Posts filed under 'linux'
A small tutorial on linking C#.NET with MySql Database
Well,I was just trying out some stuff in ADO.NET , i.e. relating C#.net with databases.So here are some basic stuff you need to do before you get started with c#.net and database handling.
1. Get MySql installed on your computer and set the userid and password.
2. Get the MySql connector. get it @ http://dev.mysql.com/downloads/connector/net/6.0.html
So,lets’ get started.First create a windows form application(we will use it to view the tables ,when we do a query).
Step 1 : Right click the properties,and add reference.
Select MySql.Data
and include using Mysql.Data.MysqlClient
Step2 : Establish Connection
1.string connect = “DataSource=localhost;Initial Catalog=login;User ID=root;Password=admin;” ;
2.MySqlConnection con = new MySqlConnection(connect);
3.con.Open();
1. Create a connection string.Here,DataSource refers to the ip address where the MySql database is present,Initial Catalog being the Database you are connecting to, UserId being the Mysql userid and password ,the password for the same.
2. Create a new MySqlConnection object and pass the connection string.This creates an object and you are ready for connecting
3. It establishes the connection.
Step 3 :
string querystr = textBox1.Text;
MySqlCommand cmd = new MySqlCommand(querystr, con);
cmd.ExecuteNonQuery();
querystr takes a query from the text box in the form.
MySqlcommand cmd passes the query along with the connection string.
ExecuteNonQuery() method is necessary to execute the same.
You can execute any kind of MySqlstatement..All you need to do is type the exact statement in the TextBox
Sample MySQL query statements :
insert into marks_table (sl_no,name,marks) values ( 5,’xyz’,89);
this inserts a row into the table called marks_table with values 5 , xyz and 89 under serial no,name and marks
Hope this post was useful.Will continue on how to display later.Feelin sleepy.!
Cheerio
1 comment July 9, 2009
A key note on apt
Just felt like writing something useful…I’ve been checking out on packaging for a while now,and came up with some couple of interesting(and not so interesting details)
1. apt-get and apt-cache are exclusively for .deb packages.But now they have come up with apt-rpm too for rpm packages.
2.The sources.list file present @ /etc/apt can be modified .What do we gain? In case you find a great repositary for .deb packages and others,then you can list them out there.I’ll just paste the contents down here..
#deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Release i386 (20090420.1)]/ jaunty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty universe
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty universe
deb http://in.archive.ubuntu.com/ubuntu/ jaunty-updates universe
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://in.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
## Uncomment the following two lines to add software from the ‘backports’
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://in.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical’s
## ‘partner’ repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu jaunty partner
# deb-src http://archive.canonical.com/ubuntu jaunty partner
deb http://security.ubuntu.com/ubuntu jaunty-security main restricted
deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted
deb http://security.ubuntu.com/ubuntu jaunty-security universe
deb-src http://security.ubuntu.com/ubuntu jaunty-security universe
deb http://security.ubuntu.com/ubuntu jaunty-security multiverse
deb-src http://security.ubuntu.com/ubuntu jaunty-security multiverse // ADD IN THE FOLLOWING FORMAT ONLY.
root@ubuntu:/etc/apt# clear
root@ubuntu:/etc/apt# cat sources.list
#deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Release i386 (20090420.1)]/ jaunty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty universe
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty universe
deb http://in.archive.ubuntu.com/ubuntu/ jaunty-updates universe
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://in.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
## Uncomment the following two lines to add software from the ‘backports’
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://in.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical’s
## ‘partner’ repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu jaunty partner
# deb-src http://archive.canonical.com/ubuntu jaunty partner
deb http://security.ubuntu.com/ubuntu jaunty-security main restricted
deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted
deb http://security.ubuntu.com/ubuntu jaunty-security universe
deb-src http://security.ubuntu.com/ubuntu jaunty-security universe
deb http://security.ubuntu.com/ubuntu jaunty-security multiverse
deb-src http://security.ubuntu.com/ubuntu jaunty-security multiverse
Cheerio!
Add comment June 30, 2009
A letter to Carlos Tevez….
Dear Carlito,
Hope you have picked up little english in your stay at the epl to comprehend this.Firstly thank you for your services.Please sign for Manchester City.Manchester United has too much competition among their ranks with players like Wayne Rooney,Dimitar berbatov,Federico macheda and Welbeck.Backed by a loser of a manager(legendary),not only have you lost half your eye for the goal,you have lost your nuts in the process.Definitely winning the Champions League,English Premier League twice,Carling Cup,Club World Cup and earning 80,000 pounds a week is far more demeaning than earning 200,000 pounds and losing week in and week out(probably drawing),with an end of season report indicating the progress in the table(i.e.finishing 8th). Your fifteen goals a week and your cry baby Argentine attitude is no longer warranted.Hopefully you come over to OT and your team gets their balls whacked as always.Hopefully,mancity gets to see some silverware,before you retire,else pack your bags to the Turkish / Greece league or ofcourse if your are 33+ or more when you make this decision,dont’ loose hope.There is a old age home available in Italy,popularly known as AC Milan.
Loads of love,
A Manchester united fan
2 comments June 29, 2009
control.tar.gz – What’s inside?
Lets take a look at the contents of control.tar.gz file.In case you are wondering what that is,plz take some time out to see what we are really talking!
In order to access the files inside the .deb file,fire nautilus and open them using archive manager(present in almost all linux editions)
control.tar.gz contains the following files
* control
*md5sums
*postinst
*postrm
*prerm
The most interesting file is control.
the contents are as follows:
i have opened the control file for epiphany browser’s deb package.control essentially gives all the .deb package including architecture and RELATED dependencies.So go through them carefully!
Package: epiphany-erowser
Version: 2.14.3-8
Section: gnome
Priority: optional
Architecture: i386
Depends: libart-2.0-2 (>= 2.3.16), libatk1.0-0 (>= 1.12.2), libaudiofile0 (>= 0.2.3-4), libavahi-client3 (>= 0.6.13), libavahi-common3 (>= 0.6.10), libavahi-glib1 (>= 0.6.12), libbonobo2-0 (>= 2.13.0), libbonoboui2-0 (>= 2.5.4), libc6 (>= 2.3.6-6), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 0.94), libdbus-glib-1-2 (>= 0.71), libesd0 (>= 0.2.35) | libesd-alsa0 (>= 0.2.35), libfontconfig1 (>= 2.4.0), libfreetype6 (>= 2.2), libgcc1 (>= 1:4.1.1-12), libgconf2-4 (>= 2.13.5), libgcrypt11 (>= 1.2.2), libglade2-0 (>= 1:2.5.1), libglib2.0-0 (>= 2.12.0), libgnome-desktop-2 (>= 2.11.1), libgnome-keyring0 (>= 0.6.0), libgnome2-0 (>= 2.14.1), libgnomecanvas2-0 (>= 2.11.1), libgnomeprint2.2-0 (>= 2.12.1), libgnomeprintui2.2-0 (>= 2.12.1), libgnomeui-0 (>= 2.13.0), libgnomevfs2-0 (>= 2.13.92), libgnutls13 (>= 1.4.0-0), libgpg-error0 (>= 1.4), libgtk2.0-0 (>= 2.8.0), libice6 (>= 1:1.0.0), libjpeg62, libmozjs0d (>= 1.8.0.13~pre070720), libnspr4-0d (>= 1.8.0.10), liborbit2 (>= 1:2.14.1), libpango1.0-0 (>= 1.14.8), libpng12-0 (>= 1.2.13-4), libpopt0 (>= 1.10), libsm6, libstartup-notification0 (>= 0.8-1), libstdc++6 (>= 4.1.1-12), libtasn1-3 (>= 0.3.4), libx11-6, libxcursor1 (>> 1.1.2), libxext6, libxfixes3 (>= 1:4.0.1), libxi6, libxinerama1, libxml2 (>= 2.6.27), libxrandr2, libxrender1, libxslt1.1 (>= 1.1.18), libxul0d, python2.4 (>= 2.3.90), zlib1g (>= 1:1.2.1), gnome-icon-theme (>= 2.9.90), dbus, iso-codes, xulrunner-gnome-support, gconf2 (>= 2.12.1-1)
Recommends: yelp, epiphany-extensions
Suggests: mozplugger
Conflicts: epiphany-extensions (<< 2.14)
Provides: www-browser, gnome-www-browser
Installed-Size: 9996
Maintainer: Jordi Mallach <jordi@debian.org>
Description: Intuitive GNOME web browser
A simple yet powerful GNOME web browser targeted at
non-technical users. Its principles are simplicity and standards
compliance. Simplicity is achieved by a well designed user interface and
reliance on external applications for performing external tasks (such as
reading email). Simplicity should not mean less powerful. Standards
compliance is achieved on the HTML side by using the Gecko
rendering engine, as developed for the Mozilla and Firefox browsers; and
on the user interface side by closely following the GNOME Human Interface
Guidelines (HIG) and by close integration with the GNOME desktop.
I’ll continue with the other files in the upcoming posts…
Add comment June 26, 2009
How to view contents of a .deb file
.deb packages can be installed by using dpkg -i .The dpkg installs(in windows terms)the necessary software on your system.But how do you view the contents of a .deb package.If it had been a package comprising of say installation and configuration files,you can always unzip them into a particular folder.What is present inside a .deb package? to find out,do a simple ar tv and you’ll get three files.
1.debian-binary(which contains the version number)
2.control.tar.gz
3.data.tar.gz
I’ll post about the contents of the other two files later…
Add comment June 26, 2009
Installing a .tar.gz file
Many of you ,(those who are new to linux) must be wondering how on earth to get the softwares installed?Believe me,even I thought the same.I was actually struggling with my VLC package for Linux.I started off with Open Suse XI with absolutely no prior knowledge and almost screwed up my system.So this tutorial should be able to get you running with respect to installation of .tar.gz files..
What is a .tar.gz file?
.tar.gz file is a format registered under GNU.
.tar represents uncompressed version of packaging,which was used in the earlier days.After applying some compression techniques such as Gzip ,etc. it led to a new format ,which was compressed form of tar and hence the name .tar.gz
Why should I bother about .tar.gz file?
Good Question.But majority of the softwares available in linux,are present in either .rpm format or .tar.gz or .deb . So more or less , you’ll come across this term in the linux circles.
How do I identify a .tar.gz file?
Simple,the file is followed by a .tar.gz extenstion
Eg: dpkg_1.13.25.tar.gz
general form : <filename>.tar.gz
F*** the stories now,take me to the important place!
Alright,chill! So here we go.!
Go to the directory where you have downloaded the .tar.gz file.Suppose it was downloaded to /home/xyz
CODE:
cd xyz
Now extracting the .tar.gz file…Remember this is only the second step,you have just extracted the setup files,you still have to install them!!!
For extracting use the following,
say file name was extractme.tar.gz
CODE:
tar -zxvf extractme.tar.gz
Once you hit this code on your terminal,you’ll get a folder of the same name at /home/xyz,indicating that the file has been extracted.
Now open the folder.
cd extractme
followed by,
ls extractme
Generally, the final 3 stages are as follows:
- Configure the installation
- Compile the software
- Install the binaries
You’ll find two – three key files which are to be used.
1.README , open the same to get instructions on how to install the package.
2.INSTALL
3.CONFIGURE
Last few steps…
code :
./configure
make install
And thats’ it! You have installed your .tar.gz successfully!!
1 comment June 26, 2009