LINQ: Tips and Tricks

Tip 1: How to convert a list of objects into a Dictionary?

For example, you have an List where Person contains field Name and field Age. Let's say that you want to create a Dictionary that would contain name and age of each person in a list. Traditionally, you would approach this problem by writing something like this:

How to count number of string occurrences in Excel

Have you ever found yourself in a situation when you had a list of, let's say phone numbers, and you wanted to know how many elements contain a certain string in them?

Well, yesterday I found myself in that situation and here's the formula that I found that would do just that:

=SUM(LEN(<range>)-LEN(SUBSTITUTE(<range>,"text","")))/LEN("text")

So, if you had the following data:

ClearCase Tips and Tricks

If you are working with IBM ClearCase as your source control, and you want to compile a list of your changes in the following manner:

  * Changed File
    - Comment

You can use this command to find checked out files:

cleartool lsco -fmt &quot;    * %En\n    - %c\n\n&quot; -me -avobs

And this command to find out recently checked in files:

HOWTO: Display Raid rebuild ETA on the Raid5 | Information page

Have you ever had a situation when your RAID has degraded and had to be rebuild? Does it take a long time and you don't know exactly how long rebuilding will take without access to the console?

Well, I have found a way to display this information in the Disk | Software RAID | RAID5 | Information.

Here's what you do:
1) log in to your FreeNAS console (physical or SSH into it)
2) Navigate to www:

HOWTO: Configure Gallery2 to use gmail as a mail service

Are you running Gallery2 to host all your pictures? Are you trying to enable e-mail support via google mail? It's not working, huh?

Well... there's a way to allow users use Gallery2 to send emails via gmail. Here's how:
1) On your server, navigate to the gallery2_root/lib/smtp (in my case gallery2_root is /srv/websites/gallery2)

cd /srv/websites/gallery2/lib/smtp

2) Open smtp.php for editing

How to find information about your hardware without taking your system apart

Have you ever found yourself in a position when you needed to know something about your motherboard or RAM chips and you didn't feel like turning your computer off and taking apart or you are away from your computer and taking your pc apart is simply not an option? Well, there's a way to get some info about your hardware using console!
Command that you will want to use is:

dmidecode

This command will give you whole bunch of output that will look something similar to this:

How to manipulate windows services via command line

If you ever wondered how to start / stop / change Startup Type of a service, keep reading this...

How to start and stop a Service

Windows XP/Vista/7 (I'm not sure about earlier versions) allow you to start and stop services via command line with the help of command net start to start a service and net stop to stop the service.
For example, if you want to start Telnet service run the following command: