Wednesday, April 29, 2009

know the System Information with a Single Command!!

1) Type Windows+R to get the "Run" dialog Box.

2) In that type "msinfo32"

3) That’s it you can see all the Information of Your System Hardware and Software with their Status.

Monday, April 27, 2009

Compile C/C++ libraries into your swf

Sounds cool huh? You look at all the projects on sourcefourge and think, man if only I could do that in the flash player. Well now you can. The project named Alchemy which translates these C and C++ libraries into bytecode for the flash player is now available on Labs. I cant wait to see how people bend and twist this one. I think it may be one of the more interesting projects I have herd come out of MAX so far.

The Download and Documentation as always is displayed and well laid out on Labs:

http://labs.adobe.com/technologies/alchemy/

Looks like its a pretty intensive install for Windows, but Mac looks fine

Adobe is providing some example libraries, and developers are encouraged to share their ported libraries.

Saturday, April 25, 2009

copy and move in ColdFusion file

You can use the cffile tag to move a file from one location on the server to another.
You can use the cffile tag to create a copy a file on the server.

Example of Moving a File
The following code moves the source file to the location specified with the destination attribute.

source="C:\docs\accessLog.txt"
destination="C:\docs\accessLog_backup.txt">

Example of Copying a File
The following code copies the source file to the location specified with the destination attribute.

source="C:\docs\accessLog.txt"
destination="C:\docs\accessLog_backup.txt">

Source : http://www.quackit.com/coldfusion/tutorial/coldfusion_move_file.cfm

Thursday, April 23, 2009

Definitions of attributes

The attributes in schema are defined like child elements. In order to have the attributes the element has a complex type. The only difference is that attributes are not included into sequence/choice scope; rather they are located in complexType-section immediately. The element may contain any number of attribute-definitions:
























source: java-tips.org

Tuesday, April 21, 2009

Connection Dead Exception in Sybase : Memory Leakage issue in Weblogic Server

If you are facing some Memory Leakage Problems in Web Applications and if it is a J2EE Struts based Web Application deployed in Weblogic Server 8.1. The memory in the server gets dumped in about 3-4 days and recycling needs to be done in the nodes to free up the memory. And also if the application does not have any EJB Transaction Management. Then follow the below resolutions and try it.

1)The memory issue could be the result of repeated ‘connection closed exception’ and its stack trace.
2)The checking, whether the connection is closed or not is wrong ‘DBUtil. closeQueryObjects’ method. Refer the following code

if(con != null){
try{con.close();
}
catch(Exception e){
m_logger.error("Exception when closing connection", e);
}

3)The right way to check whether a connection is closed or not id connection.isClosed()

Sunday, April 19, 2009

Secret Gmail delete keyboard shortcut!!!

If you are reading a message in GMail, press the # key (Shift+3) and that message will instantly move to Trash. Alternatively, select one or more email messages in the GMail list view, press the same # hash key and all the selected GMail conversations will be deleted in one batch.
you have to have the Shortcuts enabled in your Settings before you try this, or it won’t work.

Source: http://www.irintech.com/x1/blogarchive.php?id=856

Friday, April 17, 2009

Updating a table(ispf) using rexx

This is a simple rexx code, to update a row in ispf table.
lets say the table name is "sample" & it has three columns "id" & "name" & "age"
id name age
001 agent001 20
002 agent002 21
003 agent003 23

