Monthly Archives: February 2012

Turn a $99 Nook into a Fully Fledged Android Tablet in Four Easy Steps [Video] (Lifehacker)

Posted by Alan Henry at Lifehacker

The Nook Simple Touch is great for reading ebooks. It’s got plenty of storage, it’s small enough to carry anywhere, can be used with one hand, can hold tons of books, its e-ink display is crisp and easy to read, and most importantly, it runs a skinned and customized version of Android behind Barnes and Noble’s interface. I got my hands on one a couple of weeks ago from a friend, and with about a half-hour, some basic tools, and a little patience, I turned my new Nook into a solid starter Android tablet with complete access to the Android Market, Google apps, your email, and the web. Here’s how. More »


jQuery Tip #5: Using jQuery’s end() Function to Work with Sets (Dan Wahlin’s WebLog)

Posted by dwahlin at Dan Wahlin’s WebLog

Previous Tips:

jQuery’s selector functionality makes it easy to add new nodes into the DOM without making a lot of calls to document.createElement(). For example, the following code adds

and nodes into the DOM and appends them to a divContainer node:

$('
'
).appendTo('#divContainer');


The first part of the code (before appendTo()) creates an initial set and adds it to the stack. Once the set is on the stack you can go into it and use find() to grab specific nodes and then modify them as show next:

$('
'
) .find('span') .html(custName) //Update with some dynamic variable .appendTo('#divContainer');


Once find() is invoked you’re on the node so it will be appended to divContainer instead of the

that wraps when the call is appendTo() is made.

In cases where you need to dynamically generate DOM nodes, modify specific children as with the shown above, and then append the newly created set into a container, what do you do? Fortunately, jQuery provides an end() function that allows you to pop the current set off the stack and then move down to the next one. In the example above, calling end() immediately before appendTo() would cause the initial

that wraps to be appended to divContainer which would achieve the desired end result in this case. The following code shows an example of using find() and end().

