Skip to main content

Posts

Showing posts from June, 2011

Cropping , Scaling and Rotating image in Android

Here i am not writing any program to crop, scale and rotate image , im just writing the basic process with some code to show it... Cropping of BitmapImage is done in an easier way as follows Get the bitmap image - if its in resources Bitmap origBitmap=BitmapFactory.decodeResource(getResource(),R.drawable.bitmapImage); now u have got the Bitmap image from the drawable resource, my drawable resource name is bitmapImage.png , u can choose your own and correct accordingly. Co-ordinates start from the top left corner of the Image as in Java. So if u want to crop from (0,0) having width 50 and height 50 of an image having width and height of 400*400. u jsut have to create a new Bitmap by giving appropriate coordinates,, Bitmap croppedBitmap=Bitamp.create(origBitmap,0,0,50,50); here u have to consider the width and height of the cropped bitmap that it should not exceed the original height and width of the image. now Your Cropped Bitmap Image is ready , you can use it in imageView as imageVi...

RESTFul Client on Android

I was surfing on net , i didn't get a needed help on RESTful Client on Android, so I decided to write my own. Following is the code.. First of all REST service architecture uses all the basic operations of HTTP to interact. First of all u would have to set make a HttpGet method with the URI to be requested. HttpGet httpGet=new HttpGet(new URI("www://abc.con"); i have used new URI() as a get parameter because if u are sending some parameters with the GET request , it will encode the parameters ready to be sent along the network channel. Second step is that u will have to make a HttpClient which will execute the GET request that we have made. It is made as follows-- HttpClient httpClient=new DefaultHttpClient(); now execute the GET request from the HttpClient as Make a variable to hold Response of the request HttpResponse httpResponse=httpClient.execute(httpGET); to convert the Response to string use the following line String result=EntityUtils.toString(httpResponse.get...

NMAP Basics

Nmap is a free open source software available for both Linux and Windows. Basically its a port scanning software. Basic Scan Types The two basic scan types used in nmap are TCP connect() scanning [-sT] and SYN scanning (also known as half-open,or stealth) [-sS]. TCP Connect() scanning [-sT] These scans are named as connect() scanning because UNIX has a system call named connect() to start any TCP connection to a remote machine.If the connection succeeds to a particular port of remote machine i.e it connects , then that port is listed OPEN for that remote machine, if connection fails , then remote machine showed either offline or port is closed. It runs simple process of scannig all the ports of the remote machine and lists which posts are open and which are closed. This is an easy way and gives a clear picture of the process but it has disadvantage too ,if the reomte machine is having advanced firewalls and intrusion detection systems, it will flag a warning that all ports are scann...