Printing a Specific Line From a Large File in Linux

Posted in Programming on December 4th, 2009 by Carl Zulauf

I recently had to find a specific line in a large (28GB) file equipped with nothing more than the line number. I thought it would take me just a few seconds to find a cool *nix utility to accomplish this task. Instead, it took me a bit of scouring to find something that works, and works well on large files. That’s OK though since I had to wait for the 28GB file to uncompress from a tarball… which, obviously, takes a while.

What I learned about while I waited was the *nix command ’sed’. This is a tool built for command line processing of data files. Apparently it was birthed as an evolution of our trusty friend ‘grep’. The forum post I found which hinted that ’sed’ was my solution didn’t provide much real information and the Wikipedia article was mostly background and provided examples that won’t help me.

Where I found the most useful info was the sed page on sourceforge… go figure. The docs page pointed me to ‘The sed one-liners‘ by Eric Pement. Here I found, through example, the power of ’sed’ and an example that is more efficient on large files than the ones I found elsewhere.

So here is how you do it:

sed '34005050q;d' filename

‘34005050′ is the line number. ‘q’ tells sed you are looking for that line number, and ‘;d’ tells it to stop after that line. ‘filename’ is of course the file you are trying to coax a specific line out of. To do an inclusive range of lines all at once (lines 8 through 12, for example), do this:

sed '8,12!d' filename

I’m still learning about ’sed’ but its already saving my ass. Have fun.

Iowa Governor Chet Culver Promoting Intolerance

Posted in News and Opinion on August 7th, 2009 by Carl Zulauf

An ongoing story I have been watching took what I feel is a dark turn when Iowa Governor Chet Culver (Democrat) weighed in with his views on the situation. The story I am referring to is the removal of an Atheist ad from DesMoines Area Regional Transit (DART) buses. DART received several complaints and determined the ad was “too offensive.” The ad in question? Here it is:

Iowa Atheist Bus Ad

Apparently the mere acknowledgment that Atheists exist is too offensive for some people. There will always be dissenters though, that doesn’t surprised me. What did surprise me were the comments made by Governor Chet Culver:

“I was disturbed personally…by the advertisement, I can understand why other Iowans were also disturbed by the message that it sent.”

Here we have the chief executive in the state of Iowa stating that simply pointing out Atheists exist is personally disturbing. I am used to politicians pandering, but it appears Chet is taking this to the point of promoting and identifying with the complete intolerance of Atheism. We cannot stand by and allow our public servants to spew forth bigotry which labels the views of a growing minority as “disturbing.” This kind of statement is not far from hate speech and will embolden those who do hate Atheists.

Friendly Atheist has made a call to Christians to support the advertisement, and many have responded. It is clear this is not a battle between religious views but instead a battle for tolerance, religious or otherwise. Many Iowa Christians understand this, but clearly their governor does not.

I encourage all reasonable citizens of Iowa and elsewhere to write to both DART and, more importantly, Governor Chet Culver. We need to make it clear to DART that these ads are not offensive. We need to make it clear to Governor Chet Culver that acknowledging the existence of people with certain religious views (or lack thereof) is not disturbing and statements from public officials suggesting otherwise will not be tolerated.

DART can be emailed at dart@ridedart.com or called at 515-283-8111. Governor Chet Culver can be reach through a contact form or by phone at 515-281-5211. I encourage you to speak your mind, but please do so in a polite, rational, respectful, and non-threatening way.

Today DART announced they have received more calls in support of the ad than against it and are now asking the Iowa Atheists and Freethinkers (IAF) to submit a new ad for consideration. They still seem to be suggesting the original ad was offensive, but want to work with the IAF. I have no idea how the IAF could craft an ad which reaches out to Atheists and is less offensive than the current ad, but maybe I am missing something. I still feel DART could use some convincing that the original ad was fine and that their requirement for a new one is unfounded.

