Thursday, September 27, 2007

Javascript variance in mouseclick events

You probably think that capturing mouse-click events in javascript would be a pretty easy, standardized thing these days. But personal experience has proven this not to be the case, and led to finding this excellent article about the difficulties of mouse-click events in a number of browsers. http://unixpapa.com/js/mouse.html (*note no mouse click events were harmed in the creation of this post)

Tuesday, September 25, 2007

URL rewriting

In the past I linked to an article on URL rewriting and how to do it.  This past weekend I finally modified my personal web site to use URL Rewriting.

 

I tried a couple different methods of URL Rewriting and finally settled in with http://www.urlrewriting.net as the documentation was good and the implementation fit my needs.

Essentially all that was required was to drop the urlrewriting.dll into my bin directory (adding it as a reference for my website) and adding rewriting rules to my web.config.

 

The power is in adding rewriting rules to the web.config.

You create the functionality you want as query string variables, and then create a rewriting rule.  The rewriting rule defines a regular expression of the "to be" URL and how it maps to the real url.

For example:  I am using an imagehandler.ashx file to resize images on the fly.  It takes query string parameters:

dir: the subdirectory of my pictures directory to use

file: the picture in that directory to use

width (optional): how wide to make the output picture

height (optional): how tall to make the output picture

This results in a url like this:

http://www.jessandrob.com/imagehandler.ashx?dir=Alberta-Aug-2007&file=DSC00105&width=800&height=600

Which clearly isn't to friendly.

After adding the reference I added this to the web config:

<urlrewritingnet xmlns="http://www.urlrewriting.net/schemas/config/2006/07">

<rewrites>
<add name="picture_web" 
ignorecase="true"
virtualurl="^~/gallery/web/([\d\w\s\-]*)/([\d\w\s\-]*).aspx"
destinationurl="~/ImageHandler.ashx?Path=$1&amp;File=$2.jpg&amp;width=800&amp;height=600"
rewriteurlparameter="ExcludeFromClientQueryString" />
</rewrites>
</urlrewritingnet>

After this the url becomes:

http://www.jessandrob.com/gallery/web/Alberta-Aug-2007/DSC00105.aspx

 

You can see my regular expression is matching digits, letters, whitespace, and dashes for both the directory name and the file name, and they are passed to the query string as "$1" and "$2" per standard Regex notation.

Notice its .aspx instead of .jpg - this seems to be a limitation of IIS.  using ".JPG" actually works in the Visual Studio built in web server but fails in IIS - that's something I'll have to look into in the future.

Yes its that simple.  I repeated the process for a couple other dynamic pages.

The one thing that did effect me a bit was URL's on the rewritten pages - you'll notice that the rewritten pages are deeper directory wise than the original - this is my design choice.  This caused issues on the pages mapping relative urls - specifically I needed to utilize the ASP.NET "~" operator and have the url as runat=server (this was ASP.NET figures out the relative url for me).  Where this isn't possible I have to manage the urls a bit more manually.

Trouble from Windows Live Writer?

I had some problems posting to my company blog from Windows Live Writer today. 

It looks like in the past update of Live Writer it didn't migrate my connection settings properly for Community Server (Blogger was fine).  The support of Community Server has been significantly enhanced.

I deleted my connection to Community Server and recreated it - all is fine now.

Bastard Operator from Hell

In my staff meeting today I discovered that not everyone knows of the Bastard Operator from Hell series (BOFH). 

 

The series was written 1998-2001 by Simon Travaglia, though the tourch has been carried on since.  I haven't read the latest but there was a time I eagerly awaited the next episode.

Essentially the bastard operator from hell sometimes answers the phone and is quick to doll out advise to unsuspecting callers - advise that occasionally will solve their problem, but usually will just result in removal of their computer privileges.

If you have ever had to answer the questions of the technically inept you will likely find these articles of great humor (especially if you have an appreciation for mainframe/unix systems).

 

http://bofh.ntk.net/Bastard_Indexes.html

Thursday, August 09, 2007

Exchange Hosting

A couple years ago I picked up a  Samsung  i730 smartphone, and to unleash its potential to replace my RIM pager I ended up grabbing a domain and exchange hosting.

As typical I grabbed the domain from Godaddy.com  and directed it to DSLExtreme.com's DNS servers so they could provide me with an exchange account.

This has worked like a champ for quite some time, however DSLExtreme charges $9.95/month for the exchange hosting.  Not to bad, but seems a bit expensive for the level of usage I get out of it.

I tried moving to Google Apps a few weeks ago without full success - every thing moved over just by creating CNAME pointers via GoDaddy's "Total DNS Control" tool.  Big props to Google for very good directions specific to GoDaddy in their help section (don't forget the "." on the end of the MX records!). 

I like this approach because doing granular MX records it leaves the rest of the domain at my control (should I want to host a website on the domain or any subdomains).

Biggest problem with Google Apps was sending and receiving messages from Windows Mobile.  The pop access works, however I had to search a bit to keep the messages in my inbox for more than one "send and receive".  Then once that was working the conversation threading feature caused significant cluttering of my inbox (on Windows Mobile).  Additionally polling for POP access impacts the battery life noticeably.

Last week I took a little time to review this setup one more time.  This time I utilized a hybrid approach between Google Apps and also added exchange hosting.  I ended up utilizing mail2web's personal exchange hosting for ActiveSync push to WindowsMobile.  mail2web's personal exchange hosting costs $1.99/month

In Google Apps I created a forwarding rule to forward all mail to me@mydomain, and in mail2web I set my reply-to address to me@mydomain.

This is working very well, however I still need to automate the syncing of calendar and contacts back up to google.

The FWA: Favourite Website Awards

The Favorite Website Awards is very intresting site - it has quite a list of web sites that do the web differently - most  to great effect.

It is disappointing that most of the sites rely on flash for the snazzy interface (which they could have done in AJAX).

There are some very rich web applications here showcasing some impressive creativity.

 

Check it out here.

Friday, July 27, 2007

Culture at Google

I found this excellent article where a new Microsoft hire is interviewed.  However this isn't a new hire to Microsoft - but rather a former Microsoftie that ended up working for Google, and now is coming back to Microsoft.

Most interesting to me is the discussion points here about developer productivity.  The best part is the discussion of how Google does tech support:  there is a "tech stop" on each floor where anyone can go to get a technical problem solved or swap hardware.  They use a system to track what hardware you are allowed to request (based on role) and what you have checked out.  The convenience and co-location apparently makes for a very productive situation.

Additionally the interviewee claims that quite/private space is crucial to development and that Google has that wrong - this is interesting to here as I have strongly believed in private workspaces for a long time.

The article also covers the Google "20% of time on personal projects", and organizational structure (which sounds broken to me). 

http://no2google.wordpress.com/2007/06/24/life-at-google-the-microsoftie-perspective/