My personal blog around GNU/Linux

I have been exploring Python for some time and I wanted to create a Qr-code for some reason using Python. Here is how to create QR Images Using it.

Requirements

  1. Python 2.7
  2. python-qrcode library (available from Github.com)
    • Download the source code as zip file
    • Right Click and Extract here the Zip file
    • Open your terminal and navigate to the Extracted folder using ‘cd’ command
    • Then run ‘sudo python setup.py install‘ (Enter your password when prompted)

Code

  1. Open a new file
  2. Copy paste the below code.

#!/usr/bin/python2.7
import qrcode

data = raw_input(“Type something to create QRCode: “) #gets input from user to encode into qrcode
print “\n”

qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L,box_size=10,border=4,) #initialize settings for Output Qrcode
qr.add_data(data) #adds the data to the qr cursor

qr.make(fit=True)
img = qr.make_image()

file_name = raw_input(“Name for the Output image file, just the name without any extension: “)
print “\n”
file_extension = raw_input(“What type of Image? (PNG/JPEG): “)
file_name = file_name+’.’+file_extension
image_file = open(file_name,’w+’) #will open the file, if file does not exist, it will be created and opened.

img.save(image_file,file_extension.upper()) #write qrcode encoded data to the image file.

image_file.close() #close the opened file handler.

3. Save the file with extension ‘.py’ and close the editor

4.  Right click the file -> Properties -> Permissions -> Allow executing file as program

5. Double click the file, and click on ‘Run on Terminal’

run

 

Execution & Output

  1. Type something to create QrCode: Enter any data here that should be encoded into the qrcode image
  2. Name for the Output image file, just the name without any extension: testing
  3. What type of Image? (PNG/JPEG): PNG or JPEG (type any one)

That’s it. The Program ends and you should see a testing.PNG or testing.JPEG file inside the same folder.

You can view it with any Image viewer, You can Scan the image using QRCode scanner app available for Smartphones (After all that is the purpose for today).

The sample Qr-code should look like this

test

Advertisements

TideSDK is an Open Source Software stack used to develop Cross-platfrom Desktop Applications using Web-technologies like HTML, JS, CSS, etc., We have number of toolkits to develop desktop applications like GTK, QT, etc., but there are always complexities involved.

Website:- http://tidesdk.org

1. Download TideSDK 1.3.1 beta and extract the content to ~/.tidesdk folder.

2. Download TideSDK Developer (a kind of IDE like thing which helps you to run, launch, package your apps)

You can get started from here http://tidesdk.multipart.net/docs/user-dev/generated/#!/guide/getting_started

Invitation to participate in Wiki Loves Monuments India 2012.

I wanted to set up a personal web server in my home using which I would love to retrieve pages in my smartphone’s browser. If you are a passionate photographer you can host a photo album web app in your personal server and you can give links who ever visits your home they can use their laptop or smartphone to enjoy your photography!

what do you need?
1. Apache web server
2. A wireless router
3. A smartphone or laptop with wifi

To be continued …

Recently i have visited a site that requires and uses WebGL. WebGL is developed and maintained by Mozilla Developers.

I am using Both Mozilla Firefox and Google Chrome browsers in my GNU/Linux. When i visited the site via Google Chrome, i got a warning that “Eventhough   your OS supports WebGL, please check and update your Graphic Cards for it to work “. I visited the same site via Mozilla Firefox and it just worked smooth without any problem (Since it is from Mozilla, Under Firefox it was enabled by default).

For it to work in Google Chrome, we need to enable it. Here are the steps to enable WebGL in Google Chrome.

Step 1: Open Google Chrome

Step 2: Type chrome://flags in the address bar

Step 3: Press Ctrl + f and type ” Rendering list “, “Override software rendering list” should come up, Now click on Enable and restart the browser.

It should work now. 🙂

Well, i am kind of person inspired by science, especially space science. Recently came across the news (website link mentioned at the end of this article) about one of our sibling Planet Venus is transiting its position and comes exactly between Earth and the Sun, so that Venus will be visible in the day while Crossing the Sun, but should not be viewed through naked eye.

