Hack for remotely bouncing ZyXEL modem EQ-660R

EmbarqCenturyLink goes down so often, I finally had to hack together a lame heartbeat script to bounce the connection if it’s down. I run the script below via cron every 5 minutes. The target IP is this blog host, because it ought to be up and reachable. I later considered using the default route’s IP, but am too lazy to write the two pipes needed to tickle out just the IP from `ip route`.

#!/usr/bin/ruby1.8
 
require 'rubygems'
require 'net/ping'
require 'open4'
 
# Another idea is to use `ip route` and grep default.
# If the default ISP route is missing or cannot be pinged
# then the modem should be reset.
 
Net::Ping::TCP.service_check = false # seems to have no effect for TCP
p = Net::Ping::TCP.new('208.75.86.204', 80)
 
unless p.ping? or p.ping? or p.ping?
    # debugging
    puts `ip route`
    puts `/sbin/ifconfig eth0`
 
    status = Open4::popen4("/bin/netcat -q0 192.168.2.1 23") do |pid, stdin, stdout, stderr|
        # Magic sequence to restart device
        stdin.puts "passwd"
        stdin.puts "24"
        stdin.puts "4"
        stdin.puts "21"
        stdin.close
    end
end

Intuit, always trying to rip you off

When Intuit originally came out with its Web based version of TurboTax, they’d save your information and let you access it again the following year and file at no change, assuming you’re using the “free” option they offer. While they still offer it this year, unlike last year, they won’t pre-fill your personal information, even though they already have it, unless you cough up $15. (Last year, if you had your AGI you could pre-fill for free still — Or they’d charge you $20 to tell you what it was.)

Naturally, if you didn’t keep your prior year AGI, you can still get a PIN for filling by calling the IRS at 1-800-829-1040 via an electronic phone system, completely free. Further, I opted to type in my name, birthday, ssn, and address manually. Hardly worth $15 to me. What a ripoff.

As always, Intuit continues to suck.

Oh, here’s the hilarious part — They transfer the number from last year for you anyway at the end, even if you don’t pay them a dime! They also transfer over your PIN from the prior year.

The scaremongering when selecting between the ‘free’ option and the others is more annoying with TurboTax every year.

Holy shit. Just got ripped off. They’re charging me for Florida filling. There is no filling in Florida except under specific circumstances as a non-business owner I don’t fucking meet!

Solved. I had to delete my unnecessary state filling from the State section. Lovely.

One more reason Intuit sucks

What if there was a magical way to save California taxpayers time and money?

The state of California, which collects wage data more speedily from employers — with a Jan. 31 deadline — shows what is technically possible. With little money to finance the project, and over the objections of the tax-preparation software lobby, the state began a small pilot project to offer a pre-filled state tax return, called ReadyReturn, to a small sample of taxpayers with simple returns for the 2004 tax year. Invitations went out to about 52,000, and fewer than 12,000 ended up participating.

Naturally, Intuit isn’t a big fan of saving your tax dollars:

California has budgeted only $10,000 for getting word out. The meagerness of the funds allotted for the ReadyReturn program reflects the strength of its political opponents, Mr. Chiang said. The most vigorous opposition comes from companies that sell tax-preparation software, “principally, Intuit,” he added.

INTUIT, which publishes TurboTax, does not dispute this description.

“We’re a California company and actively participate in the political process,” said Julie Miller, a company spokeswoman. “Our position has consistently been that ReadyReturn duplicates what is already available.”

Needless to say, what’s already available from Intuit isn’t free by a long stretch.

On the heels of last week’s Supreme Corp decision allowing corporations to spend as they please in the last 60 days before an election, nonsense like this is only going to get worse.

Software that kills

What a spectacular level of incompetence, to produce software that when it fails, does so in an open state. In computer security, the goal is for systems to fail in a closed state by default, so a breach is more difficult. Clearly Varian has a different vision for software quality:

The investigation into what happened to Mr. Jerome-Parks quickly turned to the Varian software that powered the linear accelerator.

