Thursday, July 31, 2008

Planing and designing a Google App Engine application

Last time, if you remember, we sent a mail with Google App Engine, using the mail function. This time we need to think again on the Mass Mailer project.
It should contain
  • A simple web form
  • Textboxes, text editor and a button to send
  • Ajax platform to make it easy
  • Some animation like rotating arrows
  • Limiting mails to 50 per user
So there will be a total of 40 user every day, that's few, also sending 50 email is so few! So why not use an SMTP Server.

If the user have an SMTP server, so he can use it, then there won't be any quota problems.
The usage should be simple, like that
  • Enter the receivers addresses (50 or unlimited if he uses SMTP)
  • Enter the title and the reply address
  • Write the body with a tiny MCE editor
  • Enter the SMTP details if needed
  • Click the button, the form is hidden, but the page don't reload (as we are going to use AJAX)
  • Show a message, success or failure
Things we should now
  • Working with AJAX
  • Working with Django
  • Working with the mail API
  • some design
Things we should go through
  • Designing the user interface (HTML)
  • Coding the mass mail class with django
  • relying between the Django class and the HTML with Ajax
Should we start?

Google Charting Tools will be soon...

Ok, Google Charting tools, will be soon available for use! I'm making my first try with the Pie chart.
But what's new on those tools?

  • Ajax interface
    I'm going to work with the ajax interface, like that, every one can include those tools in his website!
  • More and more options
    More options will become available soon and also more charts like Map chart
  • So give a hand!
    I'm lost! Give me a hand making those tools, you can start helping me!
Open Source: The tools are open source, you can download them (not complete, and also a little mess on them)
The tools works with PHP and Ajax (Java Script)

How to help?
  • By design : I already designed the Pie chart boxes, you can help by designing the rest of the charts boxes. Check the 'generator.php' file for more information
  • By PHP 'ing' : If you are a PHP programmer, you can give a hand also. In the Code_gen.php file, create the algorithm of generating the link code with the parameters
  • By Ajax 'ing' : If you know ajax, you'll need just to link between the 'generator.php' and 'gen_code.php'
  • Thanks for all who wants to help
By the way, I'm going to create only the pie chart example, the rest is on you, I'm busy with other stuff!

Wednesday, July 30, 2008

Sending an email with Google App Engine

When I first started learning, my application aim was a 'Mass Mailer' with Google App Engine. To start (as a newbie in this domain), I should start with the simplest operation: 'Sending an email using Google App Engine'.

To do this I was lost, I don't know anything about Python. But, how? Take a look around you'll probably find something, return always to the Google App Engine Documentation. Yes, the Send Mail section is available. Let's see it.

Mail Api docs, give you the sample from the overview! Here's what I found

from google.appengine.api import mail

class ConfirmUserSignup(webapp.RequestHandler):
def post(self):
user_address = self.request.get("email_address")

if not mail.is_email_valid(user_address):
# prompt user to enter a valid address

else:
confirmation_url = createNewUserConfirmation(self.request)
sender_address = "support@example.com"
subject = "Confirm your registration"
body = """
Thank you for creating an account! Please confirm your email address by
clicking on the link below:

%s
""" % confirmation_url

mail.send_mail(sender_address, user_address, subject, body)


Before doing anything! You need to know, that the Send mail function isn't included by default so when running your server, you should add the following command
dev_appserver.py --enable_sendmail
Or your mail won't be sent.
Then create a new Google App Engine Application. If you don't know how, here's a quick startup to create your Google App Engine application in minutes.

Trouble in manipulating this code? No, don't do, you don't need. First we are going simply to test the send_mail function, second we are going to use the Django Frameword and not the Google one.

Here's the code, that I use, simple and clean

from google.appengine.api import mail

print 'Content-Type: text/plain'
print ''
print 'I think the email was sent or going to!'
mail.send_mail("omar.abid2006@gmail.com", "omar.abid2006@gmail.com", "Google Coder", "Googler Coder Welcome")


Here's the list, don't be stupid!
  • Your application won't work on your Localhost, so upload it
  • To upload it, seek this article
  • Run your application 'name.appspot.com'
  • Check your inbox
  • Don't Send more than 2000, see quotas here
Ok, here's the first goal and it was done, more to come in the future.

Tuesday, July 29, 2008

Google Charting tools

Just a notice, I work now with PHP designer. It sucks some money, but quite good for development. It supports PHP and Python (also Javascript and other language) that what made me use it!

Ok, I returned to Google Code and Developer API. I was just bored and wanted to get a look on those API. I found a very nice and cool one. Google Chart API. Those API will enable you to create Charts and export them to images (directly embedded on your website, like the examples below).

I read on some comments and blog posts that the number of query is limited to 50,000 per day. Which may be good, but not enough. But here's what I found on the Usage Policy:
There's no limit to the number of calls per day you can make to the Google Chart API. However, we reserve the right to block any use that we regard as abusive, an apparent denial of service attempt for example. If you think your service will make more than 250,000 API calls per day, please let us know by mailing an estimate to chart-api-notifications@google.com.
So it's unlimited now (if it was limited on the past and I don't know!). Any way, that for our good and we can start using it without any fear. (unless Google server goes down or on strike!)

Ok, fast start, the Google Chart API gives you images, like these one.


You can check the images here.
Here's the URL that will query and get back the images
http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

Now you may wonder how I embedded it to the blog post. (It's the same if you want to embed it to a website or HTML Page.

The following line of code do the necessary


See how it's flexible and easy. But as the graph become more complex, the more the URL is longer, and i think that's the only disadvantages of Google Chart API.

However the cool guys on the web are always working and have made a Google Chart API Code Generator. You have just to fill and the code generator will give you the URL. But I'm not so impressed with the current generator and seems to me quite novice. I'm also thinking of creating one with PHP. If you are interested so let me know.

My sample may make you think that Google Chart API supports only 3d Pie! Ohh no think again it's Google and it beyond your imagination.
Here's some sample that will proof its' power.












Only those? Oh no also a map



More precision here's how I select my country from the crowd ;)



Let's put the full speed, vroooom!



Is this a solution for my future online Barcode?




Like it? So you want to try?
Go to the API Documentation, don't worry, it's too long but you are not going to read it all. Read from the introduction to the Chart Data then choose a chart type and read how to manipulate it.
If you work with it on your website, then you should know how to change the colors, the labels, the styles.

BTWN, contact me if you want that we create a more advanced Google Chart Code Generator. Good luck for your charts!

Sunday, July 27, 2008

Python and Django code editors

Now we enter the development phase, so an editor is needed. We are going to focus on a Python editor, but we also prefer that it's a django one, so things will be more easier.
To not search the web, Python official website, published a list of editors. You can check this list of Python editors.

If we are going to search for a simple editor, so why not only use note pad. There's many editors on the Python editors list, some don't create .py files even; but the most are simple editors that just highlight your code and this is really stupid and won't help us.

What we need exactly is an IDE (Integrated Dev elopement Environment). It's possible to find a high quality and free IDE on the web, so the quest is to search. I find many, but no one was good and helpful. I don't really know how to find it.

Perhaps, because I'm searching a very advanced one, like Visual Studio. Ohh, I have read a thread in Reddit, the guy asks what text editor do you use with Django. The good users didn't give a link, so I had to search every term they put; I focus on the editors but they were awful!

Ok, you are searching for an advanced, professional, IDE for pyhton and Django. Don't search I already had done it.
Wing IDE is good, many features are in. It's advanced and for professional use. You can check out the screen shots. But what can I say, it's paying. And we are working Open Source for the community. It really sucks to pay $179 and additional $30 for a cover and also shipping costs :p

Waak, yet another Pyhton, ruby, php IDE. It's called Aptana Studio. It looks smart and pro, but sucks $99, oh no that's only for Pro edition. There's the community edition. (it's free).
It works on Mac, windows and linux. So joy for all Python programmers.
You should ask, why there's two version, one free and one not! Ok, those version aren't different, the pro just inlcude a support and pro plug-ins. Which may be not necessary so much. If it's then you must pay :)
Ok, let's quit those money suckers. Here's the Open Source IDE for Python and Django!
NetBeans, that's it! But I would prefer Aptana. Ok, download them both and decide what to choose.

Hope it helps! Know an IDE? Let me hear from you!

Django Platform for Google App Engine

I was surfing those days Google App Engine websites and found that the most popular and used platform to work with Google App Engine is Django. Luckily, it's already included on Google App Engine SDK in the lib folder. But I always give a hit for the official website and so you can do and visit the Django website.

The website documentation is so cool, more than that I found free book, you can get it here.
But what's Django and how it works?
As I said Django is a python Framework, written in pure python, then the matter is to know python and then Django will only accelerate your work
At its core, Django is simply a collection of libraries written in the Python programming language. To develop a site using Django, you write Python code that uses these libraries. Learning Django, then, is a matter of learning how to program in Python and understanding how the Django libraries work.
From the Django book
Ok, so we have to come back to Python, oh yes, here's a small comparision between python and django.
The example (found it in the django book) displays the ten most recently published books from a database.
The sample written in Pure Python

#!/usr/bin/python

import MySQLdb

print "Content-Type: text/html"
print
print "<html><head><title>Books</title></head>"
print "<body>"
print "<h1>Books</h1>"
print "<ul>"

connection = MySQLdb.connect(user='me', passwd='letmein', db='my_db')
cursor = connection.cursor()
cursor.execute("SELECT name FROM books ORDER BY pub_date DESC LIMIT 10")
for row in cursor.fetchall():
print "<li>%s</li>" % row[0]

print "</ul>"
print "</body></html>"

connection.close()

The sample written in Django

# models.py (the database tables)

from django.db import models

class Book(models.Model):
name = models.CharField(maxlength=50)
pub_date = models.DateField()


# views.py (the business logic)

from django.shortcuts import render_to_response
from models import Book

def latest_books(request):
book_list = Book.objects.order_by('-pub_date')[:10]
return render_to_response('latest_books.html', {'book_list': book_list})


# urls.py (the URL configuration)

from django.conf.urls.defaults import *
import views

urlpatterns = patterns('',
(r'latest/$', views.latest_books),
)


# latest_books.html (the template)

<html><head><title>Books</title></head>
<body>
<h1>Books</h1>
<ul>
{% for book in book_list %}
<li>{{ book.name }}</li>
{% endfor %}
</ul>
</body></html>


I know that most of you will see that the django code is harder. Yes, it's longer and harder but smarter to use. I will prefer to use long code, then easily type book.name to display the latest books. The framework aims to make easy long and big application development.

Saturday, July 26, 2008

Google App Engine Server Class

Ok, here's the first version of Google App Engine server.
The class contain the function that will run the server and get back the results.
Here's the class


Public Class runserver

Private startserver As Diagnostics.ProcessStartInfo

Private serveroutput As Diagnostics.Process



Sub New()

startserver = New Diagnostics.ProcessStartInfo

With startserver

.FileName = "dev_appserver"


.UseShellExecute = False


.RedirectStandardOutput = True


.CreateNoWindow = True

End With

End Sub



Public Function run_server(ByVal file_path As String, ByVal port As Integer, ByVal sendmail As Boolean, ByVal cleardatastore As Boolean, ByVal timeout As Integer) As Boolean

Dim enable_sending_mail As String = ""
Dim clear_data_store As String = ""
If sendmail = True Then enable_sending_mail = " --enable_sendmail "
If cleardatastore = True Then clear_data_store = " --clear_datastore "
Dim Status As Boolean = False

Try


startserver.Arguments = ("dev_appserver.py --port=" & port & clear_data_store & enable_sending_mail & file_path)




serveroutput = Process.Start(startserver)





serveroutput.WaitForExit(timeout + 1000)



If serveroutput.HasExited Then


Dim Reply As String = serveroutput.StandardOutput.ReadToEnd



If Reply.ToLower.IndexOf("reply") > -1 Then



Status = True

End If

End If

Catch ex As InvalidOperationException

MessageBox.Show(ex.ToString)

Catch ex As System.ComponentModel.Win32Exception

MessageBox.Show(ex.ToString)

Catch ex As ObjectDisposedException

MessageBox.Show(ex.ToString)

Finally

If Not serveroutput Is Nothing Then


serveroutput.Dispose()

serveroutput = Nothing

End If

End Try



Return Status



End Function

End Class


Good? Ok, if you have any suggestion or improvement for the code, then let me know.

The Development Console for Google App Engine

Ok; now we are going to work seriously! (I hope so). I'm back from a small vacation and I'm upping for something special now. A nice guy already posted a comment and seems to be interested on the Google App Engine Server. Ohh; I think I have to start serious work on it :)

