Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Sprawl
Nov 21, 2005


I'm a huge retarded sperglord who can't spell, but Starfleet Dental would still take me and I love them for it!

Bhaal posted:

Well no, it can't be less than the current balance. It doesn't make sense for the balance to be a larger amount BEFORE you deposit the money, so you have to check for it.
Umm so your saying if I have 5000 in my bank account and i'm trying to put in 1000 i can't because i more then 1000?

Adbot
ADBOT LOVES YOU

king_kilr
May 25, 2007

Bhaal posted:

Well no, it can't be less than the current balance. It doesn't make sense for the balance to be a larger amount BEFORE you deposit the money, so you have to check for it.
Exactly. The programmer accounted for edge case of negatives by throwing that abs() in there.

This is a phenomenal troll. Now please go away.

ColdPie
Jun 9, 2006

Sprawl posted:

I can't really understand the logic of testing the balance when all your doing is adding? Shouldn't it just be add the loving number if its a loving number?

I can't really understand the logic of using a possessive where you want to use the phrase "you are". What I'm getting at is obviously the guy is just blindly guessing at what's going on (just like you are at English). He might still be stuck at being confused about how x could possibly be equal to (x+1).

Still belongs in this thread, though. Made me chuckle.

w00tz0r
Aug 10, 2006

I'm just so god damn happy.
I have no idea how some people pass programming courses. One of my friends is taking C++ right now, and one of his classmates is the dumbest guy in the school.

Apparently when asked by the instructor how best to store a collection of strings, the guy responded confidently with "In a char".

Zombywuf
Mar 29, 2008

http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf

Y'all read that before posting about student code ok?

sonic bed head
Dec 18, 2003

this is naturual, baby!

Flobbster posted:

Can "new" in Java ever even return null? I would assume that in circumstances where that's a possibility (out of memory), you'd get shut down with the OutOfMemoryError instead before that statement had a chance to return.

It's Java, not C# and no, "new" in Java can never return null. That's why it makes no sense to me. I'm tempted to ask next time I'm told that for a bit of code that could actually throw an exception without the line throw new NullPointerException();

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
I suspect that this is a horror, but my knowledge of hashing isn't strong enough that I can prove my hunch, so I ask CoC for some assistance:
code:
// Java
public int hashCode(){
  return (int)(field1 | field2);
}
Both fields are longs. If this is as bad as I think it is, please give me as many reasons as you can think of.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Java's default distribution includes classes to do anything and everything. Writing your own hash function is a horror on its own, regardless of its contents.

zergstain
Dec 15, 2005

Mustach posted:

I suspect that this is a horror, but my knowledge of hashing isn't strong enough that I can prove my hunch, so I ask CoC for some assistance:
code:
// Java
public int hashCode(){
  return (int)(field1 | field2);
}
Both fields are longs. If this is as bad as I think it is, please give me as many reasons as you can think of.

I'm no expert either, but that looks like it would have a gazillion collisions. And what the guy above me said. This is like reinventing the wheel but making part of it flat.

ShoulderDaemon
Oct 9, 2003
support goon fund
Taco Defender

Mustach posted:

I suspect that this is a horror, but my knowledge of hashing isn't strong enough that I can prove my hunch, so I ask CoC for some assistance:
code:
// Java
public int hashCode(){
  return (int)(field1 | field2);
}
Both fields are longs. If this is as bad as I think it is, please give me as many reasons as you can think of.

If both field1 and field2 are uniformly distributed over the range of an int, and they are uncorrelated to eachother, then field1 ^ field2 would be an acceptable quick-and-dirty hash function. Using field1 | field2 even in that optimal case will be strongly biased towards returning 1s in the hash, giving a very poor hash function. If field1 and field2 are not uniformly distributed, or are correlated to eachother, then either approach will probably give a poor hash.

jandrese
Apr 3, 2007

