Wordpress code/pre tags

More things for posterity, as I had to search several times to find what I wanted…

To make the pretty formatting boxes for command output in the Grails post I just finished, I had to use both pre and code tags, like this:

<pre><code>[content here]</code></pre>

If I just used pre the font was monospace but huge, and if I just used code it stopped after the first blank line and the rest was just text. I could probably adjust this in the CSS of the theme or something, but whatever, I’ll just take the simpler path. I also had to reformat some of the longer lines because they were jutting out of the code box. Some still will if you’re using a really skinny browser window, but that’s your problem, get a bigger screen. ;)

I found this post useful in figuring the pre/code formatting stuff out.

Grails on Ubuntu Hardy

Just for the posterity of the Internet, and because I didn’t find an immediately useful answer when searching with Google…

I’ve been looking at Groovy, a really cool language with similarities to Ruby and Smalltalk that runs as Java bytecode in a standard Java container, and Grails, which is the Groovy equivalent of Ruby on Rails — namely, a framework for quickly and easily creating web applications. Very neat stuff. I hope my interview this afternoon with the company using it goes well. :)

So, while reading up on Groovy and Grails I wanted to play with it on my Ubuntu Hardy laptop. I already had the sun-java6-jre package installed so I could do standard Java stuff. However, in order to publish a Grails application, which is required in order to run it, you need the JDK. So I also installed sun-java6-jdk. It’s possible I should have just removed the JRE and replaced it with the JDK, but the Ubuntu package manager didn’t complain, so I didn’t.

Doing a ‘which java’ pointed to /usr/bin/java, so I set my JAVA_HOME to /usr and move on to installing the rest. [at this point smart people may feel a tingling in their Spidey Sense]

I installed the Ubuntu groovy package, and downloaded the grails package and installed it with dpkg. Everything looks good, I can run ‘grails help’ from the command line without errors. So I create my grails app.

bryanf@ronin2:~$ grails create-app test

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/share/grails		

Base Directory: /home/bryanf
Note: No plugin scripts found
Running script /usr/share/grails/scripts/CreateApp.groovy
Environment set to development
    [mkdir] Created dir: /home/bryanf/test/src
    [mkdir] Created dir: /home/bryanf/test/src/java
    [mkdir] Created dir: /home/bryanf/test/src/groovy
    [mkdir] Created dir: /home/bryanf/test/grails-app
    [mkdir] Created dir: /home/bryanf/test/grails-app/controllers
    [mkdir] Created dir: /home/bryanf/test/grails-app/services
    [mkdir] Created dir: /home/bryanf/test/grails-app/domain
    [mkdir] Created dir: /home/bryanf/test/grails-app/taglib
    [mkdir] Created dir: /home/bryanf/test/grails-app/utils
    [mkdir] Created dir: /home/bryanf/test/grails-app/views
    [mkdir] Created dir: /home/bryanf/test/grails-app/views/layouts
    [mkdir] Created dir: /home/bryanf/test/grails-app/i18n
    [mkdir] Created dir: /home/bryanf/test/grails-app/conf
    [mkdir] Created dir: /home/bryanf/test/test
    [mkdir] Created dir: /home/bryanf/test/test/unit
    [mkdir] Created dir: /home/bryanf/test/test/integration
    [mkdir] Created dir: /home/bryanf/test/scripts
    [mkdir] Created dir: /home/bryanf/test/web-app
    [mkdir] Created dir: /home/bryanf/test/web-app/js
    [mkdir] Created dir: /home/bryanf/test/web-app/css
    [mkdir] Created dir: /home/bryanf/test/web-app/images
    [mkdir] Created dir: /home/bryanf/test/web-app/META-INF
    [mkdir] Created dir: /home/bryanf/test/lib
    [mkdir] Created dir: /home/bryanf/test/grails-app/conf/spring
    [mkdir] Created dir: /home/bryanf/test/grails-app/conf/hibernate
