Free Information Technology Magazines and eBooks

Saturday, June 13, 2009

Combine two sequences using LINQ Zip Operator

Zip is new LINQ to Objects .NET 4.0 Operator that combines the elements from two sequences. It parse the element at the same index position in each sequence until one of the sequences finish reading its elements. Zip operator should be use on two sequence that are identical in length. It takes two arguments, (the element from first source, and the element from the second source) and it returns a combined type.

Here's the signature of the Zip method


public static IEnumerable Zip(
this IEnumerable first,
IEnumerable second,
Func func);


Sample usages of Zip


string[] employee = { "Fryan", "Auric", "James" };
string[] designation = { "Manager", "Programmer", "Designer" };

var emp = employee.Zip(designation, (employee, designation) => employee + " is a " + designation + " of the company.");

foreach (var e in emp)
Console.WriteLine(e);


Results:
Fryan is a Manager of the company.
Auric is a Programmer of the company.
James is a Designer of the company.


For more LINQ tips & tricks, subscribe now.

Microsoft Bing now has porn filter

Microsoft Bing now has porn filterGood news to parents, the software giant modified its Bing search engine to add a safe search filter that will make it easier for parents to block or monitor what their kids are viewing on the site. With this feature, parents can use almost any 3rd party parental control tools to block specific domains that contains explicit images and videos not suited for young audience. This initiative is Microsoft's response to the numerous feedback regarding how too easy for kids to find and view porn from Bing search.


There are two changes that Microsoft introduced on a blog entry.
According to the blog post,

First, potentially explicit images and video content will now be coming from a separate single domain, explicit.bing.net. This is invisible to the end customer, but allows for filtering of that content by domain which makes it much easier for customers at all levels to block this content regardless of what the SafeSearch settings might be. This makes it much easier for filtering software to block unwanted content if SafeSearch has been turned off.


Another change is,

In addition, we will begin returning source url information in the query string for images and video content so that companies who already use this method of filtering will be able to catch explicit content on Bing along with everything else they are already blocking for their customers


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

Twitpocalypse is upon us?

Twitpocalypse is upon us?Twitpocalypse is the name of the twitter bug that is similar to the Y2K bug. Every tweet sent out has a unique numeric identifier and this identifier is about to hit the signed integer limit which is 2,147,483,647. Some of third-party Twitter services are not designed to handle such a case and therefore the sequence will suddenly turn into negative numbers and those apps are likely to crash as a result


According to the countdown, the big bang was supposed to happen sometime tomorrow, but Twitter is forcing the failure to happen in the next couple of hours (21:00 GMT/2PM Pacific/5PM Eastern time today).

As of this writing, The unique identifier associated to each tweet has now exceeded 2,147,483,647 but there still yet no reports of massive failures (Current rate is 169 tweets per seconds)

Here is an update from the Twitter developer Doug Williams:

Just an update, there is a lot of coordination that it takes to pull something like this off. We need the operations team to watch the servers and application. The services team to work closely with the ops folks to ensure that any problems on our end are properly tracked and fixed. And Matt is running around coordinating the entire effort.

That said, the deadline may slip a bit as we work to ensure that we’ve covered our bases, and that the engineering team is ready to react to unforeseen problems.

Doing what we can to keep the tweets flowing.


Update: Twitterrific, TweetDeck and Destroy Twitter: 1st Victims of Twitpocalypse?

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

Friday, June 12, 2009

Find an item using text in ListView Control

I was banging my head last night because I cannot remember the method use to find an item in a ListView control. I keep on trying the ListView1.Items.Find function but I can get what I want. My application accepts a search keyword then it will search the text from the items listed on the listview. This morning, I dugg down on my old files and found what I'm looking for -- FindItemWithText.


FindItemWithText is a method that allows you to perform a text search on a ListView in list or details view, given a search string and an optional starting and ending index.

Here are sample source codes that demonstrate the search capability of ListView using text.

In VB.NET


Dim lvItem As ListViewItem = _
ListView1.FindItemWithText(TextBox1.Text, False, 0, True)


If (lvItem IsNot Nothing) Then
ListView1.TopItem = lvItem
End If


In C#


ListViewItem lvItem =
ListView1.FindItemWithText(TextBox1.Text, false, 0, true);

if (lvItem != null)
{
ListView1.TopItem = lvItem;

}


For more Coding Tips & Tricks, subscribe now.

