Sunday, May 22, 2011

Old School Hip-Hop Revivalists

The New York Times has a pretty neat article called "White Rappers Paying Homage to the Past". It's definitely worth a read for Rap fans, but here's the main point: The current trend for white rappers seeking respect is a fight to revive Hip-Hop's past. You can't go wrong traveling beaten paths. Insightful but I felt part of the story was missing, so I'm throwing in my take as an 11-year Hip-Hop DJ.

First, kudos. Someone at the Times must be a pretty big hip-hop head to recognize the 5 second homage to "Smoothe da Hustler ft. Trigger tha Gambler - Broken Language" in the Action Bronson track. I specialize in hip-hop circa 1995 and I barely hear of it (though the instrumental definitely makes the rounds). Unsurprising that it's obscure though, it's a 4 minute song with no chorus, just one giant verse with the same formula throughout -- listing a bunch of things that they are. Gotta admire sticking to themes.

The thesis of the article is an interesting one: many white rappers these days see themselves as preservationalists and throwback artists. Their next example was Beastie Boys, which is a bit off because that's not a sign of the times. The Beastie Boys have rapped like it's '86
since it was '86.

Really what I think you've got here is that Hip-Hop has always been a bitterly nostalgic genre. Case in point, that very 1995 track paid homage to Big Daddy Kane, whose peak relevance was in 88.

It's not necessarily a white thing, more of an underground hip-hop thing. There are plenty of examples of black rappers, underground and mainstream alike referencing tracks like
Slick Rick's La Di Da Di from 1985 ("La Di Da Di, we like to party..."). Amazingly, in that song Slick Rick was ALREADY complaining
about rappers biting his rhymes, and they're still doing it 25 years later.

If there has been a resurgence of the old school revivalist theme (such as Wu-Tang's recent "Take It Back", Black Eyed Peas "Bringin It Back" several albums ago when they were good, and virtually the entire Jurassic 5 catalog), I would ascribe it to the appeal of Hip-Hop as an
underdog genre. It's reached mainstream popularity dominating the charts, so we look back fondly to the days where it was relatively esoteric. As with grunge and many others, the hardcore fanbase feels let down now that our pride and joy has been warped toward popularity.

Identifying a trend with "White Rappers" is bound to get more readers, though.

Sunday, December 5, 2010

Grails Domain Objects Across Schemas

The Grails documentation is very clear on how to specify specific table and column names for your domain classes (in Section 5.5.2 Custom ORM Mapping). But what if you need to specify the schema as well? Fortunately it is just as easy, if less well-documented.



Of course, when all of your domain tables are in the same schema, you should simply specify a default schema in DataSource.groovy. The property is hibernate.default_schema.

Thursday, August 5, 2010

Testing rich webapps from JUnit with Rhino and Envjs

Envjs is an implementation of the DOM in Javascript. Together with Rhino, it can function as a headless web browser in Java. Picture HtmlUnit, but with flawless Javascript support. For instance, the latest version of JQuery works flawlessly in Envjs on Rhino but won't even load in HtmlUnit.

Here's a simple way to tie them together in JUnit. Wonderful testing frameworks to follow (looking at you, Mike ;)

Not too many Groovy-isms here, can easily be converted to plain Java.

Friday, July 23, 2010

Watch Directory For Changes in Groovy

One must-have feature in any modern web stack is the ability to automatically restart/refresh the development server when you edit the source code. It is critical for developer workflow that the feedback loop be as tight as possible. Here source code refers to actual class definitions, templates (JSPs, GSPs, haml files, etc...), static content (javascript, css, images), AND configuration (I'm looking at you, struts.xml).

All web frameworks which do not support automatic updating of all content during development shall hereafter be referred to as "Legacy Web Frameworks". Is your shop using them?

Justin Voss and I have been hard at work on a web micro-framework called Ratpack (inspired by Ruby's Sinatra). Lest it become a Legacy Web Framework right out of the gate, we've implemented basic auto-reloading right away. Feel free to grab this for other uses, as it works independently.

groovy runapp.groovy app/myapp.groovy app

The script app/myapp.groovy will be killed and re-run when any content in the app directory changes.

Since Ratpack uses Jetty, there are probably better solutions. Feedback is welcome.



The NIO.2 Filesystem in JDK7 will make this sort of thing much easier.

Sunday, May 9, 2010

Haml For Grails

Writing a Grails app? Find out why so many Rubyists swear by Haml for writing views.




Interested parties have created JHaml, a Java implementation of Haml, and a corresponding Grails plugin. (Patches welcome!)

To try it out, just grab the plugin:
grails install-plugin haml
Then add this bean definition to your grails-app/conf/spring/resources.groovy.


Now, you have the option of writing views (with the .haml extension) that will be automatically rendered to GSPs.

Learn more in the Haml tutorial.

Official Grails Plugin Page

Sunday, April 18, 2010

"Holy Grail" Three-Column Layout in Haml and Sass

Thanks to Matthew Levine for his article In Search of the Holy Grail.



Feel free to post your own variants!

Monday, January 12, 2009

Beyond web.xml

Another day paying the bills in Eclipse...
public class HelloWorldServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.getWriter().println("Hello World!");
}
}

So you've just written yourself a spiffy little servlet and you want to test it out. That's when it hits you... there is a long and arduous road ahead. You've got to remember how to deploy a War (how does that Ant script go again?). You need to configure Tomcat (Or wait 20 minutes for Weblogic to start). Then you need to write that dreaded web.xml file. This is a barren wasteland, riddled with fire and ash and dust. The very air you breathe is a poisonous fume. Not with ten thousand men could you do this. Tis folly!

Dag-nabbit! You aren't writing a big fancy industrial strength web app. All you want to do is run your little servlet in a local web browser and get on with your life! Jiminy Cricket, it's times like this that can turn a developer to Rails.

So what are you going to do? Bite the bullet and muddle through it all for the umpteenth time? Give up and write a command line app? Recall that the three chief virtues of a programmer are: Laziness, Impatience, and Hubris. Where there is a will, there is a way.

Grab yourself a Jetty jar and throw one of these in your app:
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;

public class EmbeddedServletRunner {
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
Context root = new Context(server,"/",Context.SESSIONS);
root.addServlet(new ServletHolder(new HelloWorldServlet()), "/hello");
server.start();
}
}
Run it. Point your browser to http://localhost:8080/hello and you're good to go.