Quickpost: nyroModal – another jQuery plug-in to keep an eye on
Over the last week or three Internal Apps had a problem where they wanted to display a page, but have a window appear with new contract terms visible. They also needed a scroll bar, buttons to accept/decline, print, and close the pop-up. They also needed a little twist, if the user declined the new contract, or closed the pop-window, the page should send them back to the log in page.
I thought about the problems, and I was thinking recommending to them FancyBox (our old standby for modal windows), but I had just read on another site about nyroModal. I recommended that they try it out (since it's jQuery you have all those great callback functions - that would cover the page redirection etc. - and those oh-so-tasty visual effects that would provide them with exactly what they had envisioned), and within a day they had a perfect set up. So if you find that you need a modal box (for whatever reason), I suggest you give nyroModal a try. We ourselves won't be dumping FancyBox anytime soon, but it is nice to have another option.
Print This Post
&& || and or
So it turns out you learn stuff when you read and I've noticed that you remember stuff when you write it down, so since this is the best tech blog ever I'm writing it down here so you all can look at it and learn it (it's gonna be up to you to write it down somewhere else if you wanna remember it). I'm not sure about JSTL or other languages but I'd wager they are the same. if you were wondering which is better to use && vs. "and" or || vs. "or" in your expressions it pretty much all depends because they have different precedences (is that a word? huh spell check likes it.). First of all && has a higher precedence than || (at least in php) and "and" has a higher precedence than "or" but || has a higher precedence than "and", thus || and && both have higher precedences than "or" and && also has a higher precedence than "and". Confused? k here is the breakdown, higher precedence listed first:
&& || and xor //I know we didn't cover this but it's in there... trust me. or |
as a side note "xor" means one or the other is true but not both... I can see how that could be handy.
Print This Post
$i++ || ++$i
So for some time now I've wondered what the underlying difference is in writing a variable increment as $i++ (aka post-increment) vs. writing it as ++$i (aka pre-increment). I've seen it done both ways and even tried it both ways and have been unable to determine a difference. Recently I was reading a php manual (thus the php code used in this post) and VIOLA! I stumbled into the profound answer. It is subtle yet significant. if you use the post-increment or $i++ it does just that, increments the variable after the expression that includes said variable has run. And as you may have guessed the pre-increment or ++$i does just the opposite. The book I was reading used the following scenario to explain:
$x = 3; $x++ < 4; |
This would evaluate to true as 3 is less than 4 and the expression is run before the variable $x is incremented. If you run the same using the pre-increment
$x = 3; ++$x < 4; |
It would evaluate as false because the variable is incremented before the expression is run and 4 is not less than 4.
So unless I'm mistaking the following code:
for ($i = 1;$i < 8; $i++){ echo $i; } |
Should run the same as
for ($i = 0; $i < 8; ++$i){ echo $i; } |
I guess in that scenario it's just boils down to personal preference.
Print This Post
Form Contorls – And some jQuery solutions
I was researching a little Twitter meets jQuery and I stumbled on this blog post. While it was helpful, and I may consider using the plugin, it was what the developer had 'tweeted' about that caught my eye and caused this post to exist. You see he had posted two links to form controls. The first link was ideas/new controls, and the second was the jQuery solution to those form controls. Since our interal apps department made the switch finally started using jQuery -as it was pointed out how easy it makes things and how it can improve their existing code (smaller, better, faster)- last week from in addition to prototype to jQuery, I thought they would get a little added bonus out of this post (since they use a ton of form controls).
So first up, a link to a nice form controls gallery (it even posts which js libs can accomplish such feats)
And secondly a link to the jQuery solutions to each of the form control interfaces
Between those two pages, you can dress up any page, form, or what-have-you to do almost anything you want. And it will look like the fresh-burnination* doing it.
Another short and sweet post.
---------------------------------
*fresh-burnination is a tribute to strongbad, and the Men In Black, with a little CW (WB) mockery thrown in. It is derived from the "new hotness", strongbad style, or the "fresh burnination".
Print This Post