The software required that three essential programming instructions be saved in sequence: first, the quantity or dose of radiation in the beam; then a digital image of the treatment area; and finally, instructions that guide the multileaf collimator.

When the computer kept crashing, Ms. Kalach, the medical physicist, did not realize that her instructions for the collimator had not been saved, state records show. She proceeded as though the problem had been fixed.

Surely, it ought to follow that when developing medical devices that provide potentially lethal does of radiation, the device should fucking fail in a safe state. Holy shit. Meanwhile, I suspect no one from Varian will ever face criminal prosecution for such life ending incompetence.

Words fail.

Just which decade is it?

I stumbled upon this hilarity from the PostgreSQL docs.

The first century starts at 0001-01-01 00:00:00 AD, although they did not know it at the time. This definition applies to all Gregorian calendar countries. There is no century number 0, you go from -1 century to 1 century. If you disagree with this, please write your complaint to: Pope, Cathedral Saint-Peter of Roma, Vatican.

Especially funny since I’d just read this.

At its root, the argument stems from the fact that the creators of the Western calendar were not Mayans or Hindus, peoples with both the concept and a symbol for zero. Hence, our calendar recognizes no year zero. Every decade begins not in the year ending in a 0, but ending in a 1, 2011, not 2010.

Fun stuff.

Progressives have to be nuts

Jerome a Paris makes an excellent point which I’ve long felt to be true.

But where is the “fucking nuts” left that scares the right to death and makes them want to compromise with Pelosi at all costs? Where are the people arguing for 90% marginal tax rates on the rich, and cancelling the banking licences of banks that charge usurious rates on credit cards, and closing down the insurance licenses of companies that deny care to anyone, and setting minimum wages at levels that allow for decent living standards, and putting taxes on imports from countries that let kids work or have no environmental rules (all things that get very real public support if you actually ask people rather than pundits and lobbyists)?

If Progressives aren’t willing to throw establishment Democrats under the bus, as movement conservatives have been doing with their Republican counterparts for more than a decade, no one will ever care about our demands.

The above also ties in with the concept of the Overton Window, which thereisnospoon frequently champions.

With that in mind, happy New Year.

Say goodbye to Suzanne Kosmas D-FL

I look forward to her losing her seat to a Republican in 2010. From HuffPo on why the banksters own us all, The Cash Committee: How Wall Street Wins On The Hill:

Then Waters chastised Kosmas for skipping out: “Even yesterday when we were engaged with consumer advocates, one member got up and left and went to a fundraiser with the banking community, in the middle of all that. Well, all I have to say is, I’m hopeful that our advocates will be stronger than ever and we will fight against this opposition.”

What a sick fuck. Rahm came down and did a fundraiser for her when she was running, so I can’t say I am at all surprised she’s a shitty rep.

Another good reason not to give any money to the DCCC when they come calling. Blue Dogs is where that money goes. It goes to Democrats that don’t give a fuck about the people they represent. Surprise.

Some ExtJS patterns I enjoy

It’s always nice to stumble upon patterns that make code both functional and beautiful at the same time. Among those, of late I have been abusing these patterns when developing ExtJS components.

For example, a pattern from ExtJS itself uses Ext.applyIf to both ensure an object literal exists and then to apply default values unless they’re already defined. Such a pattern can find widespread use in any project.

this.simpleConfig = Ext.applyIf(this.simpleConfig||{}, {
  width:500,
  height:250
});

Another I rather enjoy I first noticed in an Ext Direct implementation for Rails. The functions being applied are defined after the plugin on a function prototype specifically for that purpose. It’s nice and clean.

liaison.klass.plugin.OnData = Ext.extend(Object, {
	constructor:function(config) {
		Ext.apply(this, config);
	},
 
	init:function(p) {
		Ext.applyIf(p, liaison.klass.plugin.OnData.Methods.prototype);
		p.addEvents('data', 'update-data', 'create-data', 'delete-data');
		p.on('data', p.onData, p);
	}
});
 
