RSS
 

Archive for the ‘All Articles’ Category

.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>
 

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.

 

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…

 

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.

 

Book Review: Making things happen by Scott Berkun

20 May

I recently read a book by Scott Berkun, a ex-microsoft project manager (Internet Explorer), about the mastering of project management and I must say that I was pleasantly surprised with it.

I have always been a bit skeptical about those kind of books, as most of them only contain a list of do’s and don’ts that everybody actually knows. But this one differentiates itself with other books as it mentions a huge pack of exercises and is always explained with examples of his own experiences at Microsoft.

This book covers all the big points on which a project manager should pay extra attention:

  • how to write good email
  • how your relationship with colleagues should be
  • how to divide your time on a project
  • how to decide what is the most important thing to do first
  • what should be done in times of crisis
  • how to negotiate with colleagues, your staff and your bosses
  • trust and how to work with it
  • how to organize meetings and be sure that you are leading them

Off course, by reading this book, you won’t be the best project manager that ever existed, but I believe that it’s a great asset to your book shelf to use as a reference.
Be sure to try out some of the exercises or to read his experiences, it will help everyone who is in this position, or wants to improve his methodologies.

In your lifetime there are a few books you have to read if you are moving your way up the ladder, and this is definitely one of them if you are trying the step to project manager/team leader.
What I really like about this book is that it can be used as a reference, but it is also just well written, and that is why I practically read it cover to cover. It is just fun to read about his Microsoft problems and how he solved them alone, or in team. The cool thing about Scott is that he is not only a good writer, but also a very good speaker and that he doesn’t take himself too serious.

He worked at Microsoft on IE, and he switched to Firefox himself :-) as he said: It’s not because Firefox is completely new technology and groundbreaking or because Internet Explorer sucks, but because it is just a good solid program and is the best out there.

Check out some of his presentations, they are available on YouTube or via his own website (http://www.scottberkun.com/), and as he said in one of his lectures, that he will always answer all of your questions, if you just send them to him, I’ll try to send him a few questions to do a small interview and as soon as I get a response, I’ll post them here.

 

Programming Methodology Lectures

19 May

These are some interesting courses on programming methodology in Java, it’s nice you can follow them on YouTube.  The teacher entertains us during the whole course and explains everything in a pragmatic way.

Looking back at my own time in school, there where only 1 or 2 teachers giving me the same interest as he does.

Off course, as you will see in the videos and in real life, the only way to know how to program is just, well, start programming…

The coolest thing about these videos is that it probably will be better than the lessons you get at school, if you don’t get how java and object oriented programming in general works be sure to watch these videos. I guarantee every starting programmer that he/she will understand how it works after watching these videos.

I wish I had them when going to school!

Lecture by Professor Mehran Sahami for the Stanford Computer Science Department (CS106A).

If you want to read more, I placed the 6 next lectures on my blog and you can see them by following the link.
If you want even more on these or other courses, you can visit the Channel on YouTube http://www.youtube.com/user/StanfordUniversity

Read the rest of this entry »

 

Start drawing to solve problems

18 May

In my experience it’s true what Mr Roam is talking about, it is very important to use sketches and minimal drawings to explain what you are saying. Everybody will understand your problem a lot faster and it is a fact that next time someone has to explain this problem, he or she will automatically reuse the sketch initially used by the first person (excepted from some minor enhancements).

Dan Roam visits Google’s Mountain View, CA headquarters to discuss his book “The Back of the Napkin: Solving Problems and Selling Ideas with Pictures.” This event took place on May 27, 2008, as part of the Authors@Google series.

 

A few things to think about

07 May

Thoughts on Google’s 20% time

With the rise of Google, no single tactic comes up more in innovation circles than their concept of 20% time. Simply put, employees get 1/5th of their time to work on projects of their own choosing. (more info can be found here)

And this:

William L. McKnight (11 November 1887 – 4 March 1978) was an American businessman and philanthropist who served his entire career in the 3M corporation, rising to chairman of the board from 1949 to 1966. He founded The McKnight Foundation in 1953.

He said:

As our business grows, it becomes increasingly necessary to delegate responsibility and to encourage men and women to exercise their initiative. This requires considerable tolerance. Those men and women, to whom we delegate authority and responsibility, if they are good people, are going to want to do their jobs in their own way.

Mistakes will be made. But if a person is essentially right, the mistakes he or she makes are not as serious in the long run as the mistakes management will make if it undertakes to tell those in authority exactly how they must do their jobs.

Management that is destructively critical when mistakes are made kills initiative. And it’s essential that we have many people with initiative if we are to continue to grow.

or you can just watch this presentation:

Scott Berkun Lecture: The Myths of Innovation