Tag Archives: wtf

Escape from PHP

I am going to be honest with you. I… hate… this place, this zoo, this prison, this reality—whatever you want to call it, I can’t stand it any longer. It’s the smell, if there is such a thing. I feel saturated by it. I can taste your stink, And every time I do, I fear that I’ve somehow been infected by it; it’s repulsive, isn’t it? I must get out of here. I must get free.

— Agent Smith, The Matix

To be quite honest, even though I am a master PHP programmer, I pretty much despise the language and to an extent the culture around PHP.

“Hyuck, why use an open source framework when we can write our own” – 3 different clients last year said that

“We can’t do unit-testing, it will cost too much to implement.” – Pretty much every client, which is my fault because I didn’t properly sell them on TDD or just unit-testing.

Or hell, this isn’t fair to PHP’s culture, but I’ve lost count of how often MySQL is used like a gigantic dump truck. “Normalization? Fuck that, MySQL can handle it… ‘Can’t ya ol’girl?'” At which point the master MySQL server either catches on fire or gridlocks itself into oblivion.

My client’s hate me

I’ve been using mdb-tools, a open source package for extracting Access MDB files, and entering whole new depths of
conceptual joy. Application two and three were written in ASP by a college student, they were stop gap measures meant to live for a year or so… Fast forward 9 years and my client’s hired me to “fix” this problem among others.

In 2004 I replaced a USAF MS Access program used by my squadron with a PHP5 app, now 2011 I feel like I’ve stepped into a time machine and back in the hell that is MS Access and legacy ASP.

   CREATE TABLE CredentialLog
 (
	LogID			Integer, 
	StudentID			Text (100), 
	Cycle			Text (100), 
	AppTo			Text (100), 
	AppFor			Text (100), 
	DayPhone			Text (100), 
	Letter1			Text (100), 
	Letter2			Text (100), 
	Letter3			Text (100), 
	Letter4			Text (100), 
	Letter5			Text (100), 
	Letter6			Text (100), 
	Letter7			Text (100), 
	Letter8			Text (100), 
	Letter9			Text (100), 
	Letter10			Text (100), 
	Letter11			Text (100), 
	Letter12			Text (100), 
	Letter13			Text (100), 
	Letter14			Text (100), 
	Letter15			Text (100), 
	DateRec1			DATETIME, 
	DateRec2			DATETIME, 
	DateRec3			DATETIME, 
	DateRec4			DATETIME, 
	DateRec5			DATETIME, 
	DateRec6			DATETIME, 
	DateRec7			DATETIME, 
	DateRec8			DATETIME, 
	DateRec9			DATETIME, 
	DateRec10			DATETIME, 
	DateRec11			DATETIME, 
	DateRec12			DATETIME, 
	DateRec13			DATETIME, 
	DateRec14			DATETIME, 
	DateRec15			DATETIME, 
	DateSent1			DATETIME, 
	DateSent2			DATETIME, 
	DateSent3			DATETIME, 
	DateSent4			DATETIME, 
	DateSent5			DATETIME, 
	DateSent6			DATETIME, 
	DateSent7			DATETIME, 
	DateSent8			DATETIME, 
	DateSent9			DATETIME, 
	DateSent10			DATETIME, 
	DateSent11			DATETIME, 
	DateSent12			DATETIME, 
	DateSent13			DATETIME, 
	DateSent14			DATETIME, 
	DateSent15			DATETIME, 
	Initial1			Text (8), 
	Initial2			Text (8), 
	Initial3			Text (8), 
	Initial4			Text (8), 
	Initial5			Text (8), 
	Initial6			Text (8), 
	Initial7			Text (8), 
	Initial8			Text (8), 
	Initial9			Text (8), 
	Initial10			Text (8), 
	Initial11			Text (8), 
	Initial12			Text (8), 
	Initial13			Text (8), 
	Initial14			Text (8), 
	Initial15			Text (8)
);

Semi-critical OpenSSL memory issue shared with Node.js and Twisted Python

I found this ( http://journal.paul.querna.org/articles/2011/04/05/openssl-memory-use/ ) just a tad disturbing. The TLDR is that OpenSSL automatically sets compression on for SSL connections. That’s great if you’re trying to cut down on bandwidth… but not so great when thinking about both Memory and CPU utilization, definitely more so memory in this case.

Fortunately the post author and company created some partial duct tape solutions for anyone suffering under out of memory issues in their infrastructure.

What’s in a title?

With my latest contract, I will be celebrating almost seven years ( 6 continuous years ) as a senior consultant.  I’m comfortable with that title for some very simple reasons:  I started my first business ( onsite tech. support ) when I was 13 then got bought out by a larger firm and became a junior partner at 16.  Then after moving from Florida to Philadelphia ( trust me, official records say Philadelphia is a city but it’s really a state of it’s own ) I started college and multiple companies.  I know the cardinal rule of business, which is to provide less for more but appear to be providing more for less ) regardless of domain.

As a consultant, your technical know how usually plays second fiddle to finding ways for your client’s to be profitable and self-sustaining.  Not to say that you can be technically inept but I’ve worked with a few consultants that were/are.  It doesn’t really matter what the most elegant choice is sometimes if its going to take to long to ensure your client keeps the initiative in their business domain.  That really sucks, but its the truth.

That said, both my clients and my consultancy agencies I’ve worked for have thrown all sorts of crazy titles at me.  Chief engineer, chief sys. admin, architect, senior engineer, lead engineer, software developer, etc.  I’ve been somewhat dumbfounded by the naming choices as the reality doesn’t always match the title.

During the interview for my recent client, when they asked what grade/title I felt I was at I told them I was a competent software engineer with full stack experience.  It would have been quicker to just say “I’m the mother fucking man” but I refuse to do that because all it takes is one little estoric piece of knowledge I don’t know about to blow that card house down.  Somehow we got into a monologue where I explained my opinion on titles:

Apprentice

What’s the difference between a POST & GET based form?   I don’t know how to setup a development workstation.   Of course I know SOAP but why do we have to use all this XML?  Why do I need to use a quicksort when this works? ( emergent bubble sort ).

I don’t know what you’re saying.

Journeymen

Caching is stupid, it gets in the way.  Why should we use that open source framework when we can write our own?  Documentation sucks and we don’t have enough time to implement unit-testing!  Yo dawg, I herd you like patterns so I put a singleton factory in your observer so that I can command pattern inject your dependancies…. uhm no, I’ve got no idea how to fix that bug, let me get back to you in a couple days ( turns out to be an entire week).   But we’re going to need all this extra complexity because I’m bored and figured will need it someday soon.

I don’t know how to implement that and won’t tell you that until I’ve fucked things all to hell.

Craftsmen

I think I can get that done in the needed timeframe.  I hate this language/framework/database but will bear down and get this done while looking for opportunities to make things better.  I refactored feature X to use a factory pattern and will make notes to try and reinforce that change elsewhere.  I’m hesistent to add more complexity here and realize this will be a problem in the future so I’m going to add a quick unit-test to ensure integrity.

Here is how I would implement that, what do you think?

Master

No I won’t/can’t implement that right now until we get the core features down.  Why don’t you like technology X,Y,Z and how can we compromise?  I appreciate your input and will take that into consideration.  Hey boss, check out what minion 12 accomplished, I think he/she/it has a bright future.   It’s unacceptable to modify the system tier framework to resolve your issue, asking the framework mailing list/group for advice/criticism and if they accept it then submit a path.

I will delivery these features in this time frame and if I can’t I will tell you why and a better target date.

Summary

I’ve been writing software since I was 7 or 8, I’ve made a couple million dollars in revenue writing software over a decade or two, and my clients have made several more million using that software.  I’ve worked with people with decades of “experience” but no practical knowledge and inversely people with literally a year or two of experience but are masters at their trade.  I remember working with a Ruby on Rails developer a couple years back who was a goddamn bad ass combat developer knocking out reliable code and pulling epic 90 hours weeks..he learned to program the year prior.  The conclusion is that I think titles are a bit of crap.  Sticking around long enough with a company and you’ll end up being the lead/chief/senior company minion by default.  OR have enough clients you half-assed through and you can claim the title of senior… but neither is an indicator of competence.

Git Push – Remote Rejected solution

Scenario:
You made a git repo on workstation 1, committed your changes, then from workstation 2 made a git init/pull. More changes, more commit… and its time to push all that mess back to workstation 1 ( the original )

$git push workstation1.tld

Counting objects: 32, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (24/24), 13.63 KiB, done.
Total 24 (delta 6), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To rocket.x.TLD.com:~/code/pydbgp
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'rocket.x.lijit.com:~/code/pydbgp'

What the hell?

Stack overflow to the rescue with this Answer at stackoverflow

So basically… on workstation 1 do

Workstation1$git branch BeforeThePushBranch
Workstation1$git checkout BeforeThePushBranch
Workstation2$git push workstation1
Workstation1$git checkout master

Bam, back working again