<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-3550559392700243747</atom:id><lastBuildDate>Wed, 25 Sep 2024 02:20:52 +0000</lastBuildDate><category>java</category><category>javascript</category><category>regex</category><category>perl</category><category>C/C++</category><category>J2ME</category><category>javamail</category><category>DNS</category><category>FileCopy</category><category>JMailer</category><category>SOAP</category><category>clock</category><category>cookie</category><category>daemon</category><category>dnsjava</category><category>http proxy</category><category>multithreading</category><category>parse CVS</category><category>php</category><category>splash screen</category><category>telnet</category><category>utf8 convert</category><category>watermark</category><category>web calendar</category><category>web service</category><title>Free Code,Example Code</title><description>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...</description><link>http://freecode-freecode.blogspot.com/</link><managingEditor>noreply@blogger.com (freecode)</managingEditor><generator>Blogger</generator><openSearch:totalResults>66</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-5068654045956164782</guid><pubDate>Fri, 14 Nov 2008 13:51:00 +0000</pubDate><atom:updated>2008-11-14T06:03:29.123-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">utf8 convert</category><title>How to GBK(GB2312) and UTF-8 encoding conversion between in JavaScript</title><atom: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</atom:summary><link>http://freecode-freecode.blogspot.com/2008/11/how-to-gbkgb2312-and-utf-8-encoding.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-2641268228284916332</guid><pubDate>Mon, 07 Jul 2008 09:22:00 +0000</pubDate><atom:updated>2008-07-07T02:29:20.550-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">php</category><title>How to send messages using PHP</title><atom: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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/07/how-to-send-messages-using-php.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-8918938754781529575</guid><pubDate>Thu, 26 Jun 2008 03:17:00 +0000</pubDate><atom:updated>2008-06-25T20:27:48.886-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">J2ME</category><title>How to send  SMS in J2ME</title><atom: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(</atom:summary><link>http://freecode-freecode.blogspot.com/2008/06/how-to-send-sms-in-j2me.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-5584118850450619114</guid><pubDate>Mon, 16 Jun 2008 08:07:00 +0000</pubDate><atom:updated>2008-06-16T01:10:27.846-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Using the Comparable interface to compare and sort objects</title><atom: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</atom:summary><link>http://freecode-freecode.blogspot.com/2008/06/using-comparable-interface-to-compare.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-6685599124065114085</guid><pubDate>Thu, 12 Jun 2008 09:35:00 +0000</pubDate><atom:updated>2008-06-12T02:39:36.342-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C/C++</category><title>How to read floppy disk information in C++</title><atom: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&amp;lt;iostream.h&gt;
#include&amp;lt;conio.h&gt;
#include&amp;lt;dos.h&gt;
void main(){
     clrscr();
     //Floppy </atom:summary><link>http://freecode-freecode.blogspot.com/2008/06/how-to-read-floppy-disk-information-in.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-1730603445951110356</guid><pubDate>Thu, 12 Jun 2008 09:27:00 +0000</pubDate><atom:updated>2008-06-12T02:34:10.976-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C/C++</category><title>An implementation of Stack datastructure in C++</title><atom:summary type="text">
#include &amp;lt;iostream&gt;
#include &amp;lt;new&gt;
#include &amp;lt;string&gt;
#include &amp;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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/06/implementation-of-stack-datastructure.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-1706403204736318096</guid><pubDate>Thu, 12 Jun 2008 01:05:00 +0000</pubDate><atom:updated>2008-06-11T18:30:06.325-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>How to run external system commands in Java</title><atom:summary type="text">Running a system command is relatively simple - once you&#39;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</atom:summary><link>http://freecode-freecode.blogspot.com/2008/06/how-to-run-external-system-commands-in.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-216560513292985872</guid><pubDate>Wed, 11 Jun 2008 09:01:00 +0000</pubDate><atom:updated>2008-06-11T02:05:43.875-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">multithreading</category><title>Multi-threaded programming - Multithreaded chat application in java</title><atom: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</atom:summary><link>http://freecode-freecode.blogspot.com/2008/06/multi-threaded-programming.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-344149709205429036</guid><pubDate>Tue, 10 Jun 2008 14:41:00 +0000</pubDate><atom:updated>2008-06-10T07:51:24.030-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><category domain="http://www.blogger.com/atom/ns#">watermark</category><title>How to add watermark to images in java</title><atom: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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/06/how-to-add-watermark-to-images-in-java.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-6031428323642431692</guid><pubDate>Mon, 12 May 2008 15:34:00 +0000</pubDate><atom:updated>2008-05-12T08:38:46.729-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><title>How to access a database by ADO with JavaScript</title><atom: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.</atom:summary><link>http://freecode-freecode.blogspot.com/2008/05/how-to-access-database-by-ado-with.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-2380978156600031979</guid><pubDate>Mon, 12 May 2008 14:57:00 +0000</pubDate><atom:updated>2008-05-12T08:31:04.544-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Encrypts a string by the given &quot;key&quot;</title><atom:summary type="text">A more slightly advanced encryption.Encrypts a string by the given &quot;key&quot;.

import javax.swing.JOptionPane;


public class betterencryptor {

 public static void main(String[] args) {
  int key1 = Integer.parseInt(JOptionPane.showInputDialog(&quot;Input a key, a random large *prime* number:&quot;));
  String message1 = JOptionPane.showInputDialog(&quot;Input a string to be encrypted/decrypted:&quot;);
  String crypt1</atom:summary><link>http://freecode-freecode.blogspot.com/2008/05/encrypts-string-by-given-key.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-8340661482110594213</guid><pubDate>Wed, 12 Mar 2008 09:34:00 +0000</pubDate><atom:updated>2008-03-12T02:37:54.420-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>How to create a zip file</title><atom: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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/03/how-to-create-zip-file.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-3709597184985075736</guid><pubDate>Thu, 21 Feb 2008 14:29:00 +0000</pubDate><atom:updated>2008-02-21T06:30:59.497-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Write to file using BufferedOutputStream</title><atom: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</atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/write-to-file-using-bufferedoutputstrea.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-1058054979031097972</guid><pubDate>Thu, 21 Feb 2008 14:28:00 +0000</pubDate><atom:updated>2008-02-21T06:29:14.725-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Read from file with BufferedInputStream</title><atom: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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/read-from-file-with-bufferedinputstream.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-6596629326079899440</guid><pubDate>Thu, 21 Feb 2008 14:14:00 +0000</pubDate><atom:updated>2008-02-21T06:26:45.897-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Read each line in a comma separated file into an array</title><atom: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() {

</atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/read-each-line-in-comma-separated-file.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-1109770640762849898</guid><pubDate>Tue, 19 Feb 2008 13:57:00 +0000</pubDate><atom:updated>2008-02-19T06:01:11.474-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">C/C++</category><title>Base64 encoding and Base64 decoding in C</title><atom:summary type="text">
#include &quot;lib.h&quot;

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

/**
 * 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], </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/base64c.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-6868501110619136172</guid><pubDate>Tue, 19 Feb 2008 13:35:00 +0000</pubDate><atom:updated>2008-02-19T05:38:52.806-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>How to quickly sort Vector of objects that implement the Comparable interface in java</title><atom: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)  {
    </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/how-to-quickly-sort-vector-of-objects.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-9159899327983851436</guid><pubDate>Mon, 18 Feb 2008 15:01:00 +0000</pubDate><atom:updated>2008-02-18T07:03:36.790-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Listing the system properties</title><atom: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&#39;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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/listing-system-properties.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-2774950301104544097</guid><pubDate>Mon, 18 Feb 2008 14:57:00 +0000</pubDate><atom:updated>2008-02-18T06:59:22.568-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Check if a String is a valid date</title><atom: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
    </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/check-if-string-is-valid-date.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-3170555022235921128</guid><pubDate>Mon, 18 Feb 2008 14:37:00 +0000</pubDate><atom:updated>2008-02-18T06:52:10.426-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><title>how to determine window size in javascript</title><atom: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.


&amp;lt;script type=&quot;text/javascript&quot;&amp;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=</atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/how-to-determine-window-size-in.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-8999797532532555617</guid><pubDate>Sun, 17 Feb 2008 15:16:00 +0000</pubDate><atom:updated>2008-02-17T07:17:02.931-08:00</atom:updated><title>Getting data from the computer clipboard</title><atom: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&#39;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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/getting-data-from-computer-clipboard.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-790202197356439955</guid><pubDate>Sun, 17 Feb 2008 15:15:00 +0000</pubDate><atom:updated>2008-02-17T07:16:06.832-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>Placing text on the computer clipboard</title><atom: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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/placing-text-on-computer-clipboard.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-9016334180679395130</guid><pubDate>Sun, 17 Feb 2008 15:10:00 +0000</pubDate><atom:updated>2008-02-17T07:12:52.788-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">perl</category><title>Connect to a database and read from table</title><atom: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&#39;ll have to change some of the values to match your own </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/connect-to-database-and-read-from-table.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-5134461186020908352</guid><pubDate>Sun, 17 Feb 2008 14:57:00 +0000</pubDate><atom:updated>2008-02-17T06:58:50.333-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>How to extract contents of a zip file</title><atom:summary type="text">This example shows how to extract a zipfile containing one file (or entry). 
The name of the zip file is &#39;compressed.zip&#39; and we want to write the contents to a file called &#39;extracted.txt&#39;.
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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/how-to-extract-contents-of-zip-file.html</link><author>noreply@blogger.com (freecode)</author></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-3550559392700243747.post-2537900132613808257</guid><pubDate>Sun, 17 Feb 2008 14:55:00 +0000</pubDate><atom:updated>2008-02-17T06:57:01.163-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">java</category><title>How to list the contents of a zip file</title><atom: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 &#39;testfile.zip&#39;. 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 </atom:summary><link>http://freecode-freecode.blogspot.com/2008/02/how-to-list-contents-of-zip-file.html</link><author>noreply@blogger.com (freecode)</author></item></channel></rss>