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.

Thursday, May 7, 2009

emacs: Searching programming API's with webjump


Image by MarkyBon

In a previous post I outlined how to use webjump, a built in feature of emacs to quickly launch web pages in a browser, after querying the user for search phrases and so on.

This describes how to simply setup webjump to search the API documentation for whatever framework you are using. The example will be Java's Platform documentation. 



  1. Find the base url you want to search. We will use google to only find things that begin with this. In the case of Javas documentation I'm going to search at http://java.sun.com/javase/6/docs/api/
  2. Set up the web jump code as below. The three arguments in square brackets are [ base url, normal search url prefix, search url post fix ]. You just need to replace the JAVA API part of my URL with the URL you are interested in.
  3. M-x webjump
  4. Type your query and hit enter
  5. Browser opens with search results






(require 'webjump)
(global-set-key [f2] 'webjump)
(setq webjump-sites
(append '(
("Java API" .
[simple-query "www.google.com" "http://www.google.ca/search?hl=en&as_sitesearch=http://java.sun.com/javase/6/docs/api/&q=" ""])
)
webjump-sample-sites))



Wednesday, April 15, 2009

Running an elisp function on each marked file in a dired buffer


Chain Tool by Florian 

If you have some function, say some custom refactoring operation, you can call it from a dired buffer, and have it run on each marked file, using the code below. 

Go into a dired buffer, mark some files, and then do M-x and run your command. In this case it would be test-for-each-dired-marked-file


;;; iterating over files in dired

;;; usage example - for-each-dired-marked-file returns a filename and path
;;; for each marked file, so this is what a function using it looks like
(defun view-stuff(filename)
"opens up the file and gets the length of it, then messages the result"
(let (fpath fname mybuffer len)
(setq fpath filename)
(setq fname (file-name-nondirectory fpath))
(setq mybuffer (find-file fpath))
(setq len (buffer-size))
(kill-buffer mybuffer)
(message "Buffer length %d %s" len (buffer-file-name mybuffer))))

; Usage example
(defun test-for-each-dired-marked-file()
(interactive)
(for-each-dired-marked-file 'view-stuff))

(defun for-each-dired-marked-file(fn)
"Do stuff for each marked file, only works in dired window"
(interactive)
(if (eq major-mode 'dired-mode)
(let ((filenames (dired-get-marked-files)))
(mapcar fn filenames))
(error (format "Not a Dired buffer \(%s\)" major-mode))))

Thursday, April 2, 2009

Securely copying files to another machine

Fast post about copying files between computers over a secure connection.

Linux and Cygwin comes with scp, a secure version of cp.

Usage... in this case I'm copying a file from my cygwin (putty) terminal to a remote machine.

scp /cygdrive/c/Documents and Settings/myname/My Documents/interestingfile.txt usernameonmachine@1.2.3.3:/home/usernameonmachine/


You should get a password prompt and see the transfer complete as follows.

interestingfile.txt 100% 34KB 34.3KB/s 00:00

Wednesday, March 18, 2009

Vancouver game companies

I've copied this excellent list of Vancouver game companies from :

http://csciun1.mala.bc.ca:8080/~wesselsd/gamedev/index.html

Please not that the number of jobs for each one is constantly changing, and so will be only (roughly) correct at the time I posted this.

  • Acronym Games (7 jobs)
  • Action Pants Inc (always recruiting multiple positions)
  • AirG (2 jobs)
  • Atomic Robot Games (always recruiting)
  • Backbone Entertainment/Foundation 9/Digital Eclipse (2 jobs)
  • Bardel Entertainment Inc. (3+ jobs)
  • BigSandwich Games (4+ jobs)
  • Blue Castle Games (14 jobs + 3 co-op jobs)
  • Credo Interactive
  • Deep Fried Entertainment (8+ jobs)
  • Electronic Arts Canada (21 jobs)
  • Gekido Design Group (3+ jobs)
  • Hot Dog Day
  • HotHead Games (2 jobs)
  • InLight Entertainment (Victoria) (5+ jobs)
  • InterScape Creations
  • IronClad Games
  • IUGO (2 jobs)
  • Jarhead Games (always recruiting)
  • JetBlack Games (1 job)
  • Just Leap In (4+ jobs)
  • KoolHaus Games (10 jobs)
  • LavaMind
  • The Lunny Group
  • Magellan Interactive (3 jobs)
  • Magnetar Games
  • Nerd Corps Entertainment (7+ jobs)
  • Next Level Games (4 jobs)
  • Nintendo of Canada
  • Orangeview Games
  • Piranha Games Inc. (always recruiting)
  • Propaganda Games (5 jobs)
  • Radical Entertainment (16 jobs)
  • Rainmaker (30+ jobs)
  • Relic Entertainment (12 jobs)
  • Rockstar Vancouver (5 jobs)
  • Singular Inversions
  • Slant Six Games (6 jobs)
  • Smoking Gun Interactive (5 jobs)
  • Threewave (8 jobs)
  • TrueView Rendering and Animation
  • United Front Games (3 jobs)
  • Yamisoft Entertainment Inc.
  • Yummy Interactive (1 job)
  • Monday, March 9, 2009

    Using tags in emacs on windows




    This requires you install the Gunwin32 tools or Cygwin, and describes how to build a tags table for the project you're working on, when using emacs to edit the source.

    First you want to generate a file containing all the source files you want to have tagged. Go to the root folder of your project.
    find . -regex ".*\(h$\|cpp$\)" > files.txt
    Next pass this to etags to generate the tags table.
    etags.exe - < files.txt 

    Then when you're in emacs you need to visit the tags table, which will have been saved as TAGS. M-x visit-tags-table then browse to the folder where you made the TAGS file. Now when you have the curser on some function you can type... M-. to go to a tag and C-u M-. to go to the next tag. Once you're done, you can return to where you started with M-* Another useful function is tags-apropos Which will list all the tags matching a regex in a buffer.