Joe Maller.com

Removing one file’s contents from another file

A friend called in the middle of a promotional email disaster. Due to a screwup by their mailing service, messages only went out to a random portion of their list. It was a disaster because all he had left to work with were two text files, the masterlist and a log of what had already been sent.

So we basically needed to delete the contents of a small file, “deleteme.txt” from the contents of larger file, “masterlist.txt”. The lines to remove were not contiguous and some lines in the smaller file might have already been removed from the larger file.

Here is the piped unix command I used to do this:

cat deleteme.txt deleteme.txt masterlist.txt | sort | uniq -u > newmasterlist.txt

The uniq command’s -u flag outputs only lines which appear once, omitting every duplicate line. I used cat to join the deleteme.txt file twice to guarantee the interim file would contain at least two copies of every line to remove. If the lines already appeared in masterlist.txt, then there would be three to remove, but forcing duplicates made sure I wouldn’t end up with the already deleted lines being added back in (an XOR).

As I wrote this out, it started to seem more and more simple, almost to the point of silly. Writing this post took far longer than fixing the files. But the solution didn’t occur to me right away and this post is now exactly what I was googling around for.

Share |
2 Comments so far
link: Jan 19, 2007 2:22 am
posted in: misc.
Tags:

Momofuku Ando

Momofuku Ando died in Osaka January 5th, he was 96. In 1958, Mr. Ando invented the instant ramen noodle and changed the world.*

I’ve been eating at the Momofuku Ssäm bar regularly, never realizing that the name of David Chang’s expanding restaurant empire was a winking nod to the inventor of the instant noodle.

* After writing this I found the Forbes obituary, which cited an inscription at the Momofuku Ando Instant Ramen Museum, “In 1958, Momofuku Ando invented instant noodles here in Ikeda, and changed the food culture of the world.”

Share |

link: Jan 15, 2007 10:24 pm
posted in: misc.
Tags:

Robot Dragonfly

Robot Dragonfly Ornithopter

More info at RobotGossip and RobotsRule. Here’s another video (via Digg):

The design is apparently based upon work by Sean Frawley and Dan Getz while in high school. Their work is said to be based on a 19th century french invention.

Share |

link: Jan 10, 2007 1:43 am
posted in: misc.

Rancilio Sylvia: Two months of great coffee

A comment on my last espresso machine post reminded me that I never really wrote about how the new machine worked out. So here’s that post.

The new machine is fabulous

It took a few days to start getting the hang of consistently good shots, but those first few cups made me realize what great espresso was really all about. My first thoughts were, literally, “Oh my God, what have I been drinking?” This is real espresso. Much as I loved my now deceased Barrista machine, it didn’t make espresso. It made pseudo-espresso, a dopplegänger imitation of what espresso should be. Basically it was just really strong drip coffee.

With the new Rancilio Sylvia, I immediately began tasting many more levels of flavor between beans. I now know what stale beans taste like. With the Barrista I could distinguish and enjoy the differences between high east African, Central American or Sumatran beans, but it turns out those flavors were masked and muddied. The taste difference is sort of like how our TV looked pretty good before seeing what HD could do. Since getting this machine I’ve only use darker, oily roasts, but the next trip to the coffee store I’m going to get several smaller bags of various beans and roasts.

The gateway drug dispensing gateway drug

It only took a few weeks before I bought a grinder (Baratza Solis Maestro Plus). Before, I would have the beans ground when buying coffee (from Porto Rico on St. Marks). Since I burn through a pound of coffee pretty quickly, I wasn’t too concerned about the ground coffee getting stale and as it turned out, the Barrista was masking the increasingly stale taste anyway. But the main reason for the grinder was that different beans and different roasts of different beans requiring slight adjustments to the grind.

Negatives

Much as I am loving the machine, there are a few areas where it could definitely be improved upon.

Noise. I haven’t opened it up yet to check if anything could be better dampened, but the machine is quite loud enough to make noise a concern.

Cooldown time. After steaming milk, there is a bit of a process to bring down the boiler temperature for espresso. What I do is flip the hot water switch and run the wand into the sink. At the same time I tend to run hot water through the empty portafilter. That makes sure the portafilter is at least somewhat heated, and clears leftover grinds from the inner screen. These steps are loud. Because of these steps, I’m not using the three-hole steaming tip I bought — it’s too much hassle to clear the wand into another container rather than the sink. I’m not sure about initial heatup times since my wife and kids tends to turn the machine on before letting me know it’s time to drag my butt out of bed. By the time I finally stumble into the kitchen, the machine is always ready to go.