by Tiny Fistpump
At the very least, changing it to (field1 ^ field2) would be a good start, but I suspect whomever wrote that function didn't think nearly as hard about this as anybody else in this thread.

Unless they were a genius and knew something we didn't, you would likely be better off with a real hash function, one that satisfies some of the properties of good hash functions like uniform distribution, cascade, etc...

With only 8 bytes of input though, I might be tempted to just concatenate the two fields together and use that as your key, avoiding the messiness with hashes (assuming the fields are unique in some way, you would never have to concern yourself with collisions like you do with hashes). This goes double if you're only really using a part of those fields instead of the whole (you could set up a 6 byte or even 4 byte key value depending on what those fields look like).

Murodese
Mar 6, 2007

Think you've got what it takes?
We're looking for fine Men & Women to help Protect the Australian Way of Life.

Become part of the Legend. Defence Jobs.

Zombywuf posted:

http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf

Y'all read that before posting about student code ok?

I should probably point out that they posted another paper in 2008 saying they were wrong and had failed in all subsequent testing

EssOEss
Oct 23, 2006
128-bit approved
Do you have a link to the newer paper, by any chance?

nbv4
Aug 21, 2002

by Duchess Gummybuns
code:
$ egrep -R -e recieved . | wc -l
1295

Milotic
Mar 4, 2009

9CL apologist
Slippery Tilde

nbv4 posted:

code:
$ egrep -R -e recieved . | wc -l
1295

