Hacker News new | past | comments | ask | show | jobs | submit login
Rick Santorum's Fake Donation Meter (ricksantorum.com)
270 points by bithive123 on May 25, 2012 | hide | past | favorite | 93 comments



I don't think there's anything wrong, in principle, with this approach, so long as the simulated rate is calibrated frequently to the actual average donation rate.

Having it all wired up properly would require a whole lot of infrastructure, particularly for donation mechanisms that aren't online and aren't all tied in to a single system.


This is how I do it on my personal website (http://samryan.co.uk/). It makes no sense for me to put together a real automatically updating counter so every couple of days I check the real growth rate and adjust it manually. It obviously looks shady on a politicians website and I think doing it with something like donations where it's tied to a real world action is a bit... silly and they should have disclosed that it was an ESTIMATE however I don't think it is as heinous as other people suggested. It's only an issue if the donations don't exist.


It's a shame, because having an actual working one would be a really cool feature to do technically. But because of how easy to fake, it doesn't look like much. Then again, the more practical side of me says having a working one is a total waste of time 99% of the time. Everything's an estimate in some way.


In this [your] case, it should be just a matter of personal taste.

We choose to go to the moon!


There doesn't appear to be anything in this code to calibrate to the actual average donation rate. In fact it's not tied to any real amounts or rates at all. It's just a function of the current datetime.

UPDATE: They took the donation page down...

   Forbidden
 
   You don't have permission to access /stillneedhelp/ 
   on this server.


Unless they've changed the code, there are some manually adjusted values that estimate the average donation rate based on some magic number they plugged in from their own projections (/propaganda if you think this was intentionally misleading).

    val1 = 44000;
    val2 = 70000;
    maxVal = 100000;
    deltav = val2 - val1;

    vchange = deltav / deltat;

    if (now < t1 && val1 == '0')
        val = val1;
    else
        val = Math.floor((now - t1) * vchange) + val1;
If I had to guess, val1 was how many committed donations they had at 11am April 24th and val2 is how much they anticipated raising in the following 13 hours of April 24th. Note that Santorum suspended his campaign April 10th, so it looks like someone probably was updating this manually until the campaign was fully disbanded.


> There doesn't appear to be anything in this code to calibrate to the actual average donation rate. In fact it's not tied to any real amounts or rates at all. It's just a function of the current datetime.

I would assume that while the campaign was active they would periodically adjust the constants to reflect the current average.


That was a fast response. Does someone on HN work for Santorum?



you have 211 followers .. I don't think you have wider reach than HN.


It's hash-tagged on #Santorum.


oh, that would do it.


My guess is the same barely-competent webmaster who wrote the JS noticed a huge traffic spike in that directory, and disabled the index but not the cause of the spike. But we'll see... (Ed: downvotes make me think you were right. :)


You being downvoted could also be caused by you accusing the webmaster to be 'barely-competent'. This is an (afaics) unfounded accusation.


Yeah, I figured that was the real reason, the edit is tongue-in-cheek. But I don't think it's unfounded. Just look at all the comments criticizing the coding! (Particularly in Osiris' thread.) I don't consider myself a master programmer but at least I use 'var' by habit. Now one other objection I considered was the use of "barely-competent" as a term, which seems like a strange one since typically people are either competent or incompetent. But that's not really the whole picture in general and certainly not in coding. I don't just mean the levels of mastery[1], "barely-competent" here is the Just Good Enough (hey, it "works" for its purpose and most people won't know any better if they pay attention at all) and the Just Good Enough is often just fine in practice but it's not the actual goal. The goal is to do better, but if you never want to do better than the Just Good Enough, well, I for one don't want to work with you.

[1] http://www.zanthan.com/japan/archives/001004.html


Or: You were wrong to judge someone based on this tiny output.


Well, theoretically they could just have a guy manually pushing new rate values to reflect reality.

But that's a big theoretically. This is almost certainly malice.

And it would almost certainly have gone unchecked if the developer had only hidden the BS generator script on the server side.

But as others have pointed out, that's probably asking too much given the state of this code and given that the main page 403's but they left the BS script serving.


This is used to decide what dollar amount to display on the donation meter on this page: https://www.ricksantorum.com/stillneedhelp/

You can infer from the Javascript, but it just displays a dollar amount equal to the number of seconds elapsed since a certain time (edit: whoops, see below), according to your computer clock. If you refresh every second it will go up by $1 each time. If you set your clock back a year, the donation meter will read $-17 million.

Edit: Actually, this isn't quite accurate, it's closer to one dollar per two seconds. 1/(vchange*1000) = 1.7976923076923077 seconds to be exact...


Looks like they took the page down

Forbidden

You don't have permission to access /stillneedhelp/ on this server.


Largest DOUBLE value: 1.79769E+308


Mark-to-market accounting, or window-dressing as the accountants refer to it.


What? You mean a politician was using a simulation and presenting it as definitive? I'm shocked I tell you, shocked!

(with apologies to Captain Renault :-)

You could just read the quarterly reports he files with the FEC if you actually wanted to know how much he was bringing in. I suppose you could get him in hot water as an ethics violation for campaign reporting but outrage? A bit over the top I think. There are billboards that had a running total of the California state deficit, does anyone think they were repeatedly reading some sort of get_balance() api at the state treasury and putting it up? No, its a prop, a gimmick, an illustrative tool, and nothing more.


Seems a like a bit of an exaggeration to peg the OP as "outraged". They simply provided a link to an untruth.


Actually this raises some interesting questions when you think about how the average person is going to think when they see something like this. First impressions to normal people are that they would be real-time given the instantaneous nature of the internet.

Regardless, it's almost certainly false advertising which as you mentioned is ethically questionable especially since this is supposed to be a 'leader' of citizens.


"The right to private variables is not the right to a common good. It’s a me-centered right, that obviously started in the sexual revolution with contraception and obviously quickly evolved to abortion, and now has found its way into the marriage debate. And all those acts that were self-giving acts, self-sacrificing acts, have been polluted by this right to privacy." -- Rick Santorum


I'm pretty sure PEP 8 makes a sImilar argument for why privacy of underscore variables isn't strictly enforced in python.


I find it most disturbing that they are polluting the global namespace with all those variables and functions. Don't JavaScript developers these days understand how to properly scope their JavaScript?


As long as it's "single page bound" JS like this, I honestly don't think it matters one bit.

Reusable components and utility libraries is something different, of course.


It's still incredibly error prone and just bad practice. It's a telltale sign of a bad developer because a good dev would instinctively just use var without thinking about it. Good devs may make a mistake here or there but this is clearly well beyond a forgotten var keyword.


>> It's a telltale sign of a bad developer

I'm just guessing, but the site was probably not developed by a technical team, probably some web shop that specializes more on the design/layout/content side and not on the JS side.

So it's likely it's the work of a non-developer than a bad developer. The net result is the same (bad code) but the distinction is that the code was possibly written by someone who wouldn't even be considered a developer.


But when writing code, how do you know that it's always going to be "single page bound"? YAGNI is frequently useful poison and nothing more. When it's so easy to do it right the first time, why not?


> When it's so easy to do it right the first time, why not?

a) Because it isn't "right" as such. It's just "better" if the code is going to be reused. Which it isn't.

b) The code style serves as documentation. I can clearly read from this code that it's not a reusable component. It is now easier for me to get an idea of how and where this code is being used in the site.

c) Personally, I'm wary of "pre-emptive generalization". Every layer of abstraction makes the code slightly less readable. Also, unless there exists at least two use cases right now, you're not likely to get the reusability right anyway.


