CategoryTechnology

All the articles related to Information Technology related fields, including programming snippets, and other things I’m interested in

PHP RFC: Comprehensions

Another interesting RFC recently landed to PHP community. So far the easiest way of explaining comprehensions for me comes from Python world:

Comprehensions are constructs that allow sequences to be built from other sequences.

Here’re some examples from List comprehensions in Python:

def palindromes(strings):
    return [s + s[::-1] for s in strings]

def starting_with(letter, names):
    return [name for name in names if name[0].lower() == letter.lower()]

JavaScript, however, decided to remove its support from standard in favour of filter/arrow/map functions.

The array comprehensions syntax is non-standard and removed starting with Firefox 58. For future-facing usages, consider using Array.prototype.mapArray.prototype.filterarrow functions, and spread syntax.

MDN

Speaking of PHP RFC, that’s what we might get if RFC gets approved:

$gen = [for $list as $x if $x % 2 yield $x*2];

//equivalent to:

$gen = (function() use ($list) {
  foreach ($list as $x) {
    If ($x % 2) {
     yield $x * 2;
    }
  }
})();

Personally, I would vote in favour of this. Maybe, it’s nostalgia about Perl one-liners and how elegant you can solve some basic stuff. I think PHP needs this syntactic sugar, giving people choice of using closure calls and comprehensions.

Disney to compete with Netflix

Disney executives didn’t mention Netflix once during their three-hour-plus investor presentation Thursday, at which the company laid out its plans to build up a suite of subscription streaming services — most notably Disney+, a $7-a-month service bursting with movies and TV shows. Disney+ launches in the US in November and will feature everything from Disney’s recent theatrical offerings, like Captain Marvel, to classic Disney movies like Bambi, and new, original stuff like The Mandalorian, a Star Wars TV-show spinoff.

recode

“First they ignore you, then they laugh at you, then they fight you, then you win”. (c) Gandhi

Rumours: Facebook brings back Messenger to App

FastCompany recently posted some rumours on possible integration of FB Messenger back to Facebook app:

Until 2014, Facebook users were able to send and receive Facebook messages in the primary app. But then Facebook decided to remove the messaging feature from the app and forced users to use the dedicated Facebook Messenger app to send and receive Facebook messages.

Wong speculates that the reversal of this policy is in preparation of Facebook integrating its messaging services across all its apps: Messenger, WhatsApp, and Instagram..

FastCompany

Seems that, a number of people who removed FB app from mobiles, is larger than presented on the media. It’s quiet some time since I removed FB app from my mobile, due to its constant irrelevant notifications. Less than a month ago, I gave Facebook another try. It lasted few days till I deleted it again.

I still occasionally use it through the browser, but not the app:

  • UI/UX got overwhelmed with stuff I don’t use
  • Content level reduced drastically
  • All the data leaks didn’t help bringing the trust to the brand

Most of the valuable content slowly migrated to messengers, some of which belong to Facebook, but yet again, if FB will bring Messenger back to its mobile app, it’d be easier to cross this app out as well, and move to WhatsApp/Telegram alternatives.

SPA reload after deploy

John Resig, founder of jQuery, recently raised a great discussion on how to handle Single Page Application reloading after deployment.

Some of the options included:

  • Pass build version with each Ajax response and reload if mismatched.
  • Send a version hash to a server and force 412 code if versions not matching.
  • Notification on version update to leave refresh up to user to decide.
  • Client version passed in HTTP header to check for updates.
  • Log out all the clients at midnight
  • Turning on the servers only from 9 till 5.

Culture of appreciation in dev communities

Github recently released its annual report – Octoverse 2018. Ben Halpern descried an interesting fact about the use of emojis in in Github issue tracker.

According to Github infographics in the report, “the kindest” development community is Ruby developers. In a sense of support and appreciation for other developers via the use of emojis.

Some might say that this metric won’t say much about the “the kindness” of the community. So you might consider also the age distribution of the developers. As younger generation use emojis more often, I would still consider Ruby programming language as a young one (it’s mid 90s). 

On another hand, showing some basic appreciation to someone’s work would retain these people contributing to the community.

People often forget that most of open-source projects are voluntary. So you have to give some feedback to contributors. 

On the contrary, it wouldn’t mean that the world is all unicorns and rainbows. Scott Gilbertson from Wired magazine published an article about the most “swearing” programming communities back in 2011. 

C++ takes top honours, but just barely. Ruby and JavaScript are neck and neck behind C++. 

Wired magazine

We’ve been trying to adapt culture of appreciation in Qobo, whenever we receive contributions from in the wild. So far, we managed to keep our WTF/minute ration quiet low, and show as much positive feedback as we could.

So, whenever you contribute to any of our projects – don’t forget to buy us the beer. It will definitely boost the approval speed  of your pull requests. 

Indiana Jones GIF - Find & Share on GIPHY