Skip to main content

Posts

Showing posts from 2013

MySQL Post Install Setup

After MySQL is installed, either as part of Ubuntu Server installation sequence or separately through an appropriate apt-get command, it needs to be properly initialized for use by a client.

One key concept of any standalone database engine is that they have their own user namespace and associated access rights. MySQL is no different and therefore this needs to be appropriately setup before any client can create/update/delete entries into any table.

Essentially this involves the following steps, all to be undertaken as the Administrator (or the root account, by default):

Linux Command Output Redirection Rules

Here's another thing that I learned today -- command output redirection syntax.

> redirects the program's output to the specified file which is specified afterwards. If > is preceded by ampersand, shell redirects all outputs (error and normal) to the file right of >. If you don't specify ampersand, then only normal output is redirected.

In other words:
command &> file # redirect error and standard output to file command > file # redirect standard output to file command 2> file # redirect error output to file This is how things work on Ubuntu and bash. Other shells could very well be different.

VirtualBox - Sharing a host folder on Ubuntu guest

I have been using VirtualBox to run Ubuntu Server on my Windows PC over the last couple of weeks. The more time I spend with it, the more I find the need to get myself acclimatized with the good old command line method to interact with your OS. Though I'm a pretty fast learner and have spent quite a bit of time on Linux and its variants in the past, the sheer number of commands that one has to learn to manage the large array of interfaces in present-day OS is astounding.

For example, I wanted to share a folder from my Windows host to the Ubuntu guest. How do I go about doing it? How do I mount a USB stick on guest OS?

Luckily, answers to most of these questions are only a few clicks away with the help of Google. However, since I expect to carry out some of these tasks quite often in the future, I'm going to try and record things that I discover and re-learn in various blog posts, so as to act as a reference for myself. This post talks about how to go about accessing a Host fol…

Setting up Ubuntu for Python Development

This is more for my own reference as I often forget the various steps that I followed to get an environment set up. This post lists the steps that I followed to setup an Ubuntu Server for Python/Django/MySQL environment. The steps are drawn from various resources on the web -- official documentation from Ubuntu, some blog posts and a few pointers on stackexchange/stackoverflow. All credits due to all the kind souls who shared knowledge.

Play youtube videos on Raspbian using omxplayer

This is a follow up post to the original one made by Jojen on setting raspbian to use omxplayer to play videos embedded in webpages. This yields much smoother playback on raspberry PI as omxplayer is built to use the PI GPU rather than software emulation.

BTW, some blog posts might suggest that you can install gnash and its browser plugin, but since it's not hardware accelerated, I found it's performance to be simply non-acceptable. So if you stumble upon those posts, you might as well save yourself some time and not go down that path.

Back to Jojen's post. Everything in the post works as it says it would, including playing the sample video the link to which he has at the bottom of his post. The trouble starts when you try to play youtube videos. I found this was due to two reasons:

Incorrect permissions on the script omxplayer-youtube.shMidory user addon Javascript failing to detect video links since youtube as has changed the relevant div tag id
The problems can be fixed…

Debugging Django Template Tags

Here's a cool bit of code snippet that I found from the web (original post here). I'm recording it here for my own easy reference without having to google it all the time. It describes a simple technique to debug Django templates using the python debugger - pdb.

@register.filter def pdb(element): import pdb; pdb.set_trace() return element Now, inside a template you can do
{{ template_var|pdb }} and enter a pdb session (given you're running the local development server) where you can inspect element to your heart's content.

It's a very nice way to see what's happened to your object when it arrives at the template.

MQC Client

Beging a legacy component, Mercury Quality Center web plugin does not work very well with new versions of Internet Explorer. MQC Client is a little program that addresses this by hosting the MQC web plugin inside it making it work with the newer IE versions that come as standard with Windows 7.

I have not tested it on Windows 8, but it ought to work.

More about the program and how to use it is here.

Friendly(X) UI

One would think that in this day and age of highly interactive user experiences, simple message boxes can't go too wrong as far as UX is concerned. At least that's what I thought until I came across this dialog:


Perhaps you don't notice what I'm grumbling about -- the link provided to get the latest virus definition files (erased for confidentiality reasons) is neither a hyperlink nor a selectable text! That's right, you can't even select that text and copy-paste into the browser leaving you with the only choice of typing the link manually, a letter at a time.

Well, at least they got the grammar right and managed to convey the message correctly. So it's not as bad as it could've been!

Setting up Shared Repository in Git

This is not really a post and more of a web clipping for my own future reference.

This page contains useful instructions on how to setup a shared repository with Git. I use it to back up by work on to a thumbdrive.

You might wonder why am I not using one of the free services such as GitHub or BitBucket. Answer is simple -- the code is closed source.

From my research most of the online Git services only provide free hosting for open source code. May be there is a provider out there who does offer true free hosting for closed source, but I don't have the time to pour through their licence agreement and ensure that free is really free without any catches.

Hence the decision to store things locally. In any case Git makes it so easy to set things up.

Typesafe Logging

Problem One of the common sources of runtime errors in C++ comes from using the good old vararg function types -- printf() or its variants. The problem stems from type mismatch between the type specifier in the format string and the actual arguments supplied to match this format string. Though most of the present-day software do not employ the printf function for user interaction, a variant of it is quite heavily used -- sprintf()  for outputting log messages.

Often log messages are written in response to an error condition and formal testing does not always simulate all the possible error conditions which means some code goes untested. Also, log messages typically have an associated logging level which is usually set to a medium value by default. Testers often do not set the logging level to the lowest possible level before embarking on the testing process meaning that messages at the lowest level are also not exercised during testing.  Another real-world situation is when the relea…

Explicit Overrides

In the last two days, I have been twice bitten by the loose nature of legacy C++ language.

I had developed a base class that abstracts the core features of a module a year back. The class itself was a great success. Since developing it for a specific module, I successfully refactored another module to use this and was able to do so in a relatively short window of 1 week. This is the background.

Recently, I had an opportunity to re-use this class for another module and having been successful earlier twice, I guess I was a little callous in using it without referring to the accompanied documentation. The design requires that I override a bunch of methods and admittedly I was as little cocky -- if I had designed and implemented it earlier, it should be a snap for me to re-use it. So I wrote the code, compiled it, removed a few syntax errors and dropped it into test. All good, except that couple of overridden methods were not being invoked!

WTF? It also so happened that the callback to t…

Back to the roots

For the past couple of weeks, I have been working on something that I thought I had left behind a long time ago, a very long time ago -- a windows device driver!

I had launched my career writing drivers, first for OS/2 and then eventually for Windows. When I say Windows, I'm referring to Windows NT 3.51. That's correct, NT 3.51! And here's a surprise, the first Windows NT driver that I worked on ran on PowerPC platform! IBM was readying their new state-of-the-art PC platform and to play it safe wanted to give the user the choice of platforms to run -- OS/2 and Windows NT.

Being a new platform, the toolsets were not quite as well developed as they were for the more contemporary and stable x86. WinDBG (a far cry from the WinDBG of these days) had issues syncing the source line information in the PDB with the actual source files. Quite often I had to resort to using the disassembly to isolate the root cause and fix it. Another challenge that I faced then was that the x86 dri…

Back to the blogging world...

I'm back online after a hiatus of almost 12 months.

Having maintained a self hosted blog on a shared hosting service and having gone through the pains of keeping the Wordpress version current, I'm gonna give the Blogger service a try.

Since I use Gmail as my primary email service, Blogger and its tight integration with Google services ought to make this a pleasant experience.

Also, Blogger provides free mapping of custom domains to the hosted blog. That means I just need to pay for my domain name -- no more hosting charges! Not sure if theres' a way by which I can get my domain mail account to work for free as well. Let's see.

May I find the drive to persevere with this effort for the long term. Wish me luck!