November 14, 2009

3

How to Create Hyperlink on Blogger Header

Today, I got this question in comment of my previous tutorial on How to Create Hyperlink on Blogger Post.

Barbara Fowlds L.Ac.: "Can I put a hyperlink in my header of my blogspot blog and if so how?"

My answer is Yes you can. And here's how to do it in the simplest newbie way.

Before that, I assume you may wanted to add this hyperlink on your Blogger Header Description because maybe you want to invite your visitor to your business website or any other sites you have. For example, I may like to invite my blog reader to read my art blog at http://artofapogee.blogspot.com and my blog description says something like this:

Feel free to visit Art Of ApOgEE Blog to see my arts and order some graphic design books

And now we wanna link that blue "Art Of ApOgEE Blog" to http://artofapogee.blogspot.com

This is the simplest way. You just have to copy paste and no coding . Here's the step:

  1. Open up New Post on you blogger, select Edit Html and type the words there:


  2. Select the text we want to link and create the link:

    Just follow the same way like we did in How to Create Hyperlink on Blogger Post.

  3. Select all text and copy:


  4. Open the Layout tab and Edit your header:


  5. Paste the copied text to your Blog Description and Save:



That's all, now you have the link on your Blogger Header Description. Enjoy coding and Happy Blogging!!





Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy




November 13, 2009

0

Beginning LISP Programming in Ubuntu

For any reason, you may wanted to start learning Lisp Programming. However, you may wondering where to start. So here again, I'm going to share with you. How to begin Lisp Programming, "the programmable programming language".

As, I'm using Ubuntu here, this example is shown step by step on Ubuntu.

In order to start playing with Lisp on your ubuntu, you need to install CMUCL. CMUCL is a free implementation of Common Lisp which was originally developed at Carnegie Mellon University. To install CMUCL package, just run this command on your Ubuntu terminal:

$ sudo apt-get install cmucl

Next, we are going to feel the environment. Open up your terminal and type:

$ lisp

You will be greeted by CMU Common Lisp with it version and loaded subsystem. In my case, I see like this.

apogee@apogee-ubuntu:~$ lisp
CMU Common Lisp CVS release-19a 19a-release-20040728 + minimal debian patches, running on apogee-ubuntu
With core: /usr/lib/cmucl/lisp.core
Dumped on: Fri, 2009-11-13 09:05:47+08:00 on apogee-ubuntu
For support see http://www.cons.org/cmucl/support.html Send bug reports to the debian BTS.
or to pvaneynd@debian.org
type (help) for help, (quit) to exit, and (demo) to see the demos

Loaded subsystems:
Python 1.1, target Intel x86
CLOS based on Gerd's PCL 2004/04/14 03:32:47
*

As you can see the loaded subsystem is Python 1.1. This is not the Python as in Python Programming. Don't get confused. It is a native code compiler named "Python". If Common Lisp source code has been written with appropriate declarations and is organized with speed in mind, the Python compiler generates code that is almost free from overhead compared to code compiled from languages like C++. Some inefficiencies such as function call interfaces and lack of pointer-free arrays of user-defined data types are dictated by the Common Lisp standard and still need to be worked around (e.g. by inlining more and using macros to build constructs that look like user-defined structures but are actually accessing fields in preallocated specialized arrays). The Python compiler also features powerful type inferences, helping the programmer in writing overhead-free code by either inferring types automatically or issuing hints about missed optimization opportunities.

Before doing anything else, you have to know how to exit from this environment. To exit from this lisp terminal, you can simply type (quit) and press enter.

apogee@apogee-ubuntu:~$ lisp
CMU Common Lisp CVS release-19a 19a-release-20040728 + minimal debian patches, running on apogee-ubuntu
With core: /usr/lib/cmucl/lisp.core
Dumped on: Fri, 2009-11-13 09:05:47+08:00 on apogee-ubuntu
For support see http://www.cons.org/cmucl/support.html Send bug reports to the debian BTS.
or to pvaneynd@debian.org
type (help) for help, (quit) to exit, and (demo) to see the demos

Loaded subsystems:
Python 1.1, target Intel x86
CLOS based on Gerd's PCL 2004/04/14 03:32:47
* (quit)
apogee@apogee-ubuntu:~$

Now you know how to start and end the CMU Common Lisp. We can start playing with codes. Here is some example:

1. Adding Numbers:

* (+ 200 800 300 700 19 10)

2029
*

Notice my code started with '(' and end with ')'.

2. Subtract Numbers:

* (* 12 2 3)

72


3. Or even Adding and Subtract:

* (+ (* 12 2 3) 1)

73


There you go. From here you can try more stuff by following these tutorials and manual:


That's all for now mates.. Happy Coding!!

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy

November 4, 2009

2

Example of Simple Web Server Using Python

I may got the question wrong on my previous post.

So, here is how to make a simple web server using python in ubuntu.

  1. Open up your ubuntu terminal and create the 'index.html' file like this:
    <html>
    <head><title>python.my sample</title></head>
    <body>
    <h1>python.my sample</h1>
    <p>This is the simple html sample. Got it?</p>
    <p>Visit <a href="http://coderstalk.blogspot.com">Coder's Talk blog</a></p>
    </body>
    </html>


  2. In the same directory, create the python server and name it as 'pyserver.py' and enter the content like this:
    import SimpleHTTPServer
    import SocketServer

    theport = 1234
    Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
    pywebserver = SocketServer.TCPServer(("", theport), Handler)

    print "Python based web server. Serving at port", theport
    pywebserver.serve_forever()


  3. Run the python code using this command:
    $ python pyserver.py


  4. Open up your web browser and go to http://localhost:1234 and see your python web server running.

That's all... Have fun coding

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy




1

Example of Simple Website Using Python

While reading my email today, found this question from one of the python.my mailing list subscriber.

Question: i want to run a web server using python
can expertise in python share some simple codes with html as well to
demonstrate this. [link to python.my thread]

Answer: As I'm bored today coz Kristen didn't answer my email yet, I pop my ubuntu terminal and type this code:

## =========================================================
# Sample python site by ApOgEE
# ----------------------------
# 1) Make sure you have apache and enable mod-python on your apache. For example on ubuntu:
# $ sudo apt-get install apache2
# $ sudo apt-get install libapache2-mod-python
# $ sudo a2enmod python
#
# 2) Make sure you have proper PythonHandler. For example:
# AddHandler mod_python .py
# PythonHandler mod_python.publisher
# PythonDebug On
#
# 3) Enter this codes and name it as 'pythonmysample.py' on your web directory
#
# 4) test it on your browser http://localhost/pythonmysample.py
#

def index(req):
thetitle = "Python.my sample by ApOgEE"
mysite = siteheader(thetitle)
mysite += sitebody(thetitle)
mysite += sitefoot()
return mysite

def siteheader(title):
str = "<html><head><title>" + title + "\n"
str += "</title></head><body>\n"
return str

def sitefoot():
str = "\n</body></html>"
return str

def sitebody(title):
str = "<h1>" + title + "</h1>\n"
str += "<p>Hi mate!<br>\n" + \
"This is the testing python site example.<br><br>" + \
"Coded by: ApOgEE<br>" + \
"Visit <a href=\"http://coderstalk.blogspot.com\">http://coderstalk.blogspot.com</a>

\n"
return str

# end of code. Copyright (C) 2009, ApOgEE - http://coderstalk.blogspot.com



If you have problem opening the page on your ubuntu, here is the checklist:
  1. Install apache2 and libapache2-mod-python and enable mod-python
    $ sudo apt-get install apache2
    $ sudo apt-get install libapache2-mod-python
    $ sudo a2enmod python

  2. Edit /etc/apache2/sites-enabled/000-default. Search for this lines:
            <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>
    and add python handler like this:
            <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

    AddHandler mod_python .py
    PythonHandler mod_python.publisher
    PythonDebug On

    </Directory>

  3. Restart your apache
    $ sudo /etc/init.d/apache2 restart

You can also download the simple python website source code.

That's all. Hope you enjoy it... Happy Coding!!

Share This Article:


Bookmark This Article:
Feed Me Digg Technorati del.icio.us Best to Stumbleupon Reddit Blinklist Furl Spurl Yahoo Simpy