I am so curious about to know how it will look like in the sky on June 6th 5:50 Am IST during the Dawn, since it was also informed Venus will be crossing sun  even before sun rises for India. So We Indians will be able to see the 4 hours of this Spectacular sight. This occurs only in 105 and 122 Years, If we miss it now, then we need to wait for next 105 years and this is incredible.

Out of this curiosity, i just installed Stellarium – A Open Source Planetorium software, which brings you the real sky experience and real time happenings in your Computer. You can travel to future and come back to past (meant about viewing sky happenings) using this Software. So i thought of spotting this Spectacular event in Stellarium to see how it will look like and also i post the screenshot which i took using it and the steps to reproduce 🙂

Note:- I assume you have already downloaded and installed Stellarium in your machine and the steps below works irrespective of the Operating System you use (whatever it is GNU/Linux or Windows or Mac OS)

Step 1:- Set your default location

Start the Stellarium Software and now we need to set our place in Stellarium, so that we make sure it simulates exactly as we see from the place which we live in. To set location press F6 and the type the location or scroll and find it in the list available, if your location is not available select the nearest one.

Click to Enlarge the image

Note:- make sure you also put a ‘ tick ‘ at the check box ” Use as default ” at the bottom-left corner.

Step 2:- Travelling to Future

You can navigate directions using Left and Right arrow keys at the ground and Top and bottom arrow keys for aerial and ground view.
Now its time to set the exact time in the software at which according to news released venus is going to transit. Press F5 and now you should be able to get the Date and Time Settings, so change the date to June 6th 2012 (applies for Indian Time Zone) and the time to ” 6 hours, 00 minutes and 00 seconds ” , if you are not sure refer the below screenshot.

Changing the Timezone

Step 3:- Zoom – In, We are done

We are already done, in order to find any object in the sky using this software all we need to do is to press F3 and type the name of the object, Eg:- “Sun” and press enter, in this case we don’t need to search for Venus, as you might already spotted out Sun out there, just scoll your Mouse wheel or make gestures in your laptop’s trackpad to Zoom-In towards the sun and keep on until you see a small black spot over the Sun. Whoa.. this is how it will look like at the above mentioned Date and time on the sky..  Now click on the black spot over the sun and this is Venus. You can get descriptions on the top-left on the objects you have selected 🙂

Click to Enlarge

Friends don’t miss this Spectacular event live on June 6th early morning during Dawn. Be sure not to see it through naked eye. I hope this link should be very useful to you and serves as a guide with loads of information about this event along with tricks on how to see it live on that day 🙂

http://transitofvenusncra.wordpress.com/2012/05/22/hello-world/

Hope you had good time reading this, Keep sharing to others as they enjoy like how you enjoyed this event 😀

I have come across many tools available for recording our desktop, such as Record My Desktop, Desktop recorder, Eidete (this was available only for Ubuntu).
Currently i am using Fedora 16 “Verne” Operating system and needed a lightweight and a fast desktop recorder which renders the video as soon as the video capture is completed.

The above mentioned Record My Desktop, Desktop recorder, consumes more time to render the video after recording. When i searched through the repository of Gnome applications in Fedora Repository, i came across “BYZANZ” and found it very lightweight command line utility which records the video in “.ogv, .webm, .mp4, .flv , etc” formats and renders the video very faster. Here, i will show how to install and use it in your Fedora system.

Step 1 – To Install, Open Terminal and type the below command:

sudo yum install byzanz

or

su –
yum install byzanz

Step 2 – To see the options available to use:

byzanz-record –help

Step 3: To record the video without audio:

byzanz-record –duration=20 -c testing.webm

The above command will record the video in .webm format with ‘testing.webm’ as file name and for 20 seconds and -c indicates where the cursor moves the video will be captured to that window.

Step 4: To record the video with audio:

byzanz-record –duration=20 -c -a testing.webm

‘-a’ indicates recording of audio.