TPM News

A federal district court judge in Florida ruled today that a key provision in the new health care law is unconstitutional, and that the entire law must be voided.

Roger Vinson, a Ronald Reagan appointee, agreed with the 26 state-government plaintiffs that Congress exceeded its authority by passing a law penalizing individuals who do not have health insurance.

"I must reluctantly conclude that Congress exceeded the bounds of its authority in passing the Act with the individual mandate," Vinson writes. "Because the individual mandate is unconstitutional and not severable, the entire Act must be declared void."

[Emphasis added]

Read More →

1||Unrest continued over the weekend in Cairo as protesters demonstrated against President Hosni Mubarek. Check out TPM's Egypt Wire for live updates on the protests.

Pictured: January 28, 2011. ||Newscom/PTS&&

2||Cairo, January 29, 2011.||Newscom/Zuma&&

3||Cairo, January 28, 2011.||Newscom/Sipa&&

4||Cairo, January 28, 2011: Protesters stand on vehicles abandoned by the Egyptian Riot Police.||Newscom/DPA&&

5||Cairo, January 28, 2011.||Newscom/Sipa&&

6||Cairo, January 30, 2011.||Newscom/MaxPhotos&&

7||January 30, 2011: Soldiers detain suspected looters in Cairo.||Newscom/DPA&&

8||January 29, 2011: The National Democratic Party headquarters in Cairo. ||Newscom/DPA&&

9||Cairo, January 29, 2011.||Newscom/MaxPhotos&&

10||Cairo, January 28, 2011.||Newscom/PTS&&

11||January 30, 2011, Cairo.||Newscom/Sipa&&

12||January 29, 2011: A soldier stands guard at the Egyptian National Museum in Cairo after the army reportedly arrested 50 men who were trying to loot it.||Newscom/PTS&&

13||Cairo, January 28, 2011.||Newscom/Sipa&&

14||Cairo, January 28, 2011.||Newscom/Sipa&&

15||Cairo, January 29, 2011.||Newscom/Sipa&&

16||January 30, 2011: Protesters rally around Egyptian diplomat Mohamed ElBaradei in Cairo, who called on Washington to "cut off life support to the dictator."||Newscom/DPA&&

17||January 30, 2011, Cairo.||Newscom/MaxPhotos&&

18||January 28, 2011, Cairo.||Newscom/PTS&&

19||January 28, 2011, Cairo||Newscom/Zuma&&

20||January 30, 2011, Cairo||Newscom/Sipa&&

21|| January 28, 2011, Cairo||Newscom/Sipa &&

22|| January 28, 2011, Cairo||Newscom/Sipa&&

23||January 29, 2011, Cairo||Newscom/PTS&&

At an event with progressive activists last week, Senate Majority Leader Harry Reid took major Social Security cuts and privatization completely off the legislative table.

"As long as I'm the Majority Leader, I'm going to do everything within my legislative powers to prevent privatizing or eliminating Social Security," Reid said. "I'll simply say it's off the table."

Read More →

The D.C. insider whose firm sponsored an event in support of an Iranian opposition group which is currently considered a terrorist organization by the State Department admits that the group, known as the MEK, is unlikely to be the successor to the Khamenei regime. Neil Livingstone, the Chairman and CEO of Executive Action, LLC, told TPM in an interview that his group was supporting the MEK for the sake of "the Iranian opposition in general."

Read More →

CREW got a hold of a bunch of letters to House Oversight Committee Chairman Darrell Issa from trade association, industry, and think tank leaders, which identify aspects of the federal regulatory regime that they believe Issa should investigate to make life and profits easier for businesses.

The one that most neatly reflects the priorities of the conservative movement comes from the Heritage Foundation, which is asking Issa to attack decades worth of regulatory and statutory worker and consumer protections.

Here's the laundry list:

Read More →

The family of John Wheeler III, the former Republican appointee who worked on behalf of Vietnam veterans, is offering a $25,000 reward for information leading to an arrest after the state medical examiner's office said Wheeler died of blunt force trauma.

