Append DOM to Another Page Using YQL

Apparently there is a data limit to how much we can fit into a content field on our CMS at work. The problem was that there is an incredibly long list of donors names, and when saving the edits to a page in the CMS, it just wouldn’t save past a certain point in the list.

So, I was a bit stumped on how best to workaround. So, I created another page with a good amount of the names in an unordered list. I then used YQL to create a REST query that would output only the HTML on the page that I wanted into and XML feed.

select * from html where url="" and xpath='//*[@id="main"]/ul/li'

I’m not too sharp on my xpath selectors, but luckily it’s very easy to find an xpath using Chrome. Just right click on an element in the inspector, and the option is there. Huge timesaver!

Ok, now I had a REST query courtesy of YQL of the HTML elements that I wanted to take from that page.

Next was to load and append the data from the REST query onto the unordered list on the other page.

        type: "GET",
        url: "*'%2F%2F*%5B%40id%3D%22main%22%5D%2Ful%2Fli'&diagnostics=true",
        dataType: "text",
        cache: false,
        success: function(xml)
            $(xml).find('li').each(function() { 
    			$("#main ul.append-list").append($(this));

Using the jQuery library I was able to load view the ajax function the REST query. I had to choose the dataType of text not xml in this case. That way I was simply appending the results as they were in the REST query.

I can clean up the javascript a bit, and will work on that. However for now, I am able to add data from another page to work around the data limits of the CMS.


Developing Hybrid Applications for the iPhone

Developing Hybrid Applications for the iPhonePicked up a copy of Developing Hybrid Applications for the IPhone by Lee S. Barney earlier this week. Had a 33% off coupon at Borders and was itching for something new to read.

Been messing with iPhone development for a bit and since I’m a web developer figured I’d take a hard look at writing web applications for the iPhone vs going the SDK Objective-C route.

I’m really glad I picked this book up. They do an excellent job of reminding me how cool Dashcode is for developing web applications for the iPhone. My only knock on Dashcode in the past was the lack of documentation, but this book does a decent job of covering it. Still wish there was more documentation on Dashcode if anyone is reading this.

The book covers both using the QuickConnect and PhoneGap frameworks for developing hybrid iPhone apps. It’s a fairly easy read and they do cover most of the iPhone functionality that would be used in the majority of projects. While the SDK and Objective-C are still the best way to go, sometimes web applications or hybrid applications do make sense, and that’s where this book was very handy. Just for me to rediscover Dashcode alone justified the purchase.