<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-38176106</id><updated>2011-04-21T17:16:44.769-07:00</updated><category term='select box'/><category term='logging'/><category term='flash'/><category term='web'/><category term='books'/><category term='before_filter'/><category term='projects vs app'/><category term='newforms'/><category term='funding'/><category term='windows task-manager trouble-shooting'/><category term='pyspotting'/><category term='parsing'/><category term='puzzle'/><category term='api'/><category term='&quot;application.rb&quot;'/><category term='query'/><category term='truncate'/><category term='job'/><category term='frames'/><category term='quick'/><category term='js'/><category term='split strip python string methods'/><category term='rails'/><category term='attributes'/><category term='asp php comparison'/><category term='seek'/><category term='executing custom sql'/><category term='freebsd'/><category term='group'/><category term='write'/><category term='&quot;save()&quot;'/><category term='variables'/><category term='generator'/><category term='html.'/><category term='xml'/><category term='docstrings'/><category term='business'/><category term='oldforms'/><category term='mysql'/><category term='slideshareapi'/><category term='dir'/><category term='os'/><category term='object'/><category term='lambda'/><category term='callable'/><category term='django'/><category term='user'/><category term='style'/><category term='scaffolding'/><category term='hiring'/><category term='rest'/><category term='DML'/><category term='read'/><category term='controller'/><category term='Erb'/><category term='Python Repeat'/><category term='software'/><category term='*nix'/><category term='delicious'/><category term='html'/><category term='innovation'/><category term='session'/><category term='tell'/><category term='&quot;ruby on rails&quot;'/><category term='methods'/><category term='&quot;model objects&quot;'/><category term='request'/><category term='ruby'/><category term='slice'/><category term='dom'/><category term='javascript'/><category term='list'/><category term='lines'/><category term='httpresponse'/><category term='iframe'/><category term='python array sum'/><category term='tag'/><category term='social'/><category term='http'/><category term='help'/><category term='start-up'/><category term='ok/cancel'/><category term='delete'/><category term='commands'/><category term='&quot;url routing&quot;'/><category term='python'/><category term='comparison'/><category term='helper'/><category term='unix timestamp'/><category term='class'/><category term='forms'/><category term='script &quot;action script&quot; flash'/><category term='tease'/><category term='timestamp'/><category term='database'/><category term='linux'/><category term='python string comparison'/><category term='del.icio.us'/><category term='dummies guide'/><category term='loops'/><category term='render_to_response'/><category term='views'/><category term='startup'/><category term='bsd'/><category term='files'/><category term='metaprogramming'/><category term='simple'/><category term='context'/><category term='blog'/><category term='frameset'/><category term='widgets'/><category term='reflexivity'/><category term='Entrepreneurship'/><category term='DDL'/><category term='&quot;file handling&quot;'/><category term='filters'/><category term='ruby on rails'/><category term='sql'/><category term='web2.0'/><category term='&quot;render_component&quot;'/><category term='identity'/><category term='administration'/><category term='databasr'/><category term='ror'/><category term='slideshare'/><category term='vc'/><category term='is'/><title type='text'>Python, JavaScript and all that Technology</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>46</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-38176106.post-7690908019397442090</id><published>2008-02-06T11:33:00.000-08:00</published><updated>2008-02-06T11:47:16.474-08:00</updated><title type='text'></title><content type='html'>&lt;object height="355" width="425"&gt;&lt;br /&gt;&lt;param name="movie" value="http://www.youtube. com/v/LabCylbapuM&amp;amp;rel=1"&gt;&lt;br /&gt;&lt;param name="wmode" value="transparent"&gt;&lt;br /&gt;&lt;embed src="http://www.youtube.com/v/LabCylbapuM&amp;amp;rel=1" type="application/x-sho ckwave-flash" wmode="transparent" height="355" width="425"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-7690908019397442090?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/7690908019397442090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=7690908019397442090' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7690908019397442090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7690908019397442090'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2008/02/blog-post.html' title=''/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-2557727819868304258</id><published>2007-12-12T01:26:00.000-08:00</published><updated>2007-12-12T02:18:37.506-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='slideshare'/><category scheme='http://www.blogger.com/atom/ns#' term='rest'/><category scheme='http://www.blogger.com/atom/ns#' term='dummies guide'/><category scheme='http://www.blogger.com/atom/ns#' term='api'/><category scheme='http://www.blogger.com/atom/ns#' term='slideshareapi'/><title type='text'>Dummies guide for using Slideshare Api using Ruby</title><content type='html'>unix timestamp =&gt;  TS = Time.now.to_i&lt;br /&gt;get hash =&gt; HASH = Digest::SHA1.hexdigest(sharedsecret+TS)&lt;br /&gt;Api Key =&gt; AKEY&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;AKEY and sharedsecret will be mailed to you once you apply for API&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.slideshare.net/developers/documentation"&gt;http://www.slideshare.net/developers/documentation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;for ex:&lt;br /&gt;&lt;a href="http://www.slideshare.net/api/1/get_slideshow?api_key=AKEY&amp;ts=TS&amp;hash=HASH&amp;username=UN&amp;password=PWD&amp;slideshow_id=Sid"&gt;http://www.slideshare.net/api/1/get_slideshow?api_key=AKEY&amp;ts=TS&amp;hash=HASH&amp;username=UN&amp;password=PWD&amp;slideshow_id=Sid&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-2557727819868304258?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/2557727819868304258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=2557727819868304258' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2557727819868304258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2557727819868304258'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/12/dummies-guide-for-using-slideshare-api.html' title='Dummies guide for using Slideshare Api using Ruby'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1088578571564169026</id><published>2007-12-12T00:42:00.000-08:00</published><updated>2007-12-12T00:43:29.174-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='ror'/><category scheme='http://www.blogger.com/atom/ns#' term='unix timestamp'/><category scheme='http://www.blogger.com/atom/ns#' term='timestamp'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby on rails'/><title type='text'>unix timestamp in ruby</title><content type='html'>Time.now.to_i&lt;br /&gt;&lt;br /&gt;for more &lt;a href="http://wiki.rubyonrails.org/rails/pages/PhpDateAndTimeFunctions"&gt;http://wiki.rubyonrails.org/rails/pages/PhpDateAndTimeFunctions&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1088578571564169026?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1088578571564169026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1088578571564169026' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1088578571564169026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1088578571564169026'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/12/unix-timestamp-in-ruby.html' title='unix timestamp in ruby'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-6579099126582656072</id><published>2007-12-11T02:54:00.000-08:00</published><updated>2007-12-11T02:58:39.694-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='forms'/><category scheme='http://www.blogger.com/atom/ns#' term='django'/><category scheme='http://www.blogger.com/atom/ns#' term='class'/><category scheme='http://www.blogger.com/atom/ns#' term='oldforms'/><category scheme='http://www.blogger.com/atom/ns#' term='style'/><category scheme='http://www.blogger.com/atom/ns#' term='attributes'/><title type='text'>Adding classes/style to django form elements</title><content type='html'>The 'attrs' argument to the Widget class used with each particular&lt;br /&gt;Field (the Widget is what actually renders the HTML) accepts a&lt;br /&gt;dictionary which will become HTML attribute names and values. For&lt;br /&gt;example:&lt;br /&gt;&lt;br /&gt;username = forms.CharField(widget=forms.TextInput(attrs={'class': 'myclass'}))&lt;br /&gt;&lt;br /&gt;will become:&lt;br /&gt;&lt;br /&gt;&lt;input type="text" class="myclass" /&gt; &lt;br /&gt;&lt;br /&gt;the old forms default of having class attributes for each&lt;br /&gt;input type (e.g. class=vTextField for type=text)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-6579099126582656072?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/6579099126582656072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=6579099126582656072' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/6579099126582656072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/6579099126582656072'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/12/adding-classesstyle-to-django-form.html' title='Adding classes/style to django form elements'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-6582528169950322078</id><published>2007-12-09T22:53:00.000-08:00</published><updated>2007-12-09T23:29:08.804-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ror'/><category scheme='http://www.blogger.com/atom/ns#' term='select box'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby on rails'/><category scheme='http://www.blogger.com/atom/ns#' term='databasr'/><title type='text'>populating select box from database ror</title><content type='html'>controller code looks something like:&lt;br /&gt;&lt;br /&gt;class testController &lt; ApplicationController     &lt;br /&gt;   &lt;br /&gt;     def test          &lt;br /&gt;          @categories= Category.find_all&lt;br /&gt;     end&lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;use&lt;br /&gt;&lt;%= options_from_collection_for_select @categories, 'id', 'name' %&gt;&lt;br /&gt;to populate the select box&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;select id="category_id" name="todo[category_id]"&gt;&lt;br /&gt;&lt;%= options_from_collection_for_select @categories, 'id', 'name' %&gt;&lt;br /&gt;&lt;/select&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-6582528169950322078?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/6582528169950322078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=6582528169950322078' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/6582528169950322078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/6582528169950322078'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/12/populating-select-box-from-database-ror.html' title='populating select box from database ror'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-2442712149679077066</id><published>2007-12-08T03:05:00.000-08:00</published><updated>2007-12-09T03:59:45.355-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='newforms'/><category scheme='http://www.blogger.com/atom/ns#' term='forms'/><category scheme='http://www.blogger.com/atom/ns#' term='django'/><category scheme='http://www.blogger.com/atom/ns#' term='widgets'/><category scheme='http://www.blogger.com/atom/ns#' term='oldforms'/><title type='text'>Django Forms</title><content type='html'>Start with this basic Form subclass, which we’ll call ContactForm:&lt;br /&gt;&lt;br /&gt;from django import newforms as forms&lt;br /&gt;&lt;br /&gt;class ContactForm(forms.Form):&lt;br /&gt;    subject = forms.CharField(max_length=100)&lt;br /&gt;    message = forms.CharField()&lt;br /&gt;    sender = forms.EmailField()&lt;br /&gt;    cc_myself = forms.BooleanField(required=False)&lt;br /&gt;&lt;br /&gt;A form is composed of Field objects. &lt;br /&gt;&lt;br /&gt;Creating Form instances&lt;br /&gt;&lt;br /&gt;A Form instance is either bound to a set of data, or unbound.&lt;br /&gt;&lt;br /&gt;    * If it’s bound to a set of data, it’s capable of validating that data and rendering the form as HTML with the data displayed in the HTML.&lt;br /&gt;    * If it’s unbound, it cannot do validation but it can still render the blank form as HTML.&lt;br /&gt;&lt;br /&gt;To create an unbound Form instance, simply instantiate the class:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; f = ContactForm()&lt;br /&gt;&lt;br /&gt;To bind data to a form, pass the data as a dictionary as the first parameter to your Form class constructor:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; data = {'subject': 'hello',&lt;br /&gt;...         'message': 'Hi there',&lt;br /&gt;...         'sender': 'foo@example.com',&lt;br /&gt;...         'cc_myself': True}&lt;br /&gt;&gt;&gt;&gt; f = ContactForm(data)&lt;br /&gt;&lt;br /&gt;In this dictionary, the keys are the field names, which correspond to the attributes in your Form class. The values are the data you’re trying to validate. These will usually be strings, but there’s no requirement that they be strings; the type of data you pass depends on the Field, as we’ll see in a moment.&lt;br /&gt;&lt;br /&gt;If you need to distinguish between bound and unbound form instances at runtime, check the value of the form’s is_bound attribute:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; f = ContactForm()&lt;br /&gt;&gt;&gt;&gt; f.is_bound&lt;br /&gt;False&lt;br /&gt;&gt;&gt;&gt; f = ContactForm({'subject': 'hello'})&lt;br /&gt;&gt;&gt;&gt; f.is_bound&lt;br /&gt;True&lt;br /&gt;&lt;br /&gt;Note that passing an empty dictionary creates a bound form with empty data:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; f = ContactForm({})&lt;br /&gt;&gt;&gt;&gt; f.is_bound&lt;br /&gt;True&lt;br /&gt;&lt;br /&gt;If you have a bound Form instance and want to change the data somehow, or if you want to bind an unbound Form instance to some data, create another Form instance. There is no way to change data in a Form instance. Once a Form instance has been created, you should consider its data immutable, whether it has data or not.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1) The primary task of a Form object is to validate data. With a bound Form instance, call the is_valid() method to run validation and return a boolean designating whether the data was valid:&lt;br /&gt;2) Each Field in a Form class is responsible not only for validating data, but also for “cleaning” it — normalizing it to a consistent format.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;f.errors&lt;/span&gt;&lt;br /&gt;In this dictionary, the keys are the field names, and the values are lists of Unicode strings representing the error messages. The error messages are stored in lists because a field can have multiple error messages.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt; f.cleaned_data&lt;/span&gt;&lt;br /&gt;If your data does not validate, your Form instance will not have a cleaned_data attribute:&lt;br /&gt;&lt;br /&gt;cleaned_data will always only contain a key for fields defined in the Form, even if you pass extra data when you define the Form. In this example, we pass a bunch of extra fields to the ContactForm constructor, but cleaned_data contains only the form’s fields:&lt;br /&gt;&lt;br /&gt;print f&lt;br /&gt;&lt;br /&gt;You can access errors without having to call is_valid() first. The form’s data will be validated the first time either you call is_valid() or access errors.&lt;br /&gt;&lt;br /&gt;The validation routines will only get called once, regardless of how many times you access errors or call is_valid()&lt;br /&gt;&lt;br /&gt;Each field type has a default HTML representation. CharField and EmailField are represented by an &lt;input type="text"&gt;. BooleanField is represented by an &lt;input type="checkbox"&gt;. Note these are merely sensible defaults; you can specify which HTML to use for a given field by using widgets&lt;br /&gt;&lt;br /&gt;Use the auto_id argument to the Form constructor to control the label and id behavior. This argument must be True, False or a string.&lt;br /&gt;If auto_id is False, then the form output will not include &lt;label&gt; tags nor id attributes: f = ContactForm(auto_id=False)&lt;br /&gt;&lt;br /&gt;To reorder the HTML output, just change the order in which those fields are listed in the class.&lt;br /&gt;&lt;br /&gt;By default, forms use django.newforms.util.ErrorList to format validation errors. If you’d like to use an alternate class for displaying errors, you can pass that in at construction time:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; from django.newforms.util import ErrorList&lt;br /&gt;&gt;&gt;&gt; class DivErrorList(ErrorList):&lt;br /&gt;...     def __unicode__(self):&lt;br /&gt;...         return self.as_divs()&lt;br /&gt;...     def as_divs(self):&lt;br /&gt;...         if not self: return u''&lt;br /&gt;...         return u'&lt;div class="errorlist"&gt;%s&lt;/div&gt;' % ''.join([u'&lt;div class="error"&gt;%s&lt;/div&gt;' % e for e in self])&lt;br /&gt;&gt;&gt;&gt; f = ContactForm(data, auto_id=False, error_class=DivErrorList)&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; str(f['subject'])&lt;br /&gt;'&lt;input id="id_subject" type="text" name="subject" maxlength="100" /&gt;'&lt;br /&gt;&gt;&gt;&gt; unicode(f['subject'])&lt;br /&gt;u'&lt;input id="id_subject" type="text" name="subject" maxlength="100" /&gt;'&lt;br /&gt;&lt;br /&gt;For a field’s list of errors, access the field’s errors attribute. This is a list-like object that is displayed as an HTML &lt;ul class="errorlist"&gt;&lt;/ul&gt; when printed:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Subclassing forms&lt;br /&gt;&lt;br /&gt;If you have multiple Form classes that share fields, you can use subclassing to remove redundancy.&lt;br /&gt;&lt;br /&gt;When you subclass a custom Form class, the resulting subclass will include all fields of the parent class(es), followed by the fields you define in the subclass.&lt;br /&gt;&lt;br /&gt;In this example, ContactFormWithPriority contains all the fields from ContactForm, plus an additional field, priority. The ContactForm fields are ordered first:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; class ContactFormWithPriority(ContactForm):&lt;br /&gt;...     priority = forms.CharField()&lt;br /&gt;&gt;&gt;&gt; f = ContactFormWithPriority(auto_id=False)&lt;br /&gt;&lt;br /&gt;It’s possible to subclass multiple forms, treating forms as “mix-ins.” In this example, BeatleForm subclasses both PersonForm and InstrumentForm (in that order), and its field list includes the fields from the parent classes:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; class PersonForm(Form):&lt;br /&gt;...     first_name = CharField()&lt;br /&gt;...     last_name = CharField()&lt;br /&gt;&gt;&gt;&gt; class InstrumentForm(Form):&lt;br /&gt;...     instrument = CharField()&lt;br /&gt;&gt;&gt;&gt; class BeatleForm(PersonForm, InstrumentForm):&lt;br /&gt;...     haircut_type = CharField()&lt;br /&gt;&gt;&gt;&gt; b = BeatleForm(auto_id=False)&lt;br /&gt;&lt;br /&gt;label&lt;br /&gt;&lt;br /&gt;The label argument lets you specify the “human-friendly” label for this field. This is used when the Field is displayed in a Form.&lt;br /&gt;&lt;br /&gt;As explained in “Outputting forms as HTML” above, the default label for a Field is generated from the field name by converting all underscores to spaces and upper-casing the first letter. Specify label if that default behavior doesn’t result in an adequate label.&lt;br /&gt;&lt;br /&gt;The error_messages argument lets you override the default messages that the field will raise. Pass in a dictionary with keys matching the error messages you want to override.&lt;br /&gt;name = forms.CharField(error_messages={'required': 'Please enter your name'})&lt;br /&gt;&lt;br /&gt;In general, any cleaning method can raise ValidationError if there is a problem with the data it is processing, passing the relevant error message to the ValidationError constructor. If no ValidationError is raised, the method should return the cleaned (normalised) data as a Python object.&lt;br /&gt;&lt;br /&gt;A widget is Django’s representation of a HTML input element. The widget handles the rendering of the HTML, and the extraction of data from a GET/POST dictionary that corresponds to the widget.&lt;br /&gt;&lt;br /&gt;Django provides a representation of all the basic HTML widgets, plus some commonly used groups of widgets:&lt;br /&gt;Whenever you specify a field on a form, Django will use a default widget that is appropriate to the type of data that is to be displayed.&lt;br /&gt;&lt;br /&gt;However, if you want to use a different widget for a field, you can - just use the ‘widget’ argument on the field definition. For example:&lt;br /&gt;&lt;br /&gt;class CommentForm(forms.Form):&lt;br /&gt;    name = forms.CharField()&lt;br /&gt;    url = forms.URLField()&lt;br /&gt;    comment = forms.CharField(widget=forms.Textarea)&lt;br /&gt;&lt;br /&gt;This would specify a form with a comment that uses a larger Textarea widget, rather than the default TextInput widget&lt;br /&gt;&lt;br /&gt;If you want to make one widget look different to another, you need to specify additional attributes for each widget. When you specify a widget, you can provide a list of attributes that will be added to the rendered HTML for the widget.&lt;br /&gt;&lt;br /&gt;class CommentForm(forms.Form):&lt;br /&gt;    name = forms.CharField(&lt;br /&gt;                widget=forms.TextInput(attrs={'class':'special'}))&lt;br /&gt;    url = forms.URLField()&lt;br /&gt;    comment = forms.CharField(&lt;br /&gt;               widget=forms.TextInput(attrs={'size':'40'}))&lt;br /&gt;&lt;br /&gt;Django will then include the extra attributes in the rendered output:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Custom Widgets&lt;br /&gt;&lt;br /&gt;When you start to write a lot of forms, you will probably find that you will reuse certain sets of widget attributes over and over again. Rather than repeat these attribute definitions every time you need them, Django allows you to capture those definitions as a custom widget.&lt;br /&gt;&lt;br /&gt;For example, if you find that you are including a lot of comment fields on forms, you could capture the idea of a TextInput with a specific size attribute as a custom extension to the TextInput widget:&lt;br /&gt;&lt;br /&gt;class CommentWidget(forms.TextInput):&lt;br /&gt;    def __init__(self, *args, **kwargs):&lt;br /&gt;        kwargs.setdefault('attrs',{}).update({'size': '40'})&lt;br /&gt;        super(CommentWidget, self).__init__(*args, **kwargs)&lt;br /&gt;&lt;br /&gt;Then you can use this widget in your forms:&lt;br /&gt;&lt;br /&gt;class CommentForm(forms.Form):&lt;br /&gt;    name = forms.CharField()&lt;br /&gt;    url = forms.URLField()&lt;br /&gt;    comment = forms.CharField(widget=CommentWidget)&lt;br /&gt;&lt;br /&gt;You can even customize your custom widget, in the same way as you would any other widget. Adding a once-off class to your CommentWidget is as simple as adding an attribute definition:&lt;br /&gt;&lt;br /&gt;class CommentForm(forms.Form):&lt;br /&gt;    name = forms.CharField(max_length=20)&lt;br /&gt;    url = forms.URLField()&lt;br /&gt;    comment = forms.CharField(&lt;br /&gt;                widget=CommentWidget(attrs={'class': 'special'}))&lt;br /&gt;&lt;br /&gt;Django also makes it easy to specify a custom field type that uses your custom widget. For example, you could define a customized field type for comments by defining:&lt;br /&gt;&lt;br /&gt;class CommentInput(forms.CharField):&lt;br /&gt;    widget = CommentWidget&lt;br /&gt;&lt;br /&gt;You can then use this field whenever you have a form that requires a comment:&lt;br /&gt;&lt;br /&gt;class CommentForm(forms.Form):&lt;br /&gt;    name = forms.CharField()&lt;br /&gt;    url = forms.URLField()&lt;br /&gt;    comment = CommentInput()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;initial&lt;br /&gt;&lt;br /&gt;The initial argument lets you specify the initial value to use when rendering this Field in an unbound Form.&lt;br /&gt;&lt;br /&gt;The use-case for this is when you want to display an “empty” form in which a field is initialized to a particular value.&lt;br /&gt;&lt;br /&gt;The widget argument lets you specify a Widget class to use when rendering this Field.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-2442712149679077066?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/2442712149679077066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=2442712149679077066' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2442712149679077066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2442712149679077066'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/12/django-forms.html' title='Django Forms'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-4828085111181397752</id><published>2007-11-24T23:30:00.000-08:00</published><updated>2007-12-13T00:16:07.927-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='http'/><category scheme='http://www.blogger.com/atom/ns#' term='django'/><category scheme='http://www.blogger.com/atom/ns#' term='context'/><category scheme='http://www.blogger.com/atom/ns#' term='httpresponse'/><category scheme='http://www.blogger.com/atom/ns#' term='render_to_response'/><title type='text'>render_to_response()</title><content type='html'>&lt;span style="font-weight:bold;"&gt;render_to_response()&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Because it’s such a common idiom to load a template, fill a Context and return an HttpResponse object with the result of the&lt;br /&gt;rendered template, Django provides a shortcut that lets you do those things in one line of code. This shortcut is a function&lt;br /&gt;called render_to_response(), which lives in the module django.shortcuts. Most of the time, you’ll be using render_to_response() rather than loading templates and creating Context and HttpResponse objects manually.&lt;br /&gt;&lt;br /&gt;Here’s the ongoing current_datetime example rewritten to use render_to_response():&lt;br /&gt;&lt;br /&gt;from django.shortcuts import render_to_response&lt;br /&gt;import datetime&lt;br /&gt;def current_datetime(request):&lt;br /&gt;now = datetime.datetime.now()&lt;br /&gt;return render_to_response('current_datetime.html', {'current_date': now})&lt;br /&gt;&lt;br /&gt;What a difference! Let’s step through the code changes:&lt;br /&gt;l We no longer have to import get_template, Template, Context or HttpResponse. Instead, we&lt;br /&gt;import django.shortcuts.render_to_response. The import datetime remains.&lt;br /&gt;l Within the current_datetime function, we still calculate now, but the template loading, context creation, template rendering&lt;br /&gt;and HttpResponse creation is all taken care of by the render_to_response() call. Because render_to_response() returns&lt;br /&gt;an HttpResponse object, we can simply return that value in the view.&lt;br /&gt;The first argument to render_to_response() should be the name of the template to use, relative to your template directory. The&lt;br /&gt;second argument, if given, should be a dictionary to use in creating a Context for that template. If you don’t provide a second&lt;br /&gt;argument, render_to_response() will use an empty dictionary&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-4828085111181397752?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/4828085111181397752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=4828085111181397752' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4828085111181397752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4828085111181397752'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/11/rendertoresponse.html' title='render_to_response()'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-4927150268394634557</id><published>2007-11-23T18:32:00.000-08:00</published><updated>2007-11-24T23:29:50.607-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='django'/><category scheme='http://www.blogger.com/atom/ns#' term='projects vs app'/><category scheme='http://www.blogger.com/atom/ns#' term='executing custom sql'/><category scheme='http://www.blogger.com/atom/ns#' term='request'/><title type='text'>Django Stuff - 1</title><content type='html'>Projects vs. apps&lt;br /&gt;&lt;br /&gt;What’s the difference between a project and an app? An app is a Web application that does something — e.g., a weblog system, a database of public records or a simple poll app. A project is a collection of configuration and apps for a particular Web site. A project can contain multiple apps. An app can be in multiple projects.&lt;br /&gt;&lt;br /&gt;Each model is a Python class that subclasses django.db.models.Model.&lt;br /&gt;Each attribute of the model represents a database field.&lt;br /&gt;Model metadata (non-field information) goes in an inner class named Meta.&lt;br /&gt;Metadata used for Django’s admin site goes into an inner class named Admin&lt;br /&gt;&lt;br /&gt;Executing Custon SQL&lt;br /&gt;def my_custom_sql(self):&lt;br /&gt;    from django.db import connection&lt;br /&gt;    cursor = connection.cursor()&lt;br /&gt;    cursor.execute("SELECT foo FROM bar WHERE baz = %s", [self.baz])&lt;br /&gt;    row = cursor.fetchone()&lt;br /&gt;    return row&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;How Django processes a request&lt;br /&gt;&lt;br /&gt;When a user requests a page from your Django-powered site, this is the algorithm the system follows to determine which Python code to execute:&lt;br /&gt;Django looks at the ROOT_URLCONF setting in your settings file. This should be a string representing the full Python import path to your URLconf. For example: "mydjangoapps.urls".&lt;br /&gt;Django loads that Python module and looks for the variable urlpatterns. This should be a Python list, in the format returned by the function django.conf.urls.defaults.patterns().&lt;br /&gt;Django runs through each URL pattern, in order, and stops at the first one that matches the requested URL.&lt;br /&gt;Once one of the regexes matches, Django imports and calls the given view, which is a simple Python function. The view gets passed a request object as its first argument and any values captured in the regex as remaining arguments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-4927150268394634557?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/4927150268394634557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=4927150268394634557' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4927150268394634557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4927150268394634557'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/11/django-stuff-1.html' title='Django Stuff - 1'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1572581865852161358</id><published>2007-04-24T23:02:00.000-07:00</published><updated>2007-05-09T02:34:11.899-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='linux'/><category scheme='http://www.blogger.com/atom/ns#' term='user'/><category scheme='http://www.blogger.com/atom/ns#' term='group'/><category scheme='http://www.blogger.com/atom/ns#' term='commands'/><category scheme='http://www.blogger.com/atom/ns#' term='bsd'/><title type='text'>More Commands @ FreeBSD</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Clearing the Terminal:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Clear&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Adding a User:&lt;br /&gt;&lt;/span&gt;&lt;pre&gt;adduser  [-u uid [-o]] [-g group] [-G group,...]&lt;br /&gt;[-d home] [-s shell] [-c comment] [-m [-k template]]&lt;br /&gt;[-f inactive] [-e expire mm/dd/yy] [-p passwd] [-n] [-r] name&lt;br /&gt;adduser  -D [-g group] [-b base] [-s shell] [-f inactive] [-e expire mm/dd/yy]&lt;/pre&gt;&lt;span name="intelliTxt" id="intelliTxt"&gt;&lt;p style="font-weight: bold;" nd="23"&gt;To see what groups anyone else belongs to:&lt;/p&gt;&lt;p nd="23"&gt;Add their login name to the end of the groups command like so:&lt;br /&gt;groups genisis&lt;/p&gt;&lt;/span&gt;&lt;span name="intelliTxt" id="intelliTxt"&gt;&lt;span style="font-weight: bold;"&gt;Add a group:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span name="intelliTxt" id="intelliTxt"&gt;&lt;pre&gt;&lt;code&gt;pw group add group1&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;span name="intelliTxt" id="intelliTxt"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span name="intelliTxt" id="intelliTxt"&gt;&lt;span style="font-weight: bold;"&gt;To add users user1&lt;/span&gt;&lt;code style="font-weight: bold;"&gt;&lt;/code&gt;&lt;span style="font-weight: bold;"&gt; and user2&lt;/span&gt;&lt;code style="font-weight: bold;"&gt;&lt;/code&gt;&lt;span style="font-weight: bold;"&gt; to the group( group1):&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span name="intelliTxt" id="intelliTxt"&gt;&lt;pre&gt;&lt;code&gt;pw groupmod group1 -M user1,user2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1572581865852161358?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1572581865852161358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1572581865852161358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1572581865852161358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1572581865852161358'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/04/more-commands-freebsd.html' title='More Commands @ FreeBSD'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-5444136329481258353</id><published>2007-04-19T02:16:00.000-07:00</published><updated>2007-04-24T23:02:31.358-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='freebsd'/><category scheme='http://www.blogger.com/atom/ns#' term='*nix'/><category scheme='http://www.blogger.com/atom/ns#' term='commands'/><title type='text'>Commands @ FreeBSD</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Delete all contents of a directory&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;rm -f  *&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Download a file from a URL&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;wget URL&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Delete a directory&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;rm -r dirname&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Delete a file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;rm -f filename&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;List Processes&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;ps ax&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;Killing a process&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Kill -9 PID&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Finding a file&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;find (where to find) -name FileName&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-5444136329481258353?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/5444136329481258353/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=5444136329481258353' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5444136329481258353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5444136329481258353'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/04/commands-freebsd.html' title='Commands @ FreeBSD'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-7128128964914968750</id><published>2007-04-10T23:04:00.000-07:00</published><updated>2007-04-10T23:05:47.088-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='files'/><category scheme='http://www.blogger.com/atom/ns#' term='lines'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>Counting number of lines in a file @ python</title><content type='html'>&lt;pre&gt;f = open(filename)&lt;br /&gt;lines = f.readlines()&lt;br /&gt;f.close()&lt;br /&gt;&lt;br /&gt;print "%s has %d lines." % (filename, len(lines))&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-7128128964914968750?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/7128128964914968750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=7128128964914968750' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7128128964914968750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7128128964914968750'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/04/counting-number-of-lines-in-file-python.html' title='Counting number of lines in a file @ python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-3425331456399088970</id><published>2007-03-28T22:41:00.000-07:00</published><updated>2007-03-28T22:43:12.158-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='query'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>copying data from one table to another @ mysql</title><content type='html'>insert into tbl (field1,field2) select field1,field2 from users&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-3425331456399088970?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/3425331456399088970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=3425331456399088970' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/3425331456399088970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/3425331456399088970'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/03/copying-data-from-one-table-to-another.html' title='copying data from one table to another @ mysql'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-7515932225798285832</id><published>2007-03-27T00:32:00.000-07:00</published><updated>2007-03-27T22:45:26.893-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='loops'/><title type='text'>Loops @ Ruby</title><content type='html'>&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt;n.times {|i| puts i}&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt;Well, the method Integer#times iterate self times (n in this) and for each iteration calls the block, gives it the current value।&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt;something do |line|&lt;br /&gt; #process something and line here&lt;br /&gt;end&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt;something' is a method and this method call the block with&lt;br /&gt;some value.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt; For example if you want to read a file, you write&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt;  IO.foreach('file') do |line|&lt;br /&gt;   # do something with line&lt;br /&gt;end&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt; the method IO::foreach open the file given in argument, read each line and&lt;br /&gt;call the block, given it the current line. At the end, IO::foreach close&lt;br /&gt;the file&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;n.times {|i| puts i}&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;n.times do |i|&lt;br /&gt; puts i&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;a=["hello","to","you"]&lt;br /&gt;a.each {|i| puts i}&lt;br /&gt;&lt;br /&gt;(1..10)each{|i| puts i}&lt;br /&gt;&lt;br /&gt;or&lt;br /&gt;&lt;br /&gt;for i in (1..10)&lt;br /&gt;   puts i&lt;br /&gt; end&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span class="fixed_width"  style="font-family:Courier,Monospaced;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-7515932225798285832?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/7515932225798285832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=7515932225798285832' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7515932225798285832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7515932225798285832'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/03/loops-ruby.html' title='Loops @ Ruby'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-5251637801722727705</id><published>2007-03-26T09:43:00.000-07:00</published><updated>2007-03-26T21:33:22.765-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='os'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;file handling&quot;'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='seek'/><category scheme='http://www.blogger.com/atom/ns#' term='tell'/><title type='text'>File Handling @ Python</title><content type='html'>A file object maintains state about the file it has open. The tell method of a file object tells you your current position in the open file. Since you haven't done anything with this file yet, the current position is 0, which is the beginning of the file.&lt;br /&gt;The seek method of a file object moves to another position in the open file. The second parameter specifies what the first one means; 0 means move to an absolute position (counting from the start of the file), 1 means move to a relative position (counting from the current position), and 2 means move to a position relative to the end of the file. Since the MP3 tags you're looking for are stored at the end of the file, you use 2 and tell the file object to move to a position 128 bytes from the end of the file.&lt;br /&gt;The tell method confirms that the current file position has moved.&lt;br /&gt;The read method reads a specified number of bytes from the open file and returns a string with the data that was read। The optional parameter specifies the maximum number of bytes to read. If no parameter is specified, read will read until the end of the file. (You could have simply said read() here, since you know exactly where you are in the file and you are, in fact, reading the last 128 bytes.) The read data is assigned to the tagData variable, and the current position is updated based on how many bytes were read.&lt;br /&gt;&lt;br /&gt;import os&lt;br /&gt;def filesnsubfiles(root):&lt;br /&gt;   file = os.listdir(root)&lt;br /&gt;   for i in file:      &lt;br /&gt;       if os.path.isdir(root + "\\" + i):&lt;br /&gt;           filesnsubfiles(root + "\\" + i)&lt;br /&gt;       else:&lt;br /&gt;           print (root + "\\" + i)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-5251637801722727705?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/5251637801722727705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=5251637801722727705' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5251637801722727705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5251637801722727705'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/03/file-handling-python.html' title='File Handling @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-5850805977711376529</id><published>2007-03-16T22:57:00.000-07:00</published><updated>2007-03-16T23:44:38.345-07:00</updated><title type='text'>Ubiquitous Ubuntu</title><content type='html'>gconf-editor&lt;br /&gt;&lt;br /&gt;installing make command&lt;br /&gt;&lt;a href="http://www.linuxforums.org/forum/ubuntu-help/66650-installing-make-command-offline.html"&gt;http://www.linuxforums.org/forum/ubuntu-help/66650-installing-make-command-offline.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-5850805977711376529?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/5850805977711376529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=5850805977711376529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5850805977711376529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5850805977711376529'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/03/ubiquitous-ubuntu.html' title='Ubiquitous Ubuntu'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-9121079187987058081</id><published>2007-03-12T22:16:00.000-07:00</published><updated>2007-03-12T23:13:09.511-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='script &quot;action script&quot; flash'/><title type='text'>ActionScript</title><content type='html'>Some of the differences between ActionScript and JavaScript are as follows:&lt;br /&gt;&lt;br /&gt;• ActionScript does not support browser-specific objects such as Document, Window,&lt;br /&gt;and Anchor.&lt;br /&gt;• ActionScript does not completely support all the JavaScript built-in objects.&lt;br /&gt;• ActionScript does not support some JavaScript syntax constructs, such as statement labels.&lt;br /&gt;• In ActionScript, the eval() action can perform only variable references&lt;br /&gt;&lt;br /&gt;An introduction to important ActionScript terms.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Actions&lt;/strong&gt; are statements that instruct a SWF file to do something while it is playing. For example,&lt;br /&gt;gotoAndStop() sends the playhead to a specific frame or label. In this manual, the terms action&lt;br /&gt;and statement are interchangeable.&lt;br /&gt;&lt;strong&gt;Boolean&lt;/strong&gt; is a true or false value.&lt;br /&gt;&lt;strong&gt;Classes&lt;/strong&gt; are data types that you can create to define a new type of object. To define a class,&lt;br /&gt;you use the class keyword in an external script file (not in a script you are writing in the&lt;br /&gt;Actions panel).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Constants&lt;/strong&gt; are elements that don’t change. For example, the constant Key.TAB always has the&lt;br /&gt;same meaning: it indicates the Tab key on a keyboard. Constants are useful for comparing values.&lt;br /&gt;&lt;strong&gt;Constructors&lt;/strong&gt; are functions that you use to define the properties and methods of a class.&lt;br /&gt;By definition, constructors are functions within a class definition that have the same name&lt;br /&gt;as the class. For example, the following code defines a Circle class and implements a&lt;br /&gt;constructor function:&lt;br /&gt;// file Circle.as&lt;br /&gt;class Circle {&lt;br /&gt;private var radius:Number&lt;br /&gt;private var circumference:Number&lt;br /&gt;// constructor&lt;br /&gt;function Circle(radius:Number) {&lt;br /&gt;circumference = 2 * Math.PI * radius;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;The term constructor is also used when you create (instantiate) an object based on a particular&lt;br /&gt;class. The following statements are constructors for the built-in Array class and the custom&lt;br /&gt;Circle class:&lt;br /&gt;my_array:Array = new Array();&lt;br /&gt;my_circle:Circle = new Circle();&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Data types&lt;/strong&gt; describe the kind of information a variable or ActionScript element can hold. The&lt;br /&gt;ActionScript data types are String, Number, Boolean, Object, MovieClip, Function, null, and&lt;br /&gt;undefined.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Events&lt;/strong&gt; are actions that occur while a SWF file is playing. For example, different events are&lt;br /&gt;generated when a movie clip loads, the playhead enters a frame, the user clicks a button or movie&lt;br /&gt;clip, or the user types on the keyboard&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Event handlers&lt;/strong&gt; are special actions that manage events such as mouseDown or load. There are two&lt;br /&gt;kinds of ActionScript event handlers: event handler methods and event listeners. (There are also&lt;br /&gt;two event handlers, on() and onClipEvent(), that you can assign directly to buttons and movie&lt;br /&gt;clips.) In the Actions toolbox, each ActionScript object that has event handler methods or event&lt;br /&gt;listeners has a subcategory called Events or Listeners. Some commands can be used both as event&lt;br /&gt;handlers and as event listeners and are included in both subcategories&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Identifiers&lt;/strong&gt; are names used to indicate a variable, property, object, function, or method. The first&lt;br /&gt;character must be a letter, underscore (_), or dollar sign ($). Each subsequent character must be a&lt;br /&gt;letter, number, underscore, or dollar sign. For example, firstName is the name of a variable.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Instances&lt;/strong&gt; are objects that belong to a certain class. Each instance of a class contains all the&lt;br /&gt;properties and methods of that class. For example, all movie clips are instances of the MovieClip&lt;br /&gt;class, so you can use any of the methods or properties of the MovieClip class with any movie&lt;br /&gt;clip instance&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Instance names&lt;/strong&gt; are unique names that let you target movie clip and button instances in scripts.&lt;br /&gt;You use the Property inspector to assign instance names to instances on the Stage. For example, a&lt;br /&gt;master symbol in the library could be called counter and the two instances of that symbol in&lt;br /&gt;the SWF file could have the instance names scorePlayer1_mc and scorePlayer2_mc. The&lt;br /&gt;following code sets a variable called score inside each movie clip instance by using&lt;br /&gt;instance names:&lt;br /&gt;_root.scorePlayer1_mc.score += 1;&lt;br /&gt;_root.scorePlayer2_mc.score -= 1;&lt;br /&gt;You can use special suffixes when naming instances&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Methods &lt;/strong&gt;&lt;br /&gt;are functions associated with a class. For example, getBytesLoaded() is a built-in&lt;br /&gt;method associated with the MovieClip class. You can also create functions that act as methods,&lt;br /&gt;either for objects based on built-in classes or for objects based on classes that you create&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Objects&lt;/strong&gt; are collections of properties and methods; each object has its own name and is an&lt;br /&gt;instance of a particular class. Built-in objects are predefined in the ActionScript language. For&lt;br /&gt;example, the built-in Date object provides information from the system clock&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Packages&lt;/strong&gt; are directories that contain one or more class files, and reside in a designated classpath&lt;br /&gt;directory&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Target paths&lt;/strong&gt; are hierarchical addresses of movie clip instance names, variables, and objects in a&lt;br /&gt;SWF file. You name a movie clip instance in the movie clip Property inspector. (The main&lt;br /&gt;Timeline always has the name _root.) You can use a target path to direct an action at a movie clip&lt;br /&gt;or to get or set the value of a variable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-9121079187987058081?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/9121079187987058081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=9121079187987058081' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/9121079187987058081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/9121079187987058081'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/03/actionscript.html' title='ActionScript'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1369933577126871989</id><published>2007-02-23T20:56:00.000-08:00</published><updated>2007-02-25T05:31:38.983-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='reflexivity'/><category scheme='http://www.blogger.com/atom/ns#' term='metaprogramming'/><title type='text'>Metaprogramming @ Ruby</title><content type='html'>&lt;span&gt;Metaprogramming&lt;/span&gt; is the writing of programs that write or manipulate other programs (or themselves) as their data or that do part of the work that is otherwise done at run time during &lt;span&gt;compile time.&lt;/span&gt; In many cases, this allows programmers to get more done in the same amount of time as they would take to write all the code manually.&lt;br/&gt;&lt;br/&gt;The language in which the metaprogram is written is called the metalanguage. The language of the programs that are manipulated is called the object-language. The capacity of a programming language to be its own meta-language is called &lt;span&gt;reflexivity&lt;/span&gt;.&lt;br/&gt;&lt;br/&gt;Not all metaprogramming involves generative programming. If programs are modifiable at runtime (as in Lisp, Python, Smalltalk, Ruby, PHP, Perl, Tcl and other languages), then techniques can be used to accomplish metaprogramming without actually generating source code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1369933577126871989?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1369933577126871989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1369933577126871989' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1369933577126871989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1369933577126871989'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/02/metaprogramming-ruby.html' title='Metaprogramming @ Ruby'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-8130202272901265366</id><published>2007-02-22T04:27:00.000-08:00</published><updated>2007-02-23T00:38:40.906-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='controller'/><category scheme='http://www.blogger.com/atom/ns#' term='filters'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='before_filter'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;url routing&quot;'/><title type='text'>still more rails</title><content type='html'>&lt;span style="font-weight:bold;"&gt;URL routing&lt;/span&gt;&lt;br /&gt;An incoming URL always maps to some action within a controller. A controller is simply a Ruby class, and each action implemented by the controller is a public method within the controller class. The default mapping from URL to action method is (in "Rails-speak"):&lt;br /&gt;&lt;br /&gt;/:controller/:action/:id&lt;br /&gt;&lt;br /&gt;If the default URL routing does not meet your needs, you can easily specify your own routing rules, even using regular expressions&lt;br /&gt;&lt;br /&gt;Rails routing rules are Ruby code. Here is an example:&lt;br /&gt;&lt;br /&gt;map.connect 'date/:year/:month/:day',&lt;br /&gt;     :controller =&gt; 'blog',&lt;br /&gt;     :action =&gt; 'by_date',&lt;br /&gt;     :month =&gt; nil,&lt;br /&gt;     :day =&gt; nil,&lt;br /&gt;     :requirements =&gt; {:year =&gt; /\d{4}/,&lt;br /&gt;                       :day =&gt; /\d{1,2}/,&lt;br /&gt;                       :month =&gt; /\d{1,2}/}With this routing rule, the following URLs are valid:&lt;br /&gt;&lt;br /&gt;http://myblog.com/date/2005&lt;br /&gt;http://myblog.com/date/2005/08&lt;br /&gt;http://myblog.com/date/2005/08/01&lt;br /&gt;&lt;br /&gt;This rule decomposes a URL containing a date that, perhaps, a blog might use to display the postings for a particular date. A URL that matches this form will map to the BlogController class and the by_date method. The parameter hash will contain values for a four-digit year (/\d{4}/ is a Ruby regular expression), a two-digit month, and a two-digit day. Further, the month and day are optional; if no values are present, the parameter hash will contain the default value of nil.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Filters&lt;/span&gt; allow you to run preprocessing code before Rails executes an action and post-processing code after it completes an action. They are useful for such things as caching or authentication before calling the action, and compression or localization of the response after calling an action. The before_filter processing can either allow the action to be called normally by returning true, or abort the action by returning false (or by performing a render or redirect operation).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.onlamp.com/pub/a/onlamp/2005/10/13/what_is_rails.html?page=5"&gt;&lt;br /&gt;http://www.onlamp.com/pub/a/onlamp/2005/10/13/what_is_rails.html?page=5&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-8130202272901265366?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/8130202272901265366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=8130202272901265366' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/8130202272901265366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/8130202272901265366'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/02/still-more-rails.html' title='still more rails'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-2730085733693389084</id><published>2007-02-20T21:23:00.000-08:00</published><updated>2007-02-22T09:15:41.527-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='class'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;save()&quot;'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='views'/><category scheme='http://www.blogger.com/atom/ns#' term='helper'/><category scheme='http://www.blogger.com/atom/ns#' term='session'/><category scheme='http://www.blogger.com/atom/ns#' term='variables'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;model objects&quot;'/><category scheme='http://www.blogger.com/atom/ns#' term='Erb'/><category scheme='http://www.blogger.com/atom/ns#' term='ror'/><category scheme='http://www.blogger.com/atom/ns#' term='controller'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;render_component&quot;'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;ruby on rails&quot;'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;application.rb&quot;'/><category scheme='http://www.blogger.com/atom/ns#' term='flash'/><title type='text'>More Rails</title><content type='html'>Class names are mixed case (each word&lt;br /&gt;starts with a capital letter, and there are no breaks). Table names (and, as&lt;br /&gt;we’ll see later, variable names and symbols) are lowercase, with an underscore&lt;br /&gt;between words&lt;br /&gt;&lt;br /&gt;Over in app/controllers you’ll find a file called application.&lt;br /&gt;rb. This file is used to establish a context for the entire application.&lt;br /&gt;By default, it contains an empty definition of class ApplicationController.&lt;br /&gt;&lt;br /&gt;If we end a piece of&lt;br /&gt;embedded Ruby with -%&gt; (note the extra minus sign), ERb will suppress the&lt;br /&gt;newline that follows. That means embedded Ruby that doesn’t generate&lt;br /&gt;any output won’t end up leaving extraneous blank lines in the output.&lt;br /&gt;&lt;br /&gt;A commonly used method of array objects is &lt;&lt;, which appends a value to&lt;br /&gt;its receiver.&lt;br /&gt;&lt;br /&gt;The session construct stores the objects that you want to keep around&lt;br /&gt;between browser requests. To make this work, Rails has to take these&lt;br /&gt;objects and store them at the end of one request, loading them back&lt;br /&gt;in when a subsequent request comes in from the same browser. To&lt;br /&gt;store objects outside the running application, Rails uses Ruby’s serialization&lt;br /&gt;mechanism, which converts objects to data that can be loaded back in.&lt;br /&gt;&lt;br /&gt;Rails has a convenient way of dealing with&lt;br /&gt;errors and error reporting. It defines a structure called a flash. A flash is a&lt;br /&gt;bucket (actually closer to a Hash), into which you can store stuff as you process&lt;br /&gt;a request. The contents of the flash are available to the next request&lt;br /&gt;in this session before being deleted automatically. Typically the flash is&lt;br /&gt;used to collect error messages&lt;br /&gt;&lt;br /&gt;The flash information is accessible within the views by using the @flash instance variable.&lt;br /&gt;&lt;br /&gt;Why couldn’t we just store the error in any old instance variable? Remember&lt;br /&gt;that a redirect is sent by our application to the browser, which then&lt;br /&gt;sends a new request back to our application. By the time we receive that&lt;br /&gt;request, our application has moved on—all the instance variables from&lt;br /&gt;previous requests are long gone. The flash data is stored in the session in&lt;br /&gt;order to make it available between requests.&lt;br /&gt;&lt;br /&gt;A helper is simply code in a module that is automatically included into your views.&lt;br /&gt;You define helper files in app/helpers. A helper named xyz_helper.rb defines&lt;br /&gt;methods that will be available to views invoked by the xyz controller. If&lt;br /&gt;you define helper methods in the file app/helpers/application_helper.rb, those&lt;br /&gt;methods will be available in all views.&lt;br /&gt;&lt;br /&gt;model objects perform two roles: they map data into and out of the&lt;br /&gt;database, but they are also just regular objects that hold business data.&lt;br /&gt;They affect the database only when you tell them to, typically by calling&lt;br /&gt;save( ).&lt;br /&gt;&lt;br /&gt;The render_component( ) method invokes the given action and substitutes&lt;br /&gt;the output it renders into the current view.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;one way of handling subroutines at the view level is by using components to show the contents of a page on some other page. A lighter-weight way of doing the same thing is using a partial template. Unlike the component-based approach, a partial template&lt;br /&gt;has no corresponding action; it’s simply a chunk of template code &lt;br /&gt;that has been factored into a separate file&lt;br /&gt;&lt;br /&gt;We know how to create new rows in a database table; we create an action,&lt;br /&gt;put a form into a view, and invoke the model to save data away.&lt;br /&gt;&lt;br /&gt;Inside a Rails controller, the request information is available in the attribute request. We can check the request type using the methods get?( ) and post?( ).&lt;br /&gt;&lt;br /&gt;form_tag needs no parameters, as it defaults to submitting the form back&lt;br /&gt;to the action and controller that rendered the template&lt;br /&gt;&lt;br /&gt;Ruby’s attr_accessor creates a read/write attribute in the model.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-2730085733693389084?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/2730085733693389084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=2730085733693389084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2730085733693389084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2730085733693389084'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/02/more-rails.html' title='More Rails'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-531567147067381534</id><published>2007-02-19T22:30:00.000-08:00</published><updated>2007-02-22T09:17:02.141-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scaffolding'/><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='generator'/><category scheme='http://www.blogger.com/atom/ns#' term='&quot;model objects&quot;'/><title type='text'>rails</title><content type='html'>A Rails scaffold is an autogenerated framework for manipulating a model.&lt;br /&gt;When we run the generator, we tell it that we want a scaffold for a particular&lt;br /&gt;model (which it creates) and that we want to access it through a given&lt;br /&gt;controller (which it also creates).&lt;br /&gt;&lt;br /&gt;All scaffold-generated applications use the stylesheet scaffold.css in the&lt;br /&gt;directory public/stylesheets.&lt;br /&gt;&lt;br /&gt;The scaffold generator automatically makes use of Rails’ built-in&lt;br /&gt;pagination helper. This breaks the lists of products into pages of 10 entries&lt;br /&gt;each and automatically handles navigation between pages&lt;br /&gt;&lt;br /&gt;In Rails, a model is automatically mapped to a database table whose name is the plural form of the model’s class.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The model layer is the gatekeeper between the world of code and the&lt;br /&gt;database. Nothing to do with our application comes out of the database or&lt;br /&gt;gets stored back into the database that doesn’t first go through the model.&lt;br /&gt;This makes it an ideal place to put all validation; it doesn’t matter whether&lt;br /&gt;the data comes from a form or from some programmatic manipulation in&lt;br /&gt;our application. If the model checks it before writing to the database, then&lt;br /&gt;the database will be protected from bad data.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-531567147067381534?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/531567147067381534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=531567147067381534' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/531567147067381534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/531567147067381534'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/02/rails.html' title='rails'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-4829494891448669763</id><published>2007-01-30T21:20:00.000-08:00</published><updated>2007-02-06T23:12:54.891-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='query'/><category scheme='http://www.blogger.com/atom/ns#' term='delete'/><category scheme='http://www.blogger.com/atom/ns#' term='truncate'/><category scheme='http://www.blogger.com/atom/ns#' term='DDL'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><category scheme='http://www.blogger.com/atom/ns#' term='DML'/><title type='text'>Delete vs Truncate @ SQL</title><content type='html'>&lt;strong&gt;SQL Server &lt;/strong&gt;&lt;br /&gt;TRUNCATE is a DDL command and cannot be rolled back. All of the memory space is released back to the server. &lt;br /&gt;DELETE is a DML command and can be rolled back. &lt;br /&gt; &lt;br /&gt;Both commands accomplish identical tasks (removing all data from a table), but TRUNCATE is much faster&lt;br /&gt;&lt;br /&gt;TRUNCATE : You can't use WHERE clause &lt;br /&gt;DELETE : You can use WHERE clause&lt;br /&gt;&lt;br /&gt;Truncate = Delete+Commit -so we cant roll back &lt;br /&gt;Truncate is a Transcation control language &lt;br /&gt;&lt;br /&gt;Truncate: Drop all object's statistics and marks like High Water Mark, free extents and leave the object really empty with the first extent. &lt;br /&gt;Delete: You can keep object's statistics and all allocated space.&lt;br /&gt;&lt;br /&gt;Truncate will write only one query in the ldf file to remove whole data unlike the Delete query which will write one query per record in the ldf file&lt;br /&gt;&lt;br /&gt;You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint; instead, use DELETE statement without a WHERE clause. Because TRUNCATE TABLE is not logged, it cannot activate a trigger.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.geekinterview.com/question_details/425"&gt;http://www.geekinterview.com/question_details/425&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;MYSQL&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;TRUNCATE TABLE empties a table completely. Logically, this is equivalent to a DELETE statement that deletes all rows, but there are practical differences under some circumstances. &lt;br /&gt;&lt;br /&gt;For InnoDB before version 5.0.3, TRUNCATE TABLE is mapped to DELETE, so there is no difference. Starting with MySQL 5.0.3, fast TRUNCATE TABLE is available. However, the operation is still mapped to DELETE if there are foreign key constraints that reference the table. (When fast truncate is used, it resets any AUTO_INCREMENT counter. From MySQL 5.0.13 on, the AUTO_INCREMENT counter is reset by TRUNCATE TABLE, regardless of whether there is a foreign key constraint.) &lt;br /&gt;&lt;br /&gt;For other storage engines, TRUNCATE TABLE differs from DELETE in the following ways in MySQL 5.0: &lt;br /&gt;&lt;br /&gt;Truncate operations drop and re-create the table, which is much faster than deleting rows one by one. &lt;br /&gt;&lt;br /&gt;Truncate operations are not transaction-safe; an error occurs when attempting one in the course of an active transaction or active table lock. &lt;br /&gt;&lt;br /&gt;The number of deleted rows is not returned. &lt;br /&gt;&lt;br /&gt;As long as the table format file tbl_name.frm is valid, the table can be re-created as an empty table with TRUNCATE TABLE, even if the data or index files have become corrupted. &lt;br /&gt;&lt;br /&gt;The table handler does not remember the last used AUTO_INCREMENT value, but starts counting from the beginning. This is true even for MyISAM and InnoDB, which normally do not reuse sequence values. &lt;br /&gt;&lt;br /&gt;Since truncation of a table does not make any use of DELETE, the TRUNCATE statement does not invoke ON DELETE triggers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-4829494891448669763?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/4829494891448669763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=4829494891448669763' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4829494891448669763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4829494891448669763'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/01/delete-vs-truncate-sql.html' title='Delete vs Truncate @ SQL'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-2283223409824035370</id><published>2007-01-29T01:37:00.000-08:00</published><updated>2007-02-06T23:13:08.694-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='dom'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><title type='text'>DOM @ XML</title><content type='html'>The XML Document Object Model (XML DOM) defines a standard way for accessing and manipulating XML documents.&lt;br /&gt;&lt;br /&gt;The DOM presents an XML document as a tree-structure (a node tree), with the elements, attributes, and text defined as nodes.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Parsing the XML DOM&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To manipulate an XML document, you need an XML parser. The parser loads the document into your computer's memory. Once the document is loaded, its data can be manipulated using the DOM. The DOM treats the XML document as a tree.&lt;br /&gt;&lt;br /&gt;There are some differences between Microsoft's XML parser and the XML parser used in Mozilla browsers. In this tutorial we will show you how to create cross browser scripts that will work in both Internet Explorer and Mozilla browsers&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Microsoft's XML Parser&lt;br /&gt;Microsoft's XML parser is a COM component that comes with Internet Explorer 5 and higher. Once you have installed Internet Explorer, the parser is available to scripts.&lt;br /&gt;&lt;br /&gt;Microsoft's XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML. &lt;br /&gt;&lt;br /&gt;To create an instance of Microsoft's XML parser, use the following code:&lt;br /&gt;&lt;br /&gt;JavaScript:&lt;br /&gt;&lt;br /&gt;var xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); &lt;br /&gt;&lt;br /&gt;The first line of the script above creates an instance of the XML parser. The second line turns off asynchronized loading, to make sure that the parser will not continue execution of the script before the document is fully loaded. The third line tells the parser to load an XML document called "note.xml".&lt;br /&gt;&lt;br /&gt;XML Parser in Mozilla, Firefox, and Opera&lt;br /&gt;Mozilla's XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML. &lt;br /&gt;&lt;br /&gt;To create an instance of the XML parser in Mozilla browsers, use the following code:&lt;br /&gt;&lt;br /&gt;JavaScript:&lt;br /&gt;&lt;br /&gt;var xmlDoc=document.implementation.createDocument("ns","root",null); &lt;br /&gt;&lt;br /&gt;The first parameter, ns, defines the namespace used for the XML document. The second parameter, root, is the XML root element in the XML file. The third parameter, null, is always null because it is not implemented yet&lt;br /&gt;&lt;br /&gt;The following code fragment loads an existing XML document ("note.xml") into Mozillas' XML parser:&lt;br /&gt;&lt;br /&gt;var xmlDoc=document.implementation.createDocument("","",null);&lt;br /&gt;xmlDoc.load("note.xml"); &lt;br /&gt;&lt;br /&gt;The first line of the script above creates an instance of the XML parser. The second line tells the parser to load an XML document called "note.xml".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-2283223409824035370?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/2283223409824035370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=2283223409824035370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2283223409824035370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2283223409824035370'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/01/dom-xml.html' title='DOM @ XML'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-183222741829757045</id><published>2007-01-08T10:42:00.000-08:00</published><updated>2007-01-08T10:44:13.090-08:00</updated><title type='text'>Web 2.0 huh</title><content type='html'>&lt;object type="application/x-shockwave-flash" data="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=16071&amp;doc=web-20-huh-14078" width="425" height="348"&gt;&lt;param name="movie" value="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=16071&amp;doc=web-20-huh-14078" /&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-183222741829757045?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/183222741829757045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=183222741829757045' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/183222741829757045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/183222741829757045'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/01/web-20-huh.html' title='Web 2.0 huh'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-3330021171723019171</id><published>2007-01-04T09:10:00.000-08:00</published><updated>2007-01-04T09:13:45.710-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='social'/><category scheme='http://www.blogger.com/atom/ns#' term='web2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='software'/><title type='text'>Social Software</title><content type='html'>&lt;object type="application/x-shockwave-flash" data="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=17042&amp;doc=social-software-17042-7" width="425" height="348"&gt;&lt;param name="movie" value="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=17042&amp;doc=social-software-17042-7" /&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;List of Social Softwares&lt;br /&gt;http://en.wikipedia.org/wiki/List_of_social_software&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-3330021171723019171?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/3330021171723019171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=3330021171723019171' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/3330021171723019171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/3330021171723019171'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/01/social-software.html' title='Social Software'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-8086960089901606809</id><published>2007-01-04T09:02:00.000-08:00</published><updated>2007-01-04T09:04:34.175-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blog'/><category scheme='http://www.blogger.com/atom/ns#' term='write'/><category scheme='http://www.blogger.com/atom/ns#' term='web2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='read'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>Introduction-to-the-Read-Write-Web</title><content type='html'>&lt;object type="application/x-shockwave-flash" data="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=7138&amp;doc=introduction-to-the-read-write-web-13092" width="425" height="348"&gt;&lt;param name="movie" value="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=7138&amp;doc=introduction-to-the-read-write-web-13092" /&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-8086960089901606809?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/8086960089901606809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=8086960089901606809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/8086960089901606809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/8086960089901606809'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/01/introduction-to-read-write-web.html' title='Introduction-to-the-Read-Write-Web'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-5468003945968833914</id><published>2007-01-03T23:49:00.000-08:00</published><updated>2007-01-04T01:42:47.470-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><category scheme='http://www.blogger.com/atom/ns#' term='ok/cancel'/><category scheme='http://www.blogger.com/atom/ns#' term='object'/><category scheme='http://www.blogger.com/atom/ns#' term='frames'/><category scheme='http://www.blogger.com/atom/ns#' term='iframe'/><title type='text'>Misc things @ JavaScript</title><content type='html'>&lt;strong&gt;Ok/Cancel box:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;if (confirm('Like cookies?')) { document.write('you like cookies!') }&lt;br /&gt;&lt;br /&gt;The buttons on a confirm box cannot be changed, nor can you specify a &lt;br /&gt;default button&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Session object&lt;/strong&gt;&lt;br /&gt;The Session object is a host object (i.e. not native) that is made&lt;br /&gt;available to JavaScript code processed on the server in an ASP&lt;br /&gt;pre-processing page.&lt;br /&gt;&lt;br /&gt;under ASP I believe the Session object's&lt;br /&gt;properties are accessed using ' ( ) ' notation, so in an ASP page,&lt;br /&gt;Session("UserID") = "" is valid.&lt;br /&gt;&lt;br /&gt;The ASP Session object cannot be acessed by code running on the client.  It is only available to that JavaScript which&lt;br /&gt;runs on the server **before** the ASP page is sent to the client.&lt;br /&gt;&lt;br /&gt; An Iframe is a frame, so to get to the page that holds the Iframe you need&lt;br /&gt; 'parent'. From the popupwindow to the first window, use the word 'opener'.&lt;br /&gt; So you need parent.opener...&lt;br /&gt; But JS will only communicate between all these windowobjects if they all&lt;br /&gt; reside in the same domain.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-5468003945968833914?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/5468003945968833914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=5468003945968833914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5468003945968833914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5468003945968833914'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2007/01/misc-things-javascript.html' title='Misc things @ JavaScript'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-165813976102138091</id><published>2006-12-31T00:09:00.000-08:00</published><updated>2006-12-31T00:27:15.401-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='html.'/><category scheme='http://www.blogger.com/atom/ns#' term='tag'/><category scheme='http://www.blogger.com/atom/ns#' term='frameset'/><category scheme='http://www.blogger.com/atom/ns#' term='frames'/><title type='text'>Frames @ HTML</title><content type='html'>With frames, you can display more than one Web page in the same browser window.&lt;br /&gt;With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The disadvantages of using frames are:&lt;/span&gt;&lt;br /&gt;The web developer must keep track of more HTML documents&lt;br /&gt;It is difficult to print the entire page&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The Frameset Tag&lt;/span&gt;&lt;br /&gt;The &lt;.frameset&gt; tag defines how to divide the window into frames&lt;br /&gt;Each frameset defines a set of rows or columns&lt;br /&gt;The values of the rows/columns indicate the amount of screen area each row/column will occupy&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;The Frame Tag&lt;/span&gt;&lt;br /&gt;The frame tag defines what HTML document to put into each frame&lt;br /&gt;&lt;br /&gt;In the example below we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 55% of the width of the browser window and third column to remaining 20%. The HTML document "aframe.htm" is put into the first column, the HTML document "bframe.htm" is put into the second column and the HTML document "cframe.html" into the third column:&lt;br /&gt;&lt;.frameset cols="25%,55%,20%"&gt;&lt;br /&gt;   &lt;.frame src="aframe.htm"&gt;&lt;br /&gt;   &lt;.frame src="bframe.htm"&gt;&lt;br /&gt;   &lt;.frame src="cframe.htm"&gt;&lt;br /&gt;&lt;/.frameset&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If a frame has visible borders, the user can resize it by dragging the border. To prevent a user from doing this, you can add noresize="noresize" to the &lt;.frame&gt; tag.&lt;br /&gt;&lt;br /&gt;Add the &lt;.noframes&gt; tag for browsers that do not support frames.&lt;br /&gt;&lt;br /&gt;You can't use the &lt;.body&gt;&lt;/.body&gt; tags together with the &lt;.frameset&gt;&lt;/.frameset&gt; tags! However, if you add a &lt;.noframes&gt; tag containing some text for browsers that do not support frames, you will have to enclose the text in &lt;.body&gt;&lt;/.body&gt; tags!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-165813976102138091?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/165813976102138091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=165813976102138091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/165813976102138091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/165813976102138091'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/frames-html.html' title='Frames @ HTML'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1149019430638803376</id><published>2006-12-29T23:55:00.000-08:00</published><updated>2006-12-29T23:56:45.231-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='quick'/><category scheme='http://www.blogger.com/atom/ns#' term='puzzle'/><category scheme='http://www.blogger.com/atom/ns#' term='tease'/><category scheme='http://www.blogger.com/atom/ns#' term='simple'/><title type='text'>A Quick Teaser</title><content type='html'>Each child in a family has at least 5 brothers and 4 sisters. What is the smallest number of children the family might have?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1149019430638803376?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1149019430638803376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1149019430638803376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1149019430638803376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1149019430638803376'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/quick-teaser.html' title='A Quick Teaser'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-4459536352454009101</id><published>2006-12-29T05:50:00.001-08:00</published><updated>2006-12-29T05:55:26.859-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hiring'/><category scheme='http://www.blogger.com/atom/ns#' term='delicious'/><category scheme='http://www.blogger.com/atom/ns#' term='help'/><category scheme='http://www.blogger.com/atom/ns#' term='del.icio.us'/><category scheme='http://www.blogger.com/atom/ns#' term='job'/><title type='text'>Delicious is hiring</title><content type='html'>Yes, that is the news.&lt;br /&gt;&lt;br /&gt;I happened to visit the delicious blog (&lt;a href="http://blog.del.icio.us"&gt;http://blog.del.icio.us&lt;/a&gt;)and while surfing came across an article with heading &lt;strong&gt;help wanted&lt;/strong&gt; only to realise that they are hiring and here's what was written in that article&lt;br /&gt;&lt;br /&gt;It's hiring season again at del.icio.us, and we're looking to bring a few more engineers on board at our cushy Santa Clara offices.  If you are a PHP god, javascript hacker, a database wizard, a UI guru, or a uber C++ ninja, let us know.  As the team is so small, entrepreneurial spirit and willingness to learn new things are also a requirement.  Finally, enthusiasm for del.icio.us is a BIG plus, as we're a small team where everyone has a voice and the chance to affect the direction of the product.  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Perks are vast and too numerous to spell out here, but include a team t-shirt, a formidable supply of stickers and bookmarks, infinite coffee, and the opportunity to learn a lot, have fun, drink infinite coffee, and change the world&lt;br /&gt;&lt;br /&gt;refer to:&lt;br /&gt;&lt;a href="http://blog.del.icio.us/blog/2006/11/help_wanted.html"&gt;http://blog.del.icio.us/blog/2006/11/help_wanted.html&lt;/a&gt;&lt;br /&gt;for details&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-4459536352454009101?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/4459536352454009101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=4459536352454009101' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4459536352454009101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4459536352454009101'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/delicious-is-hiring_29.html' title='Delicious is hiring'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1104990753734122103</id><published>2006-12-29T05:42:00.000-08:00</published><updated>2006-12-29T05:43:57.646-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='start-up'/><category scheme='http://www.blogger.com/atom/ns#' term='Entrepreneurship'/><category scheme='http://www.blogger.com/atom/ns#' term='startup'/><category scheme='http://www.blogger.com/atom/ns#' term='vc'/><category scheme='http://www.blogger.com/atom/ns#' term='funding'/><category scheme='http://www.blogger.com/atom/ns#' term='innovation'/><category scheme='http://www.blogger.com/atom/ns#' term='books'/><category scheme='http://www.blogger.com/atom/ns#' term='business'/><title type='text'>Books on Entrepreneurship</title><content type='html'>Here's a list of books on Entrepreneurship compiled for your reference.&lt;br /&gt;&lt;br /&gt;* The High-Performance Entrepreneur by Subroto Bagchi&lt;br /&gt;* The Art of the Start by Guy Kawasaki &lt;br /&gt;* Zero to One Million by Ryan P. M. Allis&lt;br /&gt;* Zero to IPO by David Smith&lt;br /&gt;* Rich Dad's Guide to Investing by Robert Kiyosaki&lt;br /&gt;* New Venture Creation by Jeffrey Timmons&lt;br /&gt;* Good to Great by Jim Collins&lt;br /&gt;* The E-Myth by Michael Gerber&lt;br /&gt;* The Young Entrepreneurs'Edge by Jennifer Kushnell&lt;br /&gt;* The Young Entrepreneur's Guide to Starting and Running a Business by Steve Mariotti&lt;br /&gt;* The Portable MBA in Entrepreneurship by William D. Bygrave&lt;br /&gt;* Innovation and Entrepreneurship by Peter Drucker&lt;br /&gt;* Good to Great by Jim Collins&lt;br /&gt;* At Work with Thomas Edison by Blain McCormick&lt;br /&gt;* Multiple Streams of Income by Robert G. Allen&lt;br /&gt;* On Entrepreneurship by Harvard Business Review&lt;br /&gt;* Entrepreneurship.com by Tim Burns&lt;br /&gt;* Fire in the Belly - an exploration of the entrepreneurial spirit by Yanky Fachler&lt;br /&gt;* Rich Dad Poor Dad by Robert Kiyosaki&lt;br /&gt;&lt;br /&gt;Hope they'll do some value addition&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1104990753734122103?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1104990753734122103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1104990753734122103' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1104990753734122103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1104990753734122103'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/books-on-entrepreneurship.html' title='Books on Entrepreneurship'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-2633268192335686418</id><published>2006-12-28T00:40:00.001-08:00</published><updated>2006-12-28T00:40:43.700-08:00</updated><title type='text'>Web2.0 presentation @ SlideShare</title><content type='html'>&lt;object type="application/x-shockwave-flash" data="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=10765&amp;doc=an-introduction-to-web-20-the-user-role-16645" width="425" height="348"&gt;&lt;param name="movie" value="https://s3.amazonaws.com:443/slideshare/ssplayer.swf?id=10765&amp;doc=an-introduction-to-web-20-the-user-role-16645" /&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-2633268192335686418?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/2633268192335686418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=2633268192335686418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2633268192335686418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2633268192335686418'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/web20-presentation-slideshare.html' title='Web2.0 presentation @ SlideShare'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-4669230291614366026</id><published>2006-12-27T05:39:00.000-08:00</published><updated>2006-12-31T00:24:43.496-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lambda'/><category scheme='http://www.blogger.com/atom/ns#' term='docstrings'/><category scheme='http://www.blogger.com/atom/ns#' term='methods'/><category scheme='http://www.blogger.com/atom/ns#' term='dir'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='callable'/><title type='text'>Print methods and doc strings @ Python</title><content type='html'>def info(object, spacing=10, collapse=1):&lt;br /&gt;    """&lt;br /&gt;    Takes module, class, list, dictionary, or string."""&lt;br /&gt;    methodList =[method for method in dir(object) if callable(getattr(object, method))]&lt;br /&gt;    processFunc =collapse and (lambda s: " ".join(s.split())) or (lambda s:s)&lt;br /&gt;    print "\n".join(["%s=%s" % (method.ljust(spacing),processFunc(str(getattr(object, method).__doc__))) &lt;br /&gt;                         for method in methodList])   &lt;br /&gt;if __name__=="__main__":&lt;br /&gt;    print info.__doc__&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-4669230291614366026?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/4669230291614366026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=4669230291614366026' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4669230291614366026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4669230291614366026'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/print-methods-and-doc-strings-python.html' title='Print methods and doc strings @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-7384050029850126308</id><published>2006-12-26T23:34:00.000-08:00</published><updated>2006-12-26T23:35:28.079-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python array sum'/><title type='text'>Sum of elements of array @ Python</title><content type='html'>array = input('Enter the array')&lt;br /&gt;sum = 0&lt;br /&gt;for i in array:&lt;br /&gt;    sum = sum + i&lt;br /&gt;print "sum of elements of array is", sum&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-7384050029850126308?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/7384050029850126308/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=7384050029850126308' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7384050029850126308'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/7384050029850126308'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/sum-of-elements-of-array-python.html' title='Sum of elements of array @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-6689270926145193370</id><published>2006-12-26T22:54:00.000-08:00</published><updated>2006-12-26T22:55:49.161-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python string comparison'/><title type='text'>StringComparison @ Python</title><content type='html'>a = raw_input('Enter first String')&lt;br /&gt;b = raw_input('Enter second String')&lt;br /&gt;&lt;br /&gt;l1 = len(a)&lt;br /&gt;l2 = len(b)&lt;br /&gt;&lt;br /&gt;if (l1==l2):&lt;br /&gt;    for i in range(l1):&lt;br /&gt;        if (a[i]==b[i]):&lt;br /&gt;            l1 = l1-1            &lt;br /&gt;            if(l1==0):&lt;br /&gt;                print "Same"&lt;br /&gt;        else:&lt;br /&gt;            print "Different"&lt;br /&gt;            break&lt;br /&gt;&lt;br /&gt;else:&lt;br /&gt;    print "Different"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-6689270926145193370?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/6689270926145193370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=6689270926145193370' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/6689270926145193370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/6689270926145193370'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/stringcomparison-python.html' title='StringComparison @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-258200823281739532</id><published>2006-12-25T20:16:00.001-08:00</published><updated>2006-12-25T20:17:36.436-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp php comparison'/><title type='text'>PHP vs ASP</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Speed&lt;/span&gt;&lt;br /&gt;PHP is faster and more stable than ASP. ASP is built on a COM-based architecture so when ever a programme tries to connect to a database or file he calls a COM object. When that COM object tries to access the file system it calls up yet another COM object. All these COM overheads add up and slows things down.&lt;br /&gt;&lt;br /&gt;In PHP modules, everything runs in PHP's memory space. This means that PHP code will run faster because there is no overhead of communicating with different COM objects in different processes. In this case too, ASP is slower and more memory intensive than PHP's model because each ASP language compiler runs in its own process. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Price&lt;/span&gt;&lt;br /&gt;PHP installations are far cheaper to install than ASP installations. PHP runs great on Linux which is free, on the other hand ASP runs on the IIS Server (Internet Information Server) which need's Windows N.T/2000/XP, any of which costs a lot, especially when compared to the price of PHP, nothing.&lt;br /&gt;&lt;br /&gt;Apart from that ASP mostly uses MS-SQL Server as the back end which again is expensive, Where as PHP programmes mostly use MySQL which is FREE!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Extras&lt;/span&gt;&lt;br /&gt;With ASP, if you need to upload files, then you need a third party component ASPuplod, if you want to send mail or encrypt passwords you need another component and so on. Each of these components has to be bought.&lt;br /&gt;&lt;br /&gt;In PHP, if you want to FTP, encrypt passwords in MD5, or send email from a web page, you do not need any extra components as they are all built-in, which is, incidentally, another speed increase. Because everything is built-in, there is no extra layer of COM objects and access to email, for example, is faster than in ASP. Since PHP is Open-Source there are lots of plug-ins and lots of sample code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Platform Support&lt;/span&gt;&lt;br /&gt;PHP runs on Mac OS X, Windows, Win NT, Linux, Solaris, Unix, BSD etc.&lt;br /&gt;ASP runs on Windows, under MicrosoftÕs IIS server, but there are a couple of projects that allow ASP to run on other platforms and servers but guess what, most of them cost money.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-258200823281739532?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/258200823281739532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=258200823281739532' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/258200823281739532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/258200823281739532'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/php-vs-asp_25.html' title='PHP vs ASP'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-8792062977584429338</id><published>2006-12-23T09:03:00.001-08:00</published><updated>2007-01-04T09:06:41.348-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='pyspotting'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>PySpotting</title><content type='html'>Choose Python. Choose readability.&lt;br /&gt;Choose the simple over the complex and&lt;br /&gt;the complex over the complicated. Choose&lt;br /&gt;dynamic typing. Choose duck typing.&lt;br /&gt;Choose decorators. Choose generators.&lt;br /&gt;Choose metaclasses if you don't value&lt;br /&gt;your sanity. Choose to import this. Choose&lt;br /&gt;an almost-fanatical devotion to the BDFL,&lt;br /&gt;unless he comes up with something like&lt;br /&gt;optional static typing, in which case choose&lt;br /&gt;to whine about it in your blog until he stops.&lt;br /&gt;Choose Effbot. Choose Timbot. Choose&lt;br /&gt;wx. Choose to come up with a bloody implementation&lt;br /&gt;before spouting off on&lt;br /&gt;comp.lang.python or Python-Dev. Choose&lt;br /&gt;the explicit rather than the implicit. Choose&lt;br /&gt;one obvious way to do it, especially if you&lt;br /&gt;are Dutch. Choose list comprehensions.&lt;br /&gt;Choose Paul Graham's essays and&lt;br /&gt;s/LISP/Python/g. Choose Jython when&lt;br /&gt;your marketing people choose Java.&lt;br /&gt;Choose speed of development over speed&lt;br /&gt;of execution, but when in doubt, import&lt;br /&gt;psyco. Choose to finish early and laugh at&lt;br /&gt;your colleagues as they waste their miserable&lt;br /&gt;lives bowing down in subservience to&lt;br /&gt;that sadistic little C++ compiler.&lt;br /&gt;Choose Python.&lt;br /&gt;Choose your __future__&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-8792062977584429338?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/8792062977584429338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=8792062977584429338' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/8792062977584429338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/8792062977584429338'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/pyspotting_23.html' title='PySpotting'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1152050164959563980</id><published>2006-12-23T05:28:00.000-08:00</published><updated>2007-03-28T22:44:08.740-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='logging'/><category scheme='http://www.blogger.com/atom/ns#' term='administration'/><category scheme='http://www.blogger.com/atom/ns#' term='database'/><title type='text'>The General Query Log  @ Mysql</title><content type='html'>The general query log is a general record of what mysqld is doing. The server writes information to this log when clients connect or disconnect, and it logs each SQL statement received from clients. The general query log can be very useful when you suspect an error in a client and want to know exactly what the client sent to mysqld.&lt;br /&gt;&lt;br /&gt;mysqld writes statements to the query log in the order that it receives them, which might differ from the order in which they are executed. This logging order contrasts to the binary log, for which statements are written after they are executed but before any locks are released. (Also, the query log contains all statements, whereas the binary log does not contain statements that only select data.)&lt;br /&gt;&lt;br /&gt;To enable the general query log, start mysqld with the --log[=file_name] or -l [file_name] option.&lt;br /&gt;&lt;br /&gt;If no file_name value is given for --log or -l, the default name is host_name.log in the data directory.&lt;br /&gt;&lt;br /&gt;Server restarts and log flushing do not cause a new general query log file to be generated (although flushing closes and reopens it). On Unix, you can rename the file and create a new one by using the following commands:&lt;br /&gt;shell&gt; mv host_name.log host_name-old.log&lt;br /&gt;shell&gt; mysqladmin flush-logs&lt;br /&gt;shell&gt; cp host_name-old.log backup-directory&lt;br /&gt;shell&gt; rm host_name-old.log&lt;br /&gt;&lt;br /&gt;On Windows, you cannot rename the log file while the server has it open. You must stop the server and rename the file, and then restart the server to create a new log file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1152050164959563980?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1152050164959563980/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1152050164959563980' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1152050164959563980'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1152050164959563980'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/general-query-log-mysql.html' title='The General Query Log  @ Mysql'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-2288624154478673048</id><published>2006-12-23T05:08:00.000-08:00</published><updated>2006-12-23T05:11:11.506-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='split strip python string methods'/><title type='text'>String Methods @ Python</title><content type='html'>&lt;span style="font-weight:bold;"&gt;strip( [chars])&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped: &lt;br /&gt;    &gt;&gt;&gt; '   spacious   '.strip()&lt;br /&gt;    'spacious'&lt;br /&gt;    &gt;&gt;&gt; 'www.example.com'.strip('cmowz.')&lt;br /&gt;    'example'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;split( [sep [,maxsplit]])&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Return a list of the words in the string, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. (thus, the list will have at most maxsplit+1 elements). If maxsplit is not specified, then there is no limit on the number of splits (all possible splits are made). Consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, "'1„2'.split(',')"returns "['1', '', '2']"). The sep argument may consist of multiple characters (for example, "'1, 2, 3'.split(', ')" returns "['1', '2', '3']"). Splitting an empty string with a specified separator returns "['']". &lt;br /&gt;&lt;br /&gt;If sep is not specified or is None, a different splitting algorithm is applied. First, whitespace characters (spaces, tabs, newlines, returns, and formfeeds) are stripped from both ends. Then, words are separated by arbitrary length strings of whitespace characters. Consecutive whitespace delimiters are treated as a single delimiter ("'1 2 3'.split()" returns "['1', '2', '3']"). Splitting an empty string or a string consisting of just whitespace returns an empty list.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-2288624154478673048?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/2288624154478673048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=2288624154478673048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2288624154478673048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/2288624154478673048'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/string-methods-python.html' title='String Methods @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-4111222654316354010</id><published>2006-12-23T04:18:00.000-08:00</published><updated>2006-12-31T00:23:39.068-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='comparison'/><category scheme='http://www.blogger.com/atom/ns#' term='object'/><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='identity'/><category scheme='http://www.blogger.com/atom/ns#' term='list'/><category scheme='http://www.blogger.com/atom/ns#' term='slice'/><category scheme='http://www.blogger.com/atom/ns#' term='is'/><title type='text'>List Manipulation @ Python</title><content type='html'>Just think of python variables as labels to objects, not as storing stuff or even references to something.&lt;br /&gt;&lt;br /&gt;In fact you don't event need copy module... since when you slice a list it returns a new list object with the objects needed, you can use a slice to give a new list with all objects, a copy:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; a = [1, 2, 3]&lt;br /&gt;&gt;&gt;&gt; b = [a[:], a[:], a[:]]&lt;br /&gt;&gt;&gt;&gt; b&lt;br /&gt;[[1, 2, 3], [1, 2, 3], [1, 2, 3]]&lt;br /&gt;&gt;&gt;&gt; b[1][1]&lt;br /&gt;2&lt;br /&gt;&gt;&gt;&gt; b[1][1] = 4&lt;br /&gt;&gt;&gt;&gt; b&lt;br /&gt;[[1, 2, 3], [1, 4, 3], [1, 2, 3]]&lt;br /&gt;&lt;br /&gt;You get changed only the 2nd list, because you created three copies:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; a is a&lt;br /&gt;True&lt;br /&gt;&gt;&gt;&gt; a[:] is a[:]&lt;br /&gt;False&lt;br /&gt;&gt;&gt;&gt; a[:] == a[:]&lt;br /&gt;True&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The same happen for elementary types, they are no exception, but the behavior with them may be different because they are immutable and may be the same object. With integers, for instance, in this case, with small integers, &lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; x = 10&lt;br /&gt;&gt;&gt;&gt; y = x - 1&lt;br /&gt;&gt;&gt;&gt; z = x - 1&lt;br /&gt;&gt;&gt;&gt; y == z&lt;br /&gt;True&lt;br /&gt;&gt;&gt;&gt; y is z&lt;br /&gt;True&lt;br /&gt;&lt;br /&gt;Both y and z are integers with the same value and are the same object. But with large integers, the same may not happen:&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; x = 123456789&lt;br /&gt;&gt;&gt;&gt; y = x - 1&lt;br /&gt;&gt;&gt;&gt; z = x - 1&lt;br /&gt;&gt;&gt;&gt; y == z&lt;br /&gt;True&lt;br /&gt;&gt;&gt;&gt; y is z&lt;br /&gt;False&lt;br /&gt;&lt;br /&gt;Here they have the same value, but they are not the same object. Since they are immutable, it doesn't matter, just to keep in mind to always think if you want to make comparisons by value (==) or by identity (is)&lt;br /&gt;&lt;br /&gt;"==" compare by value, if both objects have the same value, while "is" compare by identity, if they are the same object.&lt;br /&gt;&lt;br /&gt;Example, here x and y have the same value, but are not the same objects.&lt;br /&gt;&lt;br /&gt;&gt;&gt;&gt; x = [1, 2, 3]&lt;br /&gt;&gt;&gt;&gt; y = [1, 2, 3]&lt;br /&gt;&gt;&gt;&gt; x == y&lt;br /&gt;True&lt;br /&gt;&gt;&gt;&gt; x is y&lt;br /&gt;False&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here x and y are the same object, and therefore have the same value:&lt;br /&gt;&gt;&gt;&gt; x = y = [1, 2, 3]&lt;br /&gt;&gt;&gt;&gt; x == y&lt;br /&gt;True&lt;br /&gt;&gt;&gt;&gt; x is y&lt;br /&gt;True&lt;br /&gt;&lt;br /&gt;But, when you deal with immutable objects, Python have an internal cache, so they may be the same object, but you have no guarantee, so be careful if you want to check by value or identity...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-4111222654316354010?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/4111222654316354010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=4111222654316354010' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4111222654316354010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/4111222654316354010'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/list-manipulation-python.html' title='List Manipulation @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1138601767092335916</id><published>2006-12-22T23:09:00.000-08:00</published><updated>2006-12-22T23:17:42.317-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows task-manager trouble-shooting'/><title type='text'>Enabling Task Manager @ Windows</title><content type='html'>Click Run &lt;br /&gt;· Enter gpedit.msc in the Open box and click OK &lt;br /&gt;· In the Group Policy settings window &lt;br /&gt;o Select User Configuration &lt;br /&gt;o Select Administrative Templates &lt;br /&gt;o Select System &lt;br /&gt;o Select Ctrl+Alt+Delete options &lt;br /&gt;o Select Remove Task Manager &lt;br /&gt;o Double-click the Remove Task Manager option &lt;br /&gt;that will do&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1138601767092335916?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1138601767092335916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1138601767092335916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1138601767092335916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1138601767092335916'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/enabling-task-manager-windows.html' title='Enabling Task Manager @ Windows'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-5558502585786212442</id><published>2006-12-22T03:10:00.000-08:00</published><updated>2007-01-04T09:08:39.858-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='dom'/><category scheme='http://www.blogger.com/atom/ns#' term='parsing'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>XML Data island @ XML</title><content type='html'>In an HTML document, you can embed the XML file above with the xml tag. The id attribute of the xml tag defines an ID for the data island, and the src attribute points to the XML file to embed:&lt;br /&gt;&lt;br /&gt;The datasrc attribute of the &lt;table&gt; tag binds the HTML table element to the XML data island. The datasrc attribute refers to the id attribute of the data island.&lt;br /&gt;&lt;td&gt; tags cannot be bound to data, so we are using &lt;span&gt; tags. The &lt;span&gt; tag allows the datafld attribute to refer to the XML element to be displayed. &lt;/table&gt;&lt;br /&gt;&lt;br /&gt;To manipulate an XML document, you need an XML parser. The parser loads the document into your computer's memory. Once the document is loaded, its data can be manipulated using the DOM. The DOM treats the XML document as a tree.&lt;br /&gt;&lt;br /&gt;There are some differences between Microsoft's XML parser and the XML parser used in Mozilla browsers.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#cc0000;"&gt;Microsoft's XML Parser&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Microsoft's XML parser is a COM component that comes with Internet Explorer 5 and higher. Once you have installed Internet Explorer, the parser is available to scripts.&lt;br /&gt;Microsoft's XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML.&lt;br /&gt;To create an instance of Microsoft's XML parser, use the following code:&lt;br /&gt;&lt;br /&gt;JavaScript:&lt;br /&gt;var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");&lt;br /&gt;&lt;br /&gt;VBScript:&lt;br /&gt;set xmlDoc=CreateObject("Microsoft.XMLDOM")&lt;br /&gt;&lt;br /&gt;ASP:&lt;br /&gt;set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")&lt;br /&gt;The following code fragment loads an existing XML document ("note.xml") into Microsoft's XML parser:&lt;br /&gt;var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");&lt;br /&gt;xmlDoc.async="false";&lt;br /&gt;xmlDoc.load("note.xml");&lt;br /&gt;The first line of the script above creates an instance of the XML parser. The second line turns off asynchronized loading, to make sure that the parser will not continue execution of the script before the document is fully loaded. The third line tells the parser to load an XML document called "note.xml".&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;XML Parser in Mozilla, Firefox, and Opera&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Mozilla's XML parser supports all the necessary functions to traverse the node tree, access the nodes and their attribute values, insert and delete nodes, and convert the node tree back to XML.&lt;br /&gt;To create an instance of the XML parser in Mozilla browsers, use the following code:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;JavaScript:&lt;/strong&gt;&lt;br /&gt;var xmlDoc=document.implementation.createDocument("ns","root",null);&lt;br /&gt;The first parameter, ns, defines the namespace used for the XML document. The second parameter, root, is the XML root element in the XML file. The third parameter, null, is always null because it is not implemented yet.&lt;br /&gt;The following code fragment loads an existing XML document ("note.xml") into Mozillas' XML&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;parser:&lt;br /&gt;&lt;/strong&gt;var xmlDoc=document.implementation.createDocument("","",null);&lt;br /&gt;xmlDoc.load("note.xml");&lt;br /&gt;The first line of the script above creates an instance of the XML parser. The second line tells the parser to load an XML document called "note.xml".&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.w3schools.com/xml/xml_data_island.asp"&gt;http://www.w3schools.com/xml/xml_data_island.asp&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-5558502585786212442?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/5558502585786212442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=5558502585786212442' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5558502585786212442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/5558502585786212442'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/xml-data-island-xml.html' title='XML Data island @ XML'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1443068799686675186</id><published>2006-12-22T00:54:00.000-08:00</published><updated>2006-12-22T00:56:37.873-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python Repeat'/><title type='text'>Repeat @ Python</title><content type='html'>class repeat(__builtin__.object)&lt;br /&gt;  repeat(element [,times]) -&gt; create an iterator which returns the element&lt;br /&gt;  for the specified number of times.  If not specified, returns the element&lt;br /&gt;  endlessly.&lt;br /&gt;&lt;br /&gt;  Methods defined here:&lt;br /&gt;  &lt;br /&gt;  __getattribute__(...)&lt;br /&gt;      x.__getattribute__('name') &lt;==&gt; x.name&lt;br /&gt;  &lt;br /&gt;  __iter__(...)&lt;br /&gt;      x.__iter__() &lt;==&gt; iter(x)&lt;br /&gt;  &lt;br /&gt;  __len__(...)&lt;br /&gt;      x.__len__() &lt;==&gt; len(x)&lt;br /&gt;  &lt;br /&gt;  __repr__(...)&lt;br /&gt;      x.__repr__() &lt;==&gt; repr(x)&lt;br /&gt;  &lt;br /&gt;  next(...)&lt;br /&gt;      x.next() -&gt; the next value, or raise StopIteration&lt;br /&gt;  &lt;br /&gt;  ----------------------------------------------------------------------&lt;br /&gt;  Data and other attributes defined here:&lt;br /&gt;  &lt;br /&gt;  __new__ = &lt;built-in&gt;&lt;br /&gt;      T.__new__(S, ...) -&gt; a new object with type S, a subtype of T&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1443068799686675186?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1443068799686675186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1443068799686675186' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1443068799686675186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1443068799686675186'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/repeat-python.html' title='Repeat @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-1273774690024769141</id><published>2006-12-21T22:52:00.000-08:00</published><updated>2006-12-21T23:14:27.693-08:00</updated><title type='text'>Dictionary @ Python</title><content type='html'>&gt; Python dict is a hash table, isn't it? Yup.&lt;br /&gt;&gt; I know that hashtable has the concept of "bucket size" and "min bucket&lt;br /&gt;&gt; count" stuff,&lt;br /&gt;&lt;br /&gt;Some implementations of hash tables do. Python's does not. Python's uses what's called "open addressing" instead.&lt;br /&gt;&lt;br /&gt;&gt; and they should be configurable so I can set them to the proper value&lt;br /&gt;&gt; when I know how many items I'm going to handle.&lt;br /&gt;&gt; If these two values can't be set, the hashtable will give them default&lt;br /&gt;&gt; values. When there are more and more items being added to the&lt;br /&gt;&gt; hashtable, it increase its buckets and copy the old items into the new&lt;br /&gt;&gt; one and re-calculate the hash value of each item.&lt;br /&gt;&lt;br /&gt;That's several distinct claims, each of which is true of some hash table implementations but not of others. Python's implementation has no "buckets", so all that's simply irrelevant. Python's implementation (not all do) saves the hash value of each item, so when it does need to grow (or shrink) the space allocated to the table, it does not need to recalculate the hash value of any item.&lt;br /&gt;You should also note that copying a dict key or value (no matter of what type) consists in its entirety of copying one machine address (a 4- or 8-byte pointer, depending on platform).&lt;br /&gt;&lt;br /&gt;&gt; I think this will waste some time doing the increasing-copying thing.&lt;br /&gt;&lt;br /&gt;It does take time to resize. "Waste" is a value judgment ;-)&lt;br /&gt;&gt; If I know I'm going to handle about 20000 items, I can set the size of&lt;br /&gt;&gt; hashtable to 30000.&lt;br /&gt;&gt; So, can I do this in python?&lt;br /&gt;&lt;br /&gt;You can't. Unless you build up to 20000 items over and over (many thousands of times), it's unlikely you'd be able to measure the time difference even if you could.&lt;br /&gt;&lt;br /&gt;Ex:&lt;br /&gt;&lt;br /&gt;1)creating the dictionary with no other Python overhead&lt;br /&gt;&lt;br /&gt;import random; r = [ random.random() for i in range(20000)]; d = dict.fromkeys(r)&lt;br /&gt;&lt;br /&gt;2)Creating the dictionary using a Python for loop&lt;br /&gt;import random; r = [ random.random() for i in range(20000)];d={} ;for k in r: d[k] = None&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-1273774690024769141?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/1273774690024769141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=1273774690024769141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1273774690024769141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/1273774690024769141'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/dictionary-python.html' title='Dictionary @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-116659370913372982</id><published>2006-12-19T21:46:00.000-08:00</published><updated>2006-12-19T21:48:29.143-08:00</updated><title type='text'>WebSite vs Web Application</title><content type='html'>&lt;span style="color:#3366ff;"&gt;WEB APPLICATION:&lt;/span&gt;&lt;br /&gt;An application that is delivered using Internet technology and meets one or more of the following conditions:&lt;br /&gt;Utilizes a database (such as Oracle or SQL Server)&lt;br /&gt;Is developed using an application development tool (such as Oracle Internet Developer Suite or Visual Studio)&lt;br /&gt;Extracts data from multi-record files&lt;br /&gt;Requires a constantly running server process (such as Newsgroups and Chatrooms)&lt;br /&gt;Stores input data from data entry screens or web forms&lt;br /&gt;Depending on its requirements, a web application may be an Internet Application or an Intranet Application.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#3333ff;"&gt;WebSite vs Web Application:&lt;/span&gt;&lt;br /&gt;Historically, a website is any site on the internet (whether simple or complex) in which visitors can go. Therefore, whether it's a static site (the visitor can only read information or research a topic,) or whether it's a dynamic site (such as an online e-commerce store that can be managed by the store owner online) it's considered a website. A web application is also considered a website. However, web applications are web-based software programs, often as powerful as software applications made for your home or business computer. For instance, many online e-commerce stores are web applications. They are software programs that run on the web and are accessed via the internet instead of running strictly on your PC&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-116659370913372982?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/116659370913372982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=116659370913372982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/116659370913372982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/116659370913372982'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/website-vs-web-application.html' title='WebSite vs Web Application'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-116652500989364194</id><published>2006-12-19T02:42:00.000-08:00</published><updated>2006-12-19T02:43:29.903-08:00</updated><title type='text'>JavaScript: Why parseInt(08) &amp; parseInt(09) is showing the value 0 ?</title><content type='html'>That's because "08" and "09" are invalid numbers, in octal.&lt;br /&gt;The parseInt() function actually allows two arguments, the string to&lt;br /&gt;parse and a radix, which is optional. This radix value allows you to&lt;br /&gt;convert a binary (base 2), hexadecimal (base 16) or other base string to&lt;br /&gt;a decimal integer. For example&lt;br /&gt;parseInt("FF", 16);&lt;br /&gt;returns 255. This is very useful for parsing things like &lt;a class="iAs" style="FONT-WEIGHT: normal; FONT-SIZE: 100%; PADDING-BOTTOM: 1px; COLOR: darkgreen; BORDER-BOTTOM: darkgreen 0.07em solid; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="http://www.faqts.com/knowledge_base/view.phtml/aid/8108/fid/53#" target="_blank" itxtdid="1462645"&gt;HTML&lt;/a&gt; color values.&lt;br /&gt;Most people aren't aware of the optional radix argument. The problem is&lt;br /&gt;that if you leave it off, the function will doesn't necessarily assume&lt;br /&gt;you want a decimal (base 10) conversion. Instead it checks the input&lt;br /&gt;string (the first argument) and if it starts with "0x" it assumes it's a&lt;br /&gt;hexadecimal value. If it starts with "0" - not followed by an "x" - it&lt;br /&gt;takes it as an octal value. This follows the &lt;a class="iAs" style="FONT-WEIGHT: normal; FONT-SIZE: 100%; PADDING-BOTTOM: 1px; COLOR: darkgreen; BORDER-BOTTOM: darkgreen 0.07em solid; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="http://www.faqts.com/knowledge_base/view.phtml/aid/8108/fid/53#" target="_blank" itxtdid="1462258"&gt;JavaScript&lt;/a&gt; convention for&lt;br /&gt;numeric constants. If you &lt;a class="iAs" style="FONT-WEIGHT: normal; FONT-SIZE: 100%; PADDING-BOTTOM: 1px; COLOR: darkgreen; BORDER-BOTTOM: darkgreen 0.07em solid; BACKGROUND-COLOR: transparent; TEXT-DECORATION: underline" href="http://www.faqts.com/knowledge_base/view.phtml/aid/8108/fid/53#" target="_blank" itxtdid="1449249"&gt;code&lt;/a&gt;&lt;br /&gt;var x = 0x18;&lt;br /&gt;alert(x);&lt;br /&gt;it will display 24 which is the decimal equivalent of the hex number&lt;br /&gt;"18". Likewise,&lt;br /&gt;var x = 014;&lt;br /&gt;alert(x);&lt;br /&gt;displays 12 which is the decimal value of the octal number "14".&lt;br /&gt;As you should know, hexadecimal uses the digits 0-9 and the letters A-F,&lt;br /&gt;16 in all. Octal is base 8, so only the digits 0-7 are valid. Hence,&lt;br /&gt;"08" and "09" are not valid octal numbers and the function returns zero&lt;br /&gt;just as it would for "xyz" in decimal - it's not a valid number.&lt;br /&gt;To avoid this, always add the second argument, in this case&lt;br /&gt;parseInt("08", 10);&lt;br /&gt;returns 8 (decimal), as desired.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-116652500989364194?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/116652500989364194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=116652500989364194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/116652500989364194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/116652500989364194'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/javascript-why-parseint08-parseint09.html' title='JavaScript: Why parseInt(08) &amp; parseInt(09) is showing the value 0 ?'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-38176106.post-116645957442206747</id><published>2006-12-18T08:28:00.000-08:00</published><updated>2006-12-18T08:37:16.703-08:00</updated><title type='text'>Enumerate function @ Python</title><content type='html'>class enumerate(object)&lt;br/&gt;&lt;br/&gt; |  enumerate(iterable) -&gt; iterator for index, value of iterable&lt;br/&gt;&lt;br/&gt; |  &lt;br/&gt;&lt;br/&gt; |  Return an enumerate object.  iterable must be an other object that supports&lt;br/&gt;&lt;br/&gt; |  iteration.  The enumerate object yields pairs containing a count (from&lt;br/&gt;&lt;br/&gt; |  zero) and a value yielded by the iterable argument.  enumerate is useful&lt;br/&gt;&lt;br/&gt; |  for obtaining an indexed list: (0, seq[0]), (1, seq[1]), (2, seq[2]), ...&lt;br/&gt;&lt;br/&gt; |  &lt;br/&gt;&lt;br/&gt; |  Methods defined here:&lt;br/&gt;&lt;br/&gt; |  &lt;br/&gt;&lt;br/&gt; |  __getattribute__(...)&lt;br/&gt;&lt;br/&gt; |      x.__getattribute__('name') &lt;==&gt; x.name&lt;br/&gt;&lt;br/&gt; |  &lt;br/&gt;&lt;br/&gt; |  __iter__(...)&lt;br/&gt;&lt;br/&gt; |      x.__iter__() &lt;==&gt; iter(x)&lt;br/&gt;&lt;br/&gt; |  &lt;br/&gt;&lt;br/&gt; |  next(...)&lt;br/&gt;&lt;br/&gt; |      x.next() -&gt; the next value, or raise StopIteration&lt;br/&gt;&lt;br/&gt; |  &lt;br/&gt;&lt;br/&gt; |  ----------------------------------------------------------------------&lt;br/&gt;&lt;br/&gt; |  Data and other attributes defined here:&lt;br/&gt;&lt;br/&gt; |  &lt;br/&gt;&lt;br/&gt; |  __new__ = &lt;built-in&gt;&lt;br/&gt;&lt;br/&gt; |      T.__new__(S, ...) -&gt; a new object with type S, a subtype of T&lt;br/&gt;&lt;br/&gt;ex::&lt;br/&gt;&lt;br/&gt;1)&lt;br/&gt;for index,word in enumerate(range(10)):&lt;br/&gt;...  print index,word&lt;br/&gt;... &lt;br/&gt; 0 0&lt;br/&gt;1 1&lt;br/&gt;2 2&lt;br/&gt;3 3&lt;br/&gt;4 4&lt;br/&gt;5 5&lt;br/&gt;6 6&lt;br/&gt;7 7&lt;br/&gt;8 8&lt;br/&gt;9 9&lt;br/&gt;&lt;br/&gt;2)&lt;br/&gt;for index,word in enumerate(range(10)):&lt;br/&gt;...  print "%s %f" % (index,word)&lt;br/&gt;... &lt;br/&gt;0 0.000000&lt;br/&gt;1 1.000000&lt;br/&gt;2 2.000000&lt;br/&gt;3 3.000000&lt;br/&gt;4 4.000000&lt;br/&gt;5 5.000000&lt;br/&gt;6 6.000000&lt;br/&gt;7 7.000000&lt;br/&gt;8 8.000000&lt;br/&gt;9 9.000000&lt;br/&gt;&lt;br/&gt; &lt;style&gt;i{content: normal !important}&lt;/style&gt;&lt;style&gt;i{content: normal !important}&lt;/style&gt;&lt;style&gt;i{content: normal !important}&lt;/style&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/38176106-116645957442206747?l=makinguseofpython.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://makinguseofpython.blogspot.com/feeds/116645957442206747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=38176106&amp;postID=116645957442206747' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/116645957442206747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/38176106/posts/default/116645957442206747'/><link rel='alternate' type='text/html' href='http://makinguseofpython.blogspot.com/2006/12/enumerate-function-python.html' title='Enumerate function @ Python'/><author><name>Mayank</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='21' src='http://3.bp.blogspot.com/_Ea95Dr-fqVk/SidT8stLw7I/AAAAAAAAAHc/DCxwlrIZ4c8/S220/mayank.jpg'/></author><thr:total>0</thr:total></entry></feed>
