Wednesday, August 26, 2009

Simple budget forecasts in emacs

Money

When I first moved from England to North America one of the things I found hard to get used to was getting paid every two weeks instead of monthly. This means that some of your bills are monthly, some are biweekly, and occasionally I had more or less money than I expected as they got out of sync.

I've been using a simple elisp program I wrote to let you manage your upcoming bills, weekly budget items like groceries, and your regular income. It runs through a period of dates you supply, and a list of incomes and expenses, and produces a csv file and a buffer that contains the output of the forecast. It shows the highest and lowest balance of the period too, so you can spot if you will go over drawn, and also see peaks when it's a good time to move money to savings.

The code is hosted on google code as emacs-easy-budget and is also released as GPL v3. Hope somebody finds it useful.

Wednesday, June 17, 2009

1337 on StackOverflow


I noticed today that my StackOverflow reputation is 1337. What an incredibly geeky way to begin Wednesday!

Wednesday, May 27, 2009

Linux: Looking at files changed recently

This is really handy (on Linux and Cygwin) when you're working on a project that may not be in source control and you want to see what you changed recently.

I made this blog post, when it seems a trivial use of find, because I don't think the man page covers it well.

This command finds all files modified in the last 60 minutes:

find . -type f -cmin -60

Thursday, May 14, 2009

Linking MingW32 with psapi

Here's something I came across that didn't have a good answer when I googled. If you get link errors with MingW32 like:

undefined reference to `GetProcessMemoryInfo@12' or
c:/justinhj/mem.cpp:55: undefined reference to `EnumProcesses@12'

Then you are not linking with the library psapi, and you need it.

To do this just add -lpsapi to your command line. It needs to be last in the list of libraries too!

Writing quick C++ programs in emacs without a makefile



Cheetah by Storm Crypt

Often when programming in C++ (or many other languages) it's desirable to write a quick program, usually a console application, to test something quickly. Working in developer studio, it takes an amount of fiddling and clicking large enough that you may not want to bother.

Working in emacs and MingW32 (or Microsoft's CL.exe) I can quickly create a CPP file, and then compile it. To compile a program though you need to either write a makefile, or build up a complex g++ command line.

Rather than do either of those I make a helloworld.cpp file which can be built like this:

g++ helloworld.cpp -g -o helloworld.exe

So I hit

M-x compile

then type in the above to compile and link it.

However there's a better way. You can add the compile command as the first line of the file as a file local variable.

// -*- compile-command:"g++ helloworld.cpp -g -o helloworld.exe"; -*-

Now I can hit the compile and it works right away, between sessions. No makefile or project settings in sight, and now there are minimal barriers involved in creating a simple test program beyond copy and pasting the file.

Tuesday, May 12, 2009

Converting flac to mp3

This is just a link to a great description of converting flac to mp3 files. There's a tonne of commercial and useless sites that try to answer this question

So I thought I'd add another link to this one that actually works, and uses free software.

http://www.afterdawn.com/guides/archive/how_to_convert_flac_files_to_mp3.cfm

Friday, May 8, 2009

emacs: Renaming multiple files at once with a regular expression

M-x dired
(navigate to the folder)
M-x wdired-change-to-wdired-mode
M-x replace-regexp
(enter search and replace expressions)
C-c C-c

Which writes out the changes to the directory.