My wife and I recently purchased a new Windows machine running Vista Home Premium. Our goal was to buy a machine to act as a backup location for the contents of our laptops as well as backup and storage for our digital photos and home movies. We also wanted a machine that could record TV programs for us. In short, we wanted a workhorse that would quietly sit in the background and ensure that we never lose anything. I struggled over the purchase because I would rather have a linux box, but given all the variables we were considering we decided Windows was best.
Overall we are happy with the new machine and getting it to work with my wife's laptop running Windows XP has been a breeze. As a few posts to come will show, it was a bit trickier getting files copied over from our old linux desktop and getting my linux laptop able to share with it.
Wednesday, September 19, 2007
Tuesday, September 18, 2007
Text to Postscript: a2ps
Sometimes I need to convert a text file to a postscript file either to print it or to include it in a paper as an eps file. To do this, I use the
If I just want to print a text file for my own viewing, I do the most basic:
This tells
In this next example, I wanted to create an eps file out of some code. I wanted line numbers, no headers, and no borders. I did it using the following:
Not surprisingly,
a2ps command, but as with symlinks, I tend to forget the options. The man page for a2ps is quite useful. Just for fun, I give some examples of how I use a2ps below.If I just want to print a text file for my own viewing, I do the most basic:
a2ps my-file.txt -o my-file.psThis tells
a2ps to take the input file my-file.txt and print it to the ps file my-file.ps. By default, this puts two virtual pages per sheet of paper as well as borders around columns. It also adds header and footer information about the file. If you want to print more virtual pages per sheet, you can add a flag with the number of pages per sheet up to nine. So if you want four per sheet, change the above to:a2ps -4 my-file.txt -o my-file.psIn this next example, I wanted to create an eps file out of some code. I wanted line numbers, no headers, and no borders. I did it using the following:
a2ps code-file --borders=no -B --line-numbers=1 -1 -o output-file.epsNot surprisingly,
--borders=no turns off borders. -B turns off headers. --line-numbers=1 tells a2ps to print every line number. -1 prints a single page per sheet of paper and -o output-file.eps tells a2ps the name of the output file. Obviously, replace code-file and out-put-file.eps with the file names you want. Again, the man pages include useful information about these and other options.
Making Windows a Bit More Linux-like: PuTTY and PSCP
When I'm using a Windows machine, I often need to ssh into a linux box or copy files from a linux box to the Windows machine. Two utilities make this very easy. PuTTY provides a terminal window for ssh'ing into linux machines and PSCP is a Windows version of scp for secure copying. Both can be found here.
When you download them, each comes as a small executable. I tend to leave the PuTTY executable in the directory I downloaded it to and create a shortcut to it on the desktop. Whenever I want to use it, I just double-click the shortcut. I like to put the PSCP executable someplace in the computer's path. Then to use it, I just open an MS-DOS terminal, change to the directory I want to copy to and copy files over with the command:
There's documentation on how to use PuTTY and PSCP here. For PSCP you can also look at the man pages for scp since the usage is the same.
When you download them, each comes as a small executable. I tend to leave the PuTTY executable in the directory I downloaded it to and create a shortcut to it on the desktop. Whenever I want to use it, I just double-click the shortcut. I like to put the PSCP executable someplace in the computer's path. Then to use it, I just open an MS-DOS terminal, change to the directory I want to copy to and copy files over with the command:
pscp remote-linux-box-address:path-to-files .There's documentation on how to use PuTTY and PSCP here. For PSCP you can also look at the man pages for scp since the usage is the same.
Monday, September 17, 2007
LaTeX, BibTeX, and Symbolic Links
The bane of my existence: multiple copies of the same file in different locations on my computer or computers. The copies may be identical or they may be of slightly different versions. I'm notorius for this and it confuses me to no end.
Here's an example: When I write papers, I use a bib file to store the BibTeX entries of my citations. With each new paper, I move the latest version of the bib file to the directory that contains the tex files of the paper and update the bib file with more entries as necessary. The result is that I have multiple versions of the same bib file strewn throughout my home directory.
Until now! In a move that did not take a lot of brain power, I created a directory
Why don't I just put the path to the original bib file into the \bibliography line of my tex file and dispense with the symlink? That would be the most convenient, but it could potentially cause some problems with uploading papers to submission sites. With the symlink, all references in the tex file will be to files in the same directory as the tex file. Therefore, I won't have to change any paths before uploading. The proof of course will be in the pudding. We'll see if this actually works.
Here's an example: When I write papers, I use a bib file to store the BibTeX entries of my citations. With each new paper, I move the latest version of the bib file to the directory that contains the tex files of the paper and update the bib file with more entries as necessary. The result is that I have multiple versions of the same bib file strewn throughout my home directory.
Until now! In a move that did not take a lot of brain power, I created a directory
~/latex/common-files and put my bib file in there. Now each time I create a directory for a new paper, I'll create a symbolic link in that directory to the bib file in my common-files directory. Hence, my last post about symlinks.Why don't I just put the path to the original bib file into the \bibliography line of my tex file and dispense with the symlink? That would be the most convenient, but it could potentially cause some problems with uploading papers to submission sites. With the symlink, all references in the tex file will be to files in the same directory as the tex file. Therefore, I won't have to change any paths before uploading. The proof of course will be in the pudding. We'll see if this actually works.
Symbolic Links
For some reason I have a mental block on how symbolic links work and have to do a Google search every time I want to create one. Maybe if I write a post about it, I'll break the block or at least have a handy reference for when I forget again.
According to Wikipedia, a symbolic link is a special type of file that points to another file. The difference between a symbolic (or soft link) and a hard link, is that if the user removes a symbolic link, the file it points to is unaffected, whereas if the user deletes a hard link, the original is deleted as well. The flip side according to these folks is that with a symbolic link if the original file is deleted, the link file is unusable. With a hard link, if the original is deleted, the link file preserves the data.
So here's how to create a symbolic link:
Replace original_file with the name of the existing file you want to make a link to and replace link_file with the name of the file you want to point to the original file.
According to Wikipedia, a symbolic link is a special type of file that points to another file. The difference between a symbolic (or soft link) and a hard link, is that if the user removes a symbolic link, the file it points to is unaffected, whereas if the user deletes a hard link, the original is deleted as well. The flip side according to these folks is that with a symbolic link if the original file is deleted, the link file is unusable. With a hard link, if the original is deleted, the link file preserves the data.
So here's how to create a symbolic link:
ln -s original_file link_fileReplace original_file with the name of the existing file you want to make a link to and replace link_file with the name of the file you want to point to the original file.
Thursday, August 30, 2007
TeX and LaTeX Cookbooks
Here's a TeX cookbook that I often consult when I can't remember a tex symbol.
A quick Google search for "tex cookbook" or "latex cookbook" points to many similar quick references.
A quick Google search for "tex cookbook" or "latex cookbook" points to many similar quick references.
Friday, August 17, 2007
minipage
I tend to use latex's features on a need-to-know basis, only seeking new ones when there's something I want to do but don't know how. This happened recently with an article I was writing. I wanted to group a number of definitions together in a floating environment with a black box around them. Enter minipage. The minipage environment creates...well, um...a mini page with adjustable height and width within a page. A minipage can have footnotes, figures, the works. In conjunction with the figure environment and a framebox, I used it to create my boxed-in definitions as follows:
\begin{figure}[t]
\noindent \framebox{
\begin{minipage}[t]{1.0\textwidth}
\begin{definition}[Definition 1's Name]
\label{def:mydef1}
My Def text here.
\end{definition}
\begin{definition}[Definition 2's Name]
\label{def:mydef2}
My Def text here.
\end{definition}
\end{minipage}
}
\caption{Some definitions}
\label{fig:mydefs}
\end{figure}
I should probably mention the \noindent. At first, I didn't wrap the minipage within a figure environment, and I found that latex kept indenting the minipage because it was treating it like a paragraph. The \noindent made sure that the minipage was flush with the left margin.
Minipage is more powerful than the above illustrates. For instance, it can also be used to make a single figure out of several smaller figures. Each smaller figure simply gets its own minipage. Consider the following:
\begin{figure}
\begin{minipage}[t]{1.0\linewidth}
\center{\underline{\Large{Some Text}}}
\vspace{.1in}
\end{minipage}
\hfill
\begin{minipage}[t]{1.0\linewidth}
\epsfxsize=4.5in
\centerline{\hbox{
\epsffile{a-figure-component.eps}
}}
\vspace{.15in}
\end{minipage}
\hfill
\framebox{
\begin{minipage}[t]{0.45\linewidth}
\begin{tabular}{l}
Stuff inside the tabular environment
\end{tabular}
\end{minipage}
}
\begin{minipage}[t]{0.55\linewidth}
\epsfxsize=2.3in
\centerline{\hbox{
\epsffile{another-figure-component.eps}
}}
\center{\large{b)}}
\end{minipage}
\caption{Caption Text}
\label{figure-label}
\end{figure}
The above figure utilizes four minipages. The first is the width of the page and consists of some text. The second is also the width of the page and consists of a figure I drew with Xfig. The third minipage is 0.45 times the width of the page and consists of some text in a tabular environment. The fourth takes up the remaining 0.55 of the page width and consists of another figure I drew with Xfig. The result is a single figure with title text at the top and a large figure beneath that. The tabular text and the smaller figure are side-by-side beneath the larger figure. Note that I had to play around with \vspace commands to get the spacing right. A Google search for minipage and latex will unearth many more details.
\begin{figure}[t]
\noindent \framebox{
\begin{minipage}[t]{1.0\textwidth}
\begin{definition}[Definition 1's Name]
\label{def:mydef1}
My Def text here.
\end{definition}
\begin{definition}[Definition 2's Name]
\label{def:mydef2}
My Def text here.
\end{definition}
\end{minipage}
}
\caption{Some definitions}
\label{fig:mydefs}
\end{figure}
I should probably mention the \noindent. At first, I didn't wrap the minipage within a figure environment, and I found that latex kept indenting the minipage because it was treating it like a paragraph. The \noindent made sure that the minipage was flush with the left margin.
Minipage is more powerful than the above illustrates. For instance, it can also be used to make a single figure out of several smaller figures. Each smaller figure simply gets its own minipage. Consider the following:
\begin{figure}
\begin{minipage}[t]{1.0\linewidth}
\center{\underline{\Large{Some Text}}}
\vspace{.1in}
\end{minipage}
\hfill
\begin{minipage}[t]{1.0\linewidth}
\epsfxsize=4.5in
\centerline{\hbox{
\epsffile{a-figure-component.eps}
}}
\vspace{.15in}
\end{minipage}
\hfill
\framebox{
\begin{minipage}[t]{0.45\linewidth}
\begin{tabular}{l}
Stuff inside the tabular environment
\end{tabular}
\end{minipage}
}
\begin{minipage}[t]{0.55\linewidth}
\epsfxsize=2.3in
\centerline{\hbox{
\epsffile{another-figure-component.eps}
}}
\center{\large{b)}}
\end{minipage}
\caption{Caption Text}
\label{figure-label}
\end{figure}
The above figure utilizes four minipages. The first is the width of the page and consists of some text. The second is also the width of the page and consists of a figure I drew with Xfig. The third minipage is 0.45 times the width of the page and consists of some text in a tabular environment. The fourth takes up the remaining 0.55 of the page width and consists of another figure I drew with Xfig. The result is a single figure with title text at the top and a large figure beneath that. The tabular text and the smaller figure are side-by-side beneath the larger figure. Note that I had to play around with \vspace commands to get the spacing right. A Google search for minipage and latex will unearth many more details.
Thursday, August 16, 2007
Banana Bread
If you like banana bread, try the following recipe. It's super-easy and a crowd pleaser, at least among my family and neighbors. My mother used to make it when I was a kid and shared the recipe with me something like 10 years ago. Every time I see my son eat a piece, I'm brought back to my own childhood.
3 ripe bananas
1 cup sugar
1 egg
1 and 1/2 cups all-purpose flower
1/4 cup canola oil
1 tsp baking soda
1/2 tsp salt (I usually just throw in a pinch)
Preheat the oven to 325 degrees Fahrenheit. Put the peeled bananas in a mixing bowl. Beat them with an electric mixer until they are smooth. Add all the other ingredients and beat well. Pour the batter into an oiled loaf pan and cook for 1 hour.
Some serving suggestions: Just plain is great - especially while it's still warm. My son likes it with cream cheese. My mother used to toast pieces and put butter on them.
3 ripe bananas
1 cup sugar
1 egg
1 and 1/2 cups all-purpose flower
1/4 cup canola oil
1 tsp baking soda
1/2 tsp salt (I usually just throw in a pinch)
Preheat the oven to 325 degrees Fahrenheit. Put the peeled bananas in a mixing bowl. Beat them with an electric mixer until they are smooth. Add all the other ingredients and beat well. Pour the batter into an oiled loaf pan and cook for 1 hour.
Some serving suggestions: Just plain is great - especially while it's still warm. My son likes it with cream cheese. My mother used to toast pieces and put butter on them.
Sunday, August 12, 2007
Knitting History Correction
After reading my last post, my wife told me that her memory of my learning to knit differs from mine. As she recalls it, we both felt that our son should have a pair of booties to wear after he was born, but that she did not want to knit them because to do so would conform to too many gender stereotypes. Since I wanted to learn to knit anyway, we decided that I'd be the one to make the booties. Therefore, contrary to what I wrote in my last post, I knit the booties and then knit a hat. Meanwhile, after seeing the booties that I had made, my wife decided to knit a pair too.
The actual story of my learning to knit undoubtedly lies somewhere between my recollection and my wife's. I tend to think my wife's recollection is closer to the truth.
The actual story of my learning to knit undoubtedly lies somewhere between my recollection and my wife's. I tend to think my wife's recollection is closer to the truth.
Sunday, August 5, 2007
Knitting Resources
I thought I'd take a break from computer-ish posts and mention a few knitting resources I've come across. First a bit of my knitting history: My wife taught me to knit because I wanted to make a hat for our son to wear after he was born. Once I had the ins and outs of it, I worked on the hat and then a pair of booties while she knit him an Afghan. Our son just turned three, and my wife and I continue to knit together.
During the last holiday season, my sister bought me a book called Knitting with Balls. It's probably no surprise that this book is directed at men. Although I find its uber-masculine emphasis somewhat ridiculous (does anyone really need a hand-knit beer cozy?), this book has some interesting pages describing the history of men in knitting and some nice, if somewhat difficult to follow, patterns. Note: Some of the patterns in this book have typos in them, and it makes copius use of esoteric abbreviations that require looking up in its glossary. It isn't that hard to figure out what's going on, but if you're like me, it's helpful to have someone nearby that you can ask questions of and tell you how to take out stitches.
Knitting with Balls was written by the man who started the website www.menknit.net which has some useful links and a bit of history about men knitting. Another useful website is www.knittinghelp.com which has free how-to videos. The last website I'll mention in this post is knitty.com, an on-line knitting magazine. I haven't made anything from it, but it has a lot of nice looking patterns.
The only other thing I can think of now is to say that the book, I Can't Believe I'm Knitting, put out by Leisure Arts gives very good instructions on how to get started from casting on, to the different stitches, to casting off.
During the last holiday season, my sister bought me a book called Knitting with Balls. It's probably no surprise that this book is directed at men. Although I find its uber-masculine emphasis somewhat ridiculous (does anyone really need a hand-knit beer cozy?), this book has some interesting pages describing the history of men in knitting and some nice, if somewhat difficult to follow, patterns. Note: Some of the patterns in this book have typos in them, and it makes copius use of esoteric abbreviations that require looking up in its glossary. It isn't that hard to figure out what's going on, but if you're like me, it's helpful to have someone nearby that you can ask questions of and tell you how to take out stitches.
Knitting with Balls was written by the man who started the website www.menknit.net which has some useful links and a bit of history about men knitting. Another useful website is www.knittinghelp.com which has free how-to videos. The last website I'll mention in this post is knitty.com, an on-line knitting magazine. I haven't made anything from it, but it has a lot of nice looking patterns.
The only other thing I can think of now is to say that the book, I Can't Believe I'm Knitting, put out by Leisure Arts gives very good instructions on how to get started from casting on, to the different stitches, to casting off.
Wednesday, August 1, 2007
McAfee Update killed Internet Explorer
One of our computers runs Windows. After downloading an update from McAfee this morning, its Internet Explorer stopped being able to connect to the Internet. After some searching, I found an announcement on McAfee's Technical Support page. (For some reason the announcement did not show up the first time I looked at the page, but after refreshing the page, it showed up.) The announcement includes instructions on how to correct the problem. The fix requires you to uninstall and reinstall McAfee which is time consuming, but not difficult.
AUCTeX - Another geeky post
This one is for anyone who uses Emacs and Latex to write papers. On and off for a few years, a colleague of mine touted the wonders of AUCTeX. He said that it would save me oodles of time. Not unlike my initial reaction to Xfig, I dismissed AUCTeX as not being worth the effort to learn how to use. I was wrong. I started using it seven and a half months ago, and I love it. It has saved me oodles of time, and it adds an element of fun to writing papers which is always welcome.
Thanks to AUCTeX, I no longer need to interrupt the flow of writing to enter "latex my-paper.tex" in a terminal window. C-c C-c runs latex right from Emacs. It also keeps track of the state of the document. In other words, the first time you type C-c C-c it runs latex. The mini-buffer will then tell you to do it again if you need to run BibTeX to get your citations right. It will then keep telling you to do it again to run latex to get the references right. When all references are in order and you haven't made any changes since the last latexing, C-c C-c starts up an external viewer so that you can view the dvi file (or the PDF if you're running it in pdfmode - yes, it can run pdflatex instead of latex if you want it to).
Try it. It's great.
Thanks to AUCTeX, I no longer need to interrupt the flow of writing to enter "latex my-paper.tex" in a terminal window. C-c C-c runs latex right from Emacs. It also keeps track of the state of the document. In other words, the first time you type C-c C-c it runs latex. The mini-buffer will then tell you to do it again if you need to run BibTeX to get your citations right. It will then keep telling you to do it again to run latex to get the references right. When all references are in order and you haven't made any changes since the last latexing, C-c C-c starts up an external viewer so that you can view the dvi file (or the PDF if you're running it in pdfmode - yes, it can run pdflatex instead of latex if you want it to).
Try it. It's great.
Vector Drawing Program - Xfig to the Rescue
For years, I looked for a good drawing program for Linux to create figures for articles, but each one I tried seemed to be missing some feature I wanted. For some reason, though, I always avoided Xfig. Its interface looked so clunky and the learning curve seemed so high. Then a few weeks ago while revising an article, I tried it out of desperation. Well, Xfig is great. It does everything I want and a number of things that I didn't even know I wanted, but that now I can't imagine living (or at least drawing) without. So if you're looking for a good Linux based drawing program give it a try.
Tuesday, July 31, 2007
Laser Printer Health Risk
I just read this article. Perhaps it's time to retire our twelve year old HP.
Tuesday, July 24, 2007
Utility
This is my first post. I've never blogged before. In fact I've been resistant to the whole idea. Yet, here I am. I was looking for an easy way to share the little bits and pieces of useful and not so useful information that I come across from time to time and a blog seemed like an easy way to do it. We'll see if it produces any utility.
Subscribe to:
Posts (Atom)