Skip to main content

Posts

Running django on apache with mod_wsgi in Ubuntu/Linux Mint

Django comes with a built in web server that should only be used in development. Integrating django and apache is a bit messy. Apart from Django and Apache itself, libapache2-mod-wsgi is needed to run django with apache2. There are four steps involved. Creating a wsgi file that enables wsgi handler . Creating a conf file in sites-available directory of apache Enabling the site and reloading apache configuration Adding a host entry that points to localhost for the site Detailed Steps First to create a mysite.wsgi file in any directory of your choice with following code [python] import os import sys sys.path = ['/var/www/mysite'] + sys.path # change the path to project directory os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings' import django.core.handlers.wsgi.WSGIHandler() [/python] Then create mysite.conf file in /etc/apache2/sites-available directory and write following code [xml] <VirtualHost *.80> WSGIScriptAlias / /home/user/mys...

Setup connection for MDMA

MDMA is a mobile network monitoring application. It shows information such as QoS, detailed signal information. I like to use MDMA rather than Huawei dashboards. It’s lightweight and much faster than Huawei Dashboards. MDMA 1.1.0.0 requires you to have connection entry ‘ MDMA ’ by default otherwise you get an error. [caption id="attachment_95" align="aligncenter" width="470"] Cannot find phone book entry error[/caption] Setting up a connection entry for MDMA Go to Control Panel\Network and Internet\Network and Sharing Center [caption id="attachment_96" align="aligncenter" width="280"] Open Network & Sharing folder[/caption] Create a copy of existing connection. [caption id="attachment_97" align="aligncenter" width="411"] Create a copy of existing connection[/caption] Rename it to MDMA [caption id="attachment_98" align="aligncenter" width="416"] Renaming...

Disable join/part messages in HexChat/XChat

Join messages are very annoying while hanging out in IRC. Its best to disable them. [caption id="attachment_84" align="aligncenter" width="1056"] Annoying join messages in IRC channels[/caption] To do this just go to Settings | Preferences | Chatting | Advanced and Check the Hide join and part messages option as shown below. [caption id="attachment_85" align="aligncenter" width="693"] Check the Hide join and part messages[/caption] You can also set this for individual channels by right clicking on channel name and choosing Hide join/part messages from settings option. [caption id="attachment_86" align="aligncenter" width="477"] Applying for individual channels[/caption]

Proxy settings in Linux Mint 14

Linux Mint 14 has a Network Manager that allows to set proxy settings but unfortunately that do not get applied to system level. [caption id="attachment_71" align="aligncenter" width="555"] Setting Network Proxy Preference in Linux Mint[/caption] To configure apt follow the following steps Go to /etc/apt/apt.conf.d/ Create a file called “30proxy” using a text editor like vi Add the following lines Acquire::http::proxy “http://username:password@host:port/”; Acquire::https::proxy “http://username:password@host:port/”; Acquire::ftp::proxy “http://username:password@host:port/”; [caption id="attachment_75" align="aligncenter" width="665"] Configuring apt to use network proxy[/caption] To configure bash in order to use curl, wget etc behind proxy Add following line in ~/.bashrc export http_proxy=http://username:password@host:port/ export ftp_proxy=http://username:password@host:port/ Don't forget to replace username and pass...

Code Completion in Aptana Studio 3 for CodeIgniter 2

If you don't know code completion in Aptana Studio 3/ Eclipse for CodeIgniter 2 is very easy. Only thing required is to put following code in any new file in CodeIgniter project directory. It’s just a class in which all the codeigniter library clasees are initialized. You can even add support for custom classes by initializing it as shown. [php] <?php class _ { function _() { // any classes you want included in autocompletion $this->load = new CI_Loader(); $this->config = new CI_Config(); $this->email = new CI_Email(); $this->encrypt = new CI_Encrypt(); $this->pagination = new CI_Pagination; $this->session = new CI_Session(); $this->driver = new CI_Driver(); $this->benchmark = new CI_Benchmark(); $this->typography = new CI_Typography(); $this->form_validation = new CI_Form_validation(); $this->profiler = new CI_Profiler...

jQuery support in Aptana Studio 3

I use Aptana Studio primarily for web development. It has great support for languages like PHP and JavaScript. But the problem is that I mostly use jQuery rather than code in JavaScript and Aptana does not have good support / content assist from beginning. So we need to install ruble for jQuery library. Ruble is short for Ruby bundle and is a runtime environment that allows the extensibility of Aptana Studio's editors by using Ruby. To install the jQuery bundle follow the following steps: Navigate to Commands | Bundle Developement | Install Bundle. Select jQuery and click OK. Aptana will clone jQuery ruble from github. Include appropriate jQuery sdocml in Project Build Path from Project Properties. Include a VSDoc file for jQuery in your project. [caption id="attachment_47" align="aligncenter" width="1313"] Aptana fetching jquery ruble from GitHub[/caption] You must include appropriate version VSDoc for correct Content Assist. [caption id="attac...

flotjs labels on tooltips for categories plugin

I had been using awesome flot.js charting library on my results app . The charts were easy to generate and I included categories plugin to replace x-axis labels to words rather than integer values. But I faced some issues while enabling tooltips and having them display the labels rather than x coordinates. I checked up the source code. [caption id="attachment_35" align="aligncenter" width="646"] getAxes()??[/caption] plot.getAxes() method described in the documentation was giving me an undefined method error.I searched the docs, searched on Google, stackexchange etc.. but to no avail. Then I found solution thanks to firebug. I did a console.log() of the whole item object and began inspecting. I could see few objects that looked promising. Upon further inspection I found a way to map a value back to its label. [caption id="attachment_34" align="aligncenter" width="924"] Dumping entire item object in firebug[/caption] I foun...