rc3.org

Strong opinions, weakly held

Month: May 2007 (page 3 of 6)

Dead in the water

Looks like the site was down for a bit due to some server configuration mistakes that I made. Note to self, don’t reference Apache::Registry in your server configuration when you don’t have the Perl module installed.

The case for .bank

F-Secure security researcher Mikko Hyppönen suggests that in order to combat phishing, a new top level domain should be set aside for use by banks and other entities that are often spoofed. The organization that manages the domain would verify that the sites are owned by actual financial institutions and that they were not being used for fraudulent purposes, and the registration fees would have to be high enough to support the due diligence required.

I don’t see what it would hurt, assuming the organization registering the domains did a good enough job to insure that any sites on that domain really could be whitelisted.

Who planted the iPhone news?

Was the quickly retracted iPhone delay news this morning the product of fraudsters attempting to manipulate Apple’s share price? I’d sure love to know.

Warp your brain

My mind absolutely refuses to let me believe that the two images on this page are identical.

Mitt Romney is the pro-torture candidate

Mitt Romney made some provocative statements about Gitmo and torture in the Republican debate Tuesday night, and followed up yesterday with even more comments on how he feels on the subject. In his quest to portray himself as a tough guy, apparently he feels we should shed our treaty obligations and our existing military regulations regarding treatment of prisoners. Just what America needs, another moralizing jackass who feels like the laws of this country should be subordinated to his whims.

Ruby on Rails layouts and JavaScript includes

Ruby on Rails includes the concept of layouts, which enable you to specify that outer framework that pages in your application will be rendered within. Most view libraries support includes, which enable you to do things like this:

My page

Do stuff here.

Layouts are a bit nicer in that you don’t even have to maintain the includes on each page. One nice feature of layouts is that if you create a variable within a page, it will be accessible when the enclosing layout is rendered. So you can have a layout like this:

<%= @page_title %> <%= yield :layout %>

And then a page like this:

<% @page_title = "My Web Page">

<%= @page_title %>

This is my web page.

The page title variable that’s set on the page will be visible to the layout, enabling you to use titles specific to each page even though they’re all rendered in the same layout.

Now to get to my point. What’s the best (or most accepted) way to link to include page-specific JavaScript in a Ruby on Rails application? Script references belong in the page header, not in the page body. The page header lives in my layout file. I could just embed the script within the specific pages, but that’s cheating, and I don’t like to cheat.

The solution I came up with involves creating an external JavaScript file for every page that has its own scripts. Rails provides a helper method called javascript_include_tag that builds a link tag to a named JavaScript file, as long as it’s in the public/javascripts directory in your application. So to include public/javascripts/application.js, you just use:

<%= javascript_include_tag "application" %>

Right now, I’m taking advantage of this feature along with the way variable scoping works with layouts and views to handle page-specific Javascript. In my layout file, I have the following:

<% if @page_specific_scripts_in %> <%= javascript_include_tag @page_specific_scripts_in %> <% end %>

In my view, I have the following:

<% @page_specific_scripts_in = "controller_index" %>

And then in public/javascripts I have controller_index.js. This works, but I can’t help but wonder if there’s a better way.

Visual Studio is deficient

Check out Jeff Atwood’s description of developing in C#:

The second is the C# compilation tax. When working in C#, I’m constantly compiling the solution to ensure that I haven’t broken anything. It’s a ridiculous productivity tax in an endless loop: Write some code. Compile. Write a little more code. Compile. Change a function. Compile. Rename a variable. Compile. Refactor some methods. Compile. Then compile again, just to be sure. Wait a second.. did I compile this yet? Compile!

I am shocked and amazed that Visual Studio doesn’t build a semantic model of your code and proactively let you know whether your code is going to compile. I almost can’t believe that this is true, given that every decent Java IDE does this and has been doing it for years. Eclipse, IntelliJ IDEA, NetBeans, JBuilder, you name it. If you use any modern Java IDE, you are never surprised by a syntax error at compilation time, because your editor lets you know that your code is broken as soon as you make a mistake. Heck, they’ll even warn you about all sorts of other common mistakes that lead to bugs, like unused local variables and uncalled methods.

Apparently some third party C# IDEs provide this functionality, but I am literally stunned that Microsoft hasn’t built it into Visual Studio. I’m blown away.

Matt’s excellent tips on running a community

Matt Haughey has posted his recommendations for people trying to establish and moderate an online community. They’re right on the money.

Stephen O’Grady on Microsoft’s patent assertions

Check out Stephen O’Grady’s FAQ on the Fortune article I linked to earlier on Microsoft’s declaration of war on open source software. He provides a lot of supplemental information that’s worth taking in.

I agree with this bit completely:

Q: How does the picture change over the longer term? A: Microsoft has spent the past few years rehabilitating – at great expense and great effort – a highly negative public image. One that, importantly, did not terribly impact its ability to do business, but one that left the firm with very few defenders and advocates. It was, in many respects, the least loved firm in the industry.

While the Microsoft of the past year or so was certainly not beloved, it had gone some distance to changing the minds of many, persuading even some ardent critics that they’d learned a great deal from their past behaviors and emerged as a more responsible corporate player. Agree or disagree, articles describing the new “kinder, gentler” Microsoft abounded.

And then there was yesterday. Depending on how Microsoft proceeds from the statements made to Fortune, I could see virtually all of that hard won goodwill evaporating overnight. Whether their business is as immune to the negative sentiment as it was in the past remains to be seen, but I know that if I intended to compete with social movements – as Microsoft obviously intends to – I’d be trying to make friends, not enemies.

Certainly that mirrors my feelings on the matter. I once hated Microsoft because I felt like they wanted to destroy the software ecosystem where I made my living. My passion waned because I realized that Microsoft wasn’t going to be able to succeed, not because I thought their goals changed. Today’s news has me worked up all over again.

Why artists tend to be liberal

This post from The Storytellers clearly explains something that I’ve known but couldn’t articulately describe for a long time. The crux of it (via Kottke):

Stories, by their nature, have some sort of conflict. Otherwise, they would be boring. Conflict, by its nature, has at least two sides. To be able to write these two sides well, the artist has to understand, deep inside, that both sides are equally human. The more he portrays the other side as human, the better the story. The less human the other side, the more flawed the story.

That puts artists on the humanistic side of most ideological battles throughout history: against racism (the other race is people, too), against slavery (slaves are people, too), for feminism (women are people, too), for the rights of children (children think and feel just like adults), against child labor, for gay rights (homosexuals are just as human), for the downtrodden, for the poor (they are just like us, only poor), against most wars (because the other side bleeds red, too, and mourns with the same pain), and against most religions (in particular, against the religions that claim its followers are ‘the chosen’ and those who are not will not get into heaven and/or are inferior in some way).

Older posts Newer posts

© 2024 rc3.org

Theme by Anders NorenUp ↑