magnify

A New Ray of Hope

Published on December 23, 2012 by in Politics

The newly formed Aam Aadmi Party (AAP) by Arvind Kejriwal is a new hope for India. Indian Politics have become a pit of dirt and corruption and Arvind Kejriwal has unveiled several politicians who are involved in various corruption scams and this brings a ray of hope that Indian politics will revive. Arvind Kejriwal’s claim that if his Aam Aadmi Party comes to power, corrupt politicians will be prosecuted in six months, but to be in power is very difficult in India, as we all know elections are win by using money and muscle power, AAP dosent have both and as per indian political history for new party its very difficult to stand in politics, I am very much doubtful about how much success they will get in first election because AAP has to fight with very experience players like Congress, BJP etc.

I think we need to support him at least we need to give him a chance to prove them self. We have tried with Congress, BJP and we all know what kind of dirty politics they do, how they play with people sentiments and win the eclections, so first time in india someone is talking about corruption its really good thing for Indian future and we all need to support them.

Also lots of people having confusion about party agenda and future plans, I also have lots of doubts like Kejewal said if they are in power then they will pass bills and lows with the help of common people not in parliament, means they are going to consider what people wants, I feel this stuff is really impassible in india, we have around 1.2 Billion people, and hundreds of parties, corruption is ok we all are tougher with it but what about “Foreign polices” “FDI” “Nuclear deal” “Financial decisions” “Petrol diesel prices” “Different kind of laws” etc. this kind of stuff we cant go in public and take their opining, some of the decisions may be good for india and people may not be ready for that, in this case party need to take very strong stand, but normally people didn’t accept hard decisions or changes, so AAP should clear his stand & polices on other issue also.

AAP party will be hopefully help our nation to develop and progress by removing all the evils that exist in our society.

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Some More Android Code Snippet

Wifi

The WifiManager can be used to enable and disable wifi.

WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
wifi.setWifiEnabled(enabled);

GPS Location
we can use LocationManager to start up the GPS and get location updates.

LocationManager locator = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener mLocationListener = new LocationListener() {
  public void onLocationChanged(Location location) {
    if (location != null) {
      location.getAltitude();
      location.getLatitude();
      location.getLongitude();
      location.getTime();
      location.getAccuracy();
      location.getSpeed();
      location.getProvider();
    }
  }

  public void onProviderDisabled(String provider) {
    // ...
  }

  public void onProviderEnabled(String provider) {
    // ...
  }

  public void onStatusChanged(String provider, int status, Bundle extras) {
    // ...
  }
};

// You need to specify a Criteria for picking the location data source.
// The criteria can include power requirements.
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);  // Faster, no GPS fix.
criteria.setAccuracy(Criteria.ACCURACY_FINE);  // More accurate, GPS fix.
// You can specify the time and distance between location updates.
// Both are useful for reducing power requirements.
mLocationManager.requestLocationUpdates(mLocationManager.getBestProvider(criteria, true),
    MIN_LOCATION_UPDATE_TIME, MIN_LOCATION_UPDATE_DISTANCE, mLocationListener,
    getMainLooper());

we can also get the phone’s last known location using the LocationManager. This is faster than setting up a LocationListener and waiting for a fix.

// Start with fine location.
Location l = locator.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (l == null) {
  // Fall back to coarse location.
  l = locator.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
}

SMS
we can send SMS by using SmsManager.

SmsManager sm = SmsManager.getDefault();
String destination = "+919822390027";
String text = "Hello, jony!";
sm.sendTextMessage(destination, null, text, null, null);

Vibrate
we can vibrate the phone for a specified duration

(Vibrator) getSystemService(Context.VIBRATOR_SERVICE).vibrate(milliseconds);
 
Tags:
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

My First Laptop

Published on April 21, 2010 by in Uncategorized

My MacBook

Like first love, you don’t get anything like your first laptop.

I got my first laptop a MacBook. I am so excited. Honestly, I didn’t initially intend on getting a MacBook because its too costly. but later I realize that spending that much of money is really worth.

It’s quite a beautiful piece of equipment, but I’m not just looking for a beautiful notebook, one factor that I value most from a notebook is durability. Because I plan to use the machine as my main computer where I do my programming with Java, Android and other activity.

