TomGee.us

Tag: Microsoft

7-Zip Command Lines (Windows)

by Tom Gee on Aug.09, 2010, under Scripts

To extract all .zip files in the specified directory and make a new folder in the current directory for the extract that has the same name as the .zip file:

  • D:\Unzipped>”c:\Program Files\7-Zip\7z.exe” x d:\Zips\*.zip -o*
Archive a folder
  • “C:\Program Files\7-Zip\7z” a -tzip D:\Zips\Data_20100801.zip D:\Output\Data_20100801
Leave a Comment :, , , , , , , , , , , more...

Microsoft Excel: Count the number of unique values in list

by Tom Gee on Apr.19, 2010, under Excel

To count the number of unique or distinct values in a list in Microsoft Excel, use the following formula.  A2:A177 is the range of cells you want to count the unique values in:

=SUM(IF(FREQUENCY(A2:A177,A2:A177)>0,1))

Leave a Comment :, , , , , , , more...

Stop the loud system beep on remote desktop sessions

by Tom Gee on Apr.16, 2010, under Remote Desktop

Sick of the ridiculously loud system beep coming from your Remote Desktop sessions, even if you have Remote Audio Playback turned off?  If so, do the following on your local machine that you are connecting from:

  • Open Device Manager
  • View > Show Hidden Devices
  • Expand the Non-Plug and Play Drivers node
  • Right-click Beep and choose Disable

You’ll have to reboot or log-off and back in for the change to take effect.

That’s all there is to it!

Leave a Comment :, , , , , , , , , , , , , , , , more...

How to generate a random number in C#

by Tom Gee on Mar.19, 2010, under C#, Programming

Here’s a quick and dirty way to use Microsoft’s “Random” class for generating a random (or as you will soon find out, not-so-random) number.

Because I believe in code reuse, I started by creating a new function that would return the random number as an integer datatype.

static int RandomNumber(int min, int max)

{

Random random = new Random();

return random.Next(min, max);

}

The only things you have to pass to the function are the upper and lower boundaries that you want the random number to fall between.

int zip = RandomNumber(10000, 99999);

In the above example, a random number between 10000 and 99999 will be assigned to the “zip” variable.

As I stated above, the random number isn’t actually very random and, therefore, might not be a perfect fit for what your trying to use it for.  However, the Random class serves its purpose for quick data generation for application testing.

Happy coding!

Leave a Comment :, , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!