Posted by Sem Dendoncker on April 22nd, 2009
Hi,
Here’s an easy solution how to select random rows from a table.
By using “ORDER BY NEWID()” the list will be scrambled.
Ex:
We have a table Users (containing an Id, FirstName and LastName).
We would like to select 10 random users from this table.
You can select all rows and then take 10 of them randomly (with code) OR you can just execute the following query:
SELECT TOP 10 Id, FirstName, LastName
FROM Users
ORDER BY NEWID();
This code will select 10 random users from the table.
You can also use this approach in more complex queries.
Cheers,
Sem
Posted by Sem Dendoncker on April 20th, 2009
Hi,
I’ve had the problem that my firefox screen always opened in the secondary screen in stead of my primary screen.
Online you can find that firefox remembers where you close your screen but this is only partial true.
The latest versions of Firefox only remember which monitor they are on if you close Firefox while it is not maximised.
So the procedure to get firefox to open maximised on the monitor of your choice in dual monitor setup:
1) Un-maximise Firefox window
2) Position un-maximised window on monitor of you choice
3) Close Firefox window
4) Reopen Firefox window
5) Maximise Firefox window
6) Close Firefox window
Now Firefox will open maximised on the screen you chose.
Hopes this helps out you guys.
Cheers,
Sem
Posted by Sem Dendoncker on April 16th, 2009
Hi,
If you work long enough on a product, you’ll see that the “using” section on top of your classes are starting to grow.
To clean these up you can rightclick –> organise usings –> remove, sort or remove and sort. This last one will remove the unused usings and sort the remaining ones.
If you do not feel like rightclicking all the time you can customize a shortcut key to do this.
To do this go to Tools –> Options –> Keyboard.
You will see a screen containing all the Actions possible within Visual studio.
In the “Show commands containing:” type “using” (without the double quotes). You’ll see all the commands with the word “using” in it.
One of them will be “EditorContextMenus.CodeWindow.OrganizeUsings.RemoveAndSort”, select it and then you can set the new shortcut key. I’ve used Ctrl+K, Ctrl+J (this wasn’t used yet).
Your window should look something like this:

If you have done all of this press Assign and finally press Ok.
Now you can just use the shortkey Ctrl+K, Ctrl+J to cleanup your using section.
You can use this method to assign any action within Visual Studio to a shortcut key.
Cheers,
Sem
Recent Comments