See changes in Git after staging change

On git and want to see the changes on files after you stage it?

git diff --cached file-to-check

Also if you want to see the difference of hte file with repo

git diff HEAD file-to-check

, , , , , ,

Leave a comment

how to get into programming part 2

Part 1 was on generic stuff that I have little idea on. But on programming and being a programmer, I can say a bit as I am living as a programmer.

Getting into programming
Lets start from simple questions first:
What do I need to be a programmer
A college diploma or degree would be good to be a programmer – but IT IS NOT MANDATORY. I have worked with great great programmers who have just a high school diploma, who have totally unrelated degree and who were working stuffs that in no way related to computers for that matter.
****But, if you have the chance to go to school and learn about programming/computers – it would make life easier and it would definitely create a difference. By yourself, you need a lot of experience to understand the basic things, with class it is so easy. By yourself you be a bad programmer for a while before you know it is bad, with class you will be guided with the best practices and become a good computer citizen right away – so if there is a chance of going to school never turn it down..

So what do you need?
A computer, a good book/website about programming and passion to program.

Where shall I begin?
In programming itself, there other branches as well: you can work on desktop applications, mobile applications and web applications.
I would advise to concentrate on web and mobile applications these days.

I will greatly discuss the web part.
The first thing on my list of advice is do something and see something..
The webpage you are interacting today for different kinds of tasks, be it facebook, google, yahoo, you online banking and the like – they are all web applications. Your goal would be to be one of those peoples who created such a good applications that make our life easier from day today.
Speaking of web applications, there are different kinds of tools that would allow us to create the websites: here are the major ones
1. The basic HTML part we discussed on the designer section of part 1
2. Good understanding of server-client architecture. All we need to know is a major part of this only
3. Fair Database knowledge – don’t worry, you will learn it as requirement when you get started to work on your web stuff
4. At least one web programming language. The HTML we discussed is only for look and data bridge part – there is another main part behind every website.
For example, when you log into facebook, facebook would know you right? it will pull if there are any new messages you have, who liked you? who has friend requested you and the like. All this has to be done somewhere. Based on your username, facebook gurus should provide you with messages that are sent to you only without sharing to the others… and even more tasks. I was talking about this task.
The above task is generally known as back-end development. It could be done using different programming languages – notable ones are PHP, Ruby, ASP.Net, Java and more and more.
So, you need to know at least one of these languages to work as a back-end developer. It looks a lot right? Again it is NOT

umm.. which one shall I study/read first
Here is the fun part. We are going to do it step by step. There are a lot of things we have to know,but we dont have to know all of them before we need them right?
Here is what we do in the order of importance..

1. Lets create simple website..
Oops.. I don’t know anything.. how could create that?
That is what we are going to do. At this level we will see how simple it is to create a very simple one
Open any text editor like notepad, How to open notepad and insert

<html>
<head>
<title>my first webpage</title>
</head>
<body>
Here is my first webpage
</body>
</html>

Then save it as my_first_web.html
After this doubleclick on it and you will see your very first webpage.
Then go back to HTML Introduction and invest a good amount of time by changing font, color, bar and the like until you can do it without further reference..the site has online editor also so you can test it online.

Afte that I would say invest a little bit of time on any programming language before you dive into the web programming.
C++ is a good candidate for it..
Intro to programming Actually, check this guy’s videos they are a good start points..

The following links are also helpful ones

http://cplus.about.com/od/introductiontoprogramming/a/career.htm

http://lifehacker.com/5401954/programmer-101-teach-yourself-how-to-code

I will try to write on Web programming next time – especially on PHP
Please post your questions/comments and I will try to answer accordingly.

, , ,

Leave a comment

How to get into programming part 1

I have been asked a lot of times, especially from fellow Ethiopians, on how to get into programming as a career or stream of life style..
But this note is not only for those who are asking that, it is for:
- those peoples with a lot of potential into programming and not just do it only because they don’t have enough information where to begin
- Friends, and relatives whom I see are in some other work stream but I think they are a good candidates for programming and make a decent living out of it..

First thing first, lets start from addressing common questions:
How could I get into computer profession?
It is a broad question and I will try to dissect into the following parts

1. Computer Technician
Are you interested in getting dirty hands with fixing computers, mobile devices, network configurations, fixing broken hardwares and the like? if so you can be on this area and be professional
What you need – usually you are required to have certificate in electronics and/or maintenance stuff along with a bit of experience.
MarketIn demand
2. Network Administarator
Large enterprises with so many, not limited to, computers and users that needs management require Network administrators.
Largely, this is a task where you would configure servers that run different kind of services like web or file, management of user access and resource access, management of computer’s resources that task out the above and related services, making sure server softwares are upto-date are among the tasks you will be working on
What you need You need certification for this one. The common one is cisco certification. There are tones and tones of books and training material that would help you get up and ready for the exam.. you can take a look at http://www.cisco.com/web/learning/certifications/index.html
MarketIn demand
3. Database Administrator (DBA)
Every interaction with have Facebook, the emails records we have on gmail, or any other interaction that needs to remember our data needs a database. A database is a huge part of computer related profession. The data that is stored could be in millions, each data would interact with another data, it will be backedup incase something wrong happens, it needs to be consistent and available, it should be upto-date, it shall handle insertion editing and deletion of data nicely .. you got the idea – for this there are well trained peoples who would make sure the data that we care for is properly handled. You can be one of those peoples
What you needThere are several brands of database management systems. The notables are oracle, MSSQL Server, MySQL and Postgres. You need a certification in at least one of these big database providers. Once you got the idea of one jumping to the other should be easy. And the good thing is when you are preparing for the certification you would know most of the basic stuff you would need for future profession
MarketIn demand

4. Designer (Front end developer) These days all you would see is a websites and mobile application. And apart from doing what they do, they have to be attractive and simple, easy to use, faster, forgiving on error and much more. This is usually the task of the designer.
Designer are usually artful peoples. If you are that kind of person, then design might be yours. Probably, you have come across the site or app that you tot you could have done the layout better or something..
What you needMost of the designers that I know are self-taught ones. Pretty much all you need an introductory lesson into HTML, CSS and Javascript. You need to have a good image processing software like adobe photoshop or something that can process images nicely. For that matter, there are well talented peoples that can make a good image from simple image processing softwares like MS-Paint.
Another thing would be to look as many website and apps as possible. This will give you a best approach to have your own signature that singles you out. Like a writer reads more before s/he writes kinda thing :)
The other good thing is, you can start to design just today. You have already what it needs to be the designer. A simple notepad and a web browser. There is a good step by step guide on HTML Introduction. Once you are done with it, you will be a good designer or front end developer

5. Developer/Programmer

, , ,

Leave a comment

react/zmq installation error on PHP 5.4 with composer

Last week I upgraded my PHP to 5.4 on my mac. It was not that bad, but I am starting to pay little by little.
I am using Ratchet for a websocket and for pushing I was using 0MQ.
My composer.json looks

....
    "require": 
        "cboden/Ratchet": "0.3.*",
		"react/zmq": "dev-master"
    }
...

Then I do composer install, it was complaining zmq is not found in the system.
I had zmq already but it is on the php5.3 default directory. And I can’t use the zmq.so file I compiled b/c i am using 5.4 now.
Here is the fix:
Go and grab the git clone from github

git clone git://github.com/mkoppanen/php-zmq.git

for further ways checkout this
Then

cd php-zmq

Then do the following

phpize

Make sure you run the correct phpize in this case. If you are upgrading from 5.3 and still you have the old version sitting around on your machine, phphize will take the older one by default.
My new php 5.4′s one is in /opt/local/bin/phpize54. So make sure you are running the phpize with the new one.
One easy thing to do would be to symlink the old phpize with the new one like:

sudo ln -s new/phpize/path old/phpize/location/phpize

Backing to the topic,
Then do the configure, being inside the php-zmq folder, as follows

./configure --with-php-config=/opt/local/bin/php-config54

make sure to replace the value of –with-php-config with your proper php-config path

if you don’t have the packageconfig, you will have an error requesting for that and you can install it from macport – if you are using mac as follows:

sudo port install pkgconfig

Just search for pkgconfig for others distros you have and it should not be that difficult ..
once you do that install it by

make && make install

Hollla..
the compiled file should be inside the modules directory.
After this, copy that file into the php executables folder and add extention=zmq.so into your php.ini

Now you can do the composer install and it should install it..

, , , , , , , , ,

Leave a comment

Apache not executing PHP code – just renders the as it is

This is the issue when you are having a fresh install of apache usually.
You need to tell apache should handle the extensions so that it could process them accordingly.
On you apache path, go to the config and open the httpd.conf file
and add the following

AddType application/x-httpd-php .php

, , , , , , ,

Leave a comment

How to reload terminal after updating profile file

Say you added an alias to your most common command to your ~/.bash_profile or .profile file and, to use the alias, you have to reload the terminal or you can do it in one line as

source ~/.bash_profile

That will refresh your terminal for ya

, , , , , , ,

Leave a comment

installing macports

If you are a programmer/developer one thing you would face on date to date basis is handling packages.
Macports is a package manager for mac using that simplifying the installation of free/open softwares on you mac.
All how to install procedure is found on http://www.macports.org/install.php
After installing the macports don’t forget to update it

sudo port -v selfupdate

, ,

Leave a comment

Follow

Get every new post delivered to your Inbox.