Wednesday, April 25, 2012

How to host website in google appengine through python


Tools Required

Download and install them both.

Register Application

Go to https://appengine.google.com/ and sign in using your Google account.
On the App Engine dashboard, click on "Create an Application" button. Follow the instructions to register an application ID - a unique name for your website. For example, if your application ID is “mywebsite”, the URL for your website will be http://mywebsite.appspot.com/. You can also purchase a top-level domain name (.COM, .NET, .ORG etc) and use that one instead. We will come to that later.
In this example, the application ID was “examplesite9”

Preparing The Website

Launch the Google App Engine Launcher and click on the + button.
gae-launcher
Enter your application ID, choose a directory on your hard drive and click Create.
gae-launcher2
A folder with the name of the application will be created in your chosen location. Open the folder in Windows explorer and create a new folder called “static”. Copy your website’s files to the folder “static”.
Open the file app.yaml in a text editor. Replace the content of the file with the following.
application: examplesite9
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /images/(.*)
  static_files: static/images/\1
  upload: static/images/(.*)
 
- url: /(.*\.html)
  static_files: static/\1
  upload: static/index.html
 
- url: /.*
  script: main.py
Short explanation: The url parameter specifies the URL where you would like your website’s resources to be available to a visitor. Here resources under the folder static, i.e. your entire website is redirected to the root of the website’s URL, so that you can access your website from http://mywebsite.appspot.com/instead of http://mywebsite.appspot.com/static
default_expiration specifies the length of time the website’s files ought to be cached in the user's browser. I have set it to 30 days.
In my example website I used only one directory – “images”, hence there is only one directory handler. If you have more than one directory, simple copy the first 3 lines that define the image folder, paste it and replace images with your directory name. For example, if you have placed your CSS files in a directory called “stylesheet” and JS files under “javascript”, the app.yml file should look.
application: examplesite9
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /images/(.*)
  static_files: static/images/\1
  upload: static/images/(.*)
handlers:
- url: /stylesheet/(.*)
  static_files: static/stylesheet/\1
  upload: static/stylesheet/(.*)
handlers:
- url: /javascript/(.*)
  static_files: static/javascript/\1
  upload: static/javascript/(.*)
- url: /(.*\.html)
  static_files: static/\1
  upload: static/index.html

- url: /.*
  script: main.py
The application directory will have another file named main.py. Open main.py in a text editor and replace its content with the following.
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class IndexHandler(webapp.RequestHandler):
    def get(self):
        if self.request.url.endswith('/'):
            path = '%sindex.html'%self.request.url
        self.redirect(path)
    def post(self):
        self.get()
application = webapp.WSGIApplication([('/.*', IndexHandler)], debug=True)
def main():
    run_wsgi_app(application)
if __name__ == "__main__":
    main()
What we have done here is redirected http://mywebsite.appspot.com/ tohttp://mywebsite.appspot.com/index.html. This is needed because Google App Engine does not do it automatically.
We are now ready to deploy our website.

Uploading Website

Open Google App Engine Launcher, select your application from the list and click on the Deploy button. Enter your Google ID and password when asked.
gae-deploy
If everything goes smoothly, your website will be uploaded and should become immediately available under the registered URL. Here is my website. http://examplesite9.appspot.com/
You also get a nice dashboard from where you can overview resource usage by your website.
gae-dashboard
Speaking about resources, there are some limitations you should be aware of. On free accounts, you get 1000 MB of in and another 1000 MB of out bandwidth each day, 1.3 million HTTP requests each day, and 1 GB of storage space. Sufficient for most users.

Using Custom Domain

This is explained here. Follow the steps and you can access your website on your own domain.

Troubleshooting

If you uploaded the wrong files, or did something wrong or the upload didn’t go through completely, you can rollback the changes you made. To do this, press Win+R and type cmd and press Enter. This will start the command prompt. Using the CD command navigate to the directory where Google App Engine is installed on your hard drive. Then issue this command:
appcfg.py rollback <full path to your application ID folder>

