RSS
 

.Project File in Eclipse

29 Jul

This is perhaps more a reference for me than for anyone else reading my blog

But I think it might come in quite useful someday.

Here’s a description of the project file of an eclipse project:

http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/project_description_file.html

and here is my code on the php project:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>ProjectName</name>
	<comment></comment>
	<projects>
	</projects>
  <buildSpec>
    <buildCommand>
      <name>org.eclipse.wst.validation.validationbuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
    <buildCommand>
      <name>org.eclipse.dltk.core.scriptbuilder</name>
      <arguments>
      </arguments>
    </buildCommand>
  </buildSpec>
  <natures>
    <nature>org.eclipse.php.core.PHPNature</nature>
  </natures>
</projectDescription>
 

the bucket list

28 Jul

Here’s a nice project, perhaps I could make my own list of things that I want to do before I die…

 
 

upgrade to the new version of PhpMyAdmin 3.3.4

12 Jul

Since 28th of June, the new version of phpMyAdmin 3.3.4 came out and here is how you can upgrade your previously installed version to the newer one.
My setup is on Windows with Wamp so if you have another local host running, you’ll have to adapt to your way of working, but I’ll bet that the difference isn’t that big.

My start screen looked something like this, on which we can see the older version and obviously it’s time to upgrade.

Go to the download page and download the latest version you prefer. As my whole environment is set in English I just select the phpMyAdmin-3.3.4-english.7z version.

Second step is to extract the downloaded files to your local location and set the rights as you prefer. This can be done in different ways but I prefer the manual way, this is done by copying the config.sample.inc.php, renaming it to config.inc.php and change the preferences in the file as you prefer.

In my case the only two lines that had to be changed where:

$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'blabla';

If you need more information, it can be found in the documentation included in the package (documentation.txt).

If we go to the location on our local host now (in my case http://localhost/phpMyAdmin/) we get an error saying that we don’t have permissions to view this page.

In order to get this working we need to set the phpmyadmin.conf file and adapt it, the alias and directory need to be adapted to the freshly installed version.

Alias /phpmyadmin "C:\wamp\apps\phpMyAdmin-3.3.4-english"

# to give access to phpmyadmin from outside
# replace the lines
#
#        Order Deny,Allow
#	Deny from all
#	Allow from 127.0.0.1
#
# by
#
#        Order Allow,Deny
#   Allow from all
#

<Directory "C:\wamp\apps\phpMyAdmin-3.3.4-english/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
	Deny from all
	Allow from 127.0.0.1
</Directory>

After restarting your local wamp, you’ll get the correct and new version of phpMyAdmin in your browser.

Have fun.

 

Google Internet Summit 2009: The Future

09 Jul

Here is a really really long video on the future of the internet by Chip Elliot, Nick McKeown, and Paul Saffo.
One of the most interesting things is on 1:05:00 where he starts talking about robots becoming smarter than people.
His example is about cars driving a race, without any human interaction, on a track just using sensors. Just a half hour before the race, where 9 out of ten cars get to the finish, an accident happens with real humans down the road and this confirms his theory on robots becoming better then people.

I believe that this is happening indeed, the only question is: When will robots take all possible issues and influences into account that only can be done by human common sense?
That and the enormous amount of data that has to be processed will be the biggest issues to solve in the future.
The amount of data of what is happening with us and around us increases on a daily basis and basic sensors won’t be sufficient…

I’m really curious where this is all heading. Following Moore’s law, doubling everything in the next 2 years, I will outlive all these inventions :-)

That is off course, if I stop drinking those loads of coffee…

 
 

Designing the Obama Campaign by Scott Thomas

03 Jun

Very inspirational speech by Scott Thomas, lead designer on the Obama Campaign.

Every designer and project manager should take a look at this video, superb.

The ‘on it’ joke is one to remember, even the best make mistakes, roflmao!

 

Mysql-bin files ate up all disc space

02 Jun

Since a few weeks I got the problem that my C drive was getting completely filled and I didn’t found where it came from. Well seems like the MySQL-bin log files where eating up all of the space on the C as my Wamp folder is located there.

I have a Wamp running with Apache 2.2.14, PHP 5.2.11 and MySQL 5.1.41 and log files are stored locally in the bin folder.

Over the past few months those bin logs grew to huge files and where taking over 7 GB in space.

It could be good to know what those MySQL-bin log files are:

The binary log contains “events” that describe database changes such as table creation operations or changes to table data. It also contains events for statements that potentially could have made changes (for example, a DELETE which matched no rows). The binary log also contains information about how long each statement took that updated data.

