Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

learning java

On Fri, 30 Apr 2004, Derek Martin wrote:
> Isn't XML seperate and distinct from Java?  What's one got to do with
> the other?  Presumably the applications you're working with make a lot
> of use of XML?  If so, would you consider hiring someone with no
> experience working with XML?

Sure.  That wasn't intended to be a Java specific question, although the 
two do often come hand in hand.  I'll only ask XML questions if people 
list XML as a skill.  And absence of XML experience won't cost you the 

> go.  But this strikes me as mainly an academic problem... While I've
> written many segments of code to test various bits, I've never
> actually come across a need to count those that are set.  Is there a
> practical use for this problem?

Dunno.  You're right, it's an academic problem.  It was asked of me when 
I was hired and, like college frat hazing, I am passing the love onto the 
next generation :).

> I'm also curious about what some of the other suggested solutions were...  

Mostly variations on the bit mask idea.  It's interesting to see how 
people try to make a bitmask.  Somebody recently tried to use logarithms
to do it.  Some folks shrug and say that since the primitive is of a 
fixed length then don't even bother with a loop, just unroll it and have
32  "if (x & (1<<y) != 0) total+=1;" lines, changing Y.

Some folks create bit masks of size N which allow you to count the bits
at in M/N passes, instead of M, which is neat.  For instance if I said
that the problem was to count bits in a byte array then a good solution
might be to just create a 256 entry bitmask table of all the 8 bit
combinations, then just look up each byte's value in the table.

> > creating several million Integer objects when it can be done by only 
> > creating 100k.
> Not knowing Java, I couldn't write the code to do it; but the obvious
> solution seems to be to create a hash with the string as a key, and
> the frequency would be the value.

The trick is that you can't store primitives in collections in Java, so 
people end up having to create a new Integer object just to increment the 
value they already stored.  Thus, a new Integer for every entry in the
original array, rather than just a new integer  only when you create a new
entry in the hash table.

> > * Crawl all the HREFs out of a given HTML file.
> Here I would definitely apply the Google defense...  ;-)

Aw come on, a little Perl and it wouldn't be that hard.  Actually when 
this question is asked the real interesting bit is to ask how long the 
candidate thinks it would take.  If they say 2 weeks, hmmmm.....

> I'm not trying to pick on you or start a flame war, but I'm curious
> about your reasoning for asking this particular question.  LRU caches
> seem particularly of interest to people writing database code or
> operating system code, and not much else.  [I would argue that the
> cache for a web browser is a kind of database, even if the web browser
> is very different from a DBMS package.] 

And, truthfully, I haven't asked this question, another one of the guys 
here has.  It's quite common to ask programming questions using real 
problems that the team is dealing with.  We have an admitted bias toward
candidates with a formal CS education, for good or bad.  So somebody
should at least know what LRU means, for instance, and be able to take a
stab and how you'd implement one.  It by no means has to be perfect.  It's
more of a "Let me listen to how you think...." problem.


BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /