elliot's blog

Learning Java

While preparing for recent job interviews, I've become painfully aware that my Java knowledge, while OK, is a bit lacking. I've never formally been taught Java, and have picked it up from hacking and a few text books. Consequently, my understanding is somewhat fractured.

What I'd like to know, then, is whether anyone can suggest a good reference book or site to get me up to speed with how to do modern Java programming. What I need are examples of good practice, including how to properly design Java applications from a test-driven perspective. Examples of decent Java patterns at a lower level (error handling, scope and size of methods, the Java idiom) would also be useful. Any suggestions?

Brian Wood, this one's for you

A few people have said they'd like to see an official Last.fm Drupal module, hosted on CVS. I have been using it on my own site, but I have hacked Drupal itself so I can set a timeout for HTTP requests when using drupal_http_request(). My reason for doing this was because Last.fm seems to timeout quite often, and Drupal won't stay up on my hosting if a module times out. This is a bit unfortunate. My development on it has stalled, as it appears finding another job is itself a full-time job. I've also shifted from Drupal stuff to exploring the Zend Framework, as I want to find a decent way to develop PHP applications as properly as possible.

Brian Wood, who has written some patches and done some work on this himself, is being far more active than me in adding functionality to this module, so I've suggested he become its custodian. So attached below is the latest version of my Last.fm module, without the patch to drupal_http_request(). It's primarily here so Brian can see what I've been doing with it. Hopefully he'll be able to pull something together and release it officially.

By the way, the thing I'd like to see in Drupal is a generic way to fetch data from a service and transform it. So far, I've used/written code which does this for Flickr, Last.fm, AllConsuming and TextLinkAds in this site. Each time, the module is using different, replicated code. It would be nice to have a proper Drupal API for this kind of stuff, don't you think? Perhaps there is one already and I just don't know about it.

The Python Challenge

(...where "challenge" is the operative word.)

Update: In the end, after an hour of trying, I had to give in and find a clue for level 5. I missed an obvious clue, which I realised when I found this solution.

After a suggestion from SteveA in the comments to my last post, I've been working on the Python Challenge. I was quite pleased with myself for the first 4 levels, which I finished with a little bit of huffing and puffing (for example, on level 3, I was getting the right matches, but not doing the right thing with them to get the next URL). Level 5 is an utter pig. I've got so far as unpickling the data, but then I'm not 100% sure what to do with it next. It's a list of lists of tuples, which presumably map onto some data structure, but I'm not sure what. I will persist. It's pretty good fun, though I think it is perhaps overly cryptic. I think there should be slightly more clues about what to do.

External validation of programming skill

We've had some bad news here over the past week or so: OpenAdvantage will go under wraps at the end of September. No money is available for the project to continue, so, consequently, we're all job hunting. This has resulted in a lot of soul-searching for me, an urge to hone my skills, and a need to work out what I'm really capable of. I started looking around on the web for self-tests I could use to determine my skill level and find out where I'm rusty. Like many open source types, I can turn my hand to pretty much anything, but have few certificates to prove it. The training courses for Linux certification, MySQL, etc. are very expensive and time-consuming; I was looking for something cheap and quick, to provide a rough indicator of my skill level. Here are a few resources I found useful:

  • JavaBat is a series of free, online Java practice problems. They are pretty simple, but very useful for reminding me of some parts of Java I'd otherwise ignore.
  • oDesk is a marketplace for remote workers. You can put your profile up there, bid for jobs, search for work, build teams, post jobs etc., all from the comfort of your web browser. The reason I like it is that they have a series of free tests you can take, which you can use to get some proof of your skills. Given that there are around 18,000 contractors on there, a potential employer can get an idea of where your skills sit within that pool. For example, I scored 3.6 out of 5 on the Ruby on Rails test, putting me at rank 15 in the pool of 83 people who've taken the test (of which 49 passed). You can see my profile here.
  • BrainBench is another US company providing some online tests for free, and lots more if you pay. My public transcript demonstrates I'm a bit rusty on Java, but better than I thought on Apache (3.99 out of 5, in the top 14% of test takers). Perhaps I should be an Apache administrator... You can also add your BrainBench certifications to oDesk, which is pretty nifty.
  • Transcender provides a range of free Microsoft (gasp! shock! horror!) tests for download, to practice for the MCSE exams. I'd always been intrigued by this qualification, and wanted to find out how whether it was actually difficult, so I did a few of the tests. I tried the one on .NET (bearing in mind I've never written more than about 6 lines of it), and I managed 40% on a multiple-choice test. Even more astonishing was that I scored 60% on the SQL Server test, and have hardly used it (though I did do a SQL Server course about 6 years ago). Ironically, the harder tests seemed easier to me, because they are more generically about design than specifics of the applications or languages. The SQL Server one, for example, gives you a case study and asks you to build the application to fit the requirements, which I've done plenty of.
  • I also found out about the CIW (Certified Internet Webmaster) qualification, which I'd seen as requirements for a couple of job adverts. Anyone heard of this or have it? I've ordered a cheap second-hand book from Amazon because it might be worth reading up and taking the exam (for £90).

