Updates from April, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • Shafiul Azam 12:51 am on April 30, 2012 Permalink | Reply
    Tags: collaboration, , merging   

    Collaborating using git: make merging less painful! 

    Hi, I’m Shafiul! Me along with Ibrahim & Sifat are working in a project which we maintain using git. We’ve decided to follow a simple protocol to merge our works effeciently in a painless way!

    All of us will work in our own branches (learn first about branching if you’re not familiar with it). At the end of the day, the one who finishes his work after the rest of the team, should merge all of our works!

    Say, after working all day long, I figured out Ibrahim was still working before I went to bed. So it became Ibrahim’s due responsibility to merge everyone’s work :)

    The first step is: create a new branch for you, where only you will work, and no one else will touch.

    Create a new Branch named “shafiul”:

    git branch shafiul

    To work in this branch, I need to check-out to work in this branch:

    git checkout shafiul

    While working, Commit any time:

    git add -A
    git commit -m "Message"

    When you’re done, push your commits to the server:

    git push origin shafiul:shafiul

    Note the command: It pushes your commits made in local “shafiul” branch to origin’s (server’s) “shafiul” branch.

    Like me, Ibrahim & Sifat has also crated their own branches named “ibrahim” & “sifat” and they’re working in their branches.


    Merging everybody’s work

    The one who will be merging has to do followings:
    First, download everyone’s commits from origin (server) to his local machine:

    git fetch origin shafiul:shafiul
    git fetch origin ibrahim:ibrahim
    git fetch origin sifat:sifat

    Now time to merge. Check-out to master branch. With this branch, we will merge all other branches.

    git checkout master

    Now merge all other branches with master:

    git merge shafiul
    git merge ibrahim
    git merge sifat

    Cool! master is now merged with everyones code (Congratulations if no conflicts has occurred. But don’t get panicked if conflicts occur, to learn how to resolve conflicts, see the end of this article) – now Push your local “master” to origin (server):

    git push origin master:master

    Everyone’s duty: Update your branches…

    The next day, before working, everyone should update their branches. First, everyone needs to pull updated “master” branch from origin (server) and merge it with your local copy of master branch:

    git checkout master
    git pull origin master:master

    Now your local copy of master branch is updated. Finally, checkout to your own branch and merge it with updated master:

    git checkout shafiul
    git merge master

     
  • Shafiul Azam 12:27 am on November 23, 2011 Permalink | Reply
    Tags: , qt moc, qt moc dir, qt signal slot error, qt troubleshooting   

    Qt Error: undefined reference to `vtable for 

    I was receiving this error once, when I was trying to add signals & slots to one of my classes. I figured out that Qt was having problems with moc files, and there were no moc files being generated.

    To solve the problem, I specified “moc directory” in the project’s .pro file:

    OBJECTS_DIR = debug/obj
    MOC_DIR = debug/moc

    And my problem was solved :D

     
    • Danish 12:27 am on January 29, 2012 Permalink | Reply

      Thanks. This helped me a lot

    • Dewsworld 7:49 pm on March 19, 2012 Permalink | Reply

      I tried your solution but it didn’t work

  • Shafiul Azam 3:53 pm on November 21, 2011 Permalink | Reply
    Tags: documentation, QSerialDevice,   

    QSerialDevice Documentation 

    I didn’t found any doc for QSerialDevice – but what I found was a doxygen file, :P so I generated documentation files. Here I’m uploading them so that people can get the docs without doxygen installing.

    Documentation – version 0.4.0

     

     
  • Shafiul Azam 11:46 pm on August 16, 2011 Permalink | Reply  

    Qt undefined reference to QNetworkAccessManager … Error! 

    To resolve the error, make sure:

    1. To include “network” in your .pro file: QT       += core gui network
    2. Include appropriate headers:

    #include <QtNetwork/QNetworkAccessManager>
    #include <QtNetwork/QNetworkRequest>
    #include <QtNetwork/QNetworkReply>

     
  • Shafiul Azam 9:24 am on May 21, 2011 Permalink | Reply
    Tags: cgi with apache2, python with apache   

    Run Python script as CGI program with Apache2 in Linux / Wamp in Windows 

    If you’ve Apache & Python installed, you can execute your python scripts as CGI programs, which your visitors can access if you host the scripts in a server. You can write your scripts in python (file-name will end with .py) or in perl (extention .pl) or anything else which is compatible.

    Step 1 – Write a “Hello, World! ” script in Python

    In a text editor, type following code. Give the file name “first.py

    #!/usr/bin/env python
    print "Content-type: text/html\n"
    
    print "Hello, world!"
    
    

    The first line is important – it tells where in our computer Python is available. If you’re using windows, use appropriate location, for example, change the first line to something like:

    #!C:/Python27/python.exe
    

    Step 2 – Put the script in a suitable directory

    Important: If you are in Linux, make your file executable! Type:

    chmod +x /path/to/your/first.py

    Pretty simple!

    1. Let’s rename the file to first.py and make it executable, if we’re in Linux.
    2. Put it in a directory named “cgi-bin” under our document root. Then, the file may be accessed in the web-browser by simply typing: http://localhost/cgi-bin/first.py

    Step 3 – Configure Apache2

    Next step is to configure Apache so that it treats our file as a CGI program. Go to the directory where your Apache configuration file exists. In Linux, it resides under /etc/apache2/ and the configuration file is httpd.conf

    NOTE: If virtual hosts are enabled (normally the are enabled), changing the httpd.conf will have no effect. You may need to edit particular configuration file for the site which is enabled. Go to the sites-enabled  directory and open the file which is currently enabled (If you have only the file “default” in your /etc/apache2/sites-enabled directory, you should open this file with your text editor)

    NOTE: If you are in windows, and using Wamp, you can simply open the httpd.conf file and make following changes.

    Edit the configuration file:

    Search for the line: ScriptAlias /cgi-bin/ /whatever-path/ – when you find it, comment out the line: that is add a # in front of the line:

    #ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

    Then,  paste following lines of code:

    <Directory "/location/to/your/cgi-bin/">
    AddHandler cgi-script .cgi .py
    AllowOverride All
    Options +Indexes FollowSymLinks +ExecCGI
    Order allow,deny
    Allow from all
    </Directory>
    

    If your first.py is in /var/www/cgi-bin/ folder, then replace the first line by <Directory “/var/www/cgi-bin”>

    You’re done! Now restart Apache to activate all changes.

    If you’re in Linux, open a terminal and enter sudo /etc/init.d/apache2 reload to restart Apache. If you’re using Wamp in Windows, you can restart Apache clicking appropriate icons!

     

    Test…

     

    Fire up your web browser, type http://localhost/cgi-bin/first.py and hit Enter…

     

    If you find only the text:

    Hello, world!

    in the page, then congratulations!

    If you find any other text than Hello, world!, something went wrong. Check for your mistakes. Ensure that “cgi_module” Apache module is enabled.

     

    You may find this link helpful.

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel
Follow

Get every new post delivered to your Inbox.