Behind Closed Doors

Johanna Rothman and Esther Derby; The Pragmatic Bookshelf

Behind Closed Doors

Written by Johanna Rothman and Esther Derby
Published by The Pragmatic Bookshelf

Management is a goal many people set for themselves.  For some it’s a skill set that comes naturally.  For other’s though it takes a lot of work.  Regardless of which camp you happen to sit in, this book will help you become a more approachable and proficient people’s person (otherwise known as a manager).

I’ve read a couple management books over the years.  And most come in a very dry and boring setting.  They approach teaching management as if it’s a science.  It’s not, and it shouldn’t be written about in such a way.  Johanna Rothman and Esther Derby have hit the nail on the head with Behind Closed Doors.  The book takes a very relaxed tone and has a story that underlines the first three quarters of the book (the remaining quarter is an indepth take on the various concepts and practices discussed through the book).  As you’re reading about Sam, the company’s new manager, you’re taken away from the story and given critical information about various management practices and techniques.  It’s the perfect integration of fiction and nonfiction.  The story acts as a role play of the concepts being discussed.  Yet it’s done in a way engaging enough that you want to read on, even if it’s only to see what happens next.

Read more

Quick Fix: Banned by cPHulkd (cPanel/WHM)

Ever been banned by cPanel’s cPHulkd?  Well, as of today I can officially say I have been.  On a server I was supposed to be administering no less!  This is what I get for agreeing to help a friend who uses cPanel.  I hate it and feel it’s a waste of resources.  But, to each their own.  Here’s how to quickly fix the issue:

  1. SSH into the server and log into your root account.
  2. Execute the following:
    /usr/local/cpanel/etc/init/stopcphulkd
  3. Log into WHM, still as root.
  4. Go to “Security Center” > “cPHulk Brute Force Protection”
  5. You’ll see some text saying “clear failed logins” with a button next to it labeled “Flush DB”.
  6. Hit that.
  7. Switch back to SSH and execute the following to start cPHulk:
    /usr/local/cpanel/etc/init/startcphulkd

While you have cPHulk’s configuration open I would strongly encourage y ou to whitelist your IP.  Switch to the “White/Black List Management” tab and enter your IP into the white list.  You won’t ban yourself from cPanel/WHM any longer.

The Reality of Offshore Hosting

I am hosting illegal content, I should host it offshore!

I see this line of crap all of the time. People looking for offshore hosting and almost always for the wrong reasons. It’s the intention of this little… essay, I guess we’ll call it, to debunk many of the myths and fallacies regarding offshore hosting. It’s my hope that people will come to understand that what they’re doing is largely ineffective. And by coming to understand that, they will be able to make a better informed decision.

If, after reading this, you decide you still want to go with offshore hosting then so be it. I cannot, and will not, go out of my way to stop that from happening. But at least make sure it’s an educated decision. Ignorance may be bliss, but only until you receive a hard awakening. Hopefully I can stop that from happening to you.

Read more

Google Code Git Authentication on Windows

I’m not typically a Windows user; I especially dislike having to do my development on Windows.  But there are times I just can’t avoid it.  And today was one of those days.  I set up Msysgit and created a new project on Google Code, using Git as the version control choice.  Then I ran into a brick wall for a little while.  What should have been stupidly simple on my Linux box (through the use of a .netrc file) turned out to be a pain on Windows: authenticating with Google Code to push my local repo.

Msysgit (and even TortoiseGit, I tried that too) refused to ask me for my password.  So every attempt I made resulted in an authentication error.  It would tell me I should try using my Google Code generated password.  Well no shit.

Anyways, I failed to find an answer on Google that worked.  But I inevitably fixed the problem on my own.  Here’s how:

Enter the .git directory within your local repo (will be hidden).  Open up the config file in your text editor of choice.  Under the [remote "origin"] section you’ll see a field for url.  This URL should be in the format of:

https://google-username@code.google.com/p/project-name/

What you need to do is append the password to your Google username with a leading colon.

https://google-username:google-password@code.google.com/p/project-name/

You’ll then be able to authenticate as required.  Stupidly simple fix for an equally stupid problem.

Random Terminology: Atomicity

Today’s random terminology is: atomicity.  This term is used specifically within the database design realm.  Other ways of referring to atomicity are: atomic (adjective) and atomic transaction (noun).

An atomic transaction is an update transaction within a database that will either complete fully or have no effect at all.  Atomicity is the guarantee that all update processes within a database will follow that rule: complete or nothing.  It’s similar to the sayings: all or nothing and go big or go home.  An atomic transaction is either done correctly or it doesn’t occur.

This may be a little awkward to picture without an example.  Let’s say we’re in charge of designing and administering the MLB’s databases.  When it comes to individual players there are a wide variety of table but specifically we’re looking at the salary table and the roster table.  Within the salary table is a listing of every player ID and the salary they’re earning.  Within the roster table is a listing of every player ID with the team ID they belong to.  Simple enough.

What happens when a player changes teams?  Well you’d update the roster table.  But a team change could come with a salary change (99 out of a 100 times it will).  We don’t want to update the player’s team but keep their old salary.  Both actions must occur or the update process has failed and we need to reexamine it.  As such, an atomic transaction in this case would be one where both tables are updated successfully.  For this situation to follow the rules of atomicity, that transaction must fail if one table cannot be updated.

I’ll go into this more within another article, but atomicity is actually one of four properties that must be present to ensure reliability within a database system.  These properties are known as ACID (atomicity, consistency, isolation and durability).

Let’s Talk MongoDB

Every developer and their little sister has worked with an RDBMS (relational database management system).  The classic example of one is MySQL.  If you’re a PHP developer then you’ve probably been brought up with MySQL all along.  MySQL, PostgreSQL, SQLite, MS SQL Server, Oracle and many others I won’t waste time naming all share one very common trait: they are relational databases.  This isn’t just some fancy term to make them sound more important than they really are.  Rather, relational is the model that shapes how an RDBMS stores information.  The relational model is one riddled with mathematical proofs and theories.  And it works out very well for most problems.  What many developers never come to appreciate is that the relational model is just one of a number of different database storage models.

I won’t go into the depths of the relational model here; maybe another time.  But if you’ve worked with MySQL you already know the basics of it.  You have a database which contains tables.  Within those tables are rows and columns comprised of tuples.  You insert data, retrieve it, delete it, modify it, etc.  Well what I am about to introduce you to is another database solution that uses an entirely different model: the document-orientated model.  This model is a great avenue into branching out of the relational model.  The two share many similarities while introducing you to a NoSQL alternative.  So let’s talk MongoDB!

Who’s this guide for?  This guide is written with the developer who has a basic familiarity with a relational database (whether it’s MySQL or another) in mind.  When I discuss the document-orientated database model I will be comparing it to the relational model in an abstract sense.  As such, it’ll be helpful if you have a basic understanding of what a relational database looks like.  If you’ve worked with MySQL and can picture a table in your mind, then you’re all set.  If not, then the comparisons in this guide may not be helpful for you.  But you should still be able to follow along.

How are examples given?  I am going to try and present examples in three different mediums.  The Mongo command line interface (which uses JavaScript), PHP and Ruby.  My goal is for every example to be demonstrated in all three mediums.

Note: Throughout this guide I may mention MySQL in a comparison.  When I do that, I actually mean any relational database solution.

Read more

SQL and Relational Theory, 2nd Edition

C.J. Date and O'Reilly Media

SQL and Relational Theory by C.J. Date

SQL and Relational Theory

Written by C.J. Date – Published by O’Reilly Media

Christopher J. Date (C.J.) has been involved in SQL and the relational model since its inception.  His expertise on SQL and relational databases is made excruciatingly clear throughout this book.  This book might as well be considered a must read by anybody with a firm interest in the theory behind relational databases and how to apply it in real world situations through SQL.

This book is not your normal introduction into SQL.  It’s not specific to any one relational database management system.  In fact, you won’t find the word “MySQL” or “PostgreSQL” anywhere throughout this book.  Rather, this is a fast-paced and very in-depth overview of the SQL language and why/how it works.  If you’re looking for a quick and easy introduction into MySQL then look elsewhere.  If you already have a firm understanding of SQL and want to improve upon it: this book may be for you.  If you’re interested in learning more about the relational model and how to better write SQL queries against it: this book is for you.

Read more

Random Terminology: Predicate

Computer science terminology can be confusing, complicated and vast.  It’s deep rooted in mathematics and theory.  But understanding the terminology is just as important as it is annoying.  So today’s random terminology will be a common one: predicate.

According to the dictionary, predicate is defined as:

1. to proclaim; declare; affirm; assert

2. Logic: to affirm or assert something of the subject of a proposition

Both are accurate to how we use the term predicate in computer science.  Simply put, a predicate is a function that returns a boolean value (true or false).  This term comes from the mathematical definition of a predicate that is: a function returning a boolean value (F: X -> {true, false}).

If you’re a software engineer then you’ll hear the term predicate used in reference to a function/method that returns true or false (boolean).  A Ruby example of a predicate:

def greaterThanZero?(n)
  n > 0
end

# Returns true
greaterThanZero? 1

An Introduction to PDO

(Note: The following introduction to PDO was written by me a number of years ago.  The information is still however pertinent, hence putting it here.)

PDO: A Better Way to Work With Data

PDO (PHP Data Objects) is a powerful, yet lightweight, abstraction layer within PHP that allows you to work with a database without caring what system it actually happens to be. In short, through PDO you can write database-driven code that is entirely independent of the underlying server specifics. Through PDO you can work with MySQL, SQLite, PostgreSQL, MS SQL, Oracle, and a few others without having to write separate code for each software. In fact, the only line of software-specific code is the initial initialization of the PDO object. Sounds pretty damn useful already doesn’t it?The obvious advantage behind this is portability. Write once, use anywhere- a very useful concept, don’t you agree? This is achieved through one very powerful keyword in programming: abstraction. That is: the act of writing code at the most appropriate level possible. Think of programming layers as a pyramid. The further towards the base of the pyramid you go the more hard-written and specific the code is. Each layer above it gets a little more generic and forgiving. As such it gets more portable and maintainable. I cannot stress to programmers enough just how vital abstracting your code is.Anyways, enough on the abstraction lecture. How about we take a look at some PDO!

Read more

Networking Engineer vs. Software Engineer

This topic came up recently at a forum a frequent.  And I took the time to write out a fairly long winded response to a question that realistically has no definitive answer.  And that question was (I’m going to paraphrase):

What career will generate a higher salary: network engineering or software engineering?

I notice these questions frequently and each time I write up a post that more or less boils down to the same thing: there are too many variables that will determine your salary; comparing two fields or just coming up with an average salary for a single field is far from an easy task (or even possible in all reality).  Regardless, I’ll copy-paste my response to that thread here for future reference.

Read more