Many languages these days are fairly Lispy, except for being homoiconic and thus having a full-strength macro system instead of C's token pasting or many other languages' nothing.
But which ones are absolutely vital to learn, and which ones are "just different languages"?
Wednesday, November 16, 2011
Tuesday, November 15, 2011
Private Streaming with CloudFront: A Guide
Update, 1 Oct 2012: This post is largely obsolete, as Amazon recently added private streaming support to the CloudFront section of the AWS Console. The original post follows.
I'll just assume you're aware of the IaaS offering known as Amazon Web Services, AWS. CloudFront is a CDN in the AWS micropayments-as-you-go style, which offers the ability to serve non-public content stored in S3. This is a compendium of the things I learned setting up a private streaming distribution for use with PHP.
This is going to be fairly low-level, since I like to drink deeply of the systems I'm working with. I don't think AWS works smoothly enough yet that you can put the API on the "it's magic" side of the line.
I'll just assume you're aware of the IaaS offering known as Amazon Web Services, AWS. CloudFront is a CDN in the AWS micropayments-as-you-go style, which offers the ability to serve non-public content stored in S3. This is a compendium of the things I learned setting up a private streaming distribution for use with PHP.
This is going to be fairly low-level, since I like to drink deeply of the systems I'm working with. I don't think AWS works smoothly enough yet that you can put the API on the "it's magic" side of the line.
Saturday, November 5, 2011
PHP's hash(): how tiger192,3 and tiger192,4 differ
PHP lists a handful of hash algorithms for Tiger:
- tiger128,3 tiger160,3 tiger192,3
- tiger128,4 tiger160,4 tiger192,4
Tuesday, November 1, 2011
Renaming buckets on S3
A technical note, since the search engines of the internet don't seem to have noticed: Amazon's S3 management console lets you cut and paste files now (including whole folders). So the process to "rename" an S3 bucket is simply:
Why would anyone want to rename a bucket? In our case, we created a StudlyCapsStyle bucket, which can't be used with CloudFront's dns-compatible-style.
In double-checking this post for accuracy, I noticed that Cut/Copy are available on the right-click menu for a single selection, but not the multi-select. Weird.
- Create the new bucket with the desired name.
- Go to the old bucket and select all files: click the first and then shift+click the last.
- Above the file listing, in the button row, is one marked "Actions", which opens a menu that includes "Cut" and "Copy". Pick one.
- Go to the new bucket, click Actions, and Paste your files.
Why would anyone want to rename a bucket? In our case, we created a StudlyCapsStyle bucket, which can't be used with CloudFront's dns-compatible-style.
In double-checking this post for accuracy, I noticed that Cut/Copy are available on the right-click menu for a single selection, but not the multi-select. Weird.
Tuesday, October 25, 2011
Character Sets: Get PHP, Perl, MySQL, and Unicode to Play Together
This post is a companion to Perl and Unicode in Brief, an attempt to cover the same ground more concisely.
This is an extended remix of my recent post on the subject, only less of a rambling story and more focused. Again, I'll start with some background definitions.
I'll also assume that you're going to make everything UTF-8, because as a US-centric American who has the luxury of using English, that's what makes the most sense for my systems. However, if you understand everything I wrote, it should not be difficult to make everything UTF-16 or any other encoding you desire.
This is an extended remix of my recent post on the subject, only less of a rambling story and more focused. Again, I'll start with some background definitions.
I'll also assume that you're going to make everything UTF-8, because as a US-centric American who has the luxury of using English, that's what makes the most sense for my systems. However, if you understand everything I wrote, it should not be difficult to make everything UTF-16 or any other encoding you desire.
Friday, October 21, 2011
The Trouble with REST
Note: this post has been superseded.
REST is easy to describe. It goes a little something like this: "You have some representation, and you send (or receive) the whole thing to read it or make changes." People coming from Clojure would understand it as REST sends values. I can GET an object, receive the value, manipulate it, and PUT the new value. It's so easy because it just uses HTTP!
Right? Maybe not. If REST is so easy, why is there HATEOAS*? Shouldn't that have been obvious? Why do we have arguments about versioning and parameters and formats and headers on Reddit?
REST is easy to describe. It goes a little something like this: "You have some representation, and you send (or receive) the whole thing to read it or make changes." People coming from Clojure would understand it as REST sends values. I can GET an object, receive the value, manipulate it, and PUT the new value. It's so easy because it just uses HTTP!
Right? Maybe not. If REST is so easy, why is there HATEOAS*? Shouldn't that have been obvious? Why do we have arguments about versioning and parameters and formats and headers on Reddit?
Wednesday, October 19, 2011
Notes on using mysqlbinlog for copying updates
I commented on this post, but for posterity:
It seems by sheer luck that I stumbled over a way to take care of everything. I save a copy of the interpreted binlog as it files through the pipe:This is in regards to piping mysqlbinlog output from one mysql server into the mysql client to execute on another; the post I linked above discusses doing so for switching to Amazon RDS. The basic strategy is to minimize downtime by loading a database dump from the source on the destination, then use mysqlbinlog on the source and the mysql client to feed updates from the source to the destination. The updates can be faster to load than a new dump; and when it's time to switch servers, it's a matter of stopping database clients, turning off the source mysqld, sending the final binlog updates, pointing the clients to the destination server, and turning the clients back on. As opposed to waiting for a whole dump to load while the clients are off.
mysqlbinlog ... | tee binlog-play.sql | mysql ...
Then if I get an error message, mysql will tell me e.g. "Error ... at line 42100". Running "vim +42100 binlog-play.sql" lets me inspect the stream to see what went wrong in detail.
Inside binlog-play.sql, the "#at 112294949" comments can be used in e.g. "--start-position=112294949" to the next mysqlbinlog command, to retry the statement after I fix the problem. (Alternatively end_pos seems to tell the position of the next command, if I need to skip the one which failed, e.g. I was testing out CREATE FUNCTION and it was logged as "CREATE DEFINER=... FUNCTION" which RDS refuses.)
The final piece of the puzzle is that executing "FLUSH LOGS;" or "mysqladmin flush-logs" will push mysqld on to the next binlog file, so you can safely play out the one you want. Once you've finished processing a file through mysqlbinlog, you can just remember the file boundary, and flush mysql's logs if you want to process the one it's presently writing to.
Subscribe to:
Posts (Atom)