Friday, November 2, 2012

A better search engine implementation

Got this thought while sharing a bookmark with my friends. A better search engine is one that searches (shared) bookmarks of every person. It is a curated content waiting to be indexed and used.

Maybe i will write a chrome plugin for this.

Arduino in Bangalore


The below reference is a good doc on where to buy Arduino in Bangalore

http://sudarmuthu.com/blog/buying-arduino-in-bangalore



You can also buy at OM Technology center in SP Road, when i went for buying there, i only got a clone of Uno as they ran out of stock. The clone costed 700.




OM Technology Centre is opp to Luciya Hotel, OTC Road.




The clone had “Freeduino USB 1.1″ printed in it and i had a tough time finding what to choose in Arduino IDE to load it. Finally by mistake i choose Arduino Uno and it gulped the code. All over the net, Freeduino USB 1.1 mapped to Diecimilia.

This is the best documentation on step by step guide on how to install CP2102 driver and get the freeduino board working

http://probots.co.in/Manuals/Probots%20Freeduino%20USB%201.0%20-%20Starter%20Guide.pdf

i tried in Mac 10.7 and it didnt work, then switched to my Windows 7 bx and was able to load the program.


Sunday, October 7, 2012

Web Application Architecture and Design Considerations

 i was a developer/manager(what they call techno-functional manager in India) of a F50 Financial services company, now i am the lone programmer/manager/hacker/cto/vp of my startup. What should you consider before starting an e-commerce/social web site. It has user regr and *passwords*, user specific content, medium level sensitive data (i am multi-tasking with summer of 69) , emails going out and coming in, images or documents and news feed.


1) Denial of Service (a.k.a DOS attack)
2) Encrypting user password (or using open id like Google/Yahoo/FB)
3) Scalability
4) Fail over
5) Securing user password retrieval (forgot password)
6) A decent session id generation logic
7) Caching
8) What goes into RDB vs NoSQL
9) Search engine optimization (aka SEO)
10) Handle authentication and authorization when opening up services for mobile apps
11) Logging
12) Monitoring
13) Load Testing
14) Continuous Integration
15) Analytics (where are your users coming from, who is introducing them to you, are they going where they want to go, are they happy)

ok, now apply lean on this, does a start up site need all this on day one, what is MVP of the feature set.

1) DOS Attack, not day one,only a few ppl know, check if a config can prevent this (not more than 50 connections from one IP, but there can be master-slave or geographically orchestrated DOS)
2) Use FB / Yahoo / Google open id for registration (save the pain of salted hashed encrypted passwords)
3) Scalability: A good hosting company should give a harware (net-scalar) and software based load balancer, just make sure what you put into HTTP Session can be replicated (serializable) and don't rely on singleton instances(cache, connection pool) to always have data that you accessed before. Handle requests as if they are stateless, very little stuff should be put into session (reduce load on replication)
4) Not day one, if you can scale horizontally without user noticing it, then fail-over should be as easy as relying on hosting env.
5) N/A
6) Use tomcat, this has been internet facing for a long time
7)  Caching: TBD, find a framework that can do a better job than HashMap, distributed cache is a nice to have
8) Identify domain objects and then mark them as either RDB or NoSQL
9) SEO: TBD
10) TBD

Tuesday, October 2, 2012

Ad-hoc Distribution iOS Apps - Entitlements Issue


After spending my patience and 4 hours of time, of the zillion stackoverflow posts, found this TestFlightApp documentation that rescued me .

Issue: After blindly following apple docs on how to test the app on iOS device. Tried the same for creating a user testable version that can be distributed to others. Again blindly followed apples instructions for creating certificates and bundling a ad-hoc distribution version, but then it failed when i tried installing with the below error


Solution:

Here is a Test Flight App Documentation. (Read Step 4 and 5)

I am re-posting the content just in case the link breaks

Step 4: Scroll down and expand the Entitlements section in the Summary tab. In previous versions of Xcode, you were required to create an Entitlements file and create a get-task-allow key. This is no longer necessary. Unless your application requires special permissions surrounding iCloud or Keychain Access, you are not required to create this file. Leave the Enable Entitlements checkbox unchecked.

Step 5: Go to the Build Settings tab and scroll down to the Code Signing section. For the two default build configurations (Debug and Release), select your Development Provisioning Profile for Debug and your Ad Hoc Provisioning Profile for Release. Leave Code Signing Entitlements blank.



In previous versions of Xcode, the most common entitlement set was setting get-task-allow to false. This caused an enormous amount of confusion. In Xcode 4.3 this entitlement is automatically set based on whether the app was built using a Development or Distribution Provisioning Profile.

Friday, August 10, 2012

Jackson JSON Views in Spring MVC

Problem: I have a pojo which can easily be serialzed to JSON using Jackson JSON, the requirement is to only serialize select fields of a POJO.

Learning: Due to lack of documentation and pages not being indexed by Google, nobody said that if i dont annotate a field, it will be serialized. One of the fields was being serialized and i had to debug code to realize that though Views work, Jackson/Spring would serialize a field that is not annotated.


Solution: Using Spring MVC 3.1.1 Release and Jackson 1.9.x


    @RequestMapping(value="/rest", method = RequestMethod.GET)
    public ModelAndView speakers() {
   
    ObjectMapper listViewMapper = new ObjectMapper();
    listViewMapper.setSerializationConfig(listViewMapper.getSerializationConfig().withView(Speaker.ListView.class));
   
    MappingJacksonJsonView jsonListView = new MappingJacksonJsonView();
    jsonListView.setObjectMapper(listViewMapper);
   
    return new ModelAndView(jsonListView, "speakers", eventService.listSpeaker());
    }


and here is the POJO that i would like to filter, note that short_bio is linked to a different view and will not be serialized. 

public class Speaker {

    @Id
    @GeneratedValue
    private Integer uid;

    private String knownAs;

    private String designation;

    private String companyName;

    private String shortBio;
    
    private String pictureLink;

    public interface ListView {};
    public interface DetailView extends ListView {};
    
    @JsonView(ListView.class)
public Integer getUid() {
return uid;
}

public void setUid(Integer uid) {
this.uid = uid;
}

@JsonProperty("known_as")
@JsonView(ListView.class)
public String getKnownAs() {
return knownAs;
}

public void setKnownAs(String knownAs) {
this.knownAs = knownAs;
}

@JsonView(ListView.class)
public String getDesignation() {
return designation;
}

public void setDesignation(String designation) {
this.designation = designation;
}

@JsonProperty("company_name")
@JsonView(ListView.class)
public String getCompanyName() {
return companyName;
}

public void setCompanyName(String companyName) {
this.companyName = companyName;
}

@JsonProperty("short_bio")
@JsonView(DetailView.class)
public String getShortBio() {
return shortBio;
}

public void setShortBio(String shortBio) {
this.shortBio = shortBio;
}

@JsonProperty("picture")
@JsonView(ListView.class)
public String getPictureLink() {
return (pictureLink == null)?"":pictureLink;
}

public void setPictureLink(String pictureLink) {
this.pictureLink = pictureLink;
}
    
    
}


I am yet to try moving the View to a class so that i can be re-used across multiple POJO

Tuesday, August 7, 2012

Grails vs Play vs Ruby on Rails

This is a good comparison of Grails vs Play

http://www.ubertracks.com/preso/index.html#/


Grails vs Play vs Ruby on Rails (i know it is not Java, but the net is swamped by this)

this is a biased article on RoR
http://ruby.dzone.com/articles/rails-vs-grails

A good post with stats comparing JSF , Struts, Groovy, Ruby, Perl and Python
http://www.expectationgap.com/posts/13


I am learning Ruby now !! , the web and google is biased towards Ruby on Rails, i drank the cola

Ruby sucks, i am one of those lazy enterprise programmers who still loves Java. Spring MVC rocks !!


Update: After realizing that if so many startups are using Ruby on Rails, there should be some credit to it, hence focused and tried Ruby and RoR and finally was able to get an app running with CRUD, oh boy !! Ruby on Rails Rocks !!.


Friday, August 3, 2012

Google Technology Day Bangalore, Aug 3, 2012

Executive Summary: "the best ever technology conference that i have ever attended, all code and no bull shit"



KeyNote started with how lucky we where as, we were the choosen 1200 out of 3800 requests (too low for such an event, may be since this is the first time in Bangalore). Sunil Rao , Country Head for outreach program was in a cool shirt with jeans (i was the dumb guy in formals, my Goldman attire that i wore for 7.5 yrs could not be forgotten easily) and talked about how Google innovates and threw some numbers around why google thinks Mobile is the way to go, and in particular why mobile in india is a potential that is yet to be tapped.



Then we went into a demo session, where a googler talked about how google help us in our every day life, the demo of JellyBeans seems to excite all the college grads (60% of  attendees where college folks) but for a proud owner of iPhone, i could relate it to Siri.



Then we went to Google API which is the new service offered by Google for its Maps, Cal, Mail, Docs and Hangout the presenter was full of enthu and showed how simple it was to register a project and start using Google API, he also showed how to authenticate with OAuth 2, this was something that i wanted to read this weekend and having somebody explaining this live and being able to ask questions on it was a blessing.


Then attended another not so worth mentioning session, since the product was still in beta and we broke for lunch. Lunch as good and they had planned really well to manage such a huge crowd.

After lunch it was time to click some Google snaps , but the spot was so busy, but i never gave up.






at last !!





and play "Bambaram (Tamil)", i had never got it right duing my childhood days, but today it just came naturally. I was amazed.




Then went on to attend a session on Hangout API's taken by a new googler. Not so interesting.

The key attraction was presentation on HTML 5, the session was presented by the same enthu guy (Neelesh Bodas) who did the Google API, he had laid out the material very well and was able to engage the audience.

HTML 5 was also another buzz word that i wanted to read about, and he gave the best and attractive intro to it. Though most of the demo's were from internet, the packaging and presentation was cool.

Demos were from http://www.html5rocks.com/


Other References

https://sites.google.com/site/gindia12/agenda-presentations/technology-days

Follow GIndia updates in G+
https://plus.google.com/u/0/s/%23gindia

Thursday, August 2, 2012

Expose COD Views as REST Service in Drupal

End User Steps


1. Download Drupal Services 3.x and install the module (install is a big word, install = download zip file and unzip to sites/all/modules folder, create modules folder if required). Choose 6.x-x.x versions, since we are using Drupal 6
2. Install Services Views
3. Install oauth 6.x-3.0-beta4
4. Install autoload 6.v-2.1
5. Go to Administer->Site Building->Modules to enable the above modules, oauth might ask you to manually download spyc, follow instructions shown in the top of the screen when you enable it. It is as simple as copying the spyc.php to the rest_server/lib folder
6. Create new Service and test your rest service


References
Drupal Pro Guide to setup Views as Service
http://www.jefflinwood.com/2010/08/using-drupals-views-as-a-json-web-service-with-the-rest-server/


How add/install modules in Drupal
http://drupal.org/node/120641

Tuesday, July 24, 2012

Drupal COD on Windows 7


  1. COD Requirements
  2. COD has been tested extensively with this configuration:
    • PHP 5.2
    • MySQL 5
    • Apache
    • Apache mod_rewrite module for clean urls
    COD should also work with general system requirements for Drupal 6.
               2. Installing Apache 2 and PHP 5.2 on Windows
      1. Download Apache 2 from Apache.org (i took 2.0.64 since PHP 5.2 on Windows uses VC6)
      2. Get PHP for windows from here (Drupal COD 6 was tested with PHP 5.2, download thread safe version as Apache is multi-threaded in windows)
      3. Follow steps for configuring Apache and PHP here (when u start Apache it complains that mysql dll is not present, ignore it for now)
      4. Create the test file , invoke it ,pat urself and get back to work

                3. Install MySQL                        

                      1. Download MySQL 5.x and Install (used MSI installer)
                      2. Create database using MySQL command line (the user in first 2 commands refers to root)

                4. Install COD

                      1. Update php.ini to increase the max_execution_time and input time to 5 or 15 mins based on how fast your comp is
                      2. Follow Step 3 and Step 4 in Drupal site (select COD option in the install page)

Reference

1. How to Install and Configure PHP 5 to Run with Apache on Windows
2. http://drupal.org/documentation/install/windows
3. http://drupal.org/node/264

Sunday, July 22, 2012

CouchDB + Application Server = CouchApp

guess i am getting closer to my vision


http://couchapp.org/page/what-is-couchapp


nope, this turned out to be not active, the feeling was that, it is best suited for weekend apps rather than large scale. Couldn't find any references to prod deployments.

Saturday, July 21, 2012

Mobile Application Architecture and Design Considerations



A good listing of design considerations (some of them are trivial thou)
http://blogs.globallogic.com/mobile-application-architecture-design-considerations
An easy answer to take the Native vs HTML 5 decision
"If your application requires local processing, access to local resources and can work in occasionally connected scenario or no connectivity consider designing a native application"
But Sencha Touch begs to differ
http://www.sencha.com/learn/taking-sencha-touch-apps-offline/
"Native application enthusiasts have often pointed to this need for offline access as being one of the factors that prohibits the feasibility of web-based application development. In this article, we'll set out to prove this argument wrong"
one other important consideration that i forgot where i read is
"While we have to design for the "I'm microtasking" mindset, optimizing for quick dashes of activity, we also have to accommodate the "I'm bored" mindset, allowing and encouraging leisurely strolls through our apps and data."





Friday, July 20, 2012

Mongo vs Couch db vs other No SQL



My Summary: since i am building a mobile app, would prefer couch db, since it supports REST out of the box, good for a startup like us to hit the market asap


References


http://www.mongodb.org/display/DOCS/Comparing+Mongo+DB+and+Couch+DB
 - a good unbiased comparison



http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis/ - a good one one with summary of what is each of them best suited for


What is Mongodb ?







What is REST ?

https://www.ibm.com/developerworks/webservices/library/ws-restful/

Sencha Touch 2 vs PhoneGap vs Appcelerator Titanium


My summary of what different frameworks offer today, PhoneGap is off the table since it is more suited for simpler apps and titanium is for developers with JavaScript background. Sencha Touch 2 is good if you are on the HTML 5 bandwagon. 


I am going ahead with Appcelerator Titanium as i am native.


Tried one of the featured PhoneGap app (that supported < iOS 5) and it was miserable (try navigating using the top buttons and it becomes clumsy)





References

http://usingimho.wordpress.com/2011/06/14/why-you-should-stay-away-from-appcelerators-titanium/