Pages

Monday, April 16, 2012

Redis

Not a mainstream database, its syntax reminds me of old console programs. Nothing superfluous, only the command, and arguments separated by spaces.

Though it's pronounced RED-iss, I like calling it ruh-DISS.

Unfortunately I haven't found many resources. Here's one:

http://rediscookbook.org/

Thursday, April 12, 2012

Android SDK

So far I'm not impressed. Eclipse is unresponsive, and the default installation lacks a file needed for virtual device creation. And installing anything is slow as molasses.

http://www.vogella.com/articles/Android/article.html


Thursday, March 15, 2012

stealth35 saves the day

After some poking around I found that in PHP 5.4, arrays can be written like this:
$array = [
    
"foo" => "bar",
    
"bar" => "foo"];
and I tried finding a WAMP supporting PHP 5.4, which led to discovering this PHP version was released in early March.

I "updated" Ampps by replacing its PHP folder with an unzipped 5.4 folder. Other than a few warnings, it worked.

Then, the MongoDB driver refused to work. From Stack Overflow, I found a link to stealth35's compiled driver dll. Now, everything works!
Right now, I'm not liking the PHP driver for MongoDB. Take a look at this example from http://www.php.net/manual/en/mongo.updates.php:

<?php/** suppose documents look like:
 * {"username" : "...", "password" : "...", "email" : "..."}
 *
/
$coll-> update(array("username" => "joe"), array("userId" => 12345
"info" => array("name" => "joe""twitter" => "@joe4153""email" => "..."),
"likes" => array()));

array(" I " => "want my JavaScript back")

Wednesday, March 14, 2012

mongo command line shell

> show dbs
Lists existing databases

> use [database-name]
Changes database. By default, test is opened.

> db.[collection-name].find()
Displays the collection's documents

Tuesday, March 13, 2012

Ajax jQuery style


I am trying out the comma-first style for my objects. I got errors many times when I added a new pair to an object list because I didn't add a comma to the last pair.


Although curl gives a more informative message, I cannot get the same information out of statusCode 412.


<html>
<head>
<script type="text/javascript" src="jquerymin.js"></script>
<script type="text/javascript">
  function initialize() {
    $.ajax({
      type: "PUT"
    , url: "http://127.0.0.1/couchdb/albums"
    , success: function(data) {
        alert(data);
      }
    
    , statusCode: {
        412: function(jqXHR, textStatus, errorThrown) {
          alert(textStatus);
        }
      }
    });
  }
</script>
</head>
<body onload="initialize()">


</body>
</html>