I like that bad namespacing is what you find disturbing here.


I can't help it. It's just the way I'm wired.


Are you really asking why a developer tasked with creating something intentionally deceptive didn't use best practices? I'm thinking not a lot of care or attention to anything was paid that day.


Different kind of ethics: "It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." (lost the source of the quote)


http://en.wikiquote.org/wiki/Nathaniel_Borenstein

To understand how these problems can be addressed, it is instructive to consider an analogy. Imagine, for a moment, that somewhere in the basement of the Pentagon there are two computers. They are identical hardware, and they run identical software; they are as alike as two peas in a pod. On each of them, there is an executable procedure called "DestroyBaghdad". On one of the machines, executing this procedure does nothing. On the other, the effects of executing the procedure are disastrous, at least for the citizens of Iraq. The only difference between the two machines is a single wire coming out of the back of the second machine.[1]

The point, of course, is that nothing inherent to a computational language is dangerous; danger is posed only insofar as the effects of executing statements in a language include "side-effects" in the external world. If all the "wires" connecting a computational language to the outside world are cut, then executing programs in that language is harmless. (An exception to this claim is that such a program can still tie up the CPU, virtual memory, or swap space on a machine by going into an infinite loop; this can be handled via resource limitations.)

[1]It should be noted that no ethically-trained software engineer would ever consent to write a "DestroyBaghdad" procedure. Basic professional ethics would instead require him to write a "DestroyCity" procedure, to which "Baghdad" could be given as a parameter.