Update: DART did the right thing and chose to allow the ad. The original one with no modifications. Support for the ad was overwhelming and our freedom of speech helped us protect our freedom of expression. We may have a long road ahead of us, but I stand today proud of my country and the ability our citizens have to challenge authority when that authority infringes one of our basic rights. This doesn’t absolve the governor of his responsibility for making such short-sighted public statements which dismiss the views Atheists, but this does show that DART is a reasonable organization who know now, more than ever, how important our liberties are. Thank you DART.

Tags: , ,

Palm vs. Apple: The Battle for iTunes Interoperability

Posted in News and Opinion, Technology on July 24th, 2009 by Carl Zulauf

A week before launching the Palm Pre, on May 28th, 2009, Palm announced their upcoming Pre would have a feature called “Media Sync”. This feature would allow the Palm Pre to sync directly with Apple’s iTunes music software without any additional tools or software. Shortly after the release of the Palm Pre it was discovered that this capability was enabled partly by the Pre masquerading as an iPod when using Media Sync mode.

For over a month all was well and Palm Pre owners who used iTunes could sync their music with the Palm Pre seamlessly. Then, on July 15th, 2009, Apple did what many had feared. Version 8.2.1 of iTunes included an update that appeared to specifically block the Palm Pre from syncing with iTunes. Although many people were outraged and saddened by this, the response I saw was surprisingly small. It appears as though most Palm Pre owners who weren’t already using iTunes used other media managers to sync with their Pre. I myself use Winamp, RhythmBox, and manual syncing.

Today Palm released version 1.1.0 of their WebOS software to Palm Pre owners. Along with many new features this update included a return volley in the battle over iTunes compatibility by restoring the Palm Pre’s ability to sync with Apple’s iTunes. To accomplish this it appears Palm took more steps to disguise the Palm Pre as an iPod. This time not only does the device identify itself as an iPod, it also identifies itself as being manufactured by Apple.

A shallow examination of the methods used by Apple to block the Palm Pre from syncing and the methods used by Palm to re-enable it seem to indicate there are still a few more ways Apple could easily block the Palm Pre. However, it also appears that Palm’s ability to disguise the Pre as an iPod is virtually limitless. If Apple chooses to fight this battle further they may find themselves stuck with the decision of forcing firmware updates on iPod users in order to prevent the Palm Pre from syncing with iTunes, a move that will surely upset many long-term iPod users who have never even heard of the Pre. Even in that scenario it’s possible Palm could yet again re-enable iTunes syncing, meaning Apple could alienate its own faithful customers and still fail to block the Pre from iTunes.

This fight by Apple is not surprising when put in the perspective of Apple’s history with third party hardware and software. Apple has actively fought its own customers on the ability to use third party media managers for iPods/iPhones by constantly breaking compatibility through firmware updates and even threatening those who share information on how to load/unload media from their devices. In the past Apple may have had a valid argument for preventing third party media managers from managing content on iPods due to the DRM present on many tracks purchased through iTunes. Apple no longer sells music with DRM and has not done so for a while, so the argument that they must fight third party software to prevent piracy is outlandish. This stance of Apple makes it extremely difficult for legitimate iPod and iPhone users from using anything else but iTunes to load content onto their devices. For some using iTunes isn’t even an option as iTunes is not available (and does not have any plans to be made available) on Linux, meaning those of us who use Linux cannot use an iPod or iPhone at all.

