tag:blogger.com,1999:blog-71997631408866896782024-03-18T23:21:27.217-04:00Pobot timeMistakes I make while doing scienceAlexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-7199763140886689678.post-44348329604699247122012-08-07T17:36:00.002-04:002012-08-07T17:36:37.556-04:00TeX Stack Exchange: preview-latex does not function<p>I have previously mentioned <a href="http://pobottime.blogspot.com/2010/11/allow-me-to-recommend-auctex-preview.html">Preview-Latex and AUCTeX</a>. I was trying to set it up on the work computer, but the previews weren’t showing up properly. I thought I had had the problem before, but it was a different problem. This <a href="http://tex.stackexchange.com/questions/30199/preview-latex-does-not-function">TeX Stack Exchange question</a> had the answer, though: disable SAFER for Ghostscript. I do not know why this works.</p>Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-19388175544724288672011-12-14T11:26:00.001-05:002011-12-14T11:28:23.517-05:00Allow me to recommend latex-diff and latexbatchdiff<p>I do almost all of my technical writing in LaTeX, and I do revision control on everything with git. Unfortunately, tracking changes in revisions is very difficult in LaTeX. Maybe I make a change to a single word in a paragraph: a naive diff on the .tex file shows the entire line as being changed, and, even worse, then I just have the diff as plaintext, not something I could show a non-LaTeX user.</p>
<p><a href="http://www.ctan.org/tex-archive/support/latexdiff">latexdiff</a> is able to overcome this, automatically generating indications of changes, like Word’s change tracking system: new words show up as blue and underlined, deleted text is red and crossed-out. (How the changes are indicated is configurable, with several default styles to try.) latexdiff has two shortcomings, though. First, if I’m using version control to manage revisions, I have to manually save old .tex files off to the side so that latexdiff can find them. Second, latexdiff only works on single-file LaTeX documents. I like to put each section in its own file.</p>
<p><a href="http://eothred.wordpress.com/2010/11/07/latexdiff-and-git/">latexbatchdiff</a> fixes both of these things. I just typed,</p>
<pre><code>latexdiff-git 1ca0 head.tex abstract.tex acknowledgments.tex\
introduction.tex methods.tex results.tex conclusion.tex
</code></pre>
<p>and it generated a marked-up PDF. (1ca0 is the start of a SHA for a previous revision.) It’s fantastic.</p>Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-87125901358790030702011-04-01T12:49:00.000-04:002011-04-01T12:49:29.009-04:00On “Antedisciplinary” ScienceIn PLoS Computational Biology, Sean R. Eddy wrote a Perspective, ["Antedisciplinary" Science](http://www.ploscompbiol.org/article/info:doi/10.1371/journal.pcbi.0010006), on how to think about emerging interdisciplinary fields in science. In particular, he is concerned with the rising expectation that research groups have members from distinct disciplines, say a team with a biologist, a computer scientist, and a physicist. He contends that, in many cases, it is more effective to have teams of generalists. This is important to me because I feel like my job is a combination of numerical analysis, mechanics, computer programming, and biology: I think this is awesome. I get bored easily, and I'm delighted that I have a job in which I get to do a lot of complementary things.Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-28227367402849428442010-11-05T16:34:00.001-04:002010-11-05T16:42:14.200-04:00Allow me to recommend AUCTeX, preview-latex, and Vincent Goulet's Emacs for OS X Modified<p>
I am wanting to start typesetting my articles in LaTeX rather than using Pages+Endnote+Mathtype or, worse, Word. I don't like the LaTeX writing process of write, run LaTeX, run LaTeX again a couple of times to get the equation numbering correct, convert the dvi to a pdf, open the pdf, find a typo in an equation, cry, go to the bathroom, make a cup of tea, write some more. <a href="http://www.gnu.org/software/auctex/index.html">AUCTeX</a> is a package for Emacs that makes it easier to write LaTeX with handy keyboard shortcuts and syntax highlighting, for example. Most notably, AUCTeX comes bundled with a tool, preview-latex, which presents rendered math equations in-line.</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.gnu.org/software/auctex/img/preview-screenshot.png" imageanchor="1" style=""><img border="0" height="380" width="389" src="http://www.gnu.org/software/auctex/img/preview-screenshot.png"></img></a></div>
<p>
This requires a GUI-enabled Emacs. On the Mac, Cocoa Emacs is the most current. Vincent Goulet has prepared a special build of Cocoa Emacs, <a href="http://vgoulet.act.ulaval.ca/en/ressources/emacs/mac">Emacs for OS X Modified</a>, which includes AUCTeX as well as ESS and psvn if you're interested in those, too.</p>
<p>I don't know if this is a common problem, but for my installation, preview-latex didn't work properly until I disabled TeX-PDF-mode by C-c C-t C-p or adding (TeX-PDF-mode nil) to my .emacs file. I got the idea from this <a href="http://email.esm.psu.edu/pipermail/macosx-emacs/2008-November/001086.html">mailing list discussion</a>.</p>Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-48979179220409822802010-05-31T14:50:00.000-04:002010-05-31T14:50:28.674-04:00Allow me to recommend Cyberduck<div class="separator" style="clear: both; text-align: center;"><a href="http://cyberduck.ch/" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://media.cyberduck.ch/img/cyberduck.icon.png" /></a></div>Price: Free<br />
<br />
<a href="http://cyberduck.ch/">Cyberduck</a> is a reliable, easy-to-use FTP, SFTP, S3, etc. browser for OSX. And you get a cute rubber duckie in your dock! I used to use <a href="http://rsug.itd.umich.edu/software/fugu/">Fugu</a>, and I find Cyberduck to be much more pleasant.Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-88047248034265201992010-05-23T20:27:00.000-04:002010-05-23T20:27:20.963-04:00BuzzCheck out my <a href="http://www.google.com/profiles/Alex.Szatmary" rel="me">Buzz</a> profile.Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-49759100595555039022010-05-20T23:58:00.000-04:002010-05-21T00:06:53.958-04:00Most confusing chart of the dayThe most confusing chart of the day award goes to:<br /><div class="thumbnail"><a href="http://skitch.com/alexszatmary/dr1g8/ide-orientation-development-in-thermotropic-liquid-2004.pdf-page-4-of-6"><img src="http://img.skitch.com/20100521-eim5c2a36w3kgw8rw7r2ass9kc.preview.jpg" alt="Ide Orientation development in thermotropic liquid 2004.pdf (page 4 of 6)" /></a><br /><span style="font-family: Lucida Grande, Trebuchet, sans-serif, Helvetica, Arial; font-size: 10px; color: #808080">Uploaded with <a href="http://plasq.com/">plasq</a>'s <a href="http://skitch.com">Skitch</a>!</span></div><br />from Ide and Ophir. Orientation development in thermotropic liquid crystal polymers. Polymer Engineering and Science (2004) vol. 23 (5) pp. 261-265. Depicted are three values (tensile modulus, tensile strength, and area reduction) for five datapoints. Three scales appear on two y-axes. I think that this plot means that the tensile modulus for the extrudate decreases with increasing shear rate; I'm not sure why I should care about the other two variables because they don't look like they change very much, but it's hard to tell, because they are also on a smaller visual scale than the tensile modulus.Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com1tag:blogger.com,1999:blog-7199763140886689678.post-82591844809341282982010-05-13T17:48:00.000-04:002010-05-13T17:54:16.122-04:00Pages' proofreading<div><div>In Episode 5 of the <a href="http://macpowerusers.com/">Mac Power Users</a> podcast, <a href="http://macpowerusers.com/2009/06/mpu-005-word-processing-and-writing/">Word Processing and Writing</a>, David and Katie point out the proofreading feature in Pages. Like in Word, and in all native Mac programs, misspelled words have red underlines. Word also has a grammar check, the green squiggly underline, which I've grown accustomed to ignoring; it consistently has worse grammar than I do. Today, as I was writing an article, I looked for Pages' green proofreading marks, and it made some suggestions:</div></div><div><ul><li>in terms of: Wordy in certain contexts. Consider simplifying with 'with', 'for', or 'of'.</li><li>"this same": Redundant expression. Consider deleting 'same'.</li><li>"for the purpose of": Wordy expression. Simplify by replacing with 'to' and an infinitive verb.</li><li>relative to: Wordy expression. Consider rephrasing with a more precise preposition.</li><li>"in general": Stock phrase. Use sparingly.</li></ul></div><div>I pasted my troublesome phrases into Word. It didn't catch any of these. Pages' proofreading is one of the most thoughtful features I've seen in software.</div>Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-72511806130529062942010-05-12T15:24:00.001-04:002010-05-19T19:13:39.721-04:00Chrome download bar interface failI love <a href="https://chrome.google.com/">Chrome</a>, but it annoys me in one small, pedantic way: the download bar. Whenever a file is downloaded, a bar pops up at the bottom of the screen. The only way to close the bar is to click on a tiny button on it. There's no keyboard shortcut. There's no way to disable it. There's no way to make it disappear once a download is completed. I googled for a solution.<div><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAq0nJ4XnfPkOvlwFBN3X3nLgQvMQQ7AC2sfS0gBJh-pNbWsSBFQOrLGh_PCKjmr-KHYyLSrtU_OMuha91QRqFGmlm0Al1U1lMqVvVifYdj2d9LS6xIRGj6fF7xqcemhEi90FBMc0_meb9/s320/Chrome_download_bar_sucks.png" style="cursor:pointer; cursor:hand;width: 320px; height: 90px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5470467504655632386" /><br />The top hit for "Chrome download bar" is "Removing the download bar?". Ouch.</div>Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-77093673589276988492010-05-10T15:27:00.000-04:002010-05-10T15:34:15.931-04:00Allow me to recommend TextExpander and DropboxI'm fond of <a href="http://www.smileonmymac.com/TextExpander/">TextExpander</a>; some people rave about it. I think it's handy, I can type "ttel" and TextExpander turns that into my phone number; I have other snippets for my websites, email addresses, and I've imported some libraries with HTML tags and autocorrections for common typos. It's handy.<div><br /></div><div>I have a byzantine, quintuple-redundant backup system, with a Time Machine backup in my lab, a clone of my hard drive at home, two daily Flash stick backups, and a <a href="http://www.dropbox.com">Dropbox</a> backup. Dropbox gives me 2 GB of storage for free; there are paid plans for more space, but I don't worry about that, I just use Dropbox to back up my most important files and settings. Dropbox is an application you can install on all of the computers you use, and it will sync a folder across the cloud, so you have access to all of your stuff everywhere. I just use it as an extra backup.</div><div><br /></div><div>Anyway, today, I noticed that my TextExpander snippets had disappeared, I don't know what happened. I went to <a href="http://www.dropbox.com">dropbox.com</a>, found my TextExpander settings, clicked Previous Versions, picked a working copy of my settings from a couple of days ago, clicked Restore, and immediately TextExpander was working again. TextExpander is a handy program that gets bonus points for having an open way of storing its settings, so that it's easy to back up and throw around. I'm shocked by how well Dropbox's version control worked.</div>Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-68972913175801555142010-04-13T23:57:00.000-04:002010-04-14T10:18:18.203-04:00iWork Numbers Automator Actions to import textI love <a href="http://www.apple.com/iwork/">iWork</a>, especially <a href="http://www.apple.com/iwork/numbers/">Numbers</a>; good golly, does Office suck on the Mac. iWork isn't up to speed, yet; notably, Numbers is horrible at importing text and formatting it into spreadsheet cells in a sensible way. Here are some OS X services that I made with Automator that are helpful for me.<br /><br />As near as I can tell, the only way for Numbers to import plaintext table data is as a CSV file. The file needs to be comma-delimited, and ending in a .csv extension. I often want to grab data from the terminal, though. The <a href="http://dl.dropbox.com/u/1324625/Import%20CSV%20Text%20To%20Numbers.workflow.zip">Import CSV Text To Numbers</a> Service takes selected comma delimited text and pops open a new Numbers document with it. The <a href="http://dl.dropbox.com/u/1324625/Import%20Whitespace%20Text%20To%20Numbers.workflow.zip">Import Whitespace Text To Numbers</a> Service does the same, with whitespace delimited text. You can install these services by extracting them from the .zip files and moving them to your ~/Library/Services directory.<br /><br />Note 1: For both of these Services, a scratch file is generated. A dialog box will pop up, asking to delete the scratch file. Only click OK once the file has finished loading.<br />Note 2: These Services operate on blocks of text, not text files; you can open a file and select the text you want imported to Numbers, that works fine.<br />Pedantic note on Import Whitespace Text To Numbers: This works via the sed command<br /><span class="Apple-style-span" style="font-family:'courier new';">sed -E 's/^[[:space:]]+//;s/[[:space:]]+/,/g'<br /></span>which actually takes all blocks of whitespace and converts them to commas. The file is then saved as a .csv, and is opened by Numbers. This means that any commas in the source text will be treated as delimiters, as well.<br /><br /><a href="http://dl.dropbox.com/u/1324625/Import%20CSV%20Text%20To%20Numbers.workflow.zip">Import CSV Text To Numbers</a><br /><a href="http://dl.dropbox.com/u/1324625/Import%20Whitespace%20Text%20To%20Numbers.workflow.zip">Import Whitespace Text To Numbers</a>Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com1tag:blogger.com,1999:blog-7199763140886689678.post-58539340956655403442010-01-20T15:48:00.001-05:002010-01-20T15:48:50.788-05:00control-z bgI guess I've been writing simulations for half my life. I was eleven or twelve when I first started meddling with QBASIC. My dad would bring a laptop home from work, an old notebook with a monochrome screen and a trackball. Since it was a work computer, we weren't allowed to install any games on it, but it had QBASIC, so I figured I could write my own. It turns out that writing computer games isn't as fun as playing them, but I started programming, anyway; it's fun!<br /><br />When I was sixteen, I started working at a particle accelerator lab with the Army Research Lab. It wasn't a huge Fermilab kind of thing, our accelerator was a small, linear thing. We'd shoot ion beams at materials to see what would happen. I wrote a little QBASIC program to help design ion beam sweep patterns that would leave even coatings.<br /><br />Later, my boss wanted me to analyze some data from a simulation. I spent the summer learning C so that I could write code that would do all sorts of things with the data. It was my first time using Unix; I was using an old SGI box.<br /><br />Unix is paralyzingly unintuitive, and this machine didn't have a neat desktop environment installed. It was running X and some sort of window manager, but not much else. I had to work mostly from the command line. A command line is a sort of typewriter way of interacting with the computer; you type a command and hit enter, and the computer types something, giving you the information you asked for, for example, and then you can type again. When you start a program that runs in a window, I was using an application called nedit, the computer locks the command line. I couldn't type anything else! I felt panicked! My boss taught me: hit control-z to interrupt the program. That stops the program, so you then use the command bg (for background) to start the process up again.<br /><br />This is the sort of thing that most people never need to know, but that Unix users have to do every day; at the time, it seemed like I was doing really fancy geeky stuff.<br /><br />My boss introduced me to other things, Unix and Mozilla (that was before it was Firefox).<br /><br />In grad school, I've done computational research; I use fancy numerical methods to study how fluids interact with membranes on the micro-scale. I've written code to run on clusters of computers, I've re-worked a couple of things in the code that solve partial differential equations.<br /><br />Today, I installed a program, <a href="https://wci.llnl.gov/codes/visit/home.html">VisIt</a>; it makes pictures of simulation data. I mostly use programs I can start up by typing a few things, and leave them running on a server; I download the data and look at it with Matlab. VisIt popped up a little window. I hit control-z bg.Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0tag:blogger.com,1999:blog-7199763140886689678.post-63988091100074648742009-08-25T00:17:00.000-04:002009-08-25T00:19:06.408-04:00Numerical modeling and computer programming are different jobs, sort ofI write in Fortran. Fortran is basically not taught in schools anymore, nor should it be. It's an ugly, outdated, backwards programming language. My code has a two-dimensional array called number (hint: everything in my code is a number). It's barely commented. There are redundant subroutines that do subtly different things that should probably be combined.<br /><br />There are no buttons or widgets or dialog boxes. There isn't a prompt you can type things into. It doesn't even have a command-line interface. To run the code with a different set of values involves editing Fortran source code and recompiling. The code is its own user interface.<br /><br />My friends in computer science hear about this and shudder and moan and gnash their teeth. I did, too, when I started my job, because, unlike most mechanical engineers, I have read a lot of books on how to program properly. I read a lot of articles about coding standards. I've gotten red in the face over how curly braces should be used in C. According to Good Programming Practice, my code I use for my research is backwards, barbaric, and ugly. It's like your racist uncle.<br /><br />The code is exactly how it should be.<br /><br />Research code is completely different from commercial code. I scrawl out notes to my roommate telling him yes-I-know-I-left-a-pile-of-dishes-in-the-kitchen-I'll-get-to-them-soon-honest-I-promise, but spend weeks revising material to be published. Research code, designed for a small handful of technical, intelligent, skilled people who want data right now, I mean now! Commercial code, used by thousands, needs to be less buggy, run on different systems, and be maintainable. It at least needs an interface.<br /><br />At least, that's what I was told after I started doing graduate research in numerical modeling. That's what everyone tells you to do. I have one professor who joked about how you never read manuals, you just copy-and-paste your old code. There are places in my code where I have a list of if statements where I should use a select case instead, and didn't, because it was easier to write a few extra lines of code than to turn around and pick up the manual.<br /><br />I'm starting to reconsider this school of thought, though. I started to think that research code should meet a higher standard when I got frustrated, recently.<br /><br />In my code, I simulate fluid-structure interaction. For my research, I look at capsule dynamics, that is, the physics of elastic membranes in fluid flows—think balloons. I had been looking at test cases involving one capsule, and for me to look at two, that would mean copy-and-pasting the initialization for the first capsule, changing the code that tells the second capsule where to go. I also need to change array sizes everywhere in the code.<br /><br />I'm fed up with code that's obnoxiously difficult to work with. It stifles creativity and innovation. Even if I'm the only person who will ever see my code, I'm going to start writing good code. I have a rigid testing protocol, starting now. I'm using version control several times a day, rather than a couple of times a month. I'm writing documentation. I'm making a total overhaul to the code. <br /><br />I think I might write a version of the code in C++ because Fortran sucks and. I haven't written C++ since I was seventeen, and I work on Fortran every day. Last week, I decided to play with some old code and in minutes I fixed a seven year old bug in some linked list code I'd written for practice. C++ just makes a lot of sense, and Fortran doesn't.Alexhttp://www.blogger.com/profile/03722157675784558619noreply@blogger.com0