Blog

Categories

Blogroll

Partial LaTeX Word Count + TextMate Posted @ 19:09 on 14th November, 2008

Long time no post, sorry! Here's just a quick one.

I've been working on some essays and reports for uni in LaTeX, and the criteria for the work is usually that it is within a certain word limit, discounting titles, appendices, references etc. So I thought the easiest way to do this would be to have the main content, the bit that actually counts towards the word limit, in a separate file and include it. I then needed a good way of counting the words in this, and Googling lead me to a solution which converted the rendered PDF into ASCII and counted that, which is fine, but doesn't work for partial LaTeX documents, i.e. ones without document tags etc. So I came across detex, which works pretty damned well. The only issue I've found with it so far is that it doesn't filter keywords within braces, so for example, with \begin{itemize} it strips the \begin{}, but not the itemize, so this obviously adds to your word count. It's a minor issue though, and one I'll happily live with. You can then just pipe the output of that into "wc" to get the word count (and various other bits of info).

If you happen to be using TextMate, here's a nice little command which will do it for you:

 

detex "$TM_DIRECTORY"/"$TM_FILENAME" | wc -w

 

I've added the "-w" option to just give me the word count, but obviously you can change this to get the other data wc will give you.

Enjoy!

Permalink. 0 Comments. Posted under Third Year Project.

Guitar Pro Posted @ 09:57 on 23rd October, 2008

I've been using Guitar Pro for quite a while now, a good couple of years, and have had very few issues with it. That is, before last night. I tabbed out a section I'd written for Drongo, and all was good. Because of compatibility/different software issues, when I send things round to the band, I send them in a MIDI file and a Guitar Pro 4 file. Normally this is all well and good, but last night I think it was trying to tell me something about the music I'd written. Firstly, the MIDI only exported the first 35 seconds, up to the heavier section. Secondly, when I exported the GP4, it swung the whole piece! Why the hell did it do that?! Somewhere, in some of the code, there is something which decided what I actually wanted to do was swing the piece of music. I'd love to know how this happened.

Permalink. 0 Comments. Posted under Music, Guitars.

NSFileBrowser Posted @ 16:18 on 22nd October, 2008

I've been working for the last couple of days on a project for my band Drongo Sealion Magic. We use a lot of samples in our music, all of which we store as MP3s on a laptop, and we wanted a simple playing mechanism which was more responsive than something like QT or iTunes. Unfortunately, we didn't have much luck finding one, so I thought I would write one. More on that later.

One of the things I want to have is a file browser so you can quickly change the samples you've got loaded. For some reason though, Cocoa doesn't appear to have a standard File Browser object. This is something I think is a bit odd. I can understand the reasoning, obviously most applications will make do with the Open/Save dialogues, and those that don't probably need some form of custom browser anyway. But surely, for consistencie's sake, they would want developers to present a standard browser so that people would be using the same browser across all their apps? As it stands, I'm having a hard time replicating the look and feel of the standard list browser in Finder. Perhaps someone should write an "NSFileBrowser" style class. Perhaps it should be me...

Permalink. 2 Comments. Posted under Drongo Sample Magic.

Scrabble is Big! Posted @ 11:20 on 20th October, 2008

I ran some simulations over the weekend, and I've found some interesting statistics I thought I'd share with you.

After 10,000 simulated games, the average number of moves per game was 23, and the average number of choices per move (i.e. the number of moves you could actually make at each move) is around 970. This means that a graph which stored all possible configurations of the board would contain around 970^23 nodes (ignoring repetitions). That's huge! As a contrast, chess (which is considered pretty damned hard to solve) has on average 57 moves per game (from a quick Google search, this may be inaccurate) and has a branching factor of around 35, making a graph of size 35^57.

What have I gotten myself into?!

Permalink. 0 Comments. Posted under Third Year Project.

Coincidence Averted? Posted @ 21:58 on 13th October, 2008

So the problem appears to be solved. The issue was that on waking from sleep, the laptop would crash. Then, when trying to start it up again, it would not even get as far as the Apple logo screen before failing. The solution to this was to hold the power button until the light flashed and a high picthed noise was heard. I'm not sure what exactly this does, but it made the laptop start up.

After some searching around, I found this article pertaining to sleep modes. I did what it said, and changed my hibernate mode to 0, and now the laptop seems fine. Also, I've saved myself a precious 2GB worth of hard drive space, which on only a 70GB drive, is very much worth it! It does mean, however, that I can't leave it on sleep for long periods of time, since it drains the battery to keep the contents of the RAM happy. I think I can live with that, though.

Permalink. 0 Comments. Posted under Gear.

<< previous
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 next >>