Posts Tagged ‘geek’

Make ruby-debug work better

If you’ve written Ruby, chances are you’ve had to use ruby-debug. You might’ve thought the experience sucked — especially the fact that the debugger defaults to a mode in which you have to use a keyword to get it to evaluate a statement. Lost? Here’s what I mean:

Say you start the debugger here:

1
2
result = resource[xml_obj.api_call_string].get
(rdb:1)

Then you want to take a look at the “xml_obj” variable. If this were (for instance) Python’s pdb, we’d just type “xml_obj” and hit return and be done with it. Not so in ruby-debug:

1
2
(rdb:1) xml_obj.api_call_string
*** Unknown command: "xml_obj.api_call_string".  Try "help".

This is because with default settings, the debugger needs a keyword (’p') to get it to actually evaluate your statement as Ruby and not a command to the debugger itself:

1
2
(rdb:1) p xml_obj.api_call_string
"documentService/documentsByCommunity"

That gets really tedious, really fast. The debugger’s help function (’help p’) will helpfully tell you that this is because the “autoeval” option is not enabled. If you’re thick like me, you won’t see this and you’ll just continue doing “p <whatever>” until you get so frustrated you drop what you’re doing one day and go hunt down a fix.

Here is that fix from inside your code:

1
2
require 'ruby-debug'
Debugger.settings[:autoeval] = true

You can also do this inside the debugger:

1
2
(rdb:1) set autoeval
autoeval is on.

Rails already does it via Rack middleware

You might be wondering why the debugging experience is different in Rails than in Ruby you’ve written elsewhere. I did too — remembering that this ‘p’ business isn’t necessary when I run the debugger as an option when I start up Mongrel in a Rails app. So I went digging for the code that Rails uses to set this stuff up. Those settings come from a piece of Rack middleware that lives in lib/rails/rack/debugger.rb. Here’s the class definition:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Rails
  module Rack
    class Debugger
      def initialize(app)
        @app = app

        require_library_or_gem 'ruby-debug'
        ::Debugger.start
        ::Debugger.settings[:autoeval] = true if ::Debugger.respond_to?(:settings)
        puts "=> Debugger enabled"
      rescue Exception
        puts "You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'"
        exit
      end

      def call(env)
        @app.call(env)
      end
    end
  end
end

For more info on how Rails uses Rack, this is a pretty handy page from the Rails guides.

Oh, Exquisite Lord of Toolish Writing!

I realize that if you think the internet is like Hollywood, then Scoble is someone you’re supposed to hate. But don’t. IN FACT, back way the hell off and realize for a second that Scoble isn’t just someone to be parodied and mocked at the places @ SxSW where the techies do drugs. Scoble is a force to be celebrated. Scoble is a national treasure for writing like this :

When I heard the news I was walking through San Antonio’s Hard Rock Cafe looking at Kurt Cobain’s high school photograph. Wow. FriendFeed was purchased by Facebook.

I quickly wrote a DM to Paul Buchheit and Bret Taylor, co-founders and said “call me.” They did, and I got one of the first interviews.

This is poetry. It’s charmingly quotidian at the top (he talks about the Hard Rock Cafe like he’s at Buckingham, and he mentions Cobain’s picture because it’s some kind terrible whitebread muse-talisman to him), but then just after this “oh, me?” scene setting, Scoble is brief and devastating in his establishment of douchey dominance — explicit and unquestionable.

He is the man who will speak about this here internet thing AND tell you the dudes’ names AND tell you that he used to hang with them before this cool thing happened, BACK WHEN THAT OTHER cool thing happened or was happening.

He’ll show you wtf is going on in this world. We should wipe the snot from his camera for the chance to be here. Luckily he lets us listen in for free:

Basically they did not tell me much other than FriendFeed would keep on going on for the indefinite future.

Scoble, no worries. I wasn’t expecting real information and was just glad that you had the opportunity to write this gem. I stand here, in awe, clapping quietly in my dusty corner of the internet. Bra-fucking-vo.

Tags: ,

John Gruber’s Awesome Post on “Microsoft’s Long, Slow Decline”

John Gruber of Daring Fireball has posted the best thing I’ve read so far encapsulating Microsoft’s current challenges in the consumer PC marketplace. He puts it in context with the history of Microsoft and Apple’s competition—especially their recent dueling ad campaigns–and takes MS executives to task for being simultaneously myopic, dismissive, and clueless when it comes to what’s happening in the retail computer marketplace.

But my favorite part is where he points out that Microsoft lost the computer geeks a few years ago and that’s the PC platform’s biggest problem. I’ve been saying this to friends of mine for awhile–the nerds all went Mac in droves when being on a Mac began to mean being on UNIX instead of the old-school Mac OS that was rather like buying a Mercedes-Benz with the hood welded shut. When Apple decided to be the platform where all flavors of nerdy digital innovator worked (as opposed to just illustrators, filmmakers and musicians), the nerd herd rallied to their flag fast. He pinpoints a subset particularly close to my heart — web developers.

Web developers had to know both the Mac and Windows, at least with passing familiarity, and the truth is that many, if not most, preferred Windows.

Today that is simply no longer the case. Microsoft has lost all but a sliver of this entire market. People who love computers overwhelmingly prefer to use a Mac today. Microsoft’s core problem is that they have lost the hearts of computer enthusiasts. Regular people don’t think about their choice of computer platform in detail and with passion like nerds do because, duh, they are not nerds. But nerds are leading indicators.

This is true in many markets with broad appeal, not just computers. Microsoft is looking ever more so like the digital equivalent of General Motors. Car enthusiasts lost interest in GM’s cars long before regular people did; the same is happening with Windows.

It might be hard to notice if you’re not watching from the techie vantage point, but the trickle-down effect of this nerd migration has been enormous–go into an Apple store on any weekend and you’ll probably have to push your way through a heterogenous crowd of browsing hipsters, grandparents, suburban moms, small children, etc just to get to the middle of the store. Everyone seems to know that a Mac is the thing to buy, and that PCs are cheaper, but they’re cheaper for a reason.

Imagine if this happened with cars

The “Laptop/PC Hunter” ad campaigns that Microsoft is so proud of make no effort to answer Apple’s contention that a Mac is a better computer–Microsoft seems satisfied merely to point out that it is possible to purchase computers for cheaper. This is just stupid. I like Gruber’s car analogy above. So what if someone tried this same ad campaign with cars? What if you saw a commercial in which GMC mocked Honda because a Civic costs more than a Geo Tracker? No one would make that commercial, because anyone who saw it would say “wait a minute–a Civic is a waaay better car than a Tracker. Of course it costs more.”

But to a lot of the people you see in these commercials — the people that Microsoft is actually targetting in a pretty savvy way — you’ll see that these are people who aren’t real comfortable with their ability to discern what’s what between computers. They don’t know too much about how they work, and actually not that much about what you can do with them. Computers make them feel uneasy. But they are comfortable with shopping for a bargain. They’ve made a religion about it, which is how there got to be things like Best Buy and Walmart in the first place.

And Microsoft is telling these people that there is equivalence between the Mac and the PC — that it’s OK to shop for this like you’d shop for a toilet brush and laugh at people who don’t. It’s ludicrous. But people have no other real basis for comparison, because if they think about it at all, they see Apple vs. PC as a tribal thing like Ford/Chevy.

But the reality is that people have settled for Windows machines for years without really knowing any better — no basis for comparison. They thought that Windows was it and computers were Windows.

I mean if you see a commercial hollering that ShitSandwiches™ are 75% off, are you going to get excited? No. Because you were never in the market for a ShitSandwich™ in the first place, thank you very much. Not even if they decide to call it Active ShitSandwich Live 2009™ But what if you don’t know it’s a ShitSandwich™?

Apple is cleaning up

As Gruber points out, MS execs believe that the PC Hunter ads work because… they answered Apple somehow. Well Gruber kicked off his post by referencing an NPD report showing that Apple now owns 91% of the $1,000+ retail computer market. Not a huge portion of the computer market by any means, but MS would do well to pay more attention to that number as an indicator.

Windows 7 isn’t going to be awesome. The Bing/Yahoo whatever isn’t going to do anything more than help out Google by keeping the US Justice Department off their back. The Wii is going to keep kicking the XBOX down the street. Exchange’s market share will get eroded by things like Zimbra (even if perhaps not Zimbra itself) over time. Office 2010 will be a laughing stock for its schizo attempt to mimic Google Docs and its bewildering interface (prediction: MS will fall on its face with something douchey for their web-based document sharing monstrosity inside the next Office). And no one is going to care about Windows Mobile I mean Windows Phone with the iPhone 3GS, the Palm Pre, and new stuff from RIM.

Long, slow decline indeed. Bring it.

Tags: , ,

Video Games — Violence and Evolution

I read this GamaSutra editorial with some head-nodding and some thoughts that it was a shame the author couldn’t have centered his critique more tightly on the idea that game designers need to get more creative (by looking for something better to make than just Yet Another FPS) because the maturation of the medium demands it.

His central premise is that while super-violent video games are fun, watching increasingly realistic depictions of human murder is probably not all that great for the human psyche. By the time that complete photorealism is possible in games (he pegs this to be about a decade away), the average gamer will be involved in tens of thousands of acts of simulated murder, torture, etc.

Eventually, he says:

If the video and computer game industry doesn’t begin to show concern over widespread and flippant depictions of realistic human violence, game publishers will soon be asking players to regularly murder scores of astoundingly realistic virtual people, enjoy it, and defend the practice from critics of the art form. (Actually, they already do, but I digress.)

But the industry shouldn’t be asking this of its loyal fans and customers. This is not just a financial issue between publishers and their wallets; it’s an ethical issue that will increasingly affect our laws, culture, and society on a deep level.

I agree. But I also agree that censorship isn’t the answer. I think what the industry really needs is a healthy combination of shame and aspiration.

Murder isn’t the point – evolution is.

Blowing things (and people) up in video games is just super fun. That’s why there’s so many FPS games out there. But let’s face it — lots of them suck. You have to ask yourself if the designers could possibly be doing other, more interesting things with their creative/programming prowess. Perhaps if there were a more permeating ethos of pride in the variety and quality of things tried in games, if game designers looked at their medium as a method for creating societal commentary and art as well as entertainment, the way filmmakers do, we’d start to see something different.

Edwards focusses on murder in this article, but for me it’s less about the psychic damage of playing violent games than it is about it being simply boring as shit to have most blockbuster titles revolve around killing. As far as I’m concerned, the game industry is guilty less of promulgating psycopathy than they are of simple lazy thinking. Edwards touches on this slightly:

I can’t help but feel that such a profound and tragic event as human murder or even “justified” human killing should be a rare and powerful statement in games, not a common theme. With the ever-increasing power developers have in their hands to rip apart virtual lives, I think it’s time to re-examine the use of death and killing as a core game mechanic.

Perhaps the public is already beginning to tire of wantonly violent gameplay with its enthusiastic embrace of both casual games and the Nintendo Wii’s lighter fare. Many players are flocking to innovative, less intense games that make the “hardcore” (read: “mostly violent and/or realistic”) gaming world shudder.

I’m not sure I want to have to wait for the public to get there though. I want the video game industry to develop a sense of pride that says “when we make any game (even FPS games), they will be works of art. And we will look for ways to push the limits of creativity, wonder, and fun as well as artificially induced adrenaline rushes.”

I guess what I’m saying is that if I were on the Call of Duty: Modern Warfare team and I went out and played Little Big Planet, I’d probably want to sit down and cry 15 minutes later, wondering why the hell I’d made yet another borderline-shameful simulation of the pain and death of real soldiers instead of something profoundly cool, beautiful, artistic, and novel.

In other words, gore won’t ever feed the soul. And it’s becoming time that game developers look upon that objective as, at least in part, their job.

Tags:

New thing to be scared of: we’re crap at cybersecurity

(Via Ars Technica)

There’s a new report out on US cyber security(PDF)

It’s a big-ass problem:

a growing array of state and non-state actors are compromising, stealing, changing, or destroying information and could cause critical disruptions to U.S. systems. At the same time, traditional telecommunications and Internet networks continue to converge, and other infrastructure sectors are adopting the Internet as a primary means of interconnectivity. The United States faces the dual challenge of maintaining an environment that promotes efficiency, innovation, economic prosperity, and free trade while also promoting safety, security, civil liberties, and privacy rights.

Yikes. So how does the government feel about this?

Leadership should be elevated and strongly anchored within the White House to provide direction, coordinate action, and achieve results. In addition, federal leadership and accountability for cybersecurity should be strengthened.

OK, good. I’m glad to hear that, because the last guy wasn’t really up on this stuff. He had this guy named Richard Clarke, remember? Right before 9/11 he got politely demoted for making a nuisance of himself by whining about a group called Al Qaeda. He asked to go to cyber-security, but wasn’t in the National Security Council anymore because oldster politicians think computers suck and wish they’d just go away.

So cool — glad that we’ve got someone in the White House who cares about keeping computers safe so that it’s easier for computers to Run All the Things of Man. Now that we’re down with cybersecurity, what are we going to do about it?

Well here’s an action plan from p. 8:

  • Appoint a cybersecurity policy official responsible for coordinating the Nation’s cybersecurity policies and activities; establish a strong NSC directorate, under the direction of the cybersecurity policy official dual-hatted to the NSC and the NEC, to coordinate interagency development of cybersecurity-related strategy and policy.
  • Prepare for the President’s approval an updated national strategy to secure the information and communications infrastructure. This strategy should include continued evaluation of CNCI activities and, where appropriate, build on its successes.
  • Designate cybersecurity as one of the President’s key management priorities and establish performance metrics.
  • Designate a privacy and civil liberties official to the NSC cybersecurity directorate.
  • Convene appropriate interagency mechanisms to conduct interagency-cleared legal analyses of priority cybersecurity-related issues identified during the policy-development process and formulate coherent unified policy guidance that clarifies roles, responsibilities, and the application of agency authorities for cybersecurity-related activities across the Federal government.
  • Initiate a national public awareness and education campaign to promote cybersecurity.
  • Develop U.S. Government positions for an international cybersecurity policy framework and strengthen our international partnerships to create initiatives that address the full range of activities, policies, and opportunities associated with cybersecurity.
  • Prepare a cybersecurity incident response plan; initiate a dialog to enhance public-private partnerships with an eye toward streamlining, aligning, and providing resources to optimize their contribution and engagement
  • In collaboration with other EOP entities, develop a framework for research and development strategies that focus on game-changing technologies that have the potential to enhance the security, reliability, resilience, and trustworthiness of digital infrastructure; provide the research community access to event data to facilitate developing tools, testing theories, and identifying workable solutions.
  • Build a cybersecurity-based identity management vision and strategy that addresses privacy and civil liberties interests, leveraging privacy-enhancing technologies for the Nation.

Ambitious — especially the public awareness campaign. How should they go about doing that? My vote is for a public viewing of the movie Hackers in every city.

Tags: , ,