Tuesday, April 26, 2005

Aisa lagta hai .......(ummmmm) jane kaisa lagta hai ,i dont know;)

why is everything so funny today i worder ,
is it what it is or is it the way i am looking at things ?

I feel butterflies in my stomach. I think its momentry apprehension.
It will decamp when i take a good sleep. I think it has all got to do abt me going home on 5th and i am thrilled that i am going home after 4 months and dad has planned a trip ( probably to some hill station , he said we will hire a Qualis or some bigger SUV for the trip , boy i am excited)
By the way my project is going fine and here is a simple code to send a image to a server ( put ur url in the Connector.Open() ) and simply put a PHP to upload image there.


---------------------------------------------------------------------------------
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import java.io.*;

public class ImageSend extends MIDlet implements CommandListener
{
private Image img;
private Display display;
private Command exit;
private Command show;
private Form fImage;
private ImageItem iitm;

private Form messF;
private byte data[];

public ImageSend()
{
getImage();
display=Display.getDisplay(this);
fImage=new Form("Some image");
exit=new Command("Exit",Command.SCREEN,1);
show=new Command("Send",Command.SCREEN,1);
iitm=new ImageItem(null,img,ImageItem.LAYOUT_DEFAULT,"Missing");
fImage.append(iitm);

fImage.setCommandListener(this);
fImage.addCommand(exit);
fImage.addCommand(show);
display.setCurrent(fImage);
}
public void startApp()
{


}
public void pauseApp()
{
}
public void destroyApp(boolean unconditional)
{
}
public void commandAction(Command c, Displayable d)
{
if(c==exit)
{
destroyApp(false);
notifyDestroyed();
}
if(c==show)
{
try
{
HttpConnection htt=(HttpConnection)Connector.open("http://192.168.36.200/~parag/linux/temp.php",Connector.READ_WRITE);
htt.setRequestMethod( HttpConnection.POST );
String boundary = "---------------------------7d43722015402c8";

String message = "--"+boundary+"\r\nContent-Disposition: form-data;"+
"name=\"bytes\"; filename=\"camera.png\"\r\nContent-Type: " + "/x-png\r\n\r\n";

byte []messageBody = message.getBytes();
htt.setRequestProperty("content-type", "multipart/form-data; boundary="+boundary);
DataOutputStream out = new DataOutputStream(htt.openOutputStream());
for(int i=0; i < j="0;j<" message="\r\n" messagebody =" message.getBytes();" i="0;" dis="htt.openDataInputStream();" baos="new" ch="dis.read())!="-1)" data="baos.toByteArray();" strb="new" r="0;r
strb.append((char)data[r]);

System.out.println(strb.toString());
//img=Image.createImage(dt,0,dt.length);
//iitm=new ImageItem(null,img,ImageItem.LAYOUT_DEFAULT,"Missing");
messF=new Form(strb.toString());
//messF.append(iitm);
messF.addCommand(exit);
messF.setCommandListener(this);
display.setCurrent(messF);
out.close();
dis.close();
htt.close();
}
catch(Exception e)
{
System.err.println("Msg: " + e.toString());
}
}
}
private void getImage()
{
DataInputStream is=null;
HttpConnection htt=null;
try
{
htt=(HttpConnection)Connector.open("http://192.168.36.200/~parag/linux/dcgui2.png");
int len=(int)htt.getLength();
data=new byte[len];
is=htt.openDataInputStream();
is.readFully(data);
is.close();
htt.close();
}
catch(Exception e)
{
System.out.println("Read Error");
img=null;
}
System.out.println("Image size "+data.length);
img=Image.createImage(data, 0, data.length);
}
}
---------------------------------------------------------------

If buzz me if u dont get the code. I think its pretty simple .

Wednesday, April 20, 2005

Hello World

Hi there ,
So u know this, guessed from d title, and have an idea where it will move on to .
"Hello World " The famous of all the programs that is written in most of the programming languages,to begin with, generally consists of the print statement...........well let me not go in the details i am no freeky programmer.

So why am i here ?? Apart from the accutomed reason for blogging ( to jot down special/significat moments, give my mind for your "food" for thought, my feeling/experience/observations ) , i think i m here for a special purpose :
I m doing a project (not that this is the first one) . what i experienced is when i am in trouble or i have a doubt i look for the solution on the net ( i use google , but i think i need to switch to some better one) and i have 1000's of solution there . Last sem someone suggested me why dont i try to keep the solutions to problems i faced on some website/blog.Hey that is a good idea ?
But why a blog ,i could have very well gone to some forum and done the same. Now here is the difference : on a forum it looks stupid to post d solution when no one is asking u the question but on a blog u can post it as a suggestion .secondly i dont find enough time to look out for the thousands of questions and answer them ( i mean the ones i have an idea of)..

but it wont be all community service; some fun and loads of "masti" ( now i m getting this feeling this is going to be gr8, incase u have noticed the title of ur browser).

So i think this is it for the first day.
so watch for this space regularly, for it may bring a smile on some face.

Troubleshooting Packet Drops in SolarFlare Onload 10G PCI Card

If you see lots of packet drops in your onload accelerated application even after going the troubleshooting discussion we did over here ,...