My personal blog around GNU/Linux

I have been a python guy for almost a year. Learning it & loving it.Now wanted to get into web-development with Django, though initially started with Flask, to get better understanding of what goes under the hood.

While browsing through the internet came across certain sites which one might find useful to get started with Django.

  1. Djangoproject.com – Official website for Django which itself contains a very good documentation to get started with.
  2. Djangorocks.com – A site which helps to know facts behind Django and with snippets and tutorials along with.
  3. GettingStartedwithDjango.com – a site which takes the beginners getting started to advanced level.
  4. Djangopackages.com – List of almost all the available packages for web-development with  Django, categorized.
  5. Djangobook.com – Yet another wonderful Free online book.

So, what are you waiting for? Dive into Django now.

Bash – Sqlite3

Wanted to use a very light weight file based Database Engine and Sqlite3 was my 1st choice. I am making this post on basic commands on Sqlite3 for my anytime reference.

Installing

sudo apt-get install sqlite3

Starting and using Basic commands

  1. $sqlite3 db_name.db – creates a new db with the give name
  2. sqlite3>.databases – list the available databases
  3. sqlite3>.tables – list the existing tables inside the selected database
  4. sqlite3>.schema tablename – displays the structure of the table.
  5. sqlite3>create table tablename (field1 datatype, field2 datatype, etc…);
    Eg:- create table test(id INTEGER PRIMARY KEY AUTOINCREMENT, name CHAR(40));
  6. sqlite3>insert into tablename(fields) values(values);
    Eg:- insert into test(NULL,”Pras”); or
    insert into test(id,name) values(NULL,”Pras”);
  7. sqlite3>update tablename set fieldname=value where fieldname=value;
    Eg:- update test set name=”Prasanna” where name=”Pras”;
  8. sqlite3>select * from tablename;
    Eg:- select * from test; or
    select * from test where name=”Prasanna”;
  9. sqlite3>drop table test; – deletes my table even from the entry
  10. sqlite3>delete from tablename – deletes the values and schema of the table.
  11. sqlite3>.quit – Get out of sqlite shell prompt and return to Bash.

 

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

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. :-)

Follow

Get every new post delivered to your Inbox.