Category: Tutorials (Page 1 of 2)

Django & Webpack

Table Of Contents

  1. Overview
  2. Environment Setup & Requirements
  3. Setup Webpack
  4. First Webpack Packaged Assets


I’ll assume that you already know Django and is already well versed with it and you just want to integrate Webpack into your project. If you already know what is Webpack and how it works please proceed to Environment Setup & Requirements. For those of you that is not quite sure what Webpack will bring into your Django project then please read on for brief introductory of it. Continue reading

Dovecot Email Migration

So I’ve just migrated my mail server recently. I was initially using iRedMail but needed to move it to another server. The problem though is that the destination server already had MySQL and Nginx as a web server. I just wasn’t comfortable running a script that has a chance to break what I’ve currently setup. I also didn’t want to take the route of creating my own email server from cratch. I’ve already did it in the past and it was okay but it was a hassle to maintain. So like anyone else I’ve jumped to Google to search for any free open source email server. Lucky for me I was able to find Mailcow relatively quickly. It’s open source and uses popular open source software for the email server components (MTA, Database, WebServer, etc.). The great thing about it though is that its dockerized which would not interfere with what is currently installed in the destination server. Continue reading

Launch Your Android App Using Your Website URL

You have a website and an android application and you want it so that an android user will be redirected to the application once they open a link from their email. Good thing android have an easy way to do this using Intents and Intent filters.

The first step is to add an information in your applications AndroidManifest.xml to tell the system that you want to received an intent regarding opened links. Open your AndroidManifest and add the following under the activity that you want to receive the intent.

 <action android:name="android.intent.action.MAIN" />
 <category android:name="android.intent.category.LAUNCHER" />
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.BROWSABLE" />
 <data android:scheme="http" android:host=""/>

What this does is tell android that your activity can handle and process links that was opened by users. Now everytime a user opens a link to a popup window will appear showing a list of applications that can process the link this includes browsers installed, your application and some application that have also registered for this.

Continue reading

Create A Python 3 Environment With virtualenv

Update: If you’re already using Python >=3.3 then there’s is already a package called venv which you can use to create you’re virtual environment with just:

python3 -m venv myennv

virtualenv is very useful in developing Python because you can create your project’s own environment without polluting the or messing with the global or your other projects Python environment.

First make sure that you have already installed virtualenv and pip for Python 3.

$ sudo apt-get install python3-pip 
$ sudo pip3 install virtualenv

Continue reading

Setting Up A Linux, Nginx, MySQL & PHP (LEMP) Stack On Debian 7

This will be a tutorial for setting up your own LEMP stack on Debian 7 Wheezy. This might be also used for installing one on Ubuntu but is not guaranteed.

LEMP Stack?

LEMP is almost the same with a LAMP stack but the Web server part is replaced with Nginx. LEMP is an acronym for a software bundle of Linux, Nginx(for E), MySQL and PHP. Sometimes any of this softwares gets replaced like MySQL can sometimes be replaced with MariaDB and PHP either Perl or Python. Continue reading

Setting Up A Linux, Apache, MySQL & PHP (LAMP) Stack On Debian 7

This will be a tutorial for setting up your own LAMP stack on Debian 7 Wheezy but this might also work for Ubuntu but is not guaranted.

What Is LAMP?

LAMP is an acronym for a software bundle that is Linux, Apache, MySQL & PHP. There are already available installer for this software stack like XAMPP which can be easily installed but if you want to setup your own LAMP stack using Debian aptitude then please read on. Continue reading

MySQL Procedure To Upper Case Table Names

Ever had an experience where you needed to rename a handful of table name into upper case. Below is a procedure to rename all tables into upper case in the current MySQL database/schema.

 SELECT t.table_name
 FROM information_schema.tables t
 WHERE t.table_schema = DATABASE() AND t.table_type=BASE TABLE;
 OPEN cur;
 rnloop: LOOP
 FETCH cur INTO tbname;
 IF no_res = 1 THEN
 LEAVE rnloop;
 SET @s = CONCAT(RENAME TABLE `, tbname , ` TO ` , UPPER(tbname), ` );
 PREPARE stmt FROM @s;
 EXECUTE stmt;
 CLOSE cur;

Just run the script and call it using


then it will rename the tables. Be reminded though that you need to specify the database to be used before connecting to MySQL or by using the use command.

Read String Console Input Including Spaces Safely In C

Reading a string input with spaces in between words can be tricky. There are two functions you can use here its scanf() and fgets(). Both can be used to read in strings from console safely. By safe I mean not overflowing your buffer.

Using fgets()

This is the common way of retrieving input including spaces safely.

int main( int argc, char* argv[] ) {
 char buffer[1024];
 printf( "Please enter a string: " );
 fgets( buffer, 1024, stdin );
 printf( "You entered: %s", buffer );
 return 0;

Using scanf()

This is the one I prefer to use over fgets(). Continue reading

Setting Up Your First Debian/Ubuntu VPS

After you have created your first VPS, your VPS provider should give you the credentials for logging in through ssh. For Linux users you can just type into the terminal:

 ssh [user]@[your-vps-ip]

For Windows user you can download Putty an application that can be used for ssh. Now connect to your VPS through ssh. I assume you are now using the root user.

Update/Upgrade Server

Make sure that your server is updated. Type in:

apt-get update
apt-get upgrade

Change “root” Password

This part is optional, if you want to change the “root” password to something that you will be able to remember then use the below command otherwise move on to “Secure ssh”


Continue reading

Android: Using An Adapter For Dynamic ListView

This a continuation of my Android: Using An Adapter For ListView post. So please read that first you if haven’t done yet. The projects files for this tutorial is also there.

Adding The Dynamic Functionality

To add the dynamic functionality for the ListView we will need to add 2 functions for adding and removing items in our class that implemented the BaseAdapter. For the function of adding strings:

public void addString( String val ) {

Aside from just normally adding the string to our data container called m_data. We are also calling the notifyDataSetChanged(), this function will notify the View where are our Adapter is connected. For this instance we will notify the ListView that the underlying data has changed and it must refresh its display/content.

Removing items is also the same, we will remove it normally from the List and notify the ListView of the changes done on the data.

public boolean removeString( int location ) {
 if ( location >= m_data.size() ) {
 return false;
 return true;

We also added the location of the item that we need to remove. The important part of these 2 function is the line where we call the notifyDataSetChanged() since without calling it your view will not refresh and show the changes you’ve done.

« Older posts

© 2024 James Baltar

Theme by Anders NorenUp ↑