The Associated Press reported that family attorney Colm F. Connolly told the News Journal of Wilmington that the family is desperate for more information about his death.

Read More →

Amiable introduction

Greetings, all. Over the next few months — and, God-willing, for ages to come — we will be rolling out a series of open-source tools to contribute to the growing, fecund field of journo-coding/data-driven-reporting/technocratic inquiry. See, we are in the business of standing on the shoulders of giants, and we think you should be as well. Chances are we are already standing on your shoulders. We look forward to the ouroboros imagery that this code dependency encourages.

But enough introduction. Is this a prologue, or the poesy of a data-driven-reporting-driver? Without further yammering, we are proud to introduce Silver, a Redis-backed database cacher, indexer and searcher.

Boilerplate blues

So, what is Silver, and why does anyone need it?

Sometime in 2009 — the exact details are lost to my youth, novice and languor — Salvatore Sanfilippo released Redis, "an open source, advanced key-value store." Now, many people already have heard of Redis, but for those who don't anxiously refresh Hacker News for the latest scoop on NOSQL databases, angels, b-trees and heated bit-twiddling, here's a brief introduction. Redis is similar to mongoDB, Cassandra or any of the other hot, new alternatives to relational databases such as MySQL or PostgreSQL. Rather than storing data in a logical system of schemas, joins, associations and all that jazz, so-called NOSQL databases, such as Redis, simply store data as the values of keys. Of course, this is a gross simplification. The way these products accomplish this and the various, sophisticated abstractions of this basic idea are manifold. You are welcome to read about the differences that make each of these products unique. Just not here.

What are the advantageous to Redis and its ilk?

  • They are deadly fast. Redis keeps all of its key-value pairs in memory. Tim Lossen compares the speed advantage to the difference between taking the Eurostar from Berlin to London and pushing a broken car the same distance. (10 hours vs. 114 years)
  • They are light, easy to set up and maintain. Replication, for example, requires a single line of configuration.
  • Redis, at least, does more than just store data. Need a simple PubSub messenger? Redis does that as well, making it perfect for event-driven applications, real-time, socketed webapps and whatnot.

However, these fancy new data stores are not perfect and, likely, won't replace traditional relational databases. They are not ideal for large datasets because they hold all or much of their data in memory. Furthermore, they are new territory. Whereas there are legions of MySQL sages meditating inside the decommissioned shells of old Oracle machines, even the NOSQL forerunners only have a few years experience. This makes troubleshooting rarely a routine ordeal, especially at an enterprise scale. Just look at what happened at Digg when they flipped the switch to Cassandra. (Note: this is not a criticism of Digg or Cassandra. Just a demonstration that new things are sometimes touch-and-go at scale.)

But there are some (read: many, many) things that Redis is great at. We already use it for real-time stats tracking and as a caching layer for many of our applications. In fact, we are so loyal to Redis that we found ourselves writing boilerplate for Redis caching in almost every new app we wrote. Need to slurp tweets? Shouldn't have to hit Twitter every time, why not store the tweets in Redis. Just gotta access stories and pictures from a CMS database? Tens of thousands of entries later, this become a Herculean task for MySQL, especially at high traffic. Solution: cache it in Redis. Need to index your images by their captions? You could use Sphinx or ... just use Redis. It's really a swiss-army key-value-storing, pubsubbing wonder.

See the issue? When you have a hammer and everything is a nail without that big, flat top part, you get tired of having to weld heads.

A challenger appears

Enter Silver. Silver is designed to be a simple, lightweight wrapper for all your calls to a database that you want to cache or index with Redis. It is completely database/web-service agnostic so you should be able to use if for anything you can imagine caching. This is all well, but you are just here to see how this works. Right. (What follows is taken from Silver's README. If you have already read, you already got it.)

First make sure you have Silver installed.

gem install silver

Now, let's pretend you have an app that queries your database for entries frequently. Entries are added frequently. Furthermore, you only want Entries that come from a specific blog, blog #12. Also you want to grab something from an association of the Entry row in the database. Let's say the author's name.

First, instantiate a new cache object.

cache ="12_entries","created_time") do |date|
  Entry.all(:order => :created_time.desc,
       => date, 
                :blog_id => 12)

