The RoLLing cOde

Rumor, crap and –un–original

Archive for 2007

Get Spread Toolkit and inotify-tools PHPized

without comments

Just very basic wrapping :)
Get them from Google Code SVN.

svn checkout http://php-spread.googlecode.com/svn/trunk/ php-spread-read-only

svn checkout http://php-inotifytools.googlecode.com/svn/trunk/ php-inotifytools-read-only

Written by freewizard

December 24th, 2007 at 3:37 pm

Posted in Crap

Tagged with

File upload with URLRequest in AIR

without comments

A function to help upload without FileReference.upload() in AIR HTML/JS application.

Function Parameters:

void PrepareMultipartRequest(
 URLRequest request,
 ByteArray file_bytes,
  string field_name = "file",
  string native_path = "C:FILE",
  object data_before = {},
  object data_after = {}
);

Sample JS Code:

var request = new air.URLRequest('http://example.com/upload.php');
var loader = new air.URLLoader();
var file = new air.File('C:\TEST.TXT'); //use file.browseForOpen() on ur wish
var stream = new air.FileStream();
var buf = new air.ByteArray();
var extra = {
 "id": "abcd"
};
stream.open(file, air.FileMode.READ);
stream.readBytes(buf);
MultipartRequest(request, buf, 'myfile', file.nativePath, extra);
loader.load(request);

Sample PHP Code:

$id = $_POST['id'];
move_uploaded_file($_FILES['myfile']['tmp_name'], '/opt/blahblah');

Download:
multipart.js

Original idea inspired from
here
.

Written by freewizard

November 12th, 2007 at 8:51 pm

Posted in Crap

Tagged with

Memcached hack by Sina guys

without comments

a BDB-backended memcached hack

http://code.google.com/p/memcachedb/

similar to Tugela.

Supported memcache command

* get, set, add, replace

* incr, decr

* delete

* stats

* flush_all

Private commands

* db_checkpoint

* db_archive

Written by freewizard

October 24th, 2007 at 9:19 am

Posted in Crap

Tagged with

Cool features upcoming in memcached

without comments

Memcached
is cool, KISS and powerful. After no-new-release-silence
of months, I’m always expecting some new feature from it. Here are
things I’m looking forward:

  • 64 bit counter: patch available from Evan Miller
  • APPEND: patch available from Filipe Laborde
  • Binary wire protocol: patch and python/java client code available from Dustin Sallings
  • Atomic operation: patch available from Chris Goffinet
  • Mass deletion: have not seen the patch yet, but I believe it will not take too long…
  • Replication? Sounds cool, but a bit complex and not so useful IMHO.
  • Storage backend? Useful in certain cases, but not so necessary since we have Tugela and
    NMDB
    . Ofcoz the world will be more perfect if author of NMDB make a memcached-compatible interface.
  • Iterating keys/items? Useful or not? Certainly leads to abusing.

For all memcached lovers, we should give our thanks to Facebook, who contributes patches and hosts hackathon. :)

Written by freewizard

September 20th, 2007 at 4:48 pm

Posted in Crap

Tagged with

Unofficial Facebook application for Douban

without comments

A Chinese Facebook Application was put online by me lately which would help ppl on
Facebook
to show off their
Douban
collections.

200+ Facebook user has enjoyed this small creation.

Wanna a try?
(Facebook account required)

For ppl interested with the TODO list in the maybe-near-maybe-far future:

  • FBML 1.1
  • Display more items in collection
  • Profile action
  • Story line update
  • Invite friends
  • Collections in common with friends

For bugs and advices, visit
here
.

Written by freewizard

August 24th, 2007 at 1:14 am

Posted in Crap

Tagged with ,