Free Information Technology Magazines and eBooks

Saturday, June 27, 2009

VB.NET: How to connect to IBM DB2 Database

VB.NET: How to connect to IBM DB2 DatabaseFor the past days, I already discussed some articles on how to connect to database server outside Microsoft platform such as Oracle and MySQL. On this entry, I will show you how to connect on another database platform called IBM DB2. DB2 is one of IBM's families of relational database management system (RDBMS) software products within IBM's broader Information Management Software line. Although there are different "editions" and "versions" of DB2, which run on devices ranging from handhelds to mainframes, most often DB2 refers to the DB2 Enterprise Server Edition, which runs on Unix (AIX), Windows, Linux and z/OS servers

To connect to a IBM DB2 Database, follow these steps.
1. First Install IBM Data Server Provider for .NET
2. Then add a reference to "IBM.Data.DB2.dll" by right-clicking your project on solution explorer then choose "Add Reference".
3. Include IBM.Data.DB2 namespace on our code as shown below


Imports IBM.Data.DB2


4. Then on your main function, add the code that connects to IBM DB2 server.


Sub Main()
Dim connString As String = "DATABASE=SAMPLE;"

'Create connection
Dim con As New DB2Connection(connString)

Try
con.ConnectionString = connString
con.Open()
Console.WriteLine("Connected to IBM DB2.")

Catch ex As OracleException
Console.WriteLine("Error: " & ex.ToString())
Finally
' Close Connection
con.Close()
Console.WriteLine("Connection Closed")

End Try

End Sub



For more VB.NET Coding Tutorials, subscribe now.

How to reveal shortened URL destinations

How to reveal shortened URL destinationsWhen sharing links, images and videos on microblogging sites such as Twitter and Plurk, links to these resources are automatically shortened to a random new URL like bit.ly, is.gd, post.ly and tinyURL. But on some cases, tiny services are blocked in some countries although the original long URL is not blocked. This is where Untiny.me service comes in. Once you enter the shortend URL and click extract, Untiny retrieves the original URL from it.


Here a sample result where I extracted the original url from "http://tinyurl.com/nf8uth"

Untiny.me - reveal shortened URL destinations

Try untiny.me for yourself.

For more cool internet discoveries, subscribe now.

Friday, June 26, 2009

C#: How to Ping a remote computer

Recently I was updating my free server monitoring software to include pre-checking of servers (if its online) before conducting resource information retrieval. To check if a server is indeed connected in the network, I included a Ping module that transmit a 32 bytes buffer to a remote computer (imitates windows ping command) and wait for reply.


.NET framework include a Ping class that allows an application to determine whether a remote computer is accessible over the network.

Here is the complete source code of my Ping module written in C#:

First include the following namespaces on the Using directives.

using System.Net.NetworkInformation;


Now insert this code for the Ping method.

