I should know better, but recently I extended Ext.Panel and defined the plugins array as part of the object literal.
MyKlass = Ext.extend(Ext.Panel, {
plugins:['cool', 'cooler'],
initComponent:function() {
MyKlass.superclass.initComponent.apply(this, arguments);
}
});
That’s all well and good, except there’s an important consequence to the above. As mentioned in the documentation, in reference to the second argument to Ext.extend for the two parameter signature: A literal with members which are copied into the subclass’s prototype, and are therefore shared between all instances of the new class.
.
In short, it means every instance of MyKlass shares a reference to the plugins array, not its own copy. That can be a problem if you need to add or remove a plugin in instances or subclasses.
If you enjoy the above pattern, you can clone the array so a pristine copy is being modified. Below I use the Ext.ux.clone extension when extending my class above. The plugins array is still shared amongst all classes and subclasses, though.
newKlass = Ext.extend(MyKlass, {
addPlugin:false,
initComponent:function() {
if(this.addPlugin) {
this.plugins = Ext.ux.clone(this.plugins||[]).concat('new-plugin');
}
MyKlass.superclass.initComponent.apply(this, arguments);
}
});
Another approach is to define the array in the constructor or within initComponent itself.
MyKlass = Ext.extend(Ext.Panel, {
constructor:function(config) {
// Each instance gets its own copy now -- the prototype does not have plugins applied to it
if(this.plugins) {
this.plugins = this.plugins.concat('cool', 'cooler');
}
else {
Ext.apply(this, {plugins:['cool', 'cooler']});
}
MyKlass.superclass.constructor.call(this, config);
}
});
Strings, Numbers, and Booleans aren’t a worry.
Last July, I spoke with someone at Embarq about our bill. My goal was to reduce the monthly cost if possible. She was more than happy to help. Six months later, I notice all our packages — the multi-line, the DSL — are now 2 year bundles.
Naturally, I would never have signed up if the Embarq representative had said I was authorizing a two year commitment. I don’t believe in multi-year agreements. It limits options. So we’re now seemingly stuck with Centurylink until our “agreement” expires. What a scam.
Running VoIP on Brighthouse is looking more and more worthwhile all the time. It appears I have 18 months to plan.
Another fun usage of XTemplate with an assist from DataView’s prepareData function, let’s wrap each paragraph separated by two newlines in actual paragraph tags instead of using Ext.util.Format’s nl2br function, as BR tags cannot be styled.
var config = {
xtype:'dataview',
singleSelect:true,
autoScroll:true,
cls:'custom',
overClass:'x-view-over',
itemSelector:'div.wrap',
prepareData:function(recordData, ri, record) {
recordData.message = recordData.message.split(/\n{2,2}/);
return recordData;
},
tpl:new Ext.XTemplate(
'<tpl for=".">',
'<div class="wrap">',
'<blockquote>',
'<tpl for="message"><p>{.}</p></tpl>',
'</blockquote>',
'<cite>',
'<span class="author">— {author}</span> @ <span class="date">{when}</span>',
'</cite>',
'<div class="x-clear"></div>',
'</div>',
'</tpl>',
'<div class="x-clear"></div>')
};
Above, I replace the message property’s value with an array split on the expression above. Then, I can use utilize a child template and XTemplate’s magic dot operator when looping over the message property array. Now, I have nicely wrapped text I can easily style instead of a bunch of double BR tags.
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
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.
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.
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.
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.
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.
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.