RSS
 

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…

 
 

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.

 

smartphone domino

11 May

It’s a cool commercial, but when I look at it the only thing that comes to mind is that people at Vodafone have to much spare time…

 
 

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