user-pic

Author

  • Posted Grails Dependency Manager Woes - This version of SLF4J requires log4j version 1.2.12 or later to 418 I'm a teapot
    With the release of Grails 1.3.1 we decided that it was finally time to stop our ‘copy all the jars to lib’ process and use the awesome dependency manager. As with any move from static lib directory to a smarter dependency manager we ran into some puzzling issues. One engineer set it all up and it worked great on our build system, but then about 50% of our engineers ran into some strange issues including this one which prevented any grails scripts from running: ... SLF4J: This version of SLF4J requires log4j version 1.2.12 or later. See also http://www.slf4j.org/codes.html#log4j_version SLF4J:...
  • Posted Groovy Deadlocks to 418 I'm a teapot
    Today I managed to set up my grails environment in such a way that it triggered deadlocks quite easily when stressed with a simple jmeter script. While this was unintentional, it did give me an opportunity to diffuse some ticking time bombs. A few of the deadlocks were caused by some of the creative ways that my project uses the Groovy on Grails APIs for rendering pages from GSP code stored in a database, and with some tweaks most of those were resolved. Some other deadlocks, though, seem to be the fault of Groovy itself. A quick google search turned...
  • Posted iPad and OneNote to 418 I'm a teapot
    Tablet computing is one technology that I’ve been attempting to early-adopt for years, but it’s never quite been there. What I’ve always dreamed of is the PADD device that everyone walked around with in Star Trek TNG: A small, light, sleek, multifunctional device that accepts pen input, accepts touch input, and is reasonable to carry around. Around 2003 I purchased a Toshiba m200. It was a hybrid Windows XP Tablet computer. It had a keyboard but could also be converted into tablet mode. The operating system was a clunky afterthought on Windows XP, but it did have one shining star...
  • Posted Checking opensolaris physical memory inside a zone to 418 I'm a teapot
    Joyent uses OpenSolaris zones for its accelerators. At some point I needed to verify the physical memory size of one of these zones but was unable to use the webmin tool that Joyent provides. This seemingly simple operation was actually pretty tricky to figure out. Here are the steps I followed: $ sudo rcapadm -E state: enabled memory cap enforcement threshold: 0% process scan rate (sec): 15 reconfiguration rate (sec): 60 report rate (sec): 5 RSS sampling rate (sec): 5 $ rcapstat -z 1 1 id zone nproc vm rss cap at avgat pg avgpg 46 foo - 0K 0K...
  • Posted Goodbye Blogosphere to Blog Gone
    Once upon a time someone blogged here, but those days are over now. It was fun while it lasted. Bye!...
  • Posted Grails Override Configuration with Properties File to 418 I'm a teapot
    Sometimes you will need to switch up configuration in a hurry. For example, you may need to switch the database connection URL in order to use your warm standby database. This can be a pain in Grails because the convient-during-development Config.groovy is compiled both by grails run-app and grails war. The simplest way to change configuration without rebuilding and redeploying your Grails application is to make use of an externalized configuration file. Although would appear to be very straight forward based on the docs, you will need to jump through a couple undocumented hoops to get it working in all...
  • Posted Zeus ZXTM Upgrade Cannot fork: Not enough space to 418 I'm a teapot
    While upgrading one of my Zeus ZXTM traffic managers from v5.1r2 to v6.0r4 it crashed on startup. This pretty surprising because the upgrade process appeared to have proceeded without a hitch. Here’s the error I saw in the logs and when I attempted to fire up the zxtm program using SSH: $ ./start-zeus Initializing Zeus Application Framework. (C) 1995 - 2010 Zeus Technology Limited Zeus Administration Server already running: 235 Zeus Traffic Manager - (C) 1995 - 2010 Zeus Technology Limited Version 6.0r4, Build date: Feb 10 2010 08:32:37 Process permissions set to zeus:zeus INFO Zeus Traffic Manager starting INFO...
  • Posted GoDaddy SSL Certificate in Zeus ZXTM Traffic Managers to 418 I'm a teapot
    Almost a year ago I purchased a wildcard SSL certificate from GoDaddy. When it was first issued I simply loaded it into into my Zeus ZXTM load balancer with the import button. Everything seemed fine for quite awhile. I visited my web site in Firefox and in all of the flavors of IE. It seemed to work great. That is, until, someone called me to let me know that Safari was not accepting the certificate! I thought I was in trouble until I googled around and found many blog entries about the root cause. It turns out that my server,...
  • Posted channel 2: open failed: administratively prohibited: open failed to 418 I'm a teapot
    I attempted to set up an SSH tunnel today to access a web application that was only bound to a private IP. I tunneled to my opensolaris box, which worked fine, and then attempted to establish a connection with telnet. Telnet reported that the connection was refused and I saw this on my command line for the tunnel: $ ssh johndoe@foo.bar.com -L 8080:foo.bar.com:8080 -N channel 2: open failed: administratively prohibited: open failed I made a pretty silly mistake, but I figure it may save someone’s time to post it here. Of course the connection was refused. My ssh tunnel attempts...
  • Posted Java Mime Type Content Type to 418 I'm a teapot
    I’ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients. For example, I’m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players. Anyway, I fumbled around for a bit in Google and found one great solution: mime-util. It’s Apache License and works great. The documentation is even very good. Since I can trust my file names I opted for the simple file name extension detection method. It’s a perfect fit except...
  • Posted Java Mime Type Content Type to 418 I'm a teapot
    I’ve been working on a Java servlet these days which for many reasons needs to determine the mime type of files so that files being rendered are correctly used by my clients. For example, I’m generating a crossdomian.xml, which if not matched with the text/xml content type, really confuses flash players. Anyway, I fumbled around for a bit in Google and found one great solution: mime-util. It’s Apache License and works great. The documentation is even very good. Since I can trust my file names I opted for the simple file name extension detection method. It’s a perfect fit except...
  • Posted E575: viminfo: Illegal starting char in line: to 418 I'm a teapot
    Once upon a time I tried to open a file for editing with MacVim and saw this message: $ vi foo.xml E575: viminfo: Illegal starting char in line: ion.properties $ I assumed there was something wrong with the file that I was editing, so I tried a different file. I observed the same result. **The Problem Your .viminfo file is corrupt. This file does not contain settings or anything, mostly temporary and working data. **The Fix Delete your ~/.viminfo file...
  • Posted Grails restart loop to 418 I'm a teapot
    The Problem The other day I was doing some bulk file operations on a grails project. I was moving some classes in bulk from a plug-in into an application. After I made the move I ran into a puzzling issue: grails kept restarting in a loop. Each time the plugin scanner ran (every 5 seconds after startup), grails would complain that it needed to compile 1 file. This went on for a few minutes until my app ran out of PermGen and crashed. To make matters worse, grails would not tell me which file it was recompiling even with logging...
  • Posted Simple Basic Authentication from Java Servlet Example to 418 I'm a teapot
    Basic Auth is a very simple way to secure your web application. When combined with a secure transport technology like SSL, it’s also good enough in most cases. Here is a dirt simple example of how to access the basic authentication information from the HTTP header in your servlet. protected void doGet(HttpServletRequest request, HttpServletResponse response) { String pathInfo = request.getPathInfo(); //will contain "Basic Ym9iOnNlY3JldA==" String header = request.getHeader("Authorization"); //always wise to assert your assumptions assert header.substring(0, 6).equals("Basic "); //will contain "Ym9iOnNlY3JldA==" String basicAuthEncoded = header.substring(6); //will contain "bob:secret" String basicAuthAsString = new String( new Base64().decode(basicAuthEncoded.getBytes())); ... } You can test...
  • Posted grails Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/grails/cli/support/GrailsStarter to 418 I'm a teapot
    Maybe you just upgraded Groovy on Grails, or maybe you’re doing a fresh install. Either way you may be confronted with this curious error message: $ grails test Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/groovy/grails/cli/support/GrailsStarter What’s wrong? You have a grails mismatch. Your GRAILS_HOME environment variable is not pointing to the same place as the grails in your PATH. Make them agree and try your grails command again....
  • Posted System call sent warnings to stderr: pst3: This program can only be run by the root user! to 418 I'm a teapot
    I ran into this very cryptic one while setting up Nagios at Joyent. I copied my plugins from one nrpe client to a new server. Three of my checks used check_procs which all failed with a message like this: check_procs System call sent warnings to stderr: pst3: This program can only be run by the root user! To make this even more annoying, sudo did not fix it. The same error message was displayed. What was the problem? File permissions! The error message should say “This program must be owned by the root user!” The fix: sudo chmod root:root pst3...
  • Posted Cancel Postgres query to 418 I'm a teapot
    Do you need to cancel / abort / terminate a long running query in PostgreSql? Perhaps you ran a very nasty select or kicked off an index creation that’s blocking inserts. Either way, stopping a long running query is easy. Log into postgres as the super user: psql -U postgres Find your query postgres=> select procpid, current_query from pg_stat_activity; procpid | current_query ---------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 8093 | <IDLE> 8172 | <IDLE> 9357 | <IDLE> 9358 | <IDLE> 17360 | select procpid, current_query from pg_stat_activity; 9359 | <IDLE> 22429 | drop index fooindex; 20363 | <IDLE> 29098 | <IDLE> 1083 | <IDLE> 10812...
  • Posted Rendering Groovy GSP Code From A String to 418 I'm a teapot
    Ever used WordPress? It has that cool feature that allows users to heavily customize their blogs by editing templates. If you’re trying to do something like that in Groovy on Grails, you’ve found the right blog entry. It’s quite easy as of Grails v1.1.1, although it does have some quirks and caveats. First, we’ll need to import a few classes for this to work. Add these imports to your controller: import org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine import org.springframework.web.context.request.RequestContextHolder import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest Next, in our controller we’ll need the template engine. Luckily just like our grails services the framework will inject this in for us. To...
  • Posted IntelliJ 8.1 Unresponsive on Mac to 418 I'm a teapot
    Did you just notice that your IntelliJ editor is very slow all of a sudden? Is scrolling clumsy and do the animations crawl? Did you recently change your editor settings, by chance? When this happened to me the other day my first impulse was to jump into the animation settings and then configuration files to tune the JVM memory settings as described in most Google results for ‘IntelliJ performance’. This was a red herring, though. I was way off. It was my friggin font setting! As part of a configuration overhaul, I had changed the editor font from the default...
  • Posted Options Not Excuses to Job Yarns
    Something terrible has happened. A supplied fell through or maybe you just screwed something up. Either way, you need to tell your boss and deal with the consequences. Most people do not like discussing their failures or the failures of...
  • Posted Java Collections List Map toString to 418 I'm a teapot
    Java collections, like List and Map, are great. In fact they’re probably the most used part of the Java core APIs. They do lack one feature, though: easy to use conversion into a string representation. This is a surprisingly common task for error messages and logging. In neither of these cases is the default toString() sufficient. Typical solutions include usage of a static utility class to convert them, iterating through them in your code, or creating a subclass of your own. None of these have ever made me happy, though. They’re either too verbose or clunky and the way I...
  • Posted Solairs PS Truncates Commands to 418 I'm a teapot
    If you’re new to Solaris, like me, you may have noticed an annoying limitation of the default ps program built into Solaris. It truncates the commands at 80 characters! To make matters worse, the man pages don’t mention anything about this issue. The reason the man pages offer no help is because this is a kernel issue. It was decided back in 1994 that 80 characters should be enough. Since the kernel does not store more than 80 characters, ps has no way of accessing this information. Ironicly, later that decade the same company invented their “language to end all...
  • Posted PostgreSql Shared Memory Error to 418 I'm a teapot
    The PostgreSQL install instructions for OS X 10.5 include a command to run to change the OS shared memory settings. Sometimes these settings seem to revert, though. If they’ve reverted or were otherwise changed you may see this big ugly error message: FATAL: could not create shared memory segment: Invalid argument DETAIL: Failed system call was shmget(key=5432001, size=29360128, 03600). HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 29360128 bytes), reduce...
  • Posted CouchDB cURL Reference to 418 I'm a teapot
    CouchDB is great. It’s simple interface means all you need to use it is an HTTP client. cURL, for example, works great. I was running into the problem, though, of having to revisit the CouchDB reference and the cURL reference to recall the basic commands. I was going to write up a quick reference with a bunch of common cURL commands, but Tim Huegdon has already posted a great blog entry so rather than reinvent the wheel, here’s a link! http://nefariousdesigns.co.uk/archive/2009/08/couchdbs-restful-api/...
  • Posted erlexec: HOME must be set to 418 I'm a teapot
    I ran into this error message for the first time when I was attempting to start CouchDB, which uses Erlang, from a Solaris SMF service. erlexec: HOME must be set This is a rare case where a seemingly cryptic error message says exactly what it means. For some reason SMF was not setting the HOME environment variable and for some even more confusing reason Erlang requires it to be set to start up. I solved the problem quite simply by setting a value for HOME. Since I didn’t plan to use whatever feature of Erlang requires this, I just set...
  • Posted SVN Retrieval of mergeinfo unsupported to 418 I'm a teapot
    This is another descriptive error message from SVN. “Retrieval of mergeinfo unsupported” If you’re seeing this error message you’re probably trying to use the reintegrate merger feature in SVN. You probably just used a command like this one: svn merge --reintegrate svn://foobranch . This error is caused by a configuration issue on your server, or a significant version mismatch between your client and server. It’s OK, though, this can be worked around pretty easily. Just fall back to the more reliable SVN 1.4 style explicit merger technique. To use this approach you’ll need to know what revision you either created...
  • Posted MySql Query Logging to 418 I'm a teapot
    Smart database usage is about more than optimizing slow queries. You also need to make sure you’re only running queries when necessary. A single N+1 query can really cause some serious problems, but luckily there’s a pretty easy way to find these hot spots: MySql query logging. To enable query logging follow these steps (Tested with MySql 5.0): Add this to your my.cnf: log=/var/log/mysql/query.log Make sure the directory exists and the user that is running mysql has write access to if. sudo mkdir -p /var/log/mysql/ sudo chmod 750 /var/log/mysql/ sudo chown mysql:mysql /var/log/mysql/ Restart your MySql server using whatever command...
  • Posted MySql ERROR 1153: Got a packet bigger than 'max_allowed_packet' bytes to 418 I'm a teapot
    You're probably here because you were trying to load a MySql database dump and you saw something like this: bar@foohost:~$ mysql -uroot -p some_database < some_big_dump.db Enter password: ERROR 1153 (08S01) at line 42: Got a packet bigger than 'max_allowed_packet' bytes Don't panic! This one is easy to fix. It's happening because somewhere on either the MySql client or the MySql server, the max_allowed_packet is being exceeded. It's an easy fix, but you will need to bounce your server. Edit your /etc/my.cnf and look for the parameter max_allowed_packet. In my case it was set to 1M, which is obviously not...
  • Posted Grails ConfigSlurper and its Permgen Apatite to 418 I'm a teapot
    This is an older one. I’ve only verified it with Grails v1.1, but it may still exist. It’s frustrating enough that it warrants a post, though. Is your app slowing to a crawl due to an amazing Permgen leak? I mean big like 400+ MB of Permgen usage and 50k loaded classes. Well if you happen to be abusing ConfigSlurper, I may have a solution for you. Are you doing something like this? for (int i = 0; i Well stop doing it. You’re leaking classes. Anything that you need to update at runtime that often should not be in...
  • Posted Prevent SVN from Comitting A File to 418 I'm a teapot
    If you’re lazy, like me, you commit your changes using svn commit -m "my awesome bug free code is done". This is easy and fast, but does not work if your software project has a machine specific configuration file, or something else that when committed causes other people pain. SVN has no direct solution to this problem, but you can abuse the changelist feature to solve the problem. Simply create a changelist for these files and never commit it. svn changelist donotcommit configurationfile1.xml configurationfile2.xml You can confirm that this has worked with svn stat. Once the changeset is crated, it...
Subscribe to feed Recent Actions from Author