Wednesday, July 6, 2011

how to custamize footer links in joomla


How to Change the Footer in Joomla

How to Change the Footer in Joomlathumbnail
Editing The Joomla Footer
One of the most commonly requested changes to an installation of the Joomla content management system is how to change the footer information or delete it altogether. As Joomla is freely offered under the GPL License, you can edit or remove the copyright information as long as the information remains within the platform's php source code. This article assumes that you are using a default installation of Joomla version 1.5.15 with the default template rhuk_milkyway. Please note that if you implement a different template into your Joomla installation, the paths described in this article will change where appropriate.

Difficulty:
 
Moderate

Instructions

Things You'll Need

  • Computer
  • Internet connection
  • FTP client
  1. Changing the "Powered by" Footer

    • 1
      Download a copy of your index.php file from your \templates\rhuk_milkyway directory to your local system and make a backup copy. Open the original file with Notepad or your favorite editor and locate the following text starting at around line 158:
      <p id="power_by">
      <?php echo JText::_('Powered by') ?> <a href="http://www.joomla.org">Joomla!</a>.
      <?php echo JText::_('Valid') ?> <a href="http://validator.w3.org/check/referer">XHTML</a>
      <?php echo JText::_('and') ?> <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>.
      </p>
    • 2
      Remove the "Powered by," "Valid," or "and" text, simply by deleting the text between the single quotes leaving only (' ') and save the file. Do not delete any code as you may decide at a later date that you would like to put some text in this area.
    • 3
      To retain the link functionality and change only the text and link destination, we can use eHow as an example of a different link by changing <a href="http://www.joomla.org">Joomla!</a> to <a href="http://www.ehow.com">eHow</a> and saving the file.
    • 4
      To delete the link functionality permanently, delete one or more of the default links by simply removing the encompassing code and text <a href="http://www.joomla.org">Joomla!</a> altogether.
    • 5
      Upload your new index.php file and check your results.

    Changing the Copyright Footer

    • 1
      Download a copy of your en-GB.mod_footer.ini file located in the \language\en-GB directory to your local system and make a back up copy of it. Open the original file and locate the following text:
      -
      FOOTER=Footer
      FOOTER_LINE1=Copyright © %date% %sitename%. All Rights Reserved.
      FOOTER_LINE2=<a href="http://www.joomla.org">Joomla!</a> is Free Software released under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU/GPL License.</a>
    • 2
      To remove all traces of the copyright information, delete all of the text and code to resemble the lines below. Save the file and upload it to your website.
      -
      FOOTER=Footer
      FOOTER_LINE1=
      FOOTER_LINE2=
    • 3
      To edit the copyright information, examine the FOOTER_LINE1 code closely. To remove the "Copyright" text and its symbol, simply remove the following: Copyright ©. To remove the date or site name, remove the percent signs and appropriate corresponding text. For example, remove the date by deleting %date%.
    • 4
      Similar to the edits described in "Powered By" footer instructions, refer to line FOOTER_LINE2= and change the text and link destination to what and where you desire. Often, the original code is changed to point to back to your website similar to <a href="http://www.yourdomainname.com">Your Website</a>.
Ads by Google

Tips & Warnings

  • Experiment with changing both footers. Add additional text or hotlinks or perhaps an image and see how you can make them appear differently.
  • Save yourself some pain and back up your original files before making edits to them.

Saturday, July 2, 2011

How to create a poll in joomla


