Wednesday, 9 May 2012

Who moved my cheese?

We have all heard of this book by Spencer Johnson, it's just been out for that long and used by so many companies to "help" people cope with (and perhaps even learn to enjoy) usually unwanted change.

It describes the lives of four characters in a maze who are looking for cheese, that represents fullness and happiness - which is what we all hope for right? Through the differences in reaction to change, we see that some people are simply constantly prepared for change, and thrive on it. Others don't expect it, get upset by it, and then get over it. And others... well, read the book and find out for yourself. It makes for a quick, simple read but doesn't delve into the depths, content to remain on the surface, some, as I did, may find that somewhat disappointing.


A few excerpts I found meaningful from The Writing On The Wall in the maze :

"If You Do Not Change, You Can Become Extinct" - Theory of evolution, eh?
"What Would You Do, If You Weren't Afraid?" - Use this with care... fear can be useful
"When You Move Beyond Your Fear, You Feel Free." - True, but also dangerous to a certain extent

It is a simple read - but not a great a read, could leave you feeling simply empty and void. Take a peak and let me know what you think if you can find it free somewhere.

Thoughts?

Monday, 30 April 2012

Flex: null vs undefined


This may seem like a non-post but it's actually more important than it seems at first glance.

This is when I learned that actionscript (Flex), like javascript, has both a null value (meaning null) and an undefined value meaning undefined. That totally makes sense both the languages deriving from ECMA-script. I cannot believe how long it took me to make the difference between for instance :

if (myObject == null) { /* do something */ }

and



if (myObject) { /* do something */ }

These are actually two very different things: in the first case we only catch things going wrong if the object is null and don't bother checking whether it is actually defined or not. In the second case, we know the object is both not null and defined - so we can get to work with it.


Thoughts?

Wednesday, 25 April 2012

Git merging

Usually one wants to merge a branch back into the master (or "trunk" equivalent branch).
To do so simply used:
git checkout master (for instance)

followed by
git merge BRANCH_NAME


Bare in mind this means you explicitly are not attempting to hide the fact you have branched and that the branch will be committed to the remote repository if you git svn dcommit.

You can then remove the merged branch using
git -d BRANCH_NAME


This gives a tree structure similar to this:
   /----------------\ <- BRANCH_NAME
------------------------------------- <- *master

where / represents the branch out and the \ represents the merge back into the master branch.

This is not very elegant unless you want to share remote branches, if you are just working with your branch locally (as you would be if you are using git over SVN), then rebase is probably the nicer option (see coming post). Thoughts?

Tuesday, 24 April 2012

Git branches

This is most certainly one of the most powerful features in git compared to tradition CVS/SVN systems.

1. you can branch locally, without affecting the remote directory - that's very cool
2. as we will see in later posts you can either merge or rebase your branch to the trunk (this defines the way your branch will get committed remotely: if you merge, you see the branch as a separate "path" in your remote repository, if you rebase, you can make sure your commit ends up looking like part of the trunk "path") - again very cool

So, here are the basics, use:
git branch
to view all current branches, the star indicates which branch you are currently working in
git branch BRANCH_NAME
to create a new branch
git checkout BRANCH_NAME
to start working in that branch
git checkout master
to revert to the master (main) branch
git merge BRANCH_NAME
to merge BRANCH_NAME into another branch (for instance master)
git rebase BRANCH_NAME
to rebase BRANCH_NAME into another branch (for instance master)
git branch -d BRANCH_NAME
to delete a given branch
git branch -D BRANCH_NAME
to force delete a branch
git checkout BRANCH_NAME

to checkout a branch and start (or continue) working on it
More information about the difference between merge and commit coming soon.
Thoughts?

Monday, 23 April 2012

Git hashes

Git identifies all its objects with a SHA-1 (40 byte) hash identifier.
This way git uniquely identifies :
- blobs (files)
- trees (groups of files and/or other trees)
- commits (a single tree)
among others.

If you type:
gitk
you will be able to see every single commit, their hashes, as well as all the files of each commit and their hashes
You can use commands such as:
git log 540991f 
to view blob content,
git ls-tree
to view tree information,
git show
for information about commits,

And so on and so forth.

Note the git is constructed around the concept that most hashes are very different and that the beginning of the hash is sufficient to identify the complete hash. That's what I did above in the git log command: used the shortened hash, which actually identifies a single blob in my system.

Use git help for more information on command options.


Thoughts?

Friday, 20 April 2012

Working locally with git

Now we have worked out how to interact with an SVN repository, let's see how we can work with git locally.

Git has three "areas" you can work in:
- the working area - this is where you program
- the staging area - this is where you store the files that have changed and you would like to include in an upcoming commit
- the repository - this is where everything that has been committed is stored (and when I say everything I mean everything - every single snapshot you have committed is stored here)

The trick with git is to get files from one place to another satisfactorily.

Here are the basic commands to do that:
git status

set a list of changed files, files prepared for commit, and unfollowed files (you can make git ignore changes to certain files like target build files, and so on and so forth).

Once you have the status, you can check differences for any of the files listed in the staging are using:
git diff FILE_PATH

You can also add unstaged files to the staging area:
git add FILE_PATH

And vice versa
git checkout -- FILE_PATH

Once you have added all the files you want to the staging area, you can commit your changes:
git commit -m "my commit message"

You have just created a local commit.

We will see in some of the next posts how the data is stored and the powerful things we can do with local commits before sending them through to the central repository.

Thoughts?

Thursday, 19 April 2012

Basic git commands

We'll be using a classic configuration of Git over SVN. In other words, we will be running and "old" SVN repository with Git clients so that we get all the flexibility of Git without having to change the server configuration and migrating all of the source code to Git.

The first obvious thing one wants to do in such a situation is to get hold of some project in the repository. There are several ways of doing this. One simple way is to get oneself into a cosy directory where we want a project to land and initialize the git repository like so:
git svn init -s PROJECT_URL LOCAL_DIR_NAME
and then go fetch it:
git svn fetch

If you want to make sure you are up to date simply type:
git svn rebase
and if you want to commit changes centrally use:
git svn dcommit
Thoughts?

Wednesday, 18 April 2012

Git overview

We've all heard of CVS, SVN... and now more flexible systems such as Git.

This a quick overview of the power of Git over SVN for instance.

There are several differences between our habitual CVS/SVN versioning systems and Git:
- SVN stores deltas between files that have changed in every commit; Git stores compressed "snapshots" of every commit
- SVN stores its data centrally; Git stores its data both centrally and locally.

These two main differences result in several advantages of Git:
- because everything is stored locally, you can work offline if the network is down
- because everything is stored locally and remotely, you can lose your central server and not lose anything
- because all snapshots are store locally, diffs are really quick, no need to have a working central server, nor to get the files across the network
Thoughts?

Tuesday, 17 April 2012

Calibre e-book management

A colleague recently suggested using Calibre for e-book management. It seemed like something of a leap to me, quite used to plundering through my PDF files stuffed (and often lost) in categorized directories.

Anyway, I skeptically got hold of the software, tried it and got hooked.

To put it in a nutshell -
Calibre is to e-books, what iTunes is to music
- a living example of KISS at its best and it's free (you can donate of course if you wish).

Enjoy -
http://calibre-ebook.com/

Thoughts?

Monday, 16 April 2012

Behind closed doors: secrets of great management

When I was young (about a year ago), I thought "The one minute manager" was a great read. I still believe it does have something to it - it makes for a quick read and is straight to the point.

But now that I am old (about a year later) and that I have read "Behind closed doors: secrets of great management" by Johanna Rothman and Esther Derby, I have just been ... well enlightened so to speak.



