This BLOG is not managed anymore.

How to Fix/Solve the Website Screen Resolution Problem ?

For long times I have been looking for solution to fix my

Website Resolution problem

. Initially I tried all the responsive design and all that, But nothing works. Then a thought pop up in my Mind about

adjusting website resolution

as per Screen Size of any resolution.

Solution is even more easier than it look.

CSS Provides property named scale which can scale the size(width x height) of any element in the document.

For example, <div id ="t_div"></div>
Now we can scale the size of the division as follow:


#t_div
{
-moz-transform:scale(1.5,1.5); //for Firefox
}

Above code will increase the size of division by x1.5 .

First of all suppose that you have your Website designed for fix size say, WIDTH x HEIGHT(e.g. 1280 x 768, 1366 x 768 etc.).

Now we will use this property of CSS to scale our website's main Tag(<html>) to adjust size according to screen size.

But we have to scale <html> tag dynamically according to screen size. For this we will use jQuery-a javascript library, to

apply CSS Property dynamically

.

Step - 1:

Apply the following CSS to your index page.


html{
 position:absolute;
 margin:0px;
 padding:0px;
}
body{
   position:absolute;
   padding:0px;
   margin:0px; 
   top:0px;
   left:0px;
//set height and width property at its maximum size in 'px' value.
}
step - 2:

Link the jQuery to your link page.you can download the local copy of jQuery OR link the online jQuery by using following tag.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

step - 3:

Now copy the following code to in your javascript.


$(document).ready(function() {

//Other code ...

/*HEIGHT and WIDTH below is your screen size not the your browser's
inner Size. AND if your width is 1280px then replace WIDTH by 1280.0 
(Note 0 after point)in the code below and same for HEIGHT.*/

factor_x = ($(window).width()) / WIDTH;
factor_y = ($(window).height( ))/HEIGHT;

$('html').css("transform","scale("+factor_x+","+factor_y+")");  
//For Firefox
$('html').css("-moz-transform","scale("+factor_x+","+factor_y+")"); 
      
//For Google Chrome
$('html').css("-webkit-transform","scale("+factor_x+","+factor_y+")");

//For Opera
$('html').css("-o-transform","scale("+factor_x+","+factor_y+")");

});

After doing this thing properly, Check your Website for various resolution. It should work.

What we are doing is scaling the <html> tag Up or Down, keeping aspect ratio of screen constant.

In case of any difficulty please comment below.

Was this Information helpful?

Yes No


How to Install MongoDB (NoSQL database) on Windows 7?

In this post i am gonna show you how to install MongoDB, a NoSQL Database, on Windows.

First of all download Related version of MongoDB from http://www.mongodb.org/downloads.There are three types of build is available for windows.

  • 64-bit 2008R2+, Use this build if you are running with 64-bit Windows Server 2008 R2, Windows 7, or greater.
  • 64-bit, Use this, If you are using 64-bit version of windows.
  • 32-bit, Use this, If you are using 32-bit version of windows.

You can check your operating system architecture by - 1) Right click on "My Computer" > Property OR 2) Running wmic os get osarchitecture command in command prompt

After downloading ZIP file, Unzip it. Run this command "move C:\mongodb-win32-* C:\mongodb" ,just to change complex name of folder to "mongodb".

MongoDB requires data folder to store its data. MongoDb stores data in db folder created inside the data folder. This folder will not be created automatically, you have to create it manually.

Now default path for this data directory should be C:\data\db but you can Specify alternate path using following command C:\mongodb\bin\mongod.exe --dbpath "d:\test\data"

Starting MongoDB server from command prompt

To Start MongoDB server from command prompt run C:\mongodb\bin\mongod.exe command. This will start MongoDB server. Prompt will show waiting status. By default server will run on localhost port no 27017. You can change port by starting server using C:\mongodb\bin\mongod.exe --port PORTNO command.

To connect with server we will use mongo.exe shell. Run C:\mongodb\bin\mongo.exe command.

Thats All !!. Now Every time you want to use MongoDB, you have to start server and then run mongo.exe shell. To avoid doing this, you can run MongoDB service , which will start every time windows boot.

Running MongoDB server as a windows service:

To install service run following command, mongod --bind_ip IPADDR --logpath "d:\test\log\mongodb.log" --logappend --dbpath "d:\test\data\db" --port PORTNO --serviceName NAMEofSERVICE --serviceDisplayName "SERVICEDISPLAYNAME" --install. Every attribute in this command is easily understood.

