webmastering

New Composer version constraints

Topic is not 0 day news. First commits adding new version constra­ints were added on decem­ber 2014. I’ll only mention what’s new:

  • when defi­ning logi­cal AND you can use space just like you use comma, so >1.0 <=1.5 is the same as >1.0,<=1.5
  • when defi­ning logi­cal OR you should (must?) use double pipe || instead of single pipe |
  • I’m sure you know tilde opera­tor ~1.5 (which means you’re inte­re­sted in versions >=1.5,<2), new caret opera­tor ^ was intro­du­ced, ^1.2.3 defi­ni­tion means >=1.2.3,<2, so the change is you can more preci­sely define star­ting version; if you would like to define the same constra­int without caret opera­tor you would need to write ~1.2,>=1.2.3, so new opera­tor is more concise
  • the last one, hyphen opera­tor - is inclu­sive set of versions, it’s a kind of myste­rious to me, 1.0 - 2.0 is equiva­lent to >=1.0.0 <2.1 and 1.0.0 - 2.1.0 is equiva­lent to >=1.0.0 <=2.1.0 (take a look at compo­ser doc and then matcher source code)
Inne

Roman Numerals Converter Code Kata summary

Brow­sing thro­ugh GitHub i came across XSolve Code Kata repo­si­tory. Code Kata #1 have two imple­men­ta­tions (PHP, C#) of Roman nume­rals conver­ter. I had some free time and wanted to imple­ment Scala version. The result is on my GitHub.

I added Roman-Arabic conver­sion compa­red to XSolve solu­tion. Project has full test cove­rage, what means every single line of code was execu­ted at least once (love that fancy Travis and Cove­ralls badges).

What is being used:

  • case clas­ses ArabicNum and RomanNum, of course it could be int and string, but hey, Scala has rich typesystem ;-)
  • whole NumConverter class is single­ton object
  • one pattern matching method
  • break() func­tions, which I find funny that Scala doesn’t have imple­men­ted such base things natively
  • FlatSpec from Scala­Test suite (BDD approach)

Be warned, vali­da­tion func­tion is ugly, conta­ins nested IFs and needs refac­to­ring, but as long as it passes tests it’s OK.

Whole code is not very „Scalish”. I consi­der myself as an Advan­ced Begin­ner on Scala accor­ding to Drey­fus Model and I don’t care ;-)

Inne

Śpiechu certyfikowany

Zend Certified Engineer LogoMiło mi poin­for­mo­wać, że uzyska­łem certy­fi­kat Zend Certi­fied PHP Engi­neer 200–550 oparty o PHP 5.5. Ozna­cza to, że moje wpisy dot. PHP mają troszkę więk­szą wagę niż dotych­czas. Pytań wam nie powiem, bo mi nie wolno (a ok. 20 pamię­tam dosyć dokład­nie). Dali papier do podpi­sa­nia, że będą legal actions jak nie posłucham.

W skró­cie o egzaminie:

  • całość w języku angielskim,
  • 70 loso­wych pytań dosyć dobrze zbalan­so­wa­nych, trochę z każdej dziedziny,
  • 90 min. czasu (wg mnie wystar­cza­jąco), zega­rek w prawym górnym rogu,
  • dosta­jesz mazak i kartkę, na której możesz sobie rzeź­bić opera­cje bitowe,
  • możli­wość ozna­cza­nia pytań jako flag for review i powrotu jeśli zosta­nie chwila czasu,
  • nie da się zdać „fuksem”.

Co należy mieć w jednym palcu: