Anton From Perm

Just another WordPress.com weblog

RESTful rendering and Devise

leave a comment »

EDIT: As I see, the issue has been fixed in the Git repository a few hours ago

I’ve been working lately with migrating my application to Rails 3 + MongoDB, which led me to use Devise instead of Authlogic. I ran into several issues while using Devise for a REST web service. In the case of an authentication error, Devise redirects requests to the login page instead of issuing a 401 unauthenticated.

The workaround is to use a custom failure app, and simply override the respond method as following:

class CustomFailure < Devise::FailureApp
  include ActionController::Head
  include ActionController::MimeResponds

  def respond
    respond_to do |format|
      format.html {
        super
      }
      format.any { head :status => 401}
    end
  end
end

And add the following in config/initializers/devise.rb:

Devise.setup do |config|
  config.warden do |manager|
    manager.failure_app = CustomFailure
  end
end
Advertisements

Written by antonfromperm

March 29, 2010 at 11:27 pm

Posted in Rails 3

Tagged with , ,

Tour in Cambridge Innovation Center

leave a comment »

I am currently in the Cambridge Innovation Center and taking a tour with the CEO Tim Rowe. He is saying that building a incubator is the same as building a nightclub. For making a nightclub work, you have to take the most beautiful women, wealthy men, and everyone else will come. An incubator works the same, except you have to convince your most successful promising entrepreneurs to come to you, and everyone else will come 🙂

Aura BioSciences is one of those companies that attract lots of startups to CIC. As Tim joked maybe because Aura founder Elisabet de los Pinos is a beautiful women 🙂

Written by antonfromperm

March 29, 2010 at 1:30 pm

Posted in Uncategorized

Centers of gravity in Russia

with one comment

GDP per capita 2007

GDP per capita, 2007, in percentage of Russia=100

A >125
B100-125
C75-100
D 50-75
E <50
Above is a chloropleth regional map of Russia, expressing the GRP of regions to the Russian average. The most interesting point is how Moscow seems to soak up all resources and population around a radius of several hundreds kilometers.
It reminds me of Volkswagen placing a industrial park in Kaluga, only to realize later that they could not find enough workforce at the wage VW was willing to pay. The locals preferred to drive three hours each day to Moscow in order to earn three times as much 🙂

Written by antonfromperm

January 23, 2010 at 9:29 pm

Tim Draper keynote at VSSV ’09

leave a comment »

Bad words Good words
Entitlement Opportunity
Rights Earnings
Government intervention Business solution
Bailout Let the losers die
Regulation Freedom
Patriotism->Protection->Poverty Free trade

(Actually he used almost the same slides at the OnDC ’09)

Written by antonfromperm

December 24, 2009 at 6:21 pm

Posted in Uncategorized

Tagged with ,

People startups should fire fast enough

leave a comment »

Joel over at Inc has an interesting post about people startups should fire fast enough. It’s about that kind of people who believe they HAVE a job (=sitting uselessly in the office) instead of DOING their work.

At the top of every company, there’s at least one person who really cares and really wants the product and the customer experience to be great. That’s you, and me, and Ryan. Below that person, there are layers of people, many of whom are equally dedicated and equally talented.

But at some point as you work your way through an organization, you find pockets of people who don’t care that much. For them, it’s a job. They just want to get through the day and don’t find it upsetting that the video switching is slow and the Wi-Fi went down and the geeks couldn’t get to their Twitters. 
If you’re lucky, none of those people are employed by your company. But the minute you begin to rely on outside vendors, you expose yourself to their people, some of whom inevitably just won’t care enough or know enough or have the right skills to deliver the awesome experience you’re trying to deliver.

Written by antonfromperm

December 11, 2009 at 7:42 pm

Posted in Uncategorized

Real unemployment in the US is 17.2 percent

with one comment

Written by antonfromperm

December 4, 2009 at 9:23 pm

Posted in Ignorance

Tagged with ,

Pirates Stock Exchange

leave a comment »

From DailyFinance:

Meanwhile, the Somali pirates have begun to put all of that ransomed lucre — tens of millions of dollars in recent years — to work for them, setting up a stock exchange “that has drawn financiers from the Somali diaspora and other nations,” according to a startling Reuters dispatch from Somalia published Tuesday.

The bandits’ bourse is a small building in the once-small fishing village of Haradheere, about 250 miles northeast of Mogadishu. “Now it is a bustling town where luxury 4×4 cars owned by the pirates and those who bankroll them create honking traffic jams along its pot-holed, dusty streets,” the wire service reports. Somalia is considered one of the most dangerous countries in the world for Western journalists.

“Four months ago, during the monsoon rains, we decided to set up this stock exchange. We started with 15 ‘maritime companies’ and now we are hosting 72. Ten of them have so far been successful at hijacking,” Reuters quotes a “wealthy former pirate named Mohammed” as saying.

“The shares are open to all and everybody can take part, whether personally at sea or on land by providing cash, weapons or useful materials … we’ve made piracy a community activity.”

Also quoted is “piracy investor” Sahra Ibrahim, a 22-year-old divorcee, who was lined up with others waiting “for her cut of a ransom pay-out after one of the gangs freed a Spanish tuna fishing vessel.“”I am waiting for my share after I contributed a rocket-propelled grenade for the operation,” she said, adding that she got the weapon from her ex-husband in alimony. “I am really happy and lucky. I have made $75,000 in only 38 days since I joined the ‘company’.”

It reminds me the story of the Dutch East India Company during the 17th century 🙂 . The difference is that the Dutch East India Company waged war and pillaged outposts, while four centuries later the Somali are hijacking US oil tankers.

Written by antonfromperm

December 3, 2009 at 3:45 pm

Posted in Uncategorized