Free Information Technology Magazines and eBooks

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.

Tuesday, June 30, 2009

How to Get Current Windows User In C#

Most of our systems run on single sign-on windows environment. User can log-in once and gains access to all different systems without being prompted to log in again at each of them. One of the technique we use to check the authority is to detect the current logged windows user. Today I will show a short snippet on how to do it in C#.

To get the current windows user in C#, follow these codes.

First include the System.Security.Principal namespace on your, using directives.


using System.Security.Principal;


On your main function, add the current windows user retrieval code as shown below


static void Main(string[] args)
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
Console.WriteLine(identity.Name);
Console.ReadKey();
}


For more coding tips & tricks, subscribe now.

Free Online OCR Scanning

Free Online OCR ScanningWhile looking for OCR software vendors in the internet to be used on our Document Repository project, I stumbled to a cool free online service. Free OCR is a free online OCR (Optical Character Recognition) tool that enables you to extract text from an image and convert it into an editable text document. If you need the text from a scan image you don't have to re-type the whole text, just upload the image file and this OCR tool will convert it into editable text.


Free OCR can accept file formats such as PDF, JPG, GIF, TIFF or BMP format. The software is totally free but the size of the images is restricted to not larger than 2MB or no wider or higher than 5000 pixels and there is a limit of 10 image uploads per hour.

I tried testing a PDF document and here are the screenshots of the result.

Free Online OCR Upload

Free Online OCR Result

For more cool softwares discoveries, subscribe now.

Monday, June 29, 2009

How to get windows registry size in C#

One of the interesting subject when programming windows machine is Windows Registry. On this article, I will show you How you can perform a query from Windows Registry using Windows Management Instrumentation (WMI) Objects. WMI objects are exposed to .NET platform through System.Management Namespace. This namespace provides access to a rich set of management information and management events about the system, devices, and applications.


For today's example, we will retrieve the windows registry size.

First we must include the following namespaces on our Using directives.

Using System.Management;


Now to retrieve the size of the current machine's registry size, cut and paste the following code.

ManagementObjectSearcher mgmtObjects =
new ManagementObjectSearcher("Select * from Win32_Registry");

foreach (var mosItem in mgmtObjects.Get())
{
Console.WriteLine(string.Format("Current Size: {0}MB", mosItem["CurrentSize"]));
Console.WriteLine(string.Format("Maximum Size: {0}MB", mosItem["MaximumSize"]));
}


For more coding tips & tricks, subscribe now.

Check for unused CSS on a Website

Check for unused CSS on a WebsiteSometimes during creation of new website project, we often add CSS style elements that later we might no longer use. These unused CSS can make your web pages bigger in size and codes become larger. Checking it line by line can be tedious and for old pages it is unpractical. But worry no more, there is now a Firefox add-on which can be used to find unused css and this tool is called Dust-Me Selectors.


What it can do is, it extracts all the selectors from all the stylesheets on the page then analyze which of those selectors are no longer in use. The result is stored so that when testing subsequent pages, selectors can be crossed off the list as they're encountered.

dust-me selectors view dialog

The Unused selectors tab in the view dialog shows you a list of all the unused selectors that have been found, grouped by which stylesheet they're in.

dust-me selectors mark it

The view dialog has a context menu — select one or more item in the list and you can Mark it.

dust-me selectors save it as csv

You can save the data from any tab in CSV format, suitable for importing into a spreadsheet program.

Download Dust-Me Selectors via SitePoint.

For more cool softwares discoveries, subscribe now.

Sunday, June 28, 2009

How to get free disk space Using T-SQL

When working with limited disk space database server like my test server at home, I make sure to check the machine's disk space now and then. To get the free disk space for all physical drives on a machine using T-SQL, we can make use of the undocumented extended stored procedure called xp_fixeddrives.

Here is a sample T-SQL code to call xp_fixeddrives:


USE master
EXEC xp_fixeddrives


If executed, the code above will produce a list that contains the driver letter and its available disk space.

For more T-SQL coding tips, subscribe now.

How to block particular website on Windows

There are several software that you can use to automatically block websites on your Windows PC but if you prefer to do it manually, you can. It cannot be done via the Windows Registry however you modify the "hosts" file of windows to block particular websites. To disallow your browser from accessing particular website, follow this instruction.


1. From your windows desktop, click windows START button
2. Choose RUN to display the Run dialog box.
3. On the Run dialog, enter "notepad \windows\system32\drivers\etc\hosts". (alternately you can use windows explorer to browse to "c:\windows\system32\drivers\etc" then locate the hosts file.)
4. Press enter to open the hosts file using notepad.
5. Add a line into the file that looks like this.

127.0.0.1 www.xxx.com
127.0.0.1 www.youporn.com
127.0.0.1 www.dontgohere.com


6. Then Save it using notepad's File > Save.

For more Windows Tips & Tricks, subscribe now.