So if I understand this correctly, these files are completely useless in my personal case. Time to remove them, but can you do that without destroying my whole setup?
Well the answer is quite easy: Yes!

How then: well go to your MySQL prompt and run this commando to get an overview of all current bin files.

MySQL > show binary logs;

An overview of binary logs is given.

show binary logs

Then simply remove all files that are changed before a certain date:

MySQL > PURGE MASTER LOGS BEFORE '2010-06-01 00:00:00';

And all magic is been done, logs are removed and you can start all over again filling up all space on your C drive.

To turn off log-bin, edit /etc/mysql/my.cnf and comment out log-bin:
#log-bin = <your-value>

Have fun.

 

Manage your directory structure for development

01 Jun

It isn’t easy to get your client data organized correctly and above all convenient. When you start out on a project you don’t need a complex structure, but as your project grows, you’ll see that your initial small structure grows very fast. Five years ago it might have been sufficient to just work with the mails clients send to you but today, that isn’t enough for several reasons:

  • colleagues need access to data that is included in the mail
  • you need backup files of your development files
  • planning has to be made and followed
  • you and others need to find information quickly in the future

These and many other reasons can have an influence on your method of working, but I’ll try to explain a few possibilities on how to organize your data properly and correctly. At least, this is how my way of doing things, from experiences I got along the past 5 years.

Most correspondence is done via mail to a specific contact person and he is in my opinion, one of the most important people in the whole cycle. He needs to develop a habit of managing the files directly as soon as he got them and if they might be important for analyze or development of the project. These actions should be done if we are dealing with: source files for development (images, xml …), documents (Word, Excel…) or feedback.

As files should be available for everyone who will work on the project, a shared folder is a good option. Different solutions are possible: Microsoft Groove, SharePoint, a folder on a server with a versioning system placed on it and many other ways. Personally I prefer a shared folder on a local server (if all users have access on this server) with Git or SVN to do the versioning. In this way data will never be lost and everyone has access to the repository.

For more information on Git, I recommend everyone to look at the video, it’s the one I saw Scott Chacon do on the Symfony Live conference in Paris and I must say that it was one of the most clarifying talks I have ever seen on the complex topic of versioning.

The folder you place your files in has to be logically split up in the way you prefer it. I had 2 different ways of organizing my data as I was, art of the time, developing small projects for different customers and developing for one big software.
In the case of the customers I chose to separate everything per client

client seperated structure

As you see everything is split up into customers and sub folders are created as needed, I generally start out with 3 folder: analyse, delivered and work area, each with there own topic related sub folders.

Note that I always use the camel-Case way of writing, this increases readability without using underscores or other special characters. A lot of sources recommend the use of dates in the naming convention, but personally I believe this is not a good way of working. In a versioning system (like Git) the update datetime of files often changes and it would be an extra workload to change the date in the name each time. From my experience, these kinds of updates are often forgotten and date of files and folders is most of the time viewable in explorer windows or Linux (ls –l commando).

In case of the one big software we were developing, we agreed to create 1 folder containing different sub folders for each small sub-project organized by: analyse, customer and documents.

software system

As you can see the structure you use is strongly dependent on the project you are working on, and is a part of development that has to be custom made, but if you start out with one of these basics, I guess you are taking the correct path.

A few things you might ask yourself before creating this kind of structure and will influence your choice are:

  • What entities and kinds of entities need to be stored?
  • Who needs access to the data?
  • Why do they need access it?
  • Are there any existing standards your organization is following?
    The bigger your company is, the harder it might be to change the current way of working.

Hope this works for you… it does for me…

 

Windows Mobile Application junkyard

28 May

Since a year I’ve been an owner of a Samsung Omnia with Windows Mobile OS 6.1 on it and I must say I’m a bit disappointed in Microsoft when it comes to application management. If you compare this software with Apple iPhone, BlackBerry or Android, they all have a better application management.

You can actually find some applications for those systems, as for Windows Mobile you should search for them on Google, or use ugly, inconvenient websites like: 1800 pocket pc, WMPoweruser or WM6 software.
WTF is that all about, they only share crappy designed applications and after installing some of them, you want to get rid of them within 5 minutes. Off course there is nothing they should be ashamed off, don’t shoot the messenger, but what the hell does Microsoft about the situation? nothing… I don’t think they are going to survive on a quickly evolving mobile market, but if I’m wrong, please correct me, or prove me wrong.

On the windows mobile website there are a few applications that are actually usable, but the marketplace they created is under expectations if you ask me. I think the community isn’t that interested in building applications if it’s too difficult, resolutions of different screens and phone  specifications are often the problem and nothing is user friendly…

