Monday, November 05, 2007

T-SQL: Concatenate something + null=null

Today I have lost 2 hours until I have discovered this rule. I wanted to concatenate the contents of a field in the database with a variable using something like that:

UPDATE TableName

SET FieldName=FieldName + ',' + @value
WHERE ID=@ID

If the value of FieldName is null this operation is very stupid because the result will be null too. In my case I have forced that the field was not nullable (default value: '') and all runs.

Tuesday, October 30, 2007

Vertical Label

Recently I have needed to display a label with the text in vertical direction. I have accomplished it using CSS with the next CSS class:

.verticaltext

{

    writing-mode: tb-rl;

    filter: flipv
fliph;

    text-indent: 60;

    padding: 2px;

    height: 75px;

}

Related links:
http://www.ssi-developer.net/css/vertical-text.shtml

Friday, June 01, 2007

Accessibility, CSS Friendly Controls, AspNet Menu and IE6

If you are developing an accesible site with ASP.NET 2.0 you can use the CSS Friendly Controls Adapters to render the controls without tables. You can access to the project at http://www.codeplex.com/cssfriendly. The current release of the AspNet Menu does not work with IE6 and the menus are invisible. After some investigation I discover that the problem is the Menu.css in the project. I have excluded this file and it shows the menu in IE6. Finally I have discovered what was happening. There is a bug in IE6 with the next class included in the Menu.css:

ul.AspNet-Menu

{


position: relative;

}

If you delete it all will works fine. For that reason I recommend to check the CSS files included in the project and verify it if you detect some strange behavior. In our case we have model the menu in the css of the application.

Special thanks to Edu and Victor who detect it.

Related Links:

http://www.codeplex.com/cssfriendly


 

Monday, April 23, 2007

Writing into Event Log from an ASP.NET application

If you try to write an entry to events log form an ASP.NET application is probably that you find an exception like this "The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.". The reason is that the ASP.NET process cannot find the source of the entry. You have to create it manually because, by default, the ASP.NET process, cannot do it programmatically. To create it manually you have to add a new entry in the registry (regedit.exe) with the name of your source (in the example TEST under Application log) in the following path "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application". Then, with the following code, you can write your entries.

string sSource;
string sEvent;
sSource = "TEST";
sLog = "Application";
sEvent = "Sample Event";
EventLog.WriteEntry(sSource, sEvent);

Related Links:
http://pranas.net/Tutorials/asp/EventLog.htm (example)

Friday, March 09, 2007

New certification

Today I have passed the 70-528 (Microsoft .NET Framework 2.0 - Web-Based Client Development). It adds to my previous certification in Windows and web development on the .net framework 1.1 (70-316 & 70-315).
Personally I have found this last exam more util than the previous version due the more general questions.
If you are preparing this exam I recomend the books of Dino Esposito about ASP.NET 2.0.

Friday, February 16, 2007

CRCDISK.SYS

After the last crash of my old XP I decided to install Vista on my Dell Latitude 610. I have installed Office 2007 and it was so pretty…

But when all were running perfectly during two days, this morning I could not start my notebook. After rebooting in safe mode it stopped at the load of the CRCDISK.SYS and 10-15 minutes later it continues with the boot process. Searching on the net I found a lot of posts about this issue, but apparently nothing could be applied to my notebook. Some posts talked about the external devices, other about the upgrade from XP and other about the energy supply. Then I remembered that the only suspicious thing that I had done about energy supply was to change de "Power Plan" of my machine from "Balanced" to "High Performance". Finally, I reverted this setting and all works.

Note: Now I am writing this post from Vista and directly from Word 2007. A great feature!

Monday, February 05, 2007

Creating a secure site using SSL

I have found this utility to do it in less than 1 minute and the most important thing... WITHOUT TYPING! Its name is SSL Diagnostics Version 1.1 (x86) and you can get it from Microsoft. You only have to identify your IIS instance, right-click and choose Create New Cert.