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