built-in Python modules you should know

June 27, 2014 Leave a comment

Originally posted on Python Adventures:

Here is an interesting thread about built-in modules that you should know: http://redd.it/28yo37 . If you wonder how to improve your Python knowledge, check ‘em out.

In the thread some useful 3rd party modules are also listed.

View original

Categories: uncategorized

Online learning: extend your CV

June 27, 2014 Leave a comment
Categories: uncategorized

Packaging a python library

June 1, 2014 Leave a comment
Categories: Interesting, python

Arrow better dates and times for Python

May 20, 2014 Leave a comment

Arrow is a Python library that offers a sensible, human-friendly approach to creating, manipulating, formatting and converting dates, times, and timestamps. It implements and updates the datetime type, plugging gaps in functionality, and provides an intelligent module API that supports many common creation scenarios. Simply put, it helps you work with dates and times with fewer imports and a lot less code.


Categories: Interesting, python

Top 10 mistakes that python programmers make

May 12, 2014 Leave a comment

International Day against DRM

May 6, 2014 Leave a comment
Categories: Interesting

FLTK – Hello World

April 2, 2014 Leave a comment

Currently reading Programming Principles and Practise Using C++ book.

Faced an issue setting up FLTK (Fast Light Toolkit) on debian.

The installation steps are straight forward as per the README.Unix.txt in the download from www.fltk.org.

#include <FL/Fl.H> 
#include <FL/Fl_Box.H>
#include <FL/Fl_Window.H>

int main()
    Fl_Window window(200, 200, "Window title");
    Fl_Box box(0, 0, 200, 200, "Hey, I mean, Hello World!");
    return Fl::run();

When I tried to compile it. I got the following errors. This was due to the g++ not knowing where to get the fltk files from.

$ g++ hello_fltk.cpp -o hello_fltk
/tmp/cccdL9E5.o: In function `main’:
hello_fltk.cpp:(.text+0x2d): undefined reference to `Fl_Window::Fl_Window(int, int, char const*)’
hello_fltk.cpp:(.text+0×61): undefined reference to `Fl_Box::Fl_Box(int, int, int, int, char const*)’
hello_fltk.cpp:(.text+0x6d): undefined reference to `Fl_Window::show()’
hello_fltk.cpp:(.text+0×72): undefined reference to `Fl::run()’
hello_fltk.cpp:(.text+0x8c): undefined reference to `Fl_Window::~Fl_Window()’
hello_fltk.cpp:(.text+0xae): undefined reference to `Fl_Window::~Fl_Window()’
/tmp/cccdL9E5.o: In function `Fl_Box::~Fl_Box()’:
hello_fltk.cpp:(.text._ZN6Fl_BoxD2Ev[_ZN6Fl_BoxD5Ev]+0xb): undefined reference to `vtable for Fl_Box’
hello_fltk.cpp:(.text._ZN6Fl_BoxD2Ev[_ZN6Fl_BoxD5Ev]+0×16): undefined reference to `Fl_Widget::~Fl_Widget()’
collect2: error: ld returned 1 exit status

To compile run

$ fltk-config --compile hello_fltk.cpp
g++ -I/usr/local/include -I/usr/local/include/FL/images -I/usr/include/freetype2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT -o 'hello_fltk' 'hello_fltk.cpp' /usr/local/lib/libfltk.a -lXext -lXft -lfontconfig -lpthread -ldl -lm -lX11

From the README

FLTK provides a neat script named “fltk-config” that can provide all the flags
needed to build FLTK applications using the same flags that were used to build
the library itself. Running “fltk-config” without arguments will print a list
options. The easiest call to compile an FLTK application from a single source
file is:

fltk-config –compile myProgram.cxx

This shows you the correct way to compile using g++. On running the file you get the simple window below.



Useful links:



The book has the header files as

#include <FL/Fl.h> 
#include <FL/Fl_Box.h>
#include <FL/Fl_Window.h>

But the files are saved with .H and will generate an error like the one below.

hello_fltk.cpp:1:19: fatal error: FL/Fl.h: No such file or directory

Categories: cpp Tags: ,

Get every new post delivered to your Inbox.

Join 36 other followers