Friday, December 25, 2009

Search for ANYTHING using EVERYTHING

  • Ever wanted to quickly find all the doc files in your PC?
  • Or all jpg files where the name starts with D and ends with an A + contains a 1 in the middle?
  • Love wildcards for searching??
  • Even better, wish you can use regular expressions for searching?
  • Wish that everything was indexed and it was a matter of typing to search for something?
  • Want your files to be indexed REAL TIME but without hogging up your RAM?
  • Love Google’s simple search box?

You need EVERYTHING! :D
EVERYTHING will search for ANYTHING and EVERYTHING the WAY you WANT it :D



image




Just give it a few minutes to index all your files and you are good to go! Just simply enter a query with/without wildcards and the results are immediately shown! Everything registers it self for file changes and automatically updates the index.
Everything is very low on resource consumption. I have made everything index all my files and that is exactly 301,695 files and it takes less than 20MB.
image



One of the most coolest features of Everything is that it can start an HTTP/ETP/FTP server on any port and (with username/password authentication) you can connect to your computer from anywhere and browse all the indexed files + download them :D




Other features include
  • Context Menu Integration
  • Export Search Results (txt format)
  • Exclude items from your search (File/Folder/Pattern)
  • Hot Key support
  • Match cAsE/Whole Word/Path/Regex
  • Use Boolean operators! (w00t!)
  • Automatic Update
  • Runs on Windows 7 (64-bit too)!
  • Its FREE!
Bad Side
  • No network location indexing (You need to run Everything on both computers and start an ETP server)
  • No file content indexing (only file names)
  • Only NTFS partitions supported!
  • Windows Only!



Check Everything FAQ for more details



DOWNLOAD EVERYTHING




Thursday, December 17, 2009

Torrent-Damage -> Torrent-Wiki

As you might have noticed one of the popular bit torrent tracker named Torrent-Damage.net is down!
The reason as i found out was some issue with the domain, the site is working perfectly fine!
Their new (maybe temporary) URL will be torrent-wiki.net

If you are in the middle of leeching/seeding a torrent please change the tracker url to
tracker.torrent-wiki.net/blah blah


www.Torrent-Wiki.net


Please say a little thank you if this helps you! :)

Tuesday, December 15, 2009

Google Chrome Extensions

I've being a hard-core Firefox fan but now Google Chrome is tempting me very much!!! First it was the Grease Monkey scripts that Chrome supported and now there are about 100 useful (almost similar to Firefox) extensions in the Google Chrome Extension website!! Installing an extension does not need a restart (well, uninstalling doesn't need either!)

Well Stumble Upon and some neat extensions are rocking Google Chrome!!! True that Chrome does not have a huge addon repository like Firefox but I'm betting on it!

Install the latest Developer Preview of Chrome and try out all those neat extensions!

Google Chrome Extensions

Monday, December 7, 2009

Get to know your laptop battery and give it a treat!

How much do you know about laptop battery? Bet you don’t know a lot apart from the manufacturer! Want to know the design capacity? Total capacity?? How about wear level? Interested? Keep reading…

Battery Care is one good piece of software that will let analyze your laptop battery’s birth certificate!

 

This is the main screen where you get to see all the basic information

image

 

This is the Detailed Information screen where you get to know everything about the battery! As you can see there is a comprehensive list of details about your battery

image

 

The most awesome feature of Battery Care is the automatic selection of power plan depending on the power source. This helps a lot when you keep your laptop unattended for a long period of time.

 image

 

BatteryCare has a handy system tray icon which will display the current status of your battery

image

 

BatteryCare has options to temporarily disable battery-hungry Vista Aero and SuperFetch, ReadyBoost and SearchIndexer services in battery mode making you squeeze out that extra juice out of your battery!

image

BatteryCare website contains a comprehensive guide to laptop batteries and debunks a lot of battery myths too!

http://batterycare.bkspot.com/en/guide.html

 

Another great feature of Battery Care is to change the power plan with just 2 clicks! Right click on the system tray icon and you can easily switch between ALL the power plans and not just 2! (I can seriously kill whoever changed Windows 7’s power plan switch option!)

image

Battery Care is really a one man show by Filipe Lourenço! Kudos!

Download Battery Care and give it a try! It is totally worth it!

Tuesday, December 1, 2009

Your one stop solution to be online in all your IM Messengers + Email Accounts + Social Networking Sites

Seriously, how many instant messengers and web browsers windows you have to have opened to chat, view email and connect with your social networking buddies?

For me, just one simple application! Digbsy!

First of all Digsby is a MULTI-PROTOCOL Instant Messenger! It can support AIM, MSN, Yahoo, ICQ, Google Talk, Jabber, and Facebook Chat!! Yes people, FACEBOOK chat too :D :D

 

Apart from these you can have fully customizable messaging windows!

OK… no more multiple windows!!! Do it the TAB style :D

Merge all Roberts Yahoo, MSN and Facebook chat in to one! :)

Find all your conversation, quickly! Really really quickly!

One of my favourite feature is the Digsby Widget :D This allows you to embed a widget in your blog or favourite which the visitors can chat with you live while you are using your desktop Digsby application

Another very cool feature is the ability to carry on conversation without the window taking up half of your screen and blocking your precious screen space. This also allows to quickly respond to messages without stopping what you are really doing.

 

OK… that’s all about instant messaging but that doesn’t stop there! The email functionality of Digsby is very extensive!

Digsby supports Hotmail, Gmail, Yahoo Mail, AOL/AIM Mail, IMAP, and POP accounts

The another very awesome feature is to the ability to keep up with all the social networking sites. Facebook, Twitter, MySpace and LinkedIn accounts are supported. You can even update your status using Digsby :)

Well i have only covered a few of the main features of Digsby! There are 100’s of more features and customizations for Digsby!

 

Download Digsby

 

Friday, November 20, 2009

Ever wanted an uncluttered desktop?

I know everybody loves their desktop! Their treasure chest. That is where all your documents, songs, downloaded items, pr0n and all your 245 shortcuts are stored. You want it neat but you need all the items too??? Have your ever seen your beautiful wallpaper that took 5 hours to search for??? No! Not in all that clutter… Do you want a simple solution for all your clutter problems?? Like ‘em organized? Fences is your solution all your cluttered nightmares :D

 

image

Like this desktop better than yours???

Want to hide all the icons and fences see that beautiful desktop wallpaper? No problem! A simple double click will do the trick. Want them back? Another double click and presto, everything is back.

And as their websites says

Fences is an add-on to your desktop, not a replacement.


Fences™ is a software by StarDock

 

Download Fences

Connectify! Share your Internet Connection, Wirelessly!

Ever wanted to share your Internet connection wirelessly?? You have 165 different WiFi activated devices and you wanted them all to have the same 100Mbps connection you get to your PC? Easy! Install Connectify! Connectify lets you virtually create/emulate a Wireless Access Point. No, it will not be an Ad-hoc network. You turn your laptop/desktop in to a REAL Wireless Access Point. No fancy configurations, no special hardware required! You only need a WiFi card (which almost all the laptops and new motherboards have built in).

image

Security? Will all my neighbors get free internet? Not a problem! Your WiFi hotspot will have WPA2-Personal (AES) encryption!

So what’s the catch? You know there is one, huh? Well Connectify runs only on Windows 7… All prior Windows versions are not supported. There FAQ tells you why…

Does it run on Windows Vista or Windows XP?

Sorry, not at this time. Connectify depends on improvements made in Windows 7 to operate. Frankly, Windows 7 is such a big improvement, that we suggest you're better off upgrading than waiting for us to get all this working on an older version of Windows. For more information on upgrading to Windows 7, see the upgrade guide on our web site.

Read their FAQ for more information.

 

Download Connectify from the official website

Monday, September 28, 2009

Aw snap! My files are corrupted/missing! :(

Ever wake up in the morning only to find your nights of work is corrupted/missing or cant boot up your PC? Ever want to get back to an earlier revision of a file you were working yesterday? Two days back or one month back? :) There are two options! Keep track of several folders with the date, zip it and email it your self. There should be easier way, isn’t it? Yep! There is! Dropbox, your ultimate solution to backing up and automatic synchronization.

Setting up Dropbox is so easy and once installed it is setup once and forget type software. Dropbox, simply put, is a folder which everything you put in to is automatically synchronized with the Dropbox server + all computers you have linked up with your account. That means, if you have Dropbox installed both at home and office, both the folders will contain the same exact content as one will immediately reflect changes made in another and vice versa. How cool is that? :) This does not stop there, well sure you can link up more than 2 computers… so all the 65365 computers that you work on will contain exactly the same folder…

