jlm-blog
~jlm

28-Dec-2013

Happy Christmas from Edward Snowden

Filed under: politics — jlm @ 12:46

A holiday message from our currently most famous fugitive.

And may your new year be private.

16-Dec-2013

Good job, China. Awful job, media.

Filed under: science — jlm @ 11:34

China has pulled off the first Moon landing in 37 years and just deployed a lunar rover. Nice job!

You wouldn’t know it if you just get your news from the L.A. Times or S.F. Chronicle, though. What the hell, news media? This is not newsworthy?!

16-Nov-2013

… and also the wrong things with the wrong people

Filed under: web — jlm @ 18:21

G+ advertises user control over sharing on post complaining of G+ unauthorized oversharing

<SOURCE>

 
"That's what we call Irony!"

23-Dec-2012

Addressing the fragile base class problem

Filed under: programming — jlm @ 21:47

I’ve been thinking about the fragile base class problem lately. (Yes, I know it’s almost Christmas. My mind works mysteriously.) I started thinking by analogy to APIs, which the interface a superclass gives a subclass in fact is, even if it’s not called that. So, the superclass’s API changes, breaking the subclass, just like a regular API’s change can break a client. How do we deal with this with regular APIs? If we are to make a compatibility-breaking change (which introducing any member into a superclass potentially is), we version the API so that a client requesting version 1 semantics gets them while only clients written against the newer semantics will request version 2. We could do the same kind of thing with class inheritance if we mark everything with revision numbers, which we reference when inheriting.

class base@2 {
    void start@1();
    void stop@1();
    void idle@2();
};

class child@1 extends base@1 {
    void idle@1();
    void park@1();
};

Here’s our classic case of a fragile base class. child subclassed base and defined the new method idle(), then later base was extended with its own method idle(). Normally, this would cause a problem — the new stop() implementation might call idle() perhaps, and child’s idle() won’t be written with overriding a then-nonexistent base::idle() in mind. But with these revision markings, we say that child only overrides methods marked as being in revision 1 of base. So, when stop() calls idle(), it gets base::idle, not child::idle, and when park() calls idle(), the call resolution goes the other way.

The problem I see with this though, is that when going to an indirect superclass, it can be unclear which revision that should be.

class grandparent@3 {
    void method@2();
};

class parent@2 extends grandparent@2;

class child@1 extends parent@1 {
    void method@1();
};

Uh-oh. Should child’s method() override grandparent’s? If parent@1 extended grandparent@2, then yes. But if it extended grandparent@1, then no. So do we need to list the parent class revisions of every revision of the child class? I’d hope there’d be a better way. Perhaps we’d be relying on an IDE to handle the revision numbers for us, keeping them updated is just a dumb task, so in that case the IDE could maintain the manifest of parent revisions too.

20-Nov-2012

How not to do automatic updates

Filed under: linux — jlm @ 10:47

Today’s attempt at upgrading packages produced this:

Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/extras.ubuntu.com_ubuntu_dists_precise_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

The contents of that file?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">  
   <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
   <META HTTP-EQUIV="refresh" CONTENT="0;url=https://login.wifiportal.co.nz">
   <TITLE>Welcome to FIVO Hotspot, Product of Natcom LTD NZ</TITLE>
</HEAD>
<BODY>

</BODY>
</HTML>

I don’t have unattended upgrades enabled on my Ubuntu laptop. Nevertheless, there’s something which goes around and replaces files in /var/lib/apt with whatever junk it gets from whatever network it happens to be connected to at random times. Can I be the only person who thinks this is a Really Bad Idea?

21-Sep-2012

Pre-desecrated ikons

Filed under: animals — jlm @ 12:10

A distressing report from National Geographic: Elephant poaching for ivory is growing alarmingly, devastating elephant populations, and the demand for elephant ivory is for making holy objects. I don’t understand this at all. How can anything made from the illegal killing of an African elephant for its tusks’ ivory be holy? How is that poaching for making ikons not sacrilege to Christians and Buddhists? How can the buyers worship using an ikon made from such desecration?

19-Sep-2012

Foray into short science fiction

Filed under: misc, science — jlm @ 18:58

“So, what’s the news?”

“Nothing much. The ship with Bob Ritchie and Lori Walton’s bodies arrived on Earth, so they’ll be getting put to rest.”

“Ah hah! I had my fingers crossed this whole time. We’re saved then!”

“What are you talking about?”

“Well, you know I have the secret battle station plans, and I performed Bob and Lori’s autopsies…”

“So, what good is that? This may be the most advanced bio lab this side of Tau Ceti, but even you can’t grow a hypernode transmitter in a vat, and you can’t smuggle 100 exabytes of secret plans in a pair of corpses–”

“– I can and did.”

“What? They put those bodies through a full nanometer scan before letting them through. If there were a single molecule which didn’t belong in a human, or even the right molecules in the wrong place, that’d pick it up. And even if you get a few through, the holographic encoding of the plans means you have to smuggle all 100 exabytes or it’s useless as none of it.”

“But the scanners don’t check the DNA.”

“Sure they do. If the body’s cells don’t have the right amount of DNA in the right place, or if there’s extra DNA in the wrong place, that’ll cause a red light.”

“I meant they don’t check the DNA sequences.”

“Well, no. Everyone’s is different, and no one is going to smuggle DNA, it’s thousands of times cheaper to make it yourself, even if you have only the most rudimentary equipment.”

“The makers of the scanners weren’t thinking about smuggling information. After all, hypernode is going to be faster and cheaper than any ship. But when your enemy has control of all the hypernodes… Well, there are 3 billion base pairs in the human genome. Each cell has a copy of that genome. And there are 50 trillion cells in the body. And this equipment can replace each cell’s DNA with a unique sequence. Those plans are written into their nuclei, redundantly many many times over. And when Earth checks their DNA against the stored records for identity verification, they’ll discover sequences which aren’t human, and don’t even match any lifeform whatsoever.”

“So, we’re going to be rescued by a pair of corpses, which you turned into digital media…”

“Yes, we’re saved by the stateful dead.”

11-Sep-2012

Getting Assange out of the embassy

Filed under: humor — jlm @ 21:41

Julian Assange is holed up in Ecuador’s embassy in London, which is basically equivalent to being under house arrest, making Ecuador’s granting of asylum somewhat moot. Usually in these situations, embassy staff will hustle the asylum seeker out in a diplomatic car, but the Ecuadorian embassy doesn’t have on-grounds parking, so those few feet of British-jurisdiction sidewalk between the embassy door and the street are causing him much consternation. How might he leave the embassy grounds?

1) Stick diplomatic plates on one of these bad boys and have him step into its cab from a balcony or roof.
Hertz lifter

2) In Europe, fugitive rapists get to walk free if they’re famous filmmakers. Assange is already famous, so all he has to do is make a movie, and he can be confident the court will reverse itself on extraditing him.

3) A bunch of helium balloons will lift a lawn chair and occupant, so he can wait for a strong wind blowing to the southeast and float away to France.

I’m confident this advice will help Assange achieve his freedom!

18-Aug-2012

The thermochemistry of fracking’s natural gas boom

Filed under: science — jlm @ 20:22

If you’ve been following along, you know that over the last several years advances in hydraulic shale fracturing (“fracking”) technology have opened up large new sources of natural gas to the energy production market. The Law of Supply being what it is, this has driven down the price of natural gas, and consequently electricity generation companies have switched from preferentially burning coal to preferentially burning natural gas, as that’s now the cheaper way to get a therm. The unexpected result of this is that the United States’s CO2 emissions from electricity generation have significantly dropped.

This is surprising at first. Why does switching from coal to natural gas reduce emissions so much? After all, they’re both fossil fuels. Well, coal is polycrystalline graphite with impurities, i.e., energetically essentially all carbon. To burn graphite, you put in energy to break C-C bonds then get energy when you form C-O bonds, and your only byproduct is CO2. Natural gas is primarialy methane, with other hydrocarbons and impurities. To burn methane you break C-H bonds, which are weaker than C-C bonds, and get energy from not only C-O bonds but also the stronger O-H bonds, so methane is a more efficient fuel. On top of that, much of your byproduct is water vapor, which doesn’t contribute to global warming.

