Search This Blog

Wednesday 12 September 2012

Getting Started with Gitorious

What is Gitorious?

    Gitorious is a  online project hosting service just like the sourceforge.net but with Git source code management system as its backend.

What is Git?

    Go to google.com and type Git in the search engine and click on "I'm feeling lucky" button. There are lot of tutorials available online. I recommend you to learn Git first.

Why I use Gitorious?

   No special reasons. I prefer free and open source options.


   This is two phase process.  Firstly we have setup remote repository in Gitorious.org and secondly, we have to setup the  local repository in our system. This video will walk you through these two phases.


For further reading:
  +Stack over post
     [http://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide]
 + Git book
    [http://git-scm.com/book]

Leave your comments please...

Saturday 25 August 2012

Developing Open Source Softwares.

   The first step is to read and understand the source code of the concerned project. The time taken to understand the source code depends upon the size and complexity of the project.

   The easiest way to understand the source code is to run the test files offered by the developers. If unfortunately the test files are not available, then you have to setup the developing environment and debug the source code. Keep in touch with the developer community all the time.

   Use IDE's like Eclipse or Code::Blocks for reading the source code for moderately sized projects, or use Emacs and VI in conjunction with extensions like autocomplete, ctags and cscope(for code assistance), for large and complex projects since the IDE's are memory hunger.

Debugging Python Source code

   This is milestone in my path. Yes, today I managed to build and debug the source code of python interpreter, with help from python development community.

   Python is dynamic programming language by design. Its compiler or interpreter is implemented in C language. Both are my favorite. Okay lets come back to business. AFAIK CPython is core of python language, and all other C api and python modules are built over it.

    Few days ago, I have posted food4thought post for making a OS especially for programmers. That is now became an idea. Soon we are gonna make it.

   Here is a screenshot of todays work. It just took 30 working minutes :D

 I'm gonna write a series of post on how to get started contributing to the open-source community. Debugging the source is one the most effective method of getting to know the source, and python is a good one to start digging before getting yours hands dirty with large and complex programs.Happy debugging :D :D

Saturday 11 August 2012

Experiment with OpenCV

    We have started the process for making our project. You can monitor the process, in our project blog Project Athena. Here is a demonstration, that I have done this evening. This video summarizes, a tutorial written in OpenCV doc. In my previous, I did explained how to compile a OpenCV program.



   The program demonstrated loads and plays a video present in the current directory and provides a slider to position the current frame. Happy Coding !!!

Saturday 28 July 2012

Get Started: OpenCV development

    Setting up OpenCV development environment in Ubuntu 12.04. In general, if you want to use any of the development libraries or API's, you need to download the development packages. This packages contains headers required, and pre-compiled libraries available for linking from our executable or our custom library. In ubuntu, these packages are suffixed with "-dev".
 for example: libopencv-dev, libcv-dev.
Installing OpenCV:
   Installing opencv development libraries is very simple. I have used Synaptic Package manager to install opencv libraries, and their dependencies.

Here is the screenshot:

   Second one is the source code editor setup. Setting up an source editor requires another separate post. I'll use emacs and will post the instruction soon.

    Then comes the compilation part. Almost all the projects written in C/C++ use GCC/G++ compiler for compilation.

Compilation command syntax is:
  gcc -oOutputFilename SourceFilename.c `pkg-config opencv --cflags --libs`

where, gcc : compiler,
            OutputFilename : the name of the compiled executable or library,
            SourceFilename.c: the name of file containing source code,
            pkg-config: a utility used ease the job for including library headers.
                  pkg-config arguments.
                         opencv: tell the pkg-config utility to provide the paths for
                         libraries related to OpenCV.
                         - -cflags: option to obtain paths to headers.
                         - -libs:     option to obtain paths to libs.

     and note that it's  | ` | and not |  ' | in the compilation command.

Friday 20 April 2012

Packing Widgets in GTKmm: My Experiment

Yes. This code compiles successfully. I have just completed an experiment based on the tutorial  from Programming with GTKmm by Murray Cumming.


Here is the code:

main.cpp
#include<gtkmm.h>
#include "MyWindow.h"


int main(int argc,char** argv)
{
    Gtk::Main kit(argc,argv);
    MyWindow window;
    Gtk::Main::run(window);
    return 0;
}


MyWindow.h

#ifndef GTKMM_TUT_CHKBUTTON_H
#define GTKMM_TUT_CHKBUTTON_H
#include<gtkmm.h>
#include<gtkmm/window.h>
class MyWindow: public Gtk::Window
{
    public:
        MyWindow();
        ~MyWindow();


    protected:
        //Signal Handlers
        //virtual void OnChkDisplayFlag_Toggled();
        virtual void OnBtnClose_Clicked();
        //virtual void OnAdjDigit();
        //virtual void OnAdjPageSize();


        Gtk::VBox m_vbxMain, m_vbxScale_Scroll;
        Gtk::HBox m_hbxVert_Horiz, m_hbxValuePos, 
              m_hbxUpdatePolicy, m_hbxDigit, m_hbxPageSize;


        Gtk::CheckButton m_chkDisplayFlag;
        Gtk::Label m_lblValuePos, m_lblUpdatePolicy,
                                 m_lblDigit, m_lblPageSize;


        //ComboBox
        Gtk::ComboBox m_cbxValuePos, m_cbxUpdatePolicy;


        class ModelColumns : public Gtk::TreeModelColumnRecord
        {
            public:
                ModelColumns()
                {
                    add(m_iID); add(m_sChoice);
                }
                Gtk::TreeModelColumn<int> m_iID;
                Gtk::TreeModelColumn<Glib::ustring> m_sChoice;
        };


        ModelColumns m_MC_UpdatePolicy, m_MC_ValuePos;
        Glib::RefPtr<Gtk::ListStore> mpLS_ValuePos, 
                                       mpLS_UpdatePolicy;


        Gtk::Adjustment m_adjVert, m_adjDigit, m_adjPageSize;
        Gtk::VScale m_vscVert ;
        Gtk::HScale m_hscHoriz,m_hscDigit,m_hscPageSize;
        Gtk::HScrollbar m_hsScroll;


        Gtk::HSeparator m_hspSep;
        Gtk::Button m_btnClose;


};
#endif //GTKMM_TUT_CHKBUTTON_H


MyWindow.cpp
#include"MyWindow.h"
#include<stdio.h>


MyWindow::MyWindow()
:
    m_vbxMain(false,30),
    m_vbxScale_Scroll(false,10),
    //m_vbxCloseButton(false,10),


    m_hbxVert_Horiz(false,10),
    m_hbxValuePos(false,10),
    m_hbxUpdatePolicy(false,10),
    m_hbxDigit(false,10),
    m_hbxPageSize(false,10),


    m_chkDisplayFlag("Display values in the Widgets",0),


    m_lblValuePos("Value Position"),
    m_lblUpdatePolicy("Update Policy"),
    m_lblDigit("Scale Digits"),
    m_lblPageSize("Page Size"),


    //Gtk::Adjustment::Adjustment (value,lower,upper,
                       step_increment,page_increment,page_size)
    m_adjVert(0.0 , 0.0, 101.0, 0.1, 1.0, 1.0),
    m_adjDigit(1.0, 0.0, 5.0),
    m_adjPageSize(1.0, 0.0, 101.1),


    m_hscHoriz(m_adjVert),
    m_vscVert(m_adjVert),
    m_hscDigit(m_adjDigit),
    m_hscPageSize(m_adjPageSize),


    m_hsScroll(m_adjVert),


    m_btnClose("Close")
{
    set_title("Ranging Widgets");


    //Vertical Scaler widget
    m_vscVert.set_update_policy(Gtk::UPDATE_CONTINUOUS);
    m_vscVert.set_digits(1);
    m_vscVert.set_value_pos(Gtk::POS_TOP);
    m_vscVert.set_draw_value();




    //Vertical Scaler widget
    m_hscHoriz.set_update_policy(Gtk::UPDATE_CONTINUOUS);
    m_hscHoriz.set_digits(1);
    m_hscHoriz.set_value_pos(Gtk::POS_TOP);
    m_hscHoriz.set_draw_value();
    m_hscHoriz.set_size_request(200,30);


    m_hscDigit.set_update_policy(Gtk::UPDATE_CONTINUOUS);
    m_hscDigit.set_digits(1);
    m_hscDigit.set_value_pos(Gtk::POS_TOP);
    m_hscDigit.set_draw_value();
    m_hscDigit.set_size_request(200,30);


    m_hscPageSize.set_update_policy(Gtk::UPDATE_CONTINUOUS);
    m_hscPageSize.set_digits(1);
    m_hscPageSize.set_value_pos(Gtk::POS_TOP);
    m_hscPageSize.set_draw_value();
    m_hscPageSize.set_size_request(200,30);




    //ComboBox-ValuePos
    mpLS_ValuePos = Gtk::ListStore::create(m_MC_ValuePos);
    m_cbxValuePos.set_model(mpLS_ValuePos);


    Gtk::TreeModel::Row row = *(mpLS_ValuePos->append());
    row[m_MC_ValuePos.m_iID] = 1;
    row[m_MC_ValuePos.m_sChoice] = "Top";




    row = *(mpLS_ValuePos->append());
    row[m_MC_ValuePos.m_iID] = 2;
    row[m_MC_ValuePos.m_sChoice] = "Right";


    row = *(mpLS_ValuePos->append());
    row[m_MC_ValuePos.m_iID] = 3;
    row[m_MC_ValuePos.m_sChoice] = "Bottom";




    row = *(mpLS_ValuePos->append());
    row[m_MC_ValuePos.m_iID] = 4;
    row[m_MC_ValuePos.m_sChoice] = "Left";


    m_cbxValuePos.pack_start(m_MC_ValuePos.m_iID);
    m_cbxValuePos.pack_start(m_MC_ValuePos.m_sChoice);


    //ComboBox-UpdatePolicy
    mpLS_UpdatePolicy =Gtk::ListStore::create(m_MC_UpdatePolicy);
    m_cbxUpdatePolicy.set_model(mpLS_UpdatePolicy);


    row = *(mpLS_UpdatePolicy->append());
    row[m_MC_UpdatePolicy.m_iID] = 1;
    row[m_MC_UpdatePolicy.m_sChoice] = "Continuous";


    row = *(mpLS_UpdatePolicy->append());
    row[m_MC_UpdatePolicy.m_iID] = 2;
    row[m_MC_UpdatePolicy.m_sChoice] = "Discontinuous";


    row = *(mpLS_UpdatePolicy->append());
    row[m_MC_UpdatePolicy.m_iID] = 3;
    row[m_MC_UpdatePolicy.m_sChoice] = "Delayed";


    m_cbxUpdatePolicy.pack_start(m_MC_UpdatePolicy.m_iID);
    m_cbxUpdatePolicy.pack_start(m_MC_UpdatePolicy.m_sChoice);




    m_btnClose.set_flags(Gtk::CAN_DEFAULT);
    m_btnClose.grab_default();
    m_btnClose.signal_clicked().connect(
          sigc::mem_fun(*this,&MyWindow::OnBtnClose_Clicked));


    //Packing
    add(m_vbxMain);
    m_vbxMain.pack_start(m_hbxVert_Horiz);
    m_vbxMain.pack_start(m_chkDisplayFlag);
    m_vbxMain.pack_start(m_hbxValuePos);
    m_vbxMain.pack_start(m_hbxUpdatePolicy);
    m_vbxMain.pack_start(m_hbxDigit);
    m_vbxMain.pack_start(m_hbxPageSize);
    m_vbxMain.pack_start(m_btnClose);


    m_hbxVert_Horiz.pack_start(m_vscVert);
    m_hbxVert_Horiz.pack_start(m_vbxScale_Scroll);


        m_vbxScale_Scroll.pack_start(m_hscHoriz);
        m_vbxScale_Scroll.pack_start(m_hsScroll);


    m_hbxValuePos.pack_start(m_lblValuePos);
    m_hbxValuePos.pack_start(m_cbxValuePos);


    m_hbxUpdatePolicy.pack_start(m_lblUpdatePolicy);
    m_hbxUpdatePolicy.pack_start(m_cbxUpdatePolicy);


    m_hbxDigit.pack_start(m_lblDigit);
    m_hbxDigit.pack_start(m_hscDigit);


    m_hbxPageSize.pack_start(m_lblPageSize);
    m_hbxPageSize.pack_start(m_hscPageSize);
    show_all_children();
}


MyWindow::~MyWindow()
{


}


void MyWindow::OnBtnClose_Clicked()
{
    printf("\nI'm over.. !!");
    hide();
}








Saturday 14 April 2012