Quotes: Technical Dept

Great article on software development sins from Ionel Cristian and great quote on technical dept:

Management fear risks. Juniors fear getting in intractable situations or just don’t know how to solve it better. Seniors with cozy positions fear embarrassment – it’s already cozy enough and the golden shackles are so shiny. Why risk looking like a fool and give management reasons for downgrade or lose that minuscule 1% salary upgrade.

But you, yes you, you can take it in your own hands. Fight for change or you’ll remain miserable and deal with “legacy” code forever. How to convince management to change and fix the damn debt? Depends on the situation, but it’s mostly a matter of ruthless politics. Make campaigns, invent reasons, gather support.

WordPress 3.9.2: security patch

This release fixes a possible denial of service issue in PHP’s XML processing, reported by Nir Goldshlager of the Salesforce.com Product Security Team. It  was fixed by Michael Adams and Andrew Nacin of the WordPress security team and David Rothstein of the Drupal security team. This is the first time our two projects have coordinated joint security releases.

WHMCS API: heritage of whmcs-ruby gem

Joshua Priddle did a great job back in DotBlock accomplishing Ruby binding for WHMCS API.  Unfortunately, last signs of activity were 3 years ago. It’s a pity, as gem is great, and works like charm, but it became massively outdated, and piled with pull requests no one merged in the master branch for ages.

The code was published by MIT license on 2011, thus whmcs-api gem will be its descendant, which I’ll try to keep updated as much as possible.

For now it’s being tested on Ruby 2.x and WHMCS 5.3.x without any problems. The source code and any issues are better be reported on the Github repo.

 

Punycode domains: why?!

why

Honestly, I couldn’t get the idea of non-latin alphabet used in domain names. Especially when the standards were passed, and Registrars started offering cyrillic, arabic domain names, but web browsers still were preferring to output it as a punycode mess.

A pretty simple cyrillic domain like ‘президент.рф’ (stands for president.rf) becomes ‘xn--d1abbgf6aiiy.xn--p1ai’. Not all the browsers still keep cyrillic domains in the address bars, so you’d see some punycode mess in there.

Ugly indeed, and not really useful, so for fast domain unicode/ascii checking that all of them are properly synced, got this tiny script:

Friday pint talks with fellow inhouse developers

X:- Hey, we’ve recently launched a cool piece of NDA in our proprietary NDA.
Y:- Sounds great. How did you manage to prototype it?
X:- Well, we took some NDA, with NDA, cuz the first one had some problems with caching, and with some NDA, we got this NDA to work!
Y:- Why did you use this NDA, when NDA we use in the company does NDA better, it’s more NDA, NDA and NDA that this!

Open-source helps people socialize! 😉

Ruby Sinatra in less than 999B of code

%w.rack tilt date INT TERM..map{|l|trap(l){$r.stop}rescue require l};$u=Date;$z=($u.new.year + 145).abs;puts "== Almost Sinatra/No Version has taken the stage on #$z for development with backup from Webrick"
$n=Module.new{extend Rack;a,D,S,q=Rack::Builder.new,Object.method(:define_method),/@@ *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m
%w[get post put delete].map{|m|D.(m){|u,&b|a.map(u){run->(e){[200,{"Content-Type"=>"text/html"},[a.instance_eval(&b)]]}}}}
Tilt.mappings.map{|k,v|D.(k){|n,*o|$t||=(h=$u._jisx0301("hash, please");File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v[0].new(*o){n=="#{n}"?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}}
%w[set enable disable configure helpers use register].map{|m|D.(m){|*_,&b|b.try :[]}};END{Rack::Handler.get("webrick").run(a,Port:$z){|s|$r=s}}
%w[params session].map{|m|D.(m){q.send m}};a.use Rack::Session::Cookie;a.use Rack::Lock;D.(:before){|&b|a.use Rack::Config,&b};before{|e|q=Rack::Request.new e;q.params.dup.map{|k,v|params[k.to_sym]=v}}}

That’s a wow! That’s what I call a minimal Web Framework. Full description of the code can be found here.

Future of PHP and HHVM buzz

  • Input Processing and sanitize (GET/POST/COOKIE)
  • Session Management
  • Database Access without surprises
  • Syntactic sugar for callbacks
  • Template processing
  • XML, HTML, JSON processing

These are stuff that PHP should already have in some kind of fast internal c code, but it simply fails to deliver. Frameworks fill the gap. If HHVM provides substantial better alternatives and people use HHVM then Frameworks will use these extensions.
Framework code is already filled with edge case handling for different PHP Versions, adding a case for HHVM isn’t a problem.

(c) source