Archive for October, 2007
Envy Code R coding font v0.7 preview
The next version of my Envy Code R font especially designed for programming (monospaced, easily distinguishable characters) is nearing completion and represents a very response-driven update to feedback, specifically:
- ReadOnly, Greg Jandl: Comma clarified and change applied to full quotation marks, semi-colons and various accented letters
- Adrian Bool, Greg Jandl: The slash on the zero has been redrawn to be less heavy
- jxp: The Euro symbol has been redrawn from scratch
- Aristotle Pagaltzis: Braces are more curvy and a full set of box-drawing characters have been added
- IRC: Hash sign with longer legs
I have also fleshed out a number of additional symbols and accented letters that has seen the number of code pages supported increase to 12 pages and made a large number of tweaks to the italic version which was a last-minute addition to 0.6 (PR6) and had a number of errors especially round the accented letters.
Of course what you really want to know is how the new version looks in Visual Studio with that lovely Humane theme of mine:

There is still some work to do on the sizes above and below 10 point (again) as well as fleshing out a few more symbols, letters and italicising additional letters such as a curly k and rounder e which I hope will be finished towards the end of this week.
The observant followers may have noticed a pixel has been shaved off the vertical height which now brings it in line with the bitmapped Envy Code B coding font. I had intended on making the change for some time and the box characters practically demanded it to ensure the centres were whole pixels and not off-centre but some people may not like it…
A newer version of Envy Code R is available.
[)amien
Shrinking JS or CSS is premature optimization
Rick Strahl has a post on a JavaScript minifier utility the sole job of which is to shrink the size of your JavaScript whilst making it almost impossible to read in order to save a few kilobytes.I thought I’d take a quick look at what the gain would be and fed it the latest version (1.6) of the very popular Prototype library:
| File (KB) | GZip (KB) | |
|---|---|---|
| Standard | 121.0 | 26.7 |
| Shrunk/minified | 90.5 | 22.0 |
| Saving | 30.7 | 4.7 |
The 30.7 KB saving looks great at first glance but bear in mind that external JavaScript files are cached on the client between page requests and it looses some appeal.If you also consider the fact that most browsers and clients support GZip compression and the savings there are around 4.7 KB and you might wonder if you are wasting your time.In computer science there is a term for blindly attempting to optimize systems without adequate measurement or justification and that term is premature optimization.As Sir Tony Hoare wrote (and Donald Knuth paraphrased)
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.
And he was working on computers throughout the 60′s and 70′s that had much less resources than those today.By all means if your server bandwidth is an issue delve into the stats, identify the cause and take it from there. Going with Yahoo’s YSlow plug-in for Firefox/Firebug is a great starting point but remember to analyse the statistics from your own context.
Rick’s tool had shortcomings with non-ASCII characters such as accents, symbols and non-US currency symbols which goes to show how optimization can have other unintended and undesirable effects.
[)amien
Calculating Elf-32 in C# and .NET
Because you can never have enough hashing algorithms at your disposal this one is compatible with the elf_hash function that forms part of the Executable and Linkable Format.
using System;
using System.Security.Cryptography;
public class Elf32 : HashAlgorithm {
private UInt32 hash;
public Elf32() {
Initialize();
}
public override void Initialize() {
hash = 0;
}
protected override void HashCore(byte[] buffer, int start, int length) {
hash = CalculateHash(hash, buffer, start, length);
}
protected override byte[] HashFinal() {
byte[] hashBuffer = UInt32ToBigEndianBytes(hash);
this.HashValue = hashBuffer;
return hashBuffer;
}
public override int HashSize { get { return 32; } }
public static UInt32 Compute(UInt32 polynomial, UInt32 seed, byte[] buffer) {
return CalculateHash(seed, buffer, 0, buffer.Length);
}
private static UInt32 CalculateHash(UInt32 seed, byte[] buffer, int start, int size) {
UInt32 hash = seed;
for (int i = start; i < size; i++)
unchecked {
hash = (hash << 4) + buffer[i];
UInt32 work = (hash & 0xf0000000);
if (work != 0)
hash ^= (work >> 24);
hash &= ~work;
}
return hash;
}
private byte[] UInt32ToBigEndianBytes(UInt32 x) {
return new byte[] {
(byte)((x >> 24) & 0xff),
(byte)((x >> 16) & 0xff),
(byte)((x >> 8) & 0xff),
(byte)(x & 0xff)
};
}
}
[)amien
Publishing .NET applications with prerequisites
Now .NET 3.5 is shipping I took the opportunity to update one of our internal applications and elected to have it install the necessary components (in this case the .NET Framework 3.5) using the Download prerequisites from the same location as my application option.
When trying to install the application via the IIS web server the installer would fail with a download error.
A little testing later I realised the publishing mechanism had placed .msu and .msp files for prerequisites onto the server and of course IIS 6.0 does not serve unknown MIME types.
Both .msu and .msp extensions must be added into the MIME database as application/octet-stream via MMC.
And all was well again.
[)amien
Goodbye BlogRush
I’ve now given up on BlogRush and removed the widget.
My dashboard shows that in the last 30 days I have directly earned 66,691 credits (made that number of impressions) and have been awarded 11,502 bonus credits and 3,473 referrer credits.
In return BlogRush have imprinted my last 12 blog posts (actually 11, one repeated, see below) and have sent a whole 15 visitors my way… that’s 1 visitor per 4,400 impressions which is mediocre by any measure. I get more hits than that in a month from leaving a couple of off-the-cuff comments on blog posts I’ve read elsewhere.
Apart from the mediocre conversions, some of the other problems include:
Uncontrolled spending of credits
BlogRush highly favours publicising the most recent articles regardless of hotness.
In my case it keeps putting out the More Silk Icons post despite only having 3 visitors for the 12,832 impressions whilst the older article on object initializers hasn’t got any new impressions despite getting 1 visitor for just 301 impressions.
If you have a glut of credits from a successful peak and you would rather hold on to your credits for the next post…well, tough, you can’t.
This forces you to change your posting schedule to meet your BlogRush credit balance.
Random capitalisation of post titles
It seems that BlogRush randomly changes the case of titles. Some examples include:
- Calculating CRC-64 in C# and .NET > Calculating Crc-64 In C# And .net
- AnkhSVN (Visual Studio Subversion integration) on Vista > AnkhSVN (visual Studio Subversion Integration) On Vista
- Droid font family courtesy of Google & Ascender > Droid Font Family Courtesy Of Google & Ascender
- Show Package Contents in Mac OS X > Show Package Contents In Mac Os X
- SQL Server replication blocking on clean-up job > Sql Server Replication Blocking On Cleanup Job
- Dissecting a C# Application – Inside SharpDevelop > Dissecting A C# Application – Inside Sharpdevelop
There seems to be no pattern behind it at all.
Duplication and random ignorance of content
My incredibly popular Droid Sans Mono great coding font post (42,000 hits in a week) doesn’t turn up on my BlogRush list at all.
Conversely my SQL Server replication article is treated as two different articles as I revised the title/URL.
Poor matching of content
Whilst they have introduced more specific categories my blog continued to show very unrelated posts – the whole simple categorisation system just doesn’t work especially when half the people haven’t revised from the more generic categories not have had any reminder or deadline to do so.
Something that worked off a posts tags would have been much better.
Filling the space
For now Google’s AdSense is taking the place rendering text adverts although for the default landing page it has no content for me. This apparently occurs if you are:
- Not indexed (definitely am, check out Google’s searches)
- Serving certain unspecified bad-words (every individual article gets adverts so not that)
- Nothing in your geographical region (see above)
I can only imagine the combination of words across certain posts when presented on the same page is hitting some magical figure. I hope talking about AdSense doesn’t mess it up further!
I doubt this widget will last very long – last time it was on for 3 months and earned me a whopping $9.
Ideally the site would move somewhere that can take being hit by the front page of DaringFireball again – that’s twice the sudden influx of users has knocked the site off. The first time my home DSL couldn’t take the strain, this time UHHosting kindly switched my site offoff for a couple of hours because I was “using too much CPU” – I have only WordPress, MySQL and a bunch of plug-in’s installed of which I have temporarily sacrificed FireStats, StatsPress and Gravatar2 at the sysop alter in order to keep my home online.
I have been toying with either renting a dedicated 1U server or co-locating one I buy. The latter was more tempting until I discovered that you only get 0.5 amps which is 120W for a whole server which means mirrored disks and a Core 2 chip are out…
[)amien