Friday, June 17, 2011

Present ideas for teachers

Have you woken up on the night before the first day( or the last day) of school realizing that tomorrow is the day you were supposed to prepare something for your child's teacher?
Have you ever browsed mindlessly through the store looking for the perfect teacher present that won't be thrown away as useless?


I have !


So each year I post a couple of ideas that I hope will help other parents and save them the frustration in trying to make their children's teachers happy.


This year our theme was " Chinese"( I make up the themes, in case you are wondering), so here is what I came up with:
End of the year teacherpresent 01




The gift set included: 
- a reusable tote bag
- a matching refrigerator magnet notebook
- a matching color bamboo mat
-a small matching print soy sauce dish
- a small wooden scroll box 
- a noodle bowl ( which were actually ice cream bowls, but they were the perfect shape and size for noodles) 
- a matching fancy chopsticks
- a "scroll" with a recipe for " Longevity noodles" and a thank you note on the back




End of the year teacherpresent 04


All of the chopsticks had different designs on the handles. I must say for the price of the set, these were pretty impressive quality.
End of the year teacherpresent 05


And here are the bags packed and ready to go. I don't have pictures of all the designs, but they matched the bags pattern.


End of the year teacherpresent 08


In case this is not your type of teacher present idea, you might want to check out these posts:


I hope these ideas help to make the last last days of school more bearable for you by giving you ideas for the perfect present for the perfect teacher! 
Have a sunny Summer, my friends!
Annie

Tuesday, June 14, 2011

Grails, Web Flows, and redirecting out

If you read the Grails Web Flow documentation it all seems pretty straightforward - start,end states, transitions, actions, events, it's all good. However, just like any other technology that seems like magic, there always is some kind of a catch once you start using it.

One of the little 'gotchas' that I ran into was how to properly complete the flow. Now, reading up the documentation, it would seem easy - at the end of your wizard/flow, you just redirect to a different controller+action and it's all good. It all makes sense - often time, the wizard walks through multiple steps, collects some information, and when it's all done (you save your brand new Foo), you can just redirect to the details page for foo (e.g. /foo/show/1).

Well you thought it would be that easy. Not that quick...

The Grails web flow documentation is kinda deceptive like that. It shows you a simplistic example that works; however, when you try to do something more realistic, then you start getting into trouble. So, the example form the docs looks like this:

  def fooFlow = { 
def startState { }

def endState {
redirect(controller:'foo', action:'bar')
}

}

The catch is that in their examples, the redirect is to a static URL that doesn't take any parameters.The problem comes up when in the end state you try to pass in some parameter from the flow (e.g. which often is the case e.g. at the end of the flow you want to display the details page (e.g. redirect(controller:'foo', action:'bar', id:flow.fooId) . The problem manifests itself in a weird way - the web flow would store a particular value of flow property( e.g. flow.fooId (under onditions that I couldn't figure out), and even though your current wizard might have stored a particular value from the current flow, for whatever reason it ends up redirecting to a value stored from a previous flow. So, the wizard 'kinda' worked in that it redirected to a details page at the end of the wizard, but in a large percentage of the time, it would redirect to the wrong details page. From what I could gather, the issue is that in the end state, the redirect cannot use any values from the flow, session, or flash and as a result uses some cached value (possibly from the first flow execution)

The solution to this (which is somewhere on the Grails mailing lists) is as follows: add an explicit empty "end" state (including an empty gsp to match the end state name), and in the states that transition into the end flow, issue the redirect from the penultimate state, e.g.


def fooFlow = {
def startState { }

def beforeEnd {
action {
redirect(controller:'foo', action:'bar', id:flow.fooId)
}
on("success").to "end"
}

def end(
/** note that this requries an end.gsp to be present
in the flow subdirectory, but it never gets rendered after the
redirect **/
)
}

Now, with this trick at hand, the end.gsp never gets rendered, and the client browsers do get redirected to the detail pages that you want to display, outside of your web flow.

As a more Web Flow centric alternative, you could always store the relevant object (Foo) inside the flow and display any relevant details about the object in the end state (end.gsp)

The Forgotten " Kiara"

After spending an amazing Saturday at the SCBWI conference in Fishkill, I realized that I didn't post anything last week. I thought I did, but I guess having a girl with 105 F fever didn't help my memory either. So, before I forget again, here is the last of the gift sets that I started posting in April. Although I did forget about this set, it's one of my favorite, I hope you enjoy it too!

"Kiara" gift set


The gift set consists of a jewelry box and a greeting card. 
"Kiara" necklace gift box



"Kiara" card

Soon all of these would be available in the store I am planing to open. 


Ta-ta for now,
Annie

Popular Posts

Related Posts with Thumbnails