The previous post on localization outlined a solution to the issue of localization - i.e. the display of your pages in multiple languages (and where appropriate currencies, time formats, etc).

In that post I highlighted the issue of memory usage when putting a resource bundle into each user’s session who differed from the default site language. Suggestion 1 was to use Coldspring to inject all resource bundles into a structure and use the locale as a key to retrieve the bundle from this structure in the Application scope. Thus, the only thing we need to store in the session is the locale string - just a few bytes per user.

This further extends Andy Jarret’s use of resourceBundle.cfc and coldspring. Rather than rewriting resourceBundle.cfc, I took the approach of creating a wrapper component which, in its init() method, populates the resource bundle structure by looping through the required locale’s and, relying on convention, pumps the locale file locations into resourceBundle.cfc to create the resource bundle and then adds the resource bundle to a structure, using the locale as the key.

First let’s take a look at this new wrapper component:
Continue reading ‘Localization in Model-Glue - Part II’

Before continuing to read, please note that there is a Part II to this post which addresses a performance issue in the following approach. However, please do continue reading because Part II assumes you have read this entire post and only makes minor changes to the code herein…

I have seen a couple of approaches to localization in Model-Glue. Personally I like the idea of having a single view page, regardless of how many languages you will support, and store the localized labels and messages in langauge files. I even extend this to the Validators that Reactor generates (more on this later).

A different approach than that of mine can be found here: Localization in Model-Glue 2
That solution involves creating pages for each locale. This is in contrast to my solution, where I have one page, but many language files.

In developing my solution, I borrowed heavily from the use of ResourceBundle here: Multi-lingual site with Model-Glue and Coldspring

However, I took it a step further to allow for a user to dynamically change the locale. I followed Andy Jarret’s approach and decided that I would inject a default locale into the main controller using the autowiring approach. So, you can take it as read that I added the same code to ColdSpring.xml and Controller.cfc as Andy did.

The next step is to give us a nice way of changing this locale. Now, when we inject the intial resource bundle into the Controller, this obviously gets saved into the Application scope so that we don’t need to keep accessing the filesystem on each page request. Every user then has that default locale. What we need now is a Controller method to change the locale. I added the following to the Controller.cfc:
Continue reading ‘Localization in Model-Glue - Part I’

In a move that brings CFML into the same arena as PHP, New Atlanta have decided that, as of June 2008, they will release their BlueDragon CFML server as free open-source. It will be available as an Eclipse J2EE project with an ant build script. What will be open-sourced will be roughly equivalent to Adobe’s ColdFusion Standard Edition, to the best of my knowledge. Additional versions will be available on a commerical basis as will the “stable” commercial version of the open-source edition.

You can read an interview with New Atlanta’s Vince Bonfanti here: http://coldfusion.dzone.com/articles/freeing-dragon-interview-vince

This is a very interesting move. Not only is there the potential that CFML will gain ground on Java/.NET/PHP in the web application space, but it also has the potential for the user community to begin driving the advancement of ColdFusion. In the past a combination of new additions by New Atlanta and Allaire/Macromedia/Adobe have been adopted into their future editions. Now I wonder if the community will enhance the open-source version, branch off from the steering-committee-controlled BlueDragon, and / or force Adobe to change their version or even go open-source themselves. Interesting months ahead…

Technorati Tags: , , ,

Here is the problem: Model-Glue scaffolds give you a nice skeleton to work with. My specific issue was with the list screens, which use a query object to populate the table in the view. If it were an iterator with records, then I would have no issue. However, Model Glue only gives the option of a query. This isn’t too bad for fairly denormalised data, but for heavily normalised tables, this represents a slight issue. If I were dealing with an iterator of reactor record objects, then I could use the getters for the linked tables and the getters for their linked tables, etc.

Here is a sample problem:

Table I am listing from: JobApplication
Links to tables: Job, Candidate
Job also links to Employer

JobApplication just holds state information about a job application. On the list page I need to display the Job Title (from Job), Candidate Name (from Candidate) and Company Name (from Employer via Job).

I did come up with a solution (though you should read UPDATE 2 for the best performing solution). What I wanted to avoid was having to go messing around with the ORMFactory that is Model Glue’s generic ORM factory for Reactor and / or Transfer. Here’s what I did…
Continue reading ‘Model-Glue / Reactor Scaffolds : List screens and those linked descriptions’

I wanted a consistent way to access application configuration settings in Model-Glue without embedding too much implementation into my views and as little as possible in the controller(s).

I found a way to do it that works well for me. I don’t know if it is best practice, but it just might be.

Source of knowledge:
http://www.nabble.com/Global-Application-Name-td7582344.html

I’ll start with a simple configuration bean I added to ColdSpring.xml:


  <bean id="genConfig" class="ModelGlue.Bean.CommonBeans.SimpleConfig">
	<property name="config">
		<map>
			<entry key="mailserver">
				<value>localhost</value>
			</entry>
			<entry key="mailuser">
				<value></value>
			</entry>
			<entry key="mailpwd">
				<value></value>
			</entry>
			<entry key="dateformat">
				<value>d/m/yyyy</value>
			</entry>
			<entry key="timeformat">
				<value>h:mm TT</value>
			</entry>
		</map>
	</property>
  </bean>

If I wanted, I could easily break this up into more beans, e.g. mailConfig and localeConfig. The ModelGlue.Bean.CommonBeans.SimpleConfig component has some simple functions/methods we can use later to access the xml settings.

Next, we add a new function to the main controller component Controller.cfc:

	<cffunction name="setGenConfig" access="public" returnType="void"
			hint="I get the config for this site">
		<cfargument name="genConfig" />

		<cfset variables._genConfig = arguments.genConfig />
	</cffunction> 

The best place to call this new function is in the onQueueComplete function in Controller.cfc because this function is always called after all events have been handled and before the page is rendered.

Add this line to that function:

<cfset arguments.event.setValue("genConfig",variables._genConfig.getConfig()) /> 

Now I can access the configuration data that was injected using ColdSpring within my view:

<cfoutput>
#dateFormat(PostDate, viewState.GetValue("genConfig").dateformat)#
#timeFormat(PostDate, viewState.GetValue("genConfig").timeformat)#
</cfoutput>

From here on, all my views will have access to viewState.GetValue(”genConfig”).config_item_name. Pretty straight forward, right?

Technorati Tags: , , ,

I’ve flirted with a lot of technologies over the years. More recently I have been working with Java - Struts with Spring, and even more recently .NET/C#/ASP.NET. They are fine architectures in their own right, and in high-end commercial systems they have a lot to offer. However, there is still something just too heavy duty about them for me. You just don’t really hit the ground running with them.

I’ve always liked Coldfusion. I started with CF 4.5 and am currently getting to grips with CF 8. In the beginning, like most people, my code was purely procedural and lacked an architecture. Sure, ColdFusion provided a lot of standardised ways of doing things, but you still ended up with real ugly code. Then I adopted a methodolgy called Fusebox - before it was a framework. It was just a good way to structure applications and tidied up the code considerably because the applications all started in the same place with an index.cfm control box including its fuses.

I never adopted the Fusebox framework (version 4+). Mostly this was because I had drifted into Java and then .NET. Here I began to discover frameworks and even did some research in the area for a CIT project. I knew about MVC going back over the years, but my first introduction to an MVC framework was with Struts. I must admit I hate Struts. It’s far too heavy-weight. I also became familiar with the light-weight Spring framework, which made a lot of sense, even if it took a long time for me to get my head around it. Spring just makes it so easy to inject objects and configuration settings into your application from the get-go. As for .NET, I can’t say I know an awful lot about it from a framework perspective… Visual Studio tends to remove you from the nuts and bolts a bit.

Which brings me back to ColdFusion. I have been trying to develop a recruitment system, mostly for my own education, but it could turn into something commercial. From past experience, I knew a framework was essential. I chose Model-Glue because it was light-weight, integrated with ColdSpring, and integrated with an Object Relation Mapper (ORM) - choice of Transfer and Reactor. I chose Reactor for the ORM because the integration seems better with Model-Glue and because Reactor seems a lot easier to setup. I did try Transfer, but found the configuration a bit overwhelming - though I do acknowledge Transfer has a lot of additional benefits like caching.

However, I’ll step back a bit. Initially I tried to start sans framework and develop my model… the usual beans and DAOs. This worked fine and I was pumping the DSN, etc, into the DAOs via the init method from a REQUEST scope variable. It’s not a terrrible way to do it, but as I continued on and looked at frameworks, I realised I was doing too much work. I had a look at Mach-II with ColdSpring and nearly got it to work with my DAOs - I was using CFCGenerator. Then I tried Transfer and found the configuration very tricky - probably because I messed up the one-to-many and many-to-one relationships. Finally when I was getting a tad frustrated I decided to give one last framework a try, so I downloaded Model-Glue. This was when I discovered scaffolds… again. You see, a couple of years ago I flirted with Ruby on Rails (I guess a lot of people did). So, the word scaffold flashed a light in my head.

So, I followed the sparse documentation on Model Glue and Reactor, not really reading up too much on ColdSpring, and started to get real results. The beauty is, you don’t need to know a whole lot about ColdSpring or Reactor with Model-Glue. You need to know a bit about the ColdSpring.xml file and you need to know how to add your tables and relationships to Reactor.xml, but that’s mostly it. The scaffold functionality allows you to generate the xml and the views. Rather than just leave the scaffolds, I copy the event handlers from Scaffolds.xml into ModelGlue.xml and copy the views from the generated folder to the main views folder. Then I customise.

I will post more about my development with these frameworks.

Technorati Tags: , , , , , , , , , , ,

Two excellent music choices

I’ve been listening to some really good choons over the past couple of days. The first is an album by Felix Laband entitled “Dark Days Exit”. It’s electronic, and uses a minimum of samples intertwined with some of Felix’s (and some friends) own instrumentals. It’s real easy listening.

The other is some music freely available to download from here. My particular favourite is mix 006. At over 2 hours, it has a fine selection of acid jazzy, loungey, deep housey, funky shit. I love it. Very nicely mixed together.

Technorati Tags: , ,

I just bought myself the fine ultraportable laptop, Lenovo’s ThinkPad X61s. Hardware-wise, this is an excellent laptop. I like the form factor with 12.1″ XGA screen. For wordprocessing and web-browsing, XGA suits the portrait page better than WXGA. 1024×768 resolution is perfectly fine for something that is going to sit right on your lap. It’s extremely light and with the 8-cell battery I bought with it, I can get amazing battery time. I had a question mark over performance, though. The reason? Windows Vista.

The laptop I got comes with 1.6GHz Centrino Duo and 1GB of RAM. I was extremely disappointed by the performance of Vista. Sure, it has a few bells and whistles, but I saw very little productivity gain from the extra features over XP. This was my first experience of Vista and I was very disappointed. I was never a great fan of XP, but I remember when I bought my ThinkPad T20 back in 2000 (still going strong, by the way, with CentOS 4 on it), that the performance of XP was very good. Booting up was very fast. I was amazed at just how slow my X61 was in booting up Vista.

After a week of frustration, issues with Firefox, intermittent crashing of OpenOffice, annoying popups, trial software I did not want, mysterious disappearance of disk space, and performance that just plain sucked, I decided I had to look for a Linux solution. I had every confidence that installing Linux, even with all the bells and whistles it has to offer, would perform very well. After some research I chose Ubuntu Linux 7.10 - a.k.a. Gutsy Gibbon. An alternative I might have considered is Novell SuSE Linux Enterprise Desktop 10 (SLED10), which has good support for the T61 (this has a different chipset than the Intel Santa-Rosa in my X61s, as far as I am aware). But, the problem with an enterprise product is that, cost aside, functional updates are very slow in arriving. Also, for those little hacks to get DivX, AVI, MediaPlayer streaming, etc, working, Ubuntu is second-to-none.

I decided I would hang-on to Vista for now and dual boot my system. The 120GB hardrive allowed for this. I followed the instructions in this wiki: Dual_boot_Vista_and_Gutsy_on_Thinkpad_x61s

An issue I had with Vista is that my system was saying there was 38GB of disk space used, but I could account for only 1/3 of that. I honestly do not know where the rest of the disk space went. I decided to resize the Vista partition to 50GB. That was tight to leave it running with just 12GB free, so I created a 30GB FAT32 partition (/share) to share between Ubuntu and Vista, as required. I created another 25GB root partition using ext3 filesystem, a 2GB swap partition and 200MB boot partition. A general rule of thumb is that Linux will use only 50% of the resources of Windows. So, I could easily survive with 25GB versus 50GB. I could also be confident that Linux would use 50% of the memory. In Vista I was constantly up at 80% of physical RAM being used. So, how much would Ubuntu use?

I was amazed at how long the resizing and partitioning took. It took almost a full day to complete!

I should also point out how I managed to run the downloaded CD images. I have an XBOX 360 for which I bought the HD-DVD player for 200 Euro. I tried this with the X61s using one of the USB ports and it worked straight away. This is good because I don’t need the docking station and I didn’t want to buy another external CD-ROM drive. Who knows… maybe there will eventually be support for HD-DVD in Linux using this drive.

I booted up the Ubuntu Live CD and found that even running from the CD, Ubuntu 7.10’s performance was comparable to Vista. That speaks volumes about how bad Vista is with 1GB of RAM. Not that 2GB of RAM would have made much difference. Just about everything that was important worked right away - wireless, the keyboard light, sleep functionality, sound, graphics, etc. A couple of things I’m not too bothered about, like the fingerprint reader. That would be nice, but I would have bought the X61s with or without it, so no big deal.

I proceded to install and it went very quickly and very smoothly. Very little interaction required. Within a short period of time I rebooted into my new Ubuntu 7.10 installation and I was really pleased with performance. It is lightening fast. I haven’t timed the boot times, but I think Ubuntu is at least twice as fast. Within a few minutes I had DivX, AVI, Windows Media streaming, etc, working. MP4 / Quicktime was a bit jittery, but it was actually better than in Vista. I haven’t tried out any of the fancy graphical features in Gnome, and I don’t even know if they work, but if they don’t, I’m pretty sure support or workarounds will arrive soon.

One issue I have read about is the heat that builds up under the right palm area above the wireless circuitry. It gets very warm, but it’s not that bad - some I have read about seem to think it’s more uncomfortable than that. The chipset is very new, so I’m quite sure these things will be ironed out.

I took a look at the physical memory usage and, sure enough, it was at just over 40%. Last week I was considering upgrading my RAM, but now I won’t bother.

So… my verdict? If you have an X61, do not have any fears about Ubuntu 7.10. You should have what you need working right off the bat. And other minor things will be resolved in time, I’m sure.

Technorati Tags: , , , ,

XBOX 360 - The 2 big questions

I have only owned my XBOX 360 since just before Christmas ‘06. Before buying it, when I was deciding on which console to buy, I researched the question of which was the best console Wii, PS3 or XBOX 360. In the end, my decision was made by availability. I had no trouble getting the XBOX 360 before Christmas, but the Wii, though released, was not generally available unless you had pre-ordered some time in advance. The PS3 was not going to be available for at least 3 more months (more when you consider the waiting lists). So, anxious to return to serious gaming after many years of being a grown-up, I decided to bite the bullet and get the XBOX 360 (I found a nice bundle in Virgin with Gears of War and got an additional 10% off with my *cough* student discount card *cough*) :)

There are so many Wii vs XBOX 360 vs PS3 blog posts, forum threads, etc, and so many heated opinions. The fact is, who cares? The XBOX 360 is a fantastic piece of engineering. The 3 x 3.2GHz CPU cores, excellent GPU, more than adequate DDR3 memory and ultra fast memory and front-side buses make the XBOX 360 a real graphics processing powerhouse even at 1080i HD (and supposedly 1080p, which it supports, but cannot easily output). Gears of War, purportedly the best game ever, is something to behold at 1080i on a 40″+ LCD or Plasma TV (especially my Sony 40W :)). Fact is, I don’t care what Wii or PS3 is like - I am enjoying nextgen game play right now with fantastic online gameplay with various “friends” around the world who I can talk to while playing.

Each console has it’s pluses. The Wii’s claim to fame is the motion sensitive controller. The PS3’s main claim to fame is the Blu-ray High Definition video player and the “9-cell processor”.

But the Wii isn’t HD and I consider graphics to be important with a nextgen console. The PS3 has lot’s of raw power, but can it be harnessed? The XBOX 360 has had a huge head start on the PS3 and many game developers will develop for XBOX 360 and port to PS3. I have heard that the PS3 is difficult to develop for with it’s complex multi-cell architecture and that the XBOX 360’s 3 core architecture is much easier and faster to develop for (especially using Microsoft Visual Studio). I’ll adopt a wait and see approach on the PS3’s power and whether it will truly ever be harnessed. Also, the XBOX 360 has an addon HD-DVD drive for when HD movies are more widely available in the likes of Xtravision and Blockbuster.

Another huge factor is the choice of games. The XBOX 360 had some real quality games to choose from, notably Gears of War and Rainbow 6: Las Vegas. And just wait for the furore surrounding Halo 3 when it comes out! The Wii has a handful of “family” games and PS3 has been slow out of the blocks. As a 30-something gamer, the Wii’s selection isn’t appealing to me, unlike the more adult and sometimes darker choices on XBOX 360.

The XBOX 360 also has an excellent online experience, with a great friends system and easily downloadable content. A web browser would be nice, but I think it’s probably best to avoid one given the Microsoft software powering the XBOX 360.

So, for 30-something gamers, the PS3 still has a lot to prove for me. Once the initial reported glitches with frame rates are fixed and a better choice of games becomes available, maybe, just maybe, the PS3 will stack up against the XBOX 360. For now, though it’s no contest. The XBOX 360 wins hands down.

—–

Question 2 is: Should I hold off buying an XBOX 360 until this mythical “Zephyr” version 2 of the XBOX 360 becomes available? The simple answer is “no”.

Zephyr, reported to have anything from 80 to 120GB of hard drive space, a smaller more quiet CPU (to reduce that annoying fan noise) and HDMI, is nothing more than a rumour. I have seen images of this supposed new version console, but they look suspiciously like modified purpose built cases. The fact is, I don’t know what the upgraded version of the XBOX 360 will be like, when it will become available (most likely just before next Christmas) or if it will ever become available.

What I do know is that Halo 3 is being developed for my version of the XBOX 360. All future games will continue to run on my version of the XBOX 360. Why? Because there are already over 10 million of us out there and growing fast. Sure, there may be a few extra things you could do like store more video or music - not a factor for me since I can stream from Media Centre. And it may be easier to connect to modern HDTVs (not a factor for me since the composite HD works very well with the Sony 40W which has plenty of HD connection options). I also would not have too many plans to download games - not the way broadband is in Ireland anyway. What would be nice is if I could connect external storage (like my Western Digital MyBook Pro 500GB external HDD storage device) using the USB interface - something I’m sure could be allowed with a software update from XBOX Live.

So, am I concerned that a newer version of the XBOX 360 might suddenly appear? Absolutely not. Would I be mad with Microsoft for doing so? Absolutely not. I like what my XBOX 360 does for me now and that won’t be diminished by what may naturally happen down the road. I don’t see myself trading in my old XBOX 360 for a new XBOX 360 when I just have no need to.

Technorati Tags: , , , , , , , , ,

My ageing IBM T20 laptop had served me well. Costing about £2,500 back in 2000, you would expect it to last the test of time. Admittedly, it has had 1 replacement screen, was on it’s 3rd hard drive, had had the memory upgraded and the battery replaced twice, but essentially it was the same laptop (unlike Trigger’s brush in Only Fools and Horses - he said his brush had served him well for 20 years, it had gone through 14 handles and 17 heads). Not quite a Ship of Theseus in my case :)

The T20 started out with Windows 2000 and ended up with CentOS 4. It was a good mix at the time between mobility and power. So, these were the main factors I used when choosing it’s replacement.

I chose the HP Pavillion dv2104eu purely on a visit to SoundStore in Blackpool shopping centre. I always do plenty of research when buying anything, so it’s not like me to just buy on the spur of the moment. However, I was suitably impressed by the features / price ratio. At 949 euro for a laptop that seemed powerful and relatively light, I was happy to make the purchase.

To say I am not happy with the laptop would be stretching it. I am in fact very happy with it - the performance is not bad, the built quality is excellent, it’s very stylish and has built-in webcam, big hard-drive and 1GB of DDR2 RAM. But, the one thing that really let’s the laptop down is the battery life. It tends to last for maybe 2 hours if I am lucky and it’s forever running out of power when on standby. I have already had to reinstall the OS (Windows XP Media Centre) once after the battery went dead and the laptop had a BSOD. It’s only one grumble, but a major one. Switching to a 12-cell battery for double the life is a solution, but will cost money and add about 0.5 kilo to the weight.

Otherwise, as I mentioned, the laptop is very good. The built-in webcam is going to be handy for things like Skype or just taking the odd photograph on the fly. There are handy ports for USB (3 in total I think), Firewire and Compact Flash (and the other flash memory card type like SD and the like. The hard-drive is large for a laptop at 120GB. There are touch sensitive buttons for immediate access to DVD, sound level, etc. While stylish, I prefer tactile buttons as these touch sensitive buttons are fiddly.

One of my favourite features is the remote control. This is handy for controlling both DVDs and PowerPoint presentations from a distance. I find this extremely useful when I lecture in UCC. I can start up the laptop, connected to a projector, and click through the presentation with the little remote. There is a neat little slot at the side of the laptop where you can store and hide the remote. A very nice little feature.

The Media Centre addition to Windows XP is very handy for streaming via my XBOX 360 (Those who know me will know I am a bit anti-Microsoft, but you can’t argue with the best console out there!). I can store video and music on my laptop and stream via the XBOX 360 Media connector to my entertainment system (40″ TV, surround, etc). Very nice :)

In summing up the laptop I would say that the performance is average (the Turion X2 1.6GHz mine has is not as good as Core 2 Duo in the other dv2000 models), the battery performance is poor, but this is somewhat compensated by the portability / weight and the abundance of features. This laptop is much better with Intel Core 2 Duo, so if you are reading this I would say, go for the Intel version which has better performance and slightly better battery performance (due to more efficient Intel architecture). Definitely worth the extra 100 - 150 euro it costs.

Overall: 3 1/2 stars out of 5

Some other (more technical) reviews of note:
From NotebookReview.com (Core 2 Duo version)
From NotebookReview.com (Turion X2 version)

Technorati Tags: , , , , , , ,