Migrating jQuery 1.4.x to jQuery 1.6.x
When migrating from jQuery 1.4.x to jQuery 1.6.x you have to consider some changes.
I guess you can find all of them anywhere on the jQuery Blog but when you don’t have the time or the patience to read all of the posts you have to try and test it by yourself.
I found out some of the changes the hard way when I migrated the Matterhorn Engage UI. Here is a list (mainly for me to remember them):
- .attr and .prop
- in jQuery 1.6 the handling of DOM attributes and DOM properties is split apart into separate methods
- .attr first checks if the attribute is explicitly written in the HTML code, after that it looks at the object created by the HTML tag, and inspects its object property
- .prop sets or gets properties on DOM elements
- see jQuery 1.6 released
- for ajax calls there are no options like ‘yourAjaxCall.onreadystatechange = anyFunction;’ any more, you have to use ‘success’, ‘error’, etc. inside your ajax-request
- the function generation from jsonp ajax-requests now contains underscores (‘_’), so you have to adapt your save patterns on server side
Related sites:
- My Matterhorn Branch Issue Tracker for the migration
- jQuery Blog: jQuery 1.6 search results
- David Tong – Upgrading jQuery – from 1.4.x to 1.6.x
To be continued…
Building libfreenect with patched libusb under Mac OS X
You need:
- macports
- The following installed macports:
- git-core
- cmake
- libtool
- libusb-devel
- libfreenect:
- git clone https://github.com/OpenKinect/libfreenect.git
- libusb:
- git clone git://git.libusb.org/libusb.git
- cd path/to/libusb
- ./autogen.sh
- patch -p1 < path/to/libfreenect/platform/osx/libusb-osx-kinect.diff
- ./configure LDFLAGS=’-framework IOKit -framework CoreFoundation’
- make
- sudo make install
- cd path/to/libfreenect
- mkdir build
- cd build
- ccmake ..
- With the following changes:
- LIBUSB_1_INCLUDE_DIR: /usr/local/include
- LIBUSB_1_LIBRARY: /usr/local/lib/libusb-1.0.dylib
- press ‘c’ and afterwards ‘g’ to generate and exit
- cmake ..
- make
- sudo make install
Lisp: Emacs Autocomplete
Today I hacked some lisp in emacs because I got two new books (Let over Lambda & Land of Lisp).
After a while when the function-definitions became more frequent I missed a language-specific autocomplete (and didn’t only want to use the built-in autocomplete that completes words you wrote earlier) and after some research I found the solution: Emacs Autocomplete. It integrates different language-dictionaries and inserts new words on the fly (with the right settings).
After installing the autocomplete into .emacs.d I inserted the following lines into my .emacs-file to enable it:
;; add .emacs.d to load path (add-to-list 'load-path "~/.emacs.d") ;; enable autocomplete (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") (ac-config-default) (global-auto-complete-mode t) (auto-complete-mode t)
To get a lisp-specific autocomplete you’ve got to include ac-slime (found at github): put it into your .emacs.d-folder and include it in your .emacs-file via
;; add lisp autocomplete-support (require 'ac-slime) (add-hook 'slime-mode-hook 'set-up-slime-ac)
and to switch on autocomplete globally you have to apply a “dirty fix”:
;; dirty fix for having AC everywhere
(define-globalized-minor-mode real-global-auto-complete-mode
auto-complete-mode (lambda ()
(if (not (minibufferp (current-buffer)))
(auto-complete-mode 1))))
(real-global-auto-complete-mode t)
Now only one thing is missing: the mentioned inserting of new words on the fly:
;; create and add new words to the dictionary on the fly (when (require 'auto-complete-config nil 'noerror) (add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") (setq ac-comphist-file "~/.emacs.d/ac-comphist.dat") (ac-config-default))
Java, C++: ClassLoader and Qt Resource System
Here a little comparison between the Java ClassLoader and the Qt Resource System:
If you want to load an icon and/or an image e.g. in a Java .jar-file you have to do it this way:
Icon icon;
Image image;
ClassLoader CLDR = this.getClass().getClassLoader();
String path = "src/to/images/name.png";
URL url = CLDR.getResource(path);
// An icon
if (!(url == null)) {
icon = new ImageIcon(url);
}
// An image
try {
image = ImageIO.read(CLDR.getResource(path));
} catch (IOException e) {
// ExceptionHandling here
}
In Qt there is another approach:
The resources associated with an application are specified in a XML-based .qrc-file.
The specified paths are relative to the directory containing the .qrc-file (listed files must be located in the same directory or any sub-directory).
In the source-code the resources are accessible under the same name they have in the source tree, with a “:/” prefix.
Here an example:
<RCC>
<qresource prefix="/dir/subDir" lang="en">
<file alias="AliasName">subDir/FileName<file>
<qresource>
</RCC>
In your source code you can access FileName (if FileName e.g. is a QFile) via
QFile file(":/dir/subdir/AliasName");
after adding the following line to your .pro-file:
RESOURCES = yourRsrcFileName.qrc
The option lang=”langCode” (here: “en”) is for the localization:
If you want to add another language to your application you have to have the file “AliasName_langCode” in your source tree.
And, of course, you don’t have to write the ressource file on your own if you use the QtCreator, there is a nice GUI included.
C++: How to include the boost library in XCode projects
0. Download the boost-Library and unzip it anywhere (here: “/Developer/Tools/boost”)
1. Create a project.
2. Right-click at the project-name and select “Get Info”
3. Set the “Header Search Paths” to the Folder you unzipped the library (here: “/Developer/Tools/boost”)
4. Ready to boost.
About videos, music and more…
Thanks to Superlevel for the Idea!
Mac OS X – “Automator”: Combine PDF files
Today I had to find a program that combines/merges 2 or more PDF-files.
Because I didn’t want to use Adobe Acrobat (Pro?) I turned my internet search on and found an interesting program: The Mac OS X Automator.
Without reading any tutorial or something different (Automator is really self-explanatory, it’s like drag’n'drop everything!) I created a good-working “Automation”/Program that performs that task.
Here’s the workflow:
- Ask for finder-items
- Combine PDF pages
- Move Finder Items

- Update 11.10.2009 -
Created a sub-site named Automator-workflows at www.calltopower.de/automatorworkflows where you can see screenshots of the workflows and/or download the workflows and/or programs. I created among other things “Save Pictures from the current website”, “Take screenshot”, “Take image from webcam (iSight or other)”, “Pictures to PDF”, “Images to PDF”.