Was that run over directories containing code, or documentation, or input XML files based on an incorrectly spelt schema? (Assuming I'm not barking up the wrong tree, not being a unix guy)

Seth Turtle
May 6, 2007

by Tiny Fistpump

Milotic posted:

Was that run over directories containing code, or documentation, or input XML files based on an incorrectly spelt schema? (Assuming I'm not barking up the wrong tree, not being a unix guy)

The joke is that 'recieved' (as shown above) is misspelled. The correct spelling is 'received'.

However, according to that egrep there, nbv4 is dealing with a codebase/xml/whatever that has that misspelling in 1295 distinct locations.

EDIT: Misspellings are terrible things. But it's cool to use words like 'klazz' in your code. Don't let anyone tell you otherwise.

Seth Turtle fucked around with this message at 23:15 on Mar 3, 2010

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

nbv4 posted:

code:
$ egrep -R -e recieved . | wc -l
1295

Didn't they teach us this in grade school?

perl -i -pe 's/(?<=c)ie/ei/g' `find .` :eng101:

csammis
Aug 26, 2003

Mental Institution

Flobbster posted:

Didn't they teach us this in grade school?

perl -i -pe 's/(?<=c)ie/ei/g' `find .` :eng101:

Except when like "A" as in "neighbor" and "weigh" :colbert:

Avenging Dentist
Oct 1, 2005

oh my god is that a circular saw that does not go in my mouth aaaaagh

csammis posted:

Except when like "A" as in "neighbor" and "weigh" :colbert:

Luckily that's wholly irrelevant to the regex!!

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

csammis posted:

Except when like "A" as in "neighbor" and "weigh" :colbert:

mariska:~ $ echo recieve | perl -pe 's/(?<=c)ie/ei/g'
receive :colbert:

mariska:~ $ echo neighbor | perl -pe 's/(?<=c)ie/ei/g'
neighbor :colbert:

mariska:~ $ echo weigh | perl -pe 's/(?<=c)ie/ei/g'
weigh :colbert:

mariska:~ $ echo species | perl -pe 's/(?<=c)ie/ei/g'
speceis :eng99:

(Yes, that's my machine name at the office :doink: )

good jovi
Dec 11, 2000

'm pro-dickgirl, and I VOTE!

Flobbster posted:

Didn't they teach us this in grade school?

perl -i -pe 's/(?<=c)ie/ei/g' `find .` :eng101:

But now you've misspelled "science" and "species", and probably a whole bunch of other words. English be dumb.

Milotic
Mar 4, 2009

9CL apologist
Slippery Tilde

Seth Turtle posted:

The joke is that 'recieved' (as shown above) is misspelled. The correct spelling is 'received'.

However, according to that egrep there, nbv4 is dealing with a codebase/xml/whatever that has that misspelling in 1295 distinct locations.

EDIT: Misspellings are terrible things. But it's cool to use words like 'klazz' in your code. Don't let anyone tell you otherwise.

No, I got the joke and the meaning of the command (I'm not completely stupid). Just 1295 occurrences of 'recieved' (sic) seems very high for pure code. Hence why asking if there was documentation or xml assets in the folders.

Seth Turtle
May 6, 2007

by Tiny Fistpump

Milotic posted:

No, I got the joke and the meaning of the command (I'm not completely stupid). Just 1295 occurrences of 'recieved' (sic) seems very high for pure code. Hence why asking if there was documentation or xml assets in the folders.

I misread your message. :downs:

nbv4
Aug 21, 2002

by Duchess Gummybuns

Milotic posted:

No, I got the joke and the meaning of the command (I'm not completely stupid). Just 1295 occurrences of 'recieved' (sic) seems very high for pure code. Hence why asking if there was documentation or xml assets in the folders.

actually the command was ran on a fairly large PHP codebase which had a variable called dual_received which appears everywhere. The misspelling is present in back-end code, front-end code, and even on the database schema. At least it's consistent... Grepping for the correctly spelled word returns 4 lines, which are all front-end template layer code.

Sebbe
Feb 29, 2004

Flobbster posted:

Didn't they teach us this in grade school?

perl -i -pe 's/(?<=c)ie/ei/g' `find .` :eng101:

Here's a better rule for you, courtesy of one of the associate editors at Merriam-Webster.

raminasi
Jan 25, 2005

a last drink with no ice

EssOEss posted:

Do you have a link to the newer paper, by any chance?

one of the authors has a website

glancing at the abstracts it looks like they have a 2008 paper that says "whoops we were wrong" but then a 2009 paper talking about how successful they were, but since that doesn't actually make sense i'm reading the papers now

Milotic
Mar 4, 2009

9CL apologist
Slippery Tilde
Bear in mind Middlesex University is ranked 86th in the country for Computer Science, and their sampling in the first paper is decidedly suspect, and at some point involves analysing handwriting because the subjects forgot their nicknames between tests. Also, the authors' tears over Oxbridge are delicious.

spiritual bypass
Feb 19, 2008

Grimey Drawer

GrumpyDoctor posted:

one of the authors has a website

glancing at the abstracts it looks like they have a 2008 paper that says "whoops we were wrong" but then a 2009 paper talking about how successful they were, but since that doesn't actually make sense i'm reading the papers now

His images are broken, the page doesn't have a title, he uses tables for layout, and all of his links go to Word documents.

Why can't CS faculty make decent web pages? It's not hard.

tef
May 30, 2004

-> some l-system crap ->
Have you seen what happens when they try to program :3:

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."

sonic bed head posted:

It's Java, not C# and no, "new" in Java can never return null. That's why it makes no sense to me. I'm tempted to ask next time I'm told that for a bit of code that could actually throw an exception without the line throw new NullPointerException();

But then what if the NullPointerException() came back as a null? :downs:

raminasi
Jan 25, 2005

a last drink with no ice
Ok the 2008 is "whoops we were wrong" and the 2009 is "we were actually right." I don't know enough about the statistical analysis methods they're using to be able to evaluate their analysis myself - maybe some of you smart people can do it.

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

GrumpyDoctor posted:

Ok the 2008 is "whoops we were wrong" and the 2009 is "we were actually right." I don't know enough about the statistical analysis methods they're using to be able to evaluate their analysis myself - maybe some of you smart people can do it.

maybe they could, you know, try it again, but this time with less data collected by accident

ErIog
Jul 11, 2001

:nsacloud:
The thing that sends a red flag up for me is that the first abstract states that there were no known discovered markers for computer programming ability other than their methods. That sort of discounting of other methods seems unprofessional to me.

I've always tied programming ability to good logical problem solving and troubleshooting skills. It doesn't make any sense that those things wouldn't be some sort of marker, even tenuous, between the two.

raminasi
Jan 25, 2005

a last drink with no ice

ErIog posted:

The thing that sends a red flag up for me is that the first abstract states that there were no known discovered markers for computer programming ability other than their methods. That sort of discounting of other methods seems unprofessional to me.

I've always tied programming ability to good logical problem solving and troubleshooting skills. It doesn't make any sense that those things wouldn't be some sort of marker, even tenuous, between the two.

While I certainly share your concerns about the quality of the work, I'm curious to know if you've ever taught introductory programming, and if you have, what your experience was, because in my opinion, the particular way that some people just don't "get" it is, quite frankly, bizarre.

ohgodwhat
Aug 6, 2005

GrumpyDoctor posted:

While I certainly share your concerns about the quality of the work, I'm curious to know if you've ever taught introductory programming, and if you have, what your experience was, because in my opinion, the particular way that some people just don't "get" it is, quite frankly, bizarre.

That's pretty much the case in any introductory course though, it isn't just programming, and it's still funny.

ErIog
Jul 11, 2001

:nsacloud:

GrumpyDoctor posted:

While I certainly share your concerns about the quality of the work, I'm curious to know if you've ever taught introductory programming, and if you have, what your experience was, because in my opinion, the particular way that some people just don't "get" it is, quite frankly, bizarre.

I've not taught programming, but I have had to design workflows for interns. I don't think there's anything really special about programming as opposed to other disciplines. There were a lot of people in my audio production classes who never ended up understanding key audio concepts. Most of them still got their degrees. They will never be very good audio engineers.

That research stems from the fact that teachers tend to take it personally when a student fails. This research wants to identify not the people who will be really good but the people who are likely to fail, and then what can be done about them.

The problem is that whole generations of kids have been raised on a steady diet of "You can do anything you want to do." that high school guidance counselors seem to just ask students what they want to do instead of investigating what that student will be most suited for. This isn't to say that people who are not suited should be barred. I know I'm not suited for math, physics, etc. I know that I could learn them fine if I spent enough time, but I know I will probably never excel in the same way in those areas as I will if I pursue the areas I am suited for.

The clueless people get into programming because they don't understand what they're getting into. They just think they kind of like computers. My point is that the research is focusing on points in the timeline that are far too late. It a systemic problem in many professions.

MononcQc
May 29, 2007

rt4 posted:

Why can't CS faculty make decent web pages? It's not hard.

Because all web devs are scrubs?

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

MononcQc posted:

Because all web devs are scrubs?

Web development is such an abomination that those of us who know :smug: real programming :smug: balk at all the bullshit you have to go through to make a website not suck.

I like Ruby on Rails though.

Nomnom Cookie
Aug 30, 2009



Flobbster posted:

Web development is such an abomination that those of us who know :smug: real programming :smug: balk at all the bullshit you have to go through to make a website not suck.

I like Ruby on Rails though.

I applied for an internship with a school district, building sites with ASP.NET. I'll probably get it, and if they offer me a job when I graduate my wife wants me to accept. :qq:

Adbot
ADBOT LOVES YOU

Milotic
Mar 4, 2009

9CL apologist
Slippery Tilde

Nomnom Cookie posted:

I applied for an internship with a school district, building sites with ASP.NET. I'll probably get it, and if they offer me a job when I graduate my wife wants me to accept. :qq:

Huh? Web development with ASP.NET is fine. There's stuff that could be improved, definitely, and how Microsoft implemented AJAX for ASP.NET can be an abomination unto God sometimes, and the page event life cycle is a bit lovely in places, but really, I've seen worse technologies and frameworks.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply