New Android Studio


I think Google just made all the android tutorials related with eclipse that are available on the internet obsolete just like that with the launch of the android studio.

What is android studio ?

If you are familiar with android development with Eclipse IDE and ADT  (Android Development Tools) , new android studio is a replacement for the both IDE and ADT. The stable version of the studio was released in 8th December 2014 named version 1.0.1.

In the earliest versions we had download eclipse for Java and then install android development related components via android web site.

Then Google made it easier. After that there was a eclipse version bundled with android development tools (ADT). Of course after setting up needed SDKs and related components had to be downloaded. This was much easier than eralier version because there was a AVD manager and SDK manager already installed. We just had to download a SDK we like and create an AVD and start coding. For now I did my lot of coding with this version.

Now with android studio it is much much easier. No need to download SDK or create an AVD at all.Because the latest SDK that is Lollipop (API 21 ) is already with the android studio and a sample Nexsus AVD is already created. Now you just have to download and start coding. 


But not so fast. There comes the HAXM problem. See this post to check it out.

Whats new about it ?


This may be a personal experience. But when I opened Android Studio for the first time I was amazed and a bit frightened at the same time.

1. UI is much more nicer now. Thats good. But at the same time its not exactly like same old eclipse. You have to do some round of navigation to get it right.

2. AVD seems much light weight and performance wise that is ok too. (So far :p)

3. Good VCS support is there. Its says on the developer site. Haven't tested that yet.

4. New AVD manager is cool. It allows to create devices like TV,Tablets,mobile and even wearable device.

So those are the things so far. Havent done much of coding with studio as it has been like 2 weeks its released and  this is Christmas vacation. :p If you too know anything, lets share it via comments.

Happy coding. :D


Share:

What is MVC ???

So lets just dive right in. No **** talks. Just the things needed. :P

First and foremost I have to tell you this. Most of the things I explain here (at least Im trying to :p)
I learnt by my self. No other parties. Just me and the sweet old internet spending long hours with my poor baby laptop.

Unlike other stuff, When you try to understand something like MVC without any help from others, I`ve gotta tell you thats something tedious and that will probably make you wanna quit your life, literally. So one time I stopped learning this MVC thing. But you never give up anything in life and become quitter, DO ya ???. Now after like 2 years I have build CodeIgniter, OOP MVC framework apps and ASP.NET MVC 5 apps.

Bottom line is dont quit, you will get it eventually. :D


What is MVC?? 

"MVC is Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user." 
Thats Wikipedia right there :p
Ok.Lets make it simple as possible.

Imagine you are developing a large scale application.A web application. You cant do it alone because its gigantic. Lot of developers have to work together. And lot of languages have to be integrated. Interfaces have to be written in HTML,CSS,JavaScript. For databses you will have to use SQL. For application you may have to use, C# or Java or PHP or anyother programming language that is available.

So if you don't use these things carefully separated you will have to use all these languages and developers working in one place. You will make a quite tangled ugly mess out of it. :D
Imagine a source code where HTML,CSS,JS,PHP,SQL is there. Thats just 5 languages right there. Thats a developers nightmare.If you want to have a clean neat development process you need to separate these various elements.

Thats what MVC has done. Thats it. No big deal. 

Ok lets dive hard again.

M is for Model. All the Database related things will be done here. (SQL and programming language.(eg: JAVA))
V is for Views. All the user interface related things will be done here. (HTML,CSS,JS)
C is for Controller. All the application logic is written here. (Java or PHP or C# or Python or whatever prgramming language)

When we seperate things like this we have the following advantages.

1. Database logic and UI logic and application logic is not mixe up. Simply programming languages dont mix.

2. Database people can work on Models, UI guys can work on Views and Other developing guys can work on Controllers at the same time.
 Because it is separated.


But although  M and V and C is separated from each other, in order to application to run these things have to be linked together somehow.

This is how it is done.
For example lets say we want log on to facebook and this is what happens according to MVC.(This is just the simple version)

1.You enter www.facebook.com on your browser. (according to MVC you are requesting a view.  In other words a web page)
2.Your request will go to the facebook controller.
3.Controller will send you the requested login web page.
4.Now you have the Login page (a View). You can interact with the views.
5.So you enter you email and password in the view (web page) and sends it to application. (In this case your application is facebook)
6.This respond is sent to a Controller again.
7.And controller now knows this web page needs to have some sort of database things done.
8.So the controller connects to a Model.
9. Now the Models does all the database operation. (looks for a user in the DB with given email and password)
10.If there is a user with that login, Model sends these data to the controller.

11. Now controller sends the related web page to user with those details that was recived from the model.
12. VOLA.! now you have your facebook profile page.


Take notes on these.
# Users dont intearct with Controllers and Models. They can only interact with the views.
# Contoller can be the broker between Model and Views.
# Model is not a necesity for an application to work. You can make it work with a Controller and Views. But there is no point in having an application 
without a Database.Is there ???

Thats MVC ladies and gentleman. :D
Share:

Tale of nets - 03 ( TCP )



Now, because we know what is called as a protocol. Let’s see some of the protocols that are being used in the networking. Sometimes these may sound more technical but bear with it coz sometime you have to make the dots hoping that someday they will be connected just like Steve Jobs said.


            Before going to that we have make some new terms. They are client and the server. It’s also not that hard concept to understand. Imagine you have a great pizza place near your house and you want to orders or request some pizzas to watch the game. What you do is you call the pizza place tell them what you want. If you are lucky and they haven’t ran out of pizzas you will get or receive your pizzas through a delivery guy. If they haven’t the particular pizza that you ordered you will get a no for an answer and that is something page requested not found error in the web. Obviously what you ordered is not there. So here you are the client and pizza place is the server. What client does is request something and what server does is replying for that requests and if the requested thing are there just send them and if not send an error message.


TCP (Transmission Control Protocol)

      
        This is a connection oriented protocol. That means whenever the client want to talk with the server it has to make a connection with the server. Say client is asking 3 web pages from the web server, it has to make 3 connections to do that.
This uses something called 3way handshaking. It’s simply like this.


  • First the client asks for a connection request from the server. It’s like asking server “Hey there sever, can we talk for a while?” and server receives the message. (Client sends Synchronized packet to server and server receives it) SYN

  • If the server is in a mood to connect with other clients he will send a message to the requested client.(Server sends Synchronized – Acknowledgement to the client and he gets the message) SYN-ACK

  • Client sends Acknowledgement and server receives the Acknowledgement. ACK



And voila. :D
A TCP connection is established between client and server.





           Normally when data or connection request or connection reply or whatever that is transmitted between clients and servers they are being sent as packets. When a TCP protocol is used what it uses is TCP packets. In a TCP packet lots of details are there like address numbers of the  source ports, destination ports, sequence numbers of the packets and so much details.


We don’t always use TCP protocol for everything. Generally its good for sending sequenced messages or packets, to send the data with delivery guarantee (because acknowledgement is there) ant to filter traffic.


Time gets into serious things now :) ......



Share:

Tale of nets - 02 ( Agreements )

OK then. One common term we most of the time use in networking is “protocol”. The word itself seems a bit technical and some what dangerous,isn’t it. But actually its not. Its very simple concept when you understand it right.

Image1 - HTTP protocol used for communication between web server and a client


Everyone has eaten some toffees right. Lest take toffees for example. Say you made some toffees for an event and you want to send them to your friend Joey. (This is the same Joey from friends : p). There is a way you send them to him and there is a way joey eats them and its something simple we follow in our day today life..


First you made the toffees. And you wrap each and everyone one of them and put them in a box. And you label Joeys address on the box and send him it. Now of course when joey recived your toffee box he just can't eat it right. The simple things he has to do is first open the box and then unwrap the toffees and eat them


Why does he has to follow these instructions ??? Because you have made them that way.
So a protocol is an agreement or set of instructions that both parties in the communication have to follow. Take our toffee example again. What happens if either one of us does not follow the required convention. It s gonna be messy. Either I can't send the toffees to joey or he cant eat them properly. So the bottom line is if you want to eat toffees properly you have to follow a certain protocol. :P


And This thing also should be said.
In Order to a communication to happen you need 3 thing.
  • A message sender
  • A message reciver
  • A communication medium.


(and of course a message :D)
image 2

Forget about computer networksLet's say we are talking, like in a conversation. For real. There is me, message sender.There is you, message receiver. And there is our communication medium, the air. And that’s communication.


And also for the communication to be successful. There should be some things like protocols, timing, synchronisation stuff like that. Without these things the messages will be transferred and communication will be happened. But it will  be gibberish to the recevier

More on about these later.........





(Resources
  http://www.highteck.net/images/34-HTTP-protocol.jpg,  https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNunXl5cRpF_Y-ufvK8JhivyLHYLoXIsr-mlYG4tIGYgFhINYXzqSBzlmiL2N8dusbv0yk-eFUZ1WOmxfqSV53aQlHilJLLPo9OGQweYtCoH9ZB4Kv-Sb5zATz_XQqn05b14_mZ9yvgyek/s1600/comm+pic.png    )


Share:

Tale of nets - 01 (Where it all began )

Where it all began…


However the first computer was built and they were happy about it. Here they means the computer techie guys coz at that time normal people couldn't afford to use computers like now. Of course there were not computers like we have now. They were the large computer, large like fitting in a room and the were not called computers at least. They were called mainframes or supercomputers. Although their sizes were like jumbos they were very slow and couldn't do super-duper tasks like controlling a rocket or something like that. How ever they can't be blamed. At least they have made a very large equipment that does something, right. :)

One large mainframe in those days














In order to work with these Mainframes they needed nodes or some may call them as terminals. So they were very not mobile. The equipment’s could not have been transported another place. So here comes the word. They were centralized not distributed.
Mean while , the DOD(Dept of defence) in America were building and experimenting on their first distributed system ARPANET. I cant really recall what the letters that stand for but you are free to google it :p .It was a military project and later it was opened for the privileged research groups at Big universities in the states.
So how ever lots of System Network Architectures were proposed for this system. Some big companies like IBM proposed some architectures named like SNA,DNA,DCA,BNA. Seriously ,these names are not that important but if you are craving for more , just google them. Most of these architectures included following functionalities.
  • ·        File transfer from node to node
  • ·        Remote printing
  • ·        Terminal transfer(remote logging)
  • ·        Remote file access

Lots of architecture and there were no one accepted standard. That later became a huge problem. So networking and system companies had their own infrastructure and standards. This was kinda ok because most of the time for an organizations networking and systems requirements they bought everything from a one company. But the problem came when they needed to do an upgrade or switch between the companies or infrastructure. It was like pain in everywhere for the tech guys. So there became a need for a everyone accepted standard.

So then we had the OSI standards or commonly known as OSI rreference model. This was 7 layered model for systems for ttransmitting data over a network. However this was not a perfect model. This had some issues. Issues like existing companies not migrating to this standard. How ever with the invention of UNIX this time of the decade these problems slowly came to an end and OSI model slowly transformed into the TCP/IP model that we use today.
I should say this. OSI is not TCP/IP. But in a way they are not that different also. Its like the same little girl but much older and much prettier now. We will discuss the similarities and differences of them later.How eer what happened there was ARPANET started with only 4 nodes and then it became a network with 50 nodes and so and It became the word wide web or the internet that we use today. So just because ARPANET adapted to TCP/IP and it became very popular TCP/IP is the standard now and that it. 

More on later ...


Share: