Saturday, April 26, 2008

C# DataGrid with DataSet

C# DataGrid with DataSet

Wednesday, April 23, 2008

Get all tutes u may need...

hi frnds,

this is a website known to have a collection of good tutorials.. these may not be standard but these are tutorials submitted by users... and if u browse the net for tutes u know we always look for such tutes instead of books etc.

here is the link KYNOU

if u know such more sites.. then please write in the comments..
thanks.
-Ravi kumar Gupta

Thursday, April 17, 2008

NetBeans Quiz !!!

hi frnds,

have u ever used netbeans... no!! why man... use it now... and install a plugin for "netbeans quiz"

this gives a lots of opportunities to win prizes every week...
Everything that u need.. u will find here..
just have a look at NetBeans Quiz

enjoy
Ravi Kumar Gupta
aka "D'Maverick"

Did you see something.. Google is hiring!!!

hi frnds,
wanna do a job in google... have u noticed something





have a look at this.. Google is hiring

apply on hiring page.
check out jobs page and send in your resume.

enjoy

Sunday, April 13, 2008

Run and Provide : A very basic mail server for intranet using postfix + dovecot + cyrus-imapd + squirrelmail

hi frnds,
i m assuming tht u have a linux installed (fully) but not configured.. ok

assuming hostname = maverick.co.in
so here we go..
u will have postfix, dovecot, cyrus-imapd, squirrel mail, httpd.. i mean web server pre-installed


lets first enable postfix
edit file "/etc/postfix/main.cf"

just uncomment/ add following lines

myhostname = maverick.co.in
mydomain = maverick.co.in
myorigin = $myhostname
inet_interfaces = all
mynetworks = 172.22.0.0/255.255.0.0
alias_maps = dbm:/etc/aliases
alias_database = dbm:/etc/mail/aliases

start the service
service postfix start

now lets configure dovecot
edit file "/etc/dovecot.conf"

just add
protocols = imap imaps pop3 pop3s

start the service
service dovecot start

lets create some users
adduser a
passwd a

start the service
service cyrus-imapd start

now lets configure squirrel mail
open file "/usr/share/squirrelmail/config/conf.pl"

go to server settings
change sendmail to smtp


now lets configure web server
open file "/etc/httpd/conf/httpd.conf"

change document root to [in line no. 265 around]
DocumentRoot "/usr/share/squirrelmail"

and in line no 290


start the service
service httpd start


to start all these automatically when u start ur computer
chkconfig postfix on
chkconfig dovecot on
chkconfig cyrus-imapd on
chkconfig httpd on


and this is ur mail server ready to mail each other... but limited to local users this is not intended to send mails to users on other mail servers...
luk at this like.. a gmail user can send mail only to a gmail server...
sry this has no relay facility.. but soon tht will be.. so keep watching...
till then..
enjoy

Thursday, April 10, 2008

Read XML File Using Java

Hi all ,
this is a simple program that uses java classes to read xml files.
If an html file is written without errors then that can also be parsed using this.


import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;

try {
File f = new File("filename");
// first obtain a parser that produces the DOM object tree from XML document
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

// to obtain DOM document instances from XML document
DocumentBuilder db = dbf.newDocumentBuilder();

// Document represents xml or html documents
Document doc = db.parse(f);
doc.getDocumentElement().normalize();

// first get the root
NodeList root = doc.getChildNodes();

// children of root
NodeList nodes = root.item(0).getChildNodes();
for (int i = 0; i <>

// in case there are childs of nodes[i]
NodeList temp = nodes.item(i).getChildNodes();
System.out.println(nodes.item(i).getNodeName());
System.out.println(temp.getLength());

}
} catch (Exception e) {
e.printStackTrace();
}


Suggestion : to know more about this and for those who dont want to mug up the things use netbeans
thanks..

Cryptography: RSA : Java Implementation

hi all,
RSA is a well known encryption algorithm for encryption and decryption
this is public key cryptography

// choose tho prime number p and q
BigInteger p,q,n,phi;

p = prime(16);
q = prime(16);

// calculate modulus: n and totient: phi
n= p.multiply(q);
BigInteger temp1,temp2;
temp1=p.subtract(BigInteger.ONE);
temp2=q.subtract(BigInteger.ONE);
phi = (temp1).
multiply(temp2);

// choose a prime number and give it name private key.
// and using private key then compute public key

// actually public = private-1mod(phi)
BigInteger private, public;

private = prime(128);

public = private.modInverse(phi);

// now we have both keys private key and public key

//public key is known to anyone and is used to encrypt data
// private key is not disclosed to anyone.. and generally used for decryption



// encryption
BigInteger message;
BigInteger cypherText;

cypherText = message.modPow(public,n);
// cyphertext is encrypted message

// decryption
message =
cypherText .modPow(private,n);

more about cryptography you can get from wikipedia - RSA

JDBC : Easy Steps

hi all,
this is a sample program to show the jdbc connectivity( very simple and limited scopes but enough to create any program using jdbc)

Connection conn;
String driver = "XXXXXX.xxx.xx.xx";
String url = "xxx:XXX:xxx"; // remember the colon here
// url contains the database name

// loading the driver
Class.forName(driver);

// creating a connection
conn = DriverManager.getConnection(url);

Statement stmt = conn.createStatement();
String query = "xxxxxxx";

ResultSet result = null;

/*
* different queries need different methods to be executed
*/

/*
*
* in case of select
* result = stmt.executeQuery(query);
*
*/

/*
*
* in case of insert, update, delete
* stmt.executeUpdate(query);
*
*/

// Like if we use select query
result = stmt.executeQuery(query);

// initially curson is set before first row of the result
// so we need to make it at the desired row

result.next();
// we can use result.first() to get it at first row or result.last() to get it at the
// last row

String str = result.getString("attribute-name");

// finally
conn.close();

this was the very basic tute to implement jdbc.
if u want more then use javadocs.

thanks
Ravi Kumar Gupta ~A.K.A~ "D'Maverick"

Friday, April 4, 2008

Received My Ipod, T-shirts and Certi......

hi frnds,

it was my first achievement in any technical contest (actually it is first i took part.. :P)...

see this...
http://in.sun.com/communities/univ/codeforfreedom/winners.html

thanks for all the people who encouraged me for this.. and a great thanks goes to rahul my partner in this contest.

enjoy..