[propertyfile] Creating new property file: /home/bryanf/test/application.properties
     [copy] Copying 2 files to /home/bryanf/test
     [copy] Copied 1 empty directory to 1 empty directory under /home/bryanf/test
     [copy] Copying 2 files to /home/bryanf/test/web-app/WEB-INF
     [copy] Copying 5 files to /home/bryanf/test/web-app/WEB-INF/tld
     [copy] Copying 87 files to /home/bryanf/test/web-app
     [copy] Copying 18 files to /home/bryanf/test/grails-app
     [copy] Copying 1 file to /home/bryanf/test
     [copy] Copying 1 file to /home/bryanf/test
     [copy] Copying 1 file to /home/bryanf/test
     [copy] Copying 1 file to /home/bryanf/test
[propertyfile] Updating property file: /home/bryanf/test/application.properties
Created Grails Application at /home/bryanf/test
bryanf@ronin2:~$

Yay, it works!

Then I try to run my Grails app, using HTTPS because hey… it’s there.

bryanf@ronin2:~$ cd test
bryanf@ronin2:~/test$ grails run-app-https test

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/share/grails		

Base Directory: /home/bryanf/test
Note: No plugin scripts found
Running script /usr/share/grails/scripts/RunAppHttps.groovy
Environment set to development
    [mkdir] Created dir: /home/bryanf/.grails/1.0.3/projects/test/classes
  [groovyc] Compiling 6 source files to /home/bryanf/.grails/1.0.3/projects/test/classes
    [mkdir] Created dir: /home/bryanf/.grails/1.0.3/projects/test/resources/grails-app/i18n
[native2ascii] Converting 11 files from /home/bryanf/test/grails-app/i18n
  to /home/bryanf/.grails/1.0.3/projects/test/resources/grails-app/i18n
Error starting Sun’s native2ascii:
bryanf@ronin2:~/test$ 

After several muttered curses and much searching around, I finally figured out the issue, extrapolated from all the search results saying “There’s something wrong with your JAVA_HOME”.

The way Ubuntu handles packages that may have overlapping commands is to setup a links in /usr/bin to files within /etc/alternatives, which are themselves links to places around the machine. The JRE apps link into /usr/lib/jvm/java-6-sun/jre/bin, while the JDK apps link into /usr/lib/jvm/java-6-sun/bin.

After setting JAVA_HOME to /usr/lib/jvm/java-6-sun, everything is happy.

bryanf@ronin2:~/test$ grails run-app-https test

Welcome to Grails 1.0.3 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /usr/share/grails		

Base Directory: /home/bryanf/test
Note: No plugin scripts found
Running script /usr/share/grails/scripts/RunAppHttps.groovy
Environment set to development
[native2ascii] Converting 11 files from /home/bryanf/test/grails-app/i18n
 to /home/bryanf/.grails/1.0.3/projects/test/resources/grails-app/i18n
     [copy] Copying 1 file to /home/bryanf/.grails/1.0.3/projects/test/classes
     [copy] Copying 1 file to /home/bryanf/.grails/1.0.3/projects/test/resources
     [copy] Copying 1 file to /home/bryanf/.grails/1.0.3/projects/test
2008-07-04 10:59:45.498::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
Creating SSL Cert…
Created SSL Cert
2008-07-04 10:59:46.283::INFO:  jetty-6.1.4
2008-07-04 10:59:46.440::INFO:  No Transaction manager found - if your webapp
 requires one, please configure one.
2008-07-04 10:59:52.760:/test:INFO:  Set web app root system property:
 ‘test-development-0.1′ = [/home/bryanf/test/web-app/]
2008-07-04 10:59:52.760:/test:INFO:  Initializing log4j from
 [file:/home/bryanf/.grails/1.0.3/projects/test/resources/log4j.properties]
2008-07-04 10:59:52.787:/test:INFO:  Initializing Spring root WebApplicationContext
[0] spring.GrailsWebApplicationContext Refreshing org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1bc93a7:
 display name [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1bc93a7];
 startup date [Fri Jul 04 10:59:53 EDT 2008];
 parent: org.springframework.web.context.support.XmlWebApplicationContext@fdb413
