Tuesday, May 31, 2005

804.aspx

Improving XML performance with the LZO real time compression library

LZO is an impressive real time compression library. I got great performance improvements when compressing XML messages several years ago. The following graph shows the results on a 10Mb LAN with multiple clients using lzo 1.08:


The X-axis shows the different compression configurations. "Val 0" is the original code that does not use any compression. The other values show the results with different compression levels.:



  • 81: very fast but low compression

  • 111: standard compression

  • 982: high compression

I expected a performance improvement but the results impressed me:



  • it uses less cpu, since it does not have to manage a lot of large strings

  • drastic increase in transactions per second: it jumped from 35 to 140!

  • it uses less network bandwith (as the data is compressed)

LZO 2.0 has just been released. Real time compression of DataSets returned by WebServices will my first test case when the .NET bindings are released.

Thursday, May 26, 2005

791.aspx

Getting rid of the worst tasks on your to do list

I started reading “Getting Things Done” this month as an eBook on my Pocket PC. I completely agree with its main point: get the to do items of your mind as soon as possible and onto a trusted medium (i.e. the Pocket PC). I have done if for years (since I got my first PDA, a Palm Pro). It frees up the mind to work on more creative issues (a very important aspect if you are an architect) and in my case it makes me sleep better.


But, in the past I did two things wrong:



  1. Everything went into the to do list, even reference material that did not require any further action. As a result I passed 1.200 items in my task list :-(

  2. With a large to do list it is tempting to scan for the most “pleasant“ tasks to do

43 folders has some great tips for getting the worst items of your to do list that nicely complements Getting Things Done.


I tested it on some things that have been on my todo since Christmas. It wasn't fun to do the tasks, but it feels great to have them out of the way!

Friday, May 20, 2005

768.aspx

subText extends the life of .TEXT

It is great news that Phil Haack has forked the .TEXT code base and created subText and I cannot wait to try the first official release. I am sure Community Server is great, but I gave up upgrading and friends who have tried it went back to .TEXT. Several neat improvements are under development.


I had a look at the latest .TEXT code base when I got hit by comment spam earlier this year. It looks fairly different from the 0.95 version my site is currently running so I did not risk installing it. I ended up implementing a customized version of DB based .TEXT anti spam system using MT-blacklist..


There are several changes I will submit when I get around to explaining myself a bit better:



  • Built in, configurable, anti spam. The DB system I am using kills my poor MSDE. I have already improved the stored procedure but it can be made even smarter by only evaluating regular expressions when needed. It would be better to have support for anti spam in the front end though. Personally I don't see any need for anchors in comments. People may post URLs but they should not be rendered as anchors. People who want to follow the link can cut and paste but search engine crawlers will not follow them (I hope)

  • Fix broken links in RSS feeds in the source code instead of in the DB (either by default or by config)

  • Implement the missing hits/statistics page

  • Better "ping" support. At the moment it pings weblogs.com but there are tons more out there.

 

Tuesday, May 17, 2005

764.aspx

The latest add for Renault Scenic gives me flashbacks

The latest adds on TV for Renault Scenic plays Buddy Holly by Weezer in the background.


I will never forget that song or the video with scenes from Happy Days as it was on the Windows 95 CD. I played it countless times at full volume during the final rush for RTM while making nightly international builds of Windows 95.


You can view the video on the Weezer site

Monday, May 16, 2005

763.aspx

Blog Feed Overdose

I just had a serious blog feed overdose. Things have been busy at the home front so I have been collecting RSS feeds rather than reading. The result? 430, mostly unread, rss feeds in my bloglines account!


Time to do some spring tidying and get down to a manageable number of feeds. I have deleted most of the high traffic feeds with a high noise/value ratio and ended up with the following feeds in my "read first" category:



I still have 300 other feeds in various categories that I still have to deal with in my blogroll.

761.aspx

Mommy Microsoft will release OneCare

Windows OneCare will go in beta soon, but not after being tested on lab rats Microsoft employees first. OneCare includes:



  • Antivirus

  • A real two way firewall

  • Data backup/restore

If you feel lucky, you can even nominate yourself as a tester:



  • Sign in to BetaPlace

  • Use OneCare as the Guest ID (use the “Sign in as Guest“ link in the top level menu)

Via [B2Tblog]

Tuesday, May 10, 2005

745.aspx

Fix for broken images in .TEXT RSS feed

.TEXT replaces links to images on the local site (http://text2blogger.appspot.com/static/egilh/Images/something) with a relative urls (/blog/something). This is a feature in some scenarios as you can move the blog to a new domain without problems. It causes a problem for me though: some RSS readers are not smart enough to render images with relative links. The problem got worse after I moved my feeds to FeedBurner as my RSS feed http://feeds.feedburner.com/egilh uses relative urls to images (/blog/images/something). Some RSS readers use the link element in the RSS to correctly compose the url as http://www.egilh.com/blog/images but not all.


The links are changed before the post is insert in the DB. The latest .TEXT code base adds some new features like search, so recompiling it may add new problems. Luckily the RSS feed uses the stored procedure blog_GetConditionalEntries to extract the data so the issue can be fixed there.


I changed the stored procedure for RSS feeds (PostConfig=17). The text of the post is a text field so I could not use the tsql replace function :-( Converting to a varchar, and truncating at 8kb, is not nice as it may leave invalid XML so I had to do it the hard way:



  • Create a temporary table with the records we should return
  • Use UPDATETEXT to replace /blog/image with blog root + /blog/image
  • Return the data in the temporary table

Replace the existing blog_GetConditionalEntries stored procedure with this one after you have taken a backup to use fully qualified url to local images in .TEXT RSS feeds:

CREATE PROCEDURE blog_GetConditionalEntries
(
 @ItemCount int,
 @PostType int,
 @PostConfig int,
 @BlogID int
)
AS
DECLARE


 @FindString varchar(8000),
 @ReplaceString varchar(8000),
 @TextPointer varbinary( 16 ) ,
 @DeleteLength int,
 @Offset int



IF @PostConfig = 17
BEGIN
 -- Insert the top ItemCount records into a temporary table
 set rowcount @ItemCount
 SELECT blog_Content.BlogID, blog_Content.[ID], blog_Content.Title, blog_Content.DateAdded, blog_Content.[Text],
  blog_Content.[Description], blog_Content.SourceUrl, blog_Content.PostType, blog_Content.Author,
  blog_Content.Email, blog_Content.SourceName, blog_Content.DateUpdated, blog_Content.TitleUrl,
  blog_Content.FeedBackCount, blog_Content.ParentID, Blog_Content.PostConfig, blog_Content.EntryName,
  Blog_Config.Host, Blog_Config.Application
 INTO #fixImageUrls
 FROM blog_Content inner join Blog_Config on (Blog_Content.BlogID = Blog_Config.BlogID)
 WHERE
blog_Content.PostType=@PostType and blog_Content.BlogID = @BlogID
  and blog_Content.PostConfig & @PostConfig = @PostConfig
 ORDER BY blog_Content.[dateadded] desc
 
 
 -- Construct the find and replace strings using the NAME and HOST of the blog
 SELECT TOP 1 @FindString = '"/' + Application + '/image', @ReplaceString  = '"
http://www.' +  Host + '/' + Application + '/image'
 FROM #fixImageUrls
 
 SET @DeleteLength = len( @FindString )
 SET @OffSet = 0
 
 
 -- Replace all the occurences of FindString with ReplaceString
 WHILE ( SELECT count( * )
  FROM #fixImageUrls
  WHERE patindex( '%' + @FindString + '%', [Text]) <> 0) > 0
 BEGIN
 
  SELECT @TextPointer = textptr( [Text]), @OffSet = patindex( '%' + @FindString + '%', [Text]) - 1
  FROM #fixImageUrls
  WHERE patindex( '%' + @FindString + '%', [Text]) <> 0
 
  UPDATETEXT #fixImageUrls.[Text] @TextPointer @OffSet @DeleteLength @ReplaceString
 END
 
 
 -- Return data and drop temp table
 SELECT * FROM #fixImageUrls
 DROP TABLE #fixImageUrls



END
ELSE
BEGIN


 SET rowcount @ItemCount


 SELECT blog_Content.BlogID, blog_Content.[ID], blog_Content.Title, blog_Content.DateAdded, blog_Content.[Text], blog_Content.[Description],
  blog_Content.SourceUrl, blog_Content.PostType, blog_Content.Author, blog_Content.Email, blog_Content.SourceName, blog_Content.DateUpdated, blog_Content.TitleUrl,
  blog_Content.FeedBackCount, blog_Content.ParentID, Blog_Content.PostConfig, blog_Content.EntryName FROM blog_Content
 WHERE
blog_Content.PostType=@PostType and blog_Content.BlogID = @BlogID
  and blog_Content.PostConfig & @PostConfig = @PostConfig
 ORDER BY blog_Content.[dateadded] desc
END
GO