Palm Pre’s Media Sync capability is different story though. In this case Apple isn’t forcing their hardware users to use their software, they are forcing software users to use their hardware. At first this seemed to me to be slightly less anti-consumer than the previous scenario until I thought about who actually uses iTunes to sync with their Palm Pre. Most people who use iTunes own an iPod or iPhone. iTunes is a decent media player but there is very little incentive for those who don’t own an iPod to use it. Both iPod owners and non-owners are encouraged by Apple to use iTunes for all their music needs and it is the only way to purchase music from Apple’s music store. Many users have invested large sums of money to build a collection of music through the iTunes Music Store, and those users believe they “own” that music. Put yourself in their shoes. Imagine you have purcahse ~$500 worth of DRM-free music over the past couple years and you have stored that music on your trusty iPod. Now, imagine you are shopping for a new phone and for whatever reason you decide to purchase a Palm Pre (maybe AT&T isn’t an option, or maybe Sprint is your current carrier, or maybe even though you are an iPod user you just don’t like or want the iPhone). In the process of purchasing your Pre you discover it actually makes a great media player that allows you to lower the number of devices in your pocket. Sure, you still use your iPod for certain things like jogging, but on a daily basis you don’t want both devices in your pocket so you want to use the Pre for music as well. Now, how do you go about getting your music onto your device? Well, without an iTunes syncing capability there are ways to get your MP3s out of iTunes and onto your device, but doing this manually or migrating to another media manager may be difficult and cumbersome. Plus, you still have to use iTunes for your iPod. Wouldn’t it be great if the Pre “just worked” with iTunes? Yeah, Palm thought so too so they made it happen. Apple’s response to this is to punish their own customers by putting up road blocks to this kind of interoperability.

Apple can try to spin this however it wants, but its hard to deny that they are punishing their own customers. If they continue this fight it may also be tough for organizations like the Department of Justice to ignore these actions in the context of the current digital music market, where roughly 70% of all music sold online occurs through iTunes. Even in the greater music market Apple is now the number one seller of music in the USA. Apple’s position in the market gives them a lot of power, and they appear to be using that power to dictate significantly the terms with which customers shall have access to content. This matches accepted definitions of “monopoly” almost verbatim. Apple can avoid that label by not strong-arming their customers, but if this battle continues that is exactly what they will be doing.

In conclusion, I strongly disagree with critics who claim Palm is wrong for trying to be interoperable with iTunes. The Palm Pre’s ability to sync with iTunes is just one of the many ways Palm allows users to load media onto the Pre. Palm is not attempting to “rely” on iTunes or any single sync method, and is instead taking the approach of giving users as many options as possible. I think this is the right approach and in most cases this allows users, who have already amassed huge media collections, to sync that media with the Pre using their current setup, whatever that may be. I believe Apple is wrong here for trying to punish their own customers who have added a non-Apple device to their collection of devices. Apple’s actions are anti-competitive and, possibly more importantly, anti-customer. They aren’t hurting Palm much by playing cat and mouse, they are hurting their own paying customers.

Tags: , , ,

ExaNotes – An Overdue Introduction

Posted in Programming, Technology on June 17th, 2009 by Carl Zulauf

Several months ago I started working on ExaNotes as a lightweight personal tool to write, access, and search notes from one of the many computers I may use throughout the day. I told a good friend of mine about the simple web app I was building and she said it sounded like a great tool for keeping a journal. I asked her if she could help test the app by keeping a journal and she hesitated. As good of friends as we were the idea of me having access to her journal was not a comfortable one. The convenience of being able to access her journal from any computer was appealing but she didn’t want to trade control of her privacy for convenience. Her desire for privacy gave me the idea of developing a system that was so secure that even the developer or administrator of the tool could not access the content users of the application have stored within it.

I decided to use this as a chance to learn much more about building secure web applications and I spent a few hours diagramming the concept. Then, I spoke with my friend again. I explained the design to her and she agreed the design would keep her journal secure enough that she would feel comfortable testing it and using it. Read more »

Tags: , , ,

McDonald’s Won’t Pay Worker’s Comp for Shot Employee

Posted in News and Opinion on February 25th, 2009 by Carl Zulauf

I have been reading about this story, looking through article after article for an update where McDonald’s comes forward and agrees to pay Nigel Haskett’s medical bills. Unfortunately, they haven’t yet and it appears they might let this issue go all the way to court.

For those who aren’t familiar with the story, let me fill you in. In August 2008 Nigel Haskett, then a 21-year-old McDonald’s employee in Little Rock, Arkansas, witnessed Perry Kennon beating a woman in the McDonald’s where he is employed. Video shows Haskett acted quickly by forcing the assailant outside of the restaurant and then blocking the door. His actions immediately ended the beating Perry Kennon was giving to the woman in the restaurant. Afterwards, Kennon went to his car, grabbed a gun, and proceeded to shoot Nigel Haskett multiple times. Nigel then stumbled into the restaurant and eventually collapsed. Nigel survived the incident and, after three surgeries, appears to be doing well. However, he is now saddled with approximately $300,000 in medical bills and his claim for Worker’s Comp has been denied by McDonald’s and their insurer.

