Showing posts with label Wiki. Show all posts
Showing posts with label Wiki. Show all posts

Wednesday, January 17, 2007

Wiki Spam II

The preceding flurry of posts was brought on by the imminent demise of my Columbia student account, my inability to get the PHP-based PmWiki working on the NYU servers, and my realization that all of the code supporting community editing of this stuff was a waste of bits. Whereas this blog is the most parsimonious use of bits imaginable. Have a nice day.

Printing LNCS format PDFs

(Non-academics: just scratch your head and walk away...)

[UPDATE 4/15/2008] I've created a shell script that simplifies the process described below: it takes an LNCS-formatted PDF or Postscript file and generates a 2-up Postscript using acroread (for PDF inputs) and pstops. Download here. Note: The script will probably have to be tweaked for system-specific pstops settings, as below.

[UPDATE 3/12/2007] The right parameters for this turn out to be a constantly moving target. Here's the command that currently works best for me on Ubuntu Gutsy:

pstops '2:0L@.8(8.5in,-.25in)+1L@.8(8.5in,4.5in)' lncsdoc.ps lncsdoc.2up.ps


So you can make up your own mind whether I'm crazy for giving this any though at all, here's a comparison on a paper I just happen to be reading today.

Standard LNCS format (2 pages):

Those are (approximately) 2 inch margins and a 12+ point font. (The copyright notice eats into the bottom margin a bit at left, but it's not present past page one.)

Using GNOME/Evince standard "Pages per side: 2" print option:

Look at that gutter! The bottom margin is more than 3 inches.

Using acroread -toPostScript and the above pstops command:

Better...

It's totally not worth it, is it?
[/UPDATE]

[Editor's Note] This is old material imported from my now-defunct Wiki

LNCS format papers from SpringerLink have always been a frustration to me. They are an odd digest size (not letter, A4, or A3, AFAIK) with wide margins. Printing them 1-to-1 on letter paper is a waste---the font blows up to almost 14 points with 2 inch margines. Printing them naively 2-to-1 landscape letter makes the font too small and the margins too big (especially down the middle).

I just spent a few minutes hacking up a solution with pstops (part of psutils). Here it is:

acroread -toPostScript -size letter \
lncsdoc.pdf
pstops '2:0L@.7(8in,0)+1L@.7(8in,5in)' \
lncsdoc.ps lncsdoc.2up.ps
ps2pdf lncsdoc.2up.ps lncsdoc.2up.pdf

I've tested this on a few papers and it seems to work.

Caveats: It might generate sub-optimal or even broken Postscript (Acrobat Reader seems less happy with the final PDF than it is with the original, maybe just because there's twice as much PS data on each page). The file lncsDoc.2up.ps doesn't have the right size and orientation parameters in GhostView. The parameters to pstops may be installation-specific.

For the pstops-curious, the second command does the following:

2: - groups the input pages by twos
0L - takes the first page of each pair and rotates it left
@.7 - then scales it down by 0.7
(8in,0) - then moves it 8 inches down (the point of rotation seems to be the lower left corner, meaning without translation, the rotated (logical) page is no longer on the (physical) page)
+1L - takes the second page of each pair and rotates it left
@.7 - then scales it down by 0.7
(8in,5in) - then moves it 8 inches down and 5 inches across (I guess the left/right pages start from the same point!)

Modifications to the scaling factor and translation are all that should be necessary for personal taste/local compatibility.

Alternative One-liner

cat lncsdoc.pdf | \
acroread -toPostScript -size letter | \
pstops '2:0L@.7(8in,0)+1@.7L(8in,5in)' \
> lncsdoc.2up.ps

Caveats: The generated PS file doesn't work with ps2pdf, for some reason. It also didn't print the last page, when I used lpr on it. It looks like somehow the PS file doesn't get properly closed off. Suggestions are welcome.

Alternative Non-Adobe Solution

The following works, but produces awful screen output. I guess pdf2ps doesn't get the right fonts or something. It also has the wrong orientation in both GhostView and Acrobat Reader.

pdf2ps lncsdoc.pdf lncsdoc.ps
pstops \
'2:0L@.85(7.75in,0.5in)+1L@.85(7.75in,5.5in)' \
lncsdoc.ps lncsdoc.2up.ps
ps2pdf lncsdoc.2up.ps lncsdoc.2up.pdf

I'm not sure if pdf2ps is a standard utility or just some random thing I downloaded (from here for example). It boils down to the following:

gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite \
-sOutputFile=lncsdoc.ps -c save pop \
-f lncsdoc.pdf

Where gs is your friendly local GhostScript install.

NOTE: This may be applicable to other Springer formats, but I'm not familiar with them.

Windows XP to A4 paper

pstops '2:0L@.85(9.5in,-.5in)+1L@.85(9.5in,5in)' \
lncsdoc.ps lncsdoc.2up.ps

Or is it better to just scale up with pstops and let psnup do the rest?

pstops \
'2:0@1.3(-22mm,-58mm),1@1.3(-48mm,-58mm)' \
lncsdoc.ps | psnup -2 > lncsdoc.2up.ps

The former file is a little smaller. And they both look bad in GSview.

Restaurants In Japan

[Editor's Note] This is old material imported from my now-defunct Wiki

Here's the first thing you need to know about Japan: you're not going to find anything if you don't have a map, preferably a map with the thing you're trying to find clearly marked on it. If you buy a guidebook, it will warn you that things are hard to find. This is a lie. Things are impossible to find. Very few streets have names, very few buildings are numbered, and very few numbers go in order. Outside of Tokyo, and even in the less touristy parts of Tokyo, very few businesses have Roman script on their signs---an establishment's name written in kanji is an essential item for finding anything.

The second thing you have to know: if your Tokyo guidebook is more than a year out of date, it will be almost completely worthless for restaurant recommendations. Said worthlessness will be disguised for a time by the difficulty of finding anything, but eventually you will figure out that the restuarant you are looking for is not just very hard to find, but non-existent. In fairness, the guidebooks will suggest that calling ahead is a good idea. In fact, if you have your heart set on eating at a particular restaurant, calling ahead is absolutely required, or else your heart might very well get broken.

The good news is, if you're willing to eat almost nothing but noodles and rice, you can get a decent meal at almost any ramen, udon, or soba shop you pass. Tasty, filling, and usually pretty cheap.

I spent my honeymoon in Japan in June 2005 with the guidance of Time Out Tokyo (3rd edition 2003) and Lonely Planet Japan (8th edition 2003). Here are some addenda for travellers of the future.

Time Out Tokyo

Time Out does not give the kanji for anything. Outside of the central city, this can be a problem.

Edogin

(p. 125) Couldn't find it. Ended up at a perfectly wonderful, seemingly quite popular place in the same area near the fish market. (BTW, the guide books aren't kidding when they say to arrive early for the fish market. We got there around 11 AM and it was like a ghost town---no signs of commercial activity whatsoever.)

Ikebukuro Gyoza Stadium

(p. 128) This exists and is in fact quite easy to find. Time Out errs in not making it clear how strange and interesting this theme park dedicated to steamed and fried dumplings is to the Western visitor. Definitely check this out.

Bangkok

(p. 128) Couldn't find it. In addition, Roppongi is overrated. Like Bourbon Street mixed with Times Square. (Every neighborhood in central Tokyo is like something mixed with Times Square.) We ended up at Freshness Burger, which wasn't too bad, if a little stingy with the meat.

Pumpkin Cook Katsura

(p. 148) We scoured the neighborhood looking for this restaurant and I'm pretty confident in saying it doesn't exist. Kiddy Land, around the corner from where this restuarant used to be on Omotesando, is a great place to stop for Japanese toys.

Senba

(p. 149) We were pretty tired of searching for restaurants when we came looking for this one, but I'm pretty sure it's not there.

Lonely Planet Japan (Tokyo)

Lonely Planet gives the kanji for all the restaurants (and other sites) that appear on the neighborhood maps. Location on a map + kanji = good stuff.

Keika Kumamoto Ramen

(p. 194) No English sign; kind of a surprisingly dumpy little place. But the ramen was quite good. The salad comes with corn flakes.

Junikagetsu

(p. 196) No longer exists. This was kind of mind-bending, because this was kind of a "food mall" that occupied a whole block. We thought we might be losing our minds when we couldn't find it. But the waiter at the (very tasty) okinamaya restaurant on the 4th or 5th floor across the street confirmed that the building had been torn down and replaced with a mall full of clothing stores.

Lonely Planet Japan (Kyoto)

Tagoto Honten

(p. 366) Don't be fooled by the description of this restauarant as "one of Kyoto's oldest" soba restaurants: it is located in a shopping arcade and looks brand new. We walked past this several times before we realized it was the place. There is no English sign, as I recall.

Morita-ya

(p. 367) We found this one, though not with the help of an English sign. It is quite good, though fairly expensive and has a very pleasant deck on the river.

Omen

(p. 369) Found this one with no problem, just a few blocks off the Philosopher's Walk.

Harajuku Girls

Not a restaurant, but none of the guide books make it clear that the infamous fashionistas of Harajuku show up in full force on Sunday afternoon, in the square just South of the JR station. You will see the odd Gothic Lolita on other days of the week, but Sunday is the day to see them on parade in Harajuku.

Development Tools on Mac OS X

[Editor's Note] This is old material imported from my now-defunct Wiki

I've been using Mac OS X 10.3 (Panther) since it was released. I regularly use Unix tools like make, gcc, latex, etc. I recently had a catastrophic hard disk failure and just got around to re-installing my development environment. The hard disk came from the shop loaded with the OS, but no Developer Tools. I put in my XCode Tools install disc and installed all of the Apple Developer Tools. Afterwards, I got the following error trying to run gcc on anything:

  % gcc t.c
ld: can't locate file for: -lcrt1.o

Thanks to Dan Smith on MacInTouch I discovered my re-install routine wasn't sufficient. The repair shop probably installed the OS off a backup disk that didn't include development libraries; the XCode disc isn't careful about checking library dependencies.

If you're installing development tools on a fresh hard disk (or even a brand new Mac, probably), you need to make sure you have the following files in /usr/lib: bundle1.o, crt1.o, dylib1.o and gcrt1.o. If they're not there, either: (1) do a fresh install off the OS discs, or (2) download and run the full XCode 1.1 or 1.2 installer from the Apple Developer Site (Log In (free registration) -> Downloads -> Mac OS X -> XCode Tools).

Problems with Ghostview

After installing Fink 0.7.2 and using it to install Ghostview 3.6.1-4, I got the following error trying to run gv:

  % gv
Warning: Representation size 4 must match superclass's to override highlightedBackground
Warning: Unsupported shape style for Command widget "toggleCurrent"
Warning: Unsupported shape style for Command widget "toggleEven"
Warning: Unsupported shape style for Command widget "toggleOdd"
Warning: Unsupported shape style for Command widget "unmarkAll"
Warning: Unsupported shape style for Command widget "autoResize"
Warning: Representation size 2 must match superclass's to override internalWidth
Bus error

This is apparently a problem with the Fink binary distro of gv. If you rebuild from source (i.e., fink rebuild gv) it should work fine (assuming that all of your X11 dev libraries are set up right---don't let Fink install XFree86 over your Apple X11 install! (Unless, of course, you know what you are doing)), .

Links

MacInTouch has an incredibly large collection of tips for Panther users, as well as for all kinds of other Mac-related subjects.

LaTeX

[Editor's Note] This is old material imported from my now-defunct Wiki

Here's where things about LaTeX get discussed. I'll have you know that WikiWords kind of drive me nuts and the title of this page should give you a hint why.

The single best hint I can give anyone using LaTeX is to bookmark /usr/share/texmf/doc/index.html. (This is assuming a standard teTeX installation (including the package tetex-doc) on Red Hat Linux or Ubuntu. On Mac OS X, fink installs the docs in /sw/share/texmf-dist/doc.) For some reason, it took me several years to discover this documentation and it has almost totally replaced the Lamport and Goossens books for everyday reference. One problem with the books (especially the graphics book) is that they are out of date and some of the key packages documented have changed. The online documentation is also out of date, but not quite so much. The documentation is mostly in DVI format, so you will have to have a working DVI viewer (e.g., xdvi) or convert them to PS/PDF.

UPDATE: I recently acquired the 2nd edition of the companion book and it is really great. It answers a lot of the questions I wanted to cover on this page, particularly about fonts!

pdfLaTeX and letter paper

On many systems, pdfLaTeX defaults to A4 output, even with the letterpaper option to the article class. The simplest solution: add \usepackage{hyperref} to your preamble. hyperref sets the right paper size for PDF output (as if by magic). Thanks for this tip goes to Oliver Haynold at Northwestern University.

NOTE: The tip works, but I'd like more info on root causes.

Future Work

Some things I'd like to put here:

  • A definitive discussion of Type 1 fonts, etc. What is the difference between "\usepackage[T1]{fontenc}" and "\usepackage{times}" (and the like)? What is the purpose of "dvips -P cmz" or "dvips -P pdf"?
  • How to fix the braces in alltt without breaking math mode.
  • Tips for dealing with pstricks, .eps files, and positioning graphics.
  • Paper sizes... or, why can't letter and A4 get along?
  • Prosper, HA-Prosper, slideware, ugh...

Sunday, June 04, 2006

The Pleasures of WikiSpam

The following words have triggered the Blocklist on my wiki in the last 24 hours: tramadol anal-porn meridia cialis asian-sex candid acyclovir adipex alprazolam carisoprodol celebrex diazepam phentermine propecia viagra xanax.

Question #1: How did "candid" get in there?

Question #2: Whither porn?

Question #3: How do you run a legitimate Wiki concerning prescription drugs?

Tuesday, May 23, 2006

WikiVandalism

The ApprovedUrls feature more-or-less made the spammers go away, but apparently some jerks can't help themselves but vandalize an open Wiki. So I've added a blocklist. It remains to be seen how well this will work. (Far be it from me to unfairly accuse anyone of IP spoofing.)

Monday, May 08, 2006

WikiSpam

So I'm going through all my stuff before I leave and I decide to take a look at my Useful Things Wiki, a very modest attempt on my part to share with the world various bits of helpful trivia that are, as yet, un- or nearly-un-Google-able and... While I wasn't looking someone has decided to take a gigantic crap in the commons. Which is to say that every single page on the site has been replaced with link spam.

And these suckers are tenacious. As I started to revert the site back its natural state, someone is simultaneously re-clobbering the site with spam! Ack!

Any Wiki tips from the good folks of the Internet? I don't want to lock down the site, because that's completely beside the point. I've enabled the ApprovedUrls feature of PmWiki and put a password on the whitelist page, which will presumably make spamming the site less attractive, but this doesn't seem to be an ideal solution.

P.S. Ironically, the only likely response to this post is... comment spam!

[UPDATE 5/21/2006] The above solutions seems to have worked. I guess there is a broken window effect with Wiki spam...

[UPDATE 5/21/2006 pt. 2] I'm still getting a trickle... It has also been useful to enable the RSS feed on the Wiki changes, so that I get notified immediately when these things happen.