What the hell? Openshift!!

Ladna's Blog

Neglecting all I’ve been taught on TDD, I set out to do a demo app. Why, yes, I decided to host on a Paas, afterall, this kid is excited about it.

deployed_to_a_paas

Don’t tell me heroku, that’s so cliche, although if it makes you feel better, I also hosted same app on heroku.

That said, openshift seemed a good bet. It offers persistent file uploads (not forcing me to use AWS S3) at a convenience, plus 1GB storage space, and lots more. Sadly, the documentation is poor – compared with heroku, for example. For a while, I was like:

how-does-this-thing-work

I didn’t give up though. Errors upon errors, issues upon issues, just to deploy a simple demo app. Where’s the love, paas??

Screen Shot 2015-06-01 at 21.14.57
Thankfully, the good guys at StackOverflow gave me tips in-between.

Long story short, and to stop annoying you with these memes, I got it running! To save myself (and…

View original post 60 more words

Advertisements

What the hell? Openshift!!

Neglecting all I’ve been taught on TDD, I set out to do a demo app. Why, yes, I decided to host on a Paas, afterall, this kid is excited about it.

deployed_to_a_paas

Don’t tell me heroku, that’s so cliche, although if it makes you feel better, I also hosted same app on heroku.

That said, openshift seemed a good bet. It offers persistent file uploads (not forcing me to use AWS S3) at a convenience, plus 1GB storage space, and lots more. Sadly, the documentation is poor – compared with heroku, for example. For a while, I was like:

how-does-this-thing-work

I didn’t give up though. Errors upon errors, issues upon issues, just to deploy a simple demo app. Where’s the love, paas??

Screen Shot 2015-06-01 at 21.14.57
Thankfully, the good guys at StackOverflow gave me tips in-between.

Long story short, and to stop annoying you with these memes, I got it running! To save myself (and others, hopefully) this same trouble, I will be writing a tutorial on openshift in my category. No doubt, the app we’ll be hosting is a Python app. In the meantime, this is how I’m handling openshift deployments, until I get the hang of it:

For the record, next time, I’ll try to mimimize my problems using:
docker-meme

Images courtesy of Google

Variables in Python

This is the second of a series of Python lessons. The aim of this series is to help provide an avenue for me to record what I know so far about this amazing language.

So what is a variable in Python?

A variable is simply a location in memory.

For people coming from other languages, you might think this simple definition holds true enough in Python. However, in Python, a variable is a pointer to an object (and it’s memory location). Remember that in this language, everything is an object. A string, a number, an expression, a function, another string, another number, and another string again – all unique objects! Understanding this concept is the foundation to understanding Python and it’s OOP model. Let’s examine the code below:

string = "this is a string"

Looking at this, one might think that the string above refers to a location in memory. If that’s the reasoning, then this code below:

string = "this has been edited"

would mean that the string would refer to the same memory location, only this time, it has been reassigned and thus has a different value. This is not the case in Python. Let’s use the built-in id method to verify this.

The id function in Python returns the identity – the memory address – of an object. Loosely, it refers to the location in memory of the said object. Let’s try this:

In [1]:
string = "this is a string"
id(string)
Out[1]:
4520340088
In [2]:
string = "string edited"
id(string)
Out[2]:
4512672544
 I am using the amazing iPython Notebook. You should try it out. I digress.
So, from the demo above, we see that even though the variable string is one and same variable, the id changes when it’s value changes. This is exactly the binding model of Python. It means that python binds variable names to objects, in this case “this is a string”, or “string edited”. Because both values are different, they are two different objects, with different memory locations, even though they are bound to same variable string. What happens is that when the string was reassigned, Python removed the binding of string from “this is a string” to “string edited”, meaning the first (“this is a string”) can exist unbound on it’s own.
To summarize, python binds variable names to objects. It is these bound objects that have a location in memory, not the variable names; the variable names merely point to the particular bound objects.

PYTHON!!!

I’m really excited about this. I’ve recently started learning Python, and I gotta say that I’m hugely impressed with the language. From it’s expressiveness to it’s myriad of packages, this is one tool that can get your job done in no time.

 

python-grandma-meme

 

I’ll try to be releasing about two to three articles weekly. I feel the best way to learn something is to practice….and teach it. I’m practicing using the rubber duck approach of learning.

I hope you’ll find this useful. You can filter all my python articles with the tag ‘python’.

In the meantime, I’m building my personal blog using Flask, a Python web microframework.

Make study more effective, the easy way

Mind Hacks

Decades old research into how memory works should have revolutionised University teaching. It didn’t.

If you’re a student, what I’m about to tell you will let you change how you study so that it is more effective, more enjoyable and easier. If you work at a University, you – like me – should hang your head in shame that we’ve known this for decades but still teach the way we do.

There’s a dangerous idea in education that students are receptacles, and teachers are responsible for providing content that fills them up. This model encourages us to test students by the amount of content they can regurgitate, to focus overly on statements rather than skills in assessment and on syllabuses rather than values in teaching. It also encourages us to believe that we should try and learn things by trying to remember them. Sounds plausible, perhaps, but there’s a problem…

View original post 656 more words

Learn to Surrender

Another amazing bit. Worth the read, as usual

Vincent Egoro

Photo Credit: flickr.com Photo Credit: flickr.com

“As children bring their broken toys with tears for us to mend,

I brought my broken dreams to God, because He was my Friend.

But then, instead of leaving Him in peace to work alone,

I hung around and tried to help with ways that were my own.

At last I snatched them back and cried, “How can You be so slow?”

“My child,” He said, “what could I do? You never did let go.” —UNKNOWN

A lot of us are like this. We go to God in prayers, and “cast our burdens” on Him one minute and the next we are out there handling it on our own. And when things turn out badly as surely as they will, we go back to Him complaining at how He wouldn’t answer our prayers and grant our desires.

There are still some of us who would go to…

View original post 163 more words

Don’t Put Off Living

Vincent Egoro

Many of us believe that we will be happy once we achieve some specific goals that we have set for ourselves. Maybe the goal is getting a promotion at work, getting a new job, getting married, driving a nicer car, and so on. But too often, we discover that even after attaining those goals, we still aren’t happy with our lives. Dale Carnegie once wrote; “one of the most tragic things I know about the human nature is that all of us tend to put off living. We are all dreaming of some magical rose garden over the horizon instead of engaging the roses that are blooming outside our windows today.”

Let us not put off living today, and be like “the child who says ‘Someday when I am a big boy.’ The big boy says ‘Some day when I grow up.’ And then grown up he says ‘Someday when…

View original post 253 more words

Just Be Glad

Intense

Vincent Egoro

The following excerpt is taken from Just Be Glad by Christian D. Larson. Read it, Study it, and make it your lifestyle…

Just be glad, and you always will be glad.

When you are tempted to feel discouraged or disappointed, be glad instead. Know that you can, say that you will, and stand uncompromisingly upon your resolve.

When things are not to your liking, be glad nevertheless, for the glad heart can cause all things to be as we wish them to be. When things do not give you pleasure, proceed instead to create pleasure in your own heart and soul. And you can if you will always be glad.

When things do not please you, resolve to please yourself by being glad, and you can add immeasurably to your happiness in this simple manner. Then you must remember that the fountain of joy within your own soul is infinitely…

View original post 449 more words