I am not alone in my outrage at McDonald’s for denying this claim. What is disheartening, however, is the fact that as of this writing McDonald’s is continuing to deny the claim, and several bloggers and commenters around the web seem to be siding with McDonald’s on this issue. McDonald’s insurer states “we have denied this claim in its entirety as it is our opinion that Mr. Haskett’s injuries did not arise out of or within the course and scope of his employment”. The reasoning behind this stance is that apparently, during a 30 minute orientation, Mr. Haskett and other employees were informed that during a robbery or anything like a robbery they should not get involved and should simply call 911.

Whether or not Nigel was strictly following company policy doesn’t really determine the validity of the compensation claim, unless the violation was grossly negligent and contributed directly to the injury. In this case Nigel’s action of intervening may have violated company policy (this is debatable however, as the situation was not a robbery and was arguably nothing like a robbery), but those actions may not have contributed to the actual injury. When Nigel encountered Perry Kennon beating a McDonald’s customer Perry was not armed. He was, however, actively assaulting a customer. Calling the police is the right thing to do, but the police are not magical and would not have arrived in time to end the beating being delivered to the female customer. It is entirely possible another employee was already contacting the police. Nigel’s actions immediately saved the customer from continued assault. What happened afterwards should really be viewed as a separate instance altogether. It is entirely possible that Perry Kennon may have gone to his car for the gun anyways to shoot the female customer or simply because a McDonald’s employee asked him to leave. Kennon is clearly an unstable individual who is obviously prone to shoot people over small altercations. The reasoning that Nigel Haskett’s actions potentially put additional people in danger are no more compelling than the argument that Perry Kennon may have intended to shoot the female he was assaulting, there by putting everyone in the store in eminent danger of being shot. By removing Perry Kennon from the store Nigel Haskett may have foiled further actions by Perry Kennon that could have resulted in more people than just Nigel Haskett being shot and may have resulted in the death of a McDonald’s patron. I realize this is a tenuous argument, but I make the argument for the purposes of showing just how equally speculative, tenuous, and ridiculous the claims are that Nigel Haskett’s actions somehow put more people at risk. Had Perry Kennon been armed from the start then it would not have been smart for Nigel to intervene. However, Perry Kennon was not armed. In this case, even if it is determine Nigel violated company policy, and it is determined he was aware of this policy (he currently denies being informed of this policy) it may not matter. When Nigel intervened he saw an unarmed person assaulting a customer. He did not try to fight with the perpetrator or resolve the dispute… he quickly and simply removed Perry from the restaurant and blocked his return. There was nothing negligent about these actions. The fact that Perry Kennon was unstable and had a gun hidden in this car is something Nigel could only know in hindsight. And, with a person as unstable as Perry Kennon there is no reason to believe he wouldn’t have shot Nigel or another employee over something else, like soggy french fries.

By every measure and definition I have seen (unless you ask Dwight Schrute) Nigel Haskett is a hero. He acted quickly and lawfully to aid a fellow human being who was clearly in deress. I only hope I have the courage to do the same if I am ever in a similar situation. McDonald’s owes this man far more than the $300,000.00 in medical expenses he is asking for. They owe him an apology and a debt of gratitude.

I am disappointed this story has not received the national exposure it deserves. If you are reading this, please blog about it and forward this to as many people as possible. I am thoroughly disappointed that it may require public outcry for McDonald’s to do the right thing, but it appears we are at that point and I will do whatever I can to see that Nigel is given the recognition and compensation he deserves. If anyone has any more information on this story that I may have missed, please share it with me. There is currently a fund set up to help Nigel Haskett through Twin City Bank. Donation instructions are right on their front page under “featured products” in the bottom right.

Tags: , , ,

A Quick Inventory and Review of Alternative Gnome Web Browsers for a Netbook

Posted in Technology on February 22nd, 2009 by Carl Zulauf

Firefox performance in linux is always a bit lacking, so I thought I’d try some of the many alternative web browsers for Ubuntu (Gnome). All of these were tested on an Acer AspireOne running Ubuntu 8.10 and all were installed through the Ubuntu package repositories.

Midori

A small and simple WebKit browser. I have been looking for a good WebKit browser to use in linux… unfortunately this isn’t it. The performance is pretty decent when loading and using the page itself, but the actual program UI is clunky, slow, and buggy. This one needs some serious GTK+ work before it can expect to be a real choice for Ubuntu users. It hasn’t crashed on me or anything, but the fact that the toolbar can get resized if you switch tabs or use the back/forward buttons should not happen, but it does and it happens slowly.

Epiphany

Uses the Gecko layout engine, like Firefox, and seems to do it a little slower than Firefox. Some of the tab behaviors are odd and difficult to configure. When I click on a link that should open in a new window I generally don’t want it to appear in a new window, I want it in a new tab. Back and forward history seem to be shared among tabs in the same window? I guess I could see how that would be useful, but it is very odd behavior. Double clicking in the empty area of the tab bar doesn’t spawn a new tab? Also odd. All-in-all this isn’t a bad browser, it just doesn’t seem to do anything better than Firefox, which I was really hoping for.

Galeon

This is another browser using the Gecko layout engine. This browser actually feels pretty fast. I have enjoyed using it. However, it is not without issues. On a netbook it is very frustrating that I cannot seem to configure the browser’s UI to take up a minimal amount of screen space. The stock back and forward buttons are huge, and the height of the toolbar they are on is way to large. Even in full screen, the UI takes up too much vertical screen real estate.

These are the only alternative browsers I have tried so far. None of these browsers offer a good alternative to Firefox on a screen-space-constrained netbook. Not a single browser here had a windowed or full screen mode that offered as much screen real-estate dedicated to displaying the web page as Firefox (when properly configured). Even after exploring the various configuration options there appears to be no way to make ANY of these browsers use less or even similar amounts of screen-space for their UI compared to Firefox (not counting the options to remove the toolbar entirely, which is not realistic) . On a screen this small page real-estate becomes very important. There should at least be OPTIONS to make the UI as minimal as possible, but the options provided are simply inadequate. This compounds the fact that Midori and Epiphany both feel slower than Firefox. Galeon, which generally feels as fast or faster than Firefox, is crippled for me by the fact that the minimum usable UI configuration is the largest of the group. Also, not a single one of these browsers offers the ability have a FULL full-screen browser, like Firefox, where the UI auto-hides and the web page is given nearly 100% of the screen. I hope with the growing number of netbook users and the growing number of them running linux this will have to be a form factor each brower’s community will develop for and offer more customizable/minimizable user interfaces.

Tags: , , , , , , , ,

Playing with Laser Light

Posted in personal, photography on December 10th, 2008 by Carl Zulauf

Here are a few pictures from my recent revisit to using laser light in photography. Ordered a new green laser so hopefully I’ll have some new ones soon that aren’t so… red.

More pictures from this series after the break.

Read more »

Tags: ,

Greasemonkey Script: ArsTechnica Cleaner

Posted in Programming on December 4th, 2008 by Carl Zulauf

This is another fairly simple Greasemonkey script I’ve made to make viewing ArsTechnica much easier. This script hides, removes, and reorganizes superfluous content, widens the main content pain a little, and removes all flash. This is extremely helpful when you are reading many articles at a time and don’t want the flash animations on every article slowing down your computer. Scrolling smoothness, tab switching, and general responsiveness of your browser will be improved, especially on older/slower computers. Also, I find the slightly wider content pain to be easier to read.

Like last time, this script is also available through userscripts.org.

Tags: , ,

Supercomputers: US Embracing “The People’s” Operating System While China Goes Commercial