http://www.guppylake.com/~nsb/CSCW-ATOMICMAIL.txt


Had me laughing so I tried to find it: http://en.wikiquote.org/wiki/Nathaniel_Borenstein


Probably wanted to make it more readable, it's not even minified.


I don't think a JSLint-compliant, file-minifying developer would need to resort to this kind of work.


I 'm implying s?he did it on purpose to shame his/her bosses.


Ah, perhaps this is the case. Would have been fun to stumble across a "Help, I'm trapped in a bullshit factory!" comment or something. But that would not help one's career.


I find the 8 space indentation most disturbing.


It's the Tab character.


Ah, so it is. Then I'm disturbed that browsers render a tab as 8 spaces.


https://developer.mozilla.org/en/CSS/tab-size was just implemented in the newest browsers, for all your tab-sizing needs :)


8 is the traditional size of tabs though, isn't it? Seems like a reasonable default. That's partially why some teams (mine included) discourages the use of tabs in source code - its appearance varies depending on what's rendering it, affecting code readability.


Patches accepted!


Was just looking at namespace best practices today for a utility library I was implementing. Is there a defacto standard?


The defacto standard is to put nothing in an enclosing namespace unless it's needed there. The purpose of functions (especially in a language like JS) is to wrap up everything that's needed to accomplish a given task and leave no mess behind.


Then why oh why are variables global by default? (this is not meant as an attack on your point, I fully agree, I just find this awfully frustrating about JS. Sane languages have scoped by default and a global keyword, not the other way around)


You'd have to ask its designer. Sloppy programmers do like globals and JS was targeted for them.


The web developers they hired were liberal.


In case they change it, here is a copy: http://pastebin.com/3Wv4AJSF


Pretty amusing. Google actually does something similar on the Gmail homepage to indicate the amount of free storage but they're doing an actual estimate using linear interpolation. You can view the source on the gmail home page and look at the updateQuota method.


I just donated $17.99 so that they can buy Crockford's JavaScript: The Good Parts.


var statements are for commies.


If your variables aren't doing anything wrong, what do they have to hide?


Also funny: "We ran a strong race and practiced fiscal discipline."

For a fundraising drive to fix their debt problems.


For comparison, does someone want to post the source code to GMail's meter:

"Over 10250.602608 megabytes (and counting) of free storage."


GMail's meter is fine -- it's displaying the state of a value which Google has decreed will increase at a set rate. Unlike Santorum's donations, it's not an unpredictable measurement.


Indeed. It looks like they have their goals set for a long time. http://i.imgur.com/WvYcq.jpg

