On one of my recent projects I needed to turn off the jQueryUI Tooltips for a certain element on the page. This was simple enough to complete, just initialize the tooltips as shown below:
The only bit I added is the ".not('#insertFeedbackSnippets *[title]')". Nice and simple!
My musings while programming in a number of languages and libraries, from PHP, Perl, JavaScript, jQuery, and KnockoutJS, with liberal use of CSS and Bootstrap to make it all pretty.
2014-02-21
2014-02-17
jQuery DataTables: How to get total rows
Given the DataTables initialization below:
I had to get the total number of rows to display elsewhere in the page. I didn't want to rely on "Showing X to Y of Z entries", as I wanted it much higher in the page.
The solution was extremely simple:
With that little bit of code I could show the user how many records I had for them before they saw the table.
Labels:
DataTables,
jQuery
Location:
Milwaukee, WI, USA
2014-02-13
JavaScript Array Prototypes, Clearing an Array in JavaScript and getting the last element from an Array in JavaScript
Recently I had to use these two prototypes for a project, and I don't wish for them to get lost in the sands of time.
Clearing an Array in JavaScript:
Getting the last element from an Array in JavaScript:
Clearing an Array in JavaScript:
Getting the last element from an Array in JavaScript:
Labels:
JavaScript,
JavaScript Prototypes,
jQuery
Location:
Milwaukee, WI, USA
2014-02-12
Quick reminder jQuery $.ajax calls, UTF8, and you!
Just a quick reminder, jQuery.ajax calls encode everything in UTF8, so if lets say you're saving that out to a JSON file for retrieval later you will need to decode UTF8 for proper display.
For example, this:
Should be:
For example, this:
Should be:
Location:
Milwaukee, WI, USA
2014-02-11
Bing Wallpaper Downloader
So I happened upon a simple Perl script that downloads the Bing wallpaper of the day and sets it as the active desktop background for GNOME. I'm working to modify this for Windows 7, and am currently stuck on how to set the active background in Windows 7.
Here is what I have so far:
Does any know how to set an image as the current desktop wallpaper in Windows 7? If so, please leave it in the comments!
Here is what I have so far:
Does any know how to set an image as the current desktop wallpaper in Windows 7? If so, please leave it in the comments!
Labels:
File::Copy,
File::Spec,
Perl,
Win32::TieRegistry,
Windows 7
Location:
Milwaukee, WI, USA
2014-02-08
Archive::Zip, setting compression level
One of my recent additions was to give users the ability to download files, but without manually downloading each file individually. I turned to Archive::Zip and it was simple enough to add the files.
But these I didn't want to waste server CPU resources on compressing these files, as they are likely already compressed (JPGs, MP3s, MP4s, etc.).
Final(ish) output:
But these I didn't want to waste server CPU resources on compressing these files, as they are likely already compressed (JPGs, MP3s, MP4s, etc.).
Final(ish) output:
2014-02-07
DataTables Footer Callback with Multiple Footer Rows
I've been working on updating our legacy product to be "Modernized". One of the pages had some simple calculations at the bottom of a table handled by the server. As part of the modernization effort I'm moving those calculations to the client side.
Since all of our tables utilize DataTables, this should be a very simple:
The original documentation shows adding the calculations to a single row in the tfoot, however, this would not work for me.
As you can see from above, I cheated and used jQuery set the values on each row explicitly.
Since all of our tables utilize DataTables, this should be a very simple:
The original documentation shows adding the calculations to a single row in the tfoot, however, this would not work for me.
As you can see from above, I cheated and used jQuery set the values on each row explicitly.
Labels:
DataTables,
JavaScript,
jQuery
Location:
Milwaukee, WI, USA
2014-02-06
Template Toolkit Multiple Filters (chaining filters)
This one is very simple, but not obvious as first...
I tried [% user.firstname FILTER lower,ucfirst %] but my output was lower only. The solution:
[% user.firstname FILTER lower FILTER ucfirst %].
There is also a short hand version:
[% user.firstname | lower | ucfirst %].
Note that filters are processed left to right so [% user.firstname FILTER ucfirst FILTER lower %] would produce only lowercase output.
I tried [% user.firstname FILTER lower,ucfirst %] but my output was lower only. The solution:
[% user.firstname FILTER lower FILTER ucfirst %].
There is also a short hand version:
[% user.firstname | lower | ucfirst %].
Note that filters are processed left to right so [% user.firstname FILTER ucfirst FILTER lower %] would produce only lowercase output.
Subscribe to:
Posts (Atom)