Categories
Development

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.

1
select * from html where url="http://www.a_web_page.com" 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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$(function()
{
    $.ajax(
    {
        type: "GET",
        url: "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22http%3A%2F%2Fintraweb.stockton.edu%2Feyos%2Fpage.cfm%3FsiteID%3D221%26pageID%3D271%22%20and%0A%20%20%20%20%20%20xpath%3D'%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.

Categories
Adventure

Dustin and Ginny’s Wedding

Dustin and Ginny’s wedding was a fine time. The ceremony (I believe that’s what it’s called) was on the beach in OC. Parking turned out to be quite interesting, it was a Saturday in OC after all. Glad that I had left plenty early, I eventually did find a spot several blocks away.

Chairs were beginning to be laid out as I arrived. As one of the first to arrive, I found myself letting others know that yes, this was the location. Met some interesting folks for sure, all very polite.

The beach scene was nice and pretty quick. Before I knew it, all was done. It was interesting to watch folks dressed up walking on the sand. I didn’t get nearly as  much sand in my shoes as I though I would.

Things then moved to Greate Bay. I’ve been to a few weddings there over the years, so I had a good idea of what to expect. Immediately upon arriving I began to eat, and eat a lot. I was quite famished, plus it gave me an excuse to not have to initiate conversation with people I didn’t know.

A few people sang and play instruments. It was nice.

Jared, the best man was a nervous wreck with having to give his speech. There was no hiding it, you could smell the fear on him. As a long time friend I did my best to calm him down and let him know he’d be fine.

Despite my encouragement, when speech time came I was expecting bad news. He is not known for his public speaking skills, or any speaking skills for that matter. However, I must admit he got up there and spoke from the heart and seriously gave one of the best speeches I’d ever witnessed at a wedding. It was truly a clutch performance, right up there with the catch (from dodgeball). An amazing moment that I will surely never forget.

My amazing table was table 5, and it seemed like a collection of wedding misfits. I fit right in. They were great, very entertaining. They couldn’t believe my age which did bring a fine smile to my face. They were a lot of fun.

All in all it turned out to be quite a fun time, and they both seemed so very happy. Very glad to see that and I wish them nothing but the best.

Categories
Books

Finders Keepers

Finders KeepersI feel like I’ve been reading a bit more non-fiction recently, so I figured I had to go with a fiction book this time around. Noticed a new Stephen King book, Finders Keepers and gave it a shot.

It was pretty solid. Turned out it was a sequel (which I might have to check out the previous book now) and centered around a crime. I really liked how the book started in the past, then jumped around to the present to set the stage.

Towards the end I really did get into it a bit more and really plowed through the last part of the book, eager to see how things ended. Good stuff.

Overall I thought it was a pretty solid summer read.

Categories
Adventure

Seasick

For Dustin’s bachelor party we were going fishing on a boat. While I have gotten slight motion sickness on a boat before, it was never anything too serious. So I was hoping that going further out into the ocean to fish wouldn’t be so bad.

About 15-20 minute into the voyage I knew I was in trouble. Not only was a random kid on the boat just completely out of the blue staring and hugging me, but I knew I was going to be sick. Oh, and we had about 6 more hours to go.

I got so sick that all I could do was find a place to sit away from people and just weather the storm. I managed not to throw up into 2 hours in, but once I had to made sure to wrap my arms around a rail in case we hit a big wave and not fall overboard while vomiting off the side.

I’m not going to lie, it was a pretty horrible day. Knowing that you have absolutely nowhere to go to get away from the nausea, and even a best case scenario the ride back to shore would take an hour and a half if they called it a day early. Yuck, no fun at all.

I currently hate boats, fish, the ocean, fishing rods, bait, water, wind, waves, and all the people on the boat (even though it wasn’t their fault at all and they were a big help).

Categories
Sports

32 Kickball Runs

Though earlier in the day it was looking like it might be a rainy day, it turned out to be probably the nicest kickball weather we’ve had all year. A lovely day for some kickball against our opponent the Star Spangled Bangers. They are a very athletic team and though we’ve had some close battles they tend to take the majority of the victories.

Well today would turned out to be an explosive offensive performance right from the start and continued throughout the entire game. What really made the difference for us were the numerous 2 out kicks. There were so many times where what would have been a small inning for us turned into a big inning with us continually finding the defensive holes kicking with 2 outs.

The kickball gods were truly with us yesterday as we just continually dropped kicks exactly where they couldn’t be played. It was quite a nice feeling and great to see everyone have a great moment or two against a quality opponent.

All in all we would wind up scoring 32 impressive runs and had a lot of fun doing so. It was relentless, and we managed to score several in each inning. Quite a fun time and I’m glad everyone had fun.

Categories
Books

Reagan: The Life

Reagan: The LifeWhile I’m not too big into politics I did notice a new biography on Ronald Reagan, and he was the President during my younger childhood. While I remember jelly beans and the Soviet Union, I figured it’d be interesting to remember a bit more about that era.

While the early history of him before being President was very interesting and good to learn, I was most interested in reading about his Presidency. Those were the years that I recalled and reading up on so many of those events of the eighties really brought back other good memories too.

For instance the terrible Challenger explosion, the Star Wars missile defense systems, the “evil” Soviets, crushing Mondale, etc. All these really stood out to me during those formative years.

Though this was a very lengthy and quite heavy book, I did enjoy reading it a lot. Not only did I learn much more about the guy and gotten a better idea of what went on behind the scenes, it also brought back some good memories as well.