One of the projects I have been working on at the lab has made it to the iPhone AppStore. It’s the Mobile Multi Display, and you can find more information about it on its website: http://www.graphics.rwth-aachen.de/software/mmd/.
Category: coding
XCode cannot compare SVN directories
Nice things about the iPad
Python: swapping variables
I forgot where I read this, but this is a neat way of swapping variables in python:
u = 1
v = 2
print "%i %i" % (u, v)
u, v = v, u
print "%i %i" % (u, v)
Drag and Drop of Actions in Qt Designer 4.6.2 on OS X does not work
One more stupid bug in Qt found. When using the Designer, you can’t drag and drop QActions, if you are using the Cocoa version of Qt. The bug is described here, a fix will be available in Qt 4.6.3.
OpenCL on OS X
Emacs: autocomplete-mode
Bug in ff-find-other-file of Emacs 22?
I am working on a C++ project which is organized such that source files (*.cc) are in some subdir called, let’s say, project/dir1/, and header files (*.h) in a directory called project/include/. Now Emacs has a function called ff-find-other-file, which is able to switch between header and implementation of C/C++ files. If you take a look at the source of this function, you will find another function called ff-get-file-name, which tries the following: first, it looks for already visited buffers, if they contain the appropriate file. Then it will search a certain set of directories, if they contain the file. Last, it will ask to find or create the file in a user specified directory. However, in my case, although both files are already being visited by buffers, the first test (finding the file in already loaded buffers) fails. Actually the offending piece of code looks like this:
(if (bufferp (get-file-buffer filename))
(setq found (buffer-file-name (get-file-buffer filename))))
The problem is that this always fails, and found will always be nil. The filename constructed is not being expanded, as get-file-buffer demands. However, expanding it is useless, since the exact expansion (absolute path) of the searched file is not exactly known! However, you can rework these lines to just look for a buffer whose name matches the file you are looking for:
(let ((b (find-if (lambda(x) (string= (buffer-name x) filename)) (buffer-list))))
(if b
(setq found (buffer-file-name b))))
Note that this will only do a simple string matching. It might happen that for a certain file foo.cc you have to buffers visiting some foo.h. The function will only find the first one. But in my opinion, there is not simple solution to find the semantically correct header file, anyway. So this is still better than the broken solution in Emacs.
No 64bit CUDA for OS X so far
I am still waiting for 64 bit CUDA support for OS X 10.6. As this thread indicates, we might have to wait for a while so far. Maybe I will switch to OpenCL in the meantime? 🙂
Recursive Makefile for LaTeX
I wanted to make a Makefile for a seminar report. This report contains all the sub-reports of the students. So the Makefile needs to recurse into subdirectories to compile all the contained LaTeX files there. So, given a file reports.tex which will include some PDFs in subdirectories 00/ to 10/, we get a Makefile that looks like this:
#####################################################
# A small LaTeX Makefile
#####################################################
PREFIX=reports
CHAPTERS=00 01 02 03 04 05 06 07 08 09 10
all: subdirs $(PREFIX).pdf
#####################################################
.PHONY: subdirs simple
subdirs:
@for i in $(CHAPTERS); do
(cd $$i; $(MAKE)); done
#####################################################
$(PREFIX).aux: $(PREFIX).tex
pdflatex $(PREFIX).tex
$(PREFIX).pdf: $(PREFIX).aux
pdflatex $(PREFIX).tex
#####################################################
simple:
pdflatex $(PREFIX).tex
#####################################################
clean:
@for i in $(CHAPTERS); do
(cd $$i; $(MAKE) clean); done
rm -f $(PREFIX).aux $(PREFIX).bbl $(PREFIX).blg
$(PREFIX).idx $(PREFIX).log $(PREFIX).out $(PREFIX).tcp
$(PREFIX).toc $(PREFIX).tps $(PREFIX).prf $(PREFIX).lbl
rm -f $(PDFFILES) *.aux