11 EL Implicit Variables

April 7th, 2010

All the EL implicit variables are Maps except for pageContext.

To remember the attribute-holding scope objects, just remember to Pick the Right Scope Automatically and stick the word “Scope” on the end:

  • pageScope
  • requestScope
  • sessionScope
  • applicationScope

Then you have 4 param and header objects of the form : (param|header)[Values]

  • param
  • paramValues
  • header
  • headerValues
Then I just remember the last 3:
  • cookie
  • initParam
  • pageContext (not a Map, it’s the JavaBean)

Captain Pan PreVents Captain Hook

April 7th, 2010

This is (a rubbish one) just to help me remember the DD tags:

<context-param>

<param-name>n</param-name>

<param-value>v</param-value>

</context-param>

Whereas Servlet params are “in-it”:

<servlet>

<init-param>

<param-name>n</param-name>

<param-value>v</param-value>

</init-param>

</servlet

Direct a Film about Petal Ink

April 7th, 2010

I’ve made a timelapse film of some daffodils blossoming but I really should do another one of a rose with its stem split into two different bottles of ink.

Not a very interesting post, it’s just another think I need top remember from this book for my exam.

Direct a film about PeTaL INk
Boils down to:
Jsp Directives are Page, Taglib and Include

Tie up the JSP implicit variables with SCRAPROPE

April 6th, 2010

Use the acronym SCRAPROPE to remember the JSP implicit variables:

session
config
request
application
pageContext
response
out
page
exception

I should really credit Russ for coming up with the acronym. I think my attempts, SCORP RAPE and SPORE CRAP, weren’t as catchy.

Pick the Right Scope Automatically

April 6th, 2010

As I previously metioned, I’m taking the SCWCD exam tomorrow. When trying to cram for any exam I like to make up short poems, acronyms or just random chains of though. For example, I know the difference between Mitosis and Meiosis because Meiosis begins with “Meow” which is what cats do and they have four legs… anyway…

My first thing to remember is that a JspContext has a findAttribute method that I can use to Pick the Right Scope Automatically.

The acroynym, PRSA, is the order scopes are searched for attributes: Page, Request, Session, Application. You know that the S stands for Session because you can’t put attributes in a servlet. This also allows you to remember which objects can have attributes.

Head First Servlets and JSP Errata

April 6th, 2010

I’m sitting another Sun* Certification exam tomorrow to become a Sun Certified Web Component Developer (SCWCD). I’ve done a bit of revising but I’m writing this post mainly as a way to procrastinate. I should take more exams really if only as a way to get other things done. Procrastination during my final year of uni enabled me to learn how to speedsolve a Rubik’s Cube.

I’ve just read the study guide for the SCWCD exam; Head First Servlets and JSP.

It’s quite long, and pretty good at sending you to sleep in the evening, but as programming books go, it’s good in the sense you can just read it without being sat at a computer.

I made a list of mistakes I spotted whilst reading the book almost like a game that made sure I read it thoroughly. O’Reilly offer a page for people to submit errata for this book but to be honest, I can’t be bothered. They should give people free books as a reward. Maybe if I mention the name “Kathy Sierra” in this post, she’ll find this from Google and post me a book herself ;)

p140 - in bullet 6 it should be “mostly
p315 - It says only four attributes are on the exam, but if so, it’s not clear which four.
p555 - an design principle
p557 - the size attribute disappears
p580 - directional quote marks are a problem throughout the book but the sample code in question 3 tries to concatenate a String that contains un-escaped quotes that can only end in tears.
p587 - valid uses of these tags
p590 - answer E is ticked even though it is incorrect.
p598 - the reason for Q17 option D is just badly phrased.
p599 - I don’t remember reading anything about the “variable” directive, did I fall asleep at that bit or have a got a page missing?!
p654 - A Brew Master gets special descounts
p677 - Missing T - CLIENT-CERT
p694 - Q1, option C has a space in front of it. This isn’t the only example in the book either
p710 - The book randomly applies ligatures for adjacent F and I characters. Annoyingly however, it does this in the “courier new” code examples which is chosen because it is a fixed width font. Blending F and I into a single charater width looks really strange to me. I picked p710 as an example because the first line doesn’t use a ligature, but the first bullet point does.
p747 - other client components
p777 - in the bottom right, the sentence doesn’t count all 5 jars
p787 - I don’ remember there being any talk of the Composite Delegate pattern in this book

Well, that kept me busy for a few minutes, I better take the mock exam and see how badly I’m going to fail this exam…

*I’m sure the Sun certification exams will be deprecated by Friday by a bigwig in Oracle towers.

How to fix the aspect ratio on videos from Windows Movie Maker Live

February 21st, 2010

Problem:

wmv file looks squashed when played in VLC or when uploaded to youtube but looks fine when played in windows media player

Solution:

You can change the aspect ratio of a wmv file without re-encoding it with vmarchanger

Ok, hopefully you just searched for this and you’re now sorted, but here’s some background on my problem in case it helps.

I made a small video (640×480 50fps) on my 7D and wanted to slap it on youtube. I didn’t have any video editing software so grabbed Windows Live Movie Maker. After exporting the video file I found it plays in the wrong aspect ratio in all players but WMP. The app that fixed it was written by this crypto fellow over here. Thanks Crypto!

The real cause of the problem?

I didn’t use a mac.

A build that’s green, should never be seen.

January 15th, 2010

Your continuous integration server should stay green all the time. The odd broken test here and there means you get numb to the failed status on your build server, which in turn means it takes you longer to notice that the build has broken. When the build breaks, you should stop whatever you’re doing and make fixing it your top* priority. After you check in, the faster you fail the better because you haven’t had time to start thinking about your next task, and the thing you did to break the build is still fresh in your mind. That’s also why it’s so import to keep the builds fast**.

At work, we’ve just installed the Radiator View Plugin*** for Hudson which allows you to see the status of all your builds at a glance. We have a spare monitor displaying this screen in the middle of the office so that you can see if the build has failed while you’re stood around the water cooler chatting about your coffee cup metric.

There are two things that still bug me about this though:

  1. That monitor is burning up quite a bit of ‘leccy.
  2. I don’t want to waste any thought power on a green build.

The first point is obvious but the second is a little more subtle. To me, no news is good news. A green screen in the middle of the office will still get my attention, when what I really want, is to pay it no attention whatsoever. That is, unless it’s red, which is when it gets all my attention. To achieve both of these requirements****, I want the screen off when the build is fine, and on when it’s not.

Introducing… screenwaker!

screenwaker is a silly little java webstart app I knocked up that polls the build page and turns off the screen if everythings ok, but fires it back up again if anything fails. Perfect.

I’m not sure anyone else has ever faced this problem, or ever will, but there it is for you to use as you please none-the-less.

Matt

* Yes, top priority. I don’t care if you were going to the loo.

** I searched for a good article on why it’s so important to keep the build fast but couldn’t find a good one. Suggestions welcome.

*** I don’t really get the “Radiator” analogy. Surely “Dashboard” would be better?

**** Well, in an ideal world, I’d like the monitor to disappear but that is beyond the scope of this post.

Software Company Locator

January 12th, 2010

Looking software companies are near you? Looking to switch jobs or perhaps your company is looking for a local consultancy to collaborate on that big contract?

I helped Dan make this map as a quick way to find those companies:


Larger version.

We’d love it if you could contribute updates. Just log in with your Google account and click the “edit” button on the left.

Should I buy a Canon 7D in the US and carry back to the UK?

November 9th, 2009

Canon have just released the 7D and although I can’t really afford it, I have to have one!

The price difference between UK and US is pretty crazy. Here, my favourite camera shop are selling body only for £1,399. £300 less than Canon’s SRP. In New York’s B&H store you can pick it up for $1,699 (~£1,014).

As luck would have it, I’m going to NY this weekend so if I’m going to buy one, now’s the time to decide.

I saw some people on flickr discussing whether or not it was worth it, or whether you could get it through customs and so I decided to call them myself. I rang the VAT, Customs and Excise helpline and was told that it being a digital camera, it was not liable for import duty and I would only have to pay VAT (currently @ 15%). I would just declare it on arrival in the UK by going down the red channel.

I think I can get the US sales tax (~8.25% ?) knocked off the camera when I buy it if I show them my passport and tell them I’m taking it home, but I’m not sure about that. Please comment if you know…

UPDATE: I contacted them about sales tax:

Purchases in our store (and all stores in NYC) are subject to an 8.875% local sales tax. This tax is not a VAT, and cannot be recovered by non-USA visitors when returning home. All prices are listed before sales tax.

This brings the total to $1,850 (£1106), it means I can still buy the 7D for about £1,270 when you add the VAT. A saving of £130.

However, I’m also not sure the Canon warranty covers me outside the US.

UPDATE: I contacted them about warranty too:

The warranty on this product is only good inside the USA. We offer the SageMax Protection Plan which is good for worldwide warranty and accidental damage protection…

What would you do?