Some numbers: Burning 1 mol of either graphite or methane produces 1 mol of CO2. Graphite’s molar heat of combustion is 393.5 kJ, while methane’s is 802.3 kJ. That means you get slightly over twice as many therms from burning methane as you do graphite for a given quantity of CO2 produced. So it’s no wonder that the switchover to natural gas has reduced CO2 emission so drastically!

An unregulated market is a double edged sword for your greenhouse gas policy, however. It’s just blind luck that a lower-carbon-footprint energy source became economical. The market can just as easily make natural gas less economical, or make a higher-carbon-footprint source (e.g., tar sands) economical.

Reflections on Barcelona

Filed under: biking, travel — jlm @ 15:38

I recently spent two weeks working in Barcelona, Spain. Here are some of my thoughts about the place.

Externally, the buildings exhibit some amazing architecture. It was a pleasure to spend free time simply wandering on my bike and gawking at the buildings. The architects of Barcelona certainly put a lot of effort into the aesthetics their works project out onto the street. Once inside, however, it seemed like basic considerations for the buildings’ users were not given. Most doors opened inward only, despite this being very dangerous if a building needs to be evacuated, say due to a fire. Very often there were stairs on the way to the elevator, often only two or three steps, making it gratuitously wheelchair inaccessible. This blatant disregard for personal safety and accessibility greatly lessened my admiration for the work the architects put into their buildings’ appearance once I recognized that it was a common theme throughout the city.

After a few days, I realized I was missing plants. Barcelona has very little green space. There are a ton of plazas, but they’re all done edge to edge in paving stones. The residential areas have no lawns or gardens, and there’s not even a strip of grass or trees between the sidewalk and road (instead, they park motorcycles there). I don’t understand why, but Barcelonans feel they have to pave every bit of bare dirt. In the less maintained areas plants would valiantly sprout through the gaps in the paving, but most places even these were trimmed away.

Language is interesting — the native tongue of Barcelona is Catalan, not Spanish. The Catalans call all Spanish castellano, though my Spanish was definitely not castellano but a weak mexicano. (In Spain, if you want some juice, that’s zumo not jugo!) A few people object to you not using Catalan with them — to them español mexicano in Catalonia is a no-no, as if weren’t the case that the only reason our southern neighbor uses any form of español at all is their countrymen of old imposed it upon them.

Except for the tourist areas, the entire city seems to shut down on Sunday. This was annoying, as I had mostly the weekends to explore, and for half the weekend everything is shuttered. Is Spain really that Christian and observant of the Fourth Commandment? I’m wondering if Spain can give their economy a much-needed boost by opening for all seven days.

Catalonian cuisine seemed to magnify some of the worst aspects of American cuisine: The portions are larger, more heavily salted, and have few vegetables. And they add some vices absent in American cuisine: there’s dessert at lunch, and the food is so very bland. I finally got fed up and had a chicken shawarma at a Turkish place just to have some spice, and even it was a pale shadow compared to any İstanbul street vendor. With these large, salty meals, in the summer heat, I was surprised at how small the drinks served are (typically less than 10 oz.) and no complimentary water. And the meals alone are pricey without the overcharging for tiny drinks. (Meals were expensive, but goods in shops seemed quite reasonably priced or even cheap. Faint comfort to a traveler, but better for residents.) Having enjoyed American interpretations of Spanish food, the cuisine was very disappointing.

Despite being there during record summer heat, I found biking around Barcelona to be very nice. (Just dress appropriately and stay hydrated!) The city is small enough that you can bike anywhere in it, and it’s mostly flat or gentle grades. There are many bike paths. Most streets are one-way, though you’re not allowed to turn on a red (oddly, this was adhered to, yet people would go straight on a red if there were no cross traffic). The intersections aren’t well signed, however, and this can pose a problem for navigation when you first go to an area. There are many interesting small alleys, and they don’t twist much, so dead reckoning works well. There’s very little space between parked cars and motoring ones, but this means there’s no danger from being doored, because everyone checks before opening their door, as otherwise they’ll lose it!

Powered by WordPress