Sunday, December 11, 2016

Geek and Proud





I had to take quote a line from the movie x-men First Class character - Mystique “Mutant and Proud”. I found it profoundly inspiring to my field of interest (coding/software development). Unfortunately you won’t be seeing floating steel metals on mid air while reading this, nor will I discuss the fate of mutants ;  it does possesses far awesome meaning. It means one should never try to change herself for mere acceptance by the established thoughts, …well with the exceptions of super and junior villains of course and with rare exceptions to the mentioned exceptions in case if its Dead Pool and Suicide Squad I mean those guys are … ok enough of them . The idea of uniqueness is something we must cherish or at least entertain the idea of it. It gives you more than a glimpse of a gift of peculiarity.  Once embraced the journey ahead will never be the same, not promisingly safe yet it let you walk on the thin line of success and a brief moment of failure.  Agreed, many people would say otherwise. After all I’m writing in favor of peculiarity. Not awaiting a 5 star rating. Now I would like to talk about geekness as in software development in particular.  
Yes like any other science stream it does need all the hard work


Almost a year ago I decided to embark on a journey of further polishing my android programming skill. Like my first time “java Servlet” coding pace in java EE; the progress was horribly slow but slowly gained  unstoppable  momentum to a point where I can challenge Juggernaut (google it). Not claiming I’m a born again developer to say it in more fancy spiritual  ways ;-)  Not claiming that I have achieved geekness fully, but I certainly have a room for it. Such  geekness is invaluable in all sense because it’s Science Craft, there is always new, faster and better ways to accomplish the task in hand and create excitingly new task. To mention some geekness description from my own experience and contemplation of its meaning I have come up with some stunning lists.

My close friends, baby sister and honestly my dates all gave it subtly different yet similar meaning calling it  “Aelaf Into the Androidness”… again with super hero movies(Thor or Star Trek) admit it does rhymes.
#0 Many times in middle of conversing with people, either your face lit up or something while making code loop checking by remembering some ideas over the projects you currently working on. I was warned that it can bring disaster. It is a character I had the liberty of doubting to ever exercise on myself. Yet the symptoms are plenty. Thus here are few of the undeniable symptoms that can distinguish proud geek from just a geek or even worse, a normal person!!! ( don’t wanna imagine that)
 #1 After day/ evening long coding with errors and u r climbing your apartment, if you are making plans  and do momentary Spanish poses(not to be admired by passing girl but only to ponder over your problems) and throw some curses over your silly mistakes upon discovering.
#2 if you are on a date, and if she went to the rest room, and you start wondering about your projects bug instead of polishing the next killer line upon her return.
# 3 If your eyes pop out every time u come across latest plus advanced tutorial on your subject of interest. While watching tv tech program, you hear a tiny squeak from people around and you wave your hand to them so much like you are hearing a breaking news about a nuke strike or the next Moon Landing.
# 4 Have a habit of forgetting your facebook, viber and you run to your gmail and back to the project
# 5 makes heavily intellectual excuses for your social absence to your loved ones to the point where they break and start asking you about the news or your high school friends…
# 6 upon introduced to sage programmer, she/he start to show u coding tricks(call it dramatic coding!!!) that u considered  out of the mortal realm. You fired up all your questions, moment of mentor-ship happening in seconds.
#7 When you heard of the latest API or some refinement which you had some trouble with that you actually  report as a bug. A reaffirming thought that you are not just making a living but contributing to a noble cause.
#8 when your answer on www.stackoverflow.com is rated badly, knowing you can’t go back crawling to your mama nor your girlfriend’s arms but to work on your mistakes
#9 when the famed world class senior developer responded to your email in person. You read it at least three times.
#10 Having a ha moment even in middle of a college/ work interviews.

 Alas there are many examples. Thus to reach geekness ninja level, mastering the core science is a must. In programing world, it includes algorithm, data-structure and many others. But to keep the passion alive you need to keep your eyes to the art of it, that includes AI based softwares, amazingly useful apps, cyborg arms. More like Da Vinci passionate observance to human anatomy minus the digging out corpses and dissecting them. But in fact that’s exactly what it’s called unit test.;-) 
In short, just admiring the amazing invention alone nor being caught up in trying to master every bit of it won’t bring the true geekness from within you. But rather bridging your skill mastery to the artistic inventions you excitingly admire.
Love the science and the art will follow.
Just promise me that after u become a tech  mogul you won’t make scary statement on the internet  like magneto did in front of the White House saying “… you have the right to fear us, we geeks will inherit the earth!!! ”

Enjoy geekness to the fullest!!!

Thursday, March 3, 2016

Fragment communications with no Activty to bother u around in Android



I must say the task of interface implementations is no walking in a park, or perhaps walking that same park in middle of the night, with fear of irrevocable beaten up possibilities only to be garbage collected in the morning by a hobo. That being said it is very simple, once u understand the core procedures to make one (so is nuclear  rocket science, dah!).
 
follow these steps We have two fragments called AddFragmentand ListFragment, and upon adding an item on first fragment you want the updated list be shown on list fragment (what sort of sorcery is this!!!).
Step 1 create the listener interface on class level of AddFragment with a method that is going to be implemented by the other guy (ListFragment ) and create Interface type variable

public class AddFragment extends Fragment{
 //listener varriable

 //listener
  public interface OnCategoryAddedListener{
    public void refreshList();
}
 private static OnCategoryAddedListener meAddListener;
}
Step 2 create register method on class level of the same AddFragment class and set listenter variable
public class AddFragment extends Fragment{


public void registerListener(OnCategoryAddedListener listener)
{
    meAddListener = listener;
}
}
Step 3 upon any event cud be button click or yelling at ur application(that is considered rude event in android :-) ) check for listener object meAddListener variable and call the interface, in a Shakespeare’s nutshell it means “for thou who implement ye interface and brought the method within ur class shelter, I shall give u my utmost privilege and blessing to …. ”
Step 4 On ListFragment implement the AddFragment’s interface,no turning back just go implement its method. Within that method u just call abracadabra to repopulate ur list or any sort of updatable android view object… and ur done
public class ListFragment extends Fragment implements AddFragment.OnCattegoryAddedListener{
//refer to AddFragment
AddFragment addFragment;
ArrayAdapter<String>   catArrayAdapter;
//once the fragment is within the memory scope u instantiate AddFragment
//and register listener with AddFragment context which inherently implement OnCategoryAddedListener

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        categoryAddFragment = new CategoryAddFragment();
        categoryAddFragment.registerListener(this);

    }

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    fillList();

}

public void fillList() {

    catArrayAdapter = new ArrayAdapter<>(context,android.R.layout.simple_list_item_1,getItems());
    setListAdapter(catArrayAdapter);

}
//le interface method u can count on to refresh ur list content
public void refreshList(){ 
catArrayAdapter.clear;
catArrayAdapter.addAll(getItems);
catArrayAdapter.notifyDataSetChanged();   
}

Monday, November 16, 2015

Life of Coders Compared with Knights


Even in the early days of mankind were arrows and Flintstones were used to make food and other necessities, I bet there were this distinct people who where rather unique from the groups who experiment on ideas and bring changes despite the challenges. For instance, I don’t think the cave drawings of those times were meant to have artistic value but rather used as blue print or tactical drawing for improved hunting capability or better yet exciting for the contemporary animal right activists, it was used for taming/grazing strategies some wild animals (I bet it was a feat that was seen as a work of divine power or pure science fiction at that time).Those were the men and women who were behind the prehistoric futuristic S.W.A.T 

At any time of man kind struggle for betterment of Life such individuals are indispensable. At our times, computers have given a way to smarter devices, unimaginable interconnection and endless possibilities. We may not desperately need Iron smith or a reputed royal sword maker. Yet the same zenith filled individual is needed in the field of computers. Human intellectual evolution has been witnessed through out human history. Upon focusing our lenses towards coders things get even much interesting.

Lets compare Coders/programmers/developers to the middle age noble knights who where considered the elite of their times (not by the current standard of course) due to the facts that they were the only few who travel to strange lands, read posters, bring justice to the mass, read maps, explain about the ancient Roman ruins to the ignorant village people, speak Latin, go deep into the woods, learn lessons from the Arabs and Turks, and live for a cause! 

A Knight can only serve one Lord for his life time, but a Coder can (in fact must) serve at least more than three Lord like programming languages.
 
A Knight with light yet durable armor has many advantages over his companions with unwieldy armors, as for a coder with a laptop of the size of dead-man chest from the movie Pirate of the Caribbean will always be tempted to switch his love of his life to an ultra-thin laptop.
A Knight fight against bandits, foe land lord, witches, dragons and not often but with demons all one at a time, but a coder deals with sudden demonic like user interface errors, performance issues which equals dark ages, horribly ugly code bugs that are similar to black death symptoms, deal with hunchbacked algorithm implementation, documentation as large as library of Alexandria, and the internet menace all at the same time.
After a battle, a Knight retires in a lavish a royal bowl with drinks, foods, and women (sorry ladies it’s the middle age) that last like months. But a coder who just delivered a successful project is expected to reply in 12 hours for any bug report, email request.
A Knight severely wounded or even killed in a battle is given a high rank, his name written in royal archive, cathedral bell rang on his name, but if a coder failed to deliver a working package then he is sued, trialed if guilty state prison is a possibility.
For a Knight there is always this lady to be saved (not necessarily one though) that awaits him, who can deliver her from toil of every day, evil step mother, evil land Lord, so on and on. But for a coder such scenario is only a folk story, as there are lady coders who are too awesome to fall for such poetic incidents.
One mistake in a battle for a Knight can cost him his life or worse ,living in dungeon like Count of Monte Cristo, as for a coder there is plenty of room for a mistake as long as it abides with the contractual agreement …
To be a Knight you need to have a royal blood in you, simply you need to be destined to be one. For a coder such racist beliefs do not pass system requirement check.

From this comparison, one can be tempted to contemplate over how human beings have evolved in the past 1000 years be it culture, technology. The question I must ask you, is how will our greatest achievements in field of computer technology will be seen a thousands years later? Instead of searching for answer, just start working on your latest ideas, who knows they could be placed next to a Knight armor as mankind greatest achievements in the future museums.

Great Achievement to All


Wednesday, September 2, 2015

Display View (Textview, Images and Buttons) at runtime on Android



 
Here are the simple steps

Get yourself  Layout in our case its Linear


/
//linearLayout -->BLUE
LinearLayout linearLayout=new LinearLayout(this);
             
               linearLayout.setOrientation(LinearLayout.HORIZONTAL);
               //vp  --> RED
               LinearLayout.LayoutParams vp=new  
               LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
 
create your views  [TextView, Button and Image] and add them to the  created linear layout àvp object for Text and button and àiv object for image

TextView tv = new TextView(this);
              tv.setText("tic");
          linearLayout.addView(tv,vp);

Button btn = new Button(this);
              btn.setVisibility(View.VISIBLE);
              btn.setText("ClickToStart");
          linearLayout.addView(btn, vp);

ImageView imageView= new ImageView(this);
             
              imageView.setImageResource(R.drawable.ic_launcher);
              imageView.setVisibility(View.VISIBLE);
          imageView.setBackgroundColor(0xFFFF00FF);
//Iv --> GREEN
LinearLayout.LayoutParams Iv=new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
              linearLayout.addView(imageView,Iv);
          setContentView(linearLayout,vp);

more than happy to read comments (not harsh i suppose)
until next time.