Posts by Jiang Yio

I got a bit closer to integrating Twisted with gevent. So far, I’m liking gevent’s speed and blocking style, but it does lack Twisted’s extensive library. Well, this new Twisted reactor runs on gevent and makes it a bit painful to use both frameworks together.

Here is where the magic happens.

Note that this code is for using Twisted with gevent (i.e. libevent and greenlet). For using Twisted with greenlet alone, there is corotwine. Twisted can also be used with Eventlet.

Now, Twisted is a pretty awesome framework. It’s not only a networking library, but it’s a framework that provides all sorts of functionality. There’s also plenty of example code, and many things are already implemented. It is somewhat slow, however, and it likes to take control of the whole program. Keeping track of all the deferreds is not really a problem for me, but greenlet’s blocking syntax is quite nice.

If you haven’t seen corotwine yet, I’d urge you to have a look. It lets you use Twisted with a blocking syntax. It’s not quite what I wanted, but it does what it says on the tin. I wanted to use Twisted with Twisted syntax, greenlet with greenlet syntax, and maybe even let the Twisted bits talk with the greenlet bits. It is apparently quite easy with gevent.

The first thing you want to do is monkey-patch select.select. This is the method that Twisted uses to wait for file descriptors, and we can let gevent handle that with libevent and greenlet. Next, you run reactor.run either in the main greenlet or in a new greenlet.

As long as Twisted and greenlet code stay separate, everything is peachy. There are some problems when they start mixing. Because the Twisted reactor runs in a single greenlet, calling gevent.sleep (or doing anything else that involves a greenlet switch) actually blocks all of Twisted. Long-running jobs could be done in new greenlets, though. And if another greenlet wants to work with a Twisted transport (i.e. to send or receive data), it’s not going to happen until gevent sees some network activity destined for Twisted and switches to its reactor. These are the same problems you’d see with corotwine, and I suspect they might be alleviated with a greenlet-aware reactor.

Update: gTwist, the original code for gevent-Twisted integration, has been replaced with a more robust system called geventreactor. As its name implies, geventreactor is a gevent-powered Twisted reactor.

Some of you might remember this lowly device. Once upon a time, it was the talk of the town. When the mobile carriers stopped issuing updates, CyanogenMod became one of the predominant variant distributions. But now, with official support dropped from the Android Open Source Project, even Cyanogen and his team are having trouble keeping up. I am, of course, talking about the HTC Dream; this review will cover a number of ways to keep this device up to date, and may apply to the HTC Sapphire/Magic as well.

Read on »

Thanks for putting up with the transition to a new (and hopefully better) hosting service! Instead of copying all the data and settings, I decided to set up a fresh system. The major difference is that I now use Nginx and PHP 5.3.3 FPM instead of Lighttpd and PHP 5.2.6 FastCGI. I have nothing against Lighttpd; I just wanted to try something different.

Also, some parts of the site have been remapped or removed. The wiki is now at wiki.inportb.com and the forum is gone. If you want the forum back, please leave a comment below to that effect. If there’s anything else you’d like to see, please also indicate that in your comment.

Happy new year!

I have often been asked, “do you believe in God?” Yes, I would say, we are all working together towards God. I don’t believe in prayer, however. I think my relationship with God is so powerful that everything I do — and everything I think — brings me closer. You would not be alone in detecting a trace of arrogance. But take a step back, dear reader, and let me tell you our story.

Read on »

Google is currently starting a Chrome OS evaluation program, which involves distributing some 60000 computers for free to guinea pigs in the United States. The device, codenamed Cr-48, is an unbranded notebook with a black rubberized exterior. Here are the technical specifications:

Dimensions: 0.9″h × 11.8″w × 8.6″d @ 3.8 lb (1.72 kg)
Motherboard: Tripod Motherboard MARIO-6050A240910-MB-A03
Chipset: Intel CG82NM10 PCH
Processor: Intel Atom N455 (Pine Trail) @ 1.66 GHz single-core with hyperthreading
Graphics: integrated Intel GMA (Pineview) @ 200 MHz with VGA port
Audio: integrated Intel 82801G HDA with stereo speakers and 3.5 mm stereo output plug
Memory: 2GB Hynix DDR3 1Rx8 PC3-10600S RAM
Flash: ITE IT8500E Flash ROM
Storage: 16 GB SanDisk SDSA4DH-016G SSD on 1.5 Gbps SATA interface
Display: 12.1″ 1280×800 active-matrix color CCFL-backlit LCD with matte surface
Keyboard: full-sized 74-key keyboard
Touchpad: oversized multitouch clickpad
WiFi: AzureWave Atheros 9280 802.11 a/b/g/n supporting WEP, WPA, and WPA2
Bluetooth: Atheros AR5BBU12 with V2.1 EDR
Mobile: Qualcomm Novatel Gobi2000 PCI Express Mini Card
Battery: 63 Wh removable Li-po battery for up to 8 hours use or 8 days standby
Cooling: fan
Other: integrated USB 2.0 port, webcam, and SD card reader

Read on »

Since it’s early in the morning, I’m going to make this short and let the pictures do the talking. Having collected almost 700000 Omegle logs, I decided to run through them all and see if there might be any patterns to be noticed. The following is a general view of some specific topics discussed on Omegle, in bulk. I chose these keywords because “ASL” is, by far, the most popular theme.

Read on »

Opkg is not limited to using packages from files; it is also capable of using apt-get style repositories, vastly simplifying the job of fetching dependencies and updating packages. I already have a repository set up, and it could be added as such

echo "src/gz inportb-android-froyo http://repo.inportb.com/android/froyo" > /cache/etc/opkg/inportb.conf

After doing that, we could refresh the package list

opkg update

Installing a package then becomes as easy as

opkg install name-of-package

And we could keep all our packages up-to-date using

opkg update; opkg upgrade

It’s also quite simple to set up a repository for distributing packages.

Read on »

Now that we have Opkg for Android, we could use it to install packages from local files or off Web servers. Installing a package is as simple as

opkg install path/to/package.opk

or, if it’s on the Web

opkg install http://host/path/to/package.opk

And to remove the package, we would go

opkg remove name-of-package

But what if we wanted to share our own software with others? In this case, we would create our own packages. An Opkg package is essentially a Debian package with fewer control fields. If you know how to make a Debian package, you should be well on your way. In general, a package is an ar archive containing a control tarball, a data tarball, and a debian-binary file. For example let’s have a look at the opkg-hello package:

Read on »