Archive of articles classified as' "command line"

Back home

Getting Grails New Uber Generate-All to Proceed without Prompting

2008/12/9

In my current project, I’ve been doing a lot of tweaking of the default grails scaffolding templates. Because of this, I need to run the new uber generate-all command quite a bit to recreate things.

The one problem with this script is that if the files already exist, a prompt will come up after ~10 seconds or so (after the grails environment bootstraps) asking you if you want to Overwrite everything:

grails generate-all "*" 
...
~10 seconds pass
...
Generating views for domain class Baz ...
File /foobar/grails-app/views/baz/list.gsp already exists. Overwrite?y,n,a

This was a bit of a pain as I’d often kick the script off, get distracted and then come back to the shell with that prompt still waiting for me to tell it what to do. I’d rather just start working with my shiny new scaffolding.

The easy solution to this is simply to pipe the answer you want into the grails command:

echo "a" | grails generate-all "*"

Doing that will pipe the “a” into the grails command so that when the prompt finally comes up, it knows that it can continue regenerating all of my scaffolding.

It seems simple enough after I figured it out, but I thought it could save some other people time when they’re hacking around with templates and know they want to regenerate all of them.
Read the rest of this article »

2 Comments

My Mercurial Setup (Plus Some Useful Shims and Jigs)

2008/11/25

In his book, The Productive Programmer, Neal Ford talks about using shims or jigs to help productivity. Jigs and shims are quickly created little snippets of code that automate repetitive tasks or make them easy enough that they’re worth doing. They’re little tools that help make your job easier and let you avoid using brute force to solve all of your problems.

My home directory has a bin folder in it that’s continually getting new jigs added to it, and my zshrc file is an ever-expanding list of quick shell functions.

Recently, I’ve been doing a lot more work with Mercurial as the team that I’m on switched from Subversion a couple of months ago on our Grails project. The initial transition was a little difficult for some people, but I think just about everyone is pretty happy with the transition now that we’ve made it.

Something that has helped everyone get comfortable with more complex Distributed Version Control System like Mercurial has been the distribution of shims and jigs amongst the team. I thought these tips might be useful to others as well.
Read the rest of this article »

4 Comments

How the Other Half Lives – Bandwidth Throttling on the Mac Using WaterRoof/ipfw

2008/10/6

Have you ever needed to test your website as if you were a dialup user? According to a Pew research study earlier this year 55% of Americans have broadband at home, and 10% still have dialup (with the remainder having no connectivity at home). This means that almost 20% of home browsers are on dialup. If you want to make sure that you’re app isn’t completely unusable for this population it could be useful to know how to slow your fat pipe down to dialup speeds.

Under the covers, Mac OSX uses a tool called “ipfw” (IP firewall) that allows for all kinds of fancy traffic shaping and piping. It’s a very unix tool though and it’s not the easiest thing to use if you’re not familiar with parsing through man pages.

There is a GUI called WaterRoof (http://www.hanynet.com/waterroof/) that makes things a little better, though it still isn’t the most intuitive thing.

Here are the steps to slow your connection down using WaterRoof.
Read the rest of this article »

3 Comments

Ubiquity – interesting looking command line for Firefox

2008/08/26

Just ran across Ubiquity over on on waxy.

It’s an alpha Firefox plugin that’s attempting to be a command line for the internet. It reminds me a little of yubnub, but quite a bit more powerful as it’s available on every page and is context sensitive.

Essentially, it has a set of built in commands (that you can add to an extend) and it’s aware of the current browser context, so if you have something highlighted, it can act on that subset of the current page.

Previously, I’ve been a heavy user of Firefox smart keywords, which allow you to assign aliases to bookmarks and type the aliases in the location bar. I’ve created smart keywords that allow me to search wikipedia, amazon, imdb and the dictionary. Ubiquity has all of these, plus a lot more built-in.

I’ve only been using it for a little bit, and there are some rough edges, but I think that there is quite a bit of promise here as well and thought that there might be a few other keyboard jockeys out there that would appreciate what Ubiquity is trying to do.

3 Comments

Distributed Source Control with Mercurial Presentation

2008/06/3

I gave a presentation at work today on Distributed Version Control Systems and Mercurial. We’re currently using Subversion, and I’m nudging my co-workers into getting interested in the benefits of distributed version control over a centralized system.

The presentation starts with the pros and cons of distributed systems and gives a brief overview of the top 3 most popular DVCS systems:

I go into the details of why I chose to use Mercurial and describe some common usage patterns for people used to using Subversion.

I then did a live-coding session where I created a quick grails application, added it to a new repository, cloned the repository and pushed changes back and forth to show how mercurial handles merging and history.

I also suggest how developers can use mercurial as a “super client” to enable much of this power while still working on a team that uses subversion.
Read the rest of this article »

5 Comments

Top 3 Shortcuts for the Terminal

2008/05/9

As my coworkers know, I’m a keyboard shortcut junkie. It’s a problem (and I need help), but I’d rather give you a taste of what I’ve been smoking and drag you down with me :).

Why only 3? Because people don’t learn a couple of pages of keystroke combinations at a time. But with only the 3 of the best keystrokes, there’s a good chance I’ll get you hooked and you’ll seek out some more.
Read the rest of this article »

1 Comment

Using Mercurial as a “super client” for Subversion

2008/05/1

There’s a blog post by one of the subversion developers talking about the future of subversion in a DVCS world.

I agree with parts of the post (and many of the comments) that subversion will continue to be around for a long time, but that more and more developers will start using tools like mercurial and git as a “super client” for a normal centralized version control repository.

Read the rest of this article »

3 Comments

Converting wordpress blog from wordpress.com to slicehost slice

2008/04/23

I just finished the conversion over from a wordpress.com hosted blog to a wordpress blog that I’m running on a slicehost slice.

I think that it’s good to maintain your own linux server and get your hands dirty from time in Apache rewrite rules and php code.

The biggest reason for the switch is that the wordpress instance on wordpress.com completely mangles pasted grails and groovy code. It tries to make things pretty by changing a double dash to an mdash, single dashes to an ndash and double quotes to “smart” quotes (an oxymoron if there ever was one). Not to mention the manual &gt; and &lt; that you need to enter instead of > and <. These insidious changes make pasted code worthless and painful for readers to use.

After struggling with trying to get the formatting working correctly for a few weeks, I decided to host my own blog and use the great wp-syntax plugin.

I did need to do some reformatting on my old posts (as I don’t need to encode things anymore) and I believe that I have everything fixed now.  Let me know if you run across anything I’ve missed in the conversion.

No Comments

Monitoring HTTP traffic to debug your Grails application

2008/04/3

I’m often surprised when I run across developers who don’t have a variety of HTTP traffic monitoring apps as an integral part of their toolkit. When doing Grails development (or any web development really), being able to see the actual information that is going over the wire is invaluable.

Firebug

These days, more and more people are familiar with the amazing Firefox plugin Firebug. It allows you to view request and response information along with many other tricks.

Read the rest of this article »

8 Comments

Using Gant to execute a groovy script within the Grails context (updated)

2008/03/31

In a previous post I showed a script that I had created to allow the execution of a groovy script within a grails application context (including access to domain objects, controllers, services, etc). A couple of people reported a problem with the script where they were getting lazy initialization exceptions. I finally tracked this issue down to one where many-to-many relationships are being used between two domain classes.

Here is an updated script that fixes this issue by setting up the hibernate session in the Gant script.
Read the rest of this article »

46 Comments