Pages

QR code: GUI tool for encoding decoding QR codes in linux

In the post "QR code: Encode and Decode QR code on linux command line" we saw usage of a command based tool to create QR codes in linux. Let us have a look at a GUI based tool for the same.

QTQR is gui a tool to create QR (Quick Response) code. We will need to install the tool qtqr



Once installed we can launch the tool from GUI in debian under Applications->graphics->QTQR

 photo app_menu.png

We can launch it from terminal using the command qtqr

This will launch a window as shown below.

 photo screen1.png

To create a QR code we can choose what kind of string we want to encode using the pull down menu at the left top as shown below.

 photo data_type.png

Once selected we can enter the text in the text below at the left and then click on "save QR code" at the right bottom and save the QR image.

 photo screen2.png

The QR image for the text "Hello" would look as below.

 photo Hello.png

To decode a QR code using QTQR click on decode at the right corner. While selecting decode we can either choose a file or choose an image being viewed by a webcam. To test the decode, point to the same QR image of "hello" that we created above and click on open.

 photo hello_decoded.png

As we can see the tool has correctly decoded the image.

Useful links
http://code.google.com/p/qtqr/
http://en.wikipedia.org/wiki/QR_code

QR code: Encode and Decode QR code on linux command line

QR(Quick response) code as defined by google is

A machine-readable code consisting of an array of black and white squares, typically used for storing URLs or other information for reading by the camera on a smartphone.

Here is how we can create QR code in linux using command line.

Using command line:

To create QR code using command line we will need to install the package libqrencode3



After successful install of the package we can encode any string of characters, text,url,numbers, into a QR code as shown below.



Let us say we want to encode the string "Hello" into a QR code.



This will creat a hello.png file in the QR format as shown below.

To be able to decode a QR code on the command line we can use the package zbar.



Once the package is installed we can use the command zbarimg to read a QR encoded file



To decode the hello.png QR we created above



Thus we can see that the QR-Code has been correctly recognized as "Hello "

Useful links: http://en.wikipedia.org/wiki/QR_code http://zbar.sourceforge.net/

Answers to Linux Quiz on semaphores

Answers to Quiz on linux Semaphores

1. Race condition occur when
Ans. There is uncontrolled access to shared data

2. The code that is surrounded by a semaphore is termed as
Ans. Critical section

3. To use a semphore as a mutex, semaphore needs to be initalized to the value of
Ans. 1

4.Which of the following will declare and initialize a mutex
Ans. DECLARE_MUTEX

5. The value of the mutex when it is locked by a process is
Ans. 0

6.To create a semaphore which will attempt to get the lock only once, we can use the function

Ans. down_trylock()
7. The functions down and down_interruptible work in similar fashion

Ans. False

8. The function call to release a semaphore is
Ans. up

9. A reader writer semaphore allows
Ans. Multiple readers or only one writer

10. Sending a signal from one thread to other regarding completion of a task/job can be done optimally using
Ans. Completion


Linux Quiz on semaphores

Quiz on linux Semaphores

Quiz on linux Semaphores

  1. Race condition occur when

  2. There is uncontrolled access to data
    There is uncontrolled access to shared data
    Every time kernel accesses user space data
    Every time user communicates with kernel

  3. The code that is surrounded by a semaphore is termed as

  4. Critical section
    Sema section
    Zero section
    Muted section

  5. To use a semphore as a mutex, semaphore needs to be initalized to the value of

  6. 0
    1
    -1
    2

  7. Which of the following will declare and initialize a mutex

  8. DECLARE_MUTEX
    SEMA_INIT_MUTEX
    DECLARE_SEMA
    MUTEX_CREATE

  9. The value of the mutex when it is locked by a process is

  10. 0
    1
    -1
    2

  11. To create a semaphore which will attempt to get the lock only once, we can use the function

  12. down()
    down_tryonce()
    down_trylock()
    down_interrupt()

  13. The functions down and down_interruptible work in similar fashion

  14. True
    False
    Depends on kernel version
    In case of mutex they are same

  15. The function call to release a semaphore is

  16. up
    up_trylock
    up_interruptible
    All of the above

  17. A reader writer semaphore allows

  18. Multiple readers or only one writer
    Multiple writers or only one reader
    Multiple readers and writers
    Only one reader or writer

  19. Sending a signal from one thread to other regarding completion of a task/job can be done optimally

  20. Mutex
    Semaphore
    Completion
    None of the above

Answers : Answers to Linux Quiz on semaphores