0v1.ro

(zero V unu)

MongoDB more indexes on Secondaries

I’ve been wondering for a time if it works, the documentation is not really clear if you can have different indexes on a replicaset secondary, maybe delayed or with priority 0. Using this feature you can do reports better on a … Read more »

Job offer

I have this LinkedIn account for a while now.. I have around 2^7 connections and lots of Job Offers come in daily, but today I got the best since now! Here you have it: So I replied in plain English, … Read more »

Compare strings in PHP

Just read a comment in the PHP documentation and had another PHP madness moment. It seems you have to be really, really careful when comparing strings that include numbers…   Command \ PHP Version 7.0.0 – 7.1.3 5.4.4 – 5.6.30 … Read more »

PHP switch case after default works normally

When you put the a case block after the default block the switch will work normally and fallback to the default only after testing all cases. The documentation doesn’t specify this directly, but there is a note with an example. … Read more »

How Tor works

Great photos explaining what is disclosed at each point when doing a request on the web, with or without Tor or HTTPS. The photo is provided by the EFF https://www.eff.org/pages/tor-and-https

Strings array access issue

What would you expect for this script to output?

Maybe a notice? maybe some false there.. But if you have in mind PHP logic.. you surely know.. So, $text is a string and string characters can be accessed with … Read more »

Foreach with reference

If you iterate over an array with & you should unset the value variable after to not modify the array accidentally after.

Should do like this

PHP echo print question

Working with echo or print is very easy in PHP. At the begining it might be harder to understand concatenations or operations order, but after you master them is really easy. But there are some cases where you wonder how … Read more »

Line history on Git

# file path export FILE=file/path # line number export LINE=10 git log –format=format:%H $FILE | xargs -L 1 git blame $FILE -L $LINE,$LINE | uniq -c

Regex

Documentation Cheatsheet: Dave Child, Dzone, RegexOne Tools: (Online) RegExr, Regex101, RagexPal, RegexPlanet, (Offline) Rad Software (free) or RegexBuddy (paid)