Friday, November 20, 2015

Getting Wrapped up in Python


On the news that Google released their AI TensorFlow w/ interface in Python, I'm getting myself wrapped up in Python. I will share what I learn. For now:



Go Download Python and run through this training

Wednesday, November 11, 2015

Getting Groovy with Grails

How to get on with your Groovy Grails IDE:


Download and install JDK 7
Last I knew, Java8 doesn't jive with Grails 2.4.4 which comes with GGTS

Download and install GGTS (which is Groovy/Grails for Eclipse)

Once installed you should configure GGTS to use your newly installed Java7. Open GGTS > click window > Preferences > Java > Configure to point to your JDK (C:\Program Files \ Java \ JDK1.7.45 [or where ever you just installed])

Follow this link for an easy-to-follow Grails Project tutorial.





Monday, November 2, 2015

Grails findAllBy Method

Home with a sick kid today, figured I could cobble together a video and a blog post. I am writing this one-handed, with a sick kid on my lap, watching PJ Masks, truly a great day. See video for a demo of the findAllBy method. You can use this method to create a pared down list, params.id is passed from URL. Kind of a cool method you may end up using on the reg.


GGTS 3.6.4 and Grails 2.4.4



Walk thru: 
  1. Start by creating a new project named lameProj
  2. Then create a domain class FavColor.groovy
package lameproj

class FavColor {
     String name
     String favColor

    static constraints = {
    }
}

   3.  Then generate-all lameproj.FavColor
   4.  Copy views >favcolor > index.gsp
   5.  Paste and rename to youtube.gsp
   6.  Add below code to favColorController.groovy

     def youtube(Integer max) {
          params.max = Math.min(max ?: 10, 100)
          def somelist = FavColor.findAllByFavColor(params.id)
          respond FavColor.list(params), model:[favColorInstanceCount: FavColor.count(), somelist:somelist]
     }


   7.  Edit youtube.gsp to use ${somelist}, about line 34

<g:each in="${somelist}" status="i" var="favColorInstance">


   8.  Launch you app, add some values, ensure the favorite color entries are exact. Test your youtube method with this link: http://localhost:8080/lameProj/favColor/youtube/Blue