Monday, June 10, 2013

Execute HTTP GET in Android

Sample Code :

try {
       HttpClient client = new DefaultHttpClient();
       String targetUrl = "http://www.example.com";
       HttpGet httpGet = new HttpGet(targetUrl);
       HttpResponse response = null;       
       response = client.execute(httpGet);
       HttpEntity entity = response.getEntity();
       if(entity!=null){
             Log.v("GET RESPONSE", EntityUtils.toString(entity));
       }
}
catch(Exception e){
       e.printStackTrace();
}

Thursday, June 06, 2013

Get the frame of a view inside another view

Converts a rectangle from the coordinate system of another view to that of the receiver.
- (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view
Sample :
CGRect frame = [imageView convertRect:button.frame toView:self.view];


Swift Operators - Basic Part 3 (Range operators in swift)

Range Operators: Closed Range operators  Half-Open Range Operators One-Sided Ranges Closed Range Operators:  a...b It defines...