if u want to know the change the age of person with id = '001' from '20' to '30'. then this is a simple code..
/*REXX*/
TDSN = "aaa.dsn"
ID = '001'
ADDRESS ISPEXEC "CONTROL ERRORS RETURN"
ADDRESS ISPEXEC "LIBDEF ISPTLIB"
ADDRESS ISPEXEC "LIBDEF ISPTABL"
ADDRESS ISPEXEC "LIBDEF ISPTLIB DATASET ID ('"TDSN"') UNCOND"
ADDRESS ISPEXEC "LIBDEF ISPTABL DATASET ID ('"TDSN"') UNCOND"TNAME = "SAMPLE"
ADDRESS ISPEXEC "TBCLOSE "TNAME
ADDRESS ISPEXEC "TBOPEN "TNAME
ADDRESS ISPEXEC "TBTOP "TNAME
ADDRESS ISPEXEC "TBSCAN "TNAME" ARGLIST ( ID )"
ADDRESS ISPEXEC "TBGET " TNAME
age = '30'
ADDRESS ISPEXEC "TBput " TNAME
ADDRESS ISPEXEC "TBCLOSE "TNAME
ADDRESS ISPEXEC "LIBDEF ISPTLIB"
ADDRESS ISPEXEC "LIBDEF ISPTABL"


after the execution of this program the resulting table will be like :
id name age
001 agent001 30
002 agent002 21
003 agent003 23

Wednesday, April 15, 2009

How To free Your hard disk space?

"How you can free some 100-500 Mb space from your hard disk in windows operating system?"first i will tell you about temporary files that takes lot of memory space in your hard disk.This is simply created when your do any work in xp for example if you are writing any document,installing any software's or visiting web pages.In windows Every work done by You is stored by Operating system as temp files. So,delete this files to free your space.

If you are reading this for first time ,i am sure that 200-400 mb space in your computer is taken by temp files. so, go and delete these files by following methods:

1. Start Run Command. or press windows key + R at a time .it will open a dialog box ,type there %temp% and enter . It will open a folder. Delete all these files. It is of no use and taking your hard disk space.

2.Start Run Command. or press windows key + R at a time .it will open a dialog box ,type there prefetch and enter . It will open a folder. Delete all these files. It is of no use and taking your hard disk space.

Monday, April 13, 2009

Object Serialization

Object Serialization transforms an object into a sequence of bytes so it cam be written to disc or can be transfer to the server. This Sequence of bytes can be later deserialized into an original object. After deserialization, the object has the same state as it had when it was serialized.

Java provides this facility through ObjectInput and ObjectOutput interfaces. The concrete implementation of ObjectOutput and OnjectInput interfaces is provided in ObjectOutputStream and ObjectInputStream classes respectively. These two interfaces have the following methods:

final void writeObject(Object obj) throws IOException
final Object readObejct() through IOException, ClassNotFoundException

The writeObject() method can be used be used to write any object to a stream, including strings and arrays and readObject() method can be used to read any stream as long as an object supports java.io.Serializable interface.

source: java-tips.org

Saturday, April 11, 2009

The private main method

YES…!!!! the main method in java can be private.
I came across a good article while surfing on the net about main method being private. That means it works if written as: private static void main( String [] args )

Moreover, this method can also be activated by the VM, which actually breaks the encapsulation law. Actually, Sun introduced this problem in version 1.2 of Java and was not solved till 1.3. This is the case on MS Windows NT, Linux and Solaris. However, while running this code on Windows 2000 or XP gives the proper run time exception as "Main method not public".

check it on: http://developer.java.sun.com/developer/bugParade/bugs/4252539.html

This issue is a known problem with a bug report opened against it. However, Sun has closed the bug report and the problem will NOT be fixed, "The runtime allows call to private methods, because of reflection. Fixing it will cause potential troubles." This violates oop's basic concept, i.e. data encapsulation, you can declare the method as private to restrict its access from outside the class where it is declared, but in this case you can declare main method as private and still jvm can access the method. This is also a compatibility issue: with some JVM this work, but other JVMs might be confused.

However, this is not a big issue as only JVM can give the call to private main method and any other attemp to access it, will result in the compile time error.

I don't know whether the bug has been solved or not but it was giving runtime exception on my machine (XP) "Main method not public" and it might get execute on Solaris or Linux machine. But be careful while taking the certification exam. The proper answer to "How do you define a main method?" remains: "The method main must be declared public, static, and void."

Thursday, April 09, 2009

