- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I would consult OpenOffice to see if can load the file. If that didn't work, I'd remove all non-ASCII characters from the file with Perl and read it.
Admin
So my DB knowledge is kind of lacking, which hasn't really helped my current job search. For #1 I would create a table that has 3 columns: ID - A unique ID for this node Parent - The ID for this node's parent Data - the actual data
So if I want to find the children of node 1, SELECT Data,ID FROM TreeNodes WHERE Parent=1
But that seems like it might be a pain to traverse the tree. Lots of searching. There a less WTFy way?
Admin
I would do a quick Google search on the phrase "download full questions/response". I would then read through and filter out the search results to determine which are relevant and trustworthy to the problem at hand. I would also consult with my developers/DBA, colleagues, and internal knowledge databases to see if there’s a more specific best-practice solution.
Admin
Of course the questions on the test are confusing. Duplicate conflicting and ambiguous statements are to be expected in a requirements document :P
Admin
HR droid: "The candidate did not attempt to commit murder after reading the questions." PH boss: "Tell him he's hired!"
Admin
You know what they say, if it spell checks, ship it!
Admin
And speaking of which...!
Admin
...guys, I think we've got a Linux Weenie!
Admin
Improbable; most of the modern antialiasing schemes for X11 look fuzzier even than the impressively fuzzy ClearType; fuzzy is in.
Admin
did he get the job?
Admin
Hey, I live in Cleveland! Oh wait, I live in the UK one :(
Admin
Sorry guys, which way to the nearest supermarket?
Admin
ATTENTION ALEX!!!
OK, I'll admit that Question 3 is a little confusing. It's either a REAL simple question, using the solution proposed in post#147417 by Zygo above, or its a trick question involving object oriented design and implementation. I'm pretty damn sure it's a trick question.
The problem is that object.equals(..) only returns true if the object EXACTLY equals the object in the HashSet (i.e. a.equals(b) iff a IS b). In other words, they have the same memory address, it's a dumbed down pointer comparison. So, simply passing an object with the same values as the original will not work, they are simply different, and will evaluate as such.
Since this is an object oriented question, I would override the "equals" method of the object, and replace it with something like:
This would allow any test for equality throughout the entire application to be properly assessed by ANY operation that required a true/false equality test. Game-Set-Match.
The real WTF is that it took 63+ Comments by people who are supposed to be SME's to finally point this out. Oh, and this guy is a doofus for not actually solving the problems. My professors in college would have written "You did not solve the problem, you receive no credit, and you should really consider a career in management."
Admin
You also need to define a hashCode method
Admin
Admin
An alternative SQL-approach to q2:
Admin
Here's how you solve #3 (with a JUnit test for a "program").
I'm still amazed at how many Java developers simply don't understand equals/hashCode. Read Effective Java already!
Admin
I had an interview I was doing on the telephone, where after the second technical question the guy stopped us and said "look, these questions are a bit pointless, why don't you tell me what your project is about, and I'll tell you how to implement it" :S
Admin
Honestly, the first time I looked at that email shown there I parsed it as saying that they were on a retarded search...
Admin
Dude, you failed. If you override equals(), you have to also override hashCode(). As I pointed out about 20 comments back, btw. And someone else before me.
Admin
I wrote a technical test for a c# developer position at my company. It is a simple paper & pen test we give applicants on thier first interview. It only contains questions that shouldn't need google to answer.
One candidate had a CV which really impressed us, and had everything we were looking for. They scored 1 out of 9 on thier test. For example:
Q9: Write a C# function that returns true if the input is 0 or greater than 5.
Applicants answer:
int a; if(a = 0 or >5) { return(true); } else { return(false); }
Admin
On the other hand, Alex's experience didn't even that far.
Admin
This is the 'normal' way of doing things, and generally acceptable. A less intuitive but more efficient method is to allocate 'left' and 'right' numbers to each node in the tree, starting at the top node, and working round in a circle (check the link and you'll see what I mean). This then makes your queries truly trivial, e.g. to find all children of a node, or all leaf nodes. However, it does involve renumbering some items when you add a new node.
There's a better explanation out there somewhere, but I can't find a better link than this one; I'm a database expert, not a Google expert.
http://www.sitepoint.com/article/hierarchical-data-database/2
Admin
Cleartype has to be set up for the kind of monitor you use (RGB or BGR TFT), if an image is captured with one cleartype mode and displayed on the opposite kind of monitor it is INCREDIBLY hard to focus on.
Someone with a CRT monitor should never enable cleartype (use standard font smoothing instead), as it relies on the way TFTs arrange the colours in their pixels. It is theoretically possible to make a version of cleartype for CRTs, but it hasn't yet been done.
Admin
Admin
I would, but some idiot decided it should be disabled for normal font sizes with no option to enable it. "standard font smoothing" is disabled between 7 and 13 points, i.e. between 9 and 18 pixels, on windows. Other systems exhibit similar behavior. (Actually, I think it's per-font, since Consolas is smoothed at all sizes, the sizes I listed above were for Arial)
Cleartype also uses different (better) hinting rules than standard font smoothing. It would be nice if there was a "cleartype gray" (i.e. enable the nicer hinting and smoothing at all sizes, without any subpixel wizardry) setting. Since there's not, cleartype still looks better on CRTs than 'standard', even with the colors.
Admin
No one is asking about your family tree. In computer science, a tree structure is a directed acyclic graph with indegree 0 or 1.
Admin
Admin
I dunno... if you weed out all the jobs that have clueless or annyoing HR, I imagine you'll soon get most of your nutrition by raiding discarded pizza boxes for cheese.
Admin
Hmmmmm.
I keep thinking I'll take the time out to get into Java again.
Is there a decent GUI toolset for Java out there or does it still all suck?
Captcha "bathe". Uhhh. Darn it! How does it know??
:)
Admin
What are you snarking at? Of course you have to override equals. This goes without saying, and is standard practice when creating classes.
Besides, your code is wrong. You're not overriding equals, you're overloading it.
The signature for equals is
public boolean equals(Object other)
not
public boolean equals(int someIntParameter, String someStringParameter)
the proper code would be
You might be able to eliminate the casting if you use generics, but I'd have to test it out first.
Admin
This should work for MySQL:
Assuming that the Instructor field would never be a non-NULL empty string.
Admin
I've been using Swing for years, and it has always been decent, and recently has become much better in terms of native look and feel. Two new specs expected in Java 7 (Application framework and Bean Binding) will further simplify things for developers.
Admin
Hmmm.
Mostly powerful and flexible.
Last time I did anything with Java, loooooong ago, it was a hassle trying to do UI in AWT and Swing. Has it matured since then?
Thanks in advance for any info. Right now I'm mostly shifted to C#/ASP.NET but I've been looking at JBoss and really like what I see so I was thinking about hedging my options and making sure I proficient in a non-Microsoft dev package.
Admin
People, CASE statements are basic SQL and if you don't know how to use them, you're probably not really using SQL, you're just reading and writing data.
Rich
Admin
No. There are a few cheaty ways and shortcuts but they tend to be more WTFey. With SQL, it really helps if you can limit the depth of the tree.
Rich
Admin
Admin
Personally, I like to make the most of the relational aspects and the ability of the query optimizers to pre-process certain types of data more efficiently than can be done on the front end code.
There is nothing wrong in using a database just to read and write data but if that's all you're doing with it, you're not really using SQL.
Rich
Admin
I can understand why a lot of people don't see how the Architect candidate's answer would be considered so bad. I don't mean this as a knock against anyone but you do have to have a good amount of systems design experience to get it. Allow me to spell it out. This person:
a) Treated certain complex concepts with no agreed-upon best practices - such as trees in an RDBMS - as trivial code-monkey tasks that a few minutes with Google could solve.
b) Wasted more time, effort, and words explaining how he'd solve the problems and/or why he didn't need to solve them, than he would have spent actually solving them (assuming he knew what he was doing).
c) Apparently didn't know SQL. This is completely OK for a programmer, but it's a big no-no for an architect. SQL is ubiquitous, it exists in almost every environment and is a critical part of any business system. DBAs may help to design individual tables, optimize indexes, set up maintenance plans, that sort of thing - but they are not responsible for designing the entire data model top-to-bottom. That is an architect's job.
d) Criticized the last question and threw his hands up in the air instead of either making reasonable assumptions or asking for clarification. Yes, I know the question was worded badly. Guess what - so are most requirements and functional specs. Resolving the ambiguities and inconsistencies in a fuzzy spec are primarily the job of an architect. They probably didn't intentionally word the question poorly, but even still, this person's reaction reveals terrible business instincts.
Bottom line: judging by the answers, I can only assume that he's spent the past "8.5+ years" actively avoiding any real work or learning. On the job, he probably gets things done - eventually - but maybe not as well as someone else would, and certainly not without a whole lot of attitude. Pass.
Admin
SQL Server 2005 also gives you CTEs with recursive queries, which is a far more elegant solution, although of course it's going to be platform-specific.
Those are certainly not the only ways, just the most well known... most of the ideas aren't cheating or WTFey either, they're covered in off-the-shelf books on data structures and algorithms. They aren't as simple and pretty as the generic parent-child join, but no production system is ever as simple as it's freshman academic equivalent.
Admin
Admin
I believe the goal was for the applicants to write a custom equals( Object o ) method for the custom object that was to be stored in the hashmap ...
But I have to agree with the guy, no "contains" method ever returns an Object ...
Admin
Admin
You are the first one that gets the whole question right :)
The other person that also answered made a similar query, but he didn't notice that the question asked for all courses to be displayed, and most probably got misled by the fact there the example table had no course with no instructors on it.
The actual question lacked a word or two (probably lost while being reworded), but I think it's still quite clear.
"Create a query which will print the all the courses and if one instructor is present display their name [their name == the instructor's name]"
Admin
Yeah, the HashSet onject will internally create a hashcode of the object passed by parameter, and then it will compare this hashcode to the hashcodes of all objects on the set.
Hell, that's the whole point of using a HashWhatever instead of a List: not having to use the equals() method on all objects on the list.
And you are right about contains() returning false if it's not the same onject on the same memory location. That's why the "correct" answer is overloading the equals() function so it will return true if the objects are identical, even if they are not on the same memory location :P
Addendum (2007-07-31 15:00):
P.D.: damn, and, of course, it would be nice to remember to overload HashCode() too, but the HashCode contract does not require it ^^
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Object.html#hashCode()
"It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables."
Addendum (2007-07-31 15:03): That damned 5 minutes edit limit makes me make mistakes -.-
You do need to overload HashCode too, specially on the circumstances describe by this question.....
Admin
Kind of off topic but:
Why do people constantly bitch about the quality of this site? It takes less effort to hit ctrl-w than it does to click 'Add Comment' and spray your verbal diarrhea. That annoys me more than the 'First!' and 'Captcha' posts...
PS: captcha: alarm -- wake up guyz! har har har! lolz!1
Admin
The headhunting part of the article reminds me of a dice posting I saw a few years back. They were recruiting for a hardware position, and one of the requirements was familiarity with "scuzzy controllers."
Admin
Oh boy! I can't wait to hire this architect to create high level designs and have no f'ing clue what any of it means!
Do you want an architect who can BS and give uninformed design decisions... or do you want someone who can demonstrate knowledge of the underlying components he is drawing on the whiteboard?
My favorite part is his comment about "Hey if you want me to solve this problem I'll just consult my internal knowledge database." No you won't, or you would have already done it.
Admin
I think I use the relational aspects of SQL, since I have as many left outer joins as the next guy, but I've never found much use for the case statement.
I don't have any 1-or-2-to-1 relationships (what a headache), so I typically just use the extra query required to get all the data in a many-to-one relationship. Also, I can't do too much fancy processing in database queries since it has a tendency to interfere with localization.
Admin
In fact, he sounds rather like this guy...