liaison.klass.plugin.OnData.Methods = function() {};
liaison.klass.plugin.OnData.Methods.prototype = {
 
	onData:function(action, result) {
		this.fireEvent(action+"-data", this[action+"Record"](result));
	}
};

Another pattern from ExtJS itself I hadn’t thought to mention, above, is concisely defining and calling functions based on some string. For example, I avoid the need for a case statement or an if block when deciding amongst functions prefixed with the string action. Instead, onData is a compound one liner that fires an event based on the results of a conditionally named function. Fun!

Finally, I noticed a short pattern for managing namespaces in a plugin by ExtJS forum member stephen.friedrich. I employ it when building up my various FormPanel classes.

(function() {
  var ns = Ext.ns('liaison.view.form.membership');
  ns.NewPanel = Ext.extend(liaison.components.form.DefaultFormPanel, {
  ...
  });
  Ext.reg('membership-new-form', ns.NewPanel);
)();

Simple, but effective. It’s nice to collect private field configuration items in local variables.

What patterns do you enjoy using?

Failing fast, Ruby style

While building up the server side RPC methods for client side calls from ExtJS’s new Direct RPC framework, I thought it would be useful to fail fast whenever the client caller violated the interface contract. Enter fail fast.

def submit(params)
  action = params.delete(:action)
  id = params.delete(:id)
  assert(action) {|v| ['update', 'create'].include?(v)}
...

Further up the stack, we can handle the exception and cleanly fail the client side request. From within active-direct.

    def invoke_method(model, method, parameters, tid)
...
      unless parameters.nil?
        return_val = model.constantize.send(method, *normalize_params_for(model,parameters))
      else
        return_val = model.constantize.send(method)
      end
      result['result'] = return_val.nil? ?  "" : return_val
 
    # Must catch descendant of Exception explicitly
    rescue FailFast::AssertionFailureError => e
      Rails.logger.error result['type'] = 'exception'
      Rails.logger.error result['message'] = e.message
      Rails.logger.error result['where'] = e.backtrace.join("\n")
...
    ensure
      return result
    end

The entry point to a RPC is a good place to ensure contract validity.

Still no cramdown — Yeah, DCCC still wants your money!

I get spam:

Jason –

This afternoon, the House passed a bill 223-to-202 tightening financial regulations and ensuring we put Main Street first.

For eight long years, President Bush and his Republican allies ignored growing risks in the financial markets. The Republicans failed to regulate financial markets leaving the big banks to take huge risks with our money and leaving taxpayers with the bill.

Today, Democrats took bold action and voted to protect Main Street’s families and small businesses — just days after Republicans were huddling with special interest groups in the Capitol over the strategy to kill financial reform.

But, unfortunately we know what that means - fat cat special interests will be gunning for Democrats who stood with us. The U.S. Chamber of Commerce has already pledged over $2 million in advertising.

That’s why this week we asked you to help us raise money for our Main Street Democratic Fund, and I am proud to announce you helped us to shatter our goal of raising $50,000 this week. We can’t thank you enough.
http://dccc.org/blog/archives/gop_masquerade/

We will keep you posted as we continue to fight for health care reform and help our candidates prepare for 2010. Thanks again for standing with us as we continue to stand up for you!

Best wishes,

Jon Vogel
DCCC Executive Director

P.S. For those of you who will celebrate tonight, the DCCC wishes you a very Happy Hanukkah!

Contribute Today:

But cramdown isn’t included.

The plight of homeowners has become a volatile political issue. On Friday, as the House passed a series of new financial regulations, it narrowly defeated a provision that would have allowed bankruptcy judges to modify the terms of mortgages. The measure was strongly opposed by the banking industry.

Maybe someone should ask Congresswoman Bean why that might be?

The Audit the Fed provision did make it into the house version of the bill. It’ll be interesting to see if such a provision survives both the Senate and the conference committee.