This book does take more than one minute to read but feels like it takes only about two, and is full of healthy material whatever your job description may say. From the bottom of the ladder right to the top, it is full of handy tips on how to coach, create team-spirit and take new team members on board. It is about creating leadership and making sure you tell the right people the right things at the right place and in the right way. Sound easy? Not so. Do you tell someone their behaviour is unacceptable even though they are a good worker? Yes. Ok, but when? In a one-on-one meeting. And HOW? Without getting emotionally involved, without pointing fingers ("you have done this...") - after all the person might not even be aware they have made mistakes in the past period, so avoid emotional cues and train people to learn to accept information without over-reacting. And what do you do when you take on a new team, that's just not really a team but a group of people working together or against each other? Behold the wonders team-meetings, prioritization, one-on-ones, coaching, rumour-killing, gelling, and much much more.

This book will definitely not fall off my bookshelf any time soon.

Thoughts?

Friday, 13 April 2012

Batch programming: defaulting user input

This is a really simple script which sets a variable to a default value if the user doesn't provide input when asked.

set /P val=Please enter value: || set val=default


If the user enters a value, the %val% variable is set to the given value. Otherwise (if the user simply pressed Enter) 'default' is used instead.

Neat :).

Thoughts?

Thursday, 12 April 2012

Back from a long hawl

It's been a while one might quite honestly say since I have kept this blog alive... rest assured though that live again it will. I am back with a family, a house, a recent new job and lots of new material to work through. So, look forward to information of all sorts: from Git to Flex through some interesting new reads and much much more!

I should be back publishing regularly shortly, so come back for a peak any time - you know you are always welcome :).

Thanks for your interest and next post shortly!

Elinor

Sunday, 7 March 2010

The one-minute read

When I saw the title of this book, I simply couldn't resist giving it a peak.

I would say it is was worth the 5-10$ it cost and made for a quick, relatively entertaining read.
The book covers three basic principles to manage anything, from your family, to your work, to your life in general:
  1. keep a list of understandable self-contained goals (one-minute objectives)
  2. remember to praise yourself and others when things go right (one-minute praises)
  3. remember to reprimand yourself and others when things go wrong (one-minute reprimands) BUT, never leave it at that: make sure to remind yourself of what actually *did* go right and that "to err is human, to forgive divine" (thanks Maggie Smith :D)
So... this is where I start rambling on about traveling the US, making it to Canada, Scotland, Ireland and many places more... go girl!! :-)

Thoughts?

Monday, 1 March 2010

Google AdWords

Well, hey presto that's done. Got an advert via the post and have decided to try out Google adWords to see how things pan out - for better for worse.

Friday, 11 December 2009

Accessing the symfony development environment

No later than this morning was I trying to use my symfony dev environment from a different PC on the network, and came across the following error:

You are not allowed to access this file. Check xxxxx_dev.php for more information.

Well, to every simple problem it seems there is a simple solution :).

Just open xxxxx_dev.php and add the relevant IP address to the array as follows:


if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '192.168.254.102', '::1')))
{
die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}


Obviously you probably wouldn't want to do this on a public server but it's neat for LAN use all the same and I am just literally more and more impressed with all the inbuilt mechanisms that symfony has to offer!

Thoughts?

Saturday, 5 December 2009

JTable in JScrollPane showing default column names

Well, back to the basics of Java...

Just in case anybody (that's including me ;-)) gets this problem (again) here is the solution.

Basic scenario: building a JTable with a non default model class extending AbstractTableModel as follows. I have omitted necessary includes and actually removed method bodies for simplification purposes.

Spot the error...


public class SyncOperationTableModel extends AbstractTableModel
{
// attributes

public SyncOperationTableModel(ArrayList syncOperations)
{
super();
// initialize attributes
}

public int getRowCount()
{
// return the row count based on attributes (for instance)
}

public int getColumnCount()
{
// return column count base on attributes (for instance)
}

public String getColumName(int column)
{
// return column name
}

public Object getValueAt(int row, int column)
{
// return the value,
// by default setValueAt is not necessary
// (AbstractTableModel returns false to isCellEditable method)
}

}



Symptom? The column names (getColumName(int column)) never get returned and are replaced with default names: A, B, C... At first sight this is strange, since I purposefully add the table to a JScrollPane (which should handle the table header automatically).

Solution? In the above code the getColumnName(int column) does not get called simply because I have created a new method named getColumName (i.e. with a missing 'n' to the 'column' part of the name). Stu-pid!

New method:


@Override
public String getColumnName(int column)
{
// code
}


Reaaaaally hopeless... no wonder this was impossible to find despite GIYF. Now getting on to cell rendering - it's been a while... other silly mistakes ahead I am sure.

More news soon.

Thoughts in the meantime?

Tuesday, 3 November 2009

Java Belt Track

This isn't new (at all) but fun nevertheless...

http://www.javablackbelt.com/

Try the belt track :)

Thoughts?

Sunday, 25 October 2009

10 reasons to use symfony

I have been thinking about the added value of using a good development framework and here are my top 10 benefits of using symfony as a development framework vs traditional program development. I won't be talking here about the license, which is open source MIT (which is great) but specifically of the programming and features aspects.

Rapid Application Development
Write better code faster. I know it sounds too good to be true but this is definitely the most obvious benefit of using a good application development framework.

Promote good code design and OOP
Using the inbuilt MVC makes the code easier to maintain and design. The symfony documentation is full of guidelines to make code easy to use during the course of the various development steps. Also, it's built on PHP5 and is fully object-oriented. This again promotes good code design and reusability.

Concentrate on the essential
When building a web application, you often find yourself doing the same things over and over again. OK, the table names change from one module to the next, as does the data structure but the logic behind managing objects is mostly the same. So, why waste precious time on the standard "common" code, when you could be spending it concentrating on the much more rewarding essentials: specific business logic, security, usability, ... since those are the things which in effect rake in the money and differenciate your product from the next?

Encourage proper code documentation
Because the framework handles most of what's happening behind the scenes, it becomes much easier to document code as you go along. And, symfony integrates phpdoc by default.

Provide different environments
Ever found yourself thinking "Gosh, I wish I could just switch to development for a second just to see the detailed error" or "I wonder how this will work in production?". Well, symfony provides inbuilt mechanisms which allow you to simply switch from one to the other, without ever disrupting the actual production environment. This also promotes testing and thus application stableness and scalibility.

Increase security
symfony provides mechanisms, tips and suggestions for output escaping, preventing SQL injection, and CSRF attacks. You really need to read the documentation from cover to cover to take full advantage of all the options provided by the framework, but it's a worthwile read!

Abstract from database
Using a database abstraction layer and ORM makes the process of accessing data completely transparent. You no longer have to worry about actually accessing the database to create, retrieve, update and delete data. All the internals are hidden. You just access the objects via the ORM layer that sits above the database abstraction layer and that's it. Did someone say KISS? :)

Manage credentials
Managing credentials is dead-easy as symfony provides a simple plugin that does all the nitty gritty behind-the-scenes work for you!

Internationalize and localize
I guess this is probably one of the most important issues, certainly for European customers. Again, symfony creators have made this one of their key features and internationalization and localization is made easy by in-built ready-to-use mechanisms.

Join a living community
symfony is big, and getting bigger. It seems everyone today will agree one of the major advantages of open source is the community that builds around the project and provides support, ideas and new features to an already growing project. Neat.

Well, those are the top 10 I could think of. Of course, there are many other things like a.o. integrated Javascript frameworks (scriptaculous...), various helpers and simplified AJAX development.

What benefits do you associate with using a development framework (or symfony more specifically)?

Wednesday, 7 January 2009

Everything you know about CSS is wrong

Well, lots of people have been talking about this book.
You can read a chapter here.
And a review by Martin Heller here.

A big thumbs up for CSS tables, way to go! :)

Thoughts?

Monday, 5 January 2009

Time to move on to SHA

Researches have 'broken' SSL! Ouch.
In the following ZDNet report there is some good news though: the hack is apparently very time-consuming.

Thoughts?
Online Marketing
Add blog to our blog directory blog search directory Blog Directory Blogarama - The Blog Directory