Are you looking for my non-technical blog?

This is now my technical-only blog, my non-technical blog is here.

25 December 2017

Free and Open Source Software is Dead

Originally posted on Medium, but since the Egyptian stupid government blocks Medium, I reposted here.

I open my laptop after I arrive to the office, I start writing Python code in a Jupyter notebook. I query a PostgreSQL database, I use libraries like PandasScikit-learn and Keras. Then when it’s time to productionise the code snippets I have written, I write my code using Atom or VIM and push it to AWS.
Everything in bold is Free and Open Source Software (FOSS), except for AWS. I even checked their licenses. It’s clear, FOSS has won the battle, no more evil Microsoft SQL server, no Visual Basic, nothing of these closed source softwares anymore, yay!
Then I leave the office, I listen to music on Spotify on my way back home, I watch movies on Netflix. The photos I take on the weekend, I edit and share them on Instagram. I chat with family and friends on Whatsapp and I do almost all of these on my phone and tablet, whose operating systems and iOS and Android.
Everything in bold is not Free nor Open Source Software, even Android, some say it is open source, but definitely it is not a free software.
Most of the open source software advocates I know are content with the first paragraph, and cannot see beyond it. They think open source software has won the war, but I believe it actually won few battles but lost the war, at least for now, and here is why:

Sorry, the location of the battlefield has been changed!

Nothing is stopping anyone from creating a FOSS video/music player, photo editor or chat application. Actually, there are already plenty of these created 20 years ago and were being massively used. These softwares still exist, the only difference is that they missed two major shifts; the cloud and the hardware/software coupling.
Thanks to the cloud, music and video players are not inseparable from their music and videos content. An open source music player is useless if you do not have music to play, same for a free video player. Thus, Netflix and Spotify will continue to prevail.
One can argue; what about bitTorrent, Popcorn Time, etc? These are examples of a software with reasonably easy to access to content. Yet, almost no body uses them nowadays. Here comes another gatekeeper, the hardware/software coupling. A combination of copyright laws, and Google/Apple’s control on mobile operating systems, makes it easy for Apple, for example, to not allow you to install any of these softwares on your phone or tablet. Who still uses laptops anyway! Even if I find a way to jailbreak my phone and install Popcorn Time on it, I would less likely succeed doing the same for my Apple TV or Alexa. Service providers would also collaborate in blocking those softwares for the sake of copyright protection.
A hardware manufacturer, whether that hardware is a mobile phone, smart speaker, smart watch, smart TV or smart anything, do couple his own hardware and software nowadays. While most FOSS advocates are still busy fighting the evil Microsoft Windows, they are not aware that both of them and Microsoft have already missed the new battlefield’s location.

FOSS is for businesses not consumers now!

It’s clear from the examples I’ve just mentioned earlier, that though businesses use FOSS, in a consumer’s everyday life all the softwares they use are closed source ones.
Unlike individuals, business can hire people (devops) to build their own cloud, and maintain it for them. Yet, the fact that most of the softwares businesses use are free doesn’t mean that this will be the case in the future too. Check my first paragraph again. If everything I run, runs on AWS. Actually, I do not recall running a single line of code on my own laptop for weeks, I run it all in the cloud. Which means, if tomorrow, Python and all the libraries I use became closed source softwares, I wouldn’t notice a difference as long as the cloud provider my business uses will still provide them as part of its package.

We need RMS who understands the cloud and the blockchain.

Back in the 80’s and 90’s when the likes of Richard Stallman (RMS), Eric. Raymond (ESR) and Linus Torvalds worked on their Free and Open Source Software ideas (check the difference between Free and Open Source Software here), they understood both the operating systems at that time and the legal frameworks softwares were created in.
It’s perfectly fine to admit that Free and Open Source Software ideas are dead, since the compute environments and legal frameworks they were created in are also gone. What matters now is that new advocates who understand the cloud economy, the legal frameworks of today, and maybe technologies like the blockchain and smart contracts, and come up with fresh and modern alternative to FOSS.

23 June 2014

Python's Getters and Setters

You can read a better formatted version of this post here.

Just learn a new python feature called @property. Let's say we create a class called Circle as follows.

class Square:
    side = 2
    area = side * side
s = Square()

Now:
>>> s.side
2
>>> s.area
4

However:
>>> s.side = 3
>>> s.side
3
>>> s.area
4

Not cool! How to solve that?

class Square:
    side = 2
    @property
    def area(self)
        return self.side * self.side
s = Square()

See now.

>>> s.side = 3
>>> s.side
3
>>> s.area
9

09 February 2014

Introduction to Data Science

The AskDeveloper group organized this hangout about Data Mining, and Machine Learning in particular. The video is in Arabic, yet the slides are in English.


،شوية دردشة عن تنقيب وتحليل البيانات والتعلم الآلي، الفيديو بالعربي

