jQuery Auto Datepicker

Posted 3 days ago

I somewhat recently started using jQuery datepicker in place of the dhtml_calendar Rails plugin. The change was for various reasons which are beyond the purpose of this blog. After using it a few times I realized it would be nice if I could just set a class on my text field and it would automagically become a jQuery datepicker enabled text field. Of course I am sure someone has likely already conquered this, I thought it would be a fun learning experience to write my own.

if (jQuery && jQuery.datepicker) {
  $(window).load(function() {
    jQuery(".datepicker[id]").map(function(i) { $("#"+this.id).datepicker(); }); 
  }); 
};

Since I am using these to almost always store into a database I like to set the default date format.

if (jQuery && jQuery.datepicker) {
  $(window).load(function() {
$.datepicker.setDefaults({ 
      "buttonImage" : "/images/calendar-icon.png",
      "constrainInput": false ,
      "dateFormat" : "yy-mm-dd", 
      "showAnim" : "slideDown", 
      "showOn" : "button"
      });
};

I am also overriding some other default options, using showOn and buttonImage I change the behavior of the datepicker to use an image of my choice to activate the calendar instead of the field itself. I change the animation to slideDown, personally I just think it looks a little more slick. I do not normally turn off constrainInput, since it adds another level of validation but in some cases it may be necessary so I thought it would be useful to demonstrate. Without disabling input constraint by setting constrainInput to false jQuery datepicker will not allow any characters that are not included in the defined format.

Hopefully this will prove helpful to someone, and if not I learned a little by doing it. I certainly welcome any feedback or constructive criticism or general cursing of my code.

Posted in  | Tags , , ,  | no comments

Installing vim-rails on OpenSuse 11.2

Posted 3 months ago

Get vim-rails either download the rails.vim from vim.org or clone vim-rails from github.com. Follow the instructions on the vim.org site or in the README on GitHub, installing the files into the appropriate VIM folder, probably ~/.vim/.

Note that I had the following VIM packages installed:
  • vim-enhanced
  • vim-base

Before you try anything further!

Additionally I needed to install vim-data. Afterwards you will find a plethora of scripts in /usr/share/vim/current/syntax, I initially had tried installing some of these for example xhtml.vim from vim.org and experienced much grief. Eventually I realized I just needed to install the Suse package mentioned above.

Once I start to become a vim-rails ninja I might post another blog on my findings, good and bad habits.

Posted in , ,  | Tags ,  | no comments

Long Overdue Freedom

Posted 3 months ago

During the 4 hour drive back to Canton from Lansing, Michigan from the Great Lakes Ruby Bash I had a realization. Its been long past due, I couldn't even bring myself to guessing how long its been since I last booted to it. Its a waste of time, space and hurting my morals.

Step 1- Staring off positive...

Something good to drink

Step 2 - A good song and it makes sense...you'll see

Something good to listen to

Step 3 - NTFS hrm wonder what that could be?

Looks like we have a problem here

Step 4 - Ah, who cares!

All better

It should be noted that I am so confident in my actions that I didn't even take the time to look through the files to see if I wanted anything on the file system...obviously its nothing important otherwise it would be on a journaled file system!

As reward for my accomplishment, I decided to subscribe to a Twitter account.

Posted in , ,  | Tags , , ,  | no comments

Fight Scene From "Unleashed"

Posted 4 months ago

My favorite fight scene from the move and probably one of my top favorite fight scenes of all movies mainly for reasons of practicality.

 

A perfect example of where speed can kill (literally) in a hand-to-hand combat situation. Granted one must have the confidence and skill but it takes very little power to impose lethal damage to the throat if it is left exposed. I watched this movie over the weekend and over all it was enjoyable, obviously the majority is entertainment value but most of the fight scenes like this one also hold real hand-to-hand combat value. I love the triple strike opposed to just one though, nothing says down for the count like three swift crosses to the throat.

Posted in ,  | Tags , , , , , , ,  | no comments

Munson's Security Or Lack Thereof

Posted 4 months ago

The night started fine at Munson's in Canton, OH last night. Of course the early night is always ok at Munson's and its a great place to grab a bite to eat during the day. However unless you enjoy being shoulder to shoulder with the scum of the earth I advise avoiding the place during the later hours. Its nothing but another overcrowded dance floor/restaurant/bar crawling with the very people that make me ashamed to be an American and even further so of the human race. The kind of people that make you wonder if we can really be considered an advanced life form.

Anyway those thoughts are nothing new, I can't stand society these days its just that simple but lets leave that bridge uncrossed for now. What I really want to say is the security there is pretty shitty at best, a bunch of meat heads running around with XXL "SECURITY" t-shirts on does not replace an (at least) somewhat experienced security team. Guys just so you are aware a major part of your job as security is to DIFFUSE VIOLENCE NOT TO CREATE IT! Of course when half of your security team is there for the thrill ride and badge I'm pretty sure that constitutes conflict of interest.

So unfortunate, but I must say its the last time I will make the mistake of going out for the later hours to Munson's.

Posted in  | Tags , , , , , ,  | no comments