Friday, December 18, 2009

How to register your Free domain.co.cc with Google apps

After countless frustration with Plesk about how to get my domain to work.
I decided to give 'free' a try
And Co.cc is wonderful option . it just works.
This is how i did it

Go to
http://www.co.cc
Search for your domain. Register the CNAME record as :

http://www.co.cc/google_apps/google_apps.php

check it with Google apps.
You're done.


With Plesk. I also found a very helpful tutorial but it doesn't work for me yet
http://branchwire.com/support/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=1#

Tuesday, December 15, 2009

Simple Useful CSS tutorial

After wasting time with other website i found it

http://www.webcredible.co.uk/user-friendly-resources/css/css-forms.shtml

Monday, December 14, 2009

Dealing with float comparing in Python

Let's start.
a = 0.7
b = 0.3
a - b = 0.4
if a - b == 0.4:
print ' a - b == 0.4'
else:
print 'a - b != 0.4'

Result a - b != 0.4

OH WHAT'S...
Solution:
if str(a -b) == str(0.4):
print 'a - b == 0.4'


Read Python Doc for more information

Monday, December 7, 2009

Query with variable and AND

It is
query =db.GqlQuery("SELECT * FROM table WHERE 1st_attribute =:variable AND 2nd_attribute ='value' ", variable = data)

Tuesday, December 1, 2009

invalid literal for int with base 10

/?p=33
I get quite some traffic for the term “invalid literal for int with base 10″. I guess a lot people fumbling around with Python or Django are getting this error message once in a while. This happens when you try to cast a string into an integer and this string does not really contain a “digit”:
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> string = “TestString”
>>>number = int(string)
Traceback (most recent call last):
File “”, line 1, in
ValueError: invalid literal for int() with base 10: ‘TestString’
>>>string = “1″
>>>number = int(string)
>>>number
1
If you work with the Django framework and get this error while trying to request a web page I would check the parameters. Since every parameter that is getting passed in a request is a string you probably cast them into integers somewhere in your source code. It can be a category id or similar. Now when that category id for whatever reason is empty or does not contain a string that can be cast into an integer, you will get the “invalid literal for int with base 10″ error message.
To avoid this error you should check if the string contains a digit:
Python 2.6 (r26:66721, Oct 2 2008, 11:35:03) [MSC v.1500 32 bit (Intel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>> string = “1″
>>> if string.isdigit():
… number = int(string)
… else:
… print “The variable String contains no digit”

>>> number
1
str.isdigit()
Return true if all characters in the string are digits and there is at least one character, false otherwise.
For 8-bit strings, this method is locale-dependent.
More on String operations can be found in the Python documentation.