2012-08-27

OpenShift My Python Django Project

Red Hat's OpenShift platform-as-a-service is easy to set up and start using if you have a Python Django project (I haven't tried the other platforms supported, e.g. Java).  It's just 9 (longish) steps!

The django-example they offer gives a good idea of what the completed Django on OpenShift project should look like, but I thought I'd jot some notes down on how to get there from an existing Django project on Ubuntu Linux.

There are two main parts to this process, (A) OpenShift Tools Set-up, and (B) Set-up Python Django Project for OpenShift.


(A) OpenShift Tools Set-up
 
(0) Go to OpenShift and sign up for an account.

(1) Install the rhc client tool on your local computer.
 There's some instructions provided, but it boils down to running on your command line:

$ sudo apt-get install ruby-full rubygems git-core
$ sudo gem install rhc
$ rhc  #this should now run without errors

(2)  Setup your computer to connect to the OpenShift servers.
This should be easy. Just do on the command line: rhc setup and follow the on-screen instructions.

That should really be all it takes, but note that that will upload your default public encryption key for your computer to OpenShift, namely: ~/.ssh/id_rsa.pub so you should know the password to that key pair or else you won't be able to connect to OpenShift.

If you don't want to use your default key, or some other reason, you can always create a new public/private encryption key pair and upload that (just delete the default one from OpenShift, which you can do through their web interface or on the command line).  I'll describe that next.

2012-08-18

Staying hungry for new achievements

When do you start dropping items from your resume? If you've been working for a few years after graduating from high school, I'd suggest all high school related achievements as well as work and volunteering experiences are from too long ago and needs to be dropped.

In general, I've been told that anything roughly older than three years can be dropped from your resume.  Few care about the honors capstone project you did in university if you've been working in industry for three years.  Why?  Because if you couldn't accomplish anything in the last three years, your super duper honors project might have been a fluke as far as achievements go.  If you're consistently accomplishing valuable achievements, then there's bound to be plenty to talk about from the past three years anyway.

Most of the world are appreciative of one-hit wonders, but wouldn't want to hire one for the long run.

Sadly, this means the shelf life of a Bachelor's Degree (or any degree for that matter) is maybe three to five years. Definitely after five years, it's more of a necessary checkbox to fill than indicative of any real ability. You'll find it hard to get hired without the degree, but you'll probably also find it hard to get hired if that's all you have [1].

2012-08-05

Github HTTPS Read and Write Push URL Broken

It's good to use Git's own protocol to push and pull repositories, but sometimes that's blocked by your company's IT department.  In that case, you may use the HTTPS protocol

To pull, copy the HTTP URL from the Github project page.  It should be in the form of https://github.com/theUserName/theProjectName.git.

Then in your terminal, do a git clone https://github.com/theUserName/theProjectName.git to get the project repository.

After making and committing some changes, you may wish to push the changes to Github again.  Of course, you should do something like git pull origin theDesiredBranchName to ensure you've gotten the latest changes from Github first.  Then you'd do a git push origin theDesiredBranchName.

If it works properly, it should prompt you for your Github username and password.  Or it doesn't work, you run into a problem, and git gives you this error:

error: The requested URL returned error: 403 while accessing https://github.com/theUserName/theProjectName.git/info/refs

fatal: HTTP request failed


Solution? No guarantees, but this worked for me.  In terminal, do:

git remote set-url origin https://YourUserName@github.com/theUserName/Booking.git

Obviously, change "YourUserName" to your Github username.

Then again do git push origin theDesiredBranchName. If it works properly, it should prompt you for only your Github password.

For some reason Github denies HTTPS access sometimes if the username isn't sent along with the project URL.

2012-05-28

CSS Relative Positioning and Collapsing DIV

The HTML/CSS pattern of nesting a floating div element in a div element can cause the problem of collapsing the parent div element, and the child div doesn't position as expected (i.e., relative to the parent div).

Namely, this doesn't work as expected:
<div class="parent" style="margin: auto; width: 50%;">
  <div class="child" style="float: left; left: 1em; top: 1em; width: 50%;">
  Hi!
  </div>
</div>

First problem, the parent div collapses to zero height.  There are two solutions:

1) Apply the overflow: auto style to the parent div, but this can sometimes introduce scroll bars with the nested div moves "outside" the "normal" area of the parent div.

2) Add a "clearing" empty div element.  This is more predictable, I've found, but introduces a semantically meaningless element.  E.g.:
<div class="parent" style="margin: auto; width: 50%;">
  <div class="child" style="float: left; left: 1em; top: 1em; width: 50%;">
   Hi!
  </div>
  <div class="clearing" style="clear: both; height: 1px; overflow: none;">
  </div>
</div>
The extra styles besides clear: both in the clearing div is for compatibility with old Internet Explorer 6 browsers.

Second problem, the child div is floating left, but it doesn't get nudged down and to the right by 1em each way (via setting top and left).  The solution is to set the child to have the CSS style position: relative, namely as this:
<div class="parent" style="margin: auto; width: 50%;">
  <div class="child" style="position: relative; float: left; left: 1em; top: 1em; width: 50%;">
   Hi!
  </div>
  <div class="clearing" style="clear: both; height: 1px; overflow: none;">
  </div>
</div>

It's also possible to set the child div to have position: absolute (and not floated) but it will be placed absolutely relative to the window's upper-left corner.  To make it relative to the parent div, set the parent div to have position: relative as well, as follows:
<div class="parent" style="position: relative; margin: auto; width: 50%;">
  <div class="child" style="position: absolute; left: 1em; top: 1em; width: 50%;">
   Hi!
  </div>
  <div class="clearing" style="clear: both; height: 1px; overflow: none;">
  </div>
</div>

2012-05-21

Facebook IPO

There's so much news on how Facebook's stock dropped like a rock after the IPO on Friday May 18 when the price was defended at about $38 by the underwriters (Morgan Stanley mainly).  It's now at about $34 at the end of Monday.

Let's not forget that prior to Thursday May 17, the IPO price range was announced to be at $28 to $35 [1].  Not only that, but they also increased the size of the IPO by 25%, as I recall.  This is essentially the same as noted by the Washington Post:
"Facebook originally set a price range of $28 to $35 for its IPO, which would have valued the company at $95 billion at the high end. Last Tuesday, though, it increased the price range to $34 to $38 per share, valuing the company at as much as $104 billion.
"Then, responding to extraordinary demand from prospective investors, the company announced on Wednesday that it would add 84 million shares to the offering."

So Morgan Stanley got caught up in their own hyping up of Facebook, ups the size and price of the IPO, and now the price drops back to where they initially priced it (for a smaller number of shares).  That's not the best outcome, but it's not as if it means Facebook will go under.

Now if the price keeps falling, that's another story, but at this point, it seems a lot of people are buying on hype, so it's no surprise that some people are going to have a bad time.

[1] Facebook IPO: The art of pricing the right pop