Mysql: Random dice

Getting a random roll of the dice:

          CREATE TABLE dice (
            d\_id int(11) NOT NULL auto\_increment,
            roll int,
            PRIMARY KEY  (d\_id)
          );

          insert into dice (roll) values (1);
          insert into dice (roll) values (2);
          insert into dice (roll) values (3);
          insert into dice (roll) values (4);
          insert into dice (roll) values (5);
          insert into dice (roll) values (6);

          select roll from dice order by rand() limit 1;

Zend Framework - Ready or not?

We are a fairly large PHP shop at work running some of the largest Danish websites. In a fairly new project, it was suggested that we considered using the Zend Framework to fast track development and piggy back upon some of the components provided by the framework. We looked at it, and said no – at least for now. Since the Zend Framework website does an excellent sales pitch on why you should use it, here’s some of the arguments why you should restrain from using the framework.

GTD: Inbox Messages Zero

It took just over a year, but I’ve finally done it. My inbox contains zero messages. It is a little bit scary, since it hasn’t been empty for the past… well since it was created over a decade ago. I’m not sure it’ll stay there on a daily basis, but I’m quite sure it’ll never reach the thousands of messages ever again. I’ve have been toying with GTD, and while it would probably be more efficient to dive in and go completely native (in GTD), I’m taking the slow adoption curve and try to adopt practices one step at a time and letting them prove to me, that they actually work.

Not Always Online

With email, instant messaging, texting and mobile phones, we’re always reachable. Being available always can be a problem. Here are a few tips on how to detach your self sometimes and get a little time to get work done. Your email client doesn’t need to be running when your computer is turned on. People sending email doesn’t expect an instant answer. Turn you mail client off, and start it when you switch to ”mail processing mode”. Turn it off again once your done. While the little pop-up notifications may be practical, they do break the attention away from the task being done, when the mail arrive.

The daily agenda

Make a small list every day of the items you need to do. Use checkmarks and track your progress throughout the day an notice which thinks out side the list, eats you time away. Run with the system a week and use the result. First the list helps you notice how much you get done throughout the day. Most people seem to work more by the clock than by tasks. By planning tasks and noticing the task progress, you learn how much you handle on a day and hopeful get better at guessing how much time a task actually takes.

Make the most of meetings

Every workplace seem to have a certain fondness for mettings, and some organizations seems to have so many meetings that they hardly have time to mind their business. There are a few tricks, which can help you make the most of meetings – or at least lessen the pain. If you’re invited to a meeting…

As a general rule expect at least two days notice before any meeting with more than 3 participants. Meetings arranged with a tighter deadline (unless some current event is the cause) are too often a joint coffee break than a meeting.

No morning meetings

Generally I’m a fan of the GTD-thinking, and while I may not be following the system (yet anyway) I have picked up a few habits, which seems to help a lot. I’ll try to post a few items on some of the things, which seems to work for me. First item on that list, is the ”no morning meetings”. Whenever I manage my calendar, I make an effort to keep the first 30 to 60 minutes after I get to work free of meetings and other interruptions.

Make meetings with yourself

The past months my calendar at work seems to have been a pure mayhem of meetings, seminars and other activities away from my desk and the feeling of during actual work. There are however one trick, which seems to do magic – make a meeting without inviting anyone. In modern offices with enterprise calendaring systems such as Outlook&/Exchange setting up meetings is much easier than ever before (maybe too easy but that’s a topic for another post).

To hide a secret in the open

Suppose you want to write a system, which requires a password to do something. Not a login system, but just a shared secret. Suppose also, that you need to show someone the source code, but you don’t want him or her, the secret password can you do that. Sure. Here’s a simple way to do it with PHP.

Gallery2 - moving to new URL

Long ago I installed Gallery2. It was initially just a test installation to see if it worked, as it should. Being a test install it was just placed at /g2/ on this server. Time passed. It just worked and before long, there were a large number of photos (with metadata) in the gallery. So how do you move it to a slightly more suitable location without breaking too many things? I tried it a few times before, but with very little success. Now it’s done, I can only wonder why it seemed difficult to do it in the past – it’s really quite simple. Here’s how to do it: