Tuesday, August 1, 2017

Java's Thread Class Analogy



Just recently after a long  moment of absence in Android development,... i'm making a slow but definite come back with a refreshed perspective, so i believe ;-) .... and after diving onto android architecture sample,  I suspected my skills on concurrency programming was not that good....you guess what i did next, requested the Oracle for help, no not in Greece! And i learned something worth sharing from Thread Creation.

Here is what i learned from Java Thread. As the Java APIs are not open source :-( yet, why not make small workable examples, analogy classes that can mimic the Thread class, in return we get to understand more deeply about the APIs and have architecture style  like the pros .

According to Oracle documentation on Thread . there are two ways of working with threads.
  1. the first one is providing a Runnable object to the thread constructor then calling thread's public method start(), simple ha?!
  2.  the second one is extending  the Thread class, write your code in the run method. then instantiating the class and calling start method.

so how would the java elites managed the classes to do such sorcery . Curiosity is the mother of all  code refactoring
here is my class analogy after an hour of  experimentation.
i made simple classes SilkThread to mimic Thread class, Jumpable interface to mimic Runnable interface, and Jackie class that uses the #1 way and Jetli class that uses the #2 way.
the codes are very much self explanatory,
The SilkThread class implements Jumpable, as well as has aggregate reference to Jumpable, it can do both tasks(for sake of example). The class is used to initiate tasks that are needed by other classes in our cases kung-fu legends Jackie Chan and JetLi classes,



//SilkThread class for First and Second Option
public class SilkThread implements Jumpable{
    Jumpable person;
    public SilkThread() {
    }
    public SilkThread(Jumpable person) {
        this.person = person;
    }
    public void start(){
       
        if(person!=null)
            person.jump();
        else
            jump();
    }
    public void jump(){
        //super-class tasks
        System.out.println("within SilkThread...");
    }
   
}

******

public class JetLi extends SilkThread {
    public void jump() {
        super.jump();
        System.out.println("JetLi Extending SilkThread & Jumping");
       
    }
        public static void main(String[] args) {
            new JetLi().start();
        }

}

******
public class Jackie implements Jumpable{

    public static void main(String[] args) {
        new SilkThread(new Jackie()).start();

    }
    public void jump() {       
        System.out.println("Jackie Implementing & Jumping High");
    }

}
******
public interface Jumpable {
    void jump();
}

Lessons I learned,
The first option: Gives much flexibility, the Jumpable object  is ready to implement many other interfaces,  but the SilkThread class is acting only as a doorway  to your implemented method. It is limited.

The Second Option which is sub-classing the SilkThread's caveat is, you can't have your acting sub-classes  do any more extending other than SilkThreads' (can't extend more than one Class)... but the Super classes carries the burden of implementing Interfaces for you, It got your back, It can do many homework tasks before the sub-classes methods.
 For instances Letting the super class handle security related tasks first.
Yes, in the eyes of Thread implementation the first option has always been the #1 but in terms of design flexibility one should at least entertain the awesomeness of the second option.

P.S   Oracle has always the Answer 😅

Sunday, July 30, 2017

Linux Basics To Break out of Windows Part 1

  1. Introdcution to Linux --- why Linux

  2. Linux Architecture  with Introduction to shell

  3. Linux Commandos- yes Commandos

  4. Redirecting I/O and Pipes

  5. Files and Their Permissions

    1. Octal Way

    2. The chmod

  6. Copying around

    1. cp , mv, ln

  7. Regular Expression for  Shell

    1. Star Lord and Its Crew (* , ? , [] )

    2. The Escape Plan

  8. Dealing with Files

    1. ls , cat

    2. grep

    3. find

  9. Shell Revised

    1. A bit of shell script

  10. To Compress or Not to Compress is the question

    1. tar

    2. zip

  11. man command


Introduction

As much as some want to stay comfortable with windows and explore less of the machines they use, the power of Linux in the era disruptive technologies is undeniable. Thus with out further  ado lets break out of windows. But why?
If you are a person who likes to share your intellectual property for betterment of humanity
fan of open source projects
Believes  collaborations brings excellence
Want to work on your imaginative ideas 
but know less about linux
You want to stay fit  and extra efficient in your coding cardio, if you are a developer.
And anyone else who feels  like breaking out of windows just for the thrill of it. This tutorial is for all of us. Black, white, asian, or even Martian.

DISCLAIMER

The writer of this article will not be hold accountable for any property damage, including windows and gates by people literally inspired by the blog, nor is he in any way in dispute with Microsoft Inc. products and services.

Architecture

All Unix and its pre/desceor  are one of the most programmer-friendly platforms ever created by man kind.
GNU/Linux is Free and Open source. Meaning you can have it for free plus you can tap into the source code when ever you feel like it.

 Linux Environment and Its Editor(s)
The operating system is independent of the operating system commands, which are command to display files, show contents of directories and many others. Thus “Kernel” is left with the necessary functionality of the o.s. The rest are executables on top of kernel, that can be changed, enhanced or even replaced. One of which is the command processor named shell.
Shell  is a program that takes command- line input , and picks what program(s) you are asking for and then runs those programs. Basically it's a dude disguised as kernel right hand. It is the user-interface.

Redirecting I/O and Pipes

 Redirecting I/O : Means it shift the inputs and outputs to your desired source and destination
 it's based on standard I/O
⦁    Any Linux process has Standard in, out and error : named as the three musketeers of open file descriptors.
Standard In: Source of input for the process e.g input from keyboard, file
Standard Out: Destination of the process output e.g output to Monitor, file
Standard Error : Destination for error messages e.g output to Monitor, file

this can bring great flexibility to your tasks.
Redirecting I/O is done by “<” for input and “>” for output
  example command line and type ls

aelaf@localhost:~$ ls
bin  Documents  Downloads  Music  Pictures  Public  Templates

aelaf@localhost:~$ ls >output_file
aelaf@localhost:~$

in the first command the output is displayed on the  screen you and you and I can see it(de facto location of standrard out), but on the second command you are redirecting the output to a file named “output_file”. Open the file to witness the magic.  As for error, to redirect standard error use “2>”

~$ ls ET_file 2> error_file
~$

exercise: the command 'sort' sorts by the first character of each line, try to sort contents from a file and redirect the result to another file, can you sort the file itself ? Why not?
   

Pipes: 

Its similar to Block chain production
 The output from one command given as an input to another command.
$ ls | wc > wc.fields
$ java MyJava < data.file | grep -i total > out.put

the first example runs ls then pipes its output to → wc(word count) program in return output is  redirected to the file wc.fields

the second example runs java with class file MyJava with argument input from data.file and the output will be piped into → grep in return output into out.put

Morale Lesson: Modularization of functions into small, reusable units. And can be interconnected with other commands to do more.

Files and Their Permissions


FileNames
Stay with alphanumeric, period and underscore,as puncutations have speacial meaning to the shell. Or you can escape them but its tedious.
 Filenames are case sensitive JackSparrow.pdf and jacksparrow.pdf are different pirate files.
Avoid using spaces, as shell uses it to delineate between arguments. Or you have to put the name in quotes when using it in shell.
Unlike windows period or “dot” in linux has no special meaning.
In a file name Mummy.avi  has .avi are just the last four characters.

Permissions

There are three categories: The owner(creator), the group(buddies), and the others(neither the creator nor buddy). Any file has a single owner and, simultaneously, to a single group.
It has separate Read/Write/Execute permission for its owner,group and  others.

If you are owner of a file, as well a member of the group that owns it, owner persmission  is valid to you. If you are not owner,but member of the group, then group permission is valid.
Other get the “other” permissions. They are the outcasts afterall.

Octal way of Permission

Read/Write/Execute as three bits of a binary number,
the most significant bit represents read,
the middle bit represents write,
and the least significant bit represents execute.
Taking the three categories, User/Group/Others as three digits, permissions of a file can be expressed as three octal digits.
22    21    20    Bit
4    2    1    Numeric
Read    Write    Execute    4+2+1 = 7

Example:The permission of 750 octal digit is as follows
R/W/X (4+2+1)for the user, R/-/X (4+1)for the group and -/-/- for others.

The chmod way:


 uses letters to represent categories and permissions.
'u'-for user, 'g'-for group, and 'o'-for others, as for permissions 'r'-for read, 'w'-for write, and 'x'-for execute.For both categories and permission a represent 'all'.

To add permission use plus sign(+)
to remove permission use minus sign(-)
example: g+a means: add all permissions to the group categories
a+r means: add read permissions to all categories
what does those mean? - a+a, u+a, g+rx

File Copying --- mv – cp – ln


mv[move]-move file around directories and rename file name

    $ mv Dart.java DartX.java  <-- rename a file
   
    $ mv MyApp.java ./Document/App.java  <--move to sub-directory      Document and rename a file if same file name exist rename it

    $ mv One.java Two.java ..   <--move the files up one directory
    '.' points to the current and '..' points to the parent directory

    $ mv /usr/oldproject/*.java . <--moves all java files from the directory “oldProject” to the current directory

cp[copy]- similar to mv but the original file is left untouched

ln[linked copy]- vaguely similar to cp, the change in the original file is reflected to the copied file.a.k.a shortcut in windows

    ~$ ln chuck ./Document/chuck2
     change copy the reference to another file named chuck2  any change to chuck, and you will see it from the face of chuck2


Star Lord and Its Crew



No, its not about saving the Galaxy, its rather more interesting ;-) → It is used in shell pattern matching

$ mv /Documents/Projects/*.java .
 The star is a shorthand to match any character with in comination to the .java, will match any file  in the /Documents/Projects. try to finish the rest  of the explanation on the command.

 Two things to note here!

First, the Star and rest of the crew “? and []” don't mean identically same as the regex in vi or other programing languages.Although similar.

Second, the pattern matching is done by the command interpreter before the arguments are given off to the specific command. Any text with those characters is replaced by the shell with one or more filenames that match the pattern.This means, all the Linux commands(be it mv,ln,ls...)only receives the result from shell.

Exercise: Try to explain the advantage of shell doing the regex job,then handling it over to the commands.

?:will match any single character
[…] or Bracket Match: It can matches any of the individual character inside
    example: [abc] matches any of a or b or c
    example2: Dart[123].java would match Dart1.java,Dart2.java,Dart3.java but not Dart12.java

exercise: what would those match to: Dart*.java and Dart?.java
Bracket Match can match a range of charaters like [a-q] or [0-5].If first character is '^' or '!', it means the meaning is reversed. Dart[^0-9].java will match non-numeric alphabet following Dart,like DartX.java but not Dart1.java.If you want to match “-” or “!” or “^”   Don't put it first,and you are clear to take off.

Short hand for common ones : [:name:]  where name could be one of the the following: alnum(alphanumeric),alpha(alphabetic),digit,punct,upper...
example [:alpha:] and [:punct:]

The Escape Plan


Yes there are times,where you don't want to live by the rules, and probably  time travelled and make a great deal with Incas before the spaniards make it to the shore.But this is not about it.
If you want the aforementioned and Lenios Travos knows the rest special character to be just character, that mean nothing to the shell.
Either precede it with a backslash or enclose it in single quotes.
Example: $rm MyApp\$1.java aremoves a file named MyApp$1.java a in the eyes of Shell $ is a variable or
    $rm 'MyApp$1.java' the special character have escaped extreme vetting from shell, for now.
Note: if filename contains extra alphanumeric,underscores,or periods, better to gear it up with the escape plans.

Dealing with Files


$ls . // displays files and directories in top bottom and left right order

$ls -l // which is long listing displays additional permissions, links,owner group size and date of modification
aelaf@localhost:~$ ls -l
total 48
drwxr-xr-x 2 aelaf aelaf 4096 Jul 26 19:17 bin
-rw-r--r-- 2 aelaf aelaf  200 Jul 27 10:41 chuck
-rw-r--r-- 2 aelaf aelaf  200 Jul 27 10:41 chuck2
drwxr-xr-x 3 aelaf aelaf 4096 Jul 27 10:25 Documents
drwxr-xr-x 2 aelaf aelaf 4096 Jul 26 19:17 Downloads
-rw-r--r-- 1 aelaf aelaf    0 Jul 27 05:50 error_log

To study the inside of a file use file command, which takes as arguments a list of files, single or not. It does look at the data blocks of the file


 Do examine the following result
aelaf@localhost:~/Pictures$ ls
Screenshot - 07272017 - 04:52:04 AM.png  screenshots  wallpapers
aelaf@localhost:~/Pictures$ file *
Screenshot - 07272017 - 04:52:04 AM.png: PNG image data, 673 x 173, 8-bit/color RGBA, non-interlaced
screenshots:                             directory


it tells a great deal about the image.




Cat : display file content if file has many lines of codes better to use more  or less .  And head command to check the top few lines of a file. The tail command displays the last few lines of a file, with a special parameter -f. -f tells the tail to display result and wait and try again. Excellent way to handle log files on the run. ^c(Contrl-C) will stop the tail command
$ tail -f error.log
displays the last few lines of a 
Do experiement on those commands on your favorite file

The grep


Relax it's not a Genetically Modified grape you must eat or die.It's Generalized RegEx Processor, a tool for searching through the contents of a file, a great tool that you really must know and its a killer

$grep mContext *.java
will search and display all lines from all *.java file(s)that has a string mContext. Remeber *.java is handled by the shell NOT grep. The    first non-option parameter which in this case is  mContext is considered a regular expression(it can have all the stars and it's crews)

$grep println MyApp.java | grep -v System.out

Search for println on every line, excluding with the ones with System.out and displays to standard output.

$ cat MyApp.java
class MyApp{
    File file = null;
    public static void main(String[] args){
        System.out.println("My App working");
        file.println("file working");
        println("just printing");
        }
    }


$ grep println MyApp.java
        System.out.println("My App working");
        file.println("file working");
        println("just printing");

matches the lines that contains println and displays

$ grep println MyApp.java | grep -v System.out
        file.println("file working");
        println("just printing");

matches the lines that contains println but excluding those System.out and displays the result

use grep --help for more actions?!?!?!?

The find Command


It has predicates – logical expressions that causes actions,and have boolean values that determines if the rest of the expression to execute or not to execute.

~$ find -name '*chuck*'
./chuck2
./chuck
./tmp/chuck2
./tmp/chuck
Looks for files with substring chuck in the current directory and descends into all subdirectories. Not excited, ok... windows can do that? well not the next one

~$ find /over/there . /tmp/here -name '*Activity*.java' -print

It looks for a java file with a name that has Activity by first searching into three underlined  directories.

-name is the predicate,it takes a regular expression as an argument. Any file that matches that regular expression pattern result true, thus the control passes onto the next predicate e.g -print
Explain the following  find predicates
Options    Explanations
-type d    True if file is directory
-mtime -5    True if file is less than 5 days since last modified; + is older than
-atime -5    True if file is less than 5 days since last accessed
-newer App.java    True if file is newer than App.java
-size +10k    True if file is greater than 10k in size


Exercise:Explain the following command
~$ find . -name '*.java' -mtime +90 -atime +30 -print

Shell Revised


Shell- the command interpreter – yes the one you handle all your commands to, can be considered a programming language in its own merit. There are an entire Books about Shell Programming.
For this tutorial we are going to use the spirit of shell scripting,working with shell variables.
By convention shell variables use uppercase, it clears possible ambugity between commands that uses lowercase.

$FILE=./chuck  <--assign variable with the file content of chuck-->
$ export FILE <--variables passed on to other environments-->
$ cat $FILE <–- display the variable content, use $-->

you can use shell variables already exported,you can alter them(their  contents) not their states obviously(no need for export keyword)

PATH(FAMED SHELL VARIABLE): It defines the directories in the filesystem where the shell will look for programs to execute,programs or commands like ls, cat, javac
$echo $PATH
//home/aelaf/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
Each directory in the PATH variable is examined by the shell for the executable you want to run. Note each directory is separated by a colon':'. If you are struck by lightning “command not found error”, it means it's not on your PATH. Usual struggle when you are setting java path for first time, and run it from command line.

You can search where commands are located by typing 'which <command_name>'
$ which ls
/bin/ls

If you have a command, and want to execute from command line, you either type the command's full path or you can set your PATH variable to include the location of the command's executable.
More practicality on that topic in next lessons under setting up environment for Java.

Just... A  Bit about Shell Script

When shell boot up, it reads initializations from files, Those files are read and executed by shell as if someone is typing. One of their actions is setting PATH. Shell Scripts are shell commands stored in a file for efficiency and other benefits

Example: create a file name myscript with content “ls -l” then, change the mode by typing chmod a+rx myscript on command line  to allow read and execute for all. Then call the script from the command line. And the script will run like it has never run before.

The tar and zip Commands


used for packing data into archive and extract it back.They provide loosless data compression, no wonder they are everywhere.

The tar action specifiers alphabets are:
c:Create Archive | x:Extract from Archive | t:Get a table contents | f: the next parameter is the file name of the archive | v:more verbose output

Try to explain the following commands
$ tar tvf packedup.tar
$ tar xvf packedup.tar
$ tar cvf packedup.tar myTar

As for zip you can easily tell the process
$ unzip -l packedup.zip <---gives table of contents of the archive file-->
$ unzip packedup.zip <---extracts all files from the zip file-->
$ unzip -r packedup.zip <---create zip archive, while recurrsivelly go down zipping subdirectories if there are any →

Example: Explain the Command
$ find . -name '*.java' -print | zip src_file_zip -@

tip: -@ let you read from standard in rather than expecting from argument list

The man Command:


Short for manual.existed ever since Dinos roamed with  Unix in 70's. A great way to easily learn about command
$ man <command_name>
$ man find

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