svn auto-props

My Tip of the day…

I finally found out how to use Svn auto-props today. These are very nice. You can set a given property based on a files extension or filename pattern. This allows for doing things like:

[auto-props]
*.py = svn:keywords=Author Date Id Revision

This means I don’t have to keep adding svn keywords on every file I add. It just gets turned on for all python files I add to svn. These properties are set in the svn config file on the client, so every client can have their own settings. Very handy.

Always check the date on food in a vending machine

A while ago my friend was drinking a milk he bought in a vending machine and was telling me something like “This mile sure is gross. I have to drink it though cause I paid $1.50 for it.” After a while I thought about what he said and told him to look at the date on the bottle. The date was over a month old! Then later we walked past the vending machine and I had to look and see if there were more out of date products. Sure enough all the milk products I could see were at least a month old.
vending machine milk
So needless to say…always check the date on food you buy in a vending machine.

Checking for installed PEAR module in PHP

PHP has the intention to make PEAR a repository of common libraries similar to CPAN in Perl. This still isn’t the case though. Every time I’ve used PEAR it is a bit kludgy. There should be some support functions as part PEAR itself to do simple operations through php scripts.

For example I wrote a report generation class for Testlink that uses Spreadsheet_Excel_Writer and I wanted to check that this dependency is met during installation. This isn’t as clear cut to do as it should be though. I wasn’t able to find any standard way in documentation for how to check if a PEAR module is actually even installed. First I tried to use the built in is_file() function in php. This doesn’t honor the include_path though so it isn’t very useful with PEAR. So I ended up just doing an include_once() for the module. This isn’t very clean though as it throws a really ugly error for the user if they have error reporting turned on in their PHP configuration.

So here’s to hoping that PHP and PEAR will someday work together in a more clean way. I would think this would be a very common operation for any project that relies on PEAR modules. Apparently it isn’t though.

Why do we overcomplicate things?

Sometimes I make things more difficult than I need to. I know this is the case with other people too. We just have come to expect things to be hard so we make them even harder than they need to be sometimes.

For example. Today I was trying to match a literal % character in an expression within vim. For some reason I thought it needed to be escaped with a \ or even multiple \\. When in reality it is just matched wthout any escaping. I was making it more difficult than it needed to be. This is a simple case, but it happens many times each week. I would imagine if most technical types kept track of how often they do this it would be more often than they expect.

I’m going to start making an effort to try to find a simple solution before looking for a more complex one.

Print a pdf from the command line

I needed to programatically print a pdf from the command line. This was easier than I expected it to be. Simply use acrobat reader to spool the pdf to the printer. In Windows this meant running something like “acrord32.exe /t filename.pdf” the /t switch was the key. The most difficult part was finding the documentation for this feature.

Getting a screenshot in Windows from MacBook Pro

I wanted to get a screenshot in Windows on my MacBook Pro today and couldn’t figure out how to do it. Apparently this is now supported in newer versions of bootcamp. I don’t currently have this installed though, so I had to find another way for the time being. I found a handy resource that showed how to do it with a Windows tool I was unaware of called On-Screen Keyboard. Thanks to this great tool I was able to get my screenshot. This could also be useful on a system where the keyboard may not be working or other similar situations.

Automate defrag in Windows

I found a blog post pointing to an easy way to automate defrag in windows xp. This is extremely easy to do and is something that more people should definitely do because it will help their Windows computers run much faster.

The steps are basically as follows

  1. open up task scheduler
  2. put in %systemroot%\system32\defrag.exe %homedrive% as the command
  3. select a time for defrag to run every night.

Here is the post