إضغط على الصورة لمشاهدة تسجيل الحلقة

10 January 2014

Github Traffic Analysis

Github now shows traffic analysis to those who visit the repositories there.


The new traffic analysis page shows the top referring websites and the top visited files in the repo as well as a time-series chart for the visits and bounce rate.

17 December 2013

We Preach by Spamming

Once upon a time, I stumbled upon an online Quran application, back then I was studying human-computer interaction as a part of my MSc. degree, so I commented on twitter that most of the online Quran readers need to reconsider their design from a usability point of view.

Since then, and I receive dozens of spam tweets each day. They come from different people, yet they all contain the exact same message.


My only interpretation for this is that Quran.ksu.edu.sa has an application that those pople trust and it uses their accounts to send those spammy messages to me.


I sent multiple spam reports to twitter, yet they don't even respond. Isn't it strange that some applications think that it is ok to abuse the trust of their users and spam someone in order to grab his attention to give them feedback about their application!? Isn't it disappointing that twitter don't give a shit to my daily spam reports!?

30 September 2013

A Quick Intro. to NumPy

For me, NumPy is a Python list on steroids. You can use it to create multidimensional arrays and matrices.

The convention is to import it as follows:

import numpy as np

To create an array of numbers between 0 and 9, you could use the following command:

x = range(9)

To convert that list into a NumPy array, you can write:

x = np.array(range(9))

And to make you life easier, there is a shorthand for the above command:

x = np.arange(9)

So far, we have been creating one dimensional array. However, there are ways to reshape the arrays. The reshape() method when applied on an array, it returns a reshaped version of it without changing the original object. To reshape the original object itself, then use resize() instead.

y = x.reshape(2,5)

The above command create a 2-dimensional array of 2 rows and 5 columns. You can create a much dimensional arrays as you want. See the command below for a 3*4*5 array.

y = np.arange(3*4*5).reshape(3,4,5)

The mathematical operations '+', '-', '/' and '*' are applied elementwise.

x = np.arange(10)

# To multiply each element of x by 10
y = x + 10

# To multiply each element of x by itself
y = x + x

To do a Matrix Multiplication though:

# Create a 3 * 5 Matrix
A = np.arange(15).reshape(3,5)

# Create a 5 * 2 Matrix
B = np.arange(10).reshape(5,2)

# Dot product gives you a 3 * 2 Matrix
y = y = np.dot(A, B)

Just like lists, you can get parts of arrays

For original lists:

A = range(10)
A[2:5] # [2, 3, 4]

For NumPy Arrays

B =  arange(10)
B[2:5] # array([2, 3, 4])

However, you can set some elements of the array as follows

B[2:5] = 1337

But, you cannot do the same to lists.

A[2:5] = 1337 # TypeError: can only assign an iterable

For statisticians, there are also the following functions

x = np.arange(5) + 1
x.mean() # 3.0
x.max() # 5
x.min() # 1
x.std() # 1.414

You can also access elements of the array using start, stop and a step:

x = np.arange(10)
x[2:7:2] # array([2, 4, 6])

Or access specific elements, let's say elements 1, 5 and 6

x[[1,5,6]] # array([1, 5, 6])

Similar to reshape() and resize(), ravel() converts a multidimensional array into a one-dimensional array, while transpose() turns rows into columns and vice versa.

If you program in R, you will not miss their way of accessing elements of array that meet a certain condition.

x = np.arange(10)
x[x>4] # array([5, 6, 7, 8, 9])
x[x%2 == 1] # array([1, 3, 5, 7, 9])

If you are having an array of elements that are either True or False.

x = np.array([True, False, True, True])

x.all() # Only True if all elements are True
x.any() # Only True if any elements are True

Finally, there is a repeat() that repeats each element of the array n times

x = np.array([1, 2])
x.repeat(3) # array([1, 1, 1, 2, 2, 2])

That's all folks for today.
Check the following tutorial for more information.






26 September 2013

Middle East Relationships Infographics

The Radio Free Europe - Radio Libre (RFE/RL) published an infographic summarizing the political relationships between the Middle Eastern countries. The graph comes after a similar one that was made by the Egyptian blogger, The Big Pharaoh (@TheBigPharaoh), and was published in the Washington Post.

I'd like to discuss the two infographics from a design point of view here. So, let me start with the one made by RFE/RL.


The main point of the graph is to show the relationships between those countries, i.e. friends and foes. However, as you can see, it is not possible to tell this from the first look. All dots are the same, black dots of the same size. Well, may be they are inviting us to interact with those dots by clicking on them.


So, there are messages hidden behind the dots, but this is just text. Hmmm, couldn't those same messages be written in an article then, or in a table? What is the use of the graph then?

Why is it that the United Stated is there on one axis but not the other. Same for Iraq. Also relationships are supposed to be symmetrical, yet the chart isn't. You can track the lines between Iran and Israel, but there are no lines between Israel and Iran. I know, this is a sort of redundancy, however, it is either the graph is to be redesigned, otherwise, this way is confusing.

Here comes The Big Pharaoh's graph then.


This times relations are supposed to be clearer from the first look. Different line colours reflect different relationships. In this graph countries are represented by points while the relationships between them are represented by lines. While on the RFE/RF's graph, it was the other way round. Entities are placed in the form of a matrix where dots represents the relationships between them and the countries are represented by the horizontal and vertical lines.

In Jacques Bertin's paper, The Matrix Theory of Graphics, he explained that the network representation (e.g. The Big Pharaoh's graph) is more useful in representing the topographical structure of the elements and how each pair of them are connected on a micro level. While the matrix representation on the other hand is more flexible in reordering the element in order to show how the relationships between elements on a macro level. You can cluster your elements first to show groups of allies and foes. Changing the dots colours or sizes gives you a third dimension to move in. As you can see in the network graph above, lines are cluttered and a bit hard to follow.

Can you sketch a better representation of those relationships then?

28 May 2013

Git Forking

After our previous guide to github, now, let's say you want to contribute to a project already existing on github, how to do that?

First thing first, you go to the projects repository and fork it using the button shown in the figure below.


After that, you will be redirected to the page of the forked repository. You will also be given a URL for the forked repository as shown in the figure below.


Now, you create a new director, go there and type the following commands:

$ git init

$ git remote add origin [the URL show above]

$ git pull -u origin master


And, that's it!

19 May 2013

Nike+ first time user's experience

I really want to know if those people behind Nike+ running app on iPhone have ever heard of something called HCI/UX or not!?

Nike+ running app

Today I was using their app for the first time, and it asked me to login, giving me two options for that: A normal login with email and password or to login via Facebook. Despite the fact that I hate apps that contaminate my Facebook timeline with their updates once I sign in with Facebook, I chose the Facebook option as I struggle with remembering passwords for the endless apps one use everyday.

Signing with Facebook is meant to save us the effort of entering passwords for each application, right? Well, seems that Nike+ app doesn't agree with that. After signing with Facebook they asked me again to enter my birthdate, gender, and all those information they can simply grab from my Facebook account, and guess what, they asked me to create a new password too. What the eff!!? They didn't stop here, they even gave me a list of 5 criterion I have to adhere to when choosing my password. Choosing a weak password is my own problem, not theirs. They shouldn't tell me how my password should look like. Additionally, come on, I can choose a password that doesn't meet their password policy yet still stronger than the ones meeting it. So, again, I am the only one who have to decide how my password should look like here.

13 April 2013

True or False: Egypt's First Locally Produced Tablet

You might have read the news that the state-owned electronics firm Katron, has produced Egypt's first locally produced smart tablet, under the trademark 'Inar.' However, the debate now is whether the correct term is 'produced' or 'assembled'. There are two camps arguing now. On the one hand, there are those who find it a huge achievement and attacking local media for not shedding the light on such great news. While on the other hand, there are those who argue that it is just assembled from imported components, and it can hardly be called "an achievement". That's why I decided here to give my humble opinion about the issue.

Inar, assembled in Egypt

First of all, let's agree that we are not living in the Industrial Age anymore. We now live in the age of outsourcing and digital disruption. What I mean by this, is that the argument of technical components not made here is not really a valid argument. Apple, Samsung, Dell, Cisco, etc. do not make every single component of their products. Let's not forget that Apple use components made by its competitor Samsung. They may decide to produce a chipset or two, they may rely on home-made Operating System, but they also may decide to just rely software and hardware components made by others. In other words, we are in fact asking the wrong question here. What really matters is the following:

If the Egyptian company succeeded in producing a competitive product that it can use to go to the market and compete against other vendors, then I call this an achievement, even if none of the products' components is locally made. Whereas, on the other hand, if it is 100% locally-made, yet its producers cannot convince anyone to buy it, then I can hardly call this an achievement. The asian  electronics firms are open market to everyone. Any company can go to that market and get off-the shelf components, whether they are processors, LCD screens or any other components. Android, Windows and Linux are also available for any manufacturer to use them if they want to. In such market, where you and your competitors have access to almost the same resources, your competitive advantages can come from your low price, better design, more advanced features, or even brand name. That's why, the question now, whether 'Inar' is an appealing products to tablet customers, from price or features or whatsoever point of view, or it is just assembled for the sake of assembling a local tablet in Egypt? If it is the formet, then let's hurray the Egyptian achievement, if now, let's question the government's unwise spending, since Katron is a state-owned firm.

P.S. The first known tablet user in history was in Egypt, by the way. Hint, hint, Moses! ^_^