static void Main(string[] args)
{
Console.Write("Enter the IP or Hostname to Ping: ");
string strhost = Console.ReadLine();
if (strhost.Length > 0)
{
Ping pingSender = new Ping();
PingOptions options = new PingOptions();
options.DontFragment = true;
// Create a buffer of 32 bytes of data to be transmitted.
string data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
byte[] buffer = Encoding.ASCII.GetBytes(data);
int timeout = 120;
try
{
PingReply reply = pingSender.Send(strhost, timeout, buffer, options);
if (reply.Status == IPStatus.Success)
{
Console.WriteLine("Ping was successful.");
}
else
{
Console.WriteLine("Ping failed.");
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}



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

Firefox 3.5 Release Candidate 3

Firefox 3.5 Release Candidate 3A few days after releasing Firefox 3.5 RC2, Mozilla has now published Firefox 3.5 RC 3 for Windows, Mac, and Linux. There were no major changes from RC2 to RC3 and according to mozilla that most of the update came from user feedbacks the could be focus on stability and security improvements.


For more details about the release, check out the official Firefox 3.5 RC 3 release notes.


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

Thursday, June 25, 2009

LINQ SkipWhile Method

In a nutshell SkipWhile is the counterpart of TakeWhile. Enumerable.SkipWhile bypasses elements in a sequence as long as a specified condition is true and then returns the remaining elements. This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. To show a sample usage, I provided a sample code that skip numbers from a list that are less than 10 until it encounters a number that is greater or equal to 10.



static void Main(string[] args)
{
int[] intnum = { 1, 3, 5, 7, 9, 11, 8, 9, 1, 2 };

var lessthan10 = intnum.SkipWhile(x => x < 10);

Console.WriteLine("Numbers that are less than 10.");
foreach (var x in lessthan10)
{
Console.WriteLine(x);
}

Console.ReadKey();
}



The LINQ code above will produce the following result:

LINQ SkipWhile Method Result


For more LINQ coding tips & tricks, subscribe now.

RapidWareX : Rapidshare Downloader

One of the most popular file hosting site in the internet is Rapidshare. If most of the good stuffs your looking for is on this server, you probably subscribed to its premium account already. Most premium users download files simultaneously, so a downloader such as RapidWareX can make users life more simpler. RapidWareX is a convenient downloading tool for RapidShare premium users that is 100% free. Recently, its version was updated to 0.9


On this recent update, You can stream audio and video directly from the RS-servers. There no more waiting for a movie to download and you can start watching it instantly.

RapidWareX Main Screen

To be able to play video it must be DivX encoded and for Music it should be Mp3.

Try this free windows software, download it now via RapidshareX website.

For more cool softwares discoveries, subscribe now.

Wednesday, June 24, 2009

LINQ TakeWhile Method

Today I will talk about a simple and useful LINQ method called "TakeWhile". Enumerable.TakeWhile as defined on MSDN is a method that returns elements from a sequence as long as a specified condition is true, and then skips the remaining elements. To show an example use of it, I provided a sample code that retrieve all numbers from a list that are less than 10 until it encounters a number greater or equal to 10.




int[] intnum = { 1, 3, 5, 7, 9, 11, 8, 9, 1, 2 };

var lessthan10 = intnum.TakeWhile(x => x < 10);

Console.WriteLine("Numbers that are less than 10.");
foreach (var x in lessthan10) {
Console.WriteLine(x);
}


The LINQ code above will produce the following result:

1
3
5
7
9

You can also apply it on a string list, as shown below.


string[] employees = { "auric", "rizza", "jayson", "fryan",
"james", "cheesy" };

IEnumerable query =
employees.TakeWhile(employee => String.Compare("fryan", employee, true) != 0);

foreach (string employee in query)
{
Console.WriteLine(employee);
}



The LINQ code above will produce the following result:

auric
rizza
jayson

For more LINQ coding tips & tricks, subscribe now.

Microsoft Security Essentials Beta Release Today

Microsoft Security Essentials Beta Release Download TodayThe software giant release its free anti-malware today which was previously labelled as "Morro" and now officially known as Microsoft Security Essentials. With Microsoft Security Essentials Beta, you get a free protection against viruses and spyware, including Trojans, worms and other malicious software. For now, Microsoft is limiting the downloads up to 75,000 only, so if your eager to try get it while it's hot (Download starts at 9PST).


According to Microsoft.

This beta is available only to customers in the United States, Israel (English only), People's Republic of China (Simplified Chinese only) and Brazil (Brazilian Portuguese only).Please visit the more information page to learn more about system requirements, our End User License Agreement and other important information.


To get a copy, download it from Microsoft Essentials website.

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

Tuesday, June 23, 2009

VB.NET: How to connect to Oracle Database

Connecting to an Oracle Database server is almost the same as connecting to SQL Server and MySQL. The only noticeable difference is that the namespace to use is System.Data.OracleClient. The System.Data.OracleClient namespace is the .NET Framework Data Provider for Oracle that composed of a collection of classes for accessing an Oracle data source in the managed space.


On this Tutorial, I will show you a sample code on How to connect to a Oracle Database.

1. First we need to add reference to System.Data.OracleClient namespace by right-clicking your project on solution explorer then choose "Add Reference".

VB.NET: How to connect to Oracle Database

2. Include the following System.Data.OracleClient namespace on our code as shown below.


Imports System.Data
Imports System.Data.OracleClient


3. Then on your main function, add the code that connects to Oracle server.

Sub Main()
Dim connString As String = "server = oracleserver; uid = admin;password = password;"

'Create connection
Dim con As New OracleConnection(connString)

Try
con.ConnectionString = connString
con.Open()
Console.WriteLine("Connected to Oracle.")

Catch ex As OracleException
Console.WriteLine("Error: " & ex.ToString())
Finally
' Close Connection
con.Close()
Console.WriteLine("Connection Closed")

End Try

End Sub


For connecting to SQL, Read the following article/s.



For more VB.NET coding tips & tricks, subscribe now.

Bakup your Google Docs using Gdoc Backup

Bakup your Google Docs using Gdoc BackupGoogle Docs is a great tool to upload your word documents, excel worksheets, OpenOffice, PDF, RTF, HTML or text files (or create documents from scratch). If your like me who relies on Google Docs to retrieve document (on the fly) anywhere then you can find Gdoc Backup useful. Google Docs Backup is a Windows backup software that was created to backup documents from Google Docs services. Users can use it to backup all documents on their local computer system that they have uploaded to Google Docs


After the installing GDocBackup, simply enter your Google account details into the configuration screen and locate a backup folder location.

GDocBackup Configuration


To start the backup process, simply click the Exec button.

Google Docs Backup process

GDocBackup is a free and open source software that is available for Windows operating system.

For more cool softwares discoveries, subscribe now.

Monday, June 22, 2009

How to connect to MySQL Database using VB.NET

In our company, our standard database platform is MS SQL Server. As VB.NET programmers, we all know how easy to connect to MS SQL Server through the use of System.Data.Sql namespace as part of .NET platform. But on our latest gate automation project, we are partnered with a 3rd party vendor where MySQL is their standard database platform of choice. Given the situation, we need to make our VB applications MySQL database friendly. For today's article, I will show you that it is as easy to connect to MySQL Database.


There are two method to connect to MySQL.
1. By using System.Data.OleDb Namespace
2. By using MySQL Connector for .NET

On this article, I will use the MySQL Connector for .NET. To begin our sample project, follow these step-by-step procedures.

1. Download and Install the latest MySQL Connector for .NET
2. Create your VB.NET project then add a reference to MySQL.Data by going to Project > Add Reference > .NET Tab.
3. On your imports directive, add the following namespaces


Imports System
Imports System.Data
Imports MySql.Data.MySqlClient


4. Now to connect MySQL database, copy and paste these codes.


Dim connString As String = "Database=TestData;Data Source=localhost;User Id=root;Password=mypassword"

Dim con As New MySqlConnection()

Try
con.ConnectionString = "Database=TestData;Data Source=localhost;User Id=root;Password=mypassword"
conn.Open()
Console.WriteLine("Connection Opened")

Catch ex As MySqlException
Console.WriteLine("Error: " & ex.ToString())
Finally
conn.Close()
Console.WriteLine("Connection Closed")
End Try


If you noticed, connecting to MySQL is similar to how you connect to a MS SQL Server database.

For more VB.NET coding tips & tricks, subscribe now.

Aviary's Falcon: Browser-based image editor

Aviary's Falcon: Browser-based image editorIf you are a webmaster that don't need a heavy image artillery such as Adobe Photoshop to edit or enhance you web images, you can take a look of this cool browser-based image editor created by Aviary called Falcon. It is a image markup editor that is a blazing fast visual markup tool that was designed to work with Aviary's new Firefox Extension (Talon) for screen capture, as well as for stand-alone image editing. Since it is web-based and works in any browser, it can be used on a Mac or PC


A detailed list of features are posted on Aviary blog post. Below are some screenshots of this great tool.

Screen Capture using Aviary's new Firefox Extension (Talon)
Talon Browser-based Screen Capture

Browser-based image editing with Aviary Falcon
Browser-based image editing with Aviary Falcon

For more cool softwares discoveries, subscribe now.

Sunday, June 21, 2009

Visual Basic 2010 : Implicit Line Continuation

The new Visual Basic 2010 or Visual Basic 10 already supports implicit line continuation which no longer use the underscore character (_). For a more details on this new feature, you can watch the video of the interview with Doug Rothaus, a programming writer on the Visual Studio User Education team. Elimination of those pesky underscore is a good thing to VB programmers because it makes our code more readable especially when writing multi-line LINQ queries.



Visual Basic 2010 : Implicit Line Continuation

So from using underscore (_)

Dim sMyString As String = "This is " & _
" a " & _
" test "

Console.WriteLine(sMyString)


Now you, don't need it anymore

Dim sMyString As String = "This is " &
" a " &
" test "

Console.WriteLine(sMyString)


How about Multiple statements in a single line?


Dim sMyString As String = "This is " & " a " & " test " : Console.WriteLine(sMyString)


For more VB.NET tips & tricks, subscribe now.

LoopApps: Multipurpose Convert to PDF Tool

LoopApps: Multipurpose Convert to PDF ToolThere are several PDF converter available on the internet today. Another and better new web based PDF utility that performs a number of tasks is LoopApps. It can convert two or more documents into PDF, combined several documents to a single document, and it can also accept documents from any URL. LoopApps also has number of advanced features such as publishing and digital signing the converted documents.


Advanced feature is only accessible upon signing up. You can convert multiple formats such as XLS, TXT, RTF, and DOC files into PDF files, or pull directly from URLs you input. If you want to electronically signed your document, LoopApps sign it using ESIGN service for free.

Here is a screenshot I captured while playing with the free online service.

LoopApps xls to pdf conversion

For more cool softwares discoveries, subscribe now.