How to Create a Poll in the Poll Manager

  1. Log in to the Administrator back-end. To learn how to do this read: Logging in or out of the Administrator back-end.
  2. Click the Components> Polls menu item. You should see the Poll Manager screen.
  3. Click the New toolbar button to create your poll.
  4. Type the question that you wish to poll in the Title field .
  5. Type an abbreviated title of your poll in the Alias field.
  6. Change, if desired, the number of seconds between votes for each user in the Lag field.
  7. Select the No or Yes radio button to publish or not your poll.
  8. Type in the Options fields the possible choices for the answers of your poll.
  9. Click the Save or Apply toolbar button to implement the new settings:
    • The Save toolbar button will save your changes and return you to the Poll Manager.
    • The Apply button will save your changes but leave you in Poll [Edit]. You can then click Close if no other changes has been made orSave to leave this screen to return back to the Poll Manager.
You should now see the title of your Poll in the Poll Manager table. If you need to edit it, you can either double click the Poll Title or select the Poll by checking the check mark box and then click the Edit the toolbar button.

How to Publish Your Poll Using the Poll Module

In order for your visitors of your site to participate in your poll, you must now publish it in the Front-end of your site. You must first activate a new Poll module.
  1. Click the Extensions> Module Manager menu item to view the Module Manager screen.
  2. Click the New toolbar button to activate your new poll module.
  3. Select the Poll radio button from the list of installed modules.
  4. Click the Next toolbar button
Details:
  1. Type the title of your Poll module in the Title field.
  2. Select the No or Yes radio button to choose if your module title is published.
  3. Select the No or Yes radio button to enable/publish your module to your site.
  4. Select the module position from the drop down menu.
  5. Select the order that you want this module to appear on your web site if there are more than one module assigned to this position
  6. Select the Access Level as to who is able to see this module on your Web site.
Menu Assignment
  1. Select from the Menu radio buttons AllNone or Select Menu Item(s) from the List. If you choose this last option, then...
  2. Select the Menu items to determine which pages you wish to appear your poll.
Parameters: Module Parameters
  1. Select the Poll from the drop down list
  2. Type the CSS class (if needed) that is included with your CSS file (Cascading Style Sheet). This class is determined by the author of your template.
Advanced Parameters
  1. Select Global or Cashing from the drop down Cashing menu.
    • Global is the setting you have for this module in the Global Configurations section of your Administrator site. (??? to verify)
    • Cashing is the setting for (??? What is this for?)
  1. Click the Save or Apply toolbar button to implement the new settings:
You can now visualize your work in the Front-end of your site.

How to Publish Your Poll Results as a Menu Item

  1. Click the Menu> Mainmenu (or other menu) menu item to view the Menu Item Manager: [mainmenu] screen.
  2. Click the New toolbar button to create a new menu item.
  3. Select Poll> Poll Layout from the list of Select Menu Item Type
Menu Item Details:
  1. Type the title of your poll in the Title field.
  2. Type the abbreviated title in the Alias field.
  3. Leave the Link field as is. (??? - to verify)
  4. Select the menu from the Display In drop down menu that you wish to present your poll results.
  5. Select the parent/child menu item as to where you wish your menu item to be located in the Parent Item drop down menu.
  6. Select the No or Yes radio button to publish/unpublish your new menu item to your site.
  7. New Menu Items default to the last place. Ordering can be changed after this Menu Item is saved in the Order drop down menu.
  8. Select the Access Level as to who is able to see this module on your Web site.
  9. Click from the On Click, Open in: items:
    • Parent Window with Browser Navigation (creates the link within your site with browser navigation)
    • New Window with with Browser Navigation (creates an external link with browser navigation)
    • New Window without Browser Navigation (creates an external link without browser navigation)
Parameters - Basic:
  1. Select the poll from the Poll drop down menu.
Parameters - System
  1. Type (if needed) the page title. (If left blank, the menu item title will be used)
  2. Select the No or Yes radio button to publish/unpublish your page title.
  3. Type the CSS class of your page if different from the standard CSS class for pages.
  4. Select from the Menu Image drop down menu an image that goes to the left or right of your menu item.
  5. Select the SSL Enabled radio button OffIgnored or On. This selects whether or not this link should use SSL and the Secure Site URL.
You can now visualize your work in the Front-end of your site.