Things to check before launching your android app in play store

Following is an incomplete list of things one needs to check  before launching his/her android app in play store

a) Provide a notification mechanism in the app to let your users know when an update for the app is available. Believe me you will update more frequently than you expect.

b) Have a error reporting mechanism inbuilt to the app. HockeyApp is a good way to do that. This is most important in beta testing phase.

c) Have google analytics built in the app. Be thrifty with its uses though. You dont want the user too see your app as the highest bandwidth user on his phone.

d) Use fragments if your views are too big or complex. Refractor your app before launch.

e) If your app needs updates from a server then use push notifications rather than creating services in your app which hit the server after certain period.

More to come...

Simple code to connect to twitter streaming api using Scala with scalaj-http

This is pretty simple stuff to do. Follow the following:

a) Get a twitter account, register an app on http://developer.twitter.com
b) Get the api keys
c) Open you scala IDE
e) Add scalaj-http lib to your project (do it yourself use maven or sbt)
d) Modify the code below to suit yourself

val consumer = Token(<Your Api Key>, <Your Api Secret>)

//note: by default scalaj-http has very little connection Timeout times
  val token = Http.post("https://api.twitter.com/oauth/request_token").param("oauth_callback", "oob")
    .oauth(consumer).options(HttpOptions.connTimeout(5000),
      HttpOptions.readTimeout(5000)).asToken

//DO THIS AND GET THE VERIFIER CODE 
  println("Go to https://api.twitter.com/oauth/authorize?oauth_token=" + token.key)

  val verifier = Console.readLine("Enter verifier: ").trim

  val accessToken = Http.post("https://api.twitter.com/oauth/access_token")
    .oauth(consumer, token, verifier).options(HttpOptions.connTimeout(5000),
      HttpOptions.readTimeout(5000)).asToken
//increased connection timeout to big value
   val request=Http("https://stream.twitter.com/1.1/statuses/filter.json").param("track","modi").oauth(consumer, accessToken).options(HttpOptions.connTimeout(500000),
      HttpOptions.readTimeout(500000))
     
 //streaming api read it continuously and do whatever with it
 //i am just printing it

 request.asHeadersAndParse {
      inputStream =>
         (Stream.continually(inputStream.read()).takeWhile(_ != -1).foreach(a=>print(a.asInstanceOf[Char])))
    }

You can send me thank you mail.

Simple Google Maps Api integration with Ember.js

Objective: To display a google map widget on SPA web page created using Ember.Js

Ok this is simple. On your (SPA) html page (I will be using index.html) do the following:

  <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=<your key-here>&sensor=false">
    </script>

Now in app.js define a view like this:

App.MapView = Ember.ContainerView.extend({

  id: 'map-canvas',
  tagName: 'div',

  attributeBindings: ['style'],
  style:"height: 200px; ",
  
  map:null,

  didInsertElement: function() {
    var mapOptions = {
      center: new google.maps.LatLng(28.405765,77.049479),
      zoom: 13,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(this.$().get(0),mapOptions);
    this.set("map",map);
  }
});

Please note I have defined id as map-canvas for the tagName div. This will be the id of the tag name my div where the map is displayed.

Now in your spa page select where you want to show the view
So in the main template you can add the view

 {{#view App.MapView contentBinding="this"}}
      <div id="map-canvas"/>
      {{/view}}

This will call the mapView and display the map in the div of id map-canvas.



** The author of this blog is looking for a job! If you can trust his solution, you can probably hire him too :), **


Hide your developers

You have a developer working on your website. You think s/he does awesome work. You put his name on the website. Yay!!
Don't Do that!!
Why??
A) He is good, someone else will poach him.

B) B is for the big one, his resume will tell a lot about your website. All a hacker needs to do his visit his linkedin profile.

Example: foreignpolicy.com  is a widely respected magazine. On its team page you have this:


The web developers name is available. A quick google search takes you to her linkedIn page. And if you go through her skills and expertise:


Tada!! Drupal, foreignpolicy.com uses drupal and has mysql as the DB! Further, a smart hacker can gauge by going through the experience and previous work what kind of security level and code level the developer would have put in place.

Enjoy ;)