To start service you can use net start NAMEofSERVICE command. And to stop service you can use net stop NAMEofSERVICE command.

If every thing goes well, you have successfullly installed MongoDB on your windows Machine.

Was this Information helpful?

Yes No


Django: How to use Python in Web Application Development- Part 2

In this post I am going to demonstrate how to develop basic and very first website using Django - A Python Web Framework. First of all, You need to have Python and Django installed on your machine. In my previous post I have already explained how to install Django on both Linux and Windows. After installation is completed, you can start your first project.

For better understanding create new directory for Django(just for convenience). To start project run django-admin.py startproject firstproject command in your working directory. ("firstproject" is just a name of Project, you can replace it with any name).

It will create project directory named firstproject. There will be two directory, Outer firstproject and Inner firstproject. If you are using Linux you have to change permission of every single file and directory. To do this, Goto firstproject directory and run chmod 777 * command.Again goto inner firstproject directory and run the same command.

Outer firstproject directory contains manage.py and inner firstproject directory.

  • manage.py is a command line utility. you can run python manage.py help commnad for help.

  • Inner firstproject directory contains another four files.

Now we will create our first module. Create file named views.py in the Inner firstproject diretory. You can give any name to this file but, it is good convention to call it views.py.

Write the following code in this file.(line starting with '#' is comment line)

views.py #bellow statement will import HttpResponse class from
#django.http module

from django.http import HttpResponse

#Following lines of code define function named "first_project".
#function accepts one argument request. And return HttpResponse
# object which contains string.

def first_project(request):
    return HttpResponse("<h3>Welcome to my First Project</h3>")

Now we have written simple module, But our Django project do not about module we've just created. To explicitly join this module with our project we have to assign particular URL to this module.

To configure URL open urls.py file, which resides in inner firstproject directory.

If we remove comments line it only contains following:

urls.py #Line below import patterns, url and include function from
#django.conf.urls.defaults module

from django.conf.urls.defaults import patterns, include, url

#line written below will import function first_project from
#module views, which we just created above.

from firstproject.views import first_project
urlpatterns = patterns('',
)

Now to configure our module, we will add url(r'^first_project$',first_project) line as argument to patterns function. Code will look something like this.

urls.py from django.conf.urls.defaults import patterns, include, url
from firstproject.views import first_project
urlpatterns = patterns('',
    url(r'^first_project/$',first_project),
)

First argument to URL is Regular Expression and Second argument is name of function we want to call when URL is opened.

For basic understanding of Regular Expression,

  • '^' sign will match staring with first_project/(e.g. first_project/first, first_project/help etc.)
  • '$' sign will match ending with first_project/(e.g. .../first/first_project/, .../help/first_project/ etc.)
In our case it will match string "first_project".

After this our basic project is done. To run it, we have to start Django server.

  • Change to outer firstproject directory
  • run python manage.py runserver command. By default it runs our server on 8000 port.
  • Now open Web Browser and type 127.0.0.1:8000 in addressbar.

If every thing works fine, You should see output "Welcome to my First Project". That's it !! this is your first Web application/Web Site using Django Framework.

Here we have simply returned plain text as response. But for real web site you have HTML code to be rendered on your page.

In the Next part of this tutorial we are going to discuss how you can use template to display/render HTML code on your website. Visit next part at: Using Templates in Django | Python in Web development - Part 3

Was this Information helpful?

Yes No


How to install Python on Windows 7?

If you have Linux installed on your machine, python is already installed on your machine. To install Python on Windows Platform follow the steps given below:

How to install python on Windows?

  • step-1: Download python for windows from http://www.python.org/download/releases/2.7.3/(Download MSI installer).
  • step-2: Run installer and it will install python into c:\python27(number 27 may vary according to version installed).
  • step-3: Now we have to add environment variable for python. For this Goto: Control Panel > User Accounts > Change my environment variable( you can also Goto: Computer > System Property > Advance system setting > environment variables).
  • step-4: Then create New(or edit existing) variable named "path" and give value c:\python27. You also need to add C:\python27\Scripts to your path value (you can provide more than one value separated by semi-colon ).
  • step-5: Now type python in command line window and you will go into python prompt(it will be like ">>>").

If you do all the step correctly then python is installed successfully on your Computer.

See how to create twitter bot using Python at:The Python Tutorial for Twitter Bots

Was this Information helpful?

Yes No


Django: How to use Python in Web Application Development

Since last few weeks I have been Searching about How to develop Web Application using Python ?. Then I found solution to this question.

To use Python in Web Application or Web Development, you have to use Python Framework like Django, Pylons, web2py etc.

One of very Famous Framework is Django which is updated regularly. It is open source project. Web Application is very easy to develop with Django. Since Django is Python Framework, you have to have Python installed on your machine to run Django.

Python is directly available on Linux. To install python on Windows visit How to install Python on Windows platform (If you are using windows, I insist to have look at this post and check for necessary environment variables). Now i Suppose you have python installed on your Machine.

There are two version of Django available to you.

  1. The latest official release and
  2. the development version.

Note: Official release is tested and stable version, while Development version contains latest features of Django.

Now download any version from https://www.djangoproject.com/download/.

How to Install Django on Windows and Linux?

Now for Linux run following Command to Install Django:

  • tar xzvf Django-1.5.1.tar.gz(Unzip the compressed file).
  • cd Django-1.5.1(Directory name may vary as per versino.)
  • sudo python setup.py install(terminal will ask for root password).

And For Windows

  • Unzip the tar file using 7-zip or other software.
  • Goto to directory that contains setup.py file.
  • Run python setup.py install command.

Now Django is installed on your Machine.To check installation Go to your Python interpreter then:

  • run import django command.
  • then run django.VERSION command.
  • You should see output: (1, 5, 1, 'final', 0) (Which shows version of Django on your Machine).

To Develop Website using Django you should have basic knowledge of Python.

In Second part, I have described, In Detail, How to Create very Basic and First Web Application using Django Web Framework

Django is very famous for its documentation, So you can Start developing Website using this Framework. Documentation is available at https://docs.djangoproject.com/. Another Useful link is https://www.djangobook.com/


Was this Information helpful?

Yes No


How to use rst2pdf tool on Windows and Linux

In this post I am gonna write basic tutorial on how create PDF using Rst2pdf tool on windows or linux. Rst2pdf can generate very rich quality PDFs from lightly marked up text files(.rst).

It can be installed easily.On Ubuntu linux you can install it using "Ubuntu software centre". To see how to install rst2pdf on windows visit my previous post How to install rst2pdf on Windows platform . Now I Suppose you have rst2pdf installed on your Computer.

I have explained the code in Following code itself. Browse through the code and read carefully. You might also like to see output PDF file simultaneously(link:how to use rst2pdf - example file).

Note: Space and NewLine is most important in this language.

Input:
Example File
============
.. contents::

.. section-numbering::

.. footer::

 Page: ###Page###/###Total###, Example file.

Section/Header 1
----------------

Texts underlined with '=' will be main header and 
Texts underlined with '-' are Sub-section.

Sub-section
~~~~~~~~~~~

Texts underlined with '~' will be Sub-sub-section

Text format
------------

Texts enclosed within **bold** will be Bold.
And those enclosed within *italic* will be Italicized

* ``Texts in double block-quote`` will lok different.

Auto numbering
~~~~~~~~~~~~~~
#. '#' will number the line automaticaly
#. this will be line number 2. 

Images
~~~~~~

.. image:: logo.png

you can specify attribute of image also

.. image:: logo.png
   :height: 140px
   :width: 250px
   :scale: 100
   :alt: alternate text

you can put inline images also:

Assuming |logo.png| is already there on your machine.

.. |logo.png| image:: logo.png
   :height: 10px
   :width: 10px

Block
~~~~~

* you can put any text like command in box using '::'. 
For example, to convert .rst to PDF enter following command ::

 rst2pdf myFile.rst

* you can number the line as follow:

.. code-block:: c
 :linenos:

 #include 
 int main() {
 printf("Hello World\n");
 return 0;
 }

Links
~~~~~

**Links** can be put in following manner

My Blog ``_

you can put **reference link** like this way.
For example, you can visit my blog  [#]_

.. [#] `<http://khuntronak.blogspot.com/>`_

Lists
~~~~~

* a bullet point using "*"

  - a sub-list using "-"

    + yet another sub-list

  - another item

Copy this code into file myFile.rst and Execute rst2pdf myFile.rst and it will generate myFile.pdf.

You can also run rst2pdf myFile.rst -o outputFileName.pdf .
You can see the output PDF file how to use rst2pdf - example file here.

There are many other things you can do with this markup language/


How to install rst2pdf tool on Windows 7?

rst2pdf is a tool for transforming reStructuredText to PDF using ReportLab. To install rst2pdf on windows you also need python because rst2pdf is coded in python.

If you are working on Linux, Python is already installed on your machine. To know how to install python on windows visit my post on How to install python on windows?

How to install rst2pdf on Windows?

Now download rst2pdf source from https://code.google.com/p/rst2pdf/downloads/list.

  • step-1:Unzip the source and copy this folder into C:\ location.
  • step-2:Goto rst2pdf source directory which contains setup.py file.
  • step-3:Run python setup.py install command and it will be installed.

To convert any .rst file to PDF file Run rst2pdf myfile.rst command and you are done.

To learn how to write reStructuredText (.rst) file visit my post How to use rst2pdf tool to Create PDf file on windows or Linux.

Was this Information helpful?

Yes No


How to Use Webmaster Tool to increase website's Pagerank

In my last post, I have already discussed How to Include Your Website in Google Search Result Using Webmaster Tool.

Now to Increase your Website rank in Google search there are many option available in Google webmaster Tool.We will continue from the last post. Go to your Webmaster Dashboard.

  • Click on "Health" option on left panel of the window.
    • Click on "Fetch As Google" .
    • Then enter URL of the Specific page.
    • You can select from Four option available. Then Click on fetch.
    • In the list Below Click on "Submit to index".
    By doing this Google will fetch your page as Google bot and will index your page.
  • Next, Click on "Index Status".
    • This will show you total Index Page of your site. By clicking on Advanced Tab you can see detailed Graph of your indexed page

  • Click on "Traffic" option. Here you will see three option.
    • "Search Queries" option will show keyword that Indexed your Website OR page on Google Search Result.
    • "Links to Your Site" option will show you Backlinks to your site.
    • "Internal links" will show you Link to your site from(various pages of)your site.
  • Next,Click on Optimization > Sitemaps.
    • Enter URL os Sitemap and Click on "ADD/TEST SITEMAP".
    • If your website is Blog on Blogspot.com Then Default sitemap is:/rss.xml(YourBlogName.bogspot.com/rss.xml) OR /atom.xml(YourBlogName.bogspot.com/Atom.xml).

    • Otherwise you can Generate Sitemap for your Website. It is very easy to Generate Sitemap. There are many other websites available which will Generate Sitemap for you. The One I Used is www.xml-sitemaps.com

    • After Generating Sitemap Upload it to The Directory in which your Index file is. And provide the URL.
    • Then refresh the page. You will see Number of Pages Index from your site.
There are many other option available Which you can explore by your self.

How to Include Your Website in Google Search Result ?

It happens that when you create a new Website It will not appear on the Google even if you write complete URL of your Website.In this post I'm gonna show you how to bring your Website on Google search result using Google Webmaster Tool.And This is the step towards SEO(Search Engine Optimization) of your Website.

How to Use Google Webmaster Tool ?

Step-1:

Goto: www.google.com/webmasters and Sign Up for Google Webmaster tool. Then login into Webmaster Tool.

Step-2:

Click on "ADD A SITE" , and Enter URL of your Website. And Click on "Continue".

Step-3:

Now you have to verify ownership of your Website.

  • If you have hosted your web site on Webspace, Then

    1. Download given HTML file.
    2. And upload it to directory in which the index.html file is.

    3. Click on "VERIFY". And it will be verified.

  • Now if your Website is Blog on the Blogspot or WordPress, Then

    1. Click on "Alternate Methods" tab. There will be three option available.
    2. Select HTML tag and copy the give HTML Code (META tag).
    3. Goto your blogger account > templets > Edit HTML.
    4. Paste the code into HEAD tag.
    5. Click on "VERIFY". And it will be verified.

By Clicking on "VERIFY" you will be redirected to dashboard of your site which will show detailed information about your site. It will look something like this:(Click on Image to see it.)

NOTE: You can add more than one Website to Webmaster Tool.

Your site will be on Google page in one days.You can check this by searching with related term of your site. Obviously it will not be on the first page of Google (it might be, if it has unique and quality content).

You can do more rather than just adding Website to Webmaster Tools.For detailed use of webmaster tools visit next part of this post here: How to increase Your Site Rank in Google Using Webmaster Tool


Was this Information helpful?

Yes No