Skip to content
May 15, 2012 / edeustace

Powershell script do download a zip and copy its contents to specific locations on downloaded machine

On my current project we are using windows servers for our deployments. So I’ve had to write a bit of Powershell. The script below downloads a zip from a given url and copies the contents to locations on the destination hard drive.

gist is here

April 13, 2012 / edeustace

Stored procedure to create a history table and triggers for a given table

Here’s a wee stored procedure for sql server 2008 that generates a history table and triggers for a given table:

https://gist.github.com/2377468

March 30, 2012 / edeustace

Scala – generate random alphanumeric sequence

For Scala Puzzles I need to create a random sequence to allow people to link to anonymous puzzles. I found an example here, but it was using toString instead of mkString, so I’ve tweaked it a tiny bit (gist is here)


import scala.util.Random

def uniqueRandomKey(chars: String, length: Int, uniqueFunc: String=>Boolean) : String =
{
 val newKey = (1 to length).map(
   x =>
   {
     val index = Random.nextInt(chars.length)
     chars(index)
   }
  ).mkString("")
  
 if (uniqueFunc(newKey))
  newKey
 else
  uniqueRandomKey(chars, length, uniqueFunc)
}

/**
 * implement your own is unique here
 */
def isUnique(s:String):Boolean = true

val chars = ('a' to 'z') ++ ('A' to 'Z') ++ ('0' to '9') ++ ("-!£$")
val key = uniqueRandomKey(chars.mkString(""), 8, isUnique)
println(key)

March 24, 2012 / edeustace

Remote script to add/remove flash player to/from your path

When building Flash/Flex projects that have unit tests and command line builds, one needs to have the Flash Player on the environment path, so it can be launched programmatically.

It’s easy to do, but can be fiddly and a pain.

Here’s a remote shell script that will do everything for you:

https://github.com/edeustace/flashplayer-on-path

Just run it like so:

Add:

bash -s < <(curl -s https://raw.github.com/edeustace/flashplayer-on-path/master/run )

The run ‘Flash\ Player’

Remove:

bash -s remove < <(curl -s https://raw.github.com/edeustace/flashplayer-on-path/master/run )
 

It only works for Mac right now, but I'll update it soon so that it works on ubuntu. It works on Mac and Linux. As for windows that will require a different script so will need to look into how to do it. Or if anyone has any ideas on that already...

March 23, 2012 / edeustace

Open containing folder in Eclipse for selected resource OSX

I’ve posted about doing this on Windows here.

Here’s how you do it for OSX:

Run -> External Tools -> External Tools Configurations -> Program -> (right click) New

February 22, 2012 / edeustace

Sublime Text linux command

The Sublime Text 2 has docs for linking the app to the command line in OS X.

Doing the same for linux is almost identical:

$ sudo ln -s /home/ed/apps/sublime_text_2/sublime_text /usr/bin/subl

 

February 18, 2012 / edeustace

Playing with Play! 2.0 – a scala puzzle site

I’ve been playing with the Play! 2.0 framework and I must say I quite like it.

As a vehicle for learning the framework, I’ve been building a Scala puzzle site.

Let me know what you think of it (I think I need to rejig the ui a bit).

 

December 21, 2011 / edeustace

‘in place’ image changer – jquery plugin

On one if my projects we’ve started using best_in_place, which is a gem that allows you to edit elements of your data model ‘in place’ (aka directly on that page) in a restful way. However there wasn’t an option to change images using the same technique.

I created a fork of best_in_place and plugged in a jQuery component that I create that provides this very option.

Here’s an example

Here’s the source code

You can use this standalone – or you can try out the forked best_in_place

December 21, 2011 / edeustace

JQuery login component

Here’s a little login component I’ve extracted out of my pet project. I found that I kept on needing this for different apps, so thought a reusable component would be handy.

Example here

Source here

December 14, 2011 / edeustace

simple jira webservice client

I was doing a bit of Jira story creation today and had a lot of stories to add. They were all written into a spreadsheet. So I wondered if I could do a batch import of the spreadsheet. This is possible if you have a Jira administrator account, but I don’t I’m just a regular Joey for this Jira server.

So I put together a little webservice client that does the csv import for me.

The project is an executable jar so you run it like so:

java -jar simple-jira-webservice-client-0.1-jar-with-dependencies.jar ${username} ${password} ${path_to_csv_file}


where the csv file might look like:
#project_key,summary,description
MYPROJECT,New Story,Here is the description
MYPROJECT,New Story Two,Here is another description

If you’d like to use it, you’ll need to run a few maven commands (see github for more info) first to get the wsdl for your jira server. Once that set up you can then build it, and then run the above command.

The source code is on Github.

Follow

Get every new post delivered to your Inbox.

Join 54 other followers