Pages

Saturday, November 17, 2007

Working with XSLT

The project I’m supposed to be working on is going to have a large focus on XSLT. So a while ago I looked into it and had a play around.
Then did some XSLT related to the project. All was good.

But you never really learn anything unless you use it for your own requirements. So I thought: “html should be valid xml. I should be able to apply XSLT to a html page and get some values out of it”. The wiki we use at work supports an xslt tag and the page I was going to target was bash.orgs latest page. On my first few attempts, I only got errors.
So I simplified it to use a working example (just to make sure that the XSLT engine was working in the wiki); all was good.
I changed the XSLT to be as simple as possible. still good.
I then changed the source back to bash.org and it failed. Turns out that the site is invalid. Pitty.
I have a feeling that the web will change and become quite interesting when everyone adheres to well formed html.

Anyway, to the interesting point.
At one point, I was parsing an XSLT document as the source of information (since XSLT is well formed XML anyway).
It got me thinking. Could you ever write an XSLT transformer with XSLT? (probably not)
But the funny thing I thought of, the first bug tracking system. If it was done in an agile fashion, version 0.0.1 would only support creating bugs, and the bug list would look something like
* Cannot edit bugs
* Cannot resolve bugs
* Cannot assign bugs to person
* Cannot tell who created bugs
* Cannot distinguish between bug and feature request
ah, distractions. Probably should get back to work.

-= Comments
1. Mark | November 16th, 2007 at 11:03 am
“html should be valid xml. I should be able to apply XSLT to a html page and get some values out of it”
Valid XHTML is XML and you can apply transformations, but HTML isn’t well formed.

“I have a feeling that the web will change and become quite interesting when everyone adheres to well formed html.”
I don’t think we’re going to get there any time soon, when XHTML is actually supported in browsers I forsee a big shift in the way markup is generated and used, XHTML must be valid or it just dies. So people won’t be typing long strings of XHTML by hand but rather parse it with other proccesses that ensure valid, well structured markup.

It’s hard too see where we’ll end up though, while Web Standards is gaining ground - so are frameworks where the bottom line is productivity, and web standards isn’t on their prioirty list. I think we’re going to lose of people to the Flex, good luck parsing that! ASP.NET encourages you not to work with / think about the generated markup, the controls are that abstracted. This is another reason I’m really enjoying Rails at the moment, it generates clean markup, and it encourages best practice in the front-end coding.

But you can still use DOM to walk the tree of a document, even if it isn’t completely valid. Thinking about it you should be able to request a page with HttpRequest and then traverse that with DOM..maybe

xhr.open(’GET’, ‘http://www.bash.org/?latest’, false);
… do things..
var content = document.createElement(’div’);
content.innerHTML = xhr.responseText;

// Get all links In page
var linksInBashLatest = content.getElementsByTagName(’a');

It’s not as efficient or as nice as XSL but if you need to get parts of the document you should be able to it with javascript..perhaps

Wednesday, November 7, 2007

How not to start a long weekend


Low life, pathetic scum.
I think it was done at the Bayswater car park, but I didn’t actually notice when I got in the car to drive it home.

Gaa

-= Comments
1. Mark | November 8th, 2007 at 10:00 am
VINCENT
You know what some fucker did to it the other day?

LANCE
What?

VINCENT
Fuckin’ keyed it.

LANCE
Oh man, that’s fucked up.

VINCENT
Tell me about it. I had the goddamn thing in storage three years. It’s out five fuckin’ days — five days, and some dickless piece of shit fucks with it.

LANCE
They should be fuckin’ killed. No trial, no jury, straight to execution.

VINCENT
I just wish I caught ‘em doin’ it, ya know? Oh man, I’d give anything to catch ‘em doin’ it. It’a been worth his doin’ it, if I coulda just caught ‘em, you know what I mean?

LANCE
It’s chicken shit. You don’t fuck another man’s vehicle.

From hyro to ....

I’ve put this off for a while but it is worth noting now.
Lucien picked up that I added an end date on my employment history on the wiki. Now I get to say why.

I originally join HotMagna, a small agile company that focused on simple Java solutions to technical issues. About the time I joined they were bought out by hyro. Like any joining, there was a little turbulence whilst the company worked itself out and I was happy to sit through it and assist in its transformation. hyros focus has been more on creative solutions and assisting companies in advertising their services.
For the past year or so, hyro has gone from an interest to buying Synergy, acquiring Synergy and starting to integrating their business into the hyro “family”. This is where things started to get hard for me. We now had 3 companies that approach different problems and internally, solved problems in very different ways. Whilst I have no doubt that once the company as a whole works out its direction, it will be an interesting company and place to work; it has got in the way of me coding.
And there focus is definitely on me.

I want to code. I miss the days of Uni where I would wake up early Saturday and code through day and some of the night until I needed to sleep. I can’t do that in a standard business because budget is always going to get in the way.

Many have pondered what I will be doing after I leave. The most direct answer I can give is sleeping in. After that, I’m not sure.
There are a couple of options that I have available:

  • A couple of friends have caught wind of my intentions, and would be happy to work with me (more development).

  • My brother is always looking for more people to join him as an air conditioner architect.

  • I’m tempted to find out how hard it is to make money out of google ads on a website.

  • I could also chase the dream of building entry level websites for small business owners.


I’m probably not going to look for anything in December since most people will be gearing down for Christmas. I am going on holiday with the family in January so I won’t be looking for a job then either.

If I come up with anything else that might be relevant, I’ll let you know.

-= Comments
1. Andrew B Coathup | November 6th, 2007 at 11:45 pm
Leaving your first job is very hard.

Leaving and not having anything lined up is a big step.

Enjoy the summer break. There are companies out there where you can just code. If I had more time in my day then I could do that where I am. Don’t give up the coding.

I know people who have lived the dream and set up there own companies. There is still lots of money (and fun) to be had doing applications for very niche markets. The VB boys did that for all of the 90’s.

Good luck. You have made a big step.

I did the same 2 and a 1/2 years in to my first job and went travelling.

2. Xavier | November 7th, 2007 at 1:20 pm
Nice one. It really annoys me when people complain about their jobs but won’t quit.

Steve Pavlina has some really good articles on making money out of a blog (and life in general), which I’d highly recommend.

Also, come along to the melbourne ruby meetup next thursday. Always companies looking for good people, plus it’s a good crowd to have a drink with. And it’s ruby! Also, I am doing a presentation

Monday, October 8, 2007

I don’t know why cyclists get a bad name

I have nothing against people who ride bikes on the road.
Sometimes it would be nice not to have them there, but they normally don’t do anything wrong.

Then I seen this guy.

Yup, that’s right. On his bike and using a mobile.

-= Comments
1. Mark | October 8th, 2007 at 9:39 pm
You always have a camera at the ready

You just solved a riddle though, this morning I wondered why the exhausts on busses shoot out of the right side and fill my car with fumes.. It’s for the benefit of the one armed cyclists talking on mobiles, I mean he couldn’t possibly stay on his bike AND talk on the phone AND breathe fumes…

2. Matthew Delves | October 8th, 2007 at 11:59 pm
Most cyclists do use a handsfree.

As for me, just as when I’m driving, I refuse to answer the phone.

Thanks,
Matthew Delves

Monday, October 1, 2007

iTunes and meta data

I started out hating iTunes from day one, but I feel that I’m stuck with it to get videos and podcast feeds updated on my iPod video.

I have recently been ripping some of my DVD collection to the machine to keep me entertained.
The application I’m using by default uses the disks name and track information as the default name for an mp4 file. This is obviously fairly useless to someone who pants to pick a clip based on the series I’m ripping and the episode.
Not a problem, I’m used to manually changing invidual items. I’m good at it.

The problem: On a 3meg mp3, the write operation is fairly quick. You blink and the whole file is re-written. Video on the other hand is a little bigger. Using iTunes, this means that I have to wait for the whole file to be re-written before starting to re-name the next file.
This takes forever.
I know with mp3’s the meta-data is at the beginning of a file and I just checked that an mp4 file also has the meta-data near the beginning.
If it had it near the end of the file, it could have at least just changed the end of the file instead of the whole lot :(. But that would mean that anything that wanted to read the meta-data would have to work out how to jump to the meta-data section (possibly taking longer to read)
I guess since reads would occur more than writes, the file structure is read optimised.

Bah.

-= Comments
1. Zooba | October 1st, 2007 at 11:34 am
As I understand, ID3 tags have fixed length fields, which means once the tag has been created the whole file doesn’t require rewriting to modify it.

Possibly an MP4 has a similar structure, in which case getting your ripping software to put a dummy tag in the video will mean you won’t have to rewrite the entire file to modify it later. Having said that, I’ve never played around with ripping videos, but it does work with MP3s.

Saturday, September 22, 2007

Just not thinking in portals

The last few days I’ve been looking into portals and portlets, specifically JSR168 compliant ones.
Reason: Our new intranet runs as a portal and they would like some additional developers working on it.

So I started looking around. The concept is really cool. You have a site the displays content: The portal. It provides things like authentication and page layout. You then have portlets that display information. They rely on the portal to provide a way to store state and session information, but they can do anything else you want with them. They don’t have to worry about how they are presented, just that they present some information.
In the world of cool ascii:
______________
|    PORTAL    |
|  ___    ___  |
| |   |  |   | |
| |___|  |___| |
|____\____/____|
      \  /
    PORTLETS
I had a look at a few of them (pluto, jetspeed, liferay, uPortal) and was disappointed from a development point of view. I have grown fond of the hot code replacement when developing j2ee application with tomcat. I would be able to debug and change logic. I could update jsps and have them recompile the next time I hit refresh in the browser. It is great. I wanted to do the same thing with portlets since it is really just an extension of servlets.

Pluto is the apache reference implementation of a portal server. It provides the basics to get a portlet running and visible on screen. Sounds like just what I am after. Unfortunately, to get portlets deployed to the portlet container, you have to provide pluto specific configuration information for pluto to detect your portlet. This is going to hinder development rather than assist.

Jetspeed was really easy to setup and get going. I had a play around with this one a little more because it was really easy to get into. Layouts where easy to play with, colours, portlets where all just simple to add to the page. From a site building tool perspective. It was great. I deployed the testsuite from the Pluto project to find out what it was like deploying additional portlets. Deploying was ok. But when I started testing these portlets, performance seemed to have taken a walk. My cpu usage would just skyrocket for a few seconds and then stop when the page returned. Whilst Jetspeed didn’t have to have any specific configuration information in the portlet to get it to load, the only way that a portlet does become registered is if you deploy to the portlet container. This means every time I want to make a change, I have to bundle my portlet and deploy. This would also hinder development rather than assist.

Liferay is very similar to Jetspeed and I feel sorry that I am discussing it after Jetspeed because I am just going to brush over it. I played with it for a while because it had the same usable simplicity that came with Jetspeed. The only difference I noted was that when I deployed the testsuite, it didn’t seem to suffer the same performance slowdown. Since I still have to deploy every time I make a change to my application, it’s not going to help development.

I couldn’t get uPortal to work out of the box, so there is not really much I can say. But it does raise an important point. If you have something that you want the world to use, it has to work out of the box. You have to be able to download, unzip and start. The hypersonic database is really cool for providing a light database that works just connecting to it.

So I was disappointed. I couldn’t believe that I had to jump through hoops to get an portlet to be recognised by the container. So I spent some time looking into how why they can’t determine the portlet information automatically. ServletContext has a getContext call which takes the context path, but it doesn’t seem like there is a way to find out all of the contexts deployed to the application.

So, there is my rant on Java portals and portlets. Most of the information I’ve been reading is from 2003-2006 which is kinda disappointing. Either I am looking in the wrong places or JSR168 portlets haven’t taken off. I am going to take a second look to see if I can find a way to list all of the contexts because when I first looked I thought I seen an old method that has been deprecated and just returns null, but now I can’t see it.

-= Comments
1. Xavier | September 30th, 2007 at 10:19 pm
oh god we used Oracle Portal with portlets to build My.Swinburne and there were so many headaches. Maybe that was the oracle bit and not the JSR bit. It was a while ago so I don’t have any useful criticism save to say I’m sufficiently burned that I’m staying well away from any job to do with portlets…

Sunday, September 16, 2007

Nothing but net

Mum asked me today if her phone added a timestamp to pictures she took.
I checked it out while she made a hot drink.
Found out how to do it and went to show her. As I was pushing the up key to get to the right menu, the phone slipped up my hands. I fumbled to grab it but just couldn’t get a good grip.
Then it landed in my hot chocolate.
I cursed. I took a moment to laugh at the situation then cursed again as I realised I should probably make an effort to get it out.
Covered it in tissues and rushed to pull it apart.

I let it sit in the tissues a while. I cleaned the dried hot chocolate off the phone and put it back together. The first time I turned it on, the camera didn’t work. I still had to put some screws in so I pulled it apart, cleaned it a little more, did the screws up and turned it on again. Camera works again.
There seems to be a little bit of a smear on the screen and it doesn’t seem like the speaker is as loud as it used to be, but it seems like everything will work.

Not the way I wanted to start the weekend :(

-= Comments
1. Matthew Delves | September 16th, 2007 at 4:10 pm
You are fighting a loosing battle my friend.

The phone won’t last too much longer no matter how much you try.

Thanks,
Matthew Delves