<?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:blogger='http://schemas.google.com/blogger/2008' 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-9062897311930590295</id><updated>2025-04-21T07:05:28.273+01:00</updated><category term="Flask"/><category term="Cell ID"/><category term="Erlang"/><category term="Erlang Record"/><category term="Erlsom"/><category term="ITU"/><category term="MWC 2012"/><category term="Mobile World Congress"/><category term="PyDev"/><category term="Python"/><category term="SQLAlchemy"/><category term="Test Field Mode"/><category term="WTForms"/><category term="XSD"/><category term="aptana"/><category term="beggars"/><category term="easy as pie"/><category term="iPhone"/><category term="liburl"/><category term="liburl2"/><category term="requests"/><category term="simpleapi"/><category term="virtualenv"/><title type='text'>This changes everything...again...</title><subtitle type='html'>Much Ado About Nothing...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-5691385489677250085</id><published>2013-02-22T12:11:00.000+00:00</published><updated>2013-02-22T12:38:00.248+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="easy as pie"/><category scheme="http://www.blogger.com/atom/ns#" term="Erlang"/><category scheme="http://www.blogger.com/atom/ns#" term="Erlang Record"/><category scheme="http://www.blogger.com/atom/ns#" term="Erlsom"/><category scheme="http://www.blogger.com/atom/ns#" term="XSD"/><title type='text'>Erlang, record and Erlsom with XSD for XML goodness</title><content type='html'>Below is a simple example which should get you up and running quickly with Erlsom. Grab a copy of Erlsom from&amp;nbsp;&lt;a href=&quot;https://github.com/willemdj/erlsom&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;Willemdj&#39;s github&lt;/a&gt;&amp;nbsp;if you need to.&lt;br /&gt;
&lt;br /&gt;
This is our XML, note.xml:&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;&lt;note&gt;
  &lt;to&gt;Tove&lt;/to&gt;
  &lt;from&gt;Jani&lt;/from&gt;
  &lt;heading&gt;Reminder&lt;/heading&gt;
  &lt;mbody&gt;Don&#39;t forget me this weekend!&lt;/mbody&gt;
&lt;/note&gt;
&lt;/pre&gt;
With that, head over to &lt;a href=&quot;http://www.xmlforasp.net/CodeBank/System_Xml_Schema/BuildSchema/BuildXMLSchema.aspx&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;xmlforasp.net&lt;/a&gt;&amp;nbsp;to get our XSD file. Copy/paste note.xml and select &quot;Separate Complex Types&quot; which worked for me.&lt;br /&gt;
&lt;br /&gt;
This is what our XSD should look like, note.xsd:&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;
&amp;lt;xsd:schema attributeFormDefault=&quot;unqualified&quot; elementFormDefault=&quot;qualified&quot; version=&quot;1.0&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&amp;gt;
&amp;nbsp; &amp;lt;xsd:element name=&quot;note&quot; type=&quot;noteType&quot; /&amp;gt;
&amp;nbsp; &amp;lt;xsd:complexType name=&quot;noteType&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;xsd:sequence&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;xsd:element name=&quot;to&quot; type=&quot;xsd:string&quot; /&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;xsd:element name=&quot;from&quot; type=&quot;xsd:string&quot; /&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;xsd:element name=&quot;heading&quot; type=&quot;xsd:string&quot; /&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;xsd:element name=&quot;mbody&quot; type=&quot;xsd:string&quot; /&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/xsd:sequence&amp;gt;
&amp;nbsp; &amp;lt;/xsd:complexType&amp;gt;
&amp;lt;/xsd:schema&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Watch out for the encoding bit as xmlforasp.net will give you utf-16 and Erlsom supports only utf-8.&lt;br /&gt;
&lt;br /&gt;
Next from Erlang CLI, we&#39;ll create our hrl file:&lt;br /&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;erlsom:write_xsd_hrl_file(&quot;note.xsd&quot;,&quot;note.hrl&quot;).
&lt;/pre&gt;
Which should generate the note.hrl file and look like this:
&lt;br /&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;-record(&#39;noteType&#39;, {anyAttribs, &#39;to&#39;, &#39;from&#39;, &#39;heading&#39;, &#39;mbody&#39;}).
&lt;/pre&gt;
Let&#39;s load the note.hrl file:&lt;br /&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;rr(&quot;note.hrl&quot;).
&lt;/pre&gt;
&lt;div class=&quot;p1&quot;&gt;
Load the note.xml file:&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;{ok, Xml} = file:read_file(&quot;note.xml&quot;).&amp;nbsp;
[noteType]&lt;/pre&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
Compile the note.xsd file:&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;{ok, Model} = erlsom:compile_xsd_file(&quot;note.xsd&quot;).
{ok,{model,[{type,&#39;_document&#39;,sequence.............&lt;/pre&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
And save the xml variables to our record:&lt;/div&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;/div&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;{ok, Note = #noteType{}, _} = erlsom:scan(Xml, Model).
{ok,{model,[{type,&#39;_document&#39;,sequence..............&lt;/pre&gt;
&lt;br /&gt;
Check the record:&lt;br /&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;Note.
#noteType{anyAttribs = [],to = &quot;Tove&quot;,from = &quot;Jani&quot;......&lt;/pre&gt;
&lt;br /&gt;
Check again:&lt;br /&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;Note#noteType.from.
&quot;Jani&quot;&lt;/pre&gt;
If you&#39;re building an OTP app and following OTP convention then, note.xml and note.xsd should go in the &quot;priv&quot; folder in your project root folder. You can then call the file like this:&lt;br /&gt;
Load priv_dir (replace &#39;note&#39; with your project name) -&lt;br /&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;privdir() -&amp;gt; code:priv_dir(note).&lt;/pre&gt;
Load XSD file names&lt;br /&gt;
&lt;pre class=&quot;brush: erlang&quot;&gt;note_xsd() -&amp;gt; filename:join([privdir(), &quot;note.xsd&quot;]).
&lt;/pre&gt;
If you get stuck, post your questions here or on Google+ and I&#39;ll try to help you out.
</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/5691385489677250085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2013/02/erlang-record-and-erlsom-with-xsd-for.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/5691385489677250085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/5691385489677250085'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2013/02/erlang-record-and-erlsom-with-xsd-for.html' title='Erlang, record and Erlsom with XSD for XML goodness'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-1230598740567861904</id><published>2013-01-30T13:13:00.002+00:00</published><updated>2013-01-30T13:21:38.402+00:00</updated><title type='text'>Apple MBP three screen setup</title><content type='html'>I just received the&amp;nbsp;&lt;a href=&quot;http://goo.gl/0icvj&quot; target=&quot;_blank&quot;&gt;USB UGA-2K-A&amp;nbsp;DisplayLink&lt;/a&gt;&amp;nbsp;adaptor and it&#39;s working great! I&#39;m seriously impressed by the no-hassle-plug-n-play. That&#39;s the good thing about having lowered expectations, you&#39;re pleasantly surprised when it does work.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I used the latest alpha 2.0 version drivers available from DisplayLink&#39;s site.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdInhZY6uR9lhFFnFY9Tow_lxVXLhYekPkRqt4WhrtWKnJZuYB-O7czGEdFQBWlbhHCeXTHFchbHK0rXSYO3Hrrl9NqQjMliBgp-G3PFOV9n1GXIc3r3KHBsvybpI-WTn2Xr_UCj_uFRU/s1600/IMG_1645.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;239&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdInhZY6uR9lhFFnFY9Tow_lxVXLhYekPkRqt4WhrtWKnJZuYB-O7czGEdFQBWlbhHCeXTHFchbHK0rXSYO3Hrrl9NqQjMliBgp-G3PFOV9n1GXIc3r3KHBsvybpI-WTn2Xr_UCj_uFRU/s320/IMG_1645.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Sweet!&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
I&#39;ve got the old mini-DVI-to-VGA plugged into one monitor, the DisplayLink adaptor into the other one and the MBP screen working too.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/1230598740567861904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2013/01/apple-mbp-three-screen-setup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/1230598740567861904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/1230598740567861904'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2013/01/apple-mbp-three-screen-setup.html' title='Apple MBP three screen setup'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdInhZY6uR9lhFFnFY9Tow_lxVXLhYekPkRqt4WhrtWKnJZuYB-O7czGEdFQBWlbhHCeXTHFchbHK0rXSYO3Hrrl9NqQjMliBgp-G3PFOV9n1GXIc3r3KHBsvybpI-WTn2Xr_UCj_uFRU/s72-c/IMG_1645.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-3912798894282977228</id><published>2012-12-14T15:25:00.000+00:00</published><updated>2016-06-05T13:29:35.664+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="beggars"/><category scheme="http://www.blogger.com/atom/ns#" term="ITU"/><title type='text'>ITU and their lost battle to charge YouTube</title><content type='html'>&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;﻿ITU&#39;s Final acts of the World Conference on International Telecommunications, Dubai 2012, is out.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;Besides begging for money and trying to stay relevant, the ITU&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;ratified &#39;Deep Packet Inspection&#39; (DPI). They also managed to insert this gem: &quot;optionally requires DPI systems to support inspection of encrypted traffic “in case of a local availability of the used encryption key(s).” [1]&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;What that means is that should your ISP magically come into&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;possession of say your private keys, they are allowed to decrypt your email, communications etc. that you used to encrypt it, forever without telling you.&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;Their shameless money grab was left for last, on page 23 of the Final Acts titled &#39;International telecommunication service traffic termination and exchange&#39;. It recognises that dedicated phone and data has moved to IP based networks and many Member States are asking for their authorised operating agencies to invoice service providers.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;In other words, many Governments are asking, on behalf of their state-run-money-losing telecos, to invoice YouTube for sending traffic to their users.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;The sooner these governments accept the fact that state run telcos are worse than state run airlines, the sooner they can stop begging YouTube for money and implement an open platform for all telecommunication firms to&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;flourish&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: white; font-family: Arial, sans-serif; font-size: 13px; line-height: 18px;&quot; /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;Source:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;[1]&amp;nbsp;https://www.cdt.org/blogs/cdt/2811adoption-traffic-sniffing-standard-fans-wcit-flames&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; font-family: &amp;quot;arial&amp;quot; , sans-serif; font-size: 13px; line-height: 18px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/3912798894282977228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/12/itu-and-their-lost-battle-to-charge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/3912798894282977228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/3912798894282977228'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/12/itu-and-their-lost-battle-to-charge.html' title='ITU and their lost battle to charge YouTube'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-36597501015869141</id><published>2012-10-01T16:42:00.000+01:00</published><updated>2012-10-01T16:47:13.059+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Flask"/><category scheme="http://www.blogger.com/atom/ns#" term="SQLAlchemy"/><category scheme="http://www.blogger.com/atom/ns#" term="WTForms"/><title type='text'>Flask, MySQL, WTForms &amp; SQLAlchemy that works</title><content type='html'>Quick &#39;n dirty Flask, WTForms &amp;amp; SQLAlchemy that works.&lt;br /&gt;
&lt;br /&gt;

database.py
&lt;pre class=&quot;brush: py&quot;&gt;
#!/usr/bin/env python
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
import sqlalchemy.interfaces

# Without this, MySQL will silently insert invalid values in the
# database, causing very long debugging sessions in the long run
# source: http://www.enricozini.org/2012/tips/sa-sqlmode-traditional/
class DontBeSilly(sqlalchemy.interfaces.PoolListener):
    def connect(self, dbapi_con, connection_record):
        cur = dbapi_con.cursor()
        cur.execute(&quot;SET SESSION sql_mode=&#39;TRADITIONAL&#39;&quot;)
        cur = None

engine = create_engine(&#39;mysql+mysqldb://root:banana@127.0.0.1/testdb?charset=utf8&amp;use_unicode=0&#39;, convert_unicode=True, listeners=[DontBeSilly()], echo=True)
db_session = scoped_session(sessionmaker(autocommit=False,autoflush=False,bind=engine))
Base = declarative_base()
Base.query = db_session.query_property()
Base.metadata.create_all(bind=engine)
&lt;/pre&gt;

models.py
&lt;pre class=&quot;brush: py&quot;&gt;
#!/usr/bin/env python
from sqlalchemy import Column, Integer, String
from flask_application.database import Base
  
class User(Base):
    __tablename__ = &#39;users&#39;
    id = Column(Integer, primary_key=True)
    username = Column(String)
    password = Column(String)
    email = Column(String, unique=True)
    country_id = Column(Integer)

    def __init__(self, username=None, password=None, email=None, country_id):
        self.username = username
        self.password = password
        self.email = email
        self.country_id = country_id

    def __repr__(self):
        return &#39;&lt;User %r %r %r&gt;&#39; % (self.username, self.password, self.email, self.country_id)
&lt;/pre&gt;

forms.py
&lt;pre class=&quot;brush: py&quot;&gt;
#!/usr/bin/env python
from flask.ext.wtf import Form, TextField, PasswordField, BooleanField, SelectField
from flask.ext.wtf import Required, Email, EqualTo
    
class user_add_form(Form):
    username = TextField(&#39;Username&#39;, [Required()])
    password = PasswordField(&#39;Password&#39;, [Required()])
    confirm = PasswordField(&#39;Repeat Password&#39;, [Required(), EqualTo(&#39;password&#39;, message=&#39;Passwords must match&#39;)])
    email = TextField(&#39;Email&#39;)
    country_id = SelectField(u&#39;Country&#39;, choices=[(&#39;1&#39;, &#39;UK - United Kingdom&#39;)])
&lt;/pre&gt;

template_add_user.html
&lt;pre class=&quot;brush: py&quot;&gt;
{% block content %}
&lt;div class=&quot;form&quot;&gt;
    &lt;form method=&quot;POST&quot; action=&quot;/users/add&quot; class=&quot;form&quot;&gt;
      &lt;p class=&quot;username&quot;&gt;
      {{ form.username }} {{ form.username.label }}
      &lt;/p&gt;
      &lt;p class=&quot;email&quot;&gt;
      {{ form.email }} {{ form.email.label }}
      &lt;/p&gt;
      &lt;p class=&quot;password&quot;&gt;
      {{ form.password }} {{ form.password.label }}
      &lt;/p&gt;
      &lt;p class=&quot;confirm&quot;&gt;
      {{ form.confirm }} {{ form.confirm.label }}
      &lt;/p&gt;
      &lt;p class=&quot;country_id&quot;&gt;
      {{ form.country_id }} {{ form.country_id.label }}
      &lt;/p&gt;
      &lt;p class=&quot;submit&quot;&gt;
      &lt;input type=&quot;submit&quot; value=&quot;Register&quot; class=&quot;button orange&quot; /&gt;
      &lt;/p&gt;
    &lt;/form&gt;
&lt;/div&gt;
{% endblock content %}
&lt;/pre&gt;

view.py
&lt;pre class=&quot;brush: py&quot;&gt;
from flask import Blueprint, request, render_template, flash, g, session, redirect, url_for
from flask_application import app
from flask_application.database import db_session
from flask_application.models import User
from flask_application.forms import user_add_form
from werkzeug.security import generate_password_hash, check_password_hash   

@frontend.route(&#39;/users/add&#39;, methods=[&#39;GET&#39;,&#39;POST&#39;])
def users_add():
    form = manage_user_add_form(request.form, csrf_enabled=False)
    if form.validate_on_submit():
        new_user = User(
                    form.username.data,
                    generate_password_hash(form.password.data),
                    form.email.data,
                    form.country_id.data
                    )
        db_session.add(new_user)
        db_session.commit()
        
    return render_template(&#39;template_add_user.html&#39;, form=form)
&lt;/pre&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/36597501015869141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/10/flask-mysql-wtforms-sqlalchemy-that.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/36597501015869141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/36597501015869141'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/10/flask-mysql-wtforms-sqlalchemy-that.html' title='Flask, MySQL, WTForms &amp; SQLAlchemy that works'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-3454497131385130881</id><published>2012-09-24T22:42:00.000+01:00</published><updated>2012-09-24T22:42:55.960+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Cell ID"/><category scheme="http://www.blogger.com/atom/ns#" term="iPhone"/><category scheme="http://www.blogger.com/atom/ns#" term="Test Field Mode"/><title type='text'>iPhone Test Field Mode, Serving PLMN Info and Cell ID.</title><content type='html'>I&#39;m working on a project and needed to validate the Location Area Code and Cell ID in my tests with actual info from my mobile phone. Using an iPhone and going into Test Field Mode did the trick.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Go into Test Field Mode:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;Dial *3001#12345#*&lt;/li&gt;
&lt;li&gt;MM Info -&amp;gt; Serving PLMN - Gives you MCC, MNC, RAC and LAC&lt;/li&gt;
&lt;li&gt;UMTS Cell Environment -&amp;gt; UMTS RR Info - Gives you Cell ID&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
There&#39;s much more information there and it&#39;s very handy since you don&#39;t need to muck about in an app.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/3454497131385130881/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/09/iphone-test-field-mode-serving-plmn.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/3454497131385130881'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/3454497131385130881'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/09/iphone-test-field-mode-serving-plmn.html' title='iPhone Test Field Mode, Serving PLMN Info and Cell ID.'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-1032832117972483385</id><published>2012-03-29T16:31:00.001+01:00</published><updated>2012-03-29T16:31:10.068+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MWC 2012"/><title type='text'>Android land at Mobile World Congress 2012</title><content type='html'>A little late but here are some shots from Android land at Mobile World Congress 2012.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/nQG1CvNFEzQ?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
An android making little Android statues.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/pCrEGATc8K8?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Club Android.&lt;br /&gt;&lt;iframe allowfullscreen=&#39;allowfullscreen&#39; webkitallowfullscreen=&#39;webkitallowfullscreen&#39; mozallowfullscreen=&#39;mozallowfullscreen&#39; width=&#39;320&#39; height=&#39;266&#39; src=&#39;https://www.youtube.com/embed/M6tYZ75yAT8?feature=player_embedded&#39; frameborder=&#39;0&#39;&gt;&lt;/iframe&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/1032832117972483385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/03/android-land-at-mobile-world-congress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/1032832117972483385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/1032832117972483385'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/03/android-land-at-mobile-world-congress.html' title='Android land at Mobile World Congress 2012'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-4747225378432912657</id><published>2012-02-29T14:44:00.001+00:00</published><updated>2013-01-04T23:55:34.909+00:00</updated><title type='text'>MWC: Huawei pretty booth</title><content type='html'>Huawei has got a very impressive boot here at MWC and some very neat products, but I didn&#39;t have much time as I was just passing by on my way to see Android&#39;s booth!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;a href=&quot;https://picasaweb.google.com/112876068015771499698/ThisChangesEverythingAgain?authkey=Gv1sRgCIuj4MuXwKjFXQ#5714568428273078818&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhulSL5-Puc4En_GvwDCi-eoQmxU0LZ8va-uTXv7gD7uUcZ4UD9ckAdcboEy75HW9hH7dugRGOLsTzRAj8Y3zINpeyNRB8K5-BDkO2MhUdLrlGcpz-9K6r-leQMACO06fWswdzj_d5m2xE/s288/0.jpg&quot; style=&quot;margin: 5px;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/center&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;
&lt;a href=&quot;https://picasaweb.google.com/112876068015771499698/ThisChangesEverythingAgain?authkey=Gv1sRgCIuj4MuXwKjFXQ#5714568452923192338&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg26t-miNh02jdPNTyAdUB-jY0mNNDN2ZMwP_cOofn45jDvC5LL6sP-YSnAySgQ_-af_sZrOreYUXSd-8UOWOfS9d5Ys8xoa9N6oRFf9RaEXQeN8fvrmPvE45VxRuEPJaGJJBk-Xht9j7E/s288/1.jpg&quot; style=&quot;margin: 5px;&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/center&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;blogpress_location&quot;&gt;
Location:&lt;a barcelona=&quot;barcelona&quot; c2.149787=&quot;c2.149787&quot; espanya=&quot;espanya&quot; href=&quot;http://maps.google.com/maps?q=Pla%C3%A7a%20d&quot; spain=&quot;spain&quot; z=&quot;10&#39;&quot;&gt;Plaça d&#39;Espanya,Barcelona,Spain&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/4747225378432912657/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/02/most-pretty-boot.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/4747225378432912657'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/4747225378432912657'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/02/most-pretty-boot.html' title='MWC: Huawei pretty booth'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhulSL5-Puc4En_GvwDCi-eoQmxU0LZ8va-uTXv7gD7uUcZ4UD9ckAdcboEy75HW9hH7dugRGOLsTzRAj8Y3zINpeyNRB8K5-BDkO2MhUdLrlGcpz-9K6r-leQMACO06fWswdzj_d5m2xE/s72-c/0.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-7511010096696996834</id><published>2012-02-25T14:57:00.000+00:00</published><updated>2012-02-25T14:59:30.402+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mobile World Congress"/><title type='text'>Mobile World Congress</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://serving.webgen.gsm.org/2C2D4599-4699-42DC-ADBD-9296346AF43F/assets/carousel-1.jpg?width=680&amp;amp;height=260&amp;amp;crop=auto&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;152&quot; src=&quot;http://serving.webgen.gsm.org/2C2D4599-4699-42DC-ADBD-9296346AF43F/assets/carousel-1.jpg?width=680&amp;amp;height=260&amp;amp;crop=auto&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
It&#39;s here once again, &lt;a href=&quot;http://www.mobileworldcongress.com/&quot; target=&quot;_blank&quot;&gt;Mobile World Congress or MWC&lt;/a&gt;, is upon us and mad scramble for free badges is in full swing. You&#39;d think a pretty large company would have this all sorted out by now, but what&#39;s the fun in that, besides as my crazy aunt always says, procrastination is the art of keeping up with yesterday.&lt;br /&gt;
&lt;br /&gt;
So there you have it, I&#39;ve just got my badge sorted out and I&#39;ll be there everyday till it&#39;s over. It&#39;s being held in beautiful Barcelona, Spain.&amp;nbsp;&lt;a href=&quot;http://www.engadget.com/2012/02/24/mobile-world-congress-2012-preview/&quot; target=&quot;_blank&quot;&gt;Engadget&lt;/a&gt; have a beautiful picture of the venue worth checking out.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll be out and about looking at cool things to come and will try to live blog as fast as I can. So stay tuned folks because there&#39;s more to come.</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/7511010096696996834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/02/mobile-world-congress.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/7511010096696996834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/7511010096696996834'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/02/mobile-world-congress.html' title='Mobile World Congress'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-2935333421978987455</id><published>2012-02-14T17:12:00.000+00:00</published><updated>2012-02-14T17:13:35.447+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="liburl"/><category scheme="http://www.blogger.com/atom/ns#" term="liburl2"/><category scheme="http://www.blogger.com/atom/ns#" term="Python"/><category scheme="http://www.blogger.com/atom/ns#" term="requests"/><title type='text'>Why use liburl when you can have &#39;requests&#39;!</title><content type='html'>If you&#39;re is using liburl/liburl2, you might want to take a look at &#39;&lt;a href=&quot;http://docs.python-requests.org/en/latest/index.html&quot; target=&quot;_blank&quot;&gt;requests&lt;/a&gt;&#39;. Very neat, clean and soft on the eyes :)</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/2935333421978987455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/02/why-use-liburl-when-you-can-have.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/2935333421978987455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/2935333421978987455'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/02/why-use-liburl-when-you-can-have.html' title='Why use liburl when you can have &#39;requests&#39;!'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-2747199611282749074</id><published>2012-01-29T00:34:00.000+00:00</published><updated>2012-02-17T14:34:53.753+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Flask"/><category scheme="http://www.blogger.com/atom/ns#" term="simpleapi"/><title type='text'>Python simpleapi flask</title><content type='html'>I was looking for a quick and simple way to implement APIs with Flask and came across one aptly called &lt;a href=&quot;https://github.com/flosch/simpleapi&quot; target=&quot;_blank&quot;&gt;Simpleapi&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
After going through the examples, there seems to be a problem with getting POST data to the server, so after a small edit, GET works fine.&lt;br /&gt;
&lt;br /&gt;
By default simpleapi client sends POST data, we will need to make a small change to make it send GET data. In /lib/python2.7/site-packages/simpleapi/client/client.py, line 62, change&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;client.py&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;pre class=&quot;brush: py&quot;&gt;try:
                response = urllib.urlopen(self.ns,
                                        urllib.urlencode(data))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
Change to:&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;brush: py&quot;&gt;try:
                response = urllib.urlopen(self.ns %
                                        urllib.urlencode(data))&lt;/pre&gt;
&lt;/div&gt;
&lt;b&gt;Flask server&lt;/b&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: py&quot;&gt;from flask import Flask

from simpleapi import Route
from handler import calculator

app = Flask(__name__)
app.route(&#39;/api/&#39;, methods=[&#39;GET&#39;])(Route(calculator, framework=&#39;flask&#39;, debug=True))

if __name__ == &#39;__main__&#39;:
    app.run(host=&#39;0.0.0.0&#39;, port=8888, debug=True)&lt;/pre&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;b&gt;Client&lt;/b&gt;&lt;/div&gt;
&lt;pre class=&quot;brush: py&quot;&gt;#!/usr/bin/env python

from simpleapi import Client, RemoteException

calculator = Client(ns=&#39;http://127.0.0.1:8888/api/?%s&#39;)
print &quot;the answer is&quot;, calculator.add(a=23, b=3)
&lt;/pre&gt;
&lt;div class=&quot;p1&quot;&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/2747199611282749074/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/01/python-simpleapi-flask.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/2747199611282749074'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/2747199611282749074'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/01/python-simpleapi-flask.html' title='Python simpleapi flask'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9062897311930590295.post-259564044019768188</id><published>2012-01-16T16:20:00.000+00:00</published><updated>2013-09-05T14:06:01.378+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="aptana"/><category scheme="http://www.blogger.com/atom/ns#" term="Flask"/><category scheme="http://www.blogger.com/atom/ns#" term="PyDev"/><category scheme="http://www.blogger.com/atom/ns#" term="virtualenv"/><title type='text'>Flask, virtualenv and Aptana/PyDev</title><content type='html'>I&#39;ve just started playing with &lt;a href=&quot;http://flask.pocoo.org/&quot; target=&quot;_blank&quot;&gt;Flask&lt;/a&gt;&amp;nbsp;and it&#39;s good, really really good. Today I want to tell you how I got Flask + &lt;a href=&quot;http://pypi.python.org/pypi/virtualenv&quot; target=&quot;_blank&quot;&gt;virtualenv&lt;/a&gt; + &lt;a href=&quot;http://aptana.org/products/studio3&quot; target=&quot;_blank&quot;&gt;Aptana studio 3&lt;/a&gt;, which includes &lt;a href=&quot;http://pydev.org/&quot; target=&quot;_blank&quot;&gt;PyDev&lt;/a&gt;, to work together.&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create project directory and setup virtualenv environment in it&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;mkdir projectfolder
cd projectfolder
virtualenv env
. env/bin/activate
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;In Aptana, import project then setup a new Python Interpreter which points to the &#39;Python executable&#39; in the &#39;env&#39; folder created by virtualenv command earlier. &lt;br /&gt;Go under &#39;Preferences -&amp;gt; PyDev -&amp;gt; Interpreter - Python&#39;, &amp;nbsp;click &#39;New...&#39;. &lt;br /&gt;Now browse to your [PROJECT_FOLDER] -&amp;gt; env -&amp;gt; bin and select &#39;python2.7&#39;. &lt;br /&gt;Change the &#39;Interpreter Name&#39; to something descriptive like &#39;[PROJECT_FOLDER]-Python&#39; and click &#39;Ok&#39;. &lt;br /&gt;A &#39;Selection needed&#39; window will pop-up. Do not touch anything, click &#39;Ok&#39;. &lt;br /&gt;An &#39;Error: Python stdlib source files not found&#39; window will pop-up. Click &#39;Proceed anyways&#39;. Click &#39;Ok&#39; on preference window.&lt;/li&gt;
&lt;li&gt;In PyDev Package Explorer window, right-click on your project folder and select &#39;PyDev -&amp;gt; Set as PyDev Project&#39;&lt;/li&gt;
&lt;li&gt;Right-click on project folder again and select &#39;Properties&#39;.&lt;br /&gt;Go under &#39;PyDev - Interpreter/Grammer&#39;&lt;br /&gt;Then under &#39;Interpreter&#39; select the one we setup in step 2, [PROJECT_NAME]-Python.&lt;/li&gt;
&lt;li&gt;Click on &#39;Ok&#39; and you&#39;re all set.&lt;/li&gt;
&lt;/ol&gt;
&lt;div&gt;
&lt;span class=&quot;s1&quot;&gt;So it all runs pretty good so far, brought to you by the good folks of the &#39;internets&#39; :)&lt;/span&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://thomasbhatia.blogspot.com/feeds/259564044019768188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://thomasbhatia.blogspot.com/2012/01/flask-virtualenv-and-aptanapydev.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/259564044019768188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9062897311930590295/posts/default/259564044019768188'/><link rel='alternate' type='text/html' href='http://thomasbhatia.blogspot.com/2012/01/flask-virtualenv-and-aptanapydev.html' title='Flask, virtualenv and Aptana/PyDev'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/00541866596726090239</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry></feed>