Mozilla FireFox JetPack 0.2

Mozilla Firefox JetPack 0.2Today on this blog entry, the Mozilla Labs team introduced a new JetPack update that introduces three new features. Mozilla Jetpack is a Firefox API that allows developers and tech-savvy users to write Firefox add-ons using regular HTML, JavaScript, and CSS. Besides numerous bug fixes 0.2 includes three main additions: slidebars, jetpack.future, and persistent storage.

What's New?
1. Slidebars - the upgrade old sidebar. Here is a sample code to add this website to slidebar.


jetpack.slideBar.append({
icon: "http://www.fryan0911.com/favicon.ico",
url: "http://www.fryan0911.com/",
width: 300
});


But according to mozilla this feature is still on experimental stage and may have a lot of bugs.

2. jetpack.future - is a collection of new features APIs that are still on experimental stage. For example, to be able to use Slidebars you must use the import facility as shown below.


jetpack.future.import("slideBar")


3. Persistent Storage and Clipboard Support - allows developers to persistently store data across restart.


jetpack.future.import("storage.simple");
var db = jetpack.storage.simple;
var data = {name: "Firefox", twitter: "@firefox"};
db.set( "friend", data );


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

Thursday, June 11, 2009

VB.NET: How to DELETE record on SQL Database

This topic is part of VB.NET SQL Database Basics Tutorial series. On this article, you will learn how to incorporate SQL DELETE statements on your VB.NET application. An SQL DELETE statement removes one or more records from a table. A subset may be defined for deletion using a condition, otherwise all records are removed. For this article, we will focus particularly on updating records in Microsoft SQL Server.



Note: I assumed that you already installed your SQL Server and Visual Studio .NET.

Here is the step-by-step procedure to UPDATE record on SQL server:
1. Create your VB.NET project.
2. Include the following namespaces.


Imports System.Data
Imports System.Data.SqlClient


The System.Data namespace provides access to classes that represent the ADO.NET architecture while the System.Data.SqlClient namespace is the.NET Framework Data Provider for SQL Server.

3. Declare and instantiate your SQLConnection object and Command object as shown below


Dim con As New SqlConnection
Dim cmd As New SqlCommand


4. Pass the SQL connection string to ConnectionString property of your SqlConnection object.

con.ConnectionString = "Data Source=atisource;Initial
Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"


5. Invoke the Open Method to connect to SQL Server.


con.Open()


6. Set the connection of the command object.


cmd.Connection = con


7. Pass the DELETE SQL statement to the command object commandtext as shown below


cmd.CommandText = "DELETE FROM table_name [WHERE condition]"
'For Example:
'DELETE FROM customer WHERE firstname='Fryan0911'


8. Use the ExecuteNonQuery() method to run the DELETE SQL statement.


cmd.ExecuteNonQuery()


The full sample source code of deleting records on SQL Database:


Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"
con.Open()
cmd.Connection = con
cmd.CommandText = "DELETE FROM table_name WHERE field1='Test'"
cmd.ExecuteNonQuery()

Catch ex As Exception
MessageBox.Show("Error while deleting record on table..." & ex.Message, "Delete Records")
Finally
con.Close()
End Try






Google Translator is translating the world's information

Google Translator is translating the world's informationLearning a different language? or are you interested reading local articles in foreign language? During the old times, you will be needing the service of a personal translator. Fast forward to digital age, you can have the same translation service online and for free. Yesterday from this blog entry, Google launched the Google Translator Kit -- a powerful but easy-to-use editor that enables translators to bring that human touch to machine translation.


Google Translator Kit allows anyone to upload different types of documents( Microsoft Word, Rich Text, OpenDocument Text , HTML and Plain Text) or input the URL of the file and even Wikipedia article. Upon submission, the information is automatically translated to the selected destination language.

Translation process flow
Google Translator Process Flow

Google Translator sample result
Google Translator Sample Result

Besides Wikipedia, Google Translator kit is also integrated with Knol. For translator by profession there are advanced features such as terminology and translation memory management.

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

Wednesday, June 10, 2009

VB.NET: How to UPDATE record on SQL Database

This topic is part of VB.NET SQL Database Basics Tutorial series. On this article, you will learn how to incorporate SQL UPDATE statements on your VB.NET application. An SQL UPDATE statement that changes the data of one or more records in a table. Either all the rows can be updated, or a subset may be chosen using a condition. For this article, we will focus particularly on updating records in Microsoft SQL Server.



Note: I assumed that you already installed your SQL Server and Visual Studio .NET.

Here is the step-by-step procedure to UPDATE record on SQL server:
1. Create your VB.NET project.
2. Include the following namespaces.


Imports System.Data
Imports System.Data.SqlClient


The System.Data namespace provides access to classes that represent the ADO.NET architecture while the System.Data.SqlClient namespace is the.NET Framework Data Provider for SQL Server.

3. Declare and instantiate your SQLConnection object and Command object as shown below


Dim con As New SqlConnection
Dim cmd As New SqlCommand

4. Pass the SQL connection string to ConnectionString property of your SqlConnection object.


con.ConnectionString = "Data Source=atisource;Initial
Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"


5. Invoke the Open Method to connect to SQL Server.


con.Open()


6. Set the connection of the command object.


cmd.Connection = con


7. Pass the UPDATE SQL statement to the command object commandtext as shown below


cmd.CommandText = "UPDATE table SET field1 = value1, field2 = value2
WHERE field3='Test'"


8. Use the ExecuteNonQuery() method to run the UPDATE SQL statement.


cmd.ExecuteNonQuery()


The full sample source code of updating records on SQL Database:

Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=atisource;Initial
Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"
con.Open()
cmd.Connection = con
cmd.CommandText = "UPDATE table SET field1 = value1, field2 = value2
WHERE field3='Test'"
cmd.ExecuteNonQuery()

Catch ex As Exception
MessageBox.Show("Error while updating record on table..." & ex.Message, "Update Records")
Finally
con.Close()
End Try





Backup your files using Fling File transfer software

Backup your files using Fling File transfer softwareIf your storing critical data on your hard drive, backup is always a must!. If you are looking for backup and file transfer software, you can have both features in one software for free. The software is called Fling . --it is a software to help you automate uploading or transferring files. It is typically used to maintain a web site on a remote hosted server or to automate backup of folders. The software supports both file transfer protocol (ftp) and network file transfer.

Here is some description from their site:

Fling File Transfer Software allows you to setup one or more "Fling Folders" on your local computer. You can work in these folders like any other folder on your computer and when any file is added or changed Fling will upload the file to a remote ftp server or network folder. The operation can be automatic (upload as soon as the files are changed), at a preset interval (eg. every hour) or manually.



Fling Main Screen

Fling Upload Properties

Fling's strength is that it is simple to setup and use. It only takes roughly a minute to configure a backup or file transfer job. Fling is available on Windows 2000, Windows XP, Windows Vista, Windows Server 2003, 2008 and Windows 7.

For more cool softwares, subscribe now.

Facebook Vanity URL is coming later this week

Facebook Vanity URL is coming later this weekFacebook will soon to open "vanity URL pointing" to more than 200 million members. According to Facebook blog post, Starting at 12:01 a.m. EDT on Saturday, June 13, Facebook users be able to choose a username on a first-come, first-serve basis for their profile by visiting www.facebook.com/username/. A notice is also see displayed on each user's home page with instructions for obtaining your username at that time..

The new Facebook URL can enhance the searchability of a Facebook profile. People can now find their friends by simply entering Facebook username as the search term on popular search engine such as Google. But wait! you can only choose your username once.

Think carefully about the username you choose. Once it's been selected, you won't be able to change or transfer it. If you signed up for a Facebook Page after May 31 or a user profile after today at 3 p.m. EDT, you may not be able to sign up for a username immediately because of steps we've taken to prevent abuse or "squatting" on names.




After choosing your username, your old format facebook URL that look like this.
www.facebook.com/profile.php?id=111111111

will be branded to a new URL.
www.facebook.com/fryan0911


Update: Over 3 Million Usernames Claimed

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

Tuesday, June 09, 2009

VB.NET: How to INSERT record to SQL Database

This topic is part of VB.NET SQL Database Basics Tutorial series. On this article, you will learn how to incorporate SQL INSERT statements on your VB.NET application. An SQL INSERT statement adds one or more records to any single table in a relational database. For this article, we will focus particularly on Microsoft SQL Server.



Note: I assumed that you already installed your SQL Server and Visual Studio .NET.

Here is the step-by-step procedure to INSERT record to SQL server:
1. Create your VB.NET project.
2. Include the following namespaces.

Imports System.Data
Imports System.Data.SqlClient

