If PDF documents show up funny within Preview, particularly if the fonts appear wrong, there is a simple fix. Open up a Terminal window and type
killall -u <username> ATSServer
Restart Preview and the problem should be fixed.
If PDF documents show up funny within Preview, particularly if the fonts appear wrong, there is a simple fix. Open up a Terminal window and type
killall -u <username> ATSServer
Restart Preview and the problem should be fixed.
Often, you’ll have a sequence of image files from which you’d like to make a movie that plays in PowerPoint for presentations. The best way I’ve found to do this is to create Windows Media files. Here is the recipe I’ve found that works well using Windows XP. You’ll need to download ImageJ and Windows Media Encoder. Your mileage may vary.
That’s it. Now test out your video in PowerPoint and make sure it plays in presentation mode.
Awk makes computing the average of a column of numbers in a text file very easy. Here’s the command for computing the average of the 5th column in a text file:
cat my_file.txt | awk '{sum=sum+$5}END{print sum/NR}'
The $5 means the 5th column and the NR means the number of entries (rows) in the column.
The ‘cut’ utility on Linux/Unix is useful for selecting columns from a delimited text file. It’s basic usage is
cat my_file.txt | cut -d ' ' -f 2
This will select the second column from a space-delimited file. The -d option specifies the delimiter (default is tab) and the -f option specifies a comma-separated list of columns that you want to select from the file.
To remove CVS files from a module you have checked out from a CVS repository, you can use a simple one-line command:
find -type d -wholename '*CVS' | xargs /bin/rm -rf
Execute this from the root of the CVS module that you checked out and want to clean up.
Finding a common time when busy people can meet is a difficult challenge. Doodle.com makes it easy for the meeting organizer to create a list of proposed times. People attending the meeting can check off the times that work for them, making it easy to find a meeting time.
From time to time, you may need to interface C code with Fortran code. One way to do this is to use the utility f2c to convert Fortran 77 code to C code that can be compiled with a C compiler that compiles ANSI C. Searching online, I couldn’t find a good written guide to compiling f2c from source. I did find instructions for compiling on Mac OS X and have adapted those instructions for a linux installation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | setenv INSTALL path/to/your/local/install/directory curl "http://netlib.sandia.gov/cgi-bin/netlib/netlibfiles.tar?filename=netlib/f2c" -o "f2c.tar" tar -xvf f2c.tar gunzip -rf f2c/* cd f2c mkdir libf2c mv libf2c.zip libf2c cd libf2c unzip libf2c.zip cp makefile.u Makefile make cp f2c.h $INSTALL/include cd ../src cp makefile.u Makefile make cp f2c $INSTALL/bin |
Copy the f2c executable to a local bin directory to make it available as a command. To compile C code converted from Fortran with f2c, you’ll have to link against the library libf2c.a generated during the build.
If you want to create a shared object from your converted source code on Linux, you’ll need to add the -fPIC option to the CFLAGS variable in the Makefile in the libf2c directory.
ImageMagick’s ‘convert’ program makes it easy to stitch together two separate images so that they appear side-by-side in another image. This can be very useful for making demo videos. The command is simple:
convert image1.png image2.png +append output.png
That’s it. The command assumes image1.png and image2.png are the same height.
To apply this command to a sequence of images and get a sequence back, it does not work to do the following:
convert image1*.png image2*.png +append output.png
This actually appends all the specified images into a single frame. Instead, you can write a simple shell script to run the command many times. This one runs in bash:
n=0; while [ $n -lt 180 ]; do printf -v file1 "ModelResized/spindle-model%04d.png" "$n"; printf -v file2 "Simulation/spindle-sim%04dG.png" "$n"; printf -v outFile "output%04d.png" "$n"; convert $file1 $file2 +append $outFile; n=$[$n+5]; done;
It’s kind of ugly, but it works. One thing to note: printf works just like the C function printf. The -v VAR option stores the formatted string output into the variable VAR.
LeechBlock is just the Firefox plugin I’ve been looking for to prevent me from wasting my day at school. It lets you enter which sites you want to block and when you want to block them. You can block at fixed time periods during the day or set it to limit the time you visit the sites per unit of time (5 minutes on reddit per hour, for example).
Now, back to productive work!
Here’s a helpful tip for redirecting visitors from your UNC CS home page URL (i.e., http://www.cs.unc.edu/~yourname/) to another directory. In my case, I wanted to redirect visitors to my WordPress installation rooted in a subdirectory.
In your public_html directory, create a file named .htaccess and add the following text to it:
redirect 301 /~cquammen/index.html http://wwwx.cs.unc.edu/~cquammen/wp/
In my case, I want to redirect visitors to my WordPress installation directory. In the UNC CS department, WordPress and other web applications can run only on the wwwx server, not the www server, so I am redirecting to that server.