Now, lets say half way through your document you suddenly realize that you have done some changes to your document that you want back badly??? Normally, this is impossible! Because the content of the file is over written… only exception being you can keep on undoing… but what if those changes were done 7 days back? No worries! Dropbox to the rescue! Dropbox not only does automatic synchronization but also keeps track of all the changes made to your files… up to 30 days!! (Yeah you get unlimited undo history for the paid version!)

Yeah now you know why you need Dropbox! It will automatically detect changes in a file and synchronize it with the server and other linked computers! But wait! What about my 65 MB file??? Every time i make a minor change to it the whole file is getting uploaded again!!!? The answer is NO WAY! This is why Dropbox is the next big thing and this is why Dropbox is so HOT! Dropbox uses a technology called Delta Synchronization (lBock-level or delta sync) where only the part of the file which has being changed is only synchronized! Easy on the bandwidth and time saving! Plus, upload resuming is supported too! It certainly is smoking HOT!

Here is a complete list of Dropbox’s features


So what are you waiting for! Get Drop Box!

P.S : The above link is actually a referral link…No it doesn’t give me $0.25 for everyone who clicks it but i get 250MB of additional space (up to 3GB) for everyone who gets registered!

Technorati Tags: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,



Friday, September 4, 2009

What happened to that 10GB i had free yesterday? :(

Common question? Yes! One morning, fresh, you check how much space is left in your C: drive and that 10GB is smiling at you making your whole day happy! You do your work, you play some games and you do all the www stuff you do everyday and everything is normal. Until, you see that weird message haunting you..

Untitled-3

Where did all my space go??? Where is that 10GB i had in the morning?

Prime Suspects

  • Wife (Nah! She never touches the PC)
  • Dog (Hates anything except fresh meat)
  • Children (Was at school)

Now which one took away my free space?? Lets hand over the case to Mr.CCleaner first! (There’s another Mister waiting to take over the case too)

image

 

CCleaner (Formerly Crap Cleaner),boasting powerful and expandable set of features will go deep down of your hard drive and search for all those unwanted junk files you never knew that was there in your hard drive.

image

It will first search in well known places for junk, useless and unwanted files reside ( Which is shown on the left side.. then it will search on places that most applications leave unwanted junk files… (Shown below)

  image

 

The analyze button will start searching for the junk files and will display what was found… You will be amazed the first time you run it, if you have  never run this before…

image

The other amazing feature that CCleaner offers is cleaning your registry! It will clean all those pesky little entries that take up the space in your registry and slow it down!

image

CCleaner is also built in with an Uninstall utility that can replace the Windows Uninstallation Utitlity…. + a startup manager and system restore point manager…. too much to ask in a freeware!

image

Download Now

Technorati Tags: ,,,,,,,,,,,,,,,,,,,,

Sunday, August 23, 2009

Let me concentrate please!!!

Do you constantly get distracted by your instant messenger notifications or all those zillion email notifications that constantly keeps popping up on your screen when you have to submit that project due tomorrow? Or you cant resist opening your browser to check what your friends are doing now?? All those are done BECAUSE you see those icons that makes you want to click them! Well what if you don't see them? What if you see only see what you type? Only text! Nothing else? Well, ladies and gentlemen, say hi to Dark Room.

 

(Full screen)image

Well this is how it looks! Just like a Dark Room.

(Fullscreen)image

The text is Green and the background is Black! Gives you the original Matrix feeling. This is a simple text editor where there is only you and your text. You get all the simple features of a notepad like text editor. You can specify your own Font and Background colors, Font and the page settings. You can even make the app transparent to your liking.

image

image

Simple other features like Auto Save and context menu integration makes it simple yet effective notepad alternative.

You know what’s the best feature? You will never get distracted again and you will finish the project due tomorrow, today and go out with your girl and save the world too :)

Sunday, July 12, 2009

Dynamic searching/filtering of DataGridView, ListBox

Have you seen those nifty tricks where a data grid view or listbox is filtered as you type in a text box? Believe it or not its really really easy using both Visual Basic and C#. I thought it was hard too… that i have to run through nested for loops… but Visual Studio it self has done the hardest part and made it easy for us!

Difficulty : Easy

Time required : Less than 5 minutes

Prerequisites : Connecting to a database, Filling in a DataSet/DataTable

 

Ok lets get it started, lets first do it in Visual Basic

image

All you need is a data grid view and a text box! Its simple as that! Now lets load the data! Make sure you have created an SQL Server database, and filled it with data!

OK lets fill the data grid view with the data!

 

Imports System.Data.SqlClient

Public Class Form1


Dim ds As New DataSet


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim con As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;Integrated Security=true; Initial Catalog=Bodgett")
        con.Open() 

         
        Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM Employee", con)

        da.Fill(ds, "Emp")


        DataGridView1.DataSource = ds.Tables("Emp")

    End Sub


End Class

Ok…now run the project and you will be (you should! ) see the data grid view filled with the data! Like this…

image

Assuming that everyone went as planned, lets do the actual filtering!

Before actually coding, here is a heads up on the syntax used for the filtering.

Lets say we want to find the employee with the first name ‘Lilak’

Then the row filter would be Emp_FName = 'Lilak'

Or lets say that we want to find some one with the email address equals to ‘emiley@bodgett.com’

then the row filter would be Emp_Email = 'emiley@bodgett.com'

But how do we search for both at the same time, simple combine them with a “and”

eg: Emp_FName = ‘Lilak’ AND Emp_Email = 'lilak@bodgett.com'

But as you can see, there is no use of filtering without the use of WILD CARDS! (I love ‘em!)

The wild cards that can be used in a Data Grid View are % and *, which does the same job!

Now lets say we want to filter records based on the email provider.

Its going to be like Emp_Email LIKE '%yahoo%'

the % sign represents 0 or more characters.

So now hoping that you guys know how to write the filtering syntax, lets get wet with the actual coding… well, there is no CODING that you to do, as it is something that could be done with…yes my friends, 1 LINE OF CODE :)

