Simple JDBC address book in Java
Tuesday, March 28th, 2006package myprojects.addressbook;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class loginb{
public static void main(String args[]){
try{
final TextField tf1,tf2;
Label l1,l2,l3;
Button b1;
final JFrame f = new JFrame(”address book”);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(800,800);
f.setLayout(null);
Class.forName(”sun.jdbc.odbc.JdbcOdbcDriver”);
final Connection con =
DriverManager.getConnection(”jdbc:odbc:student”,”",”");
final Statement st = con.createStatement();
Font f1 = new Font(”sansserif”,Font.BOLD,24);
l3 = new Label(”SHEKHAR’S ADDRESS BOOK”);
l3.setBounds(150,10,800,40);
l3.setFont(f1);
f.add(l3);
l1= new Label(”USER NAME :”);
l1.setBounds(200,200,100,30);
f.add(l1);
tf1 = new TextField();
tf1.setBounds( 400,200,100,30);
f.add(tf1);
l2= new Label(”PASSWORD :”);
l2.setBounds(200,250,100,30);
f.add(l2);
tf2 = new TextField();
tf2.setEchoChar(’*');
tf2.setBounds( 400,250,100,30);
f.add(tf2);
b1 = new [...]
Bucket sort in C++
Tuesday, March 28th, 2006/*Bucket sort */
#include<stdio.h>
#include<conio.h>
/*Defining the strcuture for each node in the list*/
typedef struct node
{
float value;
struct node *link;
} node;
void main()
{
/*An array of structures,pointers to the structure*/
node counter[10], *n2,*n1;
float ar[10] = {0.79,0.13,0.16,0.64,0.39,0.20,0.89,0.53,0.71,0.42};
float fa[10],temp;
int i,j,k=0;
float n,a;
clrscr();
/*Initializing the elements of the counter arrray to zero*/
for(i=0;i<10;i++)
{
counter[i].value = 0;
counter[i].link = 0;
}
/*Redcuing the value equal to index of an array*/
for(i=0;i<10;i++)
{
n = ar[i];
j = [...]
Download manager in Java
Tuesday, March 28th, 2006/**
* Download Manager
*
* Save-Listing1 as Download.java, Listing 2 as DownloadManager.java,
Listing 3 as DownloadsTableModel.java, Listing 4 as ProgressRenderer.java.
Then Compile javac DownloadManager.java DownloadsTableModel.java ProgressRenderer.java Download.java
& then javaw DownloadManager
*/
listing 1
import java.io.*;
import java.net.*;
import java.util.*;
// This class downloads a file from a URL.
class Download extends Observable implements Runnable {
// Max size of download buffer.
private [...]
Automatic MySQL backup script
Wednesday, March 15th, 2006#!/bin/bash
#
# MySQL Backup Script
# VER. 2.5 - http://sourceforge.net/projects/automysqlbackup/
# Copyright (c) 2002-2003 wipe_out@lycos.co.uk
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program [...]
Perl script that e-mails new sites popping up in Yahoo! Search
Sunday, March 12th, 2006This script checks Yahoo! Search to find out if any new sites appeared in the top results for the keywords you’re interested in.
Apache rewrite rules for hosting multiple domains
Friday, February 24th, 2006RewriteCond %{HTTP_HOST} site1.com$ [NC]
RewriteCond %{REQUEST_URI} !^/vhosts/site1/.*$
RewriteRule ^(.*)$ /vhosts/site1/$1 [L]
RewriteCond %{HTTP_HOST} site2.com$ [NC]
RewriteCond %{REQUEST_URI} !^/vhosts/site2/.*$
RewriteRule ^(.*)$ /vhosts/site2/$1 [L]
TechRepublic has more.
Yahoo! Maps API in VB.Net
Thursday, February 23rd, 2006Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Globalization
Imports System.Xml
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports WCPierce.Web.UI.WebControls
Partial Class _Default
Inherits System.Web.UI.Page
Public YAHOOAPI_code = “YahooDemo”
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) _
Handles MyBase.Load
Dim gSmallMapControl As New GSmallMapControl()
Dim gMapTypeControl As New GMapTypeControl()
If IsPostBack() = False [...]
Blocking certain sites from hotlinking images via mod_rewrite
Saturday, February 18th, 2006RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite1\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?badsite2\.com/ [NC]
RewriteRule \.(jpe?g|gif|png)$ images/no_hotlink.jpg [L]
Displaying another image when someone hotlinks
Saturday, February 18th, 2006RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|png)$ images/no_hotlink.jpg [L]
Preventing hotlinking images from any domain except Yahoo! Image Search and Google Images
Saturday, February 18th, 2006RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(images\.)?yahoo\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://(images\.)?google\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(jpe?g|gif|png)$ - [F]