gregs

Uncategorized

Busy

by gregs on Aug.23, 2005, under Uncategorized

Apologies again for the lack of posts, but I have been real busy at work completing another mach-ii app. So I thought I’d share a few details about this application that went live today. You won’t be able to publicly view it, so below is a screen shot (click on the image to view a larger one) for your viewing pleasure.

CMA screenshot

So what is it? It’s an application that allows a user to search for comparable properties within a given postcode, district, town, etc… The properties are retrieved from our databases and overlayed on a multimap image of the requested area using SVG. You can then select a series of properties (by either selecting them by clicking on them via the map or from a list). Selecting allows you to view the property?s details or you can add them to a list that you wish to examine more closely. This list can then be exported as Excel or rendered as a PDF document.

The UI makes use of SVG for the rendering of the map and placement of the properties, as well as some serious dHTML for displaying the different views. All the data that drives the application is delivered using the AJAX delivery mechanism. From an implementation/developer point of view it was a whole heap of fun getting a chance to develop an “RIA” using AJAX and dHTML. Despite the debugging hell, it’s no more difficult than working with Flash Remoting and I suspect that as more work is done with AJAX the better the debugging solutions will become.

The back end is all driven by CF and the framework we used, like all of our B2B apps, is Mach-ii (our consumer site uses FuseBox). The UI makes remoting calls to our app which retrieves the requested data. The data is returned in the form of XML, where after being decompressed (we compress it server side to speed up things), XSL style sheets are applied to render the output.

Much of the credit for the implementation must go to Zac (where’s your blog mate?), and it’s been great working him on this project. More so because he is fellow developer who digs Mach-ii. To date this probably my most OO based app yet, but having had a few days to look back on it now, there are still a number of areas that we could improve upon. For the next point release we are looking at quite a few enhancements in terms of the back end and taking a serious look at Tartan to help us manage our Service Layer.

It’s been a while since I have had so much fun developing a web app again and have had a chance to work with so many different technologies in one go. And of course CF sits at the heart of it all.

Leave a Comment more...

SOUNDEX

by gregs on Aug.23, 2005, under Uncategorized

Ever wondered how Google does it's little "did you mean this..." when you carry out a search? Well we just put together something similar (though I am sure not quite as clever as the folks over at Google). From some of my previous posts you may have gleaned that I am currently working for company that deals with postcodes, local authorities and properties. The mach-ii application I mentioned in my previous post makes use of this feature as quite frequently users mistype the information. So in order to help them we use two functions to guide them along their way.

SQL:
  1. SELECT DISTINCT StreetName,CONVERT(INT, ourdB.dbo.LEVENSHTEIN(StreetName, 'the road you are looking for'))
  2. FROM ourPropertyTable
  3. WHERE soundex(StreetName) = soundex('the road you are looking for')
  4. GROUP BY StreetName
  5. ORDER BY 2

SOUNDEX is a built in MS SQL function that allows you to do sound matching for strings, which returns a list of similar sounding words to the one you were looking for. LEVENSHTEIN is an third party function that further enhances this search giving the returned set a numeric weighting to determine the accuracy of the match. With these two functions and this query you can in the event of a no results found make some suggestions as to what the end user may have been looking for.

2 Comments more...

XSLT conditional statements

by gregs on Aug.23, 2005, under Uncategorized

One of the other completely new aspects of my job has been working with xmlHTTPRequest and XML/XSL transformation. And here are a few things that I learned during my last project: you can use conditional statements. W3schools proved very helpful in getting to grips with this.

You can do if like statements:

XML:
  1. <xsl:if test="expression">
  2. Do something
  3. </xsl:if>

And if/else statements:

XML:
  1. <xsl:choose>
  2. <xsl:when test="expression">
  3. Do something
  4. </xsl:when>
  5. <xsl :o therwise>
  6. Do something else
  7. </xsl :o therwise>
  8. </xsl:choose>

The test expressions can be made up of: "=", "and", "<", "& amp;gt;" and probably a whole lot more, but I haven't come across any other ones yet.

Leave a Comment more...

du

by gregs on Aug.23, 2005, under Uncategorized

I stumbled across the following command while reading this article:

du --max-depth=1 --human-readable --total

This gives you an estimated indication of your file space usage by folder. Here is some sample output:

12K ./lost+found
2.5M ./bin
84K ./dev
3.3M ./etc
187M ./home
7.6M ./lib
1.0K ./mnt
1.0K ./opt
65M ./proc
65K ./root
2.3M ./sbin
3.0K ./tmp

There are plenty of other useful scripts and tidbits in the article.

Leave a Comment more...

Getting the QueryString using JavaScript

by gregs on Aug.23, 2005, under Uncategorized

Here is a little script that parses the query strings of your URL so that you can use them in your JavaScript code:

JavaScript:
  1. // gvs - 19/7/2005 - retrieve values from URL to be appended to the link
  2. var hasQueryString = document.URL.indexOf('?');
  3. var additionalQueryString = "";
  4. var targetUrl = "http://www.someURL.com/?with=queryString";
  5. if (hasQueryString != -1) {
  6. // Create variable from ? in the url to the end of the string
  7. additionalQueryString = document.URL.substring(hasQueryString+1, document.URL.length);
  8. targetUrl = targetUrl + "&amp;" + additionalQueryString;
  9. }

In case you are wondering what I used this for: to help debug some our AJAX UIs. Every single time a request is sent to the server, we use JavaScript to create a clickable link for us that mimics the remoting call that we can use to view the XML that is sent back to the browser (or any other problems that might occur).

Leave a Comment more...

Clearing sessions on closing the browser

by gregs on Jul.18, 2005, under Uncategorized

I keep seeing this question pop up so for google's sake here is how you can kill sessions when the user closes his or her browser.

HTML:
  1. <!--- set session coookies --->
  2. <cfif>
  3. <cfcookie name="cfid" value="#cookie.cfid#">
  4. <cfcookie name="cftoken" value="#cookie.cftoken#">
  5. </cfcookie>

Leave a Comment more...

Cycling through your history

by gregs on Jun.30, 2005, under Uncategorized

I quite often find myself cycling through the history of commands I have typed in the console window and there can be quite a few commands stored there. John, part time philosopher and all round good bloke and extraordinary at all things computing related, stopped me from monkeying around on the keyboard and showed me the following command that stopped me from having kittens when it came to finding that all important and elusive command:

CODE:
  1. history | grep "pattern"

For example while re-building qmail I was looking for the last make statement:

CODE:
  1. host:/tmp/qmail/maildrop-1.6.3# history | grep "make"
  2. 511  make man &amp;&amp; make setup check
  3. 514  make man &amp;&amp; make setup check
  4. 517  make cert
  5. 520  make &amp;&amp; make setup check
  6. 528  make &amp;&amp; make install
  7. 536  make &amp;&amp; make install-strip
  8. 541  make &amp;&amp; make install-strip &amp;&amp; make install-man
  9. 547  history | grep "make"

Then you can do !541 ("!" is pronounced bang) and this will execute: "make && make install-strip && make install-man". Sometimes working with *nix systems is just so handy and it's another feather in my cap!

Oh and John see I managed to get kittens, monkeys and hats into a post!

Leave a Comment more...

tail | grep

by gregs on Jun.30, 2005, under Uncategorized

After reading a quote on a mailing list last week about the concept behind unix tools and their focus on doing one task well and the OS allowing you to pipe several commands in one go, it dawned on me that I could do the following on log files:

CODE:
  1. tail -f /var/log/syslog | grep "named"

So as the log fills up only items where the pattern "named" is found are displayed. Very neat!

5 Comments more...

CSS organisation

by gregs on Jun.30, 2005, under Uncategorized

A few week old now, but Doug over at Stop Design has come up with yet another invaluable little trick: when working with large style sheets it can be quite a lot of work to scroll through it in order to locate a certain declaration. His tip, label your sections and prefix the label with "=" like such:

CSS:
  1. /* MISC: =Lists
  2. ----------------------------------------------- */

Since "=" is not used in CSS, doing a search for =List will quickly get you to where you need to be.

And while you are over at his site, why not read up on his latest collaborative project with Happy Cog and Jeffrey Zeldman: Cap Gemini a glorious CSS/xHTML redesign!

Leave a Comment more...

maxEvents

by gregs on Jun.30, 2005, under Uncategorized

maxEvents is used in the mach-ii framework primarily to help you not get into an infinite loop. Of course limiting the number of events can also land you in trouble as some request may require more events than currently set. Determining this number is something that you will need to figure out yourself. Ben Edwards suggests that 50 or more events is fine, however he did recommend against disabling it.

For the record you can disable the maxEvents by assigning it a negative number.

Leave a Comment more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!