The first paramater passed to the constructor is the name you want to give to this cache in Redis. Silver lets you creates as many caches for as many different queries as you would like. The second paramater is the name of the field that you will be using to determine if there are new entries. Finally, you pass the constructor a block that will receive the date of the newest cached entry from Redis. You must return the entries in reverse chronological order for Silver to be able to keep them in order. Silver will then query the database/service for newer entries when the instance's find method is called. This is what a find call looks like:

results = cache.find do |entry|
  attrs = entry.attributes
  author = {:author_name =>[:name]}
  attrs.merge author

The find method of a cache instance takes a block that will be called for every new entry. The results of the block call should be a hash that will be stored in the cache. The whole thing will be converted into JSON and stashed in the Redis cache. From now on the database will never have to be hit again to return this value. The find method returns an array of all the results old and new from the Redis cache.

If you just want to read from the cache without hitting the database, simply call find without a block and with a single param: false

results = cache.find(false)

Currently, the cache does not support the changing of cached entries and is, thus, intended for data that is unlikely to change once it has been written to the database. This feature will be included in future releases of Silver.

Finally, Silver provides a cull method.


This will cut the Redis cache down to the 30 most recent items.

However, Silver is not just a simple cache. It can also be used to index a database. It is optimized to index based on short text, such as names, captions, tag lists, excerpts, tweets etc. There is nothing stopping you from using on longer fields such as body text except the size of your memory allotted to Redis. Silver uses a stupidly simple fuzzy text search. The search will likely be augmented in the future.

Here's how you would index a mess of photos by their captions, falling back on their filename if no caption is given. First, instantiate a new index object.

index ="blog_pictures","created_time") do |date|
  Picture.all(:order => :created_time.desc, => date)

This is the same deal as before with Silver::Cache: redis key name, time field, ordering block. Next, call the find_and_update method of the instance.

index.find_and_update do |result|
  output = result.label || result.filename || ""
  id =

Find_and_update takes a block that will be called for each db-fetched result. This block should return a two-item array of the row's id, first, and the value we are using for indexing, second. As you can see in the example, Silver lets you mix fields to use to index. It let's you do anything you want actually as long as an id and a corresponding value are returned. After calling find_and_update, your database is indexed and ready to be searched. Say, we wanted to search for photos of "Barack Obama":

search ="Barack Obama","blog_pictures")

The constructor takes a string to search for and the name of Redis key storing the index. To actually perform the search:

search.perform{|id| Picture.get(id)}

The perform method takes a block that will be passed the ids of all the id's whose indexes match the query. Perform will return an array of database/service objects for you to then interact with as you please.

There are more features of Silver that you can checkout at the GitHub repo or at the Rocco-annotated source:

Sharing is caring

Now, Silver is a young piece of software. We heard once that a good strategy is to release early and iterate often. In that spirit, Silver should be considered strictly beta. It passes all of its specs but has only been tested with DataMapper and SQLite/MySQL stores. We hope you will all start using silver, file bug-reports, contribute patches and follow the evolution of this embryonic product.

Oh, this is also my first gem. Hurrah, I'm becoming a real man.

We hope you enjoy. Write now, write often to

Love, Erik

With Election Day three months behind us and new legislators settling in across the country, Republicans in many states are trying to push new laws that would require photo ID at the polls. The laws, they say, would prevent rampant voter fraud.

Seven states already have laws requiring photo ID at the polls. Another 19, including some of the states below, require some form of identification, but it doesn't need to have a photo.

Critics say it such requirements impose undue hardships on those trying to vote, reminiscent of the literacy tests of yore that kept black voters from voting in the South.

Read More →