Archive for 2006

vimcolor plugin for wordpress

Wednesday, December 27th, 2006

I recently downloaded the vimcolor plugin for wordpress so my code samples could look nice and spiffy, with the syntax highlighting I am accustomed to seeing.

There were of course a few problems. The most notable was some path problems. It was trying to use these values:

I never saw any of these set in any of the configuration files for wordpress, so I just hardcoded in some values that I wanted

There were two other things that I fixed

  1. In order to highlight code, one merely has to put the code in a code block, and set the style, something like this:
    < code type="php">some code here< /code >;

    The problem was that the plugin was specifically looking for type=”[a-z]+”, with the quotation marks as part of the regular expression. I like to use single quotes (don’t have to press the shift key), and this is legal html. So I changed that to allow both single and double quotes, using type=(\’|”)[a-z]+(\’|”)

  2. The other thing I changed was actually just css. The author, whom I tried to track down, but could not, mentioned that he would like a horizonatal scroll bar to appear automatically. This is simply down with the CSS rule overflow:auto;

I hope you enjoy the syntax highlighting as much as I do.

  • FriendFeed
  • Reddit
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • Facebook
  • Fark
  • TwitThis
  • LinkedIn

speech perception, therapeutic ultrasound and detecting land mines

Sunday, December 3rd, 2006

Today was the last day of my first meeting of the Acoustical Society of America. It was actually the 155th meeting of the society, and the 4th joint meeting with the Acoustical Society of Japan. Oh, and it was in Hawaii.

I have been a member of the ASA for several years now, and have read many articles in its journal, but I have not spent that much time reading journals outside of my subfield. There are 13 subfields at each meeting of the society, which also roughly correspond to different topics in the journal. I am most interested in the Speech Communication subfield, and spent the great majority of my time learning about all sorts of interesting research going on in that area. Even within Speech Communication, there is a great diversity. I saw some posters and presentations about lexical access, which I do, as well as posters on developing better cochlear implants, quite a few papers on automated speech recognition, some on clinical applications of phonetics, and a few on using ultrasound to track the movement of the tongue.

In addition to these talks, I also saw a couple in different fields. There were two plenary talks at the beginning of the conference - one Japanese person, and one American. The first plenary, by Masayuki Morimoto, covered a fairly wide range, from architectural acoustics to psychological acoustics. Ultimately, these two are very related. Acoustic engineers are interested in designing buildings with good acoustics, but ultimately, the definition of “good” is dependent upon how humans perceive the acoustics of the space. He talked quite a bit about what types of parameters that one can measure, as opposed to parameters that cannot objectively be measured. Whether a person finds a space pleasing or not is very subjective. Whether a person finds a space ringy or deadening can be quantified though, and depending upon the space, one or the other might be desirable.

The second plenary, by Lawrence Crum, was on a completely different topic - therapeutic ultrasound. I had never really heard about this before. He gave a nice overview of how therapeutic ultrasound works, the history (first used in the 1950’s), and its applications. When we hear ultrasound, we usually think of imaging, and that is correct. Ultrasound imaging (or diagnostic ultrasound), shoots low power, low frequency sound waves into a medium, and registers the time it takes for the waves to bounce back. Objects at different angles and distances will take differing amounts of time to bounce back, and thus one can make an image. Therapeutic ultrasound uses high power, high frequency sound waves, and concentrates the waves at a particular point, much in the way one can use a magnifying glass to concentrate electromagnetic waves (e.g. sunlight) onto a piece of paper and catch it on fire. With very high power sound waves, one can do quite a bit of destruction. Destruction? Yes, destruction. One common application is for breaking up kidney stones — without surgery. Another is killing cancerous tissue, specifically for pancreatic cancer, which is a terrible sort of cancer. Another application is blood clotting (hemostasis).

