/egilh

Learning by doing

August 2004 Entries

Once upon a time…. I needed a smart way to cache data in memory. It should have a fixed expire date but also be smart enough to delete items that were not used in a long time. Frist I implemented a very simple system using a HashTable with a garbage collection thread. A simplified version: private static System.Collections.Hashtable _memoryCollection = new System.Collections.Hashtable(); public void setItem(CacheItem cacheItem){ _memoryCollection[cacheItem.cacheID] = cacheItem;} public CacheItem getItem(string cacheID) { CacheItem cacheItem = (CacheItem) _memoryCollection[cacheID]; if (null != cacheItem) { // Note; no interlocked. Who ...

Microsoft .NET Framework 1.1 Service Pack 1 available for download. The primary focus of Microsoft .NET Framework 1.1 Service Pack 1 (SP1) is improved security. In addition, the service pack includes roll-ups of all reported customer issues found after the release of the Microsoft .NET Framework 1.1. Of particular note, SP1 provides better support for consuming WSDL documents, Data Execution prevention and protection from security issues such as buffer overruns.SP1 also provides support for Windows XP Service Pack 2 to provide a safer, more reliable experience for customers using Windows XP. SP1 is available in 22 languages Update; looks like Microsoft has a busy ...

This looks like a pretty good introduction to Web Services in general and Web Services in .NET in particular. Plenty of examples like in any good dev book. I would have preffered C# examples but the intended audience are the ASP, VB 6, VB.NET developers so the examples are in are VB.NET. Yasser Shohoud has put the Real World WebServices book and source code online at http://www.learnxmlws.com/book/

I guess the BEA bosses know something we don't as the management seems to be leaving a sinking ship: BEA Systems' chief marketing officer and executive vice president has resigned, in the latest of a string of high-level executive departures at the struggling software company....Nielsen's departure is the sixth confirmed executive departure in the past two months from BEA via news.com

Today I needed a way to extract a random record from a small table. My first thought was to try something like: SELECT TOP 1 OfferTitle, OfferDescription, OfferURLFROM SpecialOffers WITH (NOLOCK)ORDER BY Rand() Close but no cigar. It doesn't work as SQL Server evaluates the Rand() function once and uses the same value for all the records. The trick is to use NewID(). It's slower as the new ID is a GUID but for a few records it's no problem: SELECT TOP 1 OfferTitle, OfferDescription, OfferURLFROM SpecialOffers WITH (NOLOCK)ORDER BY NewID()