Even though these services haven't had widespread coverage or acceptance in the UK, they're better than nothing, and a quick way to brush up your skills and identify your strengths. It's occurred to me over the past couple of weeks that programmers need external validation, particularly those of us who work with open source. I'd like to see cheaper, more readily-available courses available for normal developers who work independently or in their spare time, to help fill this need.

If anyone knows of any other self-tests (e.g. where's a good place to sharpen my Python skills?), please add a comment.

Removing a password from a PDF on Linux

I just bought a PDF, legally, from a publisher's website. However, in their wisdom, they decided it would be a good idea to password protect all legally-purchased PDFs. This means that each time you open the PDF using Acrobat Reader, you have to remember and type in the password to read it. (Evince, the built-in PDF viewer in Linux, allows you to permanently save the password, but I tend to use Acrobat as it copes better with some PDFs.)

So, if you know the password for a PDF and want to remove it, you can use the command line tools pdftops and ps2pdf to free your PDF from its chains.

  • Install pdftops. On Ubuntu, you can do:
    apt-get install xpdf-utils
  • Install ps2pdf. I think this is already included with a default Ubuntu.
  • Convert the PDF to a postscript file, using the password:
    pdftops -upw <password> <file>.pdf
  • Convert the resulting postscript (which is now sans password) back to a PDF:
    ps2pdf <file>.ps

The only thing you lose are any PDF-specific features which don't translate to postscript, e.g. hyperlinks.

Remember, this only works if you know the password for the PDF: it doesn't break the PDF password for you.

Dell laptops with Ubuntu have arrived

Finally, you can now, in the UK, buy a laptop with Ubuntu pre-installed. This is fantastic news. I'll definitely be getting my next laptop there. Just imagine: a laptop with no hardware/Linux compatibility issues. How cool that would be?

I tried putting one together and managed to get 2048Mb RAM, dual core 1.73GHz Celeron processor, plus the basics (basic DVD/CDRW drive, no accidental damage cover, basic screen etc.) for £512. Not bad at all.

The Two Petes

Some tracks by a misguided but utterly engaging pub band. Their rendition of Macarthur Park seguing into Popcorn has to be heard to be believed, including a slightly out-there moog solo. The singer sounds like the pub singer as rendered by Vic Reeves.

LUGRadio Live this weekend

LUGRadio Live 2007 is running tomorrow and Sunday. I can't make tomorrow (which is a shame, as most of the good talks seem to be on Saturday), but will be popping in for Sunday. See you there if you're going. If you're not going, I'd recommend it if you're at all interested in free and open source software: I've been to the previous two events, and thoroughly enjoyed both. This year (unlike last year) I'm not doing any talks or BOF sessions, so will be able to just have a good nose around and enjoy the talks. At £5 to get in, it's a snip.

Open source showcase report

The Open Source Showcase at OpenAdvantage on 20th June 2007 was a great event. I enjoyed putting it together (along with the other staff at OpenAdvantage, of course), and was pleased at the turnout (50 people) and the number of speakers we managed to get (13). Despite my chicken timer (to keep speakers to the 10 minute time limit) almost breaking, everything went swimmingly. Though it was a bit like a wedding, in that I was so busy trying to organise everybody that I didn't get to sit and enjoy it; I just hope the attendees and speakers found it fruitful.

I've written up a report on the event on the OpenAdvantage website.

Syndicate content