A ball joint on the steaming wand would be welcome. I’m not the first person to bring this up, but there’s enough of a hacking community around this machine that I expect someone has already figured it out and will sell a kit eventually.

For some reason, if I don’t use enough coffee, my fancy 58mm tamper will bind the edges of the portafilter basket. I will probably buy some other portafilter baskets in the future. Unfortunately, after reading this, possibly more tampers too (those Pullman tampers are beautiful).

One more thing

While writing this, I stumbled across this super-modded Rancilio controlled by an original Nintendo gamepad. Wow.


How to spell Hannukah, 2006 edition

Last year I posted Sixteen ways to spell Hanukkah, here’s an updated list showing this years counts for the various spellingsHanukkah Spelling Chart 2006:


36,515,976 total hits. Again, Google’s index seems to have grown quite a bit, the total number of hits is more than double the total from 2005. This file contains my Hanukkah spelling counts for the past three years.

Thanks again to Jeremy Blachman for posting the 2004 numbers.

Happy Hanukkah, see you again in 2007.


Two little MonoBook styling hacks for MediaWiki

Recently, I’ve spent some time working with MediaWiki for Lila’s school’s web site. A small part of what I’ve been doing has been implementing an exisiting design onto the wiki backend. In an effort not to overcomplicate anything (think longevity) I built the entire design adaptation on the default MediaWiki MonoBook theme. Everyone who’s visited Wikipedia has seen what this looks like. Monobook is a very well constructed theme with clearly defined parts that degrade nicely without its stylesheets. So far, with the exception of these two small changes, I’ve able to do everything I needed to with the default page structure.

First change: Fixing bad portlet IDs

Editing Mediawiki:Sidebar allows for nearly complete customization of the sidebar links. Custom sections automatically get custom IDs which can then be styled. There is one thing that seems like a bug however: If a section heading has a space in it, the portlet ID will have an illegal name. Classes can have spaces in their selectors, but IDs can’t. Here’s what I did:


and the new one:


'>

Simple enough, PHP’s str_replace is used to swap underscores for spaces. I’m still feeling my way around the MediaWiki codebase, so this might not be the best solution to the problem, but it does what it needs to with a very lightweight function.

Second change: Classes from page title

I needed to change the background of the globalWrapper element depending on the page, the way I accomplished this was to use the page-title. This has one initial drawback, namely that colons are not allowed in CSS class names. However the workaround above can be recast here with added benefit. Switching colons for spaces results in multiple class names, so namespaces can be styled too.

Here’s the old code:


And the new code:


This method would seem preferrable to adding a CSS import rule which would look for a custom-named file. Even though CSS load errors don’t break pages with visible 404 errors, they would slow down page loads and litter the server logs. Checking that the CSS file exists is somewhat costly, and I suspect MediaWiki’s cacheing isn’t something that can be quickly skimmed over and implemented.

There appears to be a pageCSS extension somewhere, the hooks are even specified in MonoBook’s header, but I couldn’t find a working download and CVS repository doesn’t seem to be working anymore.


Buy a Wii…

Buy a Wii and cute, giggling (French|Japanese|American) girls will flail around your generic apartment.

Nintendo’s Wii promotional site is brilliant. Cute giggling girls aside, these videos are really fun to watch. And effective as marketing too, because we’re immediately curious about what unseen thing these people are looking and smiling at, they also using marketing online, by getting agencies as Melbourne SEO expert to make a good marketing campaign to reach more costumers using different websites exactly like https://factschronicle.com/ or even http://www.brandedimage.com/service-areas/.

Nintendo isn’t just marketing to non-gamers, they really did build this “with everyone in mind. My favorite videos were the kids in this family and this older couple, who go from stoic to ecstatic in about 5 milliseconds. Looks like fun, though I’d much rather being playing catch outside.

What can Sony and Microsoft possibly have to counter this? (Some aliens in a generic dark and smokey sci-fi world with big explosions and inexplicably ubiquitous crates everywhere?)

Another good thing about the Wii controllers is that they will force players to get up off the sofa or at very least hold their arms up. That means there will be fatigue and that mean it will be very difficult for kids to get as sucked in as the typical twitching thumbs console game. Which got me thinking:

In the near future, there will be a YouTube video showing how to play Wii without leaving the sofa. Players will demonstrate ways of using the controller with as little physical movement as possible.

Mark. My. Words.

Update Through a random stroke of luck I was able to play a pre-release Wii yesterday. Well, mostly Lila played but I got to work the menus. The Wii really is that good, this thing is going to own Christmas.

Share |

link: Nov 12, 2006 2:47 am
posted in: misc.


« Previous PageNext Page »