lame thoughts
HTML Table to JSON with YQL.

Sometimes I want to pull some data from another website that is in a table but they do not provide a way for me to get the data in some easily usable format. There are many things you can do to accomplish this. However sometimes you just want something quick and easy. You can use YQL to make a SQL type query against a URL and get back JSON or XML data.

Example

————

I wanted the information that was in the table on Sectional Raster Aeronautical Charts. It is just a table of VFR sectional charts. As you can see there is “Chart Name”, “Current Edition No. and Date”, “Next Edition No. and Date”, and inside of the table there is a link to download the charts.

To get this data into JSON just go to Yahoo! Query Language Console. Once there you just make a query. In order to get the correct table on the page I had to give the query some XPath Syntax and also the url to the page. Change the radio button to JSON and click Test to make sure you get what you want back. 

select * from html where xpath=”//table[@title=’Sectional Raster Aeronautical Charts’]” and url=”http://avn.faa.gov/index.asp xml=aeronav/applications/VFR/chartlist_sect”

After you are done testing and everything you will end up with a link at the bottom you can use. An example in php would be something like this. The goo.gl is just the url from the bottom of the console run though Google’s url shortener. Also for this to work with the below php example you have to uncheck the “Dianostics” box and also remove the callback function. If not it will give you a json parse error and php is not very helpful with json errors.

<?php

$data = json_decode(file_get_contents(“http://goo.gl/IQQ5c”), true);
foreach($decodedData[‘query’][‘results’][‘table’][‘tr’] as $chart) {
    echo “Chart Name: “.$chart[‘td’][0][‘p’].”\n”;
}
 ?>

This will print out.
Chart Name: Albuquerque
Chart Name: Anchorage
Chart Name: Atlanta
Chart Name: Bethel
Chart Name: Billings

Evernote Search Grammar.

Evernote like Google or other things with a search has quite a few modifiers or Search Grammar. All of these can be found in the Evernote API Overview. Below are some of the common ones I use for finding things and making Saved Searches. Also on windows you should turn on the “Show Search Explanation” under “View” or pressing Ctrl+F10. This will make it easier to see if your Search Grammar is doing what you want. 

notebook:”Example Notebook” searchterm1 searchterm2

    This will limit the search to the Example Notebook and notes that contain all of the searchterms.

All Example

notebook:”Example Notebook” any: searchterm1 searchterm2

    This will limit the search to the PHP Snippets notebook and notes that contain any of the searchterms.

Any Example

-searchterm

    This will return notes that do not contain the searchterm. I find this best you use wtih another searchterm something like inux -ubuntu so that i get all of the notes containing linux but none that contain ubuntu.

-seachterm example

tag:tag1

    This will return notes that are tagged with tag1.

-tag:tag1

    This will return notes that are not tagged with tag1.

tag:tag*

    This will return notes that have a tag that begins with “tag”. So any note that is tagged with tag1, tag2, tagexampleblah, etc.

Again you can combine all of these so that you could do something like tag:programming -tag:objective-C this would returned all of the notes tagged with programming and none of the ones tagged with objective-C.

tag: Example

You should now have a good understanding of how this works and how to combine things together to find exactly what your looking for. Below is a quick rundown of some of the rest of the terms and things you can use. Please refer to the Search Grammar section of the  Evernote API Overview for further explanation and examples.

created:

updated:

resource:

subjectDate:

latitude:

longitude:

author:

source:
—————————————

NOTE: I seem to have come across 2 bugs or at least 2 small annoying things.

COPY AND PASTE There is some type of bug when you copy and paste from tumblr that things that are quoted do not get parsed correctly. This is stange because if i copy and paste from the edit view it works just fine however when i copy and paste the below example from the preview it does not parse the quoted section correctly. I end up with it thinking the notebook name is just Example and not Example Notebook.

example - notebook:”Example Notebook” searchterm1 searchterm2

picture result -

Copy and Paste Bug

MAC BUG Make sure you have a space between the any: and the first searchterm. If you do any:searchterm1 without the space it will skip the first searchterm. I have submitted a bug report about this. This does not seem to be a problem on the windows client.

example - any:searchterm1 searchterm2

picture result -

any: Bug


SQ3R

SQ3R is a study/reading comprehension/learning system. It stands for Survey, Question, Read, Recite, Review.

A simple overview would be.

Survey — Read the titles, headings, summaries, and conclusions. Also probably a good time to start making a Mind map to help better visualize the overview.

Question — Form questions from what you have surveyed. Easy way is to just turn the headings and titles into questions.

Read — Slow down on hard to understand parts even reread if necessary. Make sure you answer your questions as you go. Note any bold, italicized, underlined words or phrases. Read only a section at a time before reciting.

Recite — Summarize in your own words, take notes, highlight, etc. Do this with as many ways as possible (seeing, saying, hearing, writing).

Review — Go over your main points for each section as you go along with the questions you made. Make new questions from the notes you have taken. Make flash cards and use them. Make mnemonic devices for stuff that has to be memorized. Anything else that is helpful to you. Remember to use as many senses as possible and alternate them.

Everyday applications, websites, and items.

Evernote - Note taking application. I use this to capture, access, and share information.

Dropbox -  Syncing and sharing files.

Safari Books Online - A very nice resource of technical books, if you don’t mind reading them online. Also check out Google books.

LastPass - Password manager.

github - Social Coding. New hotness for code hosting and nice place to find stuff to play with. Also check out SourceForge.

Stack Exchange - All of there assorted sites.

Skype - IM and phone calls. I don’t like the memory usage on this but i use it for POTS calls because my cell service is horrible.

StumbleUpon - Sharing links with friends and wasting time.

Slashdot - News for nerds, stuff that matters. Still awesome and good for wasting time.

freshmeat - New software releases mostly OSS but still run across neat stuff.

Pilot G2 - Nice cheap pen.

Moleskine Plain Pocket Notebook - Expensive for a notebook but still the best one i have tried so far.

BiC Maxi Lighter - Fire good. Pay the extra $1 for the BiC.

USB Thumb Drive - Useful for whatever. 16GB so it will hold any DVD ISO i want to use to install from.

P-38 Can Opener - One of the smallest but most useful items ever.

Petzl TACTIKKA XP - Headlamp.

Maui Jim Paradise Sunglasses - Lightweight polarized sunglasses.