Usually beauty and durability does not came along together but apple made it. apple combine such characters into the macbook and with the OS X easy to use and stability (good performance too).

I love my MacBook! The multi-touch trackpad and battery life are AMAZING!
here are some Pros and Cons

Pros:
-Multi-Touch Trackpad
-Magnetic Power Connector
-13.3 inch Gorgeous Screen
-Easy to Fast-type Keyboard
-7 Hour Battery Life
-2.26GHz Processor! (Super fast!)
-It is just amazing

Cons:
-No SD card slot (not a big deal AT ALL)

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
1 Comment  comments 

Power Cut Problem in Bangalore

Published on April 14, 2010 by in Miscellanies

No Electricity

Bangalore is supposed to be the IT capital of India. They even call it the Silicon Valley of India. So much for that! but Karnataka Electricity Board or the BESCOM are not able to handle eccentricity problems.

Frequent power cuts are very common here. There is no scheduled power cut and power comes and goes all the time. Presently We are having a minimum four-hour cut which sometimes goes on to six hours. In summer the power condition is almost like an village, there is no power at all, sometimes the whole day… sometimes the whole night… The most weird part is when I call up the electric board office in my area, they don’t even pick up the call and when they do, ( I am very lucky that time because they pick up phone) they gave very funny answers. or speak very rudely or telling me that they can’t help.

One more thing that surprise me, The Earth Hour campaign. Karnataka government spent lot of money to advertise this event. There are lot of hoardings like “Please switch off your lights for one hour” but they don’t know, everyday we celebrate earth hour. I think in India everybody celebrates earth hour, there is no need to celebrate this event in specific day.

I think government should not waste money in event like this they should invest money in power generation and good distribution structure.

 
Tags:
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Checking GPS Status

The application I’m currently working requires that the user has the GPS active on phone. otherwise application is useless. The application needs the Geodata to function. This brought up the issue of, how do we know if the user actually has the GPS enabled on the phone? If they don’t, the application will still work, but all values are zero. to avoid this we need to check GPS status.

This can be done by using locationManager. it has isProviderEnabled() method by using that we can check GPS status.

Here is code snippet.

protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     LocationManager locManager = (LocationManager) getSystemService(LOCATION_SERVICE);

     if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
          createGpsDisabledAlert();
     }
}

private void createGpsDisabledAlert(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Your GPS is disabled! Would you like to enable it?")
     .setCancelable(false)
     .setPositiveButton("Enable GPS",
          new DialogInterface.OnClickListener(){
          public void onClick(DialogInterface dialog, int id){
               showGpsOptions();
          }
     });
     .setNegativeButton("Do nothing",
          new DialogInterface.OnClickListener(){
          public void onClick(DialogInterface dialog, int id){
               dialog.cancel();
          }
     });
AlertDialog alert = builder.create();
alert.show();
}

private void showGpsOptions(){
		Intent gpsOptionsIntent = new Intent(
				android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
		startActivity(gpsOptionsIntent);
}

And thats it! When the user starts the activity, if the GPS is off, the dialog will pop up asking them what they want to do. If the GPS is already on, nothing will happen.

 
Tags:
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
1 Comment  comments 

Finding distance between two points – Android GPS

Currently I am working on GPS related project. and every day I am exploring new things. Now I realize that GPS is very interesting technology and we can make lot of useful things by using GPS.

The new thing today I learned is, finding distance between two points. Previously I was thinking that, it may be difficult but, thankfully there is a much simpler way to figure out distances between two points on a map: the distanceTo() method in the Location class. Using this handy little method, we can quickly find out the distance between two locations:

double distance;

Location locationA = new Location("point A");

locationA.setLatitude(latA);
locationA.setLongitude(lngA);

Location locationB = new Location("point B");

locationB.setLatitude(latB);
LocationB.setLongitude(lngB);

distance = locationA.distanceTo(locationB);

One thing to note is that the distanceTo() method returns the distance in meters, so you will need to do the appropriate calculations if you want your distances in other units.

 
Tags:
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
3 Comments  comments