[0] spring.GrailsWebApplicationContext Bean factory for application context
 [org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext@1bc93a7]:
 org.springframework.beans.factory.support.DefaultListableBeanFactory@1c0ae76
2008-07-04 10:59:55.516:/test:INFO:  Initializing Spring FrameworkServlet ‘grails’
2008-07-04 10:59:56.611::INFO:  Started SelectChannelConnector@0.0.0.0:8080
2008-07-04 10:59:56.910::INFO:  Started SslSocketConnector@0.0.0.0:8443
Server running. Browse to https://localhost:8443/test

Note: at this point all I’ve done is create the Grails application and run it, without adding any of my own code, and I have a running HTTPS application that will serve a static page. Cool beans.

This post
was eventually useful in getting things working, though it’s a huge whack of text to plow through, and with several bits I didn’t really need. (do I need VNC instructions when talking about installing Grails?)

Now, back to reading more JavaOne presentations about Grails.

Ruby problems

Interesting post at Matasano with details about some possibly exploitable bugs in Ruby. I’m glad I’m not currently supporting any Ruby on Rails apps, I’m sure there are many web 2.0 companies freaking out right now.

More security blogs

Just finished watching the video of Dan Griffin’s presentation from Shmoocon 2008 on Hacking Windows Vista Security. It was good, so I’ve added his blog to my Security blogroll.

Also added the BlackHat RSS feed, which is more of a dump of all things BlackHat than a blog, but whatever.

Security blogs

I need to update the blogroll on my site, but in the mean time here are some security blogs I find interesting.

…And you will know me by the trail of bits - Dino Dai Zovi’s new blog
Matasano Chargen - the Matasano guys
MSRC - Microsoft Security Response Center (so you know whether to panic next Patch Tuesday)
MS Security Vulnerability Research & Defense - actually useful MS security blog
Mark’s Blog - Mark Russinovich (the Sysinternals guy), not always about security but always good Windows internals stuff
PHP Security Blog - Stefan Esser’s PHP blog - nothing since last Dec, but interesting
rdist: setuid just for you - Nate Lawson’s blog
Snort newsfeed - technically not a blog, but it’s in my RSS reader
Schneier on Security - obSchneier
SANS Internet Storm Center - News as things break, and sometimes more indepth stuff

Any others you’d recommend?

[update: finally updated the blogroll and even added a Security section - whee!]

ShmooCon 2008 videos

I’m a bit late to this, since they’ve been there since March, but videos of presentations from the ShmooCon 2008 security/hacking conference in February are available online for your viewing pleasure. Very interesting stuff.

Job hunting

The company I’ve been working for since January has just shut down their North American branch because they were unable to find funding. So I’m job hunting again.

One resource I just found that’s really quite neat is a blog called Toronto Technology Jobs. The guy writing it, Geoffrey Wiseman, takes a look at selected tech job postings from the Toronto area and evaluates the posting, the job, the company doing the posting, etc. It’s quite thorough, and while obviously he can’t cover every posting, it’s a good reminder of how to evaluate job postings yourself.

And who knows, I might find an interesting job there too. :)

7 Reasons the 21st Century is Making You Miserable

Sent to me by a co-worker, with an email subject or “Attn: Mandatory Reading”, go read 7 Reasons the 21st Century is Making You Miserable.

Good for perspective. I’d already come to many of the same conclusions.

HICKTech 2008

I’ll be presenting at Emma’s HICKTech conference in Owen Sound in April, on the topic of the greening trend in servers and data centres.

Sometime real soon now I’ll translate that topic into a 45min presentation…

Soldier-blogger posthumous essay

One of the most thought provoking and touching blog posts I’ve read recently is here, posted on behalf of soldier-blogger Andrew Olmsted after he was killed in Iraq.

I haven’t had the emotional energy to read much mil-blog for a long time, but this is worthy. I really like the liberal use of Babylon 5 quotes. Perhaps time to re-watch some episodes…

via Wired Danger Room

Next Page »