Open Side Menu Go to the Top

01-14-2014 , 10:55 PM
1- Point your mouse to where you want to start. Highlight the data you want.
2- C-c
3- In Excel, Right Click -> Paste Special, press Text.

Your data may be a bit messy and you'll have to do a bit of deleting and removing of duplicate values to rid spaces, but all of this should only take about 30 seconds.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
01-16-2014 , 01:01 PM
Quote:
Originally Posted by adios
On this problem I would recommend using floating point exclusively to gain some further insight into working with floating point values. This is not at a slam on the Italainfx. His question about zero indicted to me that he would benefit a lot by using floating point to solve this problem. This problem has zero issues with precision , I will read the stack overflow article if I have a disagreement with it i will post here. Gots to go and fix some C code that is defective.
I suppose I have to preface this by saying I'm not arguing, but I do think it's somewhat important to at least clarify the problem and show the issue I was having with floats. I've had to work the past few nights so I didn't have time to respond.

The program prompts the user to enter an amount of change that I owe them. In this case we're using $.15 to show the float.

The first number is before pennies are applied to the subtraction without any rounding. What you're seeing is that using float values are not exactly 0 even though it obviously should only be a dime and nickel. If you're only looking at 2 decimal places, you're not getting the entire picture.

The second number is after the pennies are applied. Since the float value is not exactly 0, it continues through the penny statement, giving you a value of 3 coins, even though it should only be 2 (dime and nickel).



This is the same idea except I rounded the "change" variable.



My point is that there is a problem with precision when using float values. It doesn't give the wrong value on every amount. For example, it works perfectly fine when you're using other values, like $.16, $.11, $.04, etc., so you get a false sense that the program works when it actually doesn't. It works functionally, but it's not precise.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 01:52 AM
Just started my 2nd to last semester of my CS degree and glad to finally have some slightly challenging coursework. These next two semesters should be really interesting.

Would ya'll rather have a PhD professor or a professor with no PhD but actually works in and/or recently retired from the industry?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 02:15 AM
what are you teaching me?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 02:42 AM
I have three courses being taught by non-PhD adjunct professors.

Operating Systems and Database System Design (2nd half of a 2 semester database sequence) are both being taught by a professor that retired from IBM last year. He has a BS in Physics and a Masters in Electrical Engineering. He worked for many years as a performance guru mainly working on the IBM iSeries. He showed us links to a bunch of the papers he had written, told us stories about actually developing an OS, etc.

Software Engineering is being taught by an adjunct professor that also works at IBM. He is a young(ish) guy compared to the other adjunct, probably mid-30's to early 40's. I believe he also works on the iSeries. IBM has a pretty large facility here.

My other two courses this semester are Networking (first of two semester sequence) and Theory of Computation. They are both being taught by PhD professors.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 02:59 AM
i'll take the phd for theory of computation, lean toward industry experience for os, vastly prefer industry experience for the rest.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 09:14 AM
Quote:
Originally Posted by KatoKrazy
Just started my 2nd to last semester of my CS degree and glad to finally have some slightly challenging coursework. These next two semesters should be really interesting.

Would ya'll rather have a PhD professor or a professor with no PhD but actually works in and/or recently retired from the industry?
Gotta love the US of A where there are non-PhD professors, teaching professors and the like. Over here professor is a distinct title to be earned (i.e. you're not a professor just because you teach at a university). PhD->longish and painfull process->professor. I guess in US-terms all professors here have tenure/went through some tenure track process. Usually there's an extra research project/paper (habilitation) that is essentially a dissertation++ which is required before becoming a professor (so essentially you should be a postgrad phd with extra chops)

Depends on what you want to do
...if academics -> PhD guy by a mile
...if business world -> probably the other dude

But the question is have him/her for what? Just classes or MA-thesis? For classes degree and everything else are utterly unimportant, you have to see them in action and decide. Styles and motivation vary a lot.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 10:17 AM
This is obviously an all else being equal kind of question (in that if thats not true there are things I care way more about).

Almost all of my profs had a PhD, but rarely did that influence what they were teaching. It obviously an indication of knowledge, but the stuff they're researching doesn't matter a whole lot in terms of most undergrad courses.

My profs with real world experience though often used that experience to add interesting stories/perspectives to the class. I remember a prof that had worked with Intel for a long time talking about how Windows almost always got blamed for bugs in their chips*. Things like that were cool.

So for most courses I'd prefer real world experience over PhD.

* One example was that there was an Intel chip that had an overflow bug that only hit after running for something like 30 days and that crashed Windows when it did hit.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 11:41 AM
Quote:
Originally Posted by KatoKrazy
I have three courses being taught by non-PhD adjunct professors.

Operating Systems and Database System Design (2nd half of a 2 semester database sequence) are both being taught by a professor that retired from IBM last year. He has a BS in Physics and a Masters in Electrical Engineering. He worked for many years as a performance guru mainly working on the IBM iSeries. He showed us links to a bunch of the papers he had written, told us stories about actually developing an OS, etc.

Software Engineering is being taught by an adjunct professor that also works at IBM. He is a young(ish) guy compared to the other adjunct, probably mid-30's to early 40's. I believe he also works on the iSeries. IBM has a pretty large facility here.

My other two courses this semester are Networking (first of two semester sequence) and Theory of Computation. They are both being taught by PhD professors.
Most professors have industry experience too. The overall teaching quality of the person is more important than credentials.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 11:46 AM
My fishy seems to be borderline busto :O
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 08:25 PM
The only degree needed at DeVry was a bachelors to proctor the countless test re-takers...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 08:53 PM
ItalianFX: Go download PowerShell so you can copy/paste text on your Windows machine
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 10:34 PM
Has anyone here ever tried cad? I want to make a few things in cad and try a 3d printing site I heard about. Any tips?

Edit: Does anyone know if I, as a student of computer science in a proper university, can legally get a copy of auto cad for free, for non-commercial use? I know a lot of companies give free "student versions" to university students or at least I thought this was the case...

Last edited by Ryanb9; 01-17-2014 at 10:53 PM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 11:06 PM
At my school the CS computer support people had a list of software you could download for free or for a severely reduced rate. Probably worth looking into.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-17-2014 , 11:25 PM
Quote:
Originally Posted by clowntable
My fishy seems to be borderline busto :O
I don't really care what happens to OpenBSD but seriously, hard to believe OpenSSH risks losing its maintainers because they can't keep the lights on...
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 01:29 AM
This might not actually be all that clever and might have been more work than it's worth, but it felt like a nice and clean solution, so I'm sharing it here.

I'm making an android app and the user gets to select using radio buttons either "substrates," "inducers," or "inhibitors." They then see a screen with the data for their selection, plus links to the data for the other 2. I could have done something like:

if selection.equals ("substrates")
then {title = "substrates"
link1 = "inducers"
link2 = "inhibitors"}
else if ...

But that seems clunky and boring. So I created a class with 3 constants:

public static final SUBSTRATES = 0;
public static final INDUCERS = 1;
public static final INHIBITORS = 2;

And a toString(int) method that switches on the int to give you corresponding name as a String.

Then, my other code becomes simpler. When the user selects a radio button, for "inducers," for example, I can set it up:

int i = MyClass.INDUCERS
title = MyClass.toString(i)
link1 = MyClass.toString((i+1)%3)
link2 = MyClass.toString((i+2)%3)
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 02:23 AM
Anyone good with Javascript and JSP? I have next to no experience with JS.

Basically Im generating a form for each object in a list in the jsp. (Im cutting out a lot of code but this is the general idea):

Code:
<c:forEach items="${foo}" var="bar">
    <form:form id="form" method="post">
         <input type="hidden" id="formId" value="${bar.id}"/>
         <input type="submit" value="Assign"/>
     </form:form>
</c:forEach>
Im trying to write a submit method that only responds to the particular submit in the correct form.

Code:
$(document).ready(function(){

    $('#form').submit(function() {
        ...
    }
}
Obviously this only works for the first generated form, Im guessing since its using an id for the form and not a class? Anyways, if any of this has made any sense, does anyone know how I can tell it the correct form to submit? I can give each form a class name of "form-{bar.id}" but then i have no idea how to write the JS method like $('.form-{bar.id}').submit(function() because I dont know how to get the bar.id in there.

So yeah total newb, but no examples i can find are generating forms using a jstl loop.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 04:06 AM
Quote:
Originally Posted by PJo336
I can give each form a class name of "form-{bar.id}" but then i have no idea how to write the JS method like $('.form-{bar.id}').submit(function() because I dont know how to get the bar.id in there.
you can use the value of 'this' or the event object to get to info about which form was submitted

Code:
$('.form-{bar.id}').submit(function(e) { console.log(this, e) });
then just grab the class name or id and run regex or whatever to get the info you need
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 05:10 AM
Quote:
Originally Posted by e i pi
you can use the value of 'this' or the event object to get to info about which form was submitted

Code:
$('.form-{bar.id}').submit(function(e) { console.log(this, e) });
then just grab the class name or id and run regex or whatever to get the info you need
Oh man thank you, literally all I needed to add was:

var currentId = this.getAttribute("id");

where the forms id=${bar.id}. Cant believe how simple that is. Hope thats not hacky or anything.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 07:04 AM
Quote:
Originally Posted by ItalianFX
I suppose I have to preface this by saying I'm not arguing, but I do think it's somewhat important to at least clarify the problem and show the issue I was having with floats. I've had to work the past few nights so I didn't have time to respond.
Ah, don't walk on egg-shells over my comment. I didn't mean "argue" like going on a monkey-rage tearing apart phone books; I meant it in the benign sense of debate class.

In regards to the float stuff, this is probably one decent reason people often suggest learning to program with a language like Python. I say this because you can have a shell that offers immediate feedback and allows you to explore concepts quickly.

From the trusty shell, which is syntactically near enough to C that it needs no explanation:

Code:
>>> 0.33 + 0.33 + 0.33 == 0.99
True

>>> 0.33 * 3 == 0.99
True
That works out like you'd expect, but consider this now:

Code:
>>> 0.333 + 0.333 + 0.333 == 0.999
False

>>> 0.333 * 3 == 0.99
False
>>> 0.333 * 3 == 0.999
False

>>> 0.333 + 0.333 + 0.333 == 0.999
False
That doesn't seem to make any sense until:

Code:
>>> 0.333 * 3
0.9990000000000001
Yes, you could have done the above with printf() and saw the results as well, but using the shell is much quicker for these dirty explorations.

This sort of dives into a deep rabbit hole. I once wrote here about how this is all sort of fascinating, but then someone posted something on the order that "real programmers don't bother with this crap." I didn't bother debating the merits of this attitude, but I'll say that there is considerable truth to this, but I will assert that at the very minimum, you should know that this is result of the limitations of representing floating point via 2^n, and you should be aware of the issues that this creates.

First, there are many types that you will be exposed to. Int, float, and many other items. Float is pretty bad for precision because some committee decided that float only needs to be precise up to 17 places and as you seen already and see above and this is why some suggested that you should convert to Int. Int doesn't have the same odd-ball limitations as floats.

But it gets so much deeper. Certain ((ahem)) "Ivory Tower" languages internally represent floats at rationals (1/3 instead of 0.33333.....). There are many types offered by many systems and they often don't agree with English or each other. For example, in Posgtres, you'd use a "numeric" type to represent money, but in SQL Server, you actually have a "money" type. I'm sure there are languages that have "money" types and...

While there is some value in knowing all of this, I don't know if you have to know it in and out. Surely, there is a lot to be said about knowing your types and understanding why UTF-8 != ASCII among other issues, but when you are just starting, this isn't going to serve much more purpose than giving you a massive headache, so just convert that to Int and make your life easier. Considering that people with much more knowledge than either you or I have on this topic tells you to just use Int, it doesn't hurt to just go for it and ponder the issues later on.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 08:59 AM
Dave, Postgres has a money type but I never used it because most ORMs try to normalize types to the least common denominator.

I wish I could come up for a use case to modify those ORMs to support a bunch of Postgres-specific types. Some of them look really cool.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 09:50 AM
I'll be darned...

For reference, this is the docs on numeric:

Quote:
The type numeric can store numbers with a very large number of digits and perform calculations exactly. It is especially recommended for storing monetary amounts and other quantities where exactness is required.
http://www.postgresql.org/docs/9.3/s...e-numeric.html

and money type: http://www.postgresql.org/docs/9.3/s...ype-money.html

More searching suggests that money is a bit controversial, but I can lay down either way on this.

I just ran a bit of testing on this:

Code:
postgres=# create temp table mtest (m money);
CREATE TABLE

postgres=# create temp table ntest (n numeric);
CREATE TABLE

postgres=# insert into mtest values (3.99), (4.99);
INSERT 0 2

postgres=# select * from mtest;
   m   
-------
 $3.99
 $4.99
(2 rows)

postgres=# insert into ntest values (3.99), (4.99);
INSERT 0 2

postgres=# select * from ntest;
  n   
------
 3.99
 4.99
(2 rows)

postgres=# select n::money from ntest;
   n   
-------
 $3.99
 $4.99
(2 rows)
(the :: is type-coersion).

I guess it breaks down to how you want to store things internally. I don't have an opinion on this one either way, but I'm not sure how I feel about having dollar signs in my data. Sort of makes is look like strings when I really have numbers.

Other issues can derive as well. Call it pre-optimization, but how would you break the locale variable to accept different money types?

It appears that locale (which money depends on) inherits from the system and Postgres isn't immune to encoding and locale errors. Far from it. In that light, I think I'd rather stick to numeric on this one, but I would have to research it more to say yes or no. Just feels a bit too messy for my tastes so far.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 10:03 AM
As far as all the types and the ORM thing, not dealing with the encoding errors is practically reason enough to use an ORM over raw SQL. Not sure why you'd need so many different data types in your typical Rails app, but a lot of it smacks of YAGNI.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 10:10 AM
Oh, I didn't research it much. I just happened to stumble upon a postgres talk the other day where a guy had a slide that included the money type.

I mainly use ORMs for reasons like that. It's not like you jump ship between mysql and postgres on a weekly basis on the same code base / project. Database platform flexibility is probably last on my list for reasons to use an ORM.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-18-2014 , 10:19 AM
On a semi-related topic, I also wonder how can you easily setup a SQL system with no single points of failure? Can you setup some type of eventually consistent cluster for redundancy? What happens when the master dies?

In my chef adventures I came across a lot of netflix videos and they are in love with Cassandra (a nosql db) because scaling it as simple as adding a new node and everything becomes consistent. Switching masters is easy too, etc.. The main benefit to that seems to be that there's no single point of failure.

Most big sites that rely on postgres or SQL in general seem to use vertical scaling like crazy. Disqus, pinterest and stack overflow all use SQL DBs to store most of their data. In Disqus and SO's case they just vertically scale them by having a massive DB master machine.

The idea of having a single master server with 32 CPU cores, 500 gigs of RAM and 30 hard drives (no joke) scares me because what happens if that server dies?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **
$25m Guaranteed WPM on CoinPoker
Join the action now
Daily Rewards • Splash Pots • CoinRaces
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

      
m