Now let's focus on the Google App Engine development console. Ok there's no much to see on it. (if you dare to compare it to the ASP.net administrator tools :( )
But I already loved a tool on it and I'll introduce it.

Now run your server; choose any application that doesn't bother.
Then open the following link 'http://localhost:8080/_ah/admin' You should see the admin console. As I said there's no much to see. Forget about the 'Data Store Viewer' and have a look on the 'interactive console'

What's cool on this console
  • Run quickly your test code
  • Check a few lines and find the error easily
  • Good for newbie and learner!
Here's the default code on it.

# Say hello to the current user
user = users.get_current_user()
if user:
nickname = user.nickname()
else:
nickname = "guest"
print "Hello, " + nickname

now try to make a change like deleting the word users in users.get_current_ser()
here's the error message
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\admin\__init__.py", line 179, in post
compiled_code = compile(code, '', 'exec')
File "", line 2
user = .get_current_user()
^
SyntaxError: invalid syntax

Sounds cool no?
Now you may wonder what this sample does. Ok, simply, if you are logged to Google account then it'll display your name. If not then it'll display "guest"!
But where to login? Ohh here's the page http://localhost:8080/_ah/login

Your users are not obliged to redirect to that page to login; you can integrate it on your own site!
You may wonder why it don't asks for a password; that's simple; because you work on local, then Google won't query its' database if you are working on local.

Wednesday, July 16, 2008

Working with Google App Engine Framework

Every language or platform should have frameworks, those are library that just accelerate development speed and better your work.
For example, the Dot Net Framework, try just to compare it with the dot net assembly language. So here's a simple and easy to use example!

While typing huge lines of code to shut down a computer...
'calling windows api
'if..then..end if
and some lines of code
You replace the work with
Windows.shutdown

Framework are huge libraries that replace ALL the code, so you don't have to work with the simple python now. This is an important step if you are going to work with Google App Engine and build secure application and long lines of code.

Google App Engine accept FrameWorks, (it's better to say Python!).
I was in this page and noticed that Google SDK have already a framework included; however if you want to include another framework, you simply have to include its' code in a folder on your project. Like Pear with PHP.

Google App Engine include a simple Framework of its' own, called Webapp

The test application will become then...


import wsgiref.handlers

from google.appengine.ext import webapp

class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Test')

def main():
application = webapp.WSGIApplication(
[('/', MainPage)],
debug=True)
wsgiref.handlers.CGIHandler().run(application)

if __name__ == "__main__":
main()


A first look on the code.. that's too long! Yes but easy to understand, if you can't learn it, then you should find a code editor like the Visual Studio editor for .net

Tuesday, July 15, 2008

Google App Engine Webserver

How much will you continue to use Google App Engine with a command line; why not make it easier. Open when Windows opens, easily upload files and much more than that.
Ok, it's not that hard. I'm a Vb.net developer and we can make an application that solve this issue.

What will the application do?
  • Manage your Google App Engine webserver with a user friendly interface.
  • Run automatically when Windows starts
  • Upload your application
  • Create a config file
  • Other things?

Is this free?

Haha, this is Open Source. Ok, I generally don't give my applications source, but this time yes, as I'm going to program for an Open Source community; GOOGLE!

When, how and why?

First it's easy to do it and won't take more than 3 or 4 hours and most of the
work is on design.
I'll host the application on both Google Code and
Codeplex. Every Vb.net programmer will be able to spice the application if he
can. and then it'll grow.
It'll be ready after I complete my current project EntreCard Browser (for EntreCard
bloggers).
So it'll be ready by the next week.

For interested people

The application is very simple, instead of using the command line through the
MS-DOS console, it'll be used through a user friendly Window. This will help you
easily select a path or customize your server... If you have any idea please
post your comment here, because I'm stack with emails :(

How to create a simple Google App Engine Application

Creating a Google App Engine, isn't that hard. Google already provide you with the required details to create your Hello Word application. So let's create a very simple Google App Engine application.
One problem is that Google introduction and samples don't touch begineers, but experienced ones. And not all experts, but in the Linux and PHP related. For example if you have knowledge on Visual Basic .net, then you can't easily make a Google App Engine application. However if you are a python or Linux coder, then Google App Engine is familiar for you.

This is normal, but Google don't provide very detailed information. I sometimes found problem on understanding what it talks about.

Google App Engine isn't flexible:
Google App Engine is cool, only if you look to the application but it's not flexible at all. You need to manage it through a command line tool, which is very annoying.

Simple Start-up:
Here's what a Google App Engine Application is (without the loosing Google tutorial).
  • A simple webpage on a server like PHP that run with Google App Engine (instead of apache)
  • Instead of uploading with FileZilla, you upload with the command line.
  • Instead of running your webserver through a program you run it with a command line.
  • Instead of using .php you use .py
  • The configuration file (like in ASP.net) is app.yaml

How to create your App Engine Application in 5 minutes:

  • Already have python and Google SDK Installed
  • Create a folder in c:/ and name it test
  • Create an app.yaml file
  • Create a test.py file

Put the following on the app.yaml file

application: helloworld
version: 1
runtime: python
api_version: 1

handlers:
- url: /.*
script: helloworld.py

Put the following on the test.py file

print 'Content-Type: text/plain'
print ''
print 'Hello, world!'

run your App Engine server:
To run your server, open the Ms-Dos Command line and type
google_appengine/dev_appserver.py c:/test/

Now you should be able to see the application in localhost(8080)

Like ASP.net in stone age!
Yes, while having an easy to use Server, editor and uploader, you have a very hard environement to work. But it's not a matter, Google and me will arrange those things together!

Sunday, July 13, 2008

Geo Chat App Engine... to work!

I liked the idea of Geo chat and decided to just customize it, then spread it up in the net. The application should be successful if I caught 5000 visitor daily, at least when someone enter he find 30 or 40 others to speak with. This will be a chating area! Nice and Wonderful, but when I try it using the appspot for this blog, it told me that I need a Google Map API Key for the following application although it did run correctly on the localhost.

Ok, this is not a big problem, I registered talkhub.appspot.com for my future chat application.

But this time I have to return to my Google tutorial or I'll be really burning steps, so I need to delete geacoder.appspot.com content but how to do that! Never mind we'll learn through the Google tutorial; hope that!

Uploading a Google App Engine application

I'm not burning steps after all, I just want to see the application alive in the internet, what matters if we derived a little bit from the Google tutorial.

So I decided to upload the Geochat sample!
But where to start? The application is complete, all files are in and very light (220 kb). So here the tutorial to be in the right track.

Upload may seems hard, if you are a beginner in programming, command lines...
So here's how to do for empty persons:
  • First you have to set an application, after you are done, remember the application ID (gaecoder is my ID and you can access my application http://gaecoder.appspot.com)
  • Go to your application root and open app.yml or app.yaml
  • Change the following line from...
    application: geochat
    to your application ID
    application: gaecoder
    If you don't do that.. you won't upload the files
  • Then run the command line and enter the following line
    appcfg.py update c:/geochat/
    And replace geochat with your path or folder name
  • You'll be asked for your email then you password (Google email and password)
  • Your upload should run and go if nothing goes wrong!
Visit your application dashboard, you should be able to see your application statics.
Check the application here, you should find Geo chat, but I may change it later...
Have a problem, let face it together, tell me what didn't work!

Running your App Engine Application

Finally running your Google App Engine application on your computer isn't that hard. I could do it on two easy steps.
First make sure your have downloaded and installed both Python and App Engine SDK.
Then download a sample, I chose Geo Chat.

Ok now after having those installed and downloaded a sample, extract the sample and put it on your Hard disk root. (Don't Ask me why, you can put it on another place, any place, but as you are using a command line and not windows then you should have easy to write path).

After extracting and putting the sample files, run the Ms-dos command line and type the following:
dev_appserver.py c:\geochat
Replace geochat with your sample folder name. Now visit your Localhost, you should see your application up and running on your computer.

As the sample use Google Maps and Google accounts, so an internet connection is needed and Google server must be up!

That was quite easy cool and interesting. It really put me on the right way! Now I'm going to try to upload the Geo chat to the App Engine Server, which may be another story...

Getting Started with Google App Engine

So I need to get started with Google App Engine, ehh?!
I follow Google steps, starting with the introduction. So, we are going to create a guest book, then we need a database, authentication and so more.. So that engine will take care of it all?

The thing that attracted me is
Users can post anonymously, or using their Google accounts.
So we are going to use Google accounts, great. I saw some application on the web (especially the big ones, that uses your Google or Hotmail account to import your contact from them.). It's really great, this is the real massive distribution.

Ok so let's go to the next step. It's simply describing the development environment. There's two important parts that you should know, the development web server and how to upload your application.

Google App Engine samples

I got bored from the app engine, I just learned that I need to use the command line to upload a file. And I hate using the command line so much, this don't impress me. However those few samples made me think back on it.

Flyapp is like I-Google. I had a friend having a project like Flyapp which is 6starts. But if you compare them, you'll notice that the App Google Engine one is more delicious than the PHP/Ruby on rail one!


Another application was Spy, but you could say it's the young brother of addictomatic; so nothing really interesting on that Google App Engine.

So my idea was to make an Email sender, other said mass mailer.

Here, at this point, I must break my mind and understand what Google App Engine is, or I'll do... nothing!

Saturday, July 12, 2008

Highligh syntax on articles for Blogger

I know this issue and this trick. Syntax highlighting is cool. There's a plug-in for that on Wordpress, luckily a cool guy, made it ready for us using JavaScript.
You can check the project here.

First thing is to download the nice project. Then you have to upload it to your server or use mine. (If you have a server upload! because my server quota may ran off, so let the place only for those who don't have server :( )

I have uploaded the files to my server as they are in the folder "http://omarabid.com/highlighter"
So you can find the script folder for example here "http://omarabid.com/highlighter/script".
So enjoy if you don't have a place, I don't recommend to use free hosting because I used them and got only problems from them.

However in Blogger you can put it on your Blog template. Create a new widget and put the following code on it

');wnd.document.close();}},CopyToClipboard:{label:'copy to clipboard',check:function(){return window.clipboardData!=null||dp.sh.ClipboardSwf!=null;},func:function(sender,highlighter)
{var code=dp.sh.Utils.FixForBlogger(highlighter.originalCode).replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');if(window.clipboardData)
{window.clipboardData.setData('text',code);}
else if(dp.sh.ClipboardSwf!=null)
{var flashcopier=highlighter.flashCopier;if(flashcopier==null)
{flashcopier=document.createElement('div');highlighter.flashCopier=flashcopier;highlighter.div.appendChild(flashcopier);}
flashcopier.innerHTML='';}
alert('The code is in your clipboard now');}},PrintSource:{label:'print',func:function(sender,highlighter)
{var iframe=document.createElement('IFRAME');var doc=null;iframe.style.cssText='position:absolute;width:0px;height:0px;left:-500px;top:-500px;';document.body.appendChild(iframe);doc=iframe.contentWindow.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write('
'+highlighter.div.innerHTML+'
');doc.close();iframe.contentWindow.focus();iframe.contentWindow.print();alert('Printing...');document.body.removeChild(iframe);}},About:{label:'?',func:function(highlighter)
{var wnd=window.open('','_blank','dialog,width=300,height=150,scrollbars=0');var doc=wnd.document;dp.sh.Utils.CopyStyles(doc,window.document);doc.write(dp.sh.Strings.AboutDialog.replace('{V}',dp.sh.Version));doc.close();wnd.focus();}}};dp.sh.Toolbar.Create=function(highlighter)
{var div=document.createElement('DIV');div.className='tools';for(var name in dp.sh.Toolbar.Commands)
{var cmd=dp.sh.Toolbar.Commands[name];if(cmd.check!=null&&!cmd.check(highlighter))
continue;div.innerHTML+=''+cmd.label+'';}
return div;}
dp.sh.Toolbar.Command=function(name,sender)
{var n=sender;while(n!=null&&n.className.indexOf('dp-highlighter')==-1)
n=n.parentNode;if(n!=null)
dp.sh.Toolbar.Commands[name].func(sender,n.highlighter);}
dp.sh.Utils.CopyStyles=function(destDoc,sourceDoc)
{var links=sourceDoc.getElementsByTagName('link');for(var i=0;i');}
dp.sh.Utils.FixForBlogger=function(str)
{return(dp.sh.isBloggerMode==true)?str.replace(/|<br\s*\/?>/gi,'\n'):str;}
dp.sh.RegexLib={MultiLineCComments:new RegExp('/\\*[\\s\\S]*?\\*/','gm'),SingleLineCComments:new RegExp('//.*,'gm'),SingleLinePerlComments:new RegExp('#.*,'gm'),DoubleQuotedString:new RegExp('"(?:\\.|(\\\\\\")|[^\\""\\n])*"','g'),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'",'g')};dp.sh.Match=function(value,index,css)
{this.value=value;this.index=index;this.length=value.length;this.css=css;}
dp.sh.Highlighter=function()
{this.noGutter=false;this.addControls=true;this.collapse=false;this.tabsToSpaces=true;this.wrapColumn=80;this.showColumns=true;}
dp.sh.Highlighter.SortCallback=function(m1,m2)
{if(m1.indexm2.index)
return 1;else
{if(m1.lengthm2.length)
return 1;}
return 0;}
dp.sh.Highlighter.prototype.CreateElement=function(name)
{var result=document.createElement(name);result.highlighter=this;return result;}
dp.sh.Highlighter.prototype.GetMatches=function(regex,css)
{var index=0;var match=null;while((match=regex.exec(this.code))!=null)
this.matches[this.matches.length]=new dp.sh.Match(match[0],match.index,css);}
dp.sh.Highlighter.prototype.AddBit=function(str,css)
{if(str==null||str.length==0)
return;var span=this.CreateElement('SPAN');str=str.replace(/ /g,' ');str=str.replace(/');if(css!=null)
{if((/br/gi).test(str))
{var lines=str.split('
');for(var i=0;ic.index)&&(match.index/gi,'\n');var lines=html.split('\n');if(this.addControls==true)
this.bar.appendChild(dp.sh.Toolbar.Create(this));if(this.showColumns)
{var div=this.CreateElement('div');var columns=this.CreateElement('div');var showEvery=10;var i=1;while(i<=150) {if(i%showEvery==0) {div.innerHTML+=i;i+=(i+'').length;} else {div.innerHTML+='·';i++;}} columns.className='columns';columns.appendChild(div);this.bar.appendChild(columns);} for(var i=0,lineIndex=this.firstLine;i0;i++)
{if(Trim(lines[i]).length==0)
continue;var matches=regex.exec(lines[i]);if(matches!=null&&matches.length>0)
min=Math.min(matches[0].length,min);}
if(min>0)
for(var i=0;i)','gm'),'cdata');this.GetMatches(new RegExp('(\<|<)!--\\s*.*?\\s*--(\>|>)','gm'),'comments');regex=new RegExp('([:\\w-\.]+)\\s*=\\s*(".*?"|\'.*?\'|\\w+)*|(\\w+)','gm');while((match=regex.exec(this.code))!=null)
{if(match[1]==null)
{continue;}
push(this.matches,new dp.sh.Match(match[1],match.index,'attribute'));if(match[2]!=undefined)
{push(this.matches,new dp.sh.Match(match[2],match.index+match[0].indexOf(match[2]),'attribute-value'));}}
this.GetMatches(new RegExp('(\<|<)/*\\?*(?!\\!)|/*\\?*(\>|>)','gm'),'tag');regex=new RegExp('(?:\<|<)/*\\?*\\s*([:\\w-\.]+)','gm');while((match=regex.exec(this.code))!=null) {push(this.matches,new dp.sh.Match(match[1],match.index+match[0].indexOf(match[1]),'tag-name'));}} dp.sh.Brushes.JScript=function() {var keywords='abstract boolean break byte case catch char class const continue debugger '+'default delete do double else enum export extends false final finally float '+'for function goto if implements import in instanceof int interface long native '+'new null package private protected public return short static super switch '+'synchronized this throw throws transient true try typeof var void volatile while with';this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:'comment'},{regex:dp.sh.RegexLib.MultiLineCComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp('^\\s*#.*','gm'),css:'preprocessor'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'}];this.CssClass='dp-c';} dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();dp.sh.Brushes.JScript.Aliases=['js','jscript','javascript']; dp.sh.Brushes.Ruby=function() {var keywords='alias and BEGIN begin break case class def define_method defined do each else elsif '+'END end ensure false for if in module new next nil not or raise redo rescue retry return '+'self super then throw true undef unless until when while yield';var builtins='Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload '+'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol '+'ThreadGroup Thread Time TrueClass' this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:'comment'},{regex:dp.sh.RegexLib.DoubleQuotedString,css:'string'},{regex:dp.sh.RegexLib.SingleQuotedString,css:'string'},{regex:new RegExp(':[a-z][A-Za-z0-9_]*','g'),css:'symbol'},{regex:new RegExp('(\\$|@@|@)\\w+','g'),css:'variable'},{regex:new RegExp(this.GetKeywords(keywords),'gm'),css:'keyword'},{regex:new RegExp(this.GetKeywords(builtins),'gm'),css:'builtin'}];this.CssClass='dp-rb';this.Style='.dp-rb .symbol { color: #a70; }'+'.dp-rb .variable { color: #a70; font-weight: bold; }';} dp.sh.Brushes.Ruby.prototype=new dp.sh.Highlighter();dp.sh.Brushes.Ruby.Aliases=['ruby','rails','ror']; dp.SyntaxHighlighter.BloggerMode(); dp.SyntaxHighlighter.HighlightAll('code'); -->



Now we can use the syntax highlighter, luckily it supports many languages. Python, VB, Java... That's really cool, check the list of Syntax highlighter supported language.

Then you can put smart blocks of code! enjoy!

Google App Engine created

Finally I got the Google App Engine created. The problem was that Google App Engine don't accept the following name "googlecoder" which make it not possible to create the app.
Now the application was created but I have some restriction so I should be careful how to use it.

I can create only 3 Google Application, plus other restriction that you find here.

From the first look, the Google App Engine seems like a hosting server, but while using PHP or ASP you are using Google App Engine.

A few examples would solve the problem and let me quickly start coding (I hope so).

Luckily it's Google who give you the samples! So let's start and see how we can upload them and run the application, after that we'll try to change something on the application, so we can create future application

Google Coder with new Template

Google Coder now have a new template, we also added some widget to the side bar. Also, we subscribed to Feedburner to give you our articles by mail so if you love this blog just subscribe.

Blogger template token from Blogger Crowd. There's only the header image that I'll change it when I find a nice related one.

We'll continue...

Register your Google App Engine Application

Then we should run. I click the button and decided to create my application. The first step was to identify myself. This will help Google prevent SPAM! I didn't tried but I think 1 phone number can register you one time.

I'm in Tunisia and the process was ultra fast. The assistant told me that I should wait 10 minutes or more but it didn't take even 1 second. I was really shocked because if i was sending the sms to another number and of the same network, this will take longer than 2 minutes to wait. Any way, how you can explain it, I got the code and arrived to the creating page of the application.

I enter the "application name" and it said that it's available, but when I click on Save, that tell me that the ID is not available.

No way, I must try another way. So I started with the Getting Started documentation.

First step is to download Python and install it. Which will be another story!
Python wasn't that lite, it wieght more than 10 mb. One thing that I don't have answer, why should I install Python? Why Google need python? Is it just needed for developer?

I first started by reading the stupid Python introduction
Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains and feel the language encourages the development of higher quality, more maintainable code.
Here's what you could read on the main page of Python. But still not clear for me what this thing will do!
I found in the side bar, a widget that shows category where this Python can help and I got interested on the Web Programming one but really didn't find something attracting especially when I saw that the download completed.

Ok the installation with the msi package was too easy but using it... may not, so I got a look on the program menu. I found the documentation, so I opened it and it starts a real server! (like the dot net help).

The help is so big! And Python seems clearly now a group of library, that we'll use perhaps. So I returned to Google App engine.

The next step is to download the Google App engine SDK. I found also some buttons for websites powered by Google App Engine. I decided to use one in the blog when fixing a custom template to it.

The SDK was light, only 2.5 mb, and It was msi package also. That was an important point for me because the Google Desktop SDK for Windows was a zip file, with very stupid files inside.
But 2.5 mb wasn't that impressive for me, if I compare it to Visual Basic .net, this would be 30 times bigger. But bigger don't mean better, but so bigger may mean it!

I found it now boring and won't become interesting unless I see and react with some samples that I'm going to show later.

Google App Engine

I started seeking the API & Developer section and got attracted by the Google App engine.
What really caught my attention is creating Web application hosted by Google where I use Google Technology or API or something like that.

Another thing, I remember a time I see a Google service (that I don't remember well!) where in the bottom there's Built by Google App Engine, which means that this one is powerful and I hope so.

As the hosting of my project or web application was free and instantly I didn't thought and signed up. I also gave a look to the app engine blog to see what's going on, on it.

Quickly I arrived to the start page and hit "Create an application" to see how it works.

If it really was easy to use it then it'll be so cool, because:
  • No assembly required, like an old MS-Dos stand alone
  • Free hosting with 500mb and 5 million page view in a month
Could you understand this one, I read it on the home page:

It's easy to scale.
Google App Engine makes it easy to build scalable applications that grow from one user to millions of users without infrastructure headaches.
What does this really mean, from 1 to 1 million? Does it work like Facebook? Is their any massive distribution for my application?

We are going to know....

Welcome to Google Coders

I have been programming with Mircosoft Technology for 4 years now. I did heard of Google API but it really didn't interest me so much. Now I think it'll do. Google had developed in the past 3 years its' bases and Google code is now so much powerful.

One thing intersting on Google code is that it's so related to the search engines or other Google products like Google earth. This is what empower Google API.

I found it useful to use a custom Google search on my site and also to do special search, like searching and getting more than 100 results.

To start your way with Google code, you need just to visit the start page
Then you'll have to check the API developer tools or Open Source programs before starting your own.

This blog will be like a tracker, it'll put all my activities visible to the web readers (sure activity on Google Code!)

Hope you enjoy reading it!
Interested on Microsoft Technologies? Read Visual Studio Dot Net