Archive for the ‘Programming’ Category
Thursday, May 14th, 2009
A few days ago I got to the see the power of cloud computing up close and personal. Someone had a large amount of files already stored in Amazon S3 which needed to be combined with another large set of files. The problem was that my desktop could do it ...
Posted in Programming | No Comments »
Sunday, May 10th, 2009
PlayList.com is a website that allows anyone to put together a playlist of their music and then share it via their Facebook/Myspace/etc page via an embedded flash Playlist. A nifty hack allows you to play a PlayList.com as a podcast or even via a cell phone.
1. Transform PlayList.com's ASX playlist ...
Posted in Programming | No Comments »
Wednesday, May 6th, 2009
Here is a short script that can mass delete files in an Amazon S3 bucket. It is limited to a 1,000 keys at a time:
#!/usr/bin/perl
use Net::Amazon::S3;
my $s3 = Net::Amazon::S3->new(
{ aws_access_key_id => 'ACCESS_ID',
aws_secret_access_key => 'ACCESS_KEY',
retry => 1,
}
);
my $bucket = $s3->bucket("BUCKET") or die $s3->err . ": " . $s3->errstr;
my $response = $bucket->list ...
Posted in Programming | No Comments »
Monday, February 9th, 2009
(A followup on an earlier post)
Here is another way to cleanup bad HTML with Perl, and convert to XML:
use HTML::DOMbo;
use HTML::TreeBuilder;
use XML::LibXML;
$html_code = '';
// Parse HTML
my $builder = HTML::TreeBuilder->new();
$xml_source = $builder->parse($html_code);
// Convert to XML DOM
$xml_source1 = $xml_source->to_XML_DOM;
// Extract XML and encode UTF-8
$xml_source2 = (encode("utf-8", $xml_source1);
This approach relies on the HTML::DOMbo ...
Posted in Programming | No Comments »
Sunday, December 28th, 2008
During a recent project, I ran into an issue when handling Unicode data in metadata headers in Amazon S3. Apparently, Amazon adds on "?UTF-8?B?" in front of any Unicode data and "?=" in end of the data. I could not find any existing standard that describes this or why it ...
Posted in Programming | No Comments »
Monday, October 27th, 2008
Some quick notes on QuickBase and Unicode:
QuickBase stores Unicode data natively on the backend
Unicode encoding must be set as default in the browser
Any QuickBase functionality that relies on Javascript or AJAX support, DOES NOT work with Unicode
The last point is due to the two issues:
1. The bug with UTF-8 encoding ...
Posted in Programming | No Comments »
Sunday, October 26th, 2008
Quick way to fix the following error in Perl:
:1: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xA0 0x20 0xA0 0x3C
Use this command:
use Encode:
$string1 = decode("UTF-8", $input);
Posted in Programming | 2 Comments »
Friday, October 24th, 2008
Here is a short way to cleanup bad HTML input and convert to XML with Perl:
use HTML::TreeBuilder;
use XML::LibXML;
$html_code = '';
my $builder = HTML::TreeBuilder->new();
$xml_source = $builder->parse($html_code);
$xml_source->elementify();
$xml_source1 = $xml_source->as_XML();
my $parser = XML::LibXML->new();
$parser->recover(1);
my $doc = $parser->parse_string($xml_source1);
$xml_source2 = $doc->toString();
Posted in Programming | 2 Comments »
Monday, October 20th, 2008
While I was working recently on one of my projects, I noticed a curious problem. The server I was using was running out of memory while doing a simple XSLT transform. That was sort of strange because the XSLT transform in question was rather simple and the amount of memory ...
Posted in Programming | No Comments »
Monday, October 20th, 2008
During my investigations into Google Reader and iGoogle, I ran into an issue which has not been clearly addressed anywhere. The question is if a site provides a JSON feed without a callback function and you are using it on a different domain (meaning you cannot use XmlHttpRequest), can you ...
Posted in Programming | No Comments »