ds.Tables("Emp").DefaultView.RowFilter



ds is our DataSet, but we are actually applying the coding to a DataTable’s (which is “Emp”) DataView. We are changing the RowFilter property of the DataView.



ds.Tables("Emp").DefaultView.RowFilter = "Emp_FName LIKE '*" & TextBox1.Text & "*'"


 



This changes the RowFilter while text is being typed on to the textbox, which dynamically filters the records according to the text. Notice that i have used * but remember % can be used too. For an example if the user enters the word Jason to the textbox, the rowFilter would look like



Emp_FName LIKE '*Jason*'



including the quotes ' '



Now run the program and see how it is…



So how do you filter based on multiple attributes. Easy! Just separate the multiple attributes with a OR



So if we want to filter using both First name and Last name we would use something like



ds.Tables("Emp").DefaultView.RowFilter = "Emp_FName LIKE '*" & TextBox1.Text & "*' OR Emp_Lname LIKE '*" & TextBox1.Text & "*'"



For the input “Jason” for the textbox this would output something like



Emp_FName LIKE '*Jason*' OR Emp_LName LIKE '*Jason*'



So this is it folks, the coding is over and so is the tutorial :)



For more information on rowFilter and rowFilter expression read these articles on MSDN



http://msdn.microsoft.com/en-us/library/system.data.dataview.rowfilter.aspx



http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx



Here is the complete coding for whoever wants it :D



Imports System.Data.SqlClient

Public Class Form1


Dim ds As New DataSet


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim con As SqlConnection = New SqlConnection("Data Source=.\SQLEXPRESS;Integrated Security=true; Initial Catalog=yourDBName")
con.Open()


Dim da As SqlDataAdapter = New SqlDataAdapter("SELECT * FROM Employee", con)

da.Fill(ds, "Emp")


DataGridView1.DataSource = ds.Tables("Emp")

End Sub


Private Sub
TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
ds.Tables("Emp").DefaultView.RowFilter = "Emp_FName LIKE '*" & TextBox1.Text & "*' OR Emp_Lname LIKE '*" & TextBox1.Text & "*'"

End Sub
End Class



Blogger Labels: Dynamic,DataGridView,ListBox,tricks,data,grid,text,Visual,Basic,Studio,self,Easy,Time,Prerequisites,database,DataSet,DataTable,Server,System,SqlClient,Public,Class,Private,sender,Object,EventArgs,MyBase,Load,SqlConnection,Source,Initial,Catalog,Bodgett,Open,SqlDataAdapter,SELECT,FROM,Employee,Fill,DataSource,syntax,WILD,CARDS,View,records,provider,characters,DefaultView,RowFilter,DataView

Sunday, July 5, 2009

OMG! Duplicate Files!! Not a problem anymore!

There was a time where it took me zillion hours to go through my playlist, my software folders and all my other load of images and videos….only to find they contain duplicates! Well though it took me zillion hours, i doubt whether i have done the job correctly!

