Category Archives: Coding Examples

Deploying to production via FTP using GIT hooks

In this post, we address a common development task of pushing to production. This tutorial assumes you are working on linux, use GIT for version control and are somewhat familiar with python. I’ve only recently started using python for scripting and I can say it’s very friendly for these kind of tasks. Also, I assume […]

Continue reading

Developer’s guide to effective and maintainable internationalization – multiple language support in web applications

item_3 Intl flags

An interesting problem I’ve encountered many times over the years is the multi-language website feature. Given a primary language of the website with its respective database, it is pretty tricky to come up with a good way of having multiple languages for the same website and making it easy to maintain. First, let’s consider we […]

Continue reading

PHP CURL: Fetch Web Page Contents with Status Code

Basic implementation Copy-paste this function to get contents of a web served file / document from given URL. Note: CURL needs to be enabled on your system. function curl_get_contents( $url ) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return array($http_status,$response); } Usage example $url […]

Continue reading

Computing Arithmetic Expressions given as Strings: C++ Solution

The most basic task any programming language should be able to handle is to compute arithmetic expressions including constants, numbers, variables as well as function calls and other value holding “objects”. I’ve written a simple C++ solution that can solve very simple arithmetic expressions. I think it’s a good starting point for anybody trying to […]

Continue reading