Tuesday, July 31, 2007

Experts-exchange deobfuscator

Here's a little something I ended up with. Someone on Digg mentioned a de-obfuscator for experts-exchange.com postings, and looking at it I realized it used ROT13 but did an AJAX call to someone's free rot13 service, which seemed a little inefficient. (And impolite)

So here's a version that does it locally and also does it better by only converting actual text in the posting.

(Kudos Code2HTML)...

// ==UserScript==
// @name Experts Exchange Deobfuscator
// @author Terr
// @namespace http://deltanin.blogspot.com/
// @version 1.0.0
// @description Makes content in experts-exchange visible.
// @include http://www.experts-exchange.com/*
// @include http://experts-exchange.com/*
// ==/UserScript==

Merged from two scripts

Improved with better text conversion by using the DOM to find text nodes
instead of changing innerHTML.

document.addEventListener('load',function (e) {
function rot13init(){
var map = new Array();
var s = "abcdefghijklmnopqrstuvwxyz";

for (var i=0; i<s.length; i++)
map[s.charAt(i)] = s.charAt((i+13)%26);
for (var i=0; i<s.length; i++)
map[s.charAt(i).toUpperCase()] = s.charAt((i+13)%26).toUpperCase();
return map;
function rot13(rot13map,a){
var s = "";
for (var i=0; i<a.length; i++)
var b = a.charAt(i);
s+= (b>='A' && b<='Z' || b>='a' && b<='z' ? rot13map[b] : b);
return s;

var elems = document.getElementsByTagName("div");
var todo = [];
for(var i =0; i< elems.length; i++){
var elem = elems[i];
if( elem.className == "answerBody quoted"){
if( elem.getAttribute("id") == "intelliTxt"){
}else if( elem.className == "blur"){
elem.className = "seethru";
}else if(elem.className == "hasMouseOver"){
elem.onmouseover = function(){};
elem.onmouseout = function(){};
var rot13map = rot13init();
for(var i =0; i < todo.length; i++){
/* We're inside a comment, but they can have BR tags as well as text. Only work on text.*/

var elem = todo[i];
for(var j =0; j < elem.childNodes.length; j++){
var subnode = elem.childNodes[j];
if(subnode.nodeType == 3){
var newnode = document.createTextNode(rot13(rot13map,subnode.nodeValue));


Friday, July 27, 2007

Senate Votes and UserJS

Well, I've accomplished a dubious achievement, melding the areas of politics and programming.

I've just finished a UserJS script—a type of Javascript module which several popular browsers support—that will automatically calculate a 3x3 table when you visit a senate roll call vote page, showing how groups voted.

Of course, I don't really want to visit each and every one of the 478 cloture votes since 1989 personally, but it does get me a step closer to automatically scraping that data.

And yes, I first tried Python and XML libraries, but unfortunately the Senate webmaster doesn't seem to think that XHTML is important.

I'll be posting the script up on UserJS.org when I get a chance.

Thursday, July 26, 2007

Internet Explorer Sucks

I'm posting this mainly so that anyone else with the same problem won't tear as much hair out as I have.

I'm using Javascript to add new content to a page via the DOM methods. The page is set as XHTML transitional. With IE6 and IE7, I'm having stupid rendering bugs.

  • When you make an HTML table, it does not display in IE6 or IE7. In order to make it display, you must wrap your row elements within a <tbody> element. According to the HTML 4.01 spec, this is actually an optional element.

  • A table cell's "rowspan" and "colspan" attributes are ignored by IE7, unless you capitalize the letter S on the attribute! This is in violation of the XHTML spec which says that all attributes should be lowercased. (Not tested in IE6)

Remember kids, friends don't let friends use Internet Explorer.

Monday, July 23, 2007

Who likes the filibuster now?

Well, I hadn't anticipated using this blog again--my personal site has been pretty much in permanent-under-construction status since starting my current job.

Anyway, with the recent filibuster in the Senate, I decided to re-examine some old history and congressional records--with surprising results. Last Wednesday, I decided to try to present the results to some sites like ThinkProgress or Crooks & Liars, but nobody has gotten back to me so I decided to dust this blog off.

Recently there has been quite a bit of discussion regarding "filibusters" in the senate, so I set out to try to check the record. Just how much was this tactic used and who probably used it?

In the last several years, most talk of filibusters have actually been about cloture votes, where the Senate needs 60 members to vote showing that they are ready to make a final vote on the subject. Most notably, during 2005 Democrats used this method to block the appointment of several judicial nominees, and the Republicans threatened to change the rules via the so-called "Nuclear Option" to bypass it.

Now, Democrats have a slim Senate majority, and Republicans are using some of the same tactics party leaders once decried.

But how much are they doing it? Let's look at the numbers for the Senate, considering when it was, how many days they were working, and how often a cloture vote failed. I'll use the acronym "FPD" to describe the assumed number of "Filibusters per day" of Senate activity. (Note that I had the rows horizontally sized to make a visible chart, but blogger strips out style attributes.)

Year Days Failed Clotures FPD
2001 173 8
2002 149 13
2003 167 22
2004 133 14
2005 159 5
2006 138 12
2007 108* 19
*Ongoing session

One important caveat to these statistics is that I cannot say what number of failed cloture happened specifically to block legislation. But with the basic assumption that the minority party cannot initiate these votes and has the most reason to block them, some interesting numbers still emerge.

Period FPD
2005: Republican's "Nuclear Option" threat
2001-2006 average: Democrats in minority
2007: Republicans in minority

  • Compared to 2005, when Republicans were threatening to change the rules, FPD is 5.67 times higher now that Republicans are the minority.

  • Compared to the Republican-majority 2001-2006 years, overall FPD is 2.18 times higher.

  • The current year has the highest FPD than any of the previous years shown.

The implications are not good for Senate Republicans: It suggests that—now that positions are reversed—they are willing to filibuster more often than the Democrats previously labeled "obstructionists" for doing the same thing.


Update: Ideally, I'd prefer to replace "failed cloture votes" with "votes where most of the votes against it came from the minority party, and where most of the minority party participated". It would be a much better metric. Unfortunately, it's difficult to get those figures from the Senate records, although if enough people show interest I may reconsider the effort.

Update: As 2007 draws to a close, I wanted to update the stats for 2007: The FPD ficgure is virtually unchanged, following the level I calculated back when I wrote this post. (~1% increase of the FPD)