Marc Adams
Programming and Amateur Photography
Programming and Amateur Photography
Apr 17th
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC
LIMIT 10;
Feb 12th
If you’ve never used NewRelic before, you’re definitely missing out. It’s a very nicely organized and detailed tool for profiling and monitoring your Java/Ruby/PHP etc; project.
If you’re developing a Java application, there is helpful documentation to get you going.
However, if you want to use it to profile and monitor your Grails application development, you need to tell Grails to load the agent.
When you run grails run-app on your project, Grails uses it’s own built in Tomcat server to serve your application up to you, what it also does, is look for an environment variable called GRAILS_OPTS, if it exists, it uses that to bootstrap the Tomcat instance it runs locally. If it doesn’t exist, it uses default settings:
if [ -n "$GRAILS_OPTS" ]
then
GRAILS_OPTS="$GRAILS_OPTS"
else
GRAILS_OPTS="-server -Xmx512M -XX:MaxPermSize=192m -Dfile.encoding=UTF-8"
fi
So, to setup your Grails development environment to use the NewRelic RPM agent do the following:
export GRAILS_OPTS="-server -Xmx512M -XX:MaxPermSize=192m -Dfile.encoding=UTF-8 -javaagent:/full/path/to/newrelic.jar -Dnewrelic.environment=development"
The -Dnewrelic.environment=development part is important as it tells the agent to set itself up in development mode, which has a higher memory footprint but more information collected.
Hope that helps!
Oct 29th
Even though you can disable the zooming on your mighty mouse, MBP trackpad or fancy Apple Trackpad, browsers don’t want you to be able to disable text zooming. That is a thing of the past, check out this awesome post: http://blog.kenneth.io/2010/10/17/how-to-disable-accidentally-text-zooming-in-browsers-when-using-magic-trackpadmouse-in-osx/comment-page-1/#comment-120
Mar 5th
Typically when you run your Grails app in development mode, it runs on the address http://localhost:8080/{app-name}
Should you want to run it in the root context, i.e. http://localhost:8080/ just add the following line to your application.properties:
app.context=/
Ta da! magic.
Feb 25th
I’m an unapologetic Apple fanboy user. Using OS X has many advantages over using Windows; for everyday tasks and software development.
One of the treasures of using OS X is TextMate. It’s a very robust, enjoyable and productive tool for writing software.
Today it just got better with TextMate-Minimap.
Normally, I try to keep my code files short and succinct. Having really long source code files is indicative that you need to break it down into more logical chunks. That’s not always the case however, especially when dealing with HTML or XML files. One issue is having to navigate to different parts of a long file – scrolling up and down etc; Bookmarks are a good start, but sometimes you don’t know the exact line you need to find, you’re just looking to move to a section of the file.
It shows an overview of your document on the side of the editor window and you can click a section of the overview or drag your mouse along it to scroll-seek.
Very very cool.
Feb 21st
I’ve jumped on the Rails template bandwagon…
I started with authlogic.rb, a template designed to setup a rails project with authlogic. Including rspec, factory girl and associated tests. It also uses the fantastic web-app-theme plugin as a default view layout.
I wish there was a standard way to break up all the file templates, like a generator, so that they’re not all in one file. I could write that kind of framework but that would kind of defeat the purpose of the quick template setup.
Regardless, it’s a pretty swanky system and makes it pretty easy to have a standard template ready to go for rails projects.