Tuesday, October 24, 2017

Map of Nigeria States' Senatorial Districts

Map of Nigeria Senatorial Districts by State - You may also be interested in Maps of Various States and their Local Governments with electoral wards in Nigeria.

The Senate is the upper house of the Nigeria's bicameral legislature, the National Assembly of Nigeria. The National Assembly (popularly referred to as NASS) is the nation's highest legislature, whose power to make laws is summarized in chapter one, section four of the 1999 Nigerian Constitution. It consists of 109 senators: the 36 states are each divided in 3 senatorial districts each electing one senator; the Federal Capital Territory elects only one senator (Source: WikiPedia).

Here are the maps or visual representation for all the 36 states Senatorial Districts as defined by INEC.

Basically, it is this table provided by INEC listing the NAME OF SENATORIAL DISTRICTS in Nigeria that am representing in a more meaningful format as a map.

Wednesday, October 18, 2017

Domain-Specific Language (Geographic Markup Language - GML)

Hello there,
According to wikipedia: A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains.

There is a wide variety of DSLs, some examples include:-
~ HTML
~ Logo for pencil-like drawing
~ Verilog and VHDL hardware description languages
~ MATLAB and GNU Octave for matrix programming
~ Mathematica, Maple and Maxima for symbolic mathematics
~ Specification and Description Language for reactive and distributed systems
~ spreadsheet formulas and macros
~ SQL for relational database queries
~ YACC grammars for creating parsers
~ regular expressions for specifying lexers
~ the Generic Eclipse Modeling System for creating diagramming languages
~ Csound for sound and music synthesis
~ GML - Geographic Markup Language
~ KML - Keyhole Markup Language

Thursday, October 12, 2017

Most profitable python programming skill in 2017 and beyond

Hello there,

This blog post will address the question:-
~ What Python skills are in demand in the freelance job market?
~ What Python skills are people/companies looking for?

I will share my python programming freelance experience since the beginning of this year 2017. Am also confident that this experience will last longer and remain relevant beyond 2017...

Python is one of the programming languages that is on the rise and there's really a demand for Python programmers out there. But, the question is what aspect or area of application is more profitable at the moment and in the near future?

Applications for Python
First of all, python is applicable in many areas of our day-to-day activities. Here is a high level overview of python application domain:
1) Web and Internet Development - Django, flask, Pyramid etc
2) Scientific and Numeric - SciPy, Pandas etc
3) Education - very good for teaching programming
4) Desktop GUIs (Graphical User Interfaces) - TkInter, wxWidgets, PyQt, Kivy etc
5) Software Development - SCons, Buildbot, Apache Gump etc
6) Network Administration

Read more on the official website...

Friday, October 6, 2017

Scraping StaticGen.com with Python

This is a short Python Web Scraping Tutorial

We will learn how to scrape data from this website StaticGen and have the data saved into a CSV file for further processing.

Let's get our hands dirty...

Prerequisite

You should already have at least some basic knowledge of the following:-
1- HTML and CSS
2- Python


Inspecting the site's HTML structure

Load the website on the browser and study the html structure. Use what ever tool or browser for this, I used Google Chrome browser and it looks like below:-




Ctrl+U to view source code





FireBug to view html code




Html Inspector (Ctrl+Shift+I)





As you may have noticed, the required dataset to be scrapped are arranged in rows and columns on the web page. This makes things easier since we have a consistent pattern to follow.

Wednesday, October 4, 2017

Dynamically generate HTML file from CSV data using Python

Hello there,

Assuming you have bunch of dataset in a CSV file and you want to dynamically add them on to a HTML file to upload on a web server so the someone on the other part part of the world could access and view it on the web. And you don't want to share the raw CSV file instead you want a to share a viewer friendly file such HTML, then this article is for you.

Below is the out of the script that collects data from a CSV file and populate a HTML file.



The script is as simple as below...

So, basically we just import the CSV module and read in the csv file. Then we used the open() method to create a html file in the working directory and write lines of standard html code in it.

import csv


csv_list = []
      
try:
    with open('registrant_data.csv', 'rU') as csvfile:
        readCSV = csv.reader(csvfile)
        for row in readCSV:
            csv_list.append(row)
 # ========= Create html file ================

    with open('../nametags8gen.html','w') as html8:
        html8.write('<html>')
        html8.write('<head><title>Title of the page...</title> <link rel="stylesheet" type="text/css" href="./nametags8gen.css"></link></head>')
        html8.write('<body>')
 # more algorithms to fetch csv records...

        html8.write('</html>')
        html8.write('</body>')
         

To generate new html with new contents, just update the CSV file and run the script.

That is it.
Thanks for following...