Tips for

- MATLAB
- Subversion (SVN)
- Preparing conference papers with latex/dvips/ps2pdf
- ACM/IEEE camera ready process
- OmniGraffle

Contact me: dhalperi@cs.washington.edu

Back to Daniel Halperin's webpage.

(a.k.a. CRC32, IEEE 802.3 FCS, IEEE 802.11 FCS, Ethernet FCS, WiFi FCS, 32-bit checksum)

Unfathomably, this code is hard (impossible?) to find online. (Hence the long line of a.k.a.'s above enabling Google to do its job.) There are lots of hyper-optimized C/C++/C# implementations using tables, but nothing useful for MATLAB. Here you go! (download link: crc32.m)

function ret = crc32(bits) poly = [1 de2bi(hex2dec('EDB88320'), 32)]'; bits = bits(:); % Flip first 32 bits bits(1:32) = 1 - bits(1:32); % Add 32 zeros at the back bits = [bits; zeros(32,1)]; % Initialize remainder to 0 rem = zeros(32,1); % Main computation loop for the CRC32 for i = 1:length(bits) rem = [rem; bits(i)]; %#ok<AGROW> if rem(1) == 1 rem = mod(rem + poly, 2); end rem = rem(2:33); end % Flip the remainder before returning it ret = 1 - rem; end

By default, MATLAB only displays four digits of precision when using the Datatip tool in plots. This can be really irritating when you're trying to get an exact spot in a large file:

You can load an alternate datatip file *every time you open a plot*, or
you can export the cursor data and then access the coordinates of that point
inside the object in the command window, but I really wanted another way.

So I found the default datatip file and modified it myself.

- On Mac OSX:
`/Applications/MATLAB_R2008a/toolbox/matlab/graphics/@graphics/@datacursor/default_getDatatipText.m` - On Linux:
`/opt/matlab/toolbox/matlab/graphics/@graphics/@datacursor/default_getDatatipText.m`

This file has two lines of text reading:

`DEFAULT_DIGITS = 4; % Display 4 digits of x,y position`

I changed the 4's to 8's.

How do I create a patch to give back to an upstream maintainer?

`svn diff --diff-cmd `which diff` -x "-bNaur" > my.patch`How do I apply the patch?

`patch -p0 < my.patch`

For individual files, SVN will treat them as binary files if you mark their mime-type as application:

`svn propset svn:mime-type application/pdf my.pdf`

Or, you can set options for all files of a certain extension by editing
`~/.subversion/config`:

[miscellany] enable-auto-props = yes # enables SVN's automatic labelling [auto-props] *.pdf = svn:mime-type=application/pdf *.ps = svn:mime-type=application/ps

Using the ACM SIG style file, how can I prevent my first bibliography entry from overlapping with the REFERENCES section header?

I don't understand why this happens sometimes and not others, but look in the

`sig-alternate-10pt.cls`file. In my copy, they redefine the bibliography command:\section[References]{% <=== OPTIONAL ARGUMENT ADDED HERE {References} % was uppercased but this affects pdf bookmarks (SP/GM October 2004) {\vskip -9pt plus 1pt} % GM Nov. 2006 / GM July 2000 (for somewhat tighter spacing) \@mkboth{{\refname}}{{\refname}}% }%

I found that commenting the

`vskip`line above fixes the problem. But don't do this permanently; other times removing this command results in extra whitespace.

How can I tell whether all my fonts are embedded?

There is a really useful utility,

`pdffonts`, which is part of the`xpdf`package. Install`xpdf`via`fink`or`apt-get`or whatever. Then run`pdffonts <your PDF>`. The "emb" column is the one you're interested in!Not all my fonts are embedded. What do I do?

First, try recompiling with the

`[draft]`option on your document style in latex, and rerun`pdffonts`. This will help you identify whether the problem is in the main PDF or in an included figure.Sometimes you can fix problems in PS or PDF files using

`ps2pdf`:`ps2pdf -dEmbedAllFonts=true -dPDFSETTINGS=/prepress paper.[ps or pdf] paper_embed.pdf`

How does one make radio emission symbols in OmniGraffle?

I used to recommend Peter McMaster's script arc_bits. It's surprisingly great.

However, Ben Ransford has revolutionized this process by adding a loop around the arc_bits script. This, and some other useful scripts we developed, are now available via our

`og-cs`GitHub project.How does one make a sine wave or sinc pulse in OmniGraffle?

Check out our above referenced

`og-cs`GitHub project.