But now it takes me only 10 seconds to scan my music folder, 15 seconds or less to scan my software list and less than 5 seconds to scan my list of images and get my hands on a neatly arranged, flexible and comprehensive list of duplicate files…all ready to be displayed in any customized way i want…

Ladies and Gentlemen, introducing Duplicate Cleaner by Digital Volcano. This too good to be free utility makes searching across directories and finding duplicates as easy as 1,2,3!

image

Digital Volcano, Duplicate Cleaner 1.3 (The latest version at the time of writing) starts with a very easy to understand interface!

First you need to decide where am i going to search for duplicates! You can choose any directory or a drive! Simply select it and click Add Path.

Now choose what you want to search :)

There are 2 handy sections, File Search and Music  Search…

image

The File search includes the basic search options. You can specify a File Filter (Wildcards) to limit which files to search for. The other amazing feature is check for the Same Content(CRC) which guarantees you almost 100% accurate search results :) Apart from that, you can search for same File Name, Size or Date.

The second option (Music Search, which saved me gigs out of my huge music collection) is the option to search for music files. It searches for songs with the same Artist, Title or Album.

Example result from my music folder may show that a particular song is there in 2 folders. Once i get the results, i can just check whatever file i need and press “Remove Selected”

image

Removing, does not necessarily mean getting rid of the file, that is why you can either delete to recycle bin, permanently delete or move all checked files to another folder.

 

Now lets say, your search returned 1000 duplicate entries, are you going to go through everything and check all by your self? Nope! That is when the handy Selection Assistant comes in to play!

image

It can make your life easier by specifying which files you want to delete, whether the file with the lowest bit rate, lowest sample rate or shortest length. (The option is to actually keep the opposite )

Or keep the newest/oldest or smallest/largest or by search pattern. When you click close after selecting the options to your heart’s content, just click remove selected files to get rid of them!

I anyway like the CRC option in the file search and it is the most used search method for me.

Duplicate Cleaner is a truly amazing piece of freeware, which perfectly does the job and saves your hard disk space and the money in your wallet!

Brilliant job, Digital Volcano

Sunday, April 5, 2009

Ubuntu 9.04 is HERE :D :D :D :D



Order your free Ubuntu CD from http://shipit.ubuntu.com

Thursday, March 12, 2009

How to connect to a SQL Server database using Visual Studio

Hoping that the credit screen is working properly, lets move on to the basics of connecting to a database and retrieving single or multiple data items. For this tutorial we are using Visual Studio 2008 with Microsoft SQL Server (which is normally installed with Visual Studio)

So fire up the IDE (Integrated Development Environment) which is Yes! You guessed it right! Visual Basic Studio and lets get down to some serious business.... (Well its easy! Believe me! )

So once the IDE is up and running start fresh with a new project. Make it a Visual Basic Windows Application.

Now lets first add a database to this project.

Go to Project -> Add New Item

Now you will be presented with a huge list of items that can be added to the Project. And as you may have seen, there are 2 types of databases. Local Database which has a file name like Database1.sdf and Service Based Database which has a name like Database1.sdf. So what is the difference? Well i was very curious about it and did some simple googling and found out that


Local Database
A Local Database which has the file extension .sdf is a type of database that is usually used in Mobile Applications. Its a kind of a database which is normally handles database tasks in your PDA or your favourite .
Remember, that though they are intended for Mobile devices, they can be used in desktop standalone applications as well. In contrast to a Service Based Database, as the name implies it does not require a service to be running in the host computer to access the data. The main disadvantage of this is the lack of support for multiple concurrent users. Enough said! Lets move on to Service Based. Well, a lil bit of googling wont hurt you!


Service Based Database
Service Based Databases, again, as the name implies requires a service (Microsoft SQL Server) to be running in the host computer to access the data. These databases ends with the extension .mdf and can be used in large scale applications with zillions of data. These kind of servers coupled with a high end server machine can handle A LOT of concurrent users. Also remember that these databases can also be used in a normal database applications as well. These databases can act as a back end for data intensive websites as well. Another very popular similar database is MySQL.


Now for this tutorial we will use a Service Based Database. Don't worry! I will cover the Local Databases as well. Though they are different conceptually, the coding is not much of a difference.

So now select the Service Based Database from the list of items available. If you find it hard to find it (i dont think so :D) select the category "Data" from the left panel to narrow down your search.




