<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3550559392700243747</id><updated>2011-11-27T15:31:04.137-08:00</updated><category term='FileCopy'/><category term='J2ME'/><category term='http proxy'/><category term='DNS'/><category term='dnsjava'/><category term='javascript'/><category term='java'/><category term='watermark'/><category term='php'/><category term='javamail'/><category term='web calendar'/><category term='C/C++'/><category term='perl'/><category term='multithreading'/><category term='utf8 convert'/><category term='cookie'/><category term='SOAP'/><category term='regex'/><category term='daemon'/><category term='clock'/><category term='splash screen'/><category term='web service'/><category term='telnet'/><category term='parse CVS'/><category term='JMailer'/><title type='text'>Free Code,Example Code</title><subtitle type='html'>FreeCode, Example Code,Free Programming Source Code: The FreeCode-FreeCode blog is the largest collection of free Internet related source code. Free programs are available in the following languages: C/C++, Java, Javascript, Ajax and Perl...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>66</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5068654045956164782</id><published>2008-11-14T05:51:00.000-08:00</published><updated>2008-11-14T06:03:29.123-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='utf8 convert'/><title type='text'>How to GBK(GB2312) and UTF-8 encoding conversion between in JavaScript</title><summary type='text'>following js code show to how to convert text between Simplified Chinese GB 2312 text strings into UTF8 using JavaScript.


