Latex symbol references

January 5th, 2012

Here’s an incredibly comprehensive list of potential Latex symbols.  If that doesn’t work out, you can try this cool tool that tries to identify the symbol as you draw it: http://detexify.kirelabs.org/

Creating diagonal fill swatch in Illustrator

November 18th, 2011

I recently wanted to fill a shape in Adobe Illustrator with diagonal lines.  I thought there would be a simple swatch I could use as a fill pattern, but for some reason, a basic diagonal line pattern isn’t included.  Fortunately, I found the following, very helpful, directions:

http://bchavez.bitarmory.com/archive/2007/10/21/how-to-create-tile-perfect-diagonal-lines-in-illustrator.aspx

To summarize:

  1. Turn on the grid and turn on snap to grid.
  2. Draw a diagonal line that’s slightly larger than a major grid square.
  3. Select Transform->Move… and put in ~12px.  Click the copy button/checkbox.
  4. Hit Ctrl-D repeatedly, until you’ve covered an entire major grid square.
  5. Select all of the lines and choose Object>Path>Outline Stroke .
  6. Draw a square the size of a major grid square (72 px) on top of the lines.
  7. Select everything and click “Divide” in the “Pathfinder” palette (shares with the Transform palette).
  8. Ungroup the objects and delete the lines that extend outside the box.
  9. Select the square of lines that remain and drag and drop them in the Swatches palette.
  10. To do other fancy things with the lines (e.g., add a gradient), Select PathFinder->Merge.  The Ungroup, PathFinder->Add Shape Area and click Expand.

Latex: Controlling vertical spacing in a tabular environment

November 14th, 2011

When working in a tabular environment, you may occasionally want a bit of extra space (or perhaps a little less space) after a line.  You can use \\ to add an entire new line, but sometimes that’s just too much space!  Instead, you can follow your line with a measurement in brackets, e.g.,

\begin{tabular}

This \=is the first line \\ [5 mm]

\>This line is the second line. \\

\end{tabular}

Upgrading WordPress via Apt-Pinning

July 23rd, 2011

In WordPress, I was unable to upload files from my computer to accompany a post.  Clicking the “Upload” button produced no reaction.  According to this support forum:

http://wordpress.org/support/topic/25-imagemedia-uploader-problems?replies=1

It’s most likely because the latest version of Flash only works with WordPress 2.7+ and I had 2.5 installed.

However, I’m still running Debian lenny, so the latest stable version of WordPress is 2.5.  To convince aptitude to install a newer version, I followed the helpful instructions at:

http://jaqque.sbih.org/kplug/apt-pinning.html

To summarize, I added the following lines to /etc/apt/sources.list

#Testing
deb http://ftp.us.debian.org/debian testing main non-free contrib
deb http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free

#Unstable
deb http://ftp.us.debian.org/debian unstable main non-free contrib
deb http://non-us.debian.org/debian-non-US unstable/non-US main contrib non-free

I then create an /etc/apt/preferences file that contained:

Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=testing
Pin-Priority: 650

Package: *
Pin: release a=unstable
Pin-Priority: 600

I preemptively created a file /etc/apt/apt.conf.d/90cachelimit and added the following line:

APT::Cache-Limit "8388608";

It turned out to be too small, but adding a zero at the end did the trick!

I ran:

aptitude update

Once it finished, I ran:

aptitude install wordpress

which upgraded me to 3.0.5.

Page breaks, URLs, and the hyperref package

June 8th, 2011

With Latex’s hyperref package enabled, if a URL splits across a page break, you’ll get:

pdfTeX error (ext4): \pdfendlink ended up in different nesting level than \pd

fstartlink.

\AtBegShi@Output …ipout \box \AtBeginShipoutBox

\fi \fi

You can add the [draft] option to the hyperref package, i.e.,

\usepackage[draft]{hyperref}

to figure out which URL is causing the problem and then tweak spacing to try to solve the problem.  You can also try putting the URL in a box (though this will prevent line breaks).

Secure hard-drive erasure

May 1st, 2011

To delete a file securely, the Linux tool “shred” appears to be a popular choice.  To erase an entire disk, however, it appears to be more straightforward to use the disk’s secure erase facility.  To do so, boot into a Live CD and run (where sdx is replaced with the drive you wish to erase):

sudo hdparm -I /dev/sdx

Confirm that security is listed as “not enabled” and “not frozen”.  Set a temporary password with:

sudo hdparm –user-master u –security-set-pass <your_temp_password>/dev/sdx

Assuming that succeeds, run:

sudo hdparm –user-master u –security-erase <your_temp_password>/dev/sdx

Warning! There is no confirmation prompt!  Be very sure about what you’re doing before you enter that command.  Now go fix a meal, or go to sleep.  The erase process is slow.  It took 38 minutes for my 40 GB drive and over an hour for my 200 GB drive.

See this site for more details: http://www.ocztechnologyforum.com/forum/showthread.php?76612-Secure-Erase-From-Within-Linux-For-Windows-Users

Diagnosing hard drive problems on a MacBook Pro

May 1st, 2011

My laptop started performing badly lately.  In the middle of non-CPU intensive operations, it would seize up, to the point of interrupting iTunes.  This happened in multiple applications.  Looking in the “All Messages” section of Console (in Applications->Utilities), I saw a number of messages from the kernel with “disk0s2: I/O error” and “disk2s2: 0×5 (UNDEFINED)” entries that seem to correlate with the poor performance.

I was also unable to successfully run a TimeMachine backup.  Console had a number of messages to the effect of “Error: (-36) SrcErr:YES Copying file1 to (null)”, “Error: (-36) SrcErr:NO Copying file1 to file2″ or “Error: (-8062) SrcErr:NO Copying file1 to file2″.  The first batch of files concerned a file in my Firefox profile, so I deleted it.  The second involved index files for Mail.

As steps in the diagnosis, I tried using the “Verify Disk” and “Repair Disk Permissions” buttons in Disk Utility.  The former didn’t find any problems.  The latter did, but repairing them didn’t seem to fix things.  I rebooted with my Mac OS X 10.5 DVD in the drive and held the Option/Alt key to boot into the installer on the DVD.  From there, I could run Disk Utility again, this time with a “Repair Disk” option.  This had no effect.  I rebooted again and held “d” this time, which launched the Apple Hardware Test utility.  I ran it in the extended mode.  It seemed to primarily test the system memory, and it didn’t report any errors.  I also installed and ran the SMARTReporter App which indicated no SMART errors, even after running the self-test (short version).

I found a thorough troubleshooting guide for Time Machine here: http://web.me.com/pondini/Time_Machine/Troubleshooting.html but none of the suggested steps helped.

I took the laptop to the Apple Store where they ran their own SMART utility, which reported 10 sectors with pending failures, and some other error messages I couldn’t parse quickly enough.  I’ll be replacing the drive with a new one.  This experience certainly decreases my faith in the SMARTReporter app, and emphasizes the importance of frequent backups.

Debugging #define macros in Windows drivers

April 22nd, 2011

When you have many levels of #define macros, it can sometimes be difficult to understand what the compiler is complaining about on a particular line.  Often, looking at the source code after the preprocessor has run can help alleviate this confusion.  To do this when building a Windows driver, first look in the buildchk_win7_x86.log file (or the appropriate build log for your build environment) and find the compile line that invoked the compiler (cl).  It may span several lines.  Reassemble it into a single line and add a /P.  Run the command, and it should produce a source.i file, where source.{c,cpp} was the file you were compiling.  The .i file contains the results of applying the preprocessor.

Debugging the Windows kernel over serial cable

April 16th, 2011

This site details the steps needed to prepare the debugee:

http://msdn.microsoft.com/en-us/windows/hardware/gg487520

In summary, you need to:

  • Start an admin cmd prompt
  • Use bcdedit /debugsettings to manipulate the parameters for the serial port.  In my case, the defaults were fine.
  • bcdedit /copy {current} /d DebugEntry
  • Copy the guid string generated above (referred to as newID below)
  • bcdedit /displayorder {newID} {current}
  • bcdedit /debug {newID} ON
  • bcdedit /default {newID}

On the debugger machine, start WinDbg.  Use File->Kernel Debugging.  Specify the com port, uncheck “pipe”.

Starting Wireshark

March 14th, 2011

To see all of your network interfaces, wireshark needs root privileges.  However, running it via sudo wireshark doesn’t work, since root doesn’t have a connection to the display manager.  The fix is to use gksudo wireshark.