Many acousticians are concerned about noise. Many speech communication people use noisy conditions to test hearing (including myself), and many are also concerned about trying to reduce noise pollution. I saw several talks about that. David Bowen gave a talk about how to perform acoustic audits for consumer products, mostly by isolating different parts of the product, such as the motor, or a fan, and using different tools to measure the amount of noise it produces. Then one can create a sound profile for the product, and try to reduce the noise through various methods. One example he gave was a copy machine. They swapped the metal chain with a composite chain, and perforated the aluminum frame inside, along with a few other modifications, to reduce the overall noise by about 8 decibels (remember that decibels are on a log scale, so that is actually a fairly large reduction).

One last small note. I did not attend any of these talks, but while reading through the abstract booklet, I noticed that there was a whole session on using acoustics to detect land mines. Talk about a diverse field. I am excited to learn more.

  • FriendFeed
  • Reddit
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • Facebook
  • Fark
  • TwitThis
  • LinkedIn

Nifty Firefox extension - resizable textareas

Wednesday, November 22nd, 2006

I just found a very nifty little Firefox extension that will make all textareas resizable. In case you don’t know, a textarea is a text box that is longer than one line. With this extension enabled, simply hover the mouse over the bottom right corner until the cursor changes, then click and drag until you reach the desired size. Very handy for those times when you want to write a long message, and the website only gives you are very small textarea to do so, which means lots of scrolling.

You can get it here:
Resizable Textareas in Firefox

  • FriendFeed
  • Reddit
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • Facebook
  • Fark
  • TwitThis
  • LinkedIn

web + print frustrations

Tuesday, November 21st, 2006

Sometimes one wants to write a document that can be viewed both in print form and on the web. From my experiences so far, there does not yet exist a good way to do this from one document. I have tried several different methods, each with its own set of complications. I have not given up hope yet. Perhaps someone else can suggest a better method.

Firstly, why would someone want to do this? Well, I think there are a couple times where documents should be available in both formats

  1. Program documentation
  2. Short tutorials
  3. Curriculum Vitae

The last one is what I have been focusing on. Almost all academics have their CV online nowadays. Some have it in html format. Many have it in pdf format, and of course some only have it a terrible format like .doc or something. Personally, if I am going to view a CV online, I prefer it to be in html format. For very complex documents with lots of figures, graphics and such, pdf is usually better. A CV usually is not that complicated though, and it is much nicer to read them in html format. However, if one is applying for jobs (as I am), it is crucial to send a copy of your CV, and this should be either in hard copy or pdf format. Next I will describe the two different approaches I have taken to this conundrum.

starting with latex

As you may have gleaned, I like LaTeX quite a bit. It is quite simple in many ways, yet can also handle some really complicated documents. It produces really nice postscript and pdf files. As I write this, I am printing off a 3′ x 5′ poster that I made with LaTeX (I’ll make a separate post about making posters with LaTeX). LaTeX was designed well before the world wide web existed, so it was not designed with the web in mind. It was designed with print in mind. That being said, there are some packages and utilities that do a decent job of converting LaTeX to html. The two that I have found best so far are latex2html and tex4ht. They both have their disadvantages and advantages

latex2html
This program takes a direct latex to html approach. Essentially it tries to do all the same things standard LaTeX can do, but instead of producing a dvi, it produces html. The drawback from this approach is that it does not always handle all the packages that standard LaTeX does. It also produces some pretty ugly, out of date html. The latest html you can specify is 4.01. This is not very satisfactory if you try to adhere to web standards. It also uses some strange heading code. Using the article class, sections are coded with <h1> tags. Normally h1 is used as the title of a page, and only once, though see this article from A List Apart about why using h1 for the title text may be a bad idea
tex4ht
This program uses an entirely different approach. It acts more like other standard drivers, by converting dvi to html. The advantage of this is that it should work with any LaTeX package imaginable, as long as parseable dvi is still produced. This is nice, but the output is still too focused on print. It defines all sorts of extra classes, and specifies all sorts of font sizes, when this should really be done with CSS.

I recently read a very poorly written article about why to use LaTeX, which spurred me on to write my own, and as a proof of concept, I decided to write it in LaTeX, and convert it to html. I ended up using the tex4ht approach, and then wrote a perl script to clean up some of the code it produced. You can view the article on why to use LaTeX on my University of Michigan homepage

starting with html + css

It is possible to get pretty nice printed output using css today, but there are still some things missing. My wife has also been working on her résumé lately, and one thing I like about hers is that she had a header on each page with her name and info. This seems quite handy. Imagine especially if someone is printing off your CV from your webpage, and the pages get mixed up or something. All of a sudden they lost a page of your CV! That is no good. Using CSS 2.1, the current standard, one cannot specify such things. The same goes for page numbers. Most browsers will let you choose whether you want page numbers or not, but we don’t want to make more work for the user.

CSS 3 offers a glimpse of hope. CSS 3 offers many more possibilities, especially in terms of dealing with alternative media such as print or aural media. Unfortunately, it seems that CSS 3 support is still quite a ways off for most browsers.

Enter Prince.

Prince is a program that implements many features from CSS 3 and is designed to make quality pdf output from xml (or xhtml) documents. It can do some pretty neat stuff. I first learned about it from A List Apart, in an article about printing an entire book with xhtml and css. It has one major drawback though. It is not open-source. In fact it is quite expensive for a normal full license. It does offer a restricted license, which has full functionality but also sticks in a default page about Prince on the first page of your document. So this is not ideal. I have tried it out, and one can see the results of my experiment by looking at my CV
What you get in your browser is the normal stuff. If you click on the button at the bottom you get the nicely formatted version from prince. If you click on the print this page button, you get a very similar version using CSS 2 rules. It is nice too, but lacking the headers and page numbers.

The future

For my dissertation, I am definitely sticking to LaTeX, and will not attempt to convert it to html. I don’t think it is well suited for that. For most of my websites, I will stick to html. For my CV, and other documents for which I want the best of both worlds, I would like to go the LaTeX route, but I think that the tools available need some updating. Maybe I will work on that.

  • FriendFeed
  • Reddit
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • Facebook
  • Fark
  • TwitThis
  • LinkedIn

Extreme TeX

Saturday, November 18th, 2006

While doing some searching around the internet for stuff about LaTeX, I ran across this snippet from a page on latex from stanford

The example is from the infamous David Carlisle, illustrating how much one can automate using TeX (plain TeX, not LaTeX). If you are in for a fun little surprise, copy the text and paste it into a file, then run

tex file
\\let~\\catcode~`76~`A13~`F1~`j00~`P2jdefA71F~`7113jdefPALLF
 PA''FwPA;;FPAZZFLaLPA//71F71iPAHHFLPAzzFenPASSFthP;A$$FevP
 A@@FfPARR717273F737271P;ADDFRgniPAWW71FPATTFvePA**FstRsamP
 AGGFRruoPAqq71.72.F717271PAYY7172F727171PA??Fi*LmPA&&71jfi
 Fjfi71PAVVFjbigskipRPWGAUU71727374 75,76Fjpar71727375Djifx
 :76jelse&U76jfiPLAKK7172F71l7271PAXX71FVLnOSeL71SLRyadR@oL
 RrhC?yLRurtKFeLPFovPgaTLtReRomL;PABB71 72,73:Fjif.73.jelse
 B73:jfiXF71PU71 72,73:PWs;AMM71F71diPAJJFRdriPAQQFRsreLPAI
 I71Fo71dPA!!FRgiePBt'el@ lTLqdrYmu.Q.,Ke;vz vzLqpip.Q.,tz;
 ;Lql.IrsZ.eap,qn.i. i.eLlMaesLdRcna,;!;h htLqm.MRasZ.ilk,%
 s$;z zLqs'.ansZ.Ymi,/sx ;LYegseZRyal,@i;@ TLRlogdLrDsW,@;G
 LcYlaDLbJsW,SWXJW ree @rzchLhzsW,;WERcesInW qt.'oL.Rtrul;e
 doTsW,Wk;Rri@stW aHAHHFndZPpqar.tridgeLinZpe.LtYer.W,:jbye

Happy holidays

  • FriendFeed
  • Reddit
  • del.icio.us
  • Digg
  • Slashdot
  • Technorati
  • Facebook
  • Fark
  • TwitThis
  • LinkedIn