It finds the closest entry in there to the current value of "new Date().getTime()". Then it just adds (what roughs out to) .000004 for every second's difference between the 0 value and the current getTime() value. So today it reads 10250 MB, which must come from index 2 of that array + enough seconds to add 10 MB and some. Definitely more legit than Santorum's.

Here's the code for the counter (it's embedded in that HTML file) http://pastebin.com/8tebjT79

The actual subtractions of the current time from the one in the array seem to be more detailed than what's put on the page, which is being rounded. A sample of input for format():

    10250.60874337952
    10250.608747448896
    10250.608751518273
    10250.608755583586
    10250.608759652963
    10250.608763722339
    10250.608767787651


IIRC GMail's meter is updated at a rate which is actually accurate, and is simulated so that the page doesn't need to keep asking google for the capacity.


It fascinates me that Americans might see this as acceptable or even that it is regarded as most likely to be totally legal and hence acceptable in nature. In Australia I would be very confident that this type of falsified campaign disclosure would be illegal or at least fall foul of a whole range of parliamentary and governmental standards.


> Americans might see this as acceptable

Do you have any evidence we do?


wait, did anybody actually think those donation counters were real?


Honestly in other cases they are. I had personal experience developing tools used for Howard Dean's 2004 primary campaign (as a volunteer not staff) and in that case it was certainly real.

I'd be very, very surprised if the ones used by Ron Paul and Obama weren't real. They have good engineering talent there, and (in the case of Obama at least) good political talent. This runs contrary to both.


I was going to check and get back to you, but I can't find one on either of their sites.


They run them during specific fund-raising drives.

You can also see them on peoples personal MyBO pages.


Can confirm that the thermometers on Obama fundraising pages (MyBo and others) are real (not simulated and not manipulable). It's a feature of the donation software they use.

(My employer develops it.)


It wouldn't be impossible to implement. Maybe it would only reflect online donations but still...


Same thing as the Google GMail "space available" counter. As long as you back it up by real numbers and adjust the rate appropriately no harm, no foul.


To be fair, it's not any less accurate than prayer.


Though I have no idea how much has truly been donated to Rick Santorum, but I would bet that growing thermometer did help contribute to that. Perception is an incredibly strong tool that can be used to elicit reactions like donating "because everyone else seems to be". Sad that they're using such a tacky tactic.


CiviCRM (which appears to be Santorum's campaign tool) comes with a fundraising thermometer out of the box.


NICE! Looks like he's giving back - http://imgur.com/PeVdv


Aren't there rules about political candidates disclosing donations? And doesn't this violate those rules?


They have to accurately disclose itemized contributions to the FEC, but a public website counter ain't the FEC.


Is he technically still a candidate? Maybe he's getting around those rules by not being a candidate anymore.


I think he suspended his campaign. Suspending means that while for all intents and purposed but one, the campaign is ended. The exception is that it allows the candidate to raise money (usually to pay off campaign debt). Ending a campaign means you hold the bag, if you're in the red, as I understand it.

So, technically, yes, still a candidate.


Actually your candidacy is its own separate legal entity, so you're not legally holding the bag. However your reputation is at stake, if you ever want to run for public office in the future, nobody will lend you money if you've proven to be a bad credit risk in the past.

See http://www.businessweek.com/articles/2012-04-19/the-business... for more.


Ah, good distinction. Thanks for the explanation.


How does one tell when a politician is lying...


This is awesome. I know of scammy companies that have gone out of their way to use actual live subscriber counts on their sites, yet this idiot uses a fake one.


Wasn't there a post on HN recently about YouTube's viewcounts being extrapolated and not actually real-time?


Witch hunt anyone?


someone seems to have thrown a hasty 403 atop https://www.ricksantorum.com/stillneedhelp/


pander.js


What? A politician being disingenuous? I'm shocked! SHOCKED!


This is not reddit.


This is an insightful comment.


I bet there are left-wing politicians that do the same thing...but we won't ever see them here because republicans are the only ones that are bad.


Alright, we got our Santorum fix for the month. Thanks, Reddit.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: