Thursday, 25 October 2012

Start it the right way !!!

I really had many experiences of starting something the right way, of course, I had the other side of it too...

When I started my career years ago, I started with Java - OOP language - but for more than a couple of years from then, OOP/OOD for me was just about 4 properties, I dont think there is a need to mention what they are. It is only at a later stage in my career, I even came to know something about OOAD principles, THE SOLID principles. I felt embarrassed, ashamed but then realized that I dint start it the right way. Had to unlearn many things before taking the right path. Now, whenever I get a chance to talk to young programmers, I make it a point to tell them my experiences and its consequences. They, at least, don't have to learn it the hard way.

I got a chance to manage a high end web based application, where UI is rich and built in Javascript. My experience kicked in, said, "Start it the right way".

Goal: Get a good hold on HTML CSS and Javascript

Approach:

I started with searching for good programmers in those technologies, came across many -  Douglas Crockford, Paul Irish, Nik Zakas, Rebecca Murphy, John Moore and some more to list... not that I want to disgrace others but the list is a bit long

I tried to understand their recommendations, suggested books, sites, blogs and what not and just read those and do the way they suggested and recommended.  Check this, it's is really interesting: http://w3fools.com/

My past learning helped a lot to do things the right way and now, I can surely say that, we are not going the wrong way, if not the right or the best way.

Maybe, I would suggest the same approach for others too :-) Good Luck :-)

Wish to see someday where my name is in the list :P.. sarcasm :-) !!!






Tuesday, 20 March 2012

Using gallery as Horizontal list view in Android

The question has already been asked on Stack Overflow: http://stackoverflow.com/questions/3877040/how-can-i-make-a-horizontal-listview-in-android

We have had a real problem getting a horizontal list view in one of our mobile applications and were initially planning to come up with one of our own. We have even come across some implementations online for Horizontal List View as a reusable component. But when tried understanding it more, we came with a approach where an existing Gallery component can be used as horizontal list view and that too with little efforts.

Gallery by default center locks the element selected and, unfortunately, is not extendible to even override that behavior. So the alternative way is to adjust the margin. Here is a sample implementation:

public class CustomGallery extends Gallery{
.
.
.
    public void setMargin(Context ctx, int width) {
        LinearLayout.LayoutParams localLayoutParams =
                        (LinearLayout.LayoutParams) getLayoutParams();
        localLayoutParams.leftMargin = (width - tileWidth - 2 * gapBetweenTiles) * -1;
        setLayoutParams(localLayoutParams);
       
    }

.
.
.
}

That is just a sample implementation, you can have it in your own way keeping the approach same :-)

Good Luck !!!