/egilh

Learning by doing

May 2006 Entries

I got the great query below from Michele today. It shows all the information you ever wanted to know about the tables in your SQL Server, in particular; the number of rows as well as the size of the data and index. DECLARE @Tab sysname DECLARE tables_Cursor CURSOR FOR SELECT name from sysobjects WHERE xType='u' OPEN tables_Cursor FETCH NEXT FROM tables_Cursor INTO @tab WHILE @@FETCH_STATUS = 0 BEGIN select @tab -- Show space used by table exec ('sp_mstablespace ''' + @tab + '''') -- Show generic table info exec ('sp_help ''' +

Until May I received very little mail spam as I use a different email alias for each subscription, forum, etc. When a company sells my address to a spammer I know who the they are, who to complain to and I just delete all mails to the spammed alias. But, the spammers just started doing something that makes my life a lot more difficult. They send a lot of fake mail that looks like they come from egilh.com. In many cases the targeted account does not exist so I get a Non-delivery report (NDR) message back. Below is one example: We're sorry. There's a problem with the e-mail address(es) you're trying to send to. Please verify the address(es) and try again. If you continue ...

The Italian Java conference 2006 will be held in Roma 26/6 and in Milano 27/6-28/6 James Gosling, the man behind Java, will attend the Italian event for the first time ever. Gosling is Vice President, Fellow and Chief Technology Officer of the Developer Products Group of Sun and is working in the Real-Time Specification for Java. Web 2.0 will be he main theme of the Java Conference 2006 with the changes the "Participation Age" implies; Software as a Service, Open Source, Service Oriented Architecture and Ajax.

Now this is a creative use of Microsoft SQL Server stored procedures: solving Sudoku puzzles: To make it even more fun for myself, I embarked on an exercise to write a program that solves Sudoku puzzles. And to make it even more challenging I decided not to write the program in the popular object-oriented fashion (Java, C++, C#, etc.) or in any of the old-fashioned procedural programming languages (Pascal, C, Basic etc); but in Transact SQL, within SQL Server 2000. Basically, I wanted to see how the features of T-SQL can be used to develop something like a Sudoku puzzle solution. I have learnt some useful things from the exercise, which I’m eager to pass on ...

The ASP.NET cache can be used from any .NET program, but for several reasons I had to make my own caching system of a configuration file. In theory it works; my cached object will automatically be removed when the file has been changes. There are multiple worker processes and each of them use a FileSystemWatcher to notice if there are any changes to the configuration file: private static System.IO.FileSystemWatcher _watcher = null;..._watcher = new System.IO.FileSystemWatcher(HttpContext.Current.Server.MapPath("."), MY_CONFIG_FILE); _watcher.Changed += new FileSystemEventHandler(callbackConfigChanged);_watcher.EnableRaisingEvents = true; I ...

If you post large data to a web service or a aspx file using a form you may get this error message: System.Web.HttpException: Maximum request length exceeded. at System.Web.HttpRequest.GetEntireRawContent() at System.Web.HttpRequest.get_InputStream() at com...ProcessRequest(HttpContext context) The problem is that .NET limits the maximum data sent in each request to 4MB by default. The size can be changed to any value you want in machine.config or in web.config by configuring the httpRuntime maxRequestLength: <!--httpRuntime Attributes: maxRequestLength="[KBytes]" - KBytes size of maximum request length to accept--><httpRuntime maxRequestLength="4096"/>

You can call me Darth Vader after the sounds I made last night… A month or so ago, I started experiencing some of the symptoms of hay fever / pollen allergy: sneezing, itching nose and eyes, runny nose (occasionally nosebleeds) and impaired smell. I have been taking a non prescription medicine every other day lately which has helped a lot. Until I got creative yesterday and stopped taking it as I felt a lot better. I wish I had not, as I can now add another symptom to the list: wheezing: During an asthma episode, inflamed airways react to environmental triggers such as smoke, dust, or pollen. The airways narrow and produce excess mucus, making it difficult ...