Run groovy scripts in sublime text

Wondering how to run Groovy files in Sublime Text? It’s really quite simple – to create a new build system in Sublime Text go to Tools > Build System > New Build System and copy/paste the code below

  "cmd": ["groovy","$file"],
  "selector": "source.groovy",
    "shell": "cmd.exe"

Once the build system is saved you should be able to type Ctrl + B to run the code and output to the Sublime console. If nothing happens you may need to go to Tools > Build System and select groovy.

This is extremely handy if you’re creating tests in Grails and want to test things without creating a full test case beforehand, writing/running tests in Grails can be excrutiating and testing within your file can help you spot mistakes much quicker than running test-app and waiting for everyting to compile and output your results.

Grails – Reloading a service without stopping your app

When a grails application is started most Grails artificats are reloaded as they are changed – controllers, filters, tag libraries, but the opposite is true if you strongly type your services like below.

FakeService fakeService

However if you use untyped injected like

def fakeService

then the service will be reloaded as changes are made. This may have been obvious to most people, but I was originally going through the hassle of either restarting my app after each change (huge time waster) or creating a fakeServiceHelper where I made all my changes and introducing a needless extra layer to my application to avoid restarting my app after each change.

Windows Media Center Reports No Signal when Recording

I was having a problem with my local ABC station working when I viewed the channel to watch a show, but every recording was failing saying “There was no TV signal when the show was scheduled to record” even if I went to the channel immediately following that error it was working. If I tried to press record on the show as it was playing it would fail and say no signal again. It turns out the problem is the antenna somehow is picking up two sources. I’m not sure why it could play the show live and not record, but here’s how I fixed it.

  1. Open the Program Guide
  2. Right click the problem channel
  3. Choose Edit Channel
  4. Choose Edit Sources – you should see two sources enabled
  5. Disable one of them and try the channel again. If that doesn’t work disable the other source and try the channel again.

For reference I’m using Windows 7 with an AVerMedia M780 Tuner.