Voting is open for the Crunchies 2008 (part sponsored by TechCrunch), and right there amongst the 'big hitters' of Web 2.0 is Swype
That's some heavy competition (um, four multi-billion dollar companies) - but not all of them are 'unique'. There's two "Connect"s in the list, plus (another) web browser, (another) spin on Search, (another) Microsoft 'Live' thing... and Swype
Ever since I first saw Swype I've wanted it on my iPhone - it is COOL! Imagine if you had seen T9 back when everyone was triple-tapping without predictive text on their Nokias and Motorolas - you'd have voted for it, right (and not Microsoft Bob, or Netscape Navigator, or whatever else was 'new' back then)?
To be honest, I wouldn't have had a chance to play with Swype first-hand if I didn't know some of the guys working on it - but of everything in that list - Swype is the one thing I want RIGHT NOW.
Anyway - don't take my word for it - check out Swype and if you like what you see, vote!
Monday, 29 December 2008
Sunday, 28 December 2008
MIX 10k Challenge - entry accepted!
My MIX 10k Challenge entry is online (try it now)!
It's called exploDZ - Explore Deep Zoom - and its raison d'être is simply to help understand the structure and operation of DeepZoom images by 'exploring' them dynamically. Sure, you can read about DeepZoom and its file format, but my hope is that being able to visualize the layers and grid is more instructive (or at least a bit of fun)...
It looks like this
and should be able to parse and display any DZC/DZI/XML on the web - assuming the hosting site has a ClientAccessPolicy.xml (you can copy that one if needed).
At the very least, you can test it on these two collections:
It's called exploDZ - Explore Deep Zoom - and its raison d'être is simply to help understand the structure and operation of DeepZoom images by 'exploring' them dynamically. Sure, you can read about DeepZoom and its file format, but my hope is that being able to visualize the layers and grid is more instructive (or at least a bit of fun)...
It looks like this
and should be able to parse and display any DZC/DZI/XML on the web - assuming the hosting site has a ClientAccessPolicy.xml (you can copy that one if needed).
At the very least, you can test it on these two collections:
- http://deepzoompublisher.com/ClientBin/Cities/dzc_output.xml
- http://deepzoompublisher.com/ClientBin/GeneratedImages/dzc_output.xml
If you feel so inclined, visit exploDZ and the other entries and vote?
Using Seadragon (iPhone) with PhotoZoom content #2
Further to this post, rather than just point people to the RSS 'how-to' instructions I've uploaded a page to do the translation for you.
To access your PhotoZoom DeepZoom images in Seadragon on iPhone, go to the Add RSS Feed screen and type this Url (replacing craig with your PhotoZoom alias).
You can read more on the DeepZoomPublisher.com website, including downloading the c# code.
Here are the iPhone screens using this url http://deepzoompublisher.com/PhotoZoom/rss.aspx?user=eflaten (from the previous post)
UPDATE: Seadragon seems to CRASH sometimes when accessing some RSS feeds. I think it is fixed now -- and was related to either (or all of) the following:
Drop a comment if you experience problems with it.
To access your PhotoZoom DeepZoom images in Seadragon on iPhone, go to the Add RSS Feed screen and type this Url (replacing craig with your PhotoZoom alias).
You can read more on the DeepZoomPublisher.com website, including downloading the c# code.
Here are the iPhone screens using this url http://deepzoompublisher.com/PhotoZoom/rss.aspx?user=eflaten (from the previous post)
UPDATE: Seadragon seems to CRASH sometimes when accessing some RSS feeds. I think it is fixed now -- and was related to either (or all of) the following:
<description>
tag containing linebreaks (must be all on a single line - fixed in generated RSS)<link>
tag being too long or containing unexpected characters (fixed in generated RSS)<author>
tag not appearing EXACTLY in the format user@domain (fullname)
(I've put a fake email address in the generated RSS to 'fix')Guid
not being a 'real' GUID (instructions say it doesn't have to be, but maybe it does...)Drop a comment if you experience problems with it.
Saturday, 27 December 2008
MIX 10k Challenge
I just submitted my MIX 10k Challenge entry - so I can stop worrying about tweaking and move on to the next little project. I'll post a link if/when it's approved, but for now here is the single line of c#
and the single line of XAML
and the 'proof' that it's only 10k
I had planned to write a whole post about 'how to fit more code into 10k', but Bill's Thoughts on the MIX 10k Challenge and Adam's What can you make with 10k of Silverlight or WPF? have covered most of the tricks already... I'll just mention a handful of comments/additions below:
Bill's second suggestions is to use short class/method/property/field/variable names - single characters if possible. In the interests of 'maintainability' I did not quite go that far (using two- and three-letter acronyms) but in general the code looks like it's been obfuscated (as you can see on the class diagram, which also shows I 'missed' a couple of opportunities for refactoring)
I'd originally used human-readable names (the code was well over 20k originally, with comments) and used the Visual Studio Refactor->Rename feature to arrive at the 'compressed' version.
Bill also said "Make sure to use using statements to avoid having to specify the namespace". Good idea - but using can be even more helpful if you alias classes that you plan to use a lot. For example,
requires 50 chars for the using declaration, but nine instances of 10 chars became 1 char (Storyboard --> v) which is 81 chars less, an improvement of 31 chars :) You only need to use PropertyChangedEventHandler three times before it's more efficient to
Another one I'd expand on is "Reduce whitespace. C# can be written as a single line for the entire file". It's not just line-breaks that you can save - C# in particular can be much shorter if you remove unnecessary spaces (that the IDE inserts) around parens, braces, commas and semi-colons, and omit braces where not required (single-statement-
Another area where the IDE will frustrate you is by offering to put each of your classes, code-behinds, etc into a individual files. DON'T LET IT! there's nothing special about a code-behind file, so put ALL your code into one .cs (I put the entire codebase into
It might seem obvious, but using
Also obvious: declare variables of the same Type together ('globally' if required) and initialize them in the declaration if they need initializing. eg
Re-use variables across methods. Don't use a property where a field will do.
Use defaults to your advantage - for example don't specify
Unfortunately I don't have any hints on making 'small' applications "look good". I definitely did not inherit the Designer-gene ... for that I'd check out Jose's blog.
Good luck with your MIX 10k entry!
and the single line of XAML
and the 'proof' that it's only 10k
I had planned to write a whole post about 'how to fit more code into 10k', but Bill's Thoughts on the MIX 10k Challenge and Adam's What can you make with 10k of Silverlight or WPF? have covered most of the tricks already... I'll just mention a handful of comments/additions below:
Bill's second suggestions is to use short class/method/property/field/variable names - single characters if possible. In the interests of 'maintainability' I did not quite go that far (using two- and three-letter acronyms) but in general the code looks like it's been obfuscated (as you can see on the class diagram, which also shows I 'missed' a couple of opportunities for refactoring)
I'd originally used human-readable names (the code was well over 20k originally, with comments) and used the Visual Studio Refactor->Rename feature to arrive at the 'compressed' version.
Bill also said "Make sure to use using statements to avoid having to specify the namespace". Good idea - but using can be even more helpful if you alias classes that you plan to use a lot. For example,
using v=System.Windows.Media.Animation.Storyboard;
requires 50 chars for the using declaration, but nine instances of 10 chars became 1 char (Storyboard --> v) which is 81 chars less, an improvement of 31 chars :) You only need to use PropertyChangedEventHandler three times before it's more efficient to
using p=System.ComponentModel.PropertyChangedEventHandler;
Another one I'd expand on is "Reduce whitespace. C# can be written as a single line for the entire file". It's not just line-breaks that you can save - C# in particular can be much shorter if you remove unnecessary spaces (that the IDE inserts) around parens, braces, commas and semi-colons, and omit braces where not required (single-statement-
if
s). Not sure how space-efficient you can be with Visual Basic...Another area where the IDE will frustrate you is by offering to put each of your classes, code-behinds, etc into a individual files. DON'T LET IT! there's nothing special about a code-behind file, so put ALL your code into one .cs (I put the entire codebase into
Page.xaml.cs
). This saves you mulitple using
clauses and namespace
declarations.It might seem obvious, but using
var
instead of the Type name will always be shorter (how many Types other than int
are three chars or less?).Also obvious: declare variables of the same Type together ('globally' if required) and initialize them in the declaration if they need initializing. eg
int i,j,k=256;
rather than int i;int j; int k; k = 256;
Re-use variables across methods. Don't use a property where a field will do.
Use defaults to your advantage - for example don't specify
public protected private
if you don't need to. Think about the defaults that apply in Xaml, Databinding, etc.Unfortunately I don't have any hints on making 'small' applications "look good". I definitely did not inherit the Designer-gene ... for that I'd check out Jose's blog.
Good luck with your MIX 10k entry!
Friday, 26 December 2008
Using Seadragon (iPhone) with PhotoZoom content
UPDATE: new post 29-Dec-08
I had a question (from Erland) on this post about viewing PhotoZoom images like this on the iPhone with Seadragon.
The Seadragon Use Your Own Images page says
Until the PhotoZoom option is available, you can fairly easily create a 'shortcut' to one or more Deep Zoom images or collections using the RSS Feed option.
For example, from this PhotoZoom page you can
That short URL is a lot easier to type than those GUIDs on the PhotoZoom website; of course I've just uploaded that one as an example - you'll need to find a host to upload yours to... and here is how the image looks:
Incidentally, Seadragon Settings (in the iPhone settings area) shows a PhotoZoom option - so I'm not sure why it's missing from the application itself?
I had a question (from Erland) on this post about viewing PhotoZoom images like this on the iPhone with Seadragon.
The Seadragon Use Your Own Images page says
PhotoZoom:However that option doesn't appear (at least on my iPhone...).
Enter a PhotoZoom username. The user's content will appear in the main listing, allowing you to view their albums.
Until the PhotoZoom option is available, you can fairly easily create a 'shortcut' to one or more Deep Zoom images or collections using the RSS Feed option.
For example, from this PhotoZoom page you can
View Source
and extract this tag <param name="initParams" value="collectionUrl=http%3a%2f%2fphotozoom.mslivelabs.com%2fDZ%2f3%2fz8b0c8100950d45379c794efbc559f800%2f633654978975379998%2fcollection.xml" />
and this url http://photozoom.mslivelabs.com/ DZ/3/z8b0c8100950d45379c794efbc559f800/ 633654978975379998 /collection.xml which can be embedded in a custom RSS document (instructions) then viewed on the iPhone!That short URL is a lot easier to type than those GUIDs on the PhotoZoom website; of course I've just uploaded that one as an example - you'll need to find a host to upload yours to... and here is how the image looks:
Incidentally, Seadragon Settings (in the iPhone settings area) shows a PhotoZoom option - so I'm not sure why it's missing from the application itself?
Tuesday, 23 December 2008
Silverlight Parser Error: when to trust your instinct
I finished my entry into the MIX 2009 10k competition this morning - having been [dis|en]couraged by Andy's cool Flickr-based entry and reading that Robby's also entering.
After getting it running locally (and trimming the code down to 9,601 bytes) I decided to upload to a remote server for testing... and the problems began:
Unhandled Error in Silverlight 2 Application Code: 7014 Category: ParserError Message: illegal xml character File: XXXXX.xap Line: 1 Position: 3
Of course I was mystified... it "worked on my machine". Since I had stripped out so much from the C# and Xaml, I assumed it was the code, and set about 'fixing' it (despite a nagging doubt about why it worked locally).
Finally it occured to me to check the XAP/ZIP file I downloaded from the server, just to see that it was the same as I uploaded... AH-HA! a clue!
The Compressed (zipped) Folder is invalid or corrupted. I FTPed another build of the XAP file up, and downloaded it again. Corrupted!
What's different between my local and the server? How the files got there! The file was being corrupted during the FTP process - possibly because I am sending a binary/zip format using TEXT FTP mode (not intentionally, by the way)?
It took about 2 seconds to confirm that changing the FTP mode to I/BIN and re-uploading the XAP file fixed the problem!
If FireFTP is your favourite file transfer program, the mode is shown in the status bar - where it can also be changed by a single (and accidental) click!
Apparently Silverlight can't tell the difference between corrupted ZIP/XAP packaging and a corrupted file within it; or else the error messages don't explain that very well. If you are getting this error, my first advice is to double-check your FTP settings; drop back to the command-prompt if necessary to ensure you are using the binary mode for file transfer. In fact, whenever you're FTPing, make sure you are using the correct mode!
BTW, the 10k entry isn't anything exciting - not a game and not animation driven - but it was fun nevertheless so I'll submit it and see what happens. More to come (including a plea for 'votes') when it appears on the MIX Gallery.
After getting it running locally (and trimming the code down to 9,601 bytes) I decided to upload to a remote server for testing... and the problems began:
Unhandled Error in Silverlight 2 Application Code: 7014 Category: ParserError Message: illegal xml character File: XXXXX.xap Line: 1 Position: 3
Of course I was mystified... it "worked on my machine". Since I had stripped out so much from the C# and Xaml, I assumed it was the code, and set about 'fixing' it (despite a nagging doubt about why it worked locally).
- I looked in App.xaml to see if I had somehow introduced invalid XML
- I looked in Page.xaml for the same thing
- I checked AppManifest.xml in the project for errors
- I checked AppManifest.xaml in the XAP file as well
- I googled and found that someone fixed a similar error by updating the <object> tag to use the current Silverlight version, but mine was already correct
- I changed the file extension from XAP to ZAP (in case the server wasn't sending the file) - no difference
- I verified that I could download the XAP and ZIP files directly (to confirm the server was sending them) - yes, the file downloaded successfully
- I even managed to get a slight different error code somehow: Unhandled Error in Silverlight 2 Application Code: 5014 Category: ParserError Message: illegal xml character File: XXXXX.xap Line: 1 Position: 3
Finally it occured to me to check the XAP/ZIP file I downloaded from the server, just to see that it was the same as I uploaded... AH-HA! a clue!
The Compressed (zipped) Folder is invalid or corrupted. I FTPed another build of the XAP file up, and downloaded it again. Corrupted!
What's different between my local and the server? How the files got there! The file was being corrupted during the FTP process - possibly because I am sending a binary/zip format using TEXT FTP mode (not intentionally, by the way)?
It took about 2 seconds to confirm that changing the FTP mode to I/BIN and re-uploading the XAP file fixed the problem!
If FireFTP is your favourite file transfer program, the mode is shown in the status bar - where it can also be changed by a single (and accidental) click!
Apparently Silverlight can't tell the difference between corrupted ZIP/XAP packaging and a corrupted file within it; or else the error messages don't explain that very well. If you are getting this error, my first advice is to double-check your FTP settings; drop back to the command-prompt if necessary to ensure you are using the binary mode for file transfer. In fact, whenever you're FTPing, make sure you are using the correct mode!
BTW, the 10k entry isn't anything exciting - not a game and not animation driven - but it was fun nevertheless so I'll submit it and see what happens. More to come (including a plea for 'votes') when it appears on the MIX Gallery.
Saturday, 20 December 2008
Google Earth - New York in 3D
I promise to post something technical soon - but for now here's another OT post...
russ sent this news on the latest Google Earth update with New York in 3D. It looks awesome! Since I was only just in New York, I decided to compare a couple of photos with Google's rendering...
First, here's my photo from "Top of the Rock" at Rockefeller Center:
and Google's
And this is the view from the Westin on 43rd and 8th
and Google's (had to make a rough guess on the position of my window)
Can I have my city in 3D too now, please?
russ sent this news on the latest Google Earth update with New York in 3D. It looks awesome! Since I was only just in New York, I decided to compare a couple of photos with Google's rendering...
First, here's my photo from "Top of the Rock" at Rockefeller Center:
and Google's
And this is the view from the Westin on 43rd and 8th
and Google's (had to make a rough guess on the position of my window)
Can I have my city in 3D too now, please?
Monday, 15 December 2008
SeaDragon 'returns' - Deep Zoom on iPhone
I *love* my iPhone... and now the original Microsoft Labs codename for Deep Zoom - SeaDragon - has reappeared as the moniker for Microsoft's first iPhone application: SeaDragon Mobile!
There are some nice built-in collections to play with...
Notice the Virtual Earth Maps (Aerial, Hybrid, Roads)... SeaDragon even uses iPhone Location Services to tell me where I am! Virtual Earth on iPhone by stealth?!
It's more fun to view your own Deep Zoom images and Photosynths. Here is a collection of photos from Bhutan (created with DeepZoomPublisher) - press the [+] button in SeaDragon Mobile to Add Deep Zoom Content:
It's even easier to add a Photosynth collection (eg. CraigD)! Since there's a hook to Location Services, I wonder when I will able able to browse "Synths near me" (since Photosynth collections can be geocoded)...
You can also find or create RSS feeds of Deep Zoom images - example to come!
As Tim Heuer says, you can create your own Deep Zoom/SeaDragon images (for iPhone, and everything else) with Deep Zoom Composer too. Download SeaDragon Mobile here if you don't just search in the iPhone AppStore.
There are some nice built-in collections to play with...
Notice the Virtual Earth Maps (Aerial, Hybrid, Roads)... SeaDragon even uses iPhone Location Services to tell me where I am! Virtual Earth on iPhone by stealth?!
It's more fun to view your own Deep Zoom images and Photosynths. Here is a collection of photos from Bhutan (created with DeepZoomPublisher) - press the [+] button in SeaDragon Mobile to Add Deep Zoom Content:
It's even easier to add a Photosynth collection (eg. CraigD)! Since there's a hook to Location Services, I wonder when I will able able to browse "Synths near me" (since Photosynth collections can be geocoded)...
You can also find or create RSS feeds of Deep Zoom images - example to come!
As Tim Heuer says, you can create your own Deep Zoom/SeaDragon images (for iPhone, and everything else) with Deep Zoom Composer too. Download SeaDragon Mobile here if you don't just search in the iPhone AppStore.
Friday, 12 December 2008
'Genetic Programming' in art
"I don't know if it's art, but I like it"
Roger Alsing's Mona Lisa generated by code caught my eye immediately on my blog reader. So it was great to see he released the source code so we could all play.
Here my contributions to the 'art' gallery.
The daytime one was finished (passed the 'fit-ness' test) but the bottom one is just a screenshot of an 'evolution' still in progress. It's running at work over the weekend - will see how it looks on Monday.
Roger Alsing's Mona Lisa generated by code caught my eye immediately on my blog reader. So it was great to see he released the source code so we could all play.
Here my contributions to the 'art' gallery.
The daytime one was finished (passed the 'fit-ness' test) but the bottom one is just a screenshot of an 'evolution' still in progress. It's running at work over the weekend - will see how it looks on Monday.
Monday, 8 December 2008
Visualizing Data
I was (sadly) very disappointed with Ben Fry's Visualizing Data book. It wasn't as though it's a badly written or presented book - I just had vastly different expectations about it's content (the downside of buying unseen from Amazon, I guess).
Recently, via the MIX site and their Decry section, I found this link:
Data Visualization: Modern Approaches
which is EXACTLY what I wanted to read about in Visualizing Data. While discussion of the 'traditional' data visualization techniques (your standard graphs and pictograms, etc) is no doubt useful, in the RIA world of today we need to go the extra mile to make data not only easy-to-understand, but attractive too. There is also more and more data to understand, so incorporating multiple axes of data into a single visualization in a logical way is a secondary goal, often supported by dedicated 'designer' resources. It is these subjects that I wished were addressed in Visualizing Data, and look forward to reading about at Decry.
Other links that I like (notice the skew towards geographic data):
Part of my interest is related to Geoquery 2008 and what features it needs to be a useful thematic mapping/data visualization front-end for SQL Server 2008.
Recently, via the MIX site and their Decry section, I found this link:
Data Visualization: Modern Approaches
which is EXACTLY what I wanted to read about in Visualizing Data. While discussion of the 'traditional' data visualization techniques (your standard graphs and pictograms, etc) is no doubt useful, in the RIA world of today we need to go the extra mile to make data not only easy-to-understand, but attractive too. There is also more and more data to understand, so incorporating multiple axes of data into a single visualization in a logical way is a secondary goal, often supported by dedicated 'designer' resources. It is these subjects that I wished were addressed in Visualizing Data, and look forward to reading about at Decry.
Other links that I like (notice the skew towards geographic data):
- Thematic Mapping and Heat Maps with Virtual Earth
- Newspaper Endorsements in the 2008 Election
- 2008 election results
- the awesome Thematic Mapping blog and the post/series on Thematic Mapping In Google Earth/
Part of my interest is related to Geoquery 2008 and what features it needs to be a useful thematic mapping/data visualization front-end for SQL Server 2008.