Posted in News and Opinion, Technology on December 4th, 2008 by Carl Zulauf

I was glancing through the November 2008 TOP500 list of the world’s most powerful super computing sites, and noticed a few interesting details.

First I noticed that the US increased its dominance at the top of the list. The nine fastest super computing sites are all in the United States. You must go all the way to the tenth fastest to find a computing site outside of the United States. In the previous list (June 2008) the US still dominated, but Germany, France, and India all had computing sites in the top ten. With just six of ten fastest computing sites located in the US only six months ago, the nine out of ten score this time around is a significant improvement. The TOP500 list has been published twice a year since 1993 and looking through all the previous lists this is the most dominant the US has ever been in the top ten, and possibly overall.

The second interesting thing I noticed was that the tenth place site is located in China. This is only China’s second time being listed in the top ten (the last time was in June 2004), and they have yet to reach any higher on the list than tenth place.

However, what really caught my eye was the choice of operating systems in the top ten systems. All nine of the systems located in the US are using some flavor of Linux as their operating system. Linux is built by a community of volunteer programmers around the world and is often considered antithetical to commercial software. By association, some people believe Linux and the Open Source software movement are in direct opposition to capitalism. I found it both ironic and gratifying to see that the most commercial and capitalistic nation on earth is dominating the rankings of the world’s fastest computing sites using a product assumed to be at odds with both commercialism and capitalism. In an even more ironic twist of fate, The People’s Repulbic of China, whose communist leaders often insist on home grown solutions for many industries, are using a foreign commercial software stack to run their fastest computing site: Microsoft Windows HPC 2008.

Beyond being interesting, does this list offer any real economic, scientific, or political insight? Probably not. However, if it did, it appears the list would be saying that the United States is not loosing its relevance as the center of the information technology revolution as quickly as many have suggested. It might also be telling us that the United States is embracing “socialist”, “grassroots”, or “community” tools (when it comes to software) to a greater degree than many realize, and that China may be embracing capitalism and commercialism more quickly than we are often led to believe.

Tags: , , , , , ,

Omaha Area Democrats: Your Vote Matters on November 4th

Posted in News and Opinion on October 8th, 2008 by Carl Zulauf

I have found that many Nebraskans are not aware that Nebraska is not a normal “winner takes all” state when it comes to electoral votes in a presidential election. Nebraska is one of two states (the other is Maine) where electoral votes are “tiered“. Of Nebraska’s five electoral votes, only two go to the state-wide popular vote winner. The remaining three electoral votes are awarded individually to the candidate who wins the popular vote in each of Nebraska’s three congressional districts. District 1 (Eastern Nebraska, including Lincoln, Fremont, Norfolk, South Sioux City, but not including Omaha/Douglas County) is considered to be a fairly safe bet for Republican John McCain, and District 3 (Western Nebraska) is an even safer bet. District 2 (Omaha/Douglas County, and parts of Sarpy County), however, is not safe for McCain.

Sarah Palin’s recent visit to Omaha has many saying that the McCain campaign is scared of loosing the single electoral vote of Nebraska’s 2nd congressional district. One of the people indicating this was Gentry Collins, McCain’s Regional Campaign Manager. Obama is also aware of how close the race has gotten in this district. He recently moved 15 additional staff here and opened a second campaign office in Omaha.

Recent electoral college projections show that Obama and McCain could end up in a tie, with each candidate receiving 269 electoral votes, both shy of the 270 votes needed to win. If we can energize Obama supporters in Omaha and cause our single electoral vote to be pledged to Obama our tiny congressional district could very well determine the outcome of this election.

I hear time and time again from discouraged potential voters in the Omaha area who think that even if they do vote for Obama it won’t matter because Nebraska is so overwhelmingly Republican. Now you know that is not true. Voters living in Douglas County and most residents of Sarpy County will find they have a very loud voice on election day… a voice so loud it could dictate the future of our country for the next four years, and possibly beyond.

Please vote. It’s possible your vote matters more this year than it has in your entire life.

Tags: , , , ,