Finally, press Add to add the database to the project. If you are getting a problem at this time, you must have either not installed SQL Server or SQL Server is not running. That being the most basic reasons for the errors, please Google if otherwise.

In the next screen press "FINISH"

You will see that the Database1.mdf is added to the Server Explorer and is displayed in the Solution Explorer.

If you are familiar with creating Tables. Go ahead and skip this section or else keep reading...

Creating a Table
Now lets create a table in the database which we can add/retrieve data. For that simply expand the Database1.mdf using the + button in the solution explorer. After that Right Click on the Tables (In the folder like list of icons) and select Add New Table.



Now you will be presented with a screen which will allow you to define the structure of the table you will be creating. For now, we will create a simple table but i will emphasize on important features with this simple table.

Lets imagine, you have being called by your employer to create an application to keep in track of all the employee's names, their telephone numbers, their addresses and their current status. So for this, you will need 4 fields with different data types.

Read this for further information on choosing data types

So lets create the Table. But there's a catch! Actually you will require 5 fields! The extra one being for the Primary Key. I cannot dig in to deep about creation about databases here because i would need to write a book about it :D But simply put, a Primary Key is something that would identify each record of the database uniquely. For an example we can make a social security number or national identity card number as a PK (Primary Key) because they will never ever ever be duplicated! Please read these articles i found if you do not understand yet, what PK means. Please read THIS, THIS and THIS

So now lets move on and create the fields. Now we have to insert a special field! The PK! So lets choose something like empID which means Employee ID. The data type depends on how many employees are going to be working in the company. Lets say its a very small company with only around 50 people are working, you can select "tiny int". The data range for Tiny Int is 0-255. Always choose a data type which will support extra for future expansion. If the company has more than 1000 employee's the go for Small Int which supports up to -32,768 to 32,767. Forget about the -minus! But now you can store up to 32000+ employee records. For this example, i will choose Small Int. Now right click on the empID field and click "Set Primary Key"


As soon as you make it a primary key notice that "Allow Nulls" checkbox gets unchecked. Because a primary can never ever ever be null (or duplicated!"). Now lets make the primary key get automatically incremented on each record. So when you insert the first employee record, it will get the employee id 1 and the next employee 2 and so on. To do this, scroll down in Column Properties just below where you are creating the table while empID is selected and expand (+) Identity Specification. Now make the "Is Identity" Property True. Now you can specify for "Identity Increment" the amount that should be incremented on each record and "Identity Seed" to specify on where to start incrementing. Lets keep it on the default.

When selecting data types to hold text there is char,varchar,nchar,nvarchar.
the difference between char and varchar is that char is a fixed length text. So if you specify a text shorter than the fixed length, it will add additional spaces to make it to length. In contrast, varchar while having a maximum character limit does not do anything if the input text is smaller than the length.

Use char for text with a fixed length such as a telephone number/identification numbers.
Use nvarchar for anything that the length is unsure such as names, addresses, email addresses etc.

The "n" in front denotes that the field can hold non-unicode characters.

Now lets quickly fill the rest of the table.

Finish the table according to the picture below.

image
Now Save the Table! Use the Save button on the toolbar and enter the name “Employee”. Try to avoid spaces in the name which will later be a trouble when writing SQL statements.
Now that you have created the data, lets fill it with some data… :)
Show Table Data
Right Click the Table and Select “Show Table Data”. Now you can add data in to the table.
image

Fill the table with appropriate data. Don’t worry about inserting an empID, just finish empName and other columns and move on to the next. Filling the empID is automatically handled.
Now that you have Database and a table with data, lets see how you can connect and retrieve the data! :D
image
First add a DataGridView to the form. A DataGridView is a table like view which will allow to show data in a convenient manner.
Now that the DataGridView is added, add a button too and change the name to “cmdLoad” and Text to “Load”
Now your form should look like this.
image
Now my favorite part! Coding!!!!!!
Double Click the Load button and lets start CODING!
First you have to create a Sql Connection to the Database. It is achieved by a SqlConnection object and its connection String.
Dim con As New SqlClient.SqlConnection



Now we have to set the con’s connection string property. The easiest way to get a connection string is from http://www.connectionstrings.com/




But for SQL Server the connection string is pretty straight forward.


Because we are using SQL Server Express Edition (Default SQL Server edition installed with VS 2008) the connection string is the following


con.ConnectionString = "Data Source=.\SQLExpress;Integrated Security=true; AttachDbFilename=|DataDirectory|\Database1.mdf;User Instance=true;"




