Monthly Archives: February 2010

Lorem Ipsum Text via YQL

Still finding more reasons to play with and learn YQL, and following up from my experiment with random numbers, today I implemented YQL support for lipsum.com, a “Lorem Ipsum” text generator.

What is Lorem Ipsum text? The lipsum.com site explains:

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

I made a simple custom data table to access this service via YQL. To use these services, you’ll need to reference the custom table I created, then “select” some random text. The service can create text in a specified amount of either paragraphs, words, bytes, or lists. You can also control whether or not you want each string to start at “lorem ipsum…”, or to start randomly.

For example, to request 5 paragraphs (try it in YQL Console):

use "http://scooterlabs.com/yql/lorem.ipsum.xml";
select * from lorem.ipsum
where amount="5" and what="paras";

To request 20 lists (try it in YQL Console):

use "http://scooterlabs.com/yql/lorem.ipsum.xml";
select * from lorem.ipsum
where amount="20" and what="lists";

Random Numbers via YQL

I recently discovered a very cool random number generator site appropriately called Random.org. After poking around a bit at the various generators available on the site, I discovered they also have a simple “http service” and sample client apps which use it.

As a quick exercise, I made custom data tables to access these random number services via YQL, Yahoo’s “select * from internet” service. To use these services in YQL, you’ll need to include the custom tables I created, then “select” some random numbers.

For example, to request a few random numbers (try it in YQL Console):

use "http://scooterlabs.com/yql/random.integers.xml";
select * from random.integers
where num="10" and min="1" and max="1000";

To request a random sequence, where every number in the range is used once (try it in YQL Console):

use "http://scooterlabs.com/yql/random.sequences.xml";
select * from random.sequences
where min="10" and max="19";

To generate some random strings (try it in YQL Console):

use "http://scooterlabs.com/yql/random.strings.xml";
select * from random.strings
where num="10" and len="20";

For a full description of each service, and more optional parameters, refer to the Random.org HTTP interface description.

Update 2010-02-25: I heard back from the owner of the Random.org site who said he has been blocking all Yahoo! Pipes traffic. So, this YQL query may stop working at some point.