GB2312UTF8  = {
  Dig2Dec : function(s){
      var retV = 0;
      if(s.length == 4){
          for(var i = 0; i &lt; 4; i ++){
              retV += eval(s.charAt(i)) * Math.pow(2, 3 - i);
          }
          return retV;
      }
      return -1;
  } ,

  Hex2Utf8 : function</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5068654045956164782'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5068654045956164782'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/11/how-to-gbkgb2312-and-utf-8-encoding.html' title='How to GBK(GB2312) and UTF-8 encoding conversion between in JavaScript'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-2641268228284916332</id><published>2008-07-07T02:22:00.000-07:00</published><updated>2008-07-07T02:29:20.550-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>How to send messages using PHP</title><summary type='text'>sendMsg is a class which allows you to send a message to a contact from a specified account. It logs in, changes status to online, creates a new IM session with the target user, sends the message and ends both connections.

The Messenger server imposes a limit on how many IM sessions can be created per minute, so the script is not suited for sending messages to large numbers of contacts within </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2641268228284916332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2641268228284916332'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/07/how-to-send-messages-using-php.html' title='How to send messages using PHP'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-8918938754781529575</id><published>2008-06-25T20:17:00.000-07:00</published><updated>2008-06-25T20:27:48.886-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2ME'/><title type='text'>How to send  SMS in J2ME</title><summary type='text'>The sample code on how to send SMS through J2ME.


import java.io.IOException;

import javax.microedition.io.Connector;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;

/** Sends an SMS message */
public class SMSender implements Runnable {
  private String smsReceiverPort;
  private String message;
  private String phoneNumber;

  public SMSender(</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8918938754781529575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8918938754781529575'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/06/how-to-send-sms-in-j2me.html' title='How to send  SMS in J2ME'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5584118850450619114</id><published>2008-06-16T01:07:00.000-07:00</published><updated>2008-06-16T01:10:27.846-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Using the Comparable interface to compare and sort objects</title><summary type='text'>This code example shows how to compare and sort objects by implementing the  Comparable interface. The code consists of a class called Main and another class  called Car.

The Main class creates a few instances of the Car class (which is  the one that implements the Comparable interface) and them compare them and also  sort them.


The Car class has three attributes, make, year and mileage.  Only</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5584118850450619114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5584118850450619114'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/06/using-comparable-interface-to-compare.html' title='Using the Comparable interface to compare and sort objects'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6685599124065114085</id><published>2008-06-12T02:35:00.000-07:00</published><updated>2008-06-12T02:39:36.342-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>How to read floppy disk information in C++</title><summary type='text'>Reads information from an inserted floppy disk.
like clusters, sectors etc.

//Disk.cpp
//Reads floppy disk properties(Ensure floppy is avaiable in drive)
//Renjith Joseph
//Perumbavoor P.O, Ernakulam Dist. Kerala State, india
//E-mail: renjithmathewjoseph@hotmail.com
//All rights reserved.

#include&lt;iostream.h&gt;
#include&lt;conio.h&gt;
#include&lt;dos.h&gt;
void main(){
     clrscr();
     //Floppy Drive </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6685599124065114085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6685599124065114085'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/06/how-to-read-floppy-disk-information-in.html' title='How to read floppy disk information in C++'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1730603445951110356</id><published>2008-06-12T02:27:00.000-07:00</published><updated>2008-06-12T02:34:10.976-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>An implementation of Stack datastructure in C++</title><summary type='text'>
#include &lt;iostream&gt;
#include &lt;new&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
using namespace std;

#if !defined __STACK_H
#define __STACK_H

namespace stk{
  class Stack{
    private:
      int *p;
      int top,length;

      string str()const;
    public:
      Stack();
      Stack(const int);
      Stack(const Stack&amp;);
      ~Stack();

      void push(int);
      int pop();
      int get_length()</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1730603445951110356'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1730603445951110356'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/06/implementation-of-stack-datastructure.html' title='An implementation of Stack datastructure in C++'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1706403204736318096</id><published>2008-06-11T18:05:00.000-07:00</published><updated>2008-06-11T18:30:06.325-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>How to run external system commands in Java</title><summary type='text'>Running a system command is relatively simple - once you've seen it done the first time.  It involves the use of two Java classes, the Runtime class and the Process class.  Basically, you use the exec() method of the Runtime class to run the command as a separate process.  This returns a Process object for managing the subprocess.  Then you use the getInputStream() and getErrorStream() methods of</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1706403204736318096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1706403204736318096'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/06/how-to-run-external-system-commands-in.html' title='How to run external system commands in Java'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-216560513292985872</id><published>2008-06-11T02:01:00.000-07:00</published><updated>2008-06-11T02:05:43.875-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='multithreading'/><title type='text'>Multi-threaded programming - Multithreaded chat application in java</title><summary type='text'>This is the server and the client program thatI wrote basically it gives u a good understanding of how sockets work in java .

/*This is the server for the MultiThreadedChatClient program thatI 
 wrote basically it gives u a good understanding of how sockets 
 work in java
 Author: Mohammed Alfaaz
 email:alfaaz@gmail.com
 */
import java.io.*;
import java.net.*;

public class MultiThreadChatServer</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/216560513292985872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/216560513292985872'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/06/multi-threaded-programming.html' title='Multi-threaded programming - Multithreaded chat application in java'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-344149709205429036</id><published>2008-06-10T07:41:00.000-07:00</published><updated>2008-06-10T07:51:24.030-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='watermark'/><title type='text'>How to add watermark to images in java</title><summary type='text'>The tool to adding watermark to images,recommended markImage () methods to create watermark image. You can use it in jsp, servlet, app.


import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileOutputStream;
import </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/344149709205429036'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/344149709205429036'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/06/how-to-add-watermark-to-images-in-java.html' title='How to add watermark to images in java'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6031428323642431692</id><published>2008-05-12T08:34:00.000-07:00</published><updated>2008-05-12T08:38:46.729-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>How to access a database by ADO with JavaScript</title><summary type='text'>I have not found any sample that shows database access with javaScript. Well, I created one. It is very simple since Javascript has the activeXObject that allow us to call an external object in the same way that vbscript uses CreateObject. 


//**************************************
// Name: ADO With JavaScript
// Description:I have not found any sample that shows database access with javaScript.</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6031428323642431692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6031428323642431692'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/05/how-to-access-database-by-ado-with.html' title='How to access a database by ADO with JavaScript'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-2380978156600031979</id><published>2008-05-12T07:57:00.000-07:00</published><updated>2008-05-12T08:31:04.544-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Encrypts a string by the given "key"</title><summary type='text'>A more slightly advanced encryption.Encrypts a string by the given "key".

import javax.swing.JOptionPane;


public class betterencryptor {

 public static void main(String[] args) {
  int key1 = Integer.parseInt(JOptionPane.showInputDialog("Input a key, a random large *prime* number:"));
  String message1 = JOptionPane.showInputDialog("Input a string to be encrypted/decrypted:");
  String crypt1</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2380978156600031979'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2380978156600031979'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/05/encrypts-string-by-given-key.html' title='Encrypts a string by the given &quot;key&quot;'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-8340661482110594213</id><published>2008-03-12T02:34:00.000-07:00</published><updated>2008-03-12T02:37:54.420-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>How to create a zip file</title><summary type='text'>This code example shows how to create a zip file.
What we do is to create an input stream from the file we want to compress, and while we read from it we write the contents to an output stream.
This output stream is of type ZipOutputStream which takes an FileOutputStream as parameter.
Next we have to add a zip entry to the output stream before we start writing to it.
We will also clean up by </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8340661482110594213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8340661482110594213'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/03/how-to-create-zip-file.html' title='How to create a zip file'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-3709597184985075736</id><published>2008-02-21T06:29:00.000-08:00</published><updated>2008-02-21T06:30:59.497-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Write to file using BufferedOutputStream</title><summary type='text'>This code snippet shows how to write to a file using a BufferedOuputStream.
Now it should be said that if you want to write text to a file you should probably find it easier to go with a Writer class like the BufferedWriter instead.
The write method of the BufferedOuputStream takes either a byte array or an int as argument so that is why we have to call getBytes() on any String that we provide to</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3709597184985075736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3709597184985075736'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/write-to-file-using-bufferedoutputstrea.html' title='Write to file using BufferedOutputStream'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1058054979031097972</id><published>2008-02-21T06:28:00.000-08:00</published><updated>2008-02-21T06:29:14.725-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Read from file with BufferedInputStream</title><summary type='text'>This example shows how to read the contents of a file using a BufferedInputStream.
There are a couple of ways to do so, and in this example we use a byte array to store the data read.
We loop through the file contents and fill out buffer up to the size of the buffer array until there are no more data left to read.
It possible to read from the file one byte at a time, but to use a buffer is more </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1058054979031097972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1058054979031097972'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/read-from-file-with-bufferedinputstream.html' title='Read from file with BufferedInputStream'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6596629326079899440</id><published>2008-02-21T06:14:00.000-08:00</published><updated>2008-02-21T06:26:45.897-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Read each line in a comma separated file into an array</title><summary type='text'>In this example we read the lines of a comma separated file and split the values into an array.
This is done fairly easy with the split() method, which takes a separator as an argument and returns 
an array of Strings.


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;


public class CsvTest {

  public void readFile() {

</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6596629326079899440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6596629326079899440'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/read-each-line-in-comma-separated-file.html' title='Read each line in a comma separated file into an array'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1109770640762849898</id><published>2008-02-19T05:57:00.000-08:00</published><updated>2008-02-19T06:01:11.474-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Base64 encoding and Base64 decoding in C</title><summary type='text'>
#include "lib.h"

/**
 * characters used for Base64 encoding
 */  
const char *BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

/**
 * encode three bytes using base64 (RFC 3548)
 *
 * @param triple three bytes that should be encoded
 * @param result buffer of four characters where the result is stored
 */  
void _base64_encode_triple(unsigned char triple[3], </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1109770640762849898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1109770640762849898'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/base64c.html' title='Base64 encoding and Base64 decoding in C'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6868501110619136172</id><published>2008-02-19T05:35:00.000-08:00</published><updated>2008-02-19T05:38:52.806-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>How to quickly sort Vector of objects that implement the Comparable interface in java</title><summary type='text'>
import java.util.Vector;  

/**
 * Implements the quicksort algorithm.
 * Sorts Vectors of objects that implement the Comparable interface.
 * The sort is based on Comparable.compare(obj) method.
 * @see Comparable
 */  
public class QuickSorter {

 /**
   * performs the sort.
   *
   * @param vect the Comparable Objects to be sorted.
   */  
  public static void sort(Vector vect)  {
    </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6868501110619136172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6868501110619136172'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/how-to-quickly-sort-vector-of-objects.html' title='How to quickly sort Vector of objects that implement the Comparable interface in java'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-9159899327983851436</id><published>2008-02-18T07:01:00.000-08:00</published><updated>2008-02-18T07:03:36.790-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Listing the system properties</title><summary type='text'>By listing the properties of the system you run the program on you can find out a lot about it. Your program maybe should act in a certain way depending on what operating system it's currently on.
This code example shows how to retrieve the properties and how to enumerate through and print them out to the console. 


import java.util.Enumeration;
import java.util.Properties;

/**
 *
 * @author </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/9159899327983851436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/9159899327983851436'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/listing-system-properties.html' title='Listing the system properties'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-2774950301104544097</id><published>2008-02-18T06:57:00.000-08:00</published><updated>2008-02-18T06:59:22.568-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Check if a String is a valid date</title><summary type='text'>This example checks if a String is a valid date by parsing the String with an instance
of the SimpleDateFormat class and returns true or false.


import java.text.SimpleDateFormat;
import java.text.ParseException;

public class DateTest {

  public boolean isValidDate(String inDate) {

    if (inDate == null)
      return false;

    //set the format to use as a constructor argument
    </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2774950301104544097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2774950301104544097'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/check-if-string-is-valid-date.html' title='Check if a String is a valid date'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-3170555022235921128</id><published>2008-02-18T06:37:00.000-08:00</published><updated>2008-02-18T06:52:10.426-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>how to determine window size in javascript</title><summary type='text'>Use this snippet to determine the size of an open window. Can be used in many different situations, e.g., for setting the size of a div.


&lt;script type="text/javascript"&gt;

if (window.innerWidth)
  theWidth=window.innerWidth;
else if (document.documentElement &amp;&amp; document.documentElement.clientWidth)
  theWidth=document.documentElement.clientWidth;
else if (document.body)
  theWidth=</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3170555022235921128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3170555022235921128'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/how-to-determine-window-size-in.html' title='how to determine window size in javascript'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-8999797532532555617</id><published>2008-02-17T07:16:00.000-08:00</published><updated>2008-02-17T07:17:02.931-08:00</updated><title type='text'>Getting data from the computer clipboard</title><summary type='text'>Getting data from the system clipboard is implemented nicely in Java through the Toolkit class which has a getSystemClipboard method.
Since there isn't necessarily text contents in the clipboard the getSystemClipboard returns an instance of the class Transferable. 
With that instance we have to test if the content is text before we do any processing with it.
To test the code, just copy some text </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8999797532532555617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8999797532532555617'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/getting-data-from-computer-clipboard.html' title='Getting data from the computer clipboard'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-790202197356439955</id><published>2008-02-17T07:15:00.000-08:00</published><updated>2008-02-17T07:16:06.832-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Placing text on the computer clipboard</title><summary type='text'>It is very easy to place text on the clipboard with Java.
We just get an instance of the default toolkit and from that we get hold of a reference to the clipboard object.
To place some text on the clipboard we need to pass an object of type Transferable and another object which is the clipboard owner to the method setContents.
To make it easy we may specify null as the owner, and as the first </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/790202197356439955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/790202197356439955'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/placing-text-on-computer-clipboard.html' title='Placing text on the computer clipboard'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-9016334180679395130</id><published>2008-02-17T07:10:00.000-08:00</published><updated>2008-02-17T07:12:52.788-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Connect to a database and read from table</title><summary type='text'>This example shows how to connect to a database, in this case a MS SQL Server database
and read rows from a table.
It is assumed that the table has 3 columns and they all contains string-values (datatype char, varchar etc.).
To connect to another database type, just change the driver and url to match the specific type.

Note that you'll have to change some of the values to match your own </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/9016334180679395130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/9016334180679395130'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/connect-to-database-and-read-from-table.html' title='Connect to a database and read from table'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5134461186020908352</id><published>2008-02-17T06:57:00.000-08:00</published><updated>2008-02-17T06:58:50.333-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>How to extract contents of a zip file</title><summary type='text'>This example shows how to extract a zipfile containing one file (or entry). 
The name of the zip file is 'compressed.zip' and we want to write the contents to a file called 'extracted.txt'.
We start by opening an input stream to the compressed file and an output stream to the file where we want the content to be extracted.
After that we get the next entry of the zip file (and the only entry in </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5134461186020908352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5134461186020908352'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/how-to-extract-contents-of-zip-file.html' title='How to extract contents of a zip file'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-2537900132613808257</id><published>2008-02-17T06:55:00.000-08:00</published><updated>2008-02-17T06:57:01.163-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>How to list the contents of a zip file</title><summary type='text'>To list the contents of a zip file you need to get the entries of the file since every file in a zip file is represented by an entry.
In this case we assume that the filename of the zip file is 'testfile.zip'. By calling the entries method of the ZipFile object we get an Enumeration back that can be used to loop through the entries of the file.
Note that we have to cast each element in the </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2537900132613808257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2537900132613808257'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/how-to-list-contents-of-zip-file.html' title='How to list the contents of a zip file'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-2755249852520336325</id><published>2008-02-14T22:55:00.000-08:00</published><updated>2008-02-14T22:57:08.804-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>How to remove duplicate items from an ArrayList</title><summary type='text'>This code example shows how to remove duplicate items from an ArrayList.


  ArrayList arrayList1 = new ArrayList();
    
  arrayList1.add("A");
  arrayList1.add("A");
  arrayList1.add("B");
  arrayList1.add("B");
  arrayList1.add("B");
  arrayList1.add("C");
    
  //Create a HashSet which allows no duplicates
  HashSet hashSet = new HashSet(arrayList1);

  //Assign the HashSet to a new </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2755249852520336325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2755249852520336325'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/how-to-remove-duplicate-items-from.html' title='How to remove duplicate items from an ArrayList'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1363050586954543156</id><published>2008-02-14T22:52:00.000-08:00</published><updated>2008-02-14T22:53:55.080-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>How to send a POST Request with Parameters From a Java Class</title><summary type='text'>his example shows how to sent a POST request to a server with attached parameters. Two parameters are sent in the example code below, width and height.
We use the URL and URLConnection classes to open the connection to the destination. Then the output stream is retrieved by calling getOutputStream() on the URLConnection object.
With the output stream we can write the parameters and then start </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1363050586954543156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1363050586954543156'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/how-to-send-post-request-with.html' title='How to send a POST Request with Parameters From a Java Class'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6201909505472636285</id><published>2008-02-14T22:46:00.000-08:00</published><updated>2008-02-14T22:51:13.266-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>how to remove a line from a text file</title><summary type='text'>This example shows how to delete a line from a file.
The method removeLineFromFile takes two parameters, the first parameter is the file to remove from and the second parameter is the content of the line to remove.
A tempfile is created and written to, except for the content that matches the second parameter.
This way very large files can be handled without demanding so much internal memory.
The </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6201909505472636285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6201909505472636285'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2008/02/how-to-remove-line-from-text-file.html' title='how to remove a line from a text file'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5973630779220987659</id><published>2007-07-07T07:21:00.000-07:00</published><updated>2007-07-07T07:27:42.528-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2ME'/><title type='text'>MIDlet examples to invoke a servlet</title><summary type='text'>
import java.io.*;
import javax.microedition.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

/**
 * An example MIDlet to invoke a servlet.
 */

public class InvokeServletMidlet1 extends MIDlet {

   private Display display;

   String url = "http://127.0.0.1:8080/examples/servlet/HelloServlet";


   public InvokeServletMidlet1() {
      display = Display.getDisplay(</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5973630779220987659'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5973630779220987659'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/07/midlet-examples-to-invoke-servlet.html' title='MIDlet examples to invoke a servlet'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6035759440724129214</id><published>2007-07-07T07:19:00.000-07:00</published><updated>2007-07-07T07:20:44.498-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2ME'/><title type='text'>Socket MIDlet example code(J2ME)</title><summary type='text'>
package ora.ch6;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6035759440724129214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6035759440724129214'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/07/socket-midlet-example-codej2me.html' title='Socket MIDlet example code(J2ME)'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-7180600640232980342</id><published>2007-07-07T07:16:00.000-07:00</published><updated>2007-07-07T07:18:33.582-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2ME'/><title type='text'>Http MIDlet example code(J2ME)</title><summary type='text'>Really working examples categorized by API, package, class. You can compile and run our examples right away! Not from source code for Java projects - only working examples! Copy, compile and run!

package ora.ch6;

import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/7180600640232980342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/7180600640232980342'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/07/http-midlet-example-codej2me.html' title='Http MIDlet example code(J2ME)'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-4905931135297535234</id><published>2007-06-27T07:58:00.000-07:00</published><updated>2007-06-27T08:00:29.650-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Implementing a Class That Can Be Sorted</title><summary type='text'>In order for a class to be used in a sorted collection such as a SortedTree or for it to be sortable by Collections.sort(), the class must implement Comparable.

public class MyClass implements Comparable {
    public int compareTo(Object o) {
        // If this &lt; o, return a negative value
        // If this = o, return 0
        // If this &gt; o, return a positive value
    }
}
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4905931135297535234'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4905931135297535234'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/implementing-class-that-can-be-sorted.html' title='Implementing a Class That Can Be Sorted'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1171070077382640017</id><published>2007-06-22T03:01:00.000-07:00</published><updated>2007-06-22T03:03:33.377-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Covert Decimal to Octal In C++</title><summary type='text'>This snippet has a will convert Decimal number to Octal number. 

// coverts decimal to ocal
// vishesh
// 21/05/2005

#include 

char* DEC_OCT(int);

int main()
{
 //
 int num;
 std::cout &lt;&lt; "Enter a number: ";
 std::cin   &gt;&gt; num;
 std::cout &lt;&lt; DEC_OCT(num);
 std::cin.get();
 return 0;
}

char* DEC_OCT(int dec)
{
 using namespace std;

 char *rtn;

 int prev, len, temp, *OCT;
 
 prev = dec;
 
 </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1171070077382640017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1171070077382640017'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/covert-decimal-to-octal-in-c.html' title='Covert Decimal to Octal In C++'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5496001873429191262</id><published>2007-06-22T02:59:00.000-07:00</published><updated>2007-06-22T03:04:02.673-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>This snippet has a will convert Decimal number to Binary number In C++</title><summary type='text'>This snippet has a will convert Decimal number to Binary number.

// coverts decimal to binary
// vishesh
// 21/05/2005

#include 

char* DEC_BIN(int);

int main()
{
 //
 int num;
 std::cout &lt;&lt; "Enter a number: ";
 std::cin   &gt;&gt; num;
 std::cout &lt;&lt; DEC_BIN(num);
 std::cin.get();
 return 0;
}

char* DEC_BIN(int dec)
{
 using namespace std;

 char *rtn;

 int prev, len, temp, *bin;
 
 prev = dec;
 
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5496001873429191262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5496001873429191262'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/this-snippet-has-will-convert-decimal.html' title='This snippet has a will convert Decimal number to Binary number In C++'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-4751943137549329882</id><published>2007-06-22T02:54:00.000-07:00</published><updated>2007-06-22T02:56:21.075-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C/C++'/><title type='text'>Implementing String trimming (Ltrim and Rtrim) in C</title><summary type='text'>Here is a simple implementation of implementing a simple Left trim (ltrim) and Right trim(rtim) of unwanted characters from a C style string. (null terminated strings). Doesn't suffer the overheads of the memmove implementation in which the worst case scenario (a string containing all junk characters) is approx. N^2 / 2.

#include 

char* rtrim(char* string, char junk);
char* ltrim(char* string, </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4751943137549329882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4751943137549329882'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/implementing-string-trimming-ltrim-and.html' title='Implementing String trimming (Ltrim and Rtrim) in C'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-8316345827989324030</id><published>2007-06-16T22:33:00.000-07:00</published><updated>2007-06-16T22:53:25.721-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='J2ME'/><title type='text'>URLEncoder for J2ME</title><summary type='text'>J2ME tech: how to encode url in J2ME programing?
Example code:
URLEncoder.encode(str,"UTF-8"));

URLEncoder class for J2ME:

package com.mobile.util;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;

/**
 * Adapted from J2SE java.net.URLEncoder.
 */
public class URLEncoder {
  
  public static String</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8316345827989324030'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8316345827989324030'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/urlencoder-for-j2me.html' title='URLEncoder for J2ME'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-4101380856647968224</id><published>2007-06-14T20:53:00.000-07:00</published><updated>2007-06-14T22:07:00.949-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>Check Time with a Regular Expression in javascript</title><summary type='text'>copy following code to save a html file, and run it.

&lt;html&gt;
 &lt;body&gt;
  &lt;script type="text/javascript"&gt;
  function check_time()
  {
    var elem = document.getElementById('timeStr');
    var orig_str = elem.value;
    //24 hour
    var _reg = new RegExp(/^([01][0-9]|2[0-3]):[0-5][0-9]$/);
    alert(_reg.test(orig_str));
  }
  &lt;/script&gt;
  &lt;input type="text" id="timeStr"&gt;
  &lt;input type="button" </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4101380856647968224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4101380856647968224'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/time-checking-with-regular-expression.html' title='Check Time with a Regular Expression in javascript'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6328810560532047444</id><published>2007-06-13T02:59:00.000-07:00</published><updated>2007-06-13T03:05:51.808-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>javascript remove attribute method</title><summary type='text'>removeAttribute() Syntax, Parameters and Note 

Removes the specified attribute value from the element. 
Returns true (successful) or false (failed).
    
Syntax:
    
document.getElementById("elementID").removeAttribute(param1, param2)
document.all.elementID.removeAttribute(param1, param2) // IE only

Parameters:
    param1   Required; the name of the attribute.
    param2   Optional; the type </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6328810560532047444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6328810560532047444'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/javascript-remove-attribute-method.html' title='javascript remove attribute method'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5873983608147046695</id><published>2007-06-13T02:45:00.000-07:00</published><updated>2007-06-13T03:03:00.789-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>javascript create attribute method</title><summary type='text'>createAttribute() Syntax, Parameters and Note 

Creates an attribute node. 
It also works with user-defined XML elements, allowing for the creation of
custom attributes.
    
Syntax:
    
document.createAttribute(param1)

Parameters:
    param1   Required; the name of the attribute.


createAttribute() example code


&lt;html&gt;
&lt;body&gt;
&lt;script language="JavaScript"&gt;
function function1() {
    var </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5873983608147046695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5873983608147046695'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/javascript-create-attribute-method.html' title='javascript create attribute method'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6535283364179230478</id><published>2007-06-11T06:15:00.000-07:00</published><updated>2007-06-11T06:39:33.097-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>A HashMap object in Javascript like the HashMap in Java</title><summary type='text'>The following Map Object code is an implementation of a HashMap in java for javascript.

function Map()
{
    // members
    this.keyArray = new Array(); // Keys
    this.valArray = new Array(); // Values
        
    // methods
    this.put = put;
    this.get = get;
    this.size = size;  
    this.clear = clear;
    this.keySet = keySet;
    this.valSet = valSet;
    this.showMe = showMe;   //</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6535283364179230478'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6535283364179230478'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/hashmap-object-in-javascript-like.html' title='A HashMap object in Javascript like the HashMap in Java'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5694105591789689339</id><published>2007-06-05T21:56:00.000-07:00</published><updated>2007-06-05T22:21:53.691-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>JavaScript remove leading and trailing whitespace</title><summary type='text'>
  &lt;script type="text/javascript"&gt;
    var str = "  java script  ";    
    str = str.replace(/^\s+/g,"");//remove heading whitespace
    str = str.replace(/\s+$/g,"");//remove trailing whitespace
    alert("|"+str+"|");
  &lt;/script&gt;
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5694105591789689339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5694105591789689339'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/javascript-remove-leading-and-trailing.html' title='JavaScript remove leading and trailing whitespace'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5048246318825570369</id><published>2007-06-04T03:12:00.000-07:00</published><updated>2007-06-04T07:32:27.026-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>A block of text to use as input to the regular expression matcher</title><summary type='text'>
// : c12:TheReplacements.java
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5048246318825570369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5048246318825570369'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/block-of-text-to-use-as-input-to.html' title='A block of text to use as input to the regular expression matcher'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5651671910123292179</id><published>2007-06-01T02:25:00.000-07:00</published><updated>2007-06-04T07:35:39.966-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>How to catch TAB key press with JavaScript in Firefox,Safari,Opare &amp; IE</title><summary type='text'>The example code is tested in IE, Firefox and Opare. Probably also works in Netscape as well as others like Safari.

&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
var obj;
var TAB = 9;
function catchTAB(evt,elem)
{
  obj = elem;
  var keyCode;
  if ("which" in evt)
  {// NN4 &amp; FF &amp;amp; Opera
    keyCode=evt.which;
  } else if ("keyCode" in evt)
  {// Safari &amp; IE4+
    keyCode=evt.keyCode;
  } </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5651671910123292179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5651671910123292179'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/06/how-to-catch-tab-key-press-with.html' title='How to catch TAB key press with JavaScript in Firefox,Safari,Opare &amp; IE'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1045349457545141706</id><published>2007-05-30T02:53:00.000-07:00</published><updated>2007-05-30T03:02:46.870-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='FileCopy'/><title type='text'>Secure File Copy in Java</title><summary type='text'>This example is from the book _Java in a Nutshell_ by David Flanagan.

import java.io.*;

public class FileCopy {
  public static void copy(String source_name, String dest_name) 
    throws IOException
  {
    File source_file = new File(source_name);
    File destination_file = new File(dest_name);
    FileInputStream source = null;
    FileOutputStream destination = null;
    byte[] buffer;
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1045349457545141706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1045349457545141706'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/secure-file-copy-in-java.html' title='Secure File Copy in Java'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-3361016491177218298</id><published>2007-05-30T02:08:00.000-07:00</published><updated>2007-05-30T02:20:19.689-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>JavaScript StringBuffer like java StringBuffer object</title><summary type='text'>
function StringBuffer()
{
  this.buffer = [];
}

StringBuffer.prototype.append = function(string) 
{ 
  this.buffer.push(string); 
  return this; 
} 

StringBuffer.prototype.toString = function()
{ 
  return this.buffer.join(""); 
}


Usage:
var s = new StringBuffer();
s.append("Hello, ").append(" World!");
alert(s.toString());</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3361016491177218298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3361016491177218298'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/javascript-stringbuffer-like-java.html' title='JavaScript StringBuffer like java StringBuffer object'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-5165638073916322082</id><published>2007-05-26T07:04:00.001-07:00</published><updated>2007-05-26T07:47:15.676-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Check whether a Perl module is installed</title><summary type='text'>The Perl code print all installed modules.


#!/usr/bin/perl 
# check_modules.pl

use strict; 
use ExtUtils::Installed; 

my $inst= ExtUtils::Installed-&gt;new(); 
my @modules = $inst-&gt;modules(); 

foreach(@modules) 
{ 
   my $ver = $inst-&gt;version($_) || "???"; 
   printf("%-14s -v %s\n", $_, $ver);
} 
exit 0;
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5165638073916322082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/5165638073916322082'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/check-whether-perl-modules-is-installed.html' title='Check whether a Perl module is installed'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1612550631915628209</id><published>2007-05-26T07:04:00.000-07:00</published><updated>2007-05-26T07:48:21.314-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Check whether a process is running or not</title><summary type='text'>The example Perl code demonstrate checking whether a process is running or not.


#!/usr/bin/perl -w
#$file: watchProcess.pl - watch whether a proccess is running.

use strict;
use POSIX;

my $pid = shift;
die "usage: watchProccess pid\n" unless defined $pid;
my $times =0;
do{
  sleep(5);
  $times++;
  print "loop: $times\n";
}until kill(SIGCHLD,$pid)==0;
print "proccess $pid is end.\n";
</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1612550631915628209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1612550631915628209'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/checking-whether-process-is-running-or.html' title='Check whether a process is running or not'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-183531062797460090</id><published>2007-05-25T08:34:00.000-07:00</published><updated>2007-05-25T17:21:33.201-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='web calendar'/><title type='text'>A simple java web calendar</title><summary type='text'>
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

/**
 * A simple java web calendar
 * 
 */
public class CalendarBuilder
{
  protected String weeks[] =
  { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", 
    "Friday", "Saturday" };
  protected String shortWeeks[] =
  { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" };

  protected String cnWeeks[] =
  { "日", "一", "二"</summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/183531062797460090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/183531062797460090'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/simple-java-web-calendar.html' title='A simple java web calendar'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-4715751009421231769</id><published>2007-05-22T09:12:00.000-07:00</published><updated>2007-05-22T09:48:05.933-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='DNS'/><category scheme='http://www.blogger.com/atom/ns#' term='dnsjava'/><title type='text'>How to access domain DNS protocol in pure java</title><summary type='text'>A tool named dnsjava is an implementation of the DNS protocol in Java. It supports all of the common record types. dnsjava provides both high and low level access to the resolver. The high level functions perform queries for records of a given name, type, and class, and return an array of records. A cache is used to reduce the number of queries sent. The low level functions allow direct </summary><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4715751009421231769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/4715751009421231769'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/how-to-access-domain-dns-protocol-in.html' title='How to access domain DNS protocol in pure java'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6687381729513953866</id><published>2007-05-21T07:11:00.000-07:00</published><updated>2007-05-21T07:28:33.309-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SOAP'/><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>A Perl Web Service Client With SOAP</title><summary type='text'>A perl WebServices client with SOAP,call XMethods temperature service.


#!/usr/bin/perl -w
#$file: ws_client.pl - a perl WebServices client with SOAP, call XMethods #temperature service. 
#

use strict;
use SOAP::EnvelopeMaker;
use SOAP::Parser;
use SOAP::Struct;
use SOAP::Transport::HTTP::Client;

my $zipcode = shift; $zipcode =~ /^\d+$/ or die "USAGE: $0 U.Szipcode\n";
my ($server, $port, $</summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/6687381729513953866/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=6687381729513953866' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6687381729513953866'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6687381729513953866'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/perl-web-service-client-with-soap.html' title='A Perl Web Service Client With SOAP'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-1406962967205833745</id><published>2007-05-20T08:05:00.000-07:00</published><updated>2007-05-20T08:09:36.016-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='daemon'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>A Perl Daemon Example Script</title><summary type='text'>
#!/usr/bin/perl -w
#$file: daemon.pl - a daemon example script 
use strict;

# become daemon
my $pid = fork();
print $pid,"\n";
if($pid) {
  #end parent process
  print "#parent process";
  exit(0);
}else {
  print "#child process";
}

# set new process group
setpgrp;
# setsid ? only C

while(1) {
  sleep(30);
  open ("TEST","&gt;&gt;/tmp/test.log");
  my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,</summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/1406962967205833745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=1406962967205833745' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1406962967205833745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/1406962967205833745'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/perl-daemon-example-script.html' title='A Perl Daemon Example Script'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-719546011556202164</id><published>2007-05-17T21:35:00.000-07:00</published><updated>2007-05-17T21:41:34.249-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>Using a Non-Capturing Group in a Regular Expression</title><summary type='text'>By default, a group captures text (see Capturing Text in a Group in a Regular Expression). In some cases, a group is needed but there is no need to capture the text. A non-capturing group should be used to improve performance. A non-capturing group starts with (?:. 

    String inputStr = "abbabcd";
    String patternStr = "(a(?:b*))+(c*)";
    // (?:b*) is a non-capturing group
    
    // </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/719546011556202164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=719546011556202164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/719546011556202164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/719546011556202164'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/using-non-capturing-group-in-regular.html' title='Using a Non-Capturing Group in a Regular Expression'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6159327815265215602</id><published>2007-05-17T21:32:00.000-07:00</published><updated>2007-05-17T21:39:46.302-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>Capturing Text in a Group in a Regular Expression</title><summary type='text'>
A group is a pair of parentheses used to group subpatterns. For example, h(a|i)t matches hat or hit. A group also captures the matching text within the parentheses. For example, 
    input:   abbc
    pattern: a(b*)c

causes the substring bb to be captured by the group (b*). A pattern can have more than one group and the groups can be nested. For example, 
    pattern: (a(b*))+(c*)

contains </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/6159327815265215602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=6159327815265215602' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6159327815265215602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6159327815265215602'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/capturing-text-in-group-in-regular.html' title='Capturing Text in a Group in a Regular Expression'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-8775775644574870896</id><published>2007-05-16T00:19:00.000-07:00</published><updated>2007-05-16T00:31:25.102-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http proxy'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>A Perl Tool To Check HTTP Proxies</title><summary type='text'>Proxy Checker: only support to check http proxies.

#!/usr/bin/perl -w 
#$file:proxy_check.pl - a simple tool to check http proxy

use strict;
use LWP::UserAgent;

my $proxy_list = "/root/proxy_list.txt";
my $test_url = "http://www.mysite.com/";

print "starting...\n";

open(FD,"$proxy_list") || die "can't open file $!";

while() {
  chomp($_);
  my $proxy = $_;
  my $ua = LWP::UserAgent-&gt;new;
  </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/8775775644574870896/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=8775775644574870896' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8775775644574870896'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8775775644574870896'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/perl-tool-to-check-proxy.html' title='A Perl Tool To Check HTTP Proxies'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-7437091331301901400</id><published>2007-05-16T00:03:00.000-07:00</published><updated>2007-05-16T00:07:25.240-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='telnet'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Perl Telnet Program</title><summary type='text'>A perl program code to telnet to a machine.


#!/usr/bin/perl -w
# telnet.pl - a program to telnet to a machine
# and do some stuff
use strict;
use Net::Telnet;

my $host = shift || 'server.telent.com';
my $user = shift || $ENV{USER};
die "no user!" unless $user;
my($pass, $command);
print 'Enter password: ';
system 'stty -echo';
chop($pass = );
system 'stty echo';
print "\n";
my $tn = new Net::</summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/7437091331301901400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=7437091331301901400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/7437091331301901400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/7437091331301901400'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/perl-telnet-program.html' title='Perl Telnet Program'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-3657914673938217096</id><published>2007-05-15T23:45:00.000-07:00</published><updated>2007-06-07T20:37:19.607-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>Regular Expression Search Program Example code</title><summary type='text'>This example demonstrates how to use a regular expression to find matches in a string. 


import java.util.regex.*;

public class BasicMatch {
    public static void main(String[] args) {
        // Compile regular expression
        String patternStr = "b";
        Pattern pattern = Pattern.compile(patternStr);

        // Determine if pattern exists in input
        CharSequence inputStr = "a b</summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/3657914673938217096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=3657914673938217096' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3657914673938217096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3657914673938217096'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/regular-expression-search-program.html' title='Regular Expression Search Program Example code'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-3376347965463548581</id><published>2007-05-10T05:32:00.000-07:00</published><updated>2007-06-07T20:33:37.795-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='clock'/><title type='text'>javascript clock</title><summary type='text'>This script displays the current time in your browser. You can choose the 12-hours format or the 24-hours format. 

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Javascript clock&lt;/title&gt;
&lt;head&gt;
&lt;style type="text/css"&gt;
 form,label
 {
   font-family:arial, sans-serif, helvetica, "times new roman";
   font-size:10pt; /* increase or decrease the value to change the size of the font */
 }
 h1
 {
   font-family:arial, </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/3376347965463548581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=3376347965463548581' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3376347965463548581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3376347965463548581'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/javascript-clock.html' title='javascript clock'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6886837009208798811</id><published>2007-05-09T07:25:00.000-07:00</published><updated>2007-06-07T20:28:34.553-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><title type='text'>Adding Undo and Redo to a Text Component</title><summary type='text'>The Swing toolkit contains an undo manager that can be added to a Document object to provide undo and redo capabilty. This example adds undo capability to a JTextArea component. The example binds the undo action to control-Z and the redo action to control-Y. 

    JTextComponent textcomp = new JTextArea();
    final UndoManager undo = new UndoManager();
    Document doc = textcomp.getDocument();
</summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/6886837009208798811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=6886837009208798811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6886837009208798811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6886837009208798811'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/adding-undo-and-redo-to-text-component.html' title='Adding Undo and Redo to a Text Component'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-3196484813229166960</id><published>2007-05-08T00:28:00.000-07:00</published><updated>2007-06-07T20:25:30.139-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='parse CVS'/><title type='text'>A Parsing CSV File Routine</title><summary type='text'>If any of you already know, parsing a CSV file is a pain in the !@#*! 
However, some people love to export their data via this format. So, 
I had a little time on my hands and wanted to share this bit of code 
with you. It is by no means "clean" and in pure OO format, but it 
gives you an idea of the pain of parsing this type of file/format.


//**************************************
// Name: A </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/3196484813229166960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=3196484813229166960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3196484813229166960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3196484813229166960'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/parsing-csv-file-routine.html' title='A Parsing CSV File Routine'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-3258953882127768557</id><published>2007-05-08T00:14:00.000-07:00</published><updated>2007-06-05T22:03:48.338-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Remove leading and trailing white space from a string</title><summary type='text'>This is a routine task best done with two regexp's when using perl.

my $string = ' Mary had a little lamb. ';
$string =~ s/^\\s+//; #remove leading spaces
$string =~ s/\\s+$//; #remove trailing spaces
print $string;
</summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/3258953882127768557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=3258953882127768557' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3258953882127768557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/3258953882127768557'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/remove-leading-and-trailing-white-space.html' title='Remove leading and trailing white space from a string'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-2511863422564728767</id><published>2007-05-07T23:52:00.000-07:00</published><updated>2007-06-07T20:19:00.974-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='splash screen'/><title type='text'>How to make a Splash Screen</title><summary type='text'>Theres no doubting that using Java Swing is time consuming on load times. So heres a demo splash screen to keep your users captivated.

You will need two classes for this example

i.e. Splash.java and SplashWindow.java

(remember line: 8 change this to match your splash image)

just change the class name to match your entry class and bobs your uncle.

Splash.java

import java.awt.Frame;
import </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/2511863422564728767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=2511863422564728767' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2511863422564728767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/2511863422564728767'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/how-to-make-splash-screen.html' title='How to make a Splash Screen'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-8405287923060382549</id><published>2007-05-07T22:23:00.000-07:00</published><updated>2007-06-07T20:13:50.681-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='cookie'/><title type='text'>Sending a Cookie to an HTTP Server</title><summary type='text'>
try {
    // Create a URLConnection object for a URL
    URL url = new URL("http://hostname:80");
    URLConnection conn = url.openConnection();

    // Set the cookie value to send
    conn.setRequestProperty("Cookie", "name1=value1; name2=value2");

    // Send the request to the server
    conn.connect();
} catch (MalformedURLException e) {
} catch (IOException e) {
}
</summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/8405287923060382549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=8405287923060382549' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8405287923060382549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8405287923060382549'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/sending-cookie-to-http-server.html' title='Sending a Cookie to an HTTP Server'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-6579739005819660493</id><published>2007-05-05T19:45:00.000-07:00</published><updated>2007-06-07T20:12:06.010-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>Parsing Character-Separated Data with a Regular Expression</title><summary type='text'>A line from a flat-file is typically formatted using a separator character to separate the fields. If the separator is simply a comma, tab, or single character, the StringTokenizer class can be used to parse the line into fields. If the separator is more complex (e.g., a space after a comma), a regular expression is needed. String.split() conveniently parses a line using a regular expression to </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/6579739005819660493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=6579739005819660493' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6579739005819660493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/6579739005819660493'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/parsing-character-separated-data-with.html' title='Parsing Character-Separated Data with a Regular Expression'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-130410599916229557</id><published>2007-05-05T19:43:00.000-07:00</published><updated>2007-06-07T19:39:01.018-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='regex'/><title type='text'>Parsing a String into Tokens Using a Regular Expression</title><summary type='text'>This example implements a tokenizer that uses regular expressions. The use of this tokenizer is similar to the StringTokenizer class in that you use it like an iterator to extract the tokens. 

CharSequence inputStr = "a 1 2 b c 3 4";
String patternStr = "[a-z]";

// Set to false if only the tokens that match the pattern are to be returned.
// If true, the text between matching tokens are also </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/130410599916229557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=130410599916229557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/130410599916229557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/130410599916229557'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/parsing-string-into-tokens-using.html' title='Parsing a String into Tokens Using a Regular Expression'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-8128686788613215001</id><published>2007-05-04T01:32:00.000-07:00</published><updated>2007-06-07T20:00:31.520-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='JMailer'/><category scheme='http://www.blogger.com/atom/ns#' term='javamail'/><title type='text'>JMailer is a java mail client like phpmailer</title><summary type='text'>
package peace.org.mail;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Properties;
import java.util.Set;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.Multipart;
import </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/8128686788613215001/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=8128686788613215001' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8128686788613215001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/8128686788613215001'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/jmailer-is-java-mail-client-like.html' title='JMailer is a java mail client like phpmailer'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3550559392700243747.post-532834702561804792</id><published>2007-05-02T07:50:00.000-07:00</published><updated>2007-06-07T20:05:15.451-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='javamail'/><title type='text'>How To Send E-Mail By JavaMail API</title><summary type='text'>This example demonstrates the simplest program that will send a textual E-mail message to a single recipient.

import java.io.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;

public class SendMail {
public static void send(String smtpHost, int smtpPort,
String from, String to,
String subject, String content)
throws AddressException, MessagingException {
// Create </summary><link rel='replies' type='application/atom+xml' href='http://freecode-freecode.blogspot.com/feeds/532834702561804792/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3550559392700243747&amp;postID=532834702561804792' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/532834702561804792'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3550559392700243747/posts/default/532834702561804792'/><link rel='alternate' type='text/html' href='http://freecode-freecode.blogspot.com/2007/05/how-to-send-e-mail-by-javamail-api.html' title='How To Send E-Mail By JavaMail API'/><author><name>freecode</name><uri>http://www.blogger.com/profile/15578182150743347774</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