Now when the connection string is added the next thing you should do is you should open the connection.


con.Open()


Now lets fill the DataGridView with the data in the Table.


First you should understand that the database only understands SQL. So we should construct an SQL statement to talk with the database. SQL stands for Structured Query Language. If you like to learn more about SQL syntax please refer to w3schools and w3schools SQL Select Statement.


Dim sqlString As String = "SELECT * FROM Employee"



This is simply a string which contains the command we are going to pass to the database. This simply says SELECT ALL RECORDS FROM THE TABLE Employee.


Now we require a middle man which will do the talking to the database. Ladies and Gentlemen, say Hello to the SQLDataAdapter. This nice friend when told what to get from the database, will talk in a nice way to the database and get the job done. 


Dim da As New SqlClient.SqlDataAdapter(sqlString, con)


Our “da” is the SqlDataAdapter and we tell him to use sqlString that we wrote and the connection. It is like telling someone what to buy and where to buy :)


Now the “da”, our SqlDataAdapter knows what to buy and where to buy but where to put all the grocery ??


That is where a DataSet comes to play! A DataSet is a object similar to a Shopping Cart :D You can hold one or more tables inside the DataSet. 


Dim ds As New DataSet


OK! Now we’ve got everything! Lets go shopping!


da.Fill(ds, "EmployeeTable")


What the above code does is calls the Fill method of the Data Adapter where two parameters are passed. We are telling the data adapter to use the SQL Statement and the connection we gave and fill the DataSet ds with the data returned from the database and name that set of data “EmployeeTable”


If you did not understand what was told above, take the Shopping Cart for an example. 


image 



A DataSet can keep hold of different sets of tables and data. But when we want a particular set of data how do we retrieve them? That is why each set of data is given a name. Daddy could be a table in the Database, so is Mommy, John and Dan. 


Shopping is over folks! If you did not encounter any problems you have successfully filled the Dataset with all the information in the Employee Table. (Remember? “SELECT * FROM Employee”? SELECT ALL)


So now we should tell to the DataGridView to load the data from the DataSet.


DataGridView1.DataSource = ds.Tables("EmployeeTable")


DataSource is a property of the DataGridView which tells where to get the data. We are telling to get the data from the object ds’s (the dataset). Notice that ds contains “Tables”, which are like compartments storing data. So we are asking for the container named “EmployeeTable” which we filled prior. If you know about arrays, you can use the array index instead of the name of the container. The following code will work too, because it is the first container of data we filled.


DataGridView1.DataSource = ds.Tables(0)


Notice that we have included an array index (aka array subscript) 0. Why 0?? Why not 1??? Because in VB .NET, an array always starts with the index 0. 


OK now after the coding is done. Run the program and press the “Load” button. Your DataGridView should be filled now!


image
Here is the complete coding!


Public Class Form1

Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLoad.Click

Dim con As New SqlClient.SqlConnection
con.ConnectionString = "Data Source=.\SQLExpress;Integrated Security=true; AttachDbFilename=|DataDirectory|\Database1.mdf;User Instance=true;"
con.Open()

Dim sqlString As String = "SELECT * FROM Employee"
Dim da As New SqlClient.SqlDataAdapter(sqlString, con)

Dim ds As New DataSet


da.Fill(ds, "EmployeeTable")

DataGridView1.DataSource = ds.Tables("EmployeeTable")

End Sub
End Class









Saturday, February 21, 2009

Create a sliding credit screen in VB .NET

Difficulty : Very Easy



Time to Complete : 10-15 minutes



Click the images for larger images!



Most of you must be familiar with the sliding credits screen in many different software. When you click the about box in the software, you are presented with a sliding text moving upwards with nice music. So lets see how to do it with Visual Basic .NET 2008



Start either Visual Studio 2008 or Visual Basic Express 2008. This works in Visual Studio 2005 and Visual Basic Express 2005 as well.



Go to File –> New Project and select “Windows Forms Application” under Visual Basic –> Windows. (See the pane to your left). Rename it below to Credit Screen or what you think is appropriate.



Step 1



ScreenHunter_06 Feb. 21 11.51



Now lets fit in the components :)





Ingredients



1 Label with whatever text you want do display



2 Timers



Few lines of coding



Lets start cooking!



First drag and drop 2 Timers to the screen. Timers are found in the Toolbox which is to your left of screen (usually!) under Components.



