Running OSQA with Nginx and uWSGI: VirtualHosting Mode with DynamicApps

Following on the previous post about OSQA installation, this post discusses the co-existence of OSQA with other WSGI-compliant web applications supported by uWSGI.

As has been shown in the post linked above, installing OSQA with Nginx, uWSGI and SQLite3 on Ubuntu Lucid is easy enough that it can be automatically done through a bash script. However, we were only considering an ideal and simplified case: one server, one (sub)domain, one application. Unless your OSQA site attracts so much traffic that it deserves its own VPS or even a dedicated server, you probably want to host other sites and web applications along with your OSQA installation. One common scenario would be running two or more OSQA installations on the same topic using different languages. For example, en.example.com catering for English-speaking visitors and fr.example.com targeting French-speaking visitors. There are more ways to achieve this than this post could possibly cover. We will focus on solutions with minimal deviation from our starting setup: Nginx as the only web server, uWSGI as the only application server and no coding beyond shell scripts.

Continue reading

Posted in Linux, Web | Tagged , , , , , , , , , | 3 Comments

Installing OSQA with Nginx, uWSGI and SQLite3 on Ubuntu Lucid (10.04) Minimal

OSQA is an open-source django-based implementation of the famous Stack Overflow Q&A community infrastructure. Its codebase was largely inherited from a Chinese project CNProg, which, for various unfortunate reasons, has closed its community site and virtually stopped development since earlier this year.

OSQA is currently only available as subversion checkout and although there are some installation tutorials posted on its website and elsewhere on the internet, one may not necessarily find all the needed information easily for his/her particular configurations.

This is basically a documentation about the process of installing OSQA on a low-spec or low-end VPS (Virtual Private Server), with 128 MB guaranteed and 128 MB burst memory. The OS is the newest LTS (Long Term Support) offering from Canonical, Ubuntu Lucid 10.04 Minimal. The selection of Nginx as web server and uWSGI as application server is based on their high performance and low memory footprint. SQLite3 is used as database engine also because of its low memory requirements and because high-traffic is not expected for the near future of the site being built.

This documentation is posted in the hope that it will make things easier for those attempting similar configurations. For more convenient use, a semi-automatic installation script is available for download at the end of this post, but it is probably better to go through the major steps of the installation process with some explanations.

Continue reading

Posted in Linux, Web | Tagged , , , , , , , | 12 Comments

Accessing Operating System Clipboard in Chromium (Chrome) Extensions

Earlier this year, Webkit disabled clipboard access of web pages by default for security reasons (see this changelog and this bug report). Programming-wise, this means good old document.execCommand(‘Copy’) and document.execCommand(‘Paste’) will always return false. This is indeed quite understandable, and very useful for protecting the average surfer’s privacy.

Unfortunately, when this change was carried over into Webkit-based Chromium and Chrome browsers, quite many extension developers’ got annoyed because their extensions suddenly stopped working as a result of the new restriction. Chromium and Chrome extensions run locally and usually require explicit permissions from users to access remote sites. It is generally safe to allow extensions to access the OS clipboard, which is used by many extensions to do various tricks. With the new change in the underlying Webkit code, they were no longer able to do so.

Continue reading

Posted in Chromium extension | Tagged , , , , , | Comments Off on Accessing Operating System Clipboard in Chromium (Chrome) Extensions

Setting a Default Zoom Level for Chrome Browser

Update (2018-5-28): I don’t know why, but apparently people are still coming to this page after all these years, so here is the most up-to-date info: in recent Chromium/Chrome, simply click on the vertical ellipsis ‘⋮’ icon to the right of the address bar, and in the opened popup menu, select ‘Settings‘; in the ‘Apperance‘ segment of the opened Settings page, locate ‘Page zoom‘ option and change it to the desired value. There are only a series of preset values available for selection and you can’t input custom value, but the presets should be more than enough. You will notice that the popup menu opened by the ‘⋮’ icon also contain a ‘zoom’ option. This is for per-site zoom level setting, while the one mentioned above is for overall zoom level setting. Per-site zoom level can also be easily changed using Ctrl + Mouse Scroll Up/Down while browsing, and the browser will remember the setting across sessions.

Update (2012-5-19): On Chromium/Chrome 19, open ‘Settings‘, click ‘show advanced settings‘ at the bottom, scroll to ‘Web content‘, change ‘Page zoom‘.

Update (2011-3-9): Google has released into the stable release channel Chromium/Chrome 10, which supports the global default zoom level setting mentioned in the earlier update below. Those on Windows should already be using this new release and those on major linux distros won’t have to wait for too long, hopefully.

