Developping for the translation industry RSS 2.0

 Friday, 30 May 2008
Friday, 30 May 2008 15:35:54 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
 Monday, 26 May 2008

The LTRIM function in T-SQL only removes whitespaces. But, in some instances, you need to do more complex trimming. The trick is to use the PATINDEX function in conjunction with the STUFF function.  PATINDEX will return the index of the first occurence of a specified pattern.  In my example below, PATINDEX will return the index of the first non-zero character.  STUFF takes 4 parameters:

– the affected column

– the the starting point of the deletion

– the length of the deletion

– a string to insert at the deletion point

So the code below will delete all characters, starting at the first, and finishing before the first non-zero character.  Why not use SUBSTRING instead?  Because STUFF is a little more robust than SUBSTING and will not raise an error on you if the PATINDEX returns -1.

SELECT STUFF(myColumn, 1, PATINDEX('%[^0]%', myColumn) - 1, SPACE(0)) FROM mytable

Also, if you happen to have a column of type float and you want to get the values without the leading zeros (for example, 0.75 would become .75), you simply need to cast your column as varchar and you’re set.

Monday, 26 May 2008 16:49:50 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
Code Snippet | SQL
 Friday, 23 May 2008

I have many ideas during the course of a normal day.  A lot of which I can’t realise or I just don’t have the time to execute.  So for your viewing pleasure, here are some of them.  Feel free to use any or all of them at no cost at all.

If you are a cellphone or mobile device developer, you might be interested in:

  1. 911–SMS: When you’re at home and a burglar enters, it may occur to you that your need to inform the cops that you are in danger.  What the system seems to be lacking as of today is a proper text-message based emergency call.  Have you wondered how awkward it would be to phone the cops and let the bad guy know where you are hidden in the same time.  What every cellphone need is some preset emergency text messages with your address already written down that would be redirected to your local police station (as any 911 call would do).  That way, it would be a lot easier to let the cops know that you are in danger without revealing your position to an intruder.
  2. Cell-Reminder: I don’t know if this has been done but it would a very useful feature in my opinion. This should be a feature directly integrated in the cellphone itself. You select the “Remind-me” feature and you say a date and time and a message.  Something like “tomorrow, 5pm, pick up some milk”.  With some basic voice recognition software and a little hard drive, you save the message and the cellphone automatically rings at the requested date and time and play the message you previously recorded.

That’s it for today folks.  Happy coding!

Friday, 23 May 2008 20:33:21 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -

I’m all about controlling every aspect of my environment Today’s tool is from SharpKeys is a keyboard remapper that writes the necessary registry keys to let you re-map any key on your keyboard.

If, for example, you always hit the windows key when playing a fullscreen game that causes it to minimize and makes you lose the final round (or race, or..  anything losable), you can re-map this key to be, for example, another shift key.

It officially supports Win2000, XP and, even if not “officially” supported, it works well on Windows Vista.


If you don’t want to search in the keys list for that “mute” button on your keyboard to change it to something else, you can use the “Type Key” feature that will select that key automatically.



Friday, 23 May 2008 09:07:08 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
 Thursday, 22 May 2008

All the Mix08 sessions are online !

I also found this blog post with links to the wmv of all 88 sessions if you want to watch them offline.

Thursday, 22 May 2008 09:15:28 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
General | News
 Wednesday, 21 May 2008

At my company, we have a windows service, built in C#, that makes automatic modifications to Active Directory groups. This process use the function call “FindAll()” from the System.DirectoryServices.DirectorySearcher class.

It seems that the SearchResultCollection returned by the FindAll method can’t release it’s unmanaged resources by itself, so you need to call explicitly the Dispose() method.

From MSDN:

Due to implementation restrictions, the SearchResultCollection class cannot release all of its unmanaged resources when it is garbage collected. To prevent a memory leak, you must call the Dispose method when the SearchResultCollection object is no longer needed.


Wednesday, 21 May 2008 14:54:00 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
 Friday, 16 May 2008

Today’s tool is for all of you programmers/bloggers, who want to have that perfectly syntax highlighted code for your posts.  CopySourceAsHtml is a Visual Studio 2005 addin that does all the dirty work for you.


You get also a lot of options for font selection, line numbering, indentation and setting custom CSS styles.


Friday, 16 May 2008 19:24:24 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
 Tuesday, 06 May 2008

This code example sets the permission to create files and update them in a folder for a particular user but doesn’t propagate these permissions to the subfolders.


using System.Security.AccessControl;


System.IO.DirectoryInfo folderInfo = new System.IO.DirectoryInfo(folder);

DirectorySecurity folderSecurity = folderInfo.GetAccessControl();


FileSystemAccessRule rule =

      new FileSystemAccessRule(


      FileSystemRights.ReadAndExecute |

        FileSystemRights.AppendData |

        FileSystemRights.CreateFiles |








Tuesday, 06 May 2008 17:52:15 (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
.NET | C# | Code Snippet

About the author/Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018
Stanislas Biron
Sign In
Total Posts: 135
This Year: 0
This Month: 0
This Week: 0
Comments: 1
All Content © 2018, Stanislas Biron