>> git memo (175 views)

Git, in my opinion, is undoubtedly the best version control system, mostly, but not only, for its distributed nature, and the way branching and merging are handled.

However having used subversion for many years I find git learning curve a real pain, some of the commands are slightly arcane, therefore not easy to remember.

In this post I will try to keep a git memo of commands that I occasionally need and regularly forget:

create new repo with first commit and push

assuming new repo is called hayate

  • add hayate to gitosis config file (gitosis.conf)
    more on gitosis in this excellent tutorial: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

    [group hayate]
    writable = hayate
    members = andrea@myhost

    then git add --all, git commit -a -m 'added hayate repo', git push
  • go in the hayate directory i.e. cd /var/www/hayate and type git init
  • git remote add origin git@hostname.com:hayate.git
  • add and/or update files and directories
  • git add --all
  • git commit -a -m 'First hayate commit'
  • then for the first push: git push origin master:refs/heads/master which creates the master branch


  • git tag v1.0 -m 'my first tag'
  • git push --tags commits the tag
  • git tag -l list all tags

clone into current directory

  • git clone git@hostname.com:hayate.git . <- note the dot (hayate directory will not be created)

change working branch

  • git branch -l lists local branches
  • git checkout <branch-name> switches working branch to “branch-name”

remove an added file or directory (before it is committed)

  • git reset <file-or-directory-name>

add submodule (an external repository) within local source tree

  • git submodule add <repo-url> <local-path>
    i.e. git submodule add git@hostname.com:hayate.git hayate

checkout a submodule

  • git submodule update --init

create a new remote branch tracking it locally

  • git checkout -b <branch_name>
  • git push -u origin <branch_name>
  • git checkout <branch_name> to switch to the new branch

start tracking a remote branch

  • git checkout --track -b <local name> origin/<remote name>

delete a remote branch

  • git push origin --delete <branch_name>

delete local branch

  • git branch -D <branch_name>

revert a merge

  • git revert -m 1 merge_hash

to suppress the following warning

warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated. This may
warning: not necessarily be what you want to happen.
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring ‘push.default’ to:
warning: ‘nothing’ : Do not push anything
warning: ‘matching’ : Push all matching branches (default)
warning: ‘tracking’ : Push the current branch to whatever it is tracking
warning: ‘current’ : Push the current branch

  • git config [--global] push.default current (–global is optional)


>> Pretty Comments (5,306 views)

Some time ago I came across, a nice jQuery plug-in (jWYSIWYG) that turns regular html textareas into very simple WYSIWYG text editors.

At the time I thought that the plug-in would work really well replacing the normal WordPress comment boxes, and finally I found (made) a little free time to encapsulate jWYSIWYG jQuery plug-in into a simple WordPress plug-in, and you can see it in action on this site.

The plug-in is called Pretty Comments and is free for anyone to use.

  • Please don’t use the comments for testing.
  • All “Test” comments will be deleted.
  • If you are asking for help please leave a link to your blog or most probably I won’t be able to help you.


>> BocaBo (79 views)


BocaBo.jp is a new dictionary to aid Japanese speakers learning Spanish, Portuguese, English and vice versa.

To kick start BocaBo’s database driven dictionaries I used EDICT and ENAMDICT dictionary files by Jim Breen. The Spanish and Portuguese versions are created by translating the English version from EDICT with the help of www.apertium.org.

BocaBo is a join project from www.yanasa.co.jp and www.byteset.com.

The original Japanese and English word list is based on the EDICT and ENAMDICT dictionaries (©1994-2001 James William Breen). Original Japanese/English files can be obtained directly from the EDICT web site.


This is a php5 library (two classes) I wrote to convert TrueType Font text into an image, using the GD library.
The project is hosted and can be downloaded from github: http://github.com/hayate/tic (it includes an example, documentation and some free fonts)
or using git: git clone git://github.com/hayate/tic.git
Documentation is also available online here: http://www.andreabelvedere.com/docs/tic/

To extend the library to add support for other Font types just extend the TIC abstract class and implement the create and dimension methods.

See example below on how to use it:

 * @file image.php
require_once 'lib/tic.php';
    ->setText('Hello World !')
    ->setBgColor(0x00, 0xff, 0xff)
    ->setFontColor(0x00, 0x00, 0x00)

Than in your html:

<img src="image.php" alt="TIC" />

That will output the following image:


The library is under the LGPL license, which means you can freely use it for commercial and non commercial applications, please post a comment for feedbacks, bugs, or links of projects where you have use it.

This is a quick self-reminder on propset svn:ignore command.

To ignore all content in directory foo but not the directory:
svn propset svn:ignore '*' foo
To ignore the directory and its content:
svn propset svn:ignore 'foo' .

>> Web Font Tester (122 views)

The quick brown fox jumps over the lazy dog !

Font Name  (i.e. Arial, Courier etc.)
Font Size

今年の5月にロンドンから東京に移住しました。 創造的、積極的で明るい雰囲気の東京の会社でのウェブ系プログラマーとしての仕事を探しています.
ウェブ系プログラマーとしては5年以上の実務経験 (Java, JSP, PHP, MVC, Zend Framework,Kohana)があり、ソフトウェア開発プログラマーとしても2年以上の実務経験があります(C/C++ .Net)。

もし御社で、才能とやる気のあるプログラマーを募集していらっしゃいましたらこのリンクからご連絡いただくか、履歴書 (167.63 kB)のダウンロードをよろしくお願いいたします。


I am in Tokyo and looking for a position as Web Application Developer in an innovative, bright and forward-thinking company based in Tokyo.

I have over 5 years of experience in Web Application Development (Java, JSP, PHP, MVC, Zend Framework,Kohana), and more than 2 years of experience in Software Development (C/C++ .Net).

If you are a small to medium size company based in Tokyo in need of a talented, hard working developer please contact me or download my resume (167.63 kB) for more information.


>> Italy (199 views)

Table of contents for Italy vs England vs Japan

  1. Italy vs England vs Japan
  2. Italy

Italy is an amazing country, and despite not being a huge country, geographically speaking it has every thing, amazing beaches, breath taking mountains, beautiful hills (i.e. Tuscany).

Many cities and small towns are so packed with history and art that if taken as a whole and placed in a museum people would pay to see them.

Of course I cannot talk about Italy and not mention how good and relatively inexpensive food is. And the reason why food is so good is that Italians are obsess about it, while we are having breakfast we are thinking what should we eat for lunch, and during lunch we often discuss with friends what we ate the night before and probably what we are going to eat for dinner.

While in England people have their local pub, Italians have their favorite Bar (Cafe), this is the Bar that makes the best cappuccino.
In London I have taken so many “Cafe Nero” and “Starbucks” that for me in Italy whichever Bar makes a great cappuccino.

So why I don’t want to go back and live in Italy ?
Well for me the following are the biggest problems: More »

Table of contents for Italy vs England vs Japan

  1. Italy vs England vs Japan
  2. Italy

Few days ago my wife and I made the important decision of moving out of London.
In May this year a new era of our life will start in Tokyo.

I think I know why I want to go to Japan as apposed to stay in London or going back home to Italy but I want to put my reasons in writing as the process of writing will help formalize my thinking and if in the future, I happen to forget how I end up in Tokyo I can refer back to this pages.

I intend to write 3 posts loosely comparing the 3 countries I know best, focusing in each post on one country. I will start tomorrow with Italy the country where I lived for the first 22 years and 10 months of my life and the country that I travel to the most as my family and friends are there.

>> Zend_Layout example (12,361 views)

Table of contents for Zend Framework

  1. Zend Framework and Smarty integration
  2. A better Zend Framework & Smarty integration
  3. Zend_Layout example

This example focuses on 3 aspects of the Zend Framework (v1.6):
the Zend_Layout mechanism, modules and helpers, including the ActionStack helper and a custom helper. (Please note that there is no Smarty involved in this example).

The main objective of this post is to demonstrate how components of ZF work together to produce a simple application, for this reason I will focus on the code that holds things together rather than going through line by line.

If you have any questions or things are not clear please leave a comment.

As in the previous posts in the series you can download the full working example here: zend_layout_example.zip (3.36 MB). (Note: the compressed file includes the ZF library hence about 3MB)
Please glance at the previous post on this series for hints on how to set up this example on your working server.

Lets start where all begins: bootstrap.php More »