Free Information Technology Magazines and eBooks

Monday, July 06, 2009

How to retrieve all installed applications using LINQ

For today's coding tip, I will show how you can retrieve information from registry using Microsoft.Win32 namespace. This namespace provides two types of classes, those that handle events raised by the operating system and those that manipulate the system registry. Our goal is to iterate through a collection of RegistryKey objects within "LocalMachine\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" to retrieve all installed applications on Windows machine.


First we must include the following namespace.

using Microsoft.Win32;


Then to retrieve all installed applications, add the following code on your main function.

static void Main(string[] args)
{
string regkey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";

using (RegistryKey key = Registry.LocalMachine.OpenSubKey(regkey))
{
var query = from a in
key.GetSubKeyNames()
let r = key.OpenSubKey(a)
select new
{
Application = r.GetValue("DisplayName")
};

foreach (var item in query)
{
if (item.Application != null)
Console.WriteLine(item.Application);
}
}
}


For more LINQ coding tips & tricks, subscribe now.

Free software to convert AVI to MP4 video

Free software to convert AVI to MP4 videoJust recently while looking for videos to add to my IPod collection, most of the videos I found was in AVI format so I needed the help of a AVI to MP4 converter. AVI stands for Audio Video Interleaved, one of the most popular video format used for Windows while MP4 is MPEG4, short for Moving Picture Expert Group-4. MP4 is commonly used format on iPod, iPhone, Mobile, Apple TV, PSP and etc.


The free software to convert AVI to MP4 video I found is called Convert AVI to MP4. Convert AVI to MP4, as its name says, it is one free but powerful software to convert the AVI video files to MP4 (MPEG4) video format files, not only support AVI (AVI, DivX, Xvid) video formats (.avi), but also WMA, MOV, H.264, MPEG1/MPEG2 video formats. A good feature of this software is that you don't have to worry about decoder and encoder since its already included most of the video codecs.

Convert AVI to MP4 Main screen

Here are the features of this software:

- Easy to use and user friendly interface.
- 100% compatible for Windows Vista, work fine with Windows XP, 98, 2000, 2003 Server.
- Convert video files to MP4 can be played in MP4, iPod, iPod Touch, iPhone, Mobile phone, PSP, PS3, Zune, Apple TV.
- Support all popular video formats such as AVI, MPEG, MP4, WMV, DivX, Xvid etc to MP4.
- 100% FREE software, no adware or spyware

Here is the direct download link via [Convert AVI to MP4 website]

For more cool softwares discoveries, subscribe now.

Sunday, July 05, 2009

How to get the difference between two DateTime values in C#

One of the most common task of programmer when dealing with DATE and TIME is to comparing its values. In .NET, you deal with it using TimeSpan class which represents a time interval that can be in days, hours, minutes or seconds. Here is an example.


The following code uses TimeSpan and subtract one DateTime from another.


DateTime Date1 = new DateTime(2009, 6, 11);
DateTime Date2 = DateTime.Now;
TimeSpan timeSpan = Date2.Subtract(Date1);

// Display the difference of the two dates up to minutes
Console.WriteLine("Days : " + timeSpan.Days.ToString());
Console.WriteLine("Hours : " + timeSpan.Hours.ToString());
Console.WriteLine("Minutes : " + timeSpan.Minutes.ToString());

// You can also retrieve Total in Hours
Console.WriteLine("Total Hours " + timeSpan.TotalHours.ToString());



For more C# coding tips & tricks, subscribe now.

Binding WPF Controls to Data in Visual Studio 10

Binding WPF Controls to Data in Visual Studio 10While browsing interesting blogs on MSDN, I stumbled upon a demonstration video from Kathleen McGrath blog that shows how to add data-bound WPF controls to an application. The video is an interview with a programming writer, McLean Schofield. You can also learn more about this topic from the MSDN documentation: Binding WPF Controls to Data in Visual Studio


This demo walk through us on how to drag items from the Data Sources window onto the WPF Designer. He also describes the XAML and code that is added behind the scenes.






Get Microsoft Silverlight


*This video requires Microsoft Silverlight

To stay up-to-date on Visual Studio 10, subscribe now.

Saturday, July 04, 2009

How to return empty string instead of Null in T-SQL

Inside .NET applications, you can anticipate null field values by using the IsDBNull function or by checking if it is equal to DBNull.Value. But you can avoid this extra coding by using ISNULL function on your T-SQL query. Here is an example.

The following query will select cellphone column from the table and return blank strings if it contains NULL value.


SELECT ISNULL(cellphone,'') FROM Customers


Using this code technique will eliminate extra coding and you are sure that your query wont return any null values.

For more SQL coding tips, subscribe now.

Displays Recently Lauched Application In Windows

Displays Recently Lauched Application In WindowsThere are several ways to get most recently launched application that average users are not aware of. Windows operating system includes few options to find out what its users have been doing recently starting from those temporary folders, time stamps of files, history and log files, the index.dat file and some information that are deeply hidden in the Windows Registry. Each time that you start a new application, Windows automatically extract the application name from the version resource of the exe file, and stores it in Registry key known as the 'MuiCache'.


Today I will share a utility called MUICacheView, that you can use to easily view and edit the list of all MuiCache items on your system. You can edit the name of the application, or alternatively, you can delete unwanted MUICache items

MUICacheView Main Window

To use MUICacheView, simply run the executable file - MUICacheView.exe. The main window of MUICacheView displays the list of all MUICache items. You can select one or more items and use the 'Delete Selected Items' option to delete them. You can also use the 'Properties' window to edit the application name of single MUICache item.

For more cool softwares discoveries, subscribe now.

Friday, July 03, 2009

How to display line numbers in Visual Studio

Sometimes line numbers on Visual Studio code editor is helpful. It makes debugging easier and code looks more organize. By default, Visual Studio does not display line numbers so you have to manually invoke it to use it.

To display line numbers in Visual Studio, follow these easy steps.
1. Go to Tools Menu then click Options.
2. Click "Text Editor" on the list of options the select "All Languages".
3. On the right pane, tick the "Line Numbers" checkbox.

How to display line numbers in Visual Studio

4. Click OK to apply changes.

The Line Numbers should be displayed now.

Line numbers in Visual Studio Editor


To stay up-to-date on Technology news, subscribe now.

YouTube uploads size doubles to 2GB

YouTube uploads size doubles to 2GBThe standard upload of 1GB on YouTube is now doubled up to 2GB size. This will allow users to upload longer and higher resolution of videos as well as large HD files directly from camera. YouTube also added some new features like sharing links directly to the HD version of your video, as well as embed the HD version on your blog or website.

Here's how to do it according to YouTube blog.


* To share a link to the HD version of your video, simply append &hd=1 to the end of the URL. This means the video will start playing in HD as soon as someone follows the link. Cool, huh?

* To embed the HD version of a video on a website or blog, click the 'customize' button to the right of the embed box on the video page. Some options will appear; simply check 'play in HD'. The embed code that's generated will cause the video to start playing in HD as soon as a viewer clicks play. We recommend embedding HD videos at the largest size (853x505) for maximum enjoyment.


YouTube play in HD


To stay up-to-date on Technology news, subscribe now.

Thursday, July 02, 2009

VB.NET: How to list all running process in Windows

On my Computer Monitoring Tool blog post, I already explained how to retrieve windows processes but in C#. On this post, I will show you how to list current running windows process using VB.NET. The code will use of System.Diagnostics namespace to explore the Process class which will give us the access to information of running processes.


Of course, What we need first is to include the most important namespace.


Imports System.Diagnostics


Now to show the list of all running process in windows, use the following codes.


Dim psList() As Process
Try
psList = Process.GetProcesses()

For Each p As Process In psList
Console.WriteLine(p.Id.ToString() + " " + p.ProcessName)
Next p

Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Console.ReadKey()


The result should look like this.

How to list all running process in Windows using VB.NET

You can download the complete sample Visual Studio 2008 project here.

For more coding tips & tricks, subscribe now.

Windows 7 Beta Bi-hourly Shutdowns start Today

Windows 7 Beta Bi-hourly Shutdowns start TodayLast May, Microsoft began sending notification emails that the Windows 7 Beta will expire on August 1, 2009. However the Bi-hourly shutdown will commence on July 1 which is today. This is Microsoft's way of reminding beta users to upgrade their BETA copy to Windows 7 Release Candidate which is good until March 1, 2010, when your PC starts the bi-hourly shutdowns again.


To avoid the Bi-hourly shutdowns, you should certainly look at giving the Windows 7 RC a try! You can register to download the Windows 7 RC here.

To stay up-to-date on Technology news, subscribe now.

Wednesday, July 01, 2009

C#: Print Screen or Take Screenshot

Lately, I was building a simple add-on that will capture the user screen and automatically send it to the system administrator. This add-on will be plug-in into our existing systems. It will be automatically triggered if an error is detected so the system administrator can analyze the problem on-hand before going to the user to fix the error. On this blog entry, I will share the code that I used to print or capture the screen.



First you must include the following namespaces.


using System.Drawing;
using System.Drawing.Imaging;


Now here's the code that performs the print screen or capture screenshot operation.


private void button1_Click(object sender, EventArgs e)
{
Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);

Graphics graphics = Graphics.FromImage(printscreen as Image);

graphics.CopyFromScreen(0, 0, 0, 0, printscreen.Size);

printscreen.Save(@"C:\fryan0911\printscreen.jpg", ImageFormat.Jpeg);
}


For more C# coding tips & tricks, subscribe now.

Firefox 3.5 is now available for download

Firefox 3.5 is now available for downloadAfter days from the last Release Candidate, the final build for the much awaited version of Firefox is now available for download to public. Firefox 3.5 is claimed by mozilla as the fastest firefox yet, more than twice as fast as Firefox 3, and ten times as fast as Firefox 2.*. The Official Firefox 3.5 press release is available here.



Grabbed from the press release.

Firefox 3.5 is the best performing browser Mozilla has ever released and delivers radically improved JavaScript performance, a new Private Browsing mode, native support for open video and audio, and Location Aware Browsing. The newest version of Firefox is more than two times faster than Firefox 3 and ten times faster than Firefox 2 on complex websites. With extensive under-the-hood work to support new technologies, Firefox 3.5 is the most powerful and complete modern browser and helps upgrade the Web experience


You can read some review and Top 10 Firefox features via LifeHacker

Download it now to try it.

To stay up-to-date on Technology news, subscribe now.