$(document).ready(function () {     var custs = getCustomerData();      for (var i = 0; i < custs.length; i++) {         var cust = custs[i];         $('
'
) .find('span') //get to span .attr('title', cust.City) .data(cust) .html(cust.Name) .click(showCust) .end() //get back to span's parent div .appendTo('#divContainer'); } });


The code starts by creating the

and nodes which adds a new set onto the stack. It then moves to the using find() and modifies an attribute, the inner HTML, the data associated with the node, and attaches a click handler. Finally, it calls end() to move back to the wrapper
and then appends it to divContainer. What’s convenient about this type of code is that you can create a set of nodes, hook up some data to children in the set (via the data() function) and then append the parent of the initial set all in one step.

Live Example

If you’re interested in learning more about jQuery or JavaScript check out my jQuery Fundamentals or Structuring JavaScript Code courses from Pluralsight. We also offer onsite/online training options for companies as well at www.thewahlingroup.com.

Conclusion

While there are certainly other ways to accomplish this type of functionality, end() can be handy to know about when you need to chain several functions together and move around in the stack.

MADismissiveTextView (Cocoa Controls)

Posted by Cocoa Controls at Cocoa Controls
A drop in UITextView subclass that handles dismissing the keyboard with your finger, just like in the Messages.app.

image of this control

JBTabBarController (Cocoa Controls)

Posted by Cocoa Controls at Cocoa Controls
JBTabBarController aims to be a drop-in replacement of UITabBarController, but with the intention of letting developers easily customise its appearance. JBTabBar uses images for all UI elements except for the labels on TabBar items. This gives the Developer/Designer the freedom to customise the all aspects of the TabBar.

In particular, the selected and unselected images for each TabBar item can be specified and are full colour images not clipping masks.

The included example attempts to emulate the standard UITabBar design provided by Apple. The layer styles used to create the TabBar images in Photoshop are in the Extras folder.

The project uses ARC and targets iOS 4.0+ devices.

image of this control

Pegasus (Cocoa Controls)

Posted by Cocoa Controls at Cocoa Controls
A lightweight Objective-C framework for Cocoa Touch to create UIKit view hierarchies in XML.

image of this control

jQuery Tip #4 – Use the on() Function for Event Handling (Dan Wahlin’s WebLog)

Posted by dwahlin at Dan Wahlin's WebLog

Previous Tips:

jQuery provides several different functions that can be used to handle events. Choices include shortcut functions such as click() and hover(), the live() function, the delegate() function, and the bind() function. The live() and delegate() functions can be used to handle event bubbling scenarios such as rows in a table being clicked, while the shortcut functions act as wrappers around the bind() function.

jQuery 1.7+ includes a new function named on() that wraps the previous event handler functions into one convenient API that can be used to handle everything from simple events to more complex event bubbling scenarios. An example of using on() to handle a simple click event is show next.

 

$('#myButton').on('click', function () {     alert('Clicked the Button'); }); 


You can always use the shortcut click() function as well. I generally prefer the shortcut functions when handling single events since I can eliminate quotes from the code but that’s just my personal preference.

When handling multiple events on() is quite useful. You can use its mapping functionality as shown next to map events to callback functions:

 

$('#MyTable tr').on({     mouseenter: function () {         $(this).toggleClass('over');         //perform other functionality needed during mouseenter     },     mouseleave: function () {         $(this).toggleClass('over');         //perform other functionality needed during mouseleave     } });


The on() function can also be used in place of live() or delegate() to detect when a child of a given parent container has been clicked. For example, when a table has a large number of rows that need event handlers to detect when a user clicks them or hovers over them, the on() function can be used. Rather than attaching an event handler to 1000 rows, on() can be used to attach a single event handler (or map event handlers) that handles row events to the containing table’s tbody element. An example of using on() for this purpose is shown next:

 

$('#customerTable tbody').on('click', 'tr', function() {     alert('Clicked a Row'); }); 


This code will cause click events triggered within a table to bubble up to the containing tbody element which handles them. It’s very efficient to handle events this way because only 1 event handler is added yet 1000s of potential row events can be handled. Future rows that are dynamically added to the table are also handled automatically. If you’re wondering what happened to jQuery’s delegate() function (which does the same type of thing), it can still be used. However, on() is now the preferred event function to use with jQuery 1.7+. To remove one or more events associated with a DOM node you can use the off() function.

 

Live Example

If you’re interested in learning more about jQuery or JavaScript check out my jQuery Fundamentals or Structuring JavaScript Code courses from Pluralsight. We also offer onsite/online training options as well at www.thewahlingroup.com.

 

 

Conclusion

jQuery provides many different options for handling events including shortcut functions, live(), delegate(), bind(), and on(). Although they all get the job done, if you’re using jQuery 1.7 or higher it’s recommended that you use the new on() function for your event handling needs.

EEToolbarCenterButton (Cocoa Controls)

Posted by Cocoa Controls at Cocoa Controls
EEToolbarCenterButton is a component to add a featured button to the center of UIToolbar. It handles button alignment, and helps you use buttom images whose height is larger than UIToolbar height.

image of this control

MNMProgressBar (Cocoa Controls)

Posted by Cocoa Controls at Cocoa Controls
Custom progress bar view to show determinate and indeterminate progress.

image of this control

Set Your Smartphone and Tablet Wallpapers to These Imaginative and Gravity-Defying Photographs [Wallpaper Wednesday] (Lifehacker)

Posted by Adam Dachis at Lifehacker

Wallpaper Wednesday is generally a showcase of traditional desktop wallpapers, but today we’re giving the spotlight to both our mobile devices and a talented photographer named Cole Rise. Come take a look at his work, which sits in a place between reality and imagination, and makes for a wonderful view on your mobile device. More »


NRGridView (Cocoa Controls)

Posted by Cocoa Controls at Cocoa Controls
NRGridView is a grid-view UI component (built as a static library) which has been developed by Louka Desroziers, for Novedia Regions. How it works? Almost like UITableView works. You set a dataSource, and a delegate.. and you implement all @required methods. It also has a ‘layoutStyle’. It means you can use it as a vertical gridView, or horizontal grid-view!

image of this control

WP Like Button Plugin by Free WordPress Templates