Tag: Python

Quick PHP Pivot

So I have this quick web service idea that keeps calling my name. I’m sure you know what I’m talking about. It’s that type of idea that keeps you up at night. The idea that makes you call in sick from work so you can work on it. That can’t stop won’t stop idea that for some reason just won’t get out of your head.

Well I have one of those ideas and I’ve decided to make a quick pivot to work on it. So by doing so I’m forced to put the Python scripting on the back burner this week. Not all the way to the back, I did happen to work on a few things that I’m giddy about which I will share with you all in my next weeks update. Which may be my last week that I focus solely on my “Learning Python in a month” challenge, haven’t fully decided yet.

I set out to spend a month with Python and I did it. I’m actually proud of myself. I wouldn’t consider myself well versed yet but I think I at least know the basics. I’m sure if  I stick with it for another six month I will somewhere around the  Sr. n00b ranks by then.

But again this has not yet been decided. What I’m considering for next month challenge is either Ruby on Rails or  IOS Programming, I have always wanted to learn how to make IPhone/IPad apps. But from what I’ve read so far this not going to be a easy challenge. I may chicken out and go the Ruby on Rails route who knows. If I take this challenge it will begin on August 1st.

Yea, next months is going to be real interesting.

Learning Python – Week4

If i had to describe this week it would be Information Overload.
This week has been less about actual coding and more about discovery.

I found a few sites and applications that I wanted to share that I thought were great additions to add to your Python learning arsenal

TheNewBoston Youtube channel. This dudes channel is packed with programming tutorials from Ruby to Java to Android. I actually discovered his channel when I was trying to learn more about Android programming. I love his tutorials because he keeps them short and sweet most are under 5 minutes. Videos that go on for more than 10 minutes start to lose my attention. So if you’re one of those people you learn better by watching instead of reading then this is a great channel to cover the basics. I even think you will get a kick out of sense of humor, he’s kind of funny.

Koding.com. I’m not certain how long this site’s been around, I just received my invite last night but so far this site is really, really awesome. It’s a combination between a cloud IDE and social networking platform for programmers, it’s pretty badass. For me a Python n00b, I love that it gives me more time to focus on learning and writing code. I spent way too much time searching for the right IDE (which I still haven’t found).
Another big feature is their community. They have topics on everything web related like CSS3, HTL5 and etc. Topics are beautifully laid out in a dashboard like grid so you can easily follow topics that you’re interested in. I’m following JQuery, mongoDB, PHP and Python if you’re curious.

Bottom line it’s a awesome site and I really think you should try it. But please note it’s currently in beta so from time to time you may experience a few issues but I can say with confidence I think this site will take off in a major way and become the next big thing.

So whether you’re a Python, PHP, or Ruby developer this site is for you.

Oh and in regards to my Python coding. I did do a tiny bit of coding and I mean tiny.
I’ve never written a Python Class before, this is actually my first attempt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python

import cgitb

cgitb.enable()

print "Content-Type: text/html"
print

###################

class PERSON:
def __init__(self):
self.f_name="Joseph"
self.l_name="Tinsley"

def showFullName(self):
return self.f_name +" "+ self.l_name +"<br>"

def add(self,x, y):
total = x+ y
return "The answer is %d" %total +"<br>"


def subtract(self,x, y):
total = x - y
return "The answer is %d" %total+"<br>"


def multiply(self,x, y):
total = x * y
return "The answer is %d" %total +"<br>"


p = PERSON()

print "Hello my name is " + p.showFullName();
print p.add(10,5);
print p.subtract(10,5);
print p.multiply(10,5);

Learning Python – Week3

So I’m 3 weeks into learning Python and overall I feel pretty good about my progress.
But this past week was a bit tricky with the 4th of July weekend and all. So as you can probably imagine how I allowed the festivities to railroaded a few of my plans, but not all of them. I was still able to crank out a few things.

For starters I built this Python Character Counter script for both personal and work use. It’s small and simple so you’re probably thinking “What this about?”. Well at the time I couldn’t think of anything else plus I knew this could be whipped out quickly. But believe it or not something as simple as a web form with a Len() Method will end up being one of the most useful tools I end up using. In my line of work there seem to always be a need for a string or phrase counter. And a tiny script like this surely beats out firing up Microsoft Word each time.

The other part of my week was spent digging through the web trying to figure out how other Python programmers work, what tools they use and what’s considered a normal workflow.

Finding the perfect workflow seems to be the most important thing for me right now. In my opinion if what you’re doing doesn’t feel right, then you’re just limiting your potential.

For example the Python code I’ve been writing was written using VIM text editor and to be honest my VIM knowledge is limited. I can fumble through a few commands but that’s about it. Funny thing, I know some old school hackers who prefer VIM over any other editor and I have to admit these dudes look pretty smart crushing code, but again that’s not me.

So until I run across a suitable FREE IDE to complete my workflow, I’ll be churning along with VIM.

Python Character Counter

Learning Python – Week2

Well it’s my second week with Python and to be totally honest compared to the previous week this week didn’t go so good.

These days work is overlapping into my personal life. I have multiple projects and approaching deadlines that’s interfering with my learnings.

But with the bit of time I was able to carve out I got to say things got a little frustrating.
I thought I was going to be able to find a few free IDE’s like with PHP but that wasn’t the case.
Plus those fancy Python frameworks that I spoke about last week worked fine on localhost but I couldn’t get them up and running on my server.

Grrrrr but if this is part of the learning curve that’s cool I’m sure the info is available somewhere and with time I will catch on, but dang I was searching the web like a mad man trying to figure this out.

So you’re probably wondering, “Soooo Joe, what did you do this week”? Well I found this article about CGI programming on TutorialsPoint.com that was pretty simple and straight forward so I ran with it.
I didn’t have to install anything extra. I had a CGI-BIN ready and available so the Python functions I had previously built could easily be run within this directory.
I even took it a step further. I moved my files outside of the CGI-Bin and inside another directory created a .htaccess file with the following handler.

“Options +ExecCGI
AddHandler cgi-script .py”

My Python script outside of the CGI-Bin was accessible and executed perfectly. I don’t know if this normal or in regards to security is it safe. I’m just happy that this week wasn’t a total bust.

So all in all I have to admit I don’t feel like I kicked butt this past week, if anything I got my butt kicked.
But that’s cool the 4th of July is right around the corner and I plan to use some of the off time to crush out some code. So looking forward to week 3

 

Learning Python – Week1

Well it’s been a full week since I’ve started working with the Python language and I’m proud to say that I’m off to a great start.

I did what I’m sure most of us would do and pushed the textbook a side and jumped right into trying to develop something.
So far I’ve installed and played around with both Django and the Bottle frameworks.
From the few articles and comments I’ve come across I believe the Django framework maybe the industry standard amongst the Python development community.

But in my opinion if your looking for a Python framework with a smaller learning curve Bottle would be my suggestion. But note I haven’t  tried CherryPy yet but looking at the documentation it seems pretty similar to Bottle.

So in regards to the week 1 goals I set for myself I can with confidence check this one off the list.
My experience with the Python language so far has been a great one. I really like it. I like the fact that the syntax it not hard to understand. And I like that it does enforce a bit of a strict structure.

For example if you want to use a Time function you have to import it first.
I also like that with Python, GUI programming is possible, I just read about this so my knowledge is extremely limited when it comes to this topic. But it’s nice to know this option is available if I ever think about going down this road.

Well my week 2 goal is to build a simple website. Right now I don’t think this will be a problem. If anything it’s trying to carve out the time to do so.

Getting on the Python Train

Well in a effort of trying new things I’ve decided to give Python a run.
I’ve heard nothing but great things about this language and since fine establishments like Google has embraced it I’m sure it will only grow in popularity.
Plus there seems to be a bit of a demand for it in the Atlanta area which is also great news.

python-developer-salary

But I’m sure just like anything else that’s has some kind of importance it’s not going to be something that’s picked up over night.
So to get the ball rolling I just purchased “Python for Kids: A Playful Introduction to Programming” from Amazon.
This may seems like a crazy book to use as a launching point to learn a new language but my logic behind going this route was “heck if it was written well enough for a kid to understand, then I shouldn’t have any problems”

I set up a few weekly mid-stone to help push my self in the right direction.

  • Week 1  – Get Python installed and up and running. This includes busting out the traditional “Hello World”
  • Week 2  – Build a simple website using Python
  • Week 3  – Maybe connect to a database, but heck this may be pushing a bit.

If I can knock down at least the first two goals that would be awesome.

But overall there’s no rush here, I’m just trying to accomplish something new.

Python here I come!

 

Copyright © 2024 Joseph Tinsley

Theme by Anders NorenUp ↑