Timer is a component which will repeatedly execute a command or set commands at an interval specified. You can use a Timer to change something every 1 second or every 10 seconds. So we are using a Timer now to change the background color! Neat, eh? :)



ScreenHunter_09 Feb. 21 12.05



Notice that now you have 2 Timers in the bottom pane of the screen.



So Timer1 is going to be take care of the colors! Oh yes colors! I’m pretty sure you don’t want the text to slide up in some empty boring background. So we will be making the screen display random colors while our text is sliding up.



Now lets change the properties of “Timer1”. Properties are displayed in a small box usually to the bottom right of the screen. Properties are different attributes of components which is used to change how the components look and behave.



Now change the properties of Timer1.




  • Enabled –> True


  • Interval –> 100



By setting the Enabled property to True we are telling the computer that the Timer will be acting and executing its commands at run time. The interval is how often the commands should be executed.



Now that the properties are changed, lets code for the Timer. Double click the Timer1. You will be presented with the coding window which will look something like below.



ScreenHunter_11 Feb. 21 12.29







Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'Whatever your coding
End Sub



The coding between the above 2 lines are the lines which will be executed at the specified interval, in our case each 100 milliseconds the ‘Whatever your coding line will be executed. But as a ' is at the beginning of a line which means the line is comment, it will not execute the line.



Now what we are actually going to to is create random colors at each interval of the timer and assign them as the background color at the same time. So we need variables to hold the colors. Probably you must be knowing that almost all the colors in this world can be created with the primary colors RGB. Red. Green. Blue. If you do not understand it now, dont worry! You will later!



OK…now we know what the Timer does lets get to the real coding! yippee!



'We create 3 Integer Variables to hold the Red, Green, Blue colors



Dim Red, Green, Blue As Integer



'Do not panic! As soon as you type this message you will

'get a warning about Unused Local variable 'Red' etc


'Its just saying that we have declared but have not taken


'any use from the variable



'Now we create a random number generator.
'A Random number generator will generate random numbers
'given a specific range


Dim RandomNumGenerator As New Random

'Now we are going to assign each variable a random


'number between 0 and 255. The strategy in this is


'that each color is represented with a value ranging from 0
'to 255 for each Red, Green and Blue values

'Example:- Giving a value between 0 to 255 to each Red, Green and Blue

'we can create colors



'Black is (0,0,0) white is (255,255,255).



Red = RandomNumGenerator.Next(0, 255)
Green = RandomNumGenerator.Next(0, 255)
Blue = RandomNumGenerator.Next(0, 255)



 'Now that we have created 3 numbers lets use them for creating a Red, Green, Blue mixed color


Me.BackColor = Color.FromArgb(Red, Green, Blue)



'We have now setup the back color of the Form
'Me is used to call the form that is currently we are coding for
'BackColor is the property that is used to set or get the Back Color
'Color.FromArgb is a function which will return a color when Red, Green and Blue values are given.


Now that everything is set up! Lets roll!



Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Red, Green, Blue As Integer
Dim
RandomNumGenerator As New Random
Red = RandomNumGenerator.Next(0, 255)
Green = RandomNumGenerator.Next(0, 255)
Blue = RandomNumGenerator.Next(0, 255)
Me.BackColor = Color.FromArgb(Red, Green, Blue)
End Sub

Now this is the code to change the background color… so lets see about the scrolling part…




The scrolling part is pretty easy! All you’ve gotta do is insert the following code for the Timer2’s Tick event




Label1.Location = New Point(Label1.Location.X,
Label1.Location.Y - 1)



Now the Label1 which is somewhere on the form will gradually rise up with each tick of Timer2 because we are steadily keeping the Location X to it self but reducing 1 from the Y coordinate!



The final coding will look like



Public Class Form1

Private Sub Timer1_Tick(ByVal sender As System.Object,
ByVal
e As System.EventArgs) Handles Timer1.Tick
Dim Red, Green, Blue As Integer
Dim
RandomNumGenerator As New Random
Red = RandomNumGenerator.Next(0, 255)
Green = RandomNumGenerator.Next(0, 255)
Blue = RandomNumGenerator.Next(0, 255)
Me.BackColor = Color.FromArgb(Red, Green, Blue)
End Sub

Private Sub
Timer2_Tick(ByVal sender As System.Object,
ByVal
e As System.EventArgs) Handles Timer2.Tick
Label1.Location = New Point(Label1.Location.X,
Label1.Location.Y - 1)
End Sub
End Class


Hope you enjoy!