Wednesday, 16 October 2013

Thanksgiving and Halloween

Finally some time to really get out into the community. What a great time to be had with the River City Zombie Committee (RCZC) on the Oct 4 event, Undead 80's. One video complete (despite camera issues destroying over 1/2 of our footage) and a website up with Zombie photos.

Not bad for failing equipment, letting the fairly new video editor play, and one developing photographer out for a day of fun to get used to the Olympus. Next time we'll catch the Rigor Productions Zombies dancing and have some more fun editing the photos.

Thanks to the desire for blood splatter, I also was able to play more with fluid in Blender. BTW: F12 would rock if it would give me the same quality photo as rendering the whole file again. Cameras also need to be easier to adjust. There should be a camera view so I can click and drag to what I want to see.

Also, this week was about the office dog. For those who are using digestive enzymes for their pets or livestock, stop paying the vet price. Pancrease-V powder, what a nightmare. Our supplier has been sporadic about having it in and has sold away bottles we requested just before we drove over. This last time the clinic even demanded a vet appointment (as if the powder wasn't expensive enough). So, no more. Digestive enzymes are available without prescription and from now on, that's what I'm doing with the help of my friends at Nutriteck. They stock all kinds of digestive enzymes, supplements, and animal care products. You don't have to go to the wholesaler to obtain digestive enzymes without prescription, but the price is worth it.

That reminds me, thinking about sales. For some odd reason there have been over 10 discussions with random people in my life about value-adds this week. What is a value-add and what is a value-fail. For example, an Internet company decides they want to add anti-virus to their list of products. However, they add anti-virus that accidentally deletes primary system files (just once, but still), doesn't protect the computer as it boots (causing many clients to discover that viruses are still working their way onto their computers), and randomly turns off according to the Windows system log. Why do they go ahead and keep offering the product?

For advertising there seems to be a lot of push to get the word out - negative or positive. However, the people making real sales urgh against cold calls, products released to early, poor sales tactics, etc due to the long-term loss of sales. I think with a balance of getting the word out where people will look for it (e.g., Google maps, positive reviews, work showcases, etc) and ensuring that the vision shown is of why the business you do rocks any business can be successful.

Blender OMG

It is rare that technology has me wishing to be a much earlier adopter. Blender has me wishing I was into animation as far back as GIF animation. Oddly, it isn't the hard things in blender that are hard, it is the simple things.  For example, to make animated water is really easy. Click the fluid tab, choose the limits of your animation (bounding box, obstacles), and select your fluid options which are extremely nicely laid out.

However, moving about the screen and putting things together - that takes days. I've never been so frustrated with what should be simple mouse and keyboard controls. Oh, and it isn't just keyboard controls. You have to know which section of the program you are in since keyboard controls are re-used or moved around. There's a terrific video about what needs to be fixed, I couldn't state it better. Intuitive design is a must. http://www.youtube.com/watch?annotation_id=annotation_2735267151&feature=iv&src_vid=yIedljapuz0&v=xYiiD-p2q80

That being said, I made my first model, had my modelling friend remake it a million times better in 1/10th of the time, then made my second model, etc. Will I become a professional modeller? To be honest, I like the creativity. However, the tool is outrageously complex.  I feel like I'm back moo programming but with a much more verbose and abstract language. Oddly, I'm not programming at all, just moving about.

Did I make all of the newbie mistakes? Most likely, check out http://www.youtube.com/watch?v=WjMaAw2BjFE. However, you have to make the mistakes to get some idea of the flow of things. There is a flow, it's just really hard to understand at first.  The basic flow goes think about what parts need to be together or separate, then carefully build those parts (organic modellers beware, if you're animating later organic modelling is bizarrely weird to break apart - I made a part of my first model organic, really bad idea and cost me hours of keyboard control nightmares). Modify until it looks good, but don't apply - or at least try not to. Texturize. Include all of your textures and test that they are included. Then do advanced stuff like animation. Seems simple, but since the newb doesn't know how to animate yet - it is rather difficult to guess how to properly separate your pieces - oh and all of the videos seem to tell you to apply your modifications - Yikes! So many more issues arise. Don't apply until you absolutely must. Blender will let you see your unapplied mods for a reason.

However, for all those attempting to learn, despite the fact that he uses Maya controls - which actually locks you out of some features so you'll have to keep switching keyboard controls, I highly recommend
cannedmushrooms - http://www.youtube.com/user/cannedmushrooms

My second and third choices let me down a great deal. They kept skipping key presses/clicks or assuming knowledge that took me hours to gain.  However, once you have some background knowledge, the advanced courses by blenderguru (http://www.blenderguru.com/page/3/) are awesome.

For those looking for something quick to feel like they've accomplished something, check out this fluid tutorial http://www.youtube.com/watch?v=dgdGV0yaoM4 by Special Features.

Off to the next project at the moment, though. So, I'm going to leave the rest of my learnings from Blender far behind me and remember that next time I try, make the house first (cannedmushrooms way of teaching you basic navigation), make the cone second (box modelling in a nutshell), then worry about what I'm trying to accomplish third.

For those looking for a blender modeller, I'll put you in contact with my tutor, Bleu is available. Just ask me about modelling and I'll send you on over to him. He's the one that did all of the work I was attempting to accomplish in 1/10th of the time.

Zen Cart, PHP, HTML, CSS, and Javascript, and you

This is an old post, moved to keep my stuff in one blog.

If you don't want to set up your own carts, then give GEE Video Production a call and we'll get you a site. The reason for going with ZenCart in the first place what they call EZ pages and Define Pages. Its like having a Word Press (or if you're really new to content editors, like having a word processor such as Microsoft Word) editor for your entire store - sounds nice, right? It's even better than that! Way less bulky, fast results, and totally customizable without a million plugins.

I've been training someone in using ZenCart. I love the software, the customizability, and the speed at which I can accomplish a reasonable website with shopping card.

The issue is that I know HTML, CSS, and only had to pick up some PHP to accomplish a site. My very bright friend, however, had to pick it all up. This is his first website and his creativity drove some awesome modifications. It was totally worth having someone on board who didn't know any limits or just want to get things done quickly. I don't think he gets how important that is sometimes.

However, I think the rest of the world might be able to use Zen Cart way faster if there was a quick outline about what to look for on the web. So, here's my outline.

HTML Very Basic

First, the basics.  HTML. What is it and how to get it done.

To use the CSS Zen Cart offers you really should follow your best standards... ZenCart is HTML transitional, most likely in case you mess up, I found very few Zen Cart issues with going HTML 4 at least. What does that mean?

Well, I can't explain it all quickly, but here are the basics of an HTML page.
Tags and elements define things... The first tag/element you come across actually breaks the rules most of the rest of the tags, it doesn't end. The tag defines what kind of page it is. Most people just copy this and put it in:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

What does it mean in layman's terms? That I can use some old and some new tags and browsers won't try to die if the structure is a bit broken. What does mean in programming terms? Well, that's quite a read and shouldn't be attempted until I finish explaining a basic page. However, here's the link... for later:
  http://www.w3.org/TR/xhtml1

Normal HTML tags have a beginning and an end. These include the outside tags. So, the minimum  to make a webpage is to tell the browser we are using HTML.
<html>
</html>
The html tag (element) is the first time you run into properly formed element with attributes. The basics of attributes are that they occur after whitespace and after the main tag declaration (html, in this case). The first attribute here is xmlns. xmlns tells us something about the html tag. In this case, the immediately following quoted text is telling the browser where to look up any needed interpretations of the elements we are about to use. dir is the second attribute, and the assigned value (the stuff in the quotes) tells us we are in a language that reads 'ltr' or left-to-right. lang is the third properly and tells us to use english (default is US).

Remember every tag that start has to end. To end html we can either:

  • <html></html>  start and end the HTML node separately OR
  • <html/> end and start with the same tag (OK, don't do this.... there are some browsers that have their own rules, but let us assume that basic W3C rules actually work)
So the actual minimum for a properly formed page is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"/>
OK, now if you're loony and want some punishment you can go read the standard.  

HTML Almost Useful

Beyond the end of the previous section, I will skip explaining most attributes, you can look them up later, when you need to use them. from:
http://www.w3schools.com/html/html_attributes.asp
To make a page that actually does something you need to fill some areas in.

<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
</head>
<body>
</body>
</html>

Head holds the header and some programming code, everything you want search engines to look at want the browser to pre-load. It has a few more of those weird tags that don't really end.
e.g., <meta name="keywords" content="webpage, basic, empty">

Meta areas contain data that are typically used by search engines. Other exceptions are link and base areas, they tell the browser where to look for the webpage content on the Internet.

Body holds all of the basic HTML tags, and some inline code from other languages... Just think of it as what the browser will actually show to the person visiting your page.

HTML Useful with Javascript

HTML is meant for structure. People mistaken structure for layout, this isn't quite true. Once things are in HTML you can move them on the page using CSS.  Just keep this in mind, HTML tells you what things belong with what other things while CSS tells you how to make it look. There are defaults in CSS, or else the Internet wouldn't work... or more properly, just structure will give you a good looking page.

This is about where I throw my student into the deep end... The HTML tag has to contain all of the data you need for the page... So, a fairly well thought out page might look like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">

<head>
<title>Show This on the Top Browser Bar</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="webpage, basic, empty">
<meta name="description" content="How to make a basic and well thought out page">
<meta name="robots" content="noindex, nofollow">
<link rel="stylesheet" type="text/css" href="./stylesheet.css">
<link rel="stylesheet" type="text/css" href="./stylesheet_css_buttons.css">
<link rel="stylesheet" type="text/css" media="print" href="./print_stylesheet.css">
<script id="twitter-wjs" src="http://platform.twitter.com/widgets.js"></script><script type="text/javascript" src="./jscript_tabbedhighlight.js"></script>
</head>
<body id="contactusBody" onload=" if (document.contact_us){ if (document.contact_us.contactname) {document.contact_us.contactname.focus()} };" data-twttr-rendered="true">
<div id="mainWrapper">
<p>Show your business in action</p>
<script language="javascript">setPage()</script> 
</div>
<script id="hiddenlpsubmitdiv" style="display: none;"></script><script>try{for(var lastpass_iter=0; lastpass_iter < document.forms.length; lastpass_iter++){ var lastpass_f = document.forms[lastpass_iter]; if(typeof(lastpass_f.lpsubmitorig2)=="undefined"){ lastpass_f.lpsubmitorig2 = lastpass_f.submit; lastpass_f.submit = function(){ var form=this; var customEvent = document.createEvent("Event"); customEvent.initEvent("lpCustomEvent", true, true); var d = document.getElementById("hiddenlpsubmitdiv"); for(var i = 0; i < document.forms.length; i++){ if(document.forms[i]==form){ d.innerText=i; } } d.dispatchEvent(customEvent); form.lpsubmitorig2(); } } }}catch(e){}</script>
</body>
</html>

The above includes two javascripts.  The basics of Javascript are that you have a loading area for the script. You can include outside files like:
<script type="text/javascript" src="./jscript_tabbedhighlight.js"></script>
or you can put code into the page to pre-load it, but that gets ugly, so lets not.

To run the script you do something like:
<script language="javascript">setPage()</script> 
You can read more about javascript in webpages at:
http://www.w3schools.com/js/
The same basic principles are followed for CGI and some other included languages. The embedding outside code becomes quite handy when we look at other helpers like Flash and QuickTime:
http://www.w3schools.com/html/html_object.asp

CSS

CSS makes things pretty. The layout can change (the look and feel of any element on the page) per element, per attribute, and/or per structure. In my opinion good CSS uses mostly structure with attributes to help locate pieces of structure. The CSS file is an included external file... OK, there is such a thing as inline CSS. Let us ignore that for the moment, please. If you're interested check out.
http://www.w3schools.com/css/css_syntax.asp
In our example, there are four places in the head that included css:
<link rel="stylesheet" type="text/css" href="./stylesheet.css">
<link rel="stylesheet" type="text/css" href="./stylesheet_css_buttons.css">
<link rel="stylesheet" type="text/css" media="print" href="./print_stylesheet.css">
Based upon the href you can see that their is a main stylesheet, one for buttons, and one for print. CSS is cascading. So, items in ./stylesheet.css can be overridden by items in ./stylesheet_css_buttons.css. CSS is also dependant on the media. This means that, even though the ./print_stylesheet.css follows the previous two it does not override them. However, two print medias in a row would allow for possible overrides.
<link rel="stylesheet" type="text/css" media="print" href="./print_stylesheet.css">
<link rel="stylesheet" type="text/css" media="print" href="./print_stylesheet2.css">
CSS cares what you defined, exactly. In the print example, all of the items in  ./print_stylesheet.css will continue to affect the layout of the page when the page is printed unless ./print_stylesheet2.css has an overriding definition.

CSS has rules, but some are broken by specific web browsers. In general CSS looks like
element {
   what to change: what you want to change;
}

To understand CSS structure, it is best to play.  However, the basics are that CSS cares about what type of attribute you are referencing and is hierarchical.

Here's an element with three four ways to address it:
<div id="contactUsNoticeContent" class="content"/>
Address by class with:
.content {}
Address by element name with
div
Address by id with:
#contactUsNoticeContent
If you add some structure you add more ways to address the element.
<div class="testclass">
  <ul>
     <li>
  </ul>
</div>
Now I can address all list items within the testclass with:
.testclass li
Check out more on this at:
http://www.w3schools.com/cssref/css_selectors.asp
In some cases weird element definitions work, these often break the standard. They are poor form, but often necessary to make sure all of the browsers look the same. Here is a great example, thanks to Microsoft, for creating some weirdness like filter:
http://reference.sitepoint.com/css/filter
What does this look like in an actual CSS file? I chopped a small section of a CSS file out so that you can see:

/**
 * Main CSS Stylesheet
 *
 */
body {
margin: 0;
font-family: Gill Sans, Lucida Sans Unicode, Lucida Grande, Tahoma, sans-serif;
font-size: 62.5%;
color: #000000;
background-color: #e5edf5;
}
a img {border: none; }
a:link, #navEZPagesTOC ul li a {
color: #3300FF;
text-decoration: none;
}
TEXTAREA {
margin: auto;
display: block;
width: 95%;
}
input:focus, select:focus, textarea:focus {
background: #E4FEF5;
}

PHP

OK, onto PHP, the basic programming language for Zen Cart. It wraps around everything I've previously shown you... And goes right in the middle. In general PHP is used to write out everything in an HTML page and provide the ability to make choices based on outside factors. Where Javascript runs on the client's computer, PHP runs on the server. It is fast, fairly flexible, and quite easy to pick up if you know at least the basics of object oriented programming.

Any attribute on a page and any variable, global variable, or if statement can make a choice. This isn't meant to teach you PHP, this is meant to get you past being able to read the basics. w3schools can help out, but I found that Zen Cart's sites were better once you get past the basics. To be honest, use Google to search zen cart's site.. Their search isn't that great, but  here are the links to w3schools and Zen Cart anyway:
http://www.w3schools.com/php/
http://www.zen-cart.com/content.php?2-FAQs-and-Tutorials
To start the PHP in each php file in Zen Cart you'll see:
<?php
To 'end' PHP you'll see
?>
However, if the PHP includes a curly bracket, it will keep including the results of the following statements until the end of the bracket
 <?php if something {?>
    <html><body><p><?php $content = "the text to write out"; echo $content; ?></p></body></html>
<?php } ?>


A really nice way of writing HTML that is easy to follow is found in some files, but not most.  For the most part HTML and PHP are interspersed. The nice way is to keep adding to the string (in this case $content) based on some decisions, then output all of the string in one go (echo $content).
<?php
/**
 * Side Box Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_ezpages.php 2982 2006-02-07 07:56:41Z birdbrain $
 */
  $content = "";
  $content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
  $content  .= "\n" . '<ul style="margin: 0; padding: 0; list-style-type: none;">' . "\n";
  for ($i=1, $n=sizeof($var_linksList); $i<=$n; $i++) {
    $content .= '<li><a href="' . $var_linksList[$i]['link'] . '">' . $var_linksList[$i]['name'] . '</a></li>' . "\n" ;
  } // end FOR loop
  $content  .= '</ul>' . "\n";
  $content .= '</div>';
echo $content;

The confusing way (and to be honest, the way most of the files are written) is to intersperse the two languages and decision trees. I'll only give a partial example:
<?php
/**
* Common Template - tpl_main_page.php...
if (in_array($current_page_base,explode(",",'list_pages_to_skip_all_right_sideboxes_on_here,separated_by_commas,and_no_spaces')) ) {
    $flag_disable_right = true;
  }
  $header_template = 'tpl_header.php';
  $footer_template = 'tpl_footer.php';
  $left_column_file = 'column_left.php';
  $right_column_file = 'column_right.php';
  $body_id = ($this_is_home_page) ? 'indexHome' : str_replace('_', '', $_GET['main_page']);
?>
<body id="<?php echo $body_id . 'Body'; ?>"<?php if($zv_onload !='') echo ' onload="'.$zv_onload.'"'; ?>>
<?php
  if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
    if ($banner->RecordCount() > 0) {
?>
    <div id="bannerOne" class="banners">
     <?php echo zen_display_banner('static', $banner); ?>
    </div>
<?php
    }
  }
?>
Things in all caps like SHOW_BANNERS_GROUP_SET1 were written as global variables somewhere else. You don't have to do the normal $Global to address them. You just write them in all caps where they are.

Notice that here the php command ends, but the bracket hasn't ended:
if ($banner->RecordCount() > 0) {
?>
<div id="bannerOne" class="banners">
That means that everything to the end of that set of brackets will be part of the decisions and output processed for the if statement. Brackets can  be nested, and are in the example... and no, I didn't include all of the ends of brackets.

Notice that it is good practice to copy out any variables you need into something that doesn't conflict before using them:
$header_template = 'tpl_header.php';
$footer_template = 'tpl_footer.php';
$left_column_file = 'column_left.php';
$right_column_file = 'column_right.php';
This doesn't always happen in the files, so watch out as you can change a variable or constant to something and affect more than that page.

All right, well, that's the basics. Good luck from there. At least you can find the start and end of things and avoid the conflicts. The rest is up to you to learn, remember Zen Cart has tons of online help and support. Use it.

Intro Who am I and Make Google API Calls in Ruby 2.0.0

This month has been a time of bizarre growth so, it is time to start writing.
Forgive me for the ramblings. This blog post is meant to share in some ways, but mostly, to force me to start blogging. I promise the next one will show more organization and full working bits of code. This is my 'get yourself out there' article. You know, like the first time you were ever interviewed and the interviewer asks you a question you don't know so you look around for someone that does know the answer - we've all seen the kids do it.
First a thanks to a huge community on the Internet, developing with limited feedback and no direction is incredibly easy. Second, I'm not quite all alone. However, going from working with a huge team to a smaller one at Castle Rock and now in a team of four has been a great experience. Don't start here, really, go for the larger team first!
This month has been about programming, marketing, and wonderfully crazy friends.
Programming - Why would a CSO with no formal programming background want to program?  Reason: Marketing.

Marketing - Makes or breaks a business, we have to do it, and, to be honest, that's what I've been doing since starting at GEE. It just looks like development, when the reality is webpages, demo products, and inventive ways to market are all marketing. Oh - and sorry to say it world, but so is blogging. Does that mean I won't contribute to the world? Absolutely not, marketing is awfully soul destructive if it doesn't build the community around you.

Wonderfully Crazy Friends - if you don't have some, get some. I'm usually the supportive quiet type, until something needs to get done. Then, I turn into the business 'get it done' male mindset (Yes, I know I'm a woman - I hate to say it, but women have terrible ways of motivating people, if we want to motivate the world around us, we really have to tap into our inner male mindset).

Background - My (recent) background in programming is to be one of those crazy quality leads that knew nothing and was the best suited for the job. I learned a lot and all with a focus on the customer, which is perfect, because that is what business is about. While doing that I became a programmer, sort of. Had to release members of my team because I could program faster, more accurately, and with better results than the guys with the degrees... However, that doesn't mean that my team just wasn't qualified. Still wouldn't call myself a programmer as such, more of a manager that could pull off more focused results than the programmers.

Ruby/Marketing

If you need to learn Ruby check out _why. This author's style is beyond weird, however, my psychology background points out that it is extremely sound. Learn a bit, distract a bit, learn some more, and your subconscious and conscious minds will ensure that it all comes together quickly.
  Read his stuff at: http://mislav.uniqpath.com/poignant-guide/book/
  Who the hell is he at: http://en.wikipedia.org/wiki/Why_the_lucky_stiff
     and http://venturebeat.com/2013/04/19/why-oh-why/
  Is he going to come back? I hope so, but his website is back to being blank. At least we know he existed for a moment. I really hope he didn't sell out to Microsoft or pass away - but then, who else was showing him kindness and humanity... Kind of wouldn't blame him.
Was that marketing? Well, sort of.. Except Why's books are free and that is information sharing. Oh, yah, information sharing - that is what I was up to.

Concept

The concept? I'm out and about, have my phone/computer/whatever with me and it knows where I am. I don't know what businesses are around, so I ask Google. Right now Google tells me a bit about what's around me, but I wanted Google to tell me more. What businesses are within a short walk, what are their websites, phone numbers, and a short description? Can I, without walking, see their storefront and check out the inside of the business? I didn't get all of my answers, but as close as I can get without either paying for more API access or talking to a Google dev team rep. I might pay if the primary idea was that I was at home, my executive friend calls me, and I tell him about his area... Hrm. Anyway, I know it is an odd idea for people to want to know what is around them, however, I do.

Google and their API for places

The logic. You would think this would be truly easy. Google has an option for things close to you in their API, the issue is that the results are so limited in number, you might as well not get them.
*[] - indicates you need to fill this in. Use https://developers.google.com/places/documentation/search to help.

Google Places

Although it sounds wonderful, I found that the most useless results come from Google Places. The limit on results is incredibly low. So low that when I chose a mall as my testing point I could see more businesses with my eyes than they returned. However, it is a good way to start using the API as the cost is only 1 point to use it. So, I used it to start learning.
https://maps.googleapis.com/maps/api/place/nearbysearch/xml?key=[add your own key]&location=[lat and long in format 43.680934,-79.429741]&radius=10&sensor=false
*Note &types=food is a useful thing to add in.

Google Radar

First find where you are, use your cell phone coordinates or Google map or something. Here's a simple tool that will <a href="http://itouchmap.com/latlong.html">return your latitude and longitude</a>. Or you can just use the Google Reference number from the results of a search from the address or business.
Second, use Google Radar with a reference key or the latitude and longitude:
https://maps.googleapis.com/maps/api/place/radarsearch/json?key=[add your own key here]&sensor=false&location=53.541195,-113.490331&radius=1700
*Note if you're looking for food or something specific add on types &types=food|store|gym|doctor|dentist
**Keep results under 200, it will return a pretty random set of businesses within your radius.
***The results are cryptic. Keep the reference numbers and move on.

Google Place Details

This tool actually results in the details for the referenced location. This is the data I want, but notice that I have to do the search 200 times. Total daily search cost for one location works out to something like 205 API calls to receive what I want. Notice that I turned extensions on even though they are useless without paying Google. Still, I'll take whatever they will give me for free.
https://maps.googleapis.com/maps/api/place/details/xml?key=[add your own key]&sensor=false&extensions&reference=CnRnAAAABkIiDvc2RPQknkaJJclZfOmDfa9oRAavfKUoNlvYwtpakL2apCH29lc4M9IE8p9AX3VU1Ssn0QBPyvfBiCga3dFwi8HyMmGrgmmh93Zwc6Z2iWV3lUFLTsXLrgKPEjAGtzDObpKc56WBEN1NIhuTthIQeJDCi-f7W7LjZ9w_eHfGsBoU-_okOBQBpGWD1J66UJuLD6XXYmA

Resources

             The Internet - which, to be fair, is a good enough resource for any programmer
             The Über Geek that works with me... Except he has his own projects, still he's a good cheering section and he really has been one of the best people to work with. Just look up for long enough and he'll notice and find some way to elicit a smile. Although crass at times, Über Geek, you're the best cheering section ever - except my husband. Something about Shakespearean swears and odd rants keeps me with my man.

Toolchains, Google, and XML versus JSON results

A brief comment is required here. You can get the results above really easily. However, the future demands faster, smaller, and friendlier applications. I was hoping to use JSON. In the end, I abandoned it and my reasons follow.

Desired Chain

Java/Javascript with json results, perhaps some WebGL for fun, the Google API. Requirement jsonpath or xpath and Google API. Goal to appeal to both the "I love text info" and the "I love useful graphics" people.

Hurdles - JSON

OK, I like the concept of JSON. Beyond belief. I'm an executive and I was willing to spend a week trying to get a toolchain I liked working with it. That's a LOT of time for me and shows a bizarre level of commitment that my Über Geek pointed out to me is just ridiculous, give it up and move on. Let the Über Geeks sort it out later. Well, any json Über Geeks out there that will help me properly encode to the JSON RFC 4627 format are suddenly best friends. There's supposed to be a java file that does it. However, I couldn't find docs.
In the meantime, those unquoted bits kill the coolest and most widely adopted tools like json.parse and json.path. Although the browser itself and javascript basic still think they are JSON almost nothing else does and re-encoders are typically advanced regexp that have bug logs too long for me to consider. I'm not into the Google suggested search your way on down the lines of code thing. I want context without losing speed and quite frankly there is a reason bubble sort is still taught in programming and a reason for indexing. Results quickly please... Please? pretty please? No? OK, off to XML land, then. If I wanted to go line by line, I could get the same performance from perl, sed, aux, or grep with curl. Hashes and arrays are better, but still clunky and quite frankly, I don't have time for clunky. There are other options that are reasonable, I tried to get many of them working. All I can say is:
"Google, STOP BREAKING THE RULES and every developer's life will be so much sweeter. JSON will catch on as a faster, easier way than XML and all the XML fans will convert"
FYI: Whomever at Google thought it would be fun to return results without the quotes, since Google used to properly quote, you just made me despise you and your first born, but that's OK, it was only for a week, all is forgiven now.

Hurdles - Ruby

Really, ruby friends, you're dropping the ball on JSON, even in rails. And your included XML interpreter is still XML 1 and doesn't verify structures? Really? Come on. However, do I care that much? No, you had what I needed, just not what would have been cool. Thanks for reducing my workload and time spent based on limits of availability. However, I probably should have gone C#. I did try jsonpath in ruby and a few converters to see if I could get there. However, most converters convert the json into hash or array, so I was better off with XML. However, Ruby, love you to program in, I'm a fan of _why and so many other Ruby thinkers. However, wake up and take some of the JSON Kool-Aid and tons of the XML Kool-Aid.
Ruby 2.0.0 with 64 bit is where I headed. Should have stopped and thought about that. However, I have this brand new machine and wanted the latest. Suggestion to the next person, stick with 32, stay with older versions that still have SSL keys built in. However, keys were pretty easy to overcome. So, I'm not going to gripe that badly. Curl even makes it easy for every developer over at http://curl.haxx.se. Oh, and to all of you goofballs turning off SSL and calling that a fix, erm? Come on, really? Wow!

The Code Snippets that Make it Possible

#Set your requires. For my full project I needed:
require 'rubygems'
require 'openssl'
require 'net/https'
require 'rspec'
require 'rexml/document'

#Grab the SSL file
#Replace [FILE PATH] below with your own path.
Net::HTTP.start("curl.haxx.se") do |http|
  resp = http.get("/ca/cacert.pem")
  if resp.code == "200"
    open($cacert_file, "wb") { |file| file.write(resp.body) }
    puts "\n\nA bundle of certificate authorities has been installed to"
    puts "[FILE PATH]\n"
    puts "* Please set SSL_CERT_FILE in your current command prompt session with:"
    puts "     set SSL_CERT_FILE=[FILE PATH] + cacert.pem"
    puts "* To make this a permanent setting, add it to Environment Variables"
    puts "  under Control Panel -> Advanced -> Environment Variables"
    #or uncomment this line and set to the correct directory:
    #ENV['SSL_CERT_FILE'] = [FILE PATH] + "cacert.pem"
  else
    abort "\n\n>>>> A cacert.pem bundle could not be downloaded."
  end
end

#Parse your URI
$uri = URI.parse(your_html_api_call)

#Use a bit of code to make sure you actually obtain a result instead of a redirect
#by setting the limit to 1.
#You can use the same code to help out in finding redirects and still obtaining results
#if you need it, just raise the limit.

def fetch_ssl_body(your_html_api_call, limit)
  raise ArgumentError, 'This application does not allow redirects' if limit == 0
  http = Net::HTTP.new($uri.host, $uri.port)
  http.use_ssl = true
  http.cert = OpenSSL::X509::Certificate.new(File.read $cacert_file)
  request = Net::HTTP::Get.new(uri_str)
  response = http.request(request)
  case response
   when Net::HTTPSuccess then
      response.body
   when Net::HTTPRedirection then
      location = response['location']
      newLocation = location.gsub(Regexp.new(Regexp.escape($uri.to_s)),'')
      warn "redirected to #{location}"
      fetch(newLocation, limit - 1)
   else
      response.body
  end
end

#**everything above here was available from a previously trusted Ruby programmer, most of it was found directly on the Ruby site.

#Build an XML tree for parsing

include REXML
doc = Document.new fetch_ssl(your_html_api_call,1) #This always looks like it errors, expect undocumented
#puts doc #use this to prove to yourself you have a document
#shove only the data you want into something references = Array.new XPath.each( doc, "//reference") {|a| references << a.text}

End Notes

True, I didn't give you the whole app here, but this is all the code you need to build it. You can make calls and Ruby's each function will give you nice easy ways to iterate.