Tuesday, April 18, 2017

Testing 123

testing 123

this blog is a pretty big deal.

Sunday, December 12, 2010


Like I mentioned in my last post, I have some big personal news to announce...without further ado -

My entrepreneurial tendencies have finally resulted in something that lives on the internet!

It's called Edufy (http://www.edufy.org). We have built a site for teachers to share and discover learning activities for their students. Our founder, Philip Cooke, is a teacher in Arlington, VA, and his frustration with finding ways to create personalized learning activities for his students inspired him to start this project. After six months of planning, building, testing, and fixing, we launched the site at a couple of conferences in November, and now we want to start spreading the news.
You can check out what Edufy is all about at:

We'd love it if you could all check out the site and let us know what you think. If you are a teacher, give it a test drive! If you know any teachers, PLEASE send this to them - we are just getting started, and any feedback/criticism/encouragement we can get is highly valued. If you have any questions or comments, please let me know, or send feedback to contact@edufy.org.

For anyone who cares, I'll be posting about some of the technologies we're using, but for now, check out Edufy, and spread the word!

To keep up with what's new on Edufy, be a fan on Facebook, or follow our blog

Thanks from the Edufy Team!

Friday, November 5, 2010

Big News...Coming Soon

For months now, I have been working with a group of awesome folks on something.  Lots of leaving my job, getting home, and going back to work.  I am pretty proud about what we've come up with.  In a few days, I'll be sharing it.  Fingers crossed.  Exciting times ahead...make or break as they say.

Stay Tuned.

Wednesday, November 3, 2010

Generating .ldif Files using Groovy

I recently needed to do a bulk update of an openLDAP directory to add a password for a really big batch of test users.  I wrote a little Groovy script to do it.  Thought it might be helpful.  First things first, generate a password for the test users using the slappasswd command.  Using the defaults will give a you password with SSHA encryption.  Now we need an .ldif file that describes the change to make.  For more information on ldapmodify commands, head here.  The script here will loop through a group of sequentially id'd users in a couple of ous and assign them our nicely hashed password:

        File newFile = new File('modify-script.ldif')
        String username = ''
        String toAdd = ""

        def stuCount = 80000
        def admCount = 2000
        def teachCount = 18000

        StringBuilder sb = new StringBuilder()

        def ous = [ 'ou1', 'ou2' ]

        for ( ouname in ous ) {

            for ( i in 1..stuCount ) {
                username = "user_${epname}_${i}"

                toAdd = """
dn: uid=${username},ou=people,ou=${ouname},dc=yourdc,dc=com
changetype: modify
add: userPassword
userPassword: {SSHA}zW7Q/yQQ8IKZiX8ANJIGugi0deNebN1o
                sb.append( toAdd )

            sb.append( "\n\n" )

            newFile << sb.toString()

This will produce a file (modify-script.ldif) with a bunch of entries like these:

dn: uid=user_ou1_1,ou=people,ou=ou1,dc=yourdc,dc=com
changetype: modify
add: userPassword
userPassword: {SSHA}zW7Q/yQQ8IKZiX8ANJIGugi0deNebN1o

dn: uid=user_ou1_2,ou=people,ou=ou1,dc=yourdc,dc=com
changetype: modify
add: userPassword
userPassword: {SSHA}zW7Q/yQQ8IKZiX8ANJIGugi0deNebN1o


Now you can simply run the ldapmodify command to update the users:

ldapmodify -x -D "cn=admin,dc=yourdc,dc=com" -w yourpass -f modify-script.ldif

I've been able to use derivatives of this script for a few different tasks.  Hope it helps someone else.

Thursday, October 7, 2010

Grails Image Processing with the ImageTools Plugin

I recently had a requirement on my side project to add some simple image processing.  I had previously used the ImageTools plugin, but that seems to have falled into a bit of disrepair.  I had a multistep process to get this going, and I figured I'd share it.

According to the git repository, the last checkin on version 1.0.4 was way back in January 2010.  Grabbing the plugin using the standard grails install-plugin as documented on the plugin documentation page just doesn't cut it.  When attempting to use the documentation, you get a message that tells you
unable to resolve class ImageTool @ line xxx, column xxx. def imageTool = new ImageTool();
This is troubling, as that is the only class included in the plugin.  Fortunately I found this comment on a closed (???) issue on github:
So, to solve this I had to run a git clone on this source tree and then follow the instruction at the link below to create my own version of this plugin with correct package.
So it would seem that you need to grab the source, then create a plugin.  This is not as easy as you might think.  First of all, you might not have git installed.  Follow the instructions here to 'git git'.  Next, you need to grab the code.  From the command prompt in the directory you want the code, run the following command:

git clone http://github.com/ricardojmendez/grails-imagetools.git

Now you have the code.  Even though it's a plugin, you have to tell grails it's a plugin, by running the grails create-plugin command.  Now you have a zip file that you can install in your project, using the standard grails install-plugin command.

From there you can follow the instructions.  The import statement is recognized, and we can get finally get down to actually writing the controller code:

import org.grails.plugins.imagetools.*


//the controller method we submit to
def myProfileSave = {


uploadPhoto( file, user )



def uploadPhoto( upfile, user ) {

 if(upfile.empty) {
  flash.message = 'File cannot be empty'
  redirect( action: 'myProfile' )

 def imageTool = new ImageTool()

 imageTool.load( upfile.getBytes() )

 // Crops it to a square
        //make the new squared image the image to operate on 
 // Reduces the image size
 imageTool.thumbnail( 125 )

 def fileBase = grailsApplication.config.imageLocation
 def fullPath = "${fileBase}/user/photo"
        File fullPFile = new File( fullPath )

 if ( !fullPFile.exists() ) {
 def filePath = "${fullPath}/user_${user.id}_125.jpg"

 File toMake = new File( filePath )

 if ( !toMake.exists() ) {
 // Saves the result
 imageTool.writeResult( filePath, "JPEG" )

Once you get the plugin working, it's a breeze, as you can see!  It's a great, simple wrapper around the nasty and complicated JAI library.

Some Tips:

1) You'll probably want to increase your heap size if you are running with a default or small heap.  This requires a bit of memory.
2) Remember to specify a multi-part form.  A good explanation of this can be found in the grails documentation.
3) Profit!

Saturday, July 31, 2010


Let's talk about family.  My grandparents are 94 and 92, and still going.  They live by themselves.  They take care of themselves.  They sometimes complain about how badly they are doing, but I can name multiple couples one third of their age who aren't doing as well as they are!  My grandfather has good days and bad, and my grandmother has short-term memory issues, but really all in all, they are both really still rocking.  I talked to them today for half an hour, and afterwards, I was hit smack in the face with one of those 'wow am I blessed to have these people in my life' moments.  They have been married now for more than SEVENTY years.  They are amazing people who have been a part of so much, and who have so many amazing stories.  They are 'unconditional love machines', who just amaze me with their capacity to be proud of and kind to their family.  They are so positive, so caring, and so full of love.  It's really quite refreshing.

Thanks Grandma and Granddaddy for being an inspiration.  We all love you a ton!