Index

  • Why Python?

    Posted on Wednesday, September 17th, 2014
    1 comment

    Here is an interesting subject which I would love to bring up and share with everyone. This article is not meant to compare Python with any other language, and in fact I will not be mentioning any language in this article but Python. As Everyone reading this might know by now, Python is a very diverse language. It can be used for tasks such as web development to the development of a Geographical Information System, to even computational biology and bioinformatics. Python has a vast array of fully supported GUI and web frameworks. This makes it a snap to apply the Model-View-Controller programming methodology to an entire application's ecosystem of software. The same code that is used to generate data for a GTK or Windows-based GUI application can also be applied to displaying the same data in a web application on the Internet. It is absolutely astonishing on what Python is really capable of when it comes to full-stack development. A developer really only need to know Python, and then the possibilities of what she or he can do is limitless.

    That is only the introduction to this article, and by now, regardless if you know or use Python or not, you should be at least somewhat impressed on it's capabilities. Python is so much more than a diverse language with limitless possibilities. Python is a vast community of developers from many backgrounds, ranging from computer science, to biology, to mathematicians, to even engineering. Python for many in the science community is the go-to language because of packages such as SciPy and Biopython.

    Python is normally installed by default on most Linux distributions, if not all. Python is also pre-installed on Mac OS X, making it a very universal language in terms of install base. This makes it easy to share your programs with other developers and colleagues. Due to this type of default install base on these platforms, some of the operating system specific scripts are also made in Python, and thus there are more bindings to operating system specific services that work right out of the box. This makes Python ideal for system automation and a general shell scripting replacement.

    If a developer knows Python, they are able to develop a wide array of applications, ranging from system automation, GUI applications, embedded development, web development, to even 3D modeling with Blender, all with a single language. This enables a developer to be extremely proficient in one language alone, as the developer doesn't need to worry about learning any additional languages to take on additional development tasks for their project. I personally distribute my Python knowledge throughout the Python ecosystem, I know how to build GUI applications, console application, system automation applications, network servers, and even web development. With Python, I am hardly limited to a single task, as just like Linux, Python is a general purpose. As with Linux, you aren't limited to just servers, you can deploy Linux on workstations, and embedded devices to even smartphones, as seen with Android. Knowing how to operate Linux in this day and age is starting to become critical due to the wide array of embedded devices and servers on the market today. Linux is only growing, and I believe it will play a vital role in the future of computing as we gravitate away from traditional PCs into the more mobile and embedded world. If Google and Apple have their way, PCs of the future will only be used for software development and PC gaming. I don't PC gaming dying, at least anytime soon.

    Python in the future will have a similar role to that of Linux, it will be that universal language that every computer science major will know and understand. With the Raspberry Pi, and children learning Python at a young age because of it, Python will be everywhere in our next generation of offspring. When I was a kid, BASIC was all the rage, where every home computer manufacturer had to ship with BASIC in ROM or the unit wouldn't sell as good. Python is like the new BASIC. When I grew into my teens and early adulthood, guess what was one of the more popular and widespread development kits for desktop development? If you said VisualBasic, then you would be correct. VisualBasic was huge in the late 90s and early 2000s, it was everywhere in the media and lots of organizations used it for development of internal software tools. As a result, ASP/ASP.NET used VisualBasic at the primary language at first, and is still used in .NET programming today.

    I believe Python is very critical for any developer to know and understand, or they will risk being left behind like FORTH and COBOL developers of the generation before BASIC. There are still some careers out there that require FORTH and COBOL, but for very old companies which have been around since the 70s and find it difficult to migrate away from their current solutions. If you understand how technology trends and have done research of how technology has trended since the 70s, it is difficult to not determine that Python is turning into the next hugely trending language and is only still growing. It is the language which our current offspring is learning that will be the next COBOL or BASIC in our technological world. Depending where some children grow up, you can also agree that Linux is also trending, especially in some European countries, and especially in communist countries where monopoly rule is banned. With the advent of Android, Ubuntu, Raspberry Pi, and the One-Laptop-per-Child project, children are seeing and using UNIX-like operating systems at a very young age. Also, the language shipped with the OLPC project is Python, with the entire Sugar desktop environment being made in Python. Another popular software product that teens and young adults are getting their hands on which uses Python is the Blender 3D modeling and animation software. One of my cousins has been learning Blender for her college degree as a 3D designer. In order to automate aspects of the 3D rendering software, and to enable game development, one can use Python. Python is literally everywhere, and in heavy use on popular software projects for the aspect of scripting and automation.

    In conclusion, to why to use Python should be a simple answer for any developer now. It enables a single language and code-base to be used across multiple projects easily, and it might very well be the next big language of our technological future. It is always best to be ahead of the curve and to not be left behind.

  • A JSON version of the standard Python xmlrpclib

    Posted on Thursday, August 14th, 2014

    I have always loved how easy Python made it to create simple RPC services using XML-RPC. I like how dead simple the API for both an XML-RPC server and client are. Here's an example XML-RPC Server in Python:

    from SimpleXMLRPCServer import SimpleXMLRPCServer
    
    # Create server
    server = SimpleXMLRPCServer(("localhost", 8000))
    
    # Register a function
    @server.register_function
    def hello(name='World'):
        return 'Hello %s!' % name
    
    # Run the server's main loop
    server.serve_forever()
    

    Accessing this service via Python couldn't be simpler:

    import xmlrpclib
    
    s = xmlrpclib.ServerProxy('http://localhost:8000')
    
    print s.hello()  # Outputs "Hello World!"
    print s.hello('XML-RPC') # Outputs "Hello XML-RPC!"
    

    I have been using XML-RPC a lot as a result, as I build mostly everything in Python. However, the overhead of XML parsing can be daunting for larger applications that are expected to receive many requests per minute. One technology that Python seems to be lacking in it's standard library is a simple service called JSON-RPC. Luckily I recently wrote a client library that currently only works on pure socket connections, here is the source code:

    #
    # JSON-RPC CLIENT LIBRARY inspired by the standard library xmlrpclib
    #
    # an JSON-RPC client interface for Python.
    #
    import urllib, json, socket
    
    class _Method(object):
        # some magic to bind an JSON-RPC method to an RPC server.
        # supports "nested" methods (e.g. examples.getStateName)
        def __init__(self, send, name):
            self.__send = send
            self.__name = name
        def __getattr__(self, name):
            return _Method(self.__send, "%s.%s" % (self.__name, name))
        def __call__(self, **kwargs):
            return self.__send(self.__name, kwargs)
    
    class ServerProxy(object):
        def __init__(self, uri):
            protocol, uri = urllib.splittype(uri)
            if protocol not in ('socket',):
                raise IOError, 'unsupported JSON-RPC protocol'
            self.__host, self.__handler = urllib.splithost(uri)
            self.__id = 0
        def __request(self, method, params):
            s = socket.socket(family=socket.AF_INET, type=socket.SOCK_STREAM)
            s.connect(urllib.splitnport(self.__host, 80))
            self.__id +=1
            data = {"jsonrpc": "2.0", "method": method, "id":self.__id}
            if params != {}:
                data.update({'params':params})
            s.send(json.dumps(data))
            resp = json.loads(s.recv(512))
            s.close()
            return resp['result']
        def __repr__(self):
            return '<ServerProxy for %s%s>' % (self.__host, self.__handler)
        __str__ = __repr__
        def __getattr__(self, name):
            return _Method(self.__request, name)
    

    This library works in the exact same manner as the xmlrpclib shown above, expect it connects to JSON-RPC servers, such as the XBMC Media Center software Here is how you would interface with XBMC:

    #
    # A super simple XBMC JSON-RPC Interface for Python
    # Control your XBMC in a Pythonic way!
    #
    import jsonrpclib, time
    
    class XBMC(jsonrpclib.ServerProxy):
        def __init__(self, host, port=9090):
            super(XBMC, self).__init__('socket://%s:%s/' % (host, int(port)))
        def notification(self, title, message):
            return self.GUI.ShowNotification(title=title, message=message)
        def global_search(self, query):
            self.home()
            self.Input.Up()
            self.Input.Select()
            time.sleep(2) # Wait for keyboard on slower boxes.
            return self.Input.SendText(text=query)
        def weather(self):
            return self.GUI.ActivateWindow(window='weather')
        def home(self):
            return self.GUI.ActivateWindow(window='home')
        def favourites(self):
            return self.GUI.ActivateWindow(window='favourites')
        favorites = favourites
    

    All of this code, plus many more, are now available on my newest bitbucket repository aptly called Python Experiments.

  • Two-factor laptop decryption using a smartphone

    Posted on Thursday, August 7th, 2014

    This is a pet project I showed to a select few at PyCon 2014 in Montreal. I have not publicly disclosed this project to anybody else in the tech community until now. I will not be releasing the source code for this project, so do not ask. I am either planning on obtaining a patent for this, or starting a Kickstarter project to obtain the funding required to develop this into a full fledged product for multiple platforms. Currently it only works with Linux, as it was much easier to prototype using such an open and hackable operating system. However, given enough interest, I would love to port this product over to Mac OS X and Microsoft Windows platforms. I am currently looking for any feedback on this, and to see how much interest there might be for such as product.

    This product has three separate parts, which enable what I am calling Chained passphrase decryption. The third part of the chain is not mentioned in this video, nor will I talk about it at all. Basically, all parts of the chain are required to successfully construct the final encryption key that will be used to decrypt the device in question. My software does not perform any actual encryption, my software only constructs the key which is then passed on to the encryption software. On the Linux platform seen in the video, the encryption software used is LUKS, which is standard in every Linux distribution for block level encryption. This software should theoretically be usable with any software that can accept a passphrase.

    The main communication link as seen in this video is a standard authenticated bluetooth connection, from the smartphone to the laptop. The connection is only active for as long as it takes to obtain that part of the chain to construct the final passphrase. In most cases, the software is manually launched by the consumer when he or she needs to decrypt his or her device. On most secure smartphones, the consumer first needs to unlock their device with a password, PIN, or fingerprint in order to launch an application on said device. Most devices also support full encryption, securing this solution even further. With only these two chains being mentioned, there is a lot of work a hacker will need to do in order to obtain the encryption key to unlock the device. Let's review what a hacker will need to do:

    • The hacker will need physical access to both the laptop and smartphone
    • If the hacker only has the laptop, he or she can try to bruteforce the encryption, however since the actual key is a binary format, and can be very long. This might take the hacker a very long time to crack. This key isn't your everyday ASCII passphrase, which are relatively easy to crack since the human alphabet is limited.
    • If the hacker has both the laptop and smartphone, they need to unlock that smartphone using the smartphones authentication. The only way by this is to remove the NAND chip(and hope that it's not encrypted), or find a vulnerability in the smartphone's lock screen.
    • If the hacker finally has access to the devices data and can run the application which creates the bluetooth link. The hacker then is required to enter in the correct PIN on the device. This can be brute forced, but hopefully the hacker never gets to this point.
    • Finally, there is one last part of the chain, the third part, which can break the chain of trust entirely, preventing that smartphone and laptop pair from even working. I will leave this part to the imagination of the reader.

    As you can see, much thought has been put into this product to make a more secure laptop for consumers and corporate workers. Unlike existing solutions which rely on local-only measures to enforce encryption, this method takes it a step further to authenticate the end-user in question using their most personal device, their smartphone. In this day and age, everybody has a smartphone, or if you work for any large company and have a company laptop, you most likely carry a company smartphone with you at all times. So naturally, the next step of laptop encryption should use this pairing to harden laptop encryption.

    UPDATE 08/08/2014: I have been receiving various comments from the different sources which I posted a link to this. I would like to clarify that this project may or may not be open source, this variable has yet to be determined, thus is why I am not releasing the source code at this time. Some comments are pointing on the fact that bluetooth is insecure, well this might be true, so is plain text SMTP, HTTP, etc... That is why you place an encryption layer over top. For email, this is normally PGP encryption, and for HTTP, this is SSL. This bluetooth link is also encrypted, currently using AES, but this is subject to change. AES was mentioned in the original video. Hopefully that clarifies some additional left out details.

  • Hacker's Edge soon to be in Closed Beta

    Posted on Friday, May 23rd, 2014

    Does anyone recall a project I began way back in 2012 called Hacker's Edge? Originally, I was building the entire project in Django, but earlier this year after creating an ncurses based website, it got me interested in trying to build Hacker's Edge using a Python console and ncurses.

    So, for the past couple of months I have been hard at work getting this new version through the alpha stage of development. The alpha is currently publicly available for anyone to jump in and play around. This new version is no longer limited by web technologies and is only limited to what I can do in Python. At the moment, I am in the process of expanding the simple-cpu I built to create both the Black Hat and White Hat tools which will be used to hack other hosts in the game, and to better protect hosts in the game respectively. My simple-cpu has come a very long way since I first built it, and now supports a full 16-bit address space, x86-like assembly instructions, and much more. I hope to make a tutorial on using the simulator soon in stand-alone projects.

    Other implemented features are a fully working mail server system, with support for independent in-game mail server. The mail system itself uses the standard mbox API for mail storage and retrieval. A DNS system is also in place, and a host can choose which host is their DNS server. So you can imagine if a player manages to hijack a DNS server in-game the havoc that could occur. Each independent host runs it's own virtual machine and has it's own memory space mapped in memory. This allows for hosts to run their own KERNELs and other programs completely independent from the other hosts in the game world. The KERNEL can be written entirely by a player if they so choose to either better prepare their hosts from attack, or to prepare their host to attack other hosts better. There is also the possibility of players creating in-game rootkits to attack other hosts and infect them. Since the hacking and white hat in-game tools will run entirely within the virtual machine, this enables players to create torjan horses to infect other hosts easily. Since most of the in-game tools will cost in-game currency to purchase, I am assuming that some players would take advantage of this and pirate the in-game tools.

    Furthermore, the following in-game player services will also be hackable by players, if they are skilled enough to do so:

    • In-game banking services, so players can technically steal currency from other players.
    • In-game ranking and experience system, so players can try to forge themselves a better ranking or increase their experience points to level up quicker.
    • In-game shops which will sell the in-game tools, these shops may also be hacked to obtain said software for no charge.

    To make the programming/coding element more accessible to players who may not have experience in Assembly-like languages, I am also developing a high-level language which compiles into Assembly, which can then be edited and then assembled into binary.

    The project still uses Django for the front-end, and for player account management. Here is the typical workflow for a player:

    1. Real user browsers to Django website, and either signs up or logs in.
    2. Real user then accesses their player management page, and proceed to create a new player character.
    3. The Django app then registers the player character in the Hacker's Edge world, and creates them their initial host.
    4. Real user now connects to either telnet or presses Play.
    5. Real user then logs in using their Player Character login credentials created via Django.
    6. Player hopefully enjoys themselves in the virtual online hacking simulation game.

    Django still plays a critical part in this project, as it's the central hub to manage a user's player characters. This enables a user to easily have multiple player characters and switch between them at will, or play against themselves in two terminal windows. Furthermore, I am also wanting to integrate the Out-of-Character mode with the web presence. This will enable players to easily access both the forums and help center, and post questions and socialize. In Out-of-Character mode, the player character is never revealed to other users, so one can post to the forum and socialize, not knowing if you are actually getting along with a rival in-game. There is definitely a separation between in-game persona and your real-world self. The only players whom will know your real-world identity will of course be server moderators, whom are there to give a helping hand and not attack your in-game hosts or real-life self.

    Which brings me to my next subject, is that I will be looking for people who would be willing to help out with moderation. You will have a special account which will allow you to perform tasks which a regular user or player would not otherwise be-able to perform. The following special powers will be provided to those who assist in moderating:

    • Access to post into staff-only forum sections.
    • Access to all the undocumented VM API calls, to assist with building specific in-game tools.
    • Ability to see the real-world Django username of an in-game player.
    • Access to any and all in-game hosts regardless of ACL table, used to assist other players.
    • Early access to KERNEL.SYS and other critical VM source code, mainly to assist in testing and debugging.
    • Access to staff-only hosts, and admin access to many in-game hosts for moderation purposes.

    I am planning for Hacker's Edge to enter Closed Beta by the end of May, or mid-June. For those who already registered on the website a couple years back, your accounts are still there and active. Once the closed beta begins, I will be choosing from the pool of users, and sending out an email notification to them to inform them of the new Hacker's Edge experience. During closed beta, the following will be available, and be tested during the closed beta:

    • In-game Black Hat and White Hat tools.
    • In game currency, and banking system.
    • In-game experience and ranking systems.
    • Missions, which will provide the experience points, and currency to the players.
    • And more, which I cannot think of right now.

    Before the alpha ends, there will be a basic test mission given to anybody who enters the alpha game in the form of an in-game email message, with instructions on what should be done. This will be there to test out the mission mechanics before going beta.

  • PyCon 2014 Montreal

    Posted on Tuesday, April 8th, 2014

    I will be attending the PyCon in Montreal this week, and I look forward to many of the talks and blogging about as much as I possibly can while I am there. If anybody whom follows Python Diary is attending, you should be-able to find me there.

    Looking forward to all the excellent talks this year, and this is my very first PyCon, so you can just see how excited I must be!

    Everything PyCon will be properly tagged on the blog, so just bookmark that tag for the latest news directly from PyCon 2014.

  • Website made entirely using ncurses!

    Posted on Saturday, February 1st, 2014

    As an interesting proof-of-concept idea, I built an entire website, my personal profile page using nothing more than ncurses and a vt100 terminal emulator! I recently unleashed it out into the public, and there was lots of positive and nostalgic responses. This is only the first iteration of the site, and more features will be coming soon.

    The result was unexpectedly usable! Although hosting such a site is only ideal for low traffic websites as the server resources can really be used up by each forked Python process. How it works is simpler than you might imagine, it is merely a standard Python console application running directly in the browser! To obtain the vt100 emulation and access to the Python application, I used a popular remote shell tool called Shellinabox. Shellinabox is normally used to provide a Linux admin with a remote login shell via their browser to administer the server, just as he/she would while using SSH. Shellinabox can actually run any terminal program you tell it to run, and this gave birth to this idea. I first tested it by running Lynx in a web browser directly, so accessing a page would immediately display the popular Lynx browser. Amazingly, the mouse was also able to control Lynx! So... I thought, if I could make my own ncurses application which can also use a mouse, I could build an entire website using just ncurses!

    You can view it live by clicking on my name below my photo in the right bar of this website. There is also an alternative telnet interface for those whom don't have a graphical browser handy, as vt100 emulation requires a decent JavaScript engine.

    This is more of a proof-of-concept, as I am planning on building this idea further with a complete recode of my Hacker's Edge massively multiplayer online game. I had some difficulties making Hacker's Edge what I wanted it to be, and I believe turning it into a full Python console application with some ncurses components might be what I need to really make this game take off. The game will end up featuring both a web-based vt100 terminal emulation for those without a compatible Telnet client, and telnet connection support. The new idea will be to add a better network simulator, many console applications, and a fake assembly language to built fake viruses and malware to create fake botnets. Think of it as a Grand Theft Auto for CyberCrime! As you can see from my Bitbucket page, I have been creating some specialized applications, such as the CPU simulator, which will make it's way into Hacker's Edge.

  • Kevin Veroneau Consulting demo video

    Posted on Tuesday, December 10th, 2013

    In this video you can see my Consulting Services website in action to see the benefits of working with me over other independent Django contractor. The tools were of course built using Django, and have been used for over a year now successfully:

  • Have Django respond to Email in real-time

    Posted on Thursday, August 1st, 2013

    It's been a long time since I wrote a new article on Python Diary, and I do apologize for the lack of content recently. Hopefully this interesting article will make up for that.

    Have you ever wanted Django to parse an incoming Email in real-time as soon as it comes into your server? Look no further than this handy solution here. In order to use this solution, you will need to configure a local Postfix server, it doesn't need to be-able to send outbound email, only receive new messages for your domain. Although being able to send messages will make it easier to reply back to the user's whom are sending the server messages.

    You will first need to create a short Python script which Postfix will deliver the actual message to:

    import sys
    import urllib2
    
    req = urllib2.Request(url='[Django URL]', data=sys.stdin.read())
    f = urllib2.urlopen(req)
    

    This script submits the entire message unmodified directly to any web address you give the script, preferably a Django URL. Notice that I am not using the standard form encoding, as there is no need to add additional overhead when all we want to do is have Django process an entire message. The main reason why this script exists, is because this script will run normally as nobody:nogroup, so it will not be-able to easily talk with your local Django app directly using say, a management script. Sending the data directly over HTTP to the Django instance is simple and should have very little overhead and integrate easily with existing solutions.

    from django.views.decorators.csrf import csrf_exempt
    from email import message_from_string
    from django.http import HttpResponse
    
    @csrf_exempt
    def mail_parse(req):
      msg = message_from_string(req.body)
      # Process data from msg here!
      return HttpResponse("OK", content_type="text/plain")
    

    Here is the Django view which will receive the raw message data and parse it. You should read the Python documentation on the subject to learn how to extract the headers, body, and attachments you want to parse. Finally, here is what you should place in your /etc/aliases:

    api:         |/[path to script].py
    

    Be sure to run newaliases afterwards to rebuild the hash table. This alias here makes anything api@[domain] submit to your Django site. Enjoy!

  • Django bootstrap theme is ready!

    Posted on Saturday, May 25th, 2013

    You can download a project template for this now: http://www.pythondiary.com/templates/bootstraptheme

    It's finally ready for developer consumption, my Django bootstrap theme Django app. With this super simple app in your Django project, you can easily apply a site-wide Bootstrap theme in a matter of minutes. Here's an example base.html you would use in your project's templates directory:

    {% extends 'bootstrap_theme/starter.html' %}
    
    {% block title %}Bootstrap Django site{% endblock %}
    
    {% block branding %}Django Project{% endblock %}
    
    {% block content %}
    Yes Folks, this is how easy it is to implement bootstrap in Django now.  Be sure to look at the other templates available to see what <b>blocks</b> you can override.
    {% endblock %}
    

    Be sure to add bootstrap_theme to your INSTALLED_APPS, and this will work like a charm. Here is a list of available base templates you can extend:

    base.html
    This is the main template which the ones below extend to create the Bootstrap experience.
    starter.html
    This is the exact starter template from the Bootstrap documentation, it's the most basic and easiest to extend.
    fluid.html
    Similar to starter, except it allows users to sign in and out, and has a left navigation bar.
    marketing.html
    The marketing template directly from the bootstrap examples page tailored to work with Django.
    marketing_narrow.html
    From the bootstrap example page, another version of a marketing page you can try out.
    marketing_clean.html
    Yet another marketing page example, also from the bootstrap examples page.
    carousel.html
    The bootstrap carousel example made for Django, the bonus is that the Carousel is driven from the database, so it's easy to add and edit the big Carousel banner.

    Wait, there's more... There's a large amount of templatetags at your disposal as well in the bootstrap library which you can load into any template you need it in. Here's what's included:

    buttonlink url icon
    You can create bootstrap themed buttons with this tag.
    emphasis filter
    This filter will add special styling to the text, such as muted which is the default, or anything in the text- CSS components.
    abbrev filter
    This handy filter will create an abbreviation text.
    yesnoicon filter
    Depending if the value is True or False a different icon is displayed.
    ratingicon filter
    This super handy filter will create a specific amount of star icons depending on the value.
    link filter
    Pass in any model object which has a get_absolute_url and it will automatically make it click-able.
    carousel group_name
    This is used to display a database driven Carousel. The group_name parameter is which group in the database model to display for this instance.
    navbar_gradient first_color last_color
    This super handy tag will automatically generate the required CSS style needed for the navbar gradient.
    modal title modal_id form_action
    This block tag is used to generate a modal dialog box, the last 2 options are optional. The first is the title of the dialog box, the second is the unique div ID for the modal, and the last one is the URL which the form inside the modal will be posted to, if the user saves the changes.
    icon slug
    This is used to display bootstrap icons easily.
    modal_button title modal_id icon
    This is used to generate the required A tag to display a modal dialog box generated above. The first option is what to display on the button itself, the second is the div ID chosen, and the last one is an icon slug to place on the button. The last two options are optional and have reasonable defaults.

    Don't leave yet, there's still one last thing... An include-able template which can display a Django form very elegantly in bootstrap! Finally you can make your Django generated forms look great and functional with very little effort. Here's an example contact form to get you started:

              <form action="{% url 'contact-form' %}" method="post">{% csrf_token %}
                <fieldset>
                  <legend>Contact form</legend>
                  {% include "bootstrap_form.html" %}
                  <button type="submit" class="btn btn-primary">Send Message</button>
                </fieldset>
              </form>
    

    Wow, that's a lot to take in, in the next release I will be adding a bunch of ready made templates for django-registration so that you can get a new Django website up and running in a matter of hours.

  • Looking for advertising proposals

    Posted on Sunday, May 19th, 2013

    As some of you may have noticed, the AdSense bar no longer exists on my blog, this is due to Google recently revoking my AdSense account, I am quite sure it is in regards to mentioning it on a page. Currently users who have an account are able to opt'd out of either being tracked by Analytics or have no ads served to them. I will be removing this feature soon, as I am planning on self-hosting ads from prospect publishers. If you have a Python or Django related project which you would like to adverse on this blog, please contact me. Having a way to fund this website will allow me to publish more quality articles and tutorials. When a new article is posted, this blog receives over 1,000 hits in that single day. These are 1,000 prospect users which use Python and maybe Django who will see your advertisement. These can also be users who are just learning Python, so books and courses are also welcome.

    Currently the ad serving system has yet to be implemented, so at this time I am only asking prospect advertisers to provide me with a proposal on how the ads should be served to users and costs they might be willing to pay. For the record this blog has been online for well over a year now and receives many returning users due to the quality of the content which is provided. This website is also much more than a blog, as it has other features which bring users back for more.

    Thank you for your time in reading this.

  • DVD Collection source code now available

    Posted on Sunday, May 19th, 2013

    For those who were wanting a copy of the DVD Collection software made in Python, I have now open sourced it and it is live on BitBucket!

    DVD Collection software

  • Python Script to encode Django templates

    Posted on Sunday, May 19th, 2013

    Do you need to display raw Django template code in your Django <1.4 project? Look no further than this script! It's rather crude, but gets the job done. I haven't yet updated a few Django websites to Django 1.5, which has a new template tag to do this for you, so I created this script to use in legacy Django sites, and it works like a charm!

    #!/usr/bin/python
    
    import sys
    
    try:
      filename = sys.argv[1]
    except IndexError:
      print "This command needs exactly 1 parameter!"
      sys.exit()
    
    data = open(filename, 'r').read()
    data = data.replace('{%', '{! templatetag openblock !}').replace('%}', '{! templatetag closeblock !}')
    data = data.replace('{{', '{% templatetag openvariable %}').replace('}}', '{% templatetag closevariable %}')
    
    print data.replace('{!', '{%').replace('!}', '%}')
    

    You should Pygments to highlight the syntax like I do on this blog of course. If you are using Django 1.5 or greater, you should use the verbatim template tag over this.

  • Building a set of indie community focused Django apps

    Posted on Friday, May 10th, 2013

    Today I have just started work on an set of Django pluggable apps which can either be used independently or as a whole. The main focus is to provide Indie developers with an entire website framework which can be used to host a database of indie downloads, manage assets, support developer blogs and vlogs, and much more. I am building this as an open source project from the start, and it is hosted on BitBucket with the discussion hosted on Uarica.

    The first prototype of the website is done for anyone that's curious on how it currently looks, it can be accessed here.

    Uarica Project page
    BitBucket page

  • A birthday present for a friend made in Django

    Posted on Friday, April 19th, 2013

    I have a friend whom is a huge, and I really mean huge movie buff. He has the largest movie collection that I know of, and one the largest TVs I have seen. He was previously managing his collection using another website someone built, which I think is personally not very well done and my friend deserves much better!

    First I used the standard Python XML libraries to parse and extract all the movies he has on the old website, as I didn't want to re-enter all those movies, and I'm sure he wouldn't either. After it was all extracted and I was able to parse it easily through Python, I created the Django project and models for which the movie titles will live in. I created the first part of the website, including the importing of all his movies in just a mere 4.5 hours(according to my Subversion timestamp). I was truly amazed at what a full featured web application I could create in such little time, I could barely sleep last night as I wanted to continue work and add new features.

    Now, the website is nearing completion and I thought I'd share it here with all my loyal readers. This web application has full IMDb integration, which still has a few bugs here and there that need to be ironed out. I am currently debating if I should open source this creation or not...

    You can check this application at Cinema-Nick.com.

  • Will be taking another look at web2py

    Posted on Wednesday, April 10th, 2013

    My last encounter with Web2py was with version 2.0, this was back in October of 2012, of which I have a review for that version. Reviewing their changelog, I can see that this framework has evolved a great amount in just a few short months. There were many features which I praised about the framework, but there were still some things holding me back from using it over Django for my next project. So, with that, I am planning on diving back into web2py, and should have a new review up with the latest version. I have a project, I am thinking I may convert over to web2py and see how that goes. If development becomes quicker, then I will consider web2py for future projects as well.

    If you haven't already, I would recommend taking a look at web2py and see what it can offer your project. Both Django and web2py are similar, but at the same time they are very different. They both took the Ruby on Rails idea in their own direction. One thing to note, is that apps in web2py are not like apps in Django. This also makes working with web2py a little difficult at times, as it's not easy for apps to talk to each other, not as easy as it is in Django that is. However, in web2py, it's not an apps purpose to extend the frameworks functionality, it is the job of a plugin. That being said, web2py has grown a large amount since I last used it, so all my hardships I experienced last time around might be resolved.

About Me

My Photo
Names Kevin, hugely into UNIX technologies, not just Linux. I've dabbled with the demons, played with the Sun, and now with the Penguins.




Kevin Veroneau Consulting Services
Do you require the services of a Django contractor? Do you need both a website and hosting services? Perhaps I can help.

This Month

If you like what you read, please consider donating to help with hosting costs, and to fund future books to review.

Python Powered | © 2012-2014 Kevin Veroneau