Python Script – Learning the hard way!


I recently enrolled in a Python Online Course – although I’ve been using it for more than a year now, It was always good to go back to the roots of it and refresh the fundamental knowledge I have.

The online course I’m talking about is this: learnpythonthehardway.org.

It’s a very straight forward beginners guide to creating scripts using the platform. The author was great in explaining every detail and every output. He encourages learners to not copy and paste, but to actually code what he wrote on the site.

ex35_py_and_Python_Script_–_Learning_the_hard_way____AREYES

So whats in it for me? 

We’ll I’ve always been fascinated with automation using scripting languages. I find it “attractive” and “fulfilling” creating different scripts to automate a complex process – and Python is, if not the best, is one of the best there is. It’s so simple and yet so powerful. Extremely easy to learn – allowing developers to be creative with it! Some might not say the same thing, but I’m very excited just thinking about the things I can do with it.

I used it so far:

  1. Automated our side by side comparison generation.
  2. Automate my local application deployment.
  3. Web scrapping and putting them on a database (cannot give details on this one though).
  4. Simple Registration process using DJango

If you’re going to start it though, make sure you either have Notepad++ (if you’re on windows) or TextWrangler/Sublime Text (in Mac). Open up your terminals (Mac comes with python 2 – as of this writing). Something like this:

learnpythehardway_—_sh_—_81×23_and_ex35_py_and_Edit_Post_‹_AREYES_—_WordPress

Some Tips:

  1. Start with a TextEditor – not a IDE that has intellisense in it. There is no fun with that. If you need documentation, use the pydocs!
  2. Pydocs <object> – Extremely Helpful!
  3. Python Editor Plugin for Sublime Text.
  4. Get Projects! Don’t just practice – do real stuff and contribute!

Join me in improving this comparison tool! https://github.com/alvinjayreyes/svnDiffToHtml

 

Happy Coding!

Python-ing


Over the last couple of weeks, I’ve tried learning Python. It’s not as far from Java as someone would say, I’d actually call it one of the closest to the language. 🙂 I learned the language for one primary reason, I want to automate a process. I have the logical design, process flow, but I don’t want to use my comfort level language which is Java cause… we’ll it’s to comfy.

1st off, when and where to learn. A great deal of tutorials are all over the web! There’s no excuse for not learning it, even the advance stuff. It’s all about using your creativity to use the language.  

http://www.learnpython.org/

2nd, the tools. I’m using PyDev plugin for Eclipse – so Eclipse IDE plus a a python interpreter.

PyDev_-_PyDevSample1_sample_package_sample_py_-_Eclipse_-__Users_alvinreyes_EclipseProjects_Python

3rd, learn a web framework (optional). Well this is not really required. I tried learning Django and made a simple registration application with it. It’s not as simple as using CakePHP or CI, but it does the job. It has a “bake” like command that generates model that can be used in your application, as well as controller and view level (modules) scaffoldings. Very neat, but not as neat as Cake.

 

I had fun using and trying to achieve something with it, especially when I’m trying to parse through an XML file to get the nodes and its values. I’m trying to create a automated process to deploy our apps in a Weblogic console given an XML formatted or JSON file as a parameter. Simple and Straight forward. I’ll roll it out when the right time comes.