Update (2011-1-20): Although not available in the current stable release channels (8.0.552.* series) yet, recent versions of Chromium/Chrome 9 and 10 (available from https://sites.google.com/a/chromium.org/dev/getting-involved/dev-channel) include support for user-selectable global default zoom level, which can be accessed at ‘Settings – Under the Hood – Web Content – Page Zoom’. The zoom level choices are the same as those available in the ‘Zoom’ menu entry and apparently not customizable.


Big LCDs with their high resolutions are now dominating the desktop display market. Unfortunately, internet content has yet to catch up with this not-so-new development. Although it has become rarer and rarer to see statements like ‘Best viewed at 800×600′, a significant part, if not a great majority, of web content has simply not been designed to display on anything with a resolution higher than 1024×768. Surfers often find themselves unconsciously leaning towards the screen to make out the small fonts. White spaces left by websites in their visitors’ browser windows have become so common, that online advertising companies have even come up with special types of ads that are specifically designed to fill this emptiness.

Fortunately, most, if not all, modern browsers boast the capability of both text zooming and full-page zooming. The one with the best solution, indisputably, is Firefox with its NoSquint add-on, which provides both default and site-specific zooming. IE8 allows the user to set one zoom level that is applied to all sites and anything other than that has to be set manually. The situation of Chrome (and Chromium) is a bit awkward at the moment. On the one hand, it memorizes user-set zoom levels for all sites visited, so that on subsequent visits, the site’s content will be automatically zoomed. On the other hand, there does not seem to be an option to set a default zoom level for all sites, which both Firefox, through NoSquint, and IE8 provide. What all this comes to is that every time I visit a new website in Chrome, I have to manually zoom it to fit my 1920×1080 display. That is at least two ctrl-+ or ctrl-wheelup for EVERY new site I visit. And should I have to re-install OS and lose all configuration from previous Chrome install, I will have to do it for EVERY site, AGAIN. I feel exhausted already just describing the process.

Continue reading

Posted in Web | Tagged , , , , | 5 Comments

HiMedia HD300A (RTD1073) TTL Serial Pinout

The other day I ordered one of those HD (which is conveniently capable of standing for both High Definition and Hard Drive) media player boxes. After roughly 2-3 years in the market, such products have really come a long way and matured significantly in both hardware and software, and more importantly, at least for yours truly, the prices have dropped even more significantly, 🙂

The model I decided on buying is a rather old one, HD300A from HiMedia based on Realtek’s RTD1073 Soc, which is still very popular among both vendors and consumers despite its comparatively old age. Like most Soc’es used in HD media players, RTD1073 is mostly proprietary. Almost all RTD1073-based products run firmwares modified from the same Realtek SDK, although the SDK seems to have been updated once or twice, maybe even more, over the time. Sources for parts of a particular version of SDK are available here and there on the net, but the most vital parts, video and audio en/decoding, are still only available as binaries.

Continue reading

Posted in Linux, RTD1073 | Tagged , , , , | Comments Off on HiMedia HD300A (RTD1073) TTL Serial Pinout

Running 2.6.36 kernels on SmartQ5

With the release of 2.6.35 kernel, basic support for SmartDevices SmartQ series MIDs has now been officially merged into mainline linux source trees ([1]).

‘Series’ here is certainly an overstatement, as there have only been two: SmartQ5 and SmartQ7. These S3C6410-based devices were released in China around last April and have been since exported abroad, sometimes with distributor branding. Stock firmwares, from the original ones to the few ‘updates’ that were made available later, were all based on a patched kernel from 2.6.24 series, presumably provided by Samsung in the BSP to HHTech, who is the real manufacturer of these devices.

Getting stuck on 2.6.24 most certainly is not something desirable for anyone familiar with progresses mainline kernels have been making in the meantime. Unfortunately, as has happened numerous times before and as will happen numerous times in future, the manufacturer, HHTech, showed no apparent interest in pushing support for their products into mainline and it was up to the user community to do their job. It took quite some months, but finally, mainly thanks to the hard work of Maurus Cuelenaere, you can now boot an up-to-date mainline linux kernel on SmartQs.

Well, not quite. Not unless you are using an up-to-date bootloader that can pass correct machine type ID numbers to the linux kernel. The bootloader in stock firmwares passes the ID number for smdk6410 machine type (1626) on both SmartQ5 and SmartQ7, whereas 2.6.35 and later kernels expect 2534 for SmartQ5 and 2479 for SmartQ7. This will cause the kernel to recognize the device as a different machine and either fail to load proper drivers or refuse to boot altogether.

Continue reading

Posted in Linux, SmartQ | Tagged , , , | Comments Off on Running 2.6.36 kernels on SmartQ5

Merging Two PhpBB Forums Together

Browsing through my sourceforge account, I realized there still was a ‘zombie’ GeeXboX for Wii forum left there. I thought maybe I could merge the few posts there into the slightly more active and up-to-date GeeXboX for Wii forum and opt out of the service to avoid wasting sf’s resources.

It turned out that this was not such a simple task but Google, while having difficulties with what were actually meant to be merged, eventually pointed towards an apparrently working solution: Merge two phpbb3 forums. Since the steps involved are a bit too many and the old forum did not contain that much useful info anyway, I decided that I will just save this for some rainy day and future Googlers.

Posted in Web | Tagged , | Comments Off on Merging Two PhpBB Forums Together

Everybody else is blogging!

Now so am I!

Posted in Miscellaneous | Tagged | Comments Off on Everybody else is blogging!