ISO 3166-1 to woeid - iso

Where do I find a list of all countries woeid from their ISO 3166-1 alpha2 or alpha3 codes?

Aral Balkan has something that you might enjoy
http://openCountryCodes.appspot.com/
it includes the ISO 3166-1-alpha-2 list in HTML, Python, JavaScript, ActionScript, Flex, JSON and XML
with this, just hook up to Yahoo API and do your magic

See the GeoPlanet user guide: http://developer.yahoo.com/geo/geoplanet/guide/
and http://developer.yahoo.com/geo/geoplanet/guide/api-reference.html#api-countries
You can get a list of countries using an URL like:
http://where.yahooapis.com/v1/countries?appid=[yourappidhere]

Related

Markdown to HTML conversion

I'm still in the middle of coding my final year project at university, and I have come across an issue where I need to either convert from HTML to Markdown or visa versa. Now I have no experience whatsoever of Perl, Python, etc. so I'm in need of an easy-to-implement solution, I only have about 6 weeks left to complete this now. I'm writing the data from a WMD text box to SQL Server, and I can either upload it as Markdown or HTML but if that data needs editing it cannot be in HTML as this would be too confusing for the end user who is perceived to have zero/very little computing "know how".
What should I do?
Karmastan's answer is probably the best here. Keeping the raw Markdown in the database is a really good solution as it allows users to upkeep the content in a form with which they're familiar.
However, if you have a bunch of HTML which is already converted, you might want to look at something like Markdownify: The HTML to Markdown converter for PHP.
Edit: based on what you've said below, there are a few things you should keep in mind:
Make sure that the following is set in wmd.js:
wmd_options = {"output": "Markdown"};
This ensures that you're storing Markdown in the database.
Source: How do you store the markdown using WMD in ASP.NET?
When outputting the Markdown to the web, you need to transform it to HTML. To do this, you'll need a library which does Markdown -> HTML conversion. Here are two examples:
Announcing Markdown.NET
Revisied Markdown.NET Library
I'm not a .NET developer, so I can't really help with how these libraries should be used, but hopefully the documentation will make that clear.
If you look at the web site for Markdown, you'll find a Perl script that converts Markdown-syntax documents to HTML. Keep Markdown text in your database and invoke the script whenever you need to display the text. No Perl knowledge required!

where can I find SVG or GeoJSON of countries that uses a 2 or 3 digit country code?

I was going to use the Polymaps.org library (combined with Protovis) to create a nice vector based world map. However, there example (http://polymaps.org/ex/world.html) uses a GeoJSON from Thematic Mapping, but the countries are coded by name instead of by their 2 digit country codes.
When I pair up my data, I have problems with things like "Russia" vs "Republic of Russia". Anybody know of a GeoJSON file for countries that uses the ISO 2 or 3 digit codes? It seems crazy to use the names.
Any other SVG type file would be useful too. I could create one, but I feel like it must exist out there and I just don't know how to find it.
Its not exactly what you want since its not in geoJSON format:
http://vis.stanford.edu/protovis/ex/countries.js
May be this is what you want ? World Countries Information and ip geocoding RESTful Web services API
Happy coding:-)

Translating string in Drupal

I've developed a site in english (admin & front end) but the site needs to be in a Dutch. Locale and i18n modules have been installed.
Dutch has been added to the list of languages and set as default in admin/settings/language.
I'm now wondering how I can translate strings like the date output? For ex, when I print out a date from a view, it still outputs the days and months in English.
In admin/settings/language/configure I've selected "path prefix only" but I don't get the language code in the url's and links. How is this achieved?
Thanks
You can translate month names, days and much more using Translation interface. Navigate to:
Administer -> Site Building -> Translate interface (admin/build/translate) -> Search (admin/build/translate/search)
and use the search form to locate the string you wish to translate.
Since you've already added Dutch to your site, you can download entire Dutch translation on http://localize.drupal.org. Site is currently in beta, so you will have to login using your Drupal.org credentials.
Use this link to export Dutch translation of Drupal. Just make sure you choose All in one file format so you can easily import it in your site using Translate interface -> Import
To get the language code in the URLs you will have to enable Multilingual support for each content type you need translated (admin/content/types) by opening edit and selecting desired option under Workflow settings -> Multilingual support.
After that make sure that you specify Dutch/English language while adding or editing nodes.

How to parse html in a client-side script?

What's the best way to create scripts for a browser?
I need to parse some html pages on different domains
I am on windows and use firefox most of all.
If it's just about retrieving the pages to do whatever you want with it, the built-in urllib module in python will do that for you.
It sounds like you want to retrieve webpages and parse them to extract meaningful data? I would suggest something like TagSoup (for Java) which fires off nice SAX events which you can use directly, or using an XML module of your choice (raw DOM, JDOM, dom4j, XOM, etc...). The TagSoup page also lists a number of references for other languages, suck as Beautiful Soup for Python, Rubyful Soup for Ruby and others.
From there, I would suggest using something like XPath to retrieve the bits of data that you want. Another option would be XSLT to transform the HTML into some unified format that you can more easily manipulate.
I'd recommend Synthetics Web. Here is a working example at jsFiddle.
jsFiddle
http://jsfiddle.net/dwayne05/YkLVw/
Synthetics Web
http://www.syntheticsweb.com/

How do I aggregate data off of a google search

I am trying to aggregate movie times off of google/movies search into a usable format such as json or xml
http://www.google.com/movies?q=movie+times&sc=1&mid=&hl=en&oi=showtimes&ct=change-location&near=new+york
The Google AJAX api does not seem to work for this as you cannot do a movie search.
Does anyone know how this can be done?
Lookup the technique called web scraping.
Basically, you have to fetch the results page using some server-side scripting, and then extract data from it, to present in a formated way (json, xml, etc). Regular expressions or a DOM/XML parser could help.
This guy has a PHP script that converts Google results to RSS.

Resources