Skip to main content

Posts

TCP dump

tcp dump enables us to capture the packets over a network. But there might be a problem when you run this on localhost. Like you are running a socket program, and both server and client residdes in localhost only, then it will not work. The reason for it is: " It's not reaching the Network Card (NIC) actually when it's in localhost." This problem has not been reported anywhere. So, always try this thing on two different machines, may be in a LAN. B'coz the request will never reach the card and will not filter request for a particular port.

socket programming in j2me

Well, I found the code for client side everytime but i am not able to find a code working on the server end. So, I ma posting a working code: import java.io.*; import java.net.*; public class mpp_usr { public static void main ( String args[])throws IOException { Socket sock = null; String str =null; InputStream in; byte b[] = new byte[1024]; try { ServerSocket ss = new ServerSocket(9000); sock = ss.accept(); in = sock.getInputStream(); DataInputStream din = new DataInputStream(in); int len; while((len = din.read(b)) > 0) { String req = new String(b,0,len); System.out.print(req); } } catch(IOException ioe) { System.out.println("error"); } } }

gnome-do

if your gnome do or also called dorkey not working. Go to terminal-> ps -A it will show all the processes. kill the process named gnome-do by "kill -9 pro_number" kill one by one all it's processes, at one instance it'll appear. If it still doesn't come, then call in terminal "gnome-do &" and press ctrl+c and exit. Your gnome-do is back.

jdbc mysql cofiguration for eclipse

There might be problem even after installing everything and doing all the coding of jdbc in ubuntu. So, the solution is : just download a mysql-connector.jar file and make your eclipse to point to it. for this: right click on project->properties->libraries here you should see that mysql connector jar. so, add it by clicking on "add external jar" Now, the project will run sound.

use of connector.open()

The Connector.open method is a factory for connections. You do not use the new operator to instantiate connections. This is a smart mechanism, which keeps the static footprint small when the platform does not include implementations for specific connections. The method throws ConnectionNotFoundException if the desired protocol handler is not available.

store from arraylist into hashtable

import java.util.*; import java.io.*; public class ArraytoHash{ public static void main(String[] args) throws IOException{ String key; String value; ArrayList al1 =new ArrayList(); ArrayList al2 = new ArrayList(); System.out.println("Enter key for the hash table : "); al1 = create(); System.out.println("\n"+"Enter value for the key : "); al2 = create(); Object ia1[] = al1.toArray(); Object ia2[] = al2.toArray(); Hashtable hashTable = new Hashtable (); for(int i = 0; i { key = (ia1[i]).toString(); value = String.valueOf(ia2[i]); hashTable.put(Integer.parseInt(key), value.toString()); } Map map = new TreeMap (hashTable); System.out.println(map); } public static ArrayList create () { ArrayList al = new ArrayList(); try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("How many elements you want to enter to the hash...

pdf to word

To convert pdf to word, we have a solution to install kword it's just of 6.5 MB in terminal, type: sudo apt-get install kword and open the pdf doc and just save it as doc.