Send Email in Outlook without Using Mouse!!!

To send an email without ever taking your hands off of the keyboard, follow these simple steps:

1.Use Alt+Tab to switch to Outlook.
2.If you’re looking at anything other than one of your mail folders (like your Calendar or Contacts), hit Ctrl+Shift+M to open a new mail message, otherwise just hit Ctrl+N.
3.You should now be looking at a blank email, with your cursor placed in the To: field. Type the recipients name (and if Outlook is connected to Microsoft Exchange Server and you’re emailing somebody in your organization, you can type their name and hit Ctrl+K, which will verify their address for you).
4.Use the TAB key to navigate between the CC:, BCC: and Subject fields, filling in as necessary. 5.Hit TAB to enter the main text area of the email, type the body of your message.
6.Invoke the SpellCheck utility using the F7 key. Use the TAB key to navigate, making changes as needed.
7.Once you’re ready to send, hit Ctrl+Enter.
8.Bask in the knowledge that you’ve just sent an email and your mouse is getting dusty!
Pretty simple, right? This process is a little weird at first (especially if you want to attach files, etc. - use Alt+I, F to do that), but once you’ve done it a few times, you’ll wonder how you ever got along without it!

Source:http://blog.crankingwidgets.com/2007/01/30/no-mouse-required-how-to-create-and-send-an-email-in-outlook-using-only-your-keyboard/

Tuesday, April 07, 2009

Magic Numbers

Did you know why 37 is a magic number ? Here's why. If you divide any number consisting of 3 identical digits by the sum of these digits, the result is always 37 eg 666 / (6+6+6) = 555 / (5+5+5) = 37 etc.

Source: Read in a Magazine called "Speed Mathematics"

Sunday, April 05, 2009

Writing a file in Java

This code first creates a file (MyFile.txt) and add the data using DataOutputStream. DataOutputStream have special methods to write different type of data like writeInt() uses for integer, writeChars() uses for string.

import java.io.*;
public class FileOutput {
public static void main(String[] args) {
FileOutputStream fos;
DataOutputStream dos;
try {
File file= new File("C:\\MyFile.txt");
fos = new FileOutputStream(file);
dos=new DataOutputStream(fos);
dos.writeInt(2333);
dos.writeChars("Hello");
} catch (IOException e) {
e.printStackTrace();
}
}
}

source: java-tips.org

Friday, April 03, 2009

Recalling the Message From Sent Items !!!

For Outlook 2003:
1. Go to the Sent Items folder.
2. Find the message you want recalled and double-click it.
3. Go to the Actions menu and select Recall This Message.
4. To recall the message:
Select Delete unread copies of this message. (Note: the recipient needs to have Outlook opened for the message to be deleted)
To replace the message:
Select Delete unread copies and replace with a new message, click OK, and type your new message.
To be notified about the success of the recall or replacement:
Check the Tell me if recall succeeds or fails for each recipient check box.
5. Click OK.


UPDATE: How To Recall a Sent Message in Outlook 2007:
1. Click on Sent Items.
2. Find the message you want recalled and double-click it to open.
3. Go to the Actions menu -> other Actionh and select Recall This Message.

Thursday, April 02, 2009

Convert html file into js file

This code takes html file as an input and converts it into the js file.

import java.io.*;
public class ChangeFileM {
public static void main(String[] args) {
try {
BufferedReader obj1 = new BufferedReader(new FileReader("c:\\terms and conditions.html"));
OutputStream os= new FileOutputStream(new File("c:\\out.js"));
PrintStream ps = new PrintStream(os);
String line;
String prefix="document.write('";
String sufix="');";
while ((line = obj1.readLine())!= null) {
line = prefix + line + sufix;
ps.println(line);
}
ps.close();
os.close();
obj1.close();

} catch (Exception e) {
}
}
}

source: java-tips.org
Computers Add to Technorati Favorites Programming Blogs - BlogCatalog Blog Directory