Entries Tagged 'Nerdy Stuff' ↓

ASUS PL30JT First Impressions

I’m very excited to be typing this on my brand new ASUS PL30JT. When I was looking for user reviews of this machine over the last couple of days I didn’t find many, so I thought I’d take the opportunity to help others interested in this machine, as well as test out the keyboard a little more extensively. Please keep in mind that my last laptop is an Apple Macbook Pro circa 2005, so a lot of the standard features on new laptops are possibly novel and exciting to me.
Continue reading →

memcpy and memset

Now that I am back in the world of full-time work, I have begun to think more seriously about my goals. One of my life goals, which I have recently decided are a superset of career goals, is to learn as much as possible. I have also decided that learning as much as possible is also a member of my set of career goals. To alleviate any confusion, I drew a Venn diagram summarising the situation.

As part of my new job, I am programming in C++ for a good part of each day. A consequence of this is that I am constantly learning new methods for writing and debugging C++ code, and programming in general. In an effort to document and share this knowledge, I’m going to start by telling you about memcpy and memset. memcpy and memset are two functions included in the C standard libraries.  memcpy is used to copy a block of memory from a source to a destination, and memset is similarly used to set a block of memory to a particular value.  While quite low level functions, these can both be very useful if speed is critical and you’re not working with higher level containers for whatever reason (yes, I know everyone says to use vectors if you’re not using straight C).

Continue reading →

Cleaning an Apple Mighty Mouse Scroll Ball

I’ve recently started using my Macbook Pro a bit more to do some web development stuff, and I quickly ran into an ongoing problem. In a rare case of design failure, the scroll ball on the Mighty Mouse just doesn’t work after extended use. The most common cause of this is a buildup of dirt and gunk around the scroll ball and its surrounding sensors. After some google searching, I found a few different methods for cleaning from the hardcore to the basic (push down and rub). In the end I went with a slightly modified version of this kid’s method which has thus far worked a treat.
Continue reading →

Batch Conversion of RAW Images

A little while ago I took some RAW images with my DSLR. Having never used a DSLR or dealt with the RAW format before, I had no idea how to view or use the files. After a brief search, I discovered a most useful program called UFRaw. It’s free (and I think open source), and allows you to open and edit a variety of RAW image formats. Not only that, but it also acts as a GIMP plugin and a batch converter, so you can load your images directly into The GIMP for editing. All of these features appear to be documented on the UFRaw site, although to tell the truth I really haven’t used it all that much.

Today I wanted to convert about 45 RAW images to JPEG. Obviously this is a job for the batch conversion tool that comes with UFRaw, however, the batch conversion program converts images to .PPM by default. In order to batch convert images to JPEG, an additional command line argument must be passed to the program.  Having to get into the command line removes the drag-and-drop simplicity you get with the default behaviour, and I knew I could do better. It quickly became apparent that it was time to get my batch file on. Below is my example script that allows you to drag-and-drop any number of files onto it and have them converted to JPG. This same script could be re-applied to any other program that works in the same way by simply changing the program and command line arguments.


@ECHO OFF
START "converting RAWs to JPEG" "C:\Program Files (x86)\GIMP-2.0\bin\ufraw-batch.exe" --out-type=jpg %*

The first line of the script just turns off printing to the command line. The second line is where the magic happens. Breaking up the second line we have:

  • START – used to start a program
  • the title of the command line window that opens to run the command
  • the path to the executable we’re calling (in this case, ufraw-batch.exe)
  • the command line arguments passed to ufraw-batch.exe to convert images to JPEG instead of PPM
  • finally, the “%*” at the end passes all of the arguments/files passed to the script, onto the ufraw-batch.exe command we’ve just defined

Obviously if you want to use the script yourself you may need to change the path to ufraw-batch.exe.

Floating Point Comparisons in C++

For the really geeky amongst you, here’s a pretty good article explaining some of the issues and approaches relating to floating point comparisons in C/C++.

On a side note, I’m almost done with my uni assignments for this semester. I’m hoping to post a few articles based on stuff I’ve encountered this semester once I get into exam period/holidays.

That is all.