The System.Data namespace provides access to classes that represent the ADO.NET architecture while the System.Data.SqlClient namespace is the.NET Framework Data Provider for SQL Server.

3. Declare and instantiate your SQLConnection object and Command object as shown below

Dim con As New SqlConnection
Dim cmd As New SqlCommand

4. Pass the SQL connection string to ConnectionString property of your SqlConnection object.

con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"


5. Invoke the Open Method to connect to SQL Server.

con.Open()

6. Set the connection of the command object.

cmd.Connection = con

7. Pass the INSERT SQL statement to the command object commandtext as shown below

cmd.CommandText = "INSERT INTO table (field1, [field2, ... ]) VALUES (value1, [value2, ...])"

8. Use the ExecuteNonQuery() method to run INSERT SQL that has no return value.

cmd.ExecuteNonQuery()


If you expect a return value use ExecuteScalar() instead. A good example of ExecuteScalar is to get the Identity column after inserting record
(ExecuteScalar return the first column of the first row from the result).


The full sample source code of inserting record to SQL Database:

Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"
con.Open()
cmd.Connection = con
cmd.CommandText = "INSERT INTO table([field1], [field2]) VALUES([Value1], [Value2])"
cmd.ExecuteNonQuery()

Catch ex As Exception
MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
Finally
con.Close()
End Try





Safari 4. Beta no more

Safari 4 leaves betaToday the Apple's Safari 4 is officially leaving beta stage. It was announced by Apple's Bertrand Serlet at the WWDC this morning. Serlet also claims that Safari 4's Nitro will be the fastest JavaScript engine of any browser on the market. He showed a chart showing that Safari 4 is 7.8 times faster than Internet Explorer 8 where Chrome 2 is only 5.3 times faster. Safari 4 will also loads JavaScript 3x faster than Safari on the iPhone, Serlet said. New web technologies such as HTML 5 audio and video tags will be supported in Safari 4.



Safari 4. Beta no more

What's new in Safari 4?
1. Top Sites - if you open new tab or instance, you favorite websites are displayed on matrix format the same way how Google Chrome do it.

2. Cover Flow - flip through your site history or bookmarks like you flip through albums in iTunes.

3. Full History Search - easily search for sites you visited before

4. Nitro Engine - as Apple claim, surf the web with the world's fastest browser engine.

5. New Windows Native Look and Feel - safari blends on your Vista and XP.

6. Developer Tools - various development tools are included.

Safari can be downloaded at Apple download website.


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

Monday, June 08, 2009

VB.NET: How to SELECT records from SQL Database

This topic is a part of VB.NET SQL Database Basics Tutorial series. On this article, you will learn how to retrieve records from an SQL Database server using VB.NET. Data retrieval is a common task of business applications. It can be use for view and search purposes. At the end of this article, you should be able to know how easy to query or SELECT records from SQL server.


Note: I assumed that you already installed your SQL Server and Visual Studio .NET.

Here is the step-by-step procedure to query from SQL server:
1. Create your VB.NET project.
2. Include the following namespaces.

Imports System.Data
Imports System.Data.SqlClient

The System.Data namespace provides access to classes that represent the ADO.NET architecture while the System.Data.SqlClient namespace is the.NET Framework Data Provider for SQL Server.

3. Declare and instantiate your SQLConnection object and Command object as shown below

Dim con As New SqlConnection
Dim cmd As New SqlCommand

4. Pass the SQL connection string to ConnectionString property of your SqlConnection object.

con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"


5. Invoke the Open Method to connect to SQL Server.

con.Open()

6. Set the connection of the command object.

cmd.Connection = con

7. Pass the SELECT SQL statement to the command object commandtext as shown below

cmd.CommandText = "SELECT [field1], [field2] FROM [tablename] ORDER BY [sortfield]"

8. Use the ExecuteReader() method to run the SELECT SQL.

Dim lrd As SqlDataReader = cmd.ExecuteReader()

*ExecuteReader() - Sends the CommandText to the Connection and builds a SqlDataReader
* SqlDataReader - Provides a means of reading a forward-only stream of rows from a
SQL Server database

9. Loop through the SqlDataReader

While lrd.Read()
'Do something
End While


The full sample source code of Selecting records from SQL Database:

Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"
con.Open()
cmd.Connection = con
cmd.CommandText = "SELECT [field1], [field2] FROM [tablename] ORDER BY [sortfield]"
Dim lrd As SqlDataReader = cmd.ExecuteReader()

While lrd.Read()
'Do something here
End While

Catch ex As Exception
MessageBox.Show("Error while retrieving records on table..." & ex.Message, "Load Records")
Finally
con.Close()
End Try





Twitter to launch Verified Accounts

Twitter to launch Verified AccountsAccording to Twitter blog, they are not playing ball. Twitter is taking seriously the issue of individual impersonation. The blog announcement is twitter's answer to impersonation complaint by Mr. La Russa where twitter denied that they agree to settle or plan to pay. To address improvement, Twitter has just announced a verified accounts beta program to make sure there are no more lawsuits of this nature.


The Twitter verified accounts experiment will begin this summer for accounts of public officials, public agencies, famous artists, athletes, and other well known individuals at risk of impersonation.


Although the verification will implemented to small set of accounts, In the future they are looking for it to be available to all. Heres how the "Twitter verification seal" will look like.


Twitter verification seal


Quoted from the blog in regards to accounts without a verification seal


Please note that this doesn't mean accounts without a verification seal are fake—the vast majority of Twitter accounts are not impersonators. Another way to determine authenticity is to check the official web site of the person for a link back to their Twitter account.


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

Sunday, June 07, 2009

VB.NET: How to connect to SQL Server

This topic is a part of VB.NET SQL Database Basics Tutorial series. On this article, you will learn how to connect to any version of SQL server using VB.NET. For programmers, database programming is a must if your working on data oriented companies. Before you can insert, update or query records from database, you must first know how to connect to it and this is my objective for this article. At the end of this article, you should be able to know how easy to connect to SQL server.


Note: I assumed that you already installed your SQL Server and Visual Studio .NET.

Here is the step-by-step procedure to connect to SQL server:
1. Create your VB.NET project.
2. Include the following namespaces.

Imports System.Data
Imports System.Data.SqlClient

The System.Data namespace provides access to classes that represent the ADO.NET architecture while the System.Data.SqlClient namespace is the.NET Framework Data Provider for SQL Server.
3. Declare and instantiate your SQLConnection object as shown below

Dim con As New SqlConnection

SQLConnection class represents an open connection to a SQL Server database.
4. Pass the SQL connection string to ConnectionString property of your SqlConnection object.

con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"

The connectionstring value usually contains the following :
Data Source - physical server hostname
Initial Catalog - your database name
User ID - SQL username use to connect to the server
Password - SQL username's password

On this sample, I am using an SQL Server 2005. For the connectionstring for other SQL version, you can get it from here http://www.connectionstrings.com/.

5. Last step is to invoke the Open method of the connection object

con.Open()


The complete sample sourcecode:

Imports System.Data.SqlClient
Imports System.Data

Private Sub ConnectToSQL()
Dim con As New SqlConnection
Dim cmd As New SqlCommand

con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"
con.Open()
End Sub


To capture if the connection was successful or not, just tweak the above code:


Imports System.Data.SqlClient
Imports System.Data

Private Sub ConnectToSQL()
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=atisource;Initial Catalog=BillingSys;Persist Security Info=True;User ID=sa;Password=12345678"
con.Open()
Catch ex As Exception
MessageBox.Show("Error while connecting to SQL Server." & ex.Message) Finally
con.Close() 'Whether there is error or not. Close the connection.
End Try
End Sub





VB.NET Tutorial: SQL Database Basics

On this tutorial, you will learn how to INSERT, UPDATE, and DELETE records to Microsoft SQL Server Database. The target audience of this topic are beginners. I will be using my own coding technique which I use in real life experience as a programmer. Before you can start, what you need is an SQL Server installed. Sample sourcecodes used throughout this tutorial series are compatible with either SQL sever versions: SQL 2000, SQL 2005 and SQL 2008.


Upon completion this tutorial series, you should be able to:
1. Know how to connect to SQL server
2. Know how to use how to query from SQL server using SqlDataReader class
3. Know how to Insert, Update and Delete Records.

Assumptions:
I assumed that you already performed the following:
1. Installation of SQL Server
2. Creation of SQL Database
3. Installation of Visual Studio 2005 or higher (Express/Professional/Enterprise)


Table Of Contents:
Topic 1: How to connect to SQL Server
Topic 2: How to SELECT records from SQL Database
Topic 3: How to INSERT record to SQL Database
Topic 4: How to UPDATE record on SQL Database
Topic 5: How to DELETE record on SQL Database