Haven’t they got the clue why iPhone uses those big finger friendly buttons, or why blackberry has that nice joystick in the middle of the phone? Common people, the phones are ok, why are the applications so crappy? I presume that the strategy for future phones slightly changed, but I don’t think that I will buy a Microsoft OS phone in the future…

And what the f*ck is that MyPhone thing all about? Who the hell wants to have all his pictures on his phone uploaded to his MyPhone space as a backup. This takes hours before 200-300 pictures are uploaded if you are even lucky not to get disconnected or get an error on your phone. For those kind of actions cables and usb connections where invented…..

I thought of building an application for the upcoming World Championship in South-Africa, but I stopped digging in to it, as it was too complicated building an app that would suit all windows operated phones. I guess that there are a lot of designers and developers out there with the same hesitation and then I’m not even talking about the Visual Studio environment you should develop in… How the hell can you create a development community if there is a super expensive .Net framework in a developers way (700 $ – 11000$).

In times where user friendliness and simplicity stand central, this method will fail… shame on you Microsoft… take action, this won’t last for ever.

 
 

Unit testing in Symfony

26 May

I hope I don’t have to convince you of the importance of unit testing… and if I do, just read this post from Adil Akhter on the importance of unit testing.

In Symfony, A lime test library has been included and makes it easy for us to do these kinds of tests.
You can do this by requiring the unit.php file that is included in the Symfony package.

And create an instance of the lime_test class

require_once dirname(__FILE__).'/../bootstrap/unit.php';

$t = new lime_test(3, new lime_output_color());

In this case with initialize $t as an instance of lime_test and in the constructor we set 3 as variable, being the number of tests we want to run.

If we run this test in a command prompt, it will execute our test and display the results line by line.
To make it more readable you could set extra text like this:

$t->diag(‘this is the start of the test’);

From the moment the class was initialized, you can create any test you want by simply using the predefined functions in the lime_test class.

Diag generates text
is compares two values
like compares two strings
and so on…

In our little test we simply use ‘is’ as we only want to check if the values that have been calculated are correct if we run it trough a function.

What we want to do is do a unit test of 2 functions, one called sum and one called multiply. The best way to test them is to split them up into 2 unit tests, but in my example, I’ll test them both at once.

The data we can use for this test is set up in an YML file called fixtures.yml and is placed in the same folder as the file that contains the unit test.
I like using this YML file for this kind of tests for several reasons:

  • You can set a huge amount of test data (almost equal to xml)
  • The test data is separated from the code, and code is therefore more readable

We save our file in the same folder as the yml file and call it: SumTest.php, the yml file, containing all the test data is called fixtures.yml.
Here is all code that I wrote in the SumTest.php file, and under the code, you can find the complete explanation.

require_once(dirname(__FILE__).'/../../bootstrap/unit.php');

/**
 * Sum of set of values
 * @param array $inputData
 * @return integer $sum
 */
function sum($inputData){
  $sum = 0;
  $sum = $inputData['a'] + $inputData['b'] + $inputData['c'];
  return $sum;
}

/**
 * Multiply set of values
 * @param array $inputData
 * @return integer $multiply
 */
function multiply($inputData){
  $multiply = 0;
  $multiply = $inputData['a'] * $inputData['b'] * $inputData['c'];
  return $multiply;
}

// Initialize the test engine.
$t = new lime_test(6, new lime_output_color());

$t->diag('Our small function test');

// retrieve test data
$dataProvider = sfYaml::load(dirname(__FILE__) . "/fixtures.yml");

//loop tests
foreach($dataProvider as $testId => $testData) {

  //for each test run the test data trough the functions, retrieving a result
  $sum = sum($testData['input']);
  $multiply = multiply($testData['input']);

  //get the expected data from the yml file
  $expectedData = $testData['expected'];

  //do the actual unit test for the sum and multiply
  $t->is($sum, $expectedData['sum'], " Result of the sum is: " . $sum);
  $t->is($multiply, $expectedData['multiply'], " Result of the multiplication is: " . $multiply);
}

On top of the file I wrote 2 functions that I wanted to test, sum and multiply, a better way would be to include them from the file where they were originally placed and used. If you copy your method in your test, and later change the original method, your test will be totally useless, so be sure to include that in stead of copying it.

The both simply loop the data and add or multiply it and finally return the result.

After initializing our lime_test and displaying a line on the output, we get all test data from the YML file.

We can execute all tests by looping them and using the test data by sending it trough our 2 functions we wrote on top of the page.
Get the expected results out of that same YML file and run them both trough the unit tests.

In our case we simply compare the result of the function with the expected result giving a third parameter as output result on success, or giving an error on failure.

In our YML file data is set as followed.

Test1:
  input: { a: 17, b: 26, c: 35}
  expected: { sum: 78, multiply: 15470 }

Test2:
  input: { a: 2, b: 13, c: 18}
  expected: { sum: 33, multiply: 468 }

Test3:
  input: { a: 3, b: 0, c: 1500}
  expected: { sum: 1503, multiply: 0 }

If we run our test in dos prompt, we see that all results went just fine, even when trying to multiply by 0 as this was an expected output.
You can run your test by calling Symfony test:unit and then the name of your test without Test.php on the end(Remember our file was called SumTest.php).

Hope this was a bit clear for y’all.
greetings.
K.

 

Kick those colleagues asses … or not.

21 May

An issue free work environment doesn’t exist, lets face it, everybody has some issues on what his colleagues do or what is happing within 3 feet from your desk.

Some have the most obvious laughter, others have to tap on your desk every time they pass by, I even heard my brother in law go completely crazy on a sound his colleague made if they where talking too loud. It’s funny to watch those things or hear those stories on how people get irritated by others. This is not something new, everybody hates the habits of others, and what might be something stupid in the beginning and might end up as being the reason to beat up the guy (or girl, girls have those habits too you know, I never meet any on my work as I’m a it-nerd, the root of all evil).

Improving your working environment isn’t easy at all but there might be some things you can do:

Buy yourself a stress ball

Every time you hear or see something that irritates you, start squeezing the damn thing like it’s the dudes head.
Another thing you can do, and is a more common method, is counting to 10 very slowly. This might end up in counting number all day long, but hey, better counting than smashing someones face in I guess.

Start smoking

This might not be the most healthy way, but as I was a smoker once, many moons ago, it got me a little distressed on the funkiest, deadline moments. I used to always go for this excuse to get away for a five minute break (7 actually, as this is the average time of smoking a cigarette) and from the moment I stopped smoking this was the most difficult habit to get rid of. But hey, I did it and am now already more then 2 years smoke free.<

So actually, don’t start smoking, and to all the smokers out there, stop smoking and buy yourself a stress ball.
I know that there are 10 000 friends and relatives that tried to convince you on the health issue, but hey, try these reasons:

  • On a yearly base if you stop smoking your pack a day you save (following Belgium prices)  about 1700 €. Common man, that’s almost 3 days of work (just kidding).
  • Your 7 minutes you smoke per cigarette, for 20 times a day takes you about 51100 minutes in a year you are inhaling toxic air and being unproductive, man that’s  851 hours or 35 days!!!
  • if you’re young it looks cool to smoke, but as the Editors say, have you ever seen those smokers outside of hospital doors, they are the saddest thing in the world…

I guess I made my point here :-)

Just… let it go

Stop trying to make it a better world, you will be doing this the rest of your life trying to improve people, just face it, it’s not worth the time. Pick the people you need to change carefully…

Report it to your boss

Let him do the dirty job of facing the person with the problem. You need a reason why?
- Well he won’t get beaten up, as he is the boss and can say whatever he wants to his employees (in the right way off course)
- He has the actual power of changing people, and probably or hopefully the correct people skills to do this.

Make sure that, if you choose this way, that the person doesn’t know that you are the one that started nagging to the boss, otherwise you might end up getting beaten after all ;-)

Deal with it yourself

This might be the best option after all, but be careful when doing so, you don’t want to hurt anyone’s feelings on this. Be gentle and try bringing this on as something that isn’t the worst thing in the world, but is just getting on your nerves. Be prepared for some reactions, for example:

- He might give you a list of things that bother him about you, and those can also hurt your feelings. But I believe this reaction only comes back to you if you got too confronting in the first place.

- He says ‘ok man, thanks for telling me this, I’ll try to do something about it, didn’t know it was a problem’, deals with it, and never does it again. This is off course the best one, yeeey, you win, fatality, flawless victory!

- You get a positive reaction in the first place, but after a few days the other guy explodes inside because he cannot stand you anymore and then you’ll end up sitting at the bosses desk explaining why the guy gave his resignation.

This is delicate matter for everyone, be careful how to tell it to your colleague…

As you can see, there are some options and I bet you that you can find tons of other ways to deal with this. Just remember that after all, it is only some thing that is happening, it’s not world war 3, it’s not Nagasaki, nobody died, try to deal with it or try to find a good solution.

And until you found a solution, watch out for flying staplers of irritated colleagues…