First wxWidget Program

After learning some wxWidgets basic, lets open new article for discussing a simple application.

In this article we will cover a basic in creating a wxWidget frame and show how to display an icon. Next we will create a simple example demonstrating usage of an event. Finally, we will see, how widgets communicate in wxWidgets applications.

A simple application

First we create the very basic wxWidgets program.

/** filename: simple.h **/
#include <wx/wx.h>

class Simple : public wxFrame
{
public:
Simple(const wxString& title);

};

/** filename: simple.cpp **/
#include "simple.h"

Simple::Simple(const wxString& title)
: wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150))
{
Centre();
}

/** filename: main.h **/
#include <wx/wx.h>

class MyApp : public wxApp
{
public:
...

Read More

Getting Started with wxWidgets

People who are completely new to wxWidgets would normally follow the steps illustrated below.

WxGettingStartedRoadmap

In this article we will set our environment for developing a wxWidget application.

Installing wxWidgets and Setting up IDE

When developing application using wxWidget, we can choose whether use helping from IDE or not. For an overview of IDEs that have been reported to work with wxWidgets, you can see the list of IDEs on wxWidgets site.

We won’t cover installation of any IDE in this section, but I would recommend you to install one.

Your main guide for compiling wxWidgets should be the installation instructions : Look in <code-base-dir>/docs/.

On Windows

<to be continued>

On Linux

Getting Started

Before getting started, make sure you have installed all necessary build tools, including g++ and aut...

Read More

wxWidget Helper Classes

wxWidgets consists of a large group of helper classes, that help programmers to do their job. These include classes for working with strings, files, XML files, streams, database or network.

In this article, we will discuss about some helper classes that frequently used or useful for developing with wxWidget later. We will also illustrate some of the helper classes in simple console-based applications (although we can also use GUI applications).

Console

This is a simple console application. The application puts some text into the console window.

/** filename: console.cpp **/
#include <wx/string.h>

int main(int argc, char **argv) {
wxPuts(wxT("A wxWidgets console application"));
}

You should get output, a string “A wxWidgets console application” on your terminal.

wxString

wxString is a cl...

Read More

Introduction to wxWidgets Toolkit

In beginning it is known as wxWindows.

wxWidgets is a GUI (Graphical User Interface) toolkit and library for creating C++ applications. It is an open source, mature and cross-platform toolkit. wxWidgets applications run on all major OS platforms, Windows, Unix and Mac. The project was started by Julian Smart in 1992. wxWidgets is much more than a toolkit. It provides a large variety of classes for handling streams, databases, threads, online help or application settings. wxWidgets consists of a large group of widgets.

Official site of wxWidget is http://www.wxwidgets.org/

To use tutorial in this site, you should have wxWidget installed. I use wxWidget 2.9.4 mainly and can be downloaded from here http://www.wxwidgets.org/downloads/.

wxWidgets gives you a single, easy-to-use API for writing ...

Read More

Basic Programming: Designing a Good Program

The goal of every programmer is producing a good program. Nearly all programmers strive to sharpen their skill in coding and engineering stuff. But programming is not only matters of code.

A good program is a program which is not only having good response and robust. But we should not forget that other factors are important for a project.

In this article, I list some characteristic of good program design according to me.

Minimal Complexity

The main goal in any program should be to minimize complexity.  As a developer, our time will be maintaining or upgrading existing code. If it is a complete mess, then your life is going to be that much harder. Try and avoid those solutions where you use a one line complex solution to replace 20 lines of easy to read code...

Read More

How DNS Works?

Computer / machine only recognize numbers and all data are stored as symbols. However human tends to easily recognize information in format of name. Instead of IP address such as 167.205.1.34, people can remember name such as itb.ac.id. Therefore, to bridge two different system, a DNS is created.

DNS is a server for translating name in human representation to number (IP address) which is known by computer.

DNS is a distributed database in the purpose of identifaction and naming nodes on Internet. The term distributed in this concept refer to the concept that DNS server only store hostnames or computers or nodes under its authorities only. DNS will not store information of nodes for domain which doesn’t belong to its authority.

For example:

Let say there is a DNS server on domain xathrya...

Read More

DNS Cache vs Authoritative

A DNS Server has two main functions. It can acts as a resolver / cache, and it can also acts as authoritative server.

Authoritative DNS is a DNS server who manage or have authority over DNS under its domain. This domain will answer any query for any domain under it authority. For example: DNS on xathrya.web.id will only responsible to translate domain name under xathrya.web.id such as mail.xathrya.web.id, labs.xathrya.web.id, etc. It will not and can not answer other domain outside of its authority.

A physical DNS, can has authority over two or more domain. For example, the domain celestial-links.net is under the same authority of domain which manage xathrya.web.id.

Another function DNS Server had is cache / resolver...

Read More

Installing OpenLDAP 2.4 on Debian Squeeze

OpenLDAP is one of software that implement Lightweight Directory Access Protocol (LDAP).

In this article we will do installation of OpenLDAP on Debian. Technically say, we will install OpenLDAP 2.4 which is provided by Debian repository. The benefits of LDAP, and OpenLDAP specifically, is we can achieve Single Sign On to other services such as FTP, SSH, etc. The LDAP will act as back-end which authenticates user.

OpenLDAP consists of some packages, but basically we can be categorized them as three categories: main application (daemon), supporting application, and packages for extending LDAP functionalities (as well as libraries for other applications).

In this article we will use Debian 6.0.7 (Squeeze) for amd64 with following packages:

  1. slapd
  2. ldap-utils
  3. db4.8-util

The method we use here ...

Read More

LDAP Scheme

To declare a directory or an object, LDAP used scheme system.

Scheme or schema is simply a packaging unit. It is a collection of valid object class and attributes. The attributes are declared and registered through LDAP system and can be widely known by it. Every object class and attributes must be defined inside of scheme. An attribute defined in one schema can be used by an objectclass defined in another schema.

It is wise to say scheme is like a blueprint of object. When we want to instantiate / create an object, we should refer to the blueprint. Object defined outside of blueprint won’t be recognized / not accepted.

Even after declaring objects and attributes inside of scheme, the scheme won’t be used unless it is included in the configuration file.

Schema decides what information are ...

Read More

LDAP Attributes

Attribute is the atomic structure of schema and a member of object class. Attribute typically contain data.

Every attribute is included in one or more object classes. Therefore, some object class might have same attribute. Once defined in a schema, it can also be used by any object class.

Attribute has a name as identifier. The name is used for identifying the attribute, distinguish one attribute from other attribute. Attribute should be unique. Attribute is also a container for value(s). It is an entry of which value is stored. The value could be a single-value or multi-value.

To define an attribute, we have following syntax:

attributetype whsp "(" whsp
numericoid whsp
[ "NAME" qdescrs ]
[ "DESC" qdescrs ]
[ "OBSOLETE" whsp ]
[ "SUP" woid ]
[ "EQUALITY" woid ]
[ "ORDERING" woid ]...
Read More