How to deal with BC and AD dates in Excel or OpenOffice

In the past couple of months, I’ve found myself needing to create timelines and gantt charts that span multiple centuries. Ancient dates aren’t supported by Excel or OpenOffice, so you have to get a little creative. If you only need years, and not month and days, the solution is pretty straightforward:

  1. Enter BC dates as negative numbers, and AD dates as positive numbers.
  2. Select the columns that contain the dates. Right-click, and choose “Format Cells”
  3. On the “Number” tab, choose “Custom,” and type in a number format that adds an AD before the positive numbers and a BC after the negative numbers. In Excel, theĀ custom number format is:
    "AD" #0;#0 "BC"
  4. Create a stacked bar chart. If you want a timeline, the years should be organized in a single row. If you want a gantt chart, the years should be organized as two columns (first column is start date, second column is duration).

The solution to entering dates like April 1, 1692 is a little uglier, since you have to create an extra column, but whatever:

  1. First column, enter in the month, day (and time, if you need to get that specific)
  2. Format the first column as a Date however you like, showing everything except the year. Once you are fine with your date formatting, make a note of the number format code (shown when you click on the Custom option of the Number tab of the Format Cells dialog). For instance, you would note the string “d-mmm” if you decide your month and day should show up as “1-Apr”.
  3. Second column, enter the year as just a number
  4. Third column, use code similar to the following to concatenate the formatted date and year — replacing A1, B1 with cells from the first and second column respectively. Replace “d-mmm” with the string you noted from step 2.
    CONCATENATE(TEXT(A1,"d-mmm")," ",B1)

Formula for plotting a half-circle waveform.

Have you ever wondered what the formula for that thing that looks like a sine wave, but is really just half circles? Well, take a look below for the Matlab code of how to generate and plot such a signal with a particular frequency. If you need help translating to another programming or graphing language, just let me know.

Also, a handy feature of this code is the ability to only plot the first N periods. Take a look! šŸ™‚

Fs = 100;                     % Sampling frequency
T = 1/Fs;
L = 1000;                     % Number of samples
t = (0:L-1)*T;                % Time vector

fs = 1;                       % Frequency of signal.
A = 1;                        % Amplitude of signal.
% Half-circle waveform:
r = 1/(fs*4);
y = (A/r)*1)2*(mod(t,r*4) == mod(t,2*r - 1).*sqrt(r^2 - (mod(t,2*r)-r).^2));

% Regular sine waveform:
y2 = A*sin(2*pi*fs*t);

% Plot the waveforms.
numPeriods = 3;
tEnd = round(numPeriods/(T*fs));
plot(t(1:tEnd),y(1:tEnd),t(1:tEnd),y2(1:tEnd))

 

Notes   [ + ]

How to use Alt+Print Screen with VMWare or VirtualBox on Mac OSX

If you’ve ever had a Windows process or application you were trying to document using screenshots, chances are that you’ve used the Alt+Print Screen shortcut to capture a single window to the clipboard. If you have Windows running on a virtual environment like VMWare or VirtualBox under Mac OSX, you can still use the print screen key. Here’s how:

  1. Go to System Preferences
  2. Click on Keyboard
  3. Check the “Use all F1, F2, etc. keys as standard function keys” box on the Keyboard tab.
  4. Use the F13 key as your Print Screen key, and the option key (alt) for your alt. Ā For example Alt+Print Screen would translate to option+F13

Split one PDF Page into Two Pages

I think I’m going to attempt to make more use of this blog as somewhere to record the cool things I learn. I’m sure at least some of you have had this problem:

  1. You scan in a file two pages at a time.
  2. The pages are a little skewed, but the two pages are skewed a little differently.
  3. OCR doesn’t work too well.

The solution to this problem was found here. In short, you print to PDF using Acrobat. Then, in the print options specify to “Tile Large Pages”. Look at the preview image, and adjust the margins and scaling so the split happens in the appropriate place. Hit print, and save as another file. Then, run OCR on that new file. The pages can then be deskewed separately. PRETTY NIFTY!