On Local Open Source Products

I was called earlier this week by some technology show inquiring if I’d join a forum discussing the local Open Source Projects, and the reasons why the are rather scarce. I ended up not being able to join that forum, but it did get me thinking, I can’t think of even a handful of products that originated in our region, or even contributions to existing products. Even with the recent startups/innovation boom, I don’t recall seeing any opensource code to speak off.

After spending some time googling around and searching for any serious opensource project i was only able to find a Linux distro (Ojuba) that was developed in our region and seems like even that project was stopped 2 years ago. I also recalled seeing some Egyptian themed redhat based distro but can’t recall its name, I’m sure however it was discontinued. Other than that I wasn’t really able to find any mention worthy Open Source projects to speak off. Still I was able to find several Open Source fonts and even music…so seems the Open Source shortage is limited to code.

In the last 5 years several products emerged, some where complex enough for its code to be open source worthy, kngine for instance with their semantic web based search engine…it faded out of the scene now, but i believe it’d have persisted if he chose to open source it. Same applies to several other projects that may have failed business wise, but would have definitely left an impact if its code was shared with the world. So why aren’t people sharing their code with the world in our region as they do in other places.

There are several approaches to open source code development for instance:

  1. an individuals building such an amazing algorithm then sharing it on github for the world to use.
  2. A Company builds a really interesting product and decides to release its code for developers knowing that they still own it as intellectual property even though the world can see the code you can’t use it to earn money without contacting that company first.
  3. A group of developers collaborate to build a project then share its code to the world.

My thought process led me to question the motivations that lead source code to be shared. I believe in cases of individuals code is shared as a way to gain credit, after all who doesn’t know Linus Torvalds, or Phil Zimmermann, and their contributions. Even though their code is free to use, they still made more fame and subsequently money out of their products than they’d have if they sold it to some corporation. As for corporations, sharing the code serves to allow people to port and improve it, also to go over the code and increase the resilience through a process of global peer review, a really decent example here would be Android OS, open source and with millions of variations out and yet not nearly as many security issues as iOS.

I believe the following reasons are why we don’t see that many open source projects originating in our side of the world:

Lack of Time (individuals): Time being one of the most expensive assets we have (and the only one we can’t replenish) is wasted in traffic, red tape and other smaller fruitless activities, the time left after doing all of this isn’t nearly enough to be donate to open source development. Developing elegant share worthy code takes a lot of effort, not to mention the clarity of mind to sit down and plan something.

Lack of Recognition (Individuals): The local eco-systems doesn’t reward people who’ve been involved in even successful open source projects. Most corporate would dismiss that as irrelevant.

Lack of Resources (for Companies): Managing a project to completion is expensive, sharing the code isn’t nearly as rewarding in our region due to the lax intellectual property laws. Your competitors can just take your code and use it as is without crediting or consulting you. and good luck trying to convince a judge that this was actually your code, I don’t believe they have computer code technical advisers in our judiciary system to being with. Furthermore I’m not really sure you can patent code. Sharing your code wouldn’t result in people porting and improving it while retaining the credit, instead it’d result in creating competition and wasting the resources invested in the product.

Please feel free to share your opinions and your points of view on this topic…

Local Products Data Security Concerns

Last week a mini scandal broke out when Pavel Durov the founder of Vkontakte Russia’s dominant social network fled Russia and made really disturbing statements about the Kremlin trying to coerce him into divulging information about Ukrainian citizens and anti-corruption activists. Already the Russian Government is the majority stockholder of Vkontakte and they are in full control of the company.

Today, Durov announced he has fled Russia, citing security concerns after resisting pressure from the Kremlin to share user information from the Vkontakte network. In his public statements he has said that, in particular, the Kremlin had tried to force him to turn over information about Ukrainian citizens and anti-corruption activists in Russia.

PavelDurovvKontakte

This fits perfectly with a concern I’ve had for a while now about the privacy and security of local products and services. In my opinion privacy laws implementation in our region isn’t sufficient to protect our data from preying eyes, especially if backed by the government. It is quite easy to subpoena the entire database of a social network company for instance, or even require direct live access to the service based on the telecom laws. It gets even more interesting when you think of all the different ways the government can use to coerce “convince” the product founder to divulge the information he has about anonymous users he doesn’t know personally.

The concern here is not about technical security of the product as much as it is about the physical security of the founder and his family. Personally I don’t believe it’d take a lot of effort from the correct authority to extract all the info he has on any of the products users. After all such authorities have really convincing methods.

Another concern would be the political affiliation of the founder, since the product is local, his political affiliation may match or be quite different from yours. There is no guarantee that his access to your data wont be use either way. Again referring to our lax privacy laws implementation. Even if implemented without proper periodical auditing there is no way to be 100% sure no one is snooping on your data.

That is why I choose not to use local apps and services as much as possible. Most offer geo-services (cairo360-bey2ollak-wasalny-circle tie-etc…) and the last thing I want is for some entity to have real time access to my where abouts 24×7. Also their is that inherent risk associated with installing any mobile app on your phone, most request access to your contacts anyway (all android have access to all photos stored on device), just think about where your data may end up migrating to without your knowledge.

Naturally these risks are associated with almost any product you end up installing or using but I feel a lot more comfortable knowing that my data MAY end up getting exposed to some XYZ developer in some obscure country who knows nothing about me and has zero interest on our current local affairs. And knowing that it’d be quite hard to coerce someone that far away.

Sharing an Image from Bitmap in Android

I had a project that required downloading an image from the internet then calling the sharing intent to share that bitmap, I went through countless entries until I reached the conclusion that it is impossible to share an image directly from a bitmap object, the bitmap must be saved first and then you can share it and if you dont want to keep a copy on disk you have to explicitly delete it.

Here are how I ended up doing it.

1. Save BitMap

String file_path = Environment.getExternalStorageDirectory().getAbsolutePath() +
"/ProjectName";
File dir = new File(file_path);
if(!dir.exists())
dir.mkdirs();
File file = new File(dir, name);
FileOutputStream fOut;
try {
fOut = new FileOutputStream(file);
abmp.compress(Bitmap.CompressFormat.PNG, 85, fOut);
fOut.flush();
fOut.close();
} catch (Exception e) {
e.printStackTrace();
}

2. Share URI from file

Uri uri = Uri.fromFile(file);
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType("image/*");

intent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "");

intent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(Intent.createChooser(intent, "Share Cover Image"));

 

If you can come up with a hack to share directly from BitMap please do share, but I dont believe it is possible.

 

Fault Tolerant Process Design Patterns

Designing a fault tolerant system in a loosely coupled system based on async calls can be quite challenging, usually certain trade offs must be made between resilience and performance. The usual challenge faced while designing such a system is missed/unprocessed calls resulting in data drift, that exponentially increase overtime turning the system unusable.

Use Case:

GSM customer swapping his SIM card.

async SIM swap

async SIM swap

  1. SIM migration order created.
  2. Order processing starts, and SIM swap call is sent to network elements.
  3. Customer’s SIM is swapped but response from network elements is missed/not sent.
  4. CRM order is cancelled by customer care.
  5. Customer now has two different SIMs associated with his account, the one he is using listed in Network, and his old SIM card on CRM.
  6. All subsequent orders will fail since the customer’s service account is inconsistent through the BSS stack.

One way to prevent such an issue from happening all together is to lock the customer for editing until the SIM swap request is completed from network, and if a failure happens during SIM swap the customer remains locked until resolved manually, this approach is called Fault Avoidance, and its quite costly performance wise, also it provides a really poor customer experience.

Fault Tolerance on the other hand allows for such incidents to take place but the system prevents failure from happening. In my opinion the best pattern to handle faults in loosely coupled systems is check-pointing.

Checkpointing is a technique in which the system periodically checks for faults or inconsistencies and attempts to recover from them, thus preventing a failure from happening.

Check-pointing pattern is based on a  four-stage approach:

  1. Error detection
  2. Damage assessment and confinement (sometimes called “firewalling”)
  3. Error recovery
  4. Fault treatment and continued service

If this approach sounds familiar its because its been in use for quite sometime now in SQL (a loosely coupled system between client and DB Server), to retain DB consistency in the event of a faults during long running queries the following steps are taken :

  1. Client session termination is detected (step 1 detection).
  2. Does user have any uncommitted DML queries  (step 2 assessment).
  3. Access undo log and pull out data needed to rollback changes (step 3 recovery).
  4. Rollback changes and restore data consistency (step 4 fault treatment).

Checkpoint Roll-Back:

The pattern used by DBMSs, Checkpoint-rollback Scenario relies on taking a snap shot of the system at certain checkpoints through the process flow and upon failure between two checkpoints restoring the snapshot. However this pattern becomes too complex to implement in multi-tiered systems.

Checkpoint  Recovery Block:

This pattern relies on using alternative flows based on the type of fault, the checkpoint recognizes the type of fault and picks the correct block to use to recover from the error and complete the process.

This approach is extensively while coding, try with multiple catching blocks each handling a different type of exception, however instead of using it within the code of a single layer its taken one step further and used on the process level.

Agendat the Android Game

poster2

I’m almost done building my first Android game Agendat (agendas), A game based on the events Egypt has been going through since the revolution. Agendat is divided into chapters representing the phases of the Egyptian revolution. With major revolution themes/memes scattered through game play. Agendat which means Agendas alludes to the term used by the late chief spy Omar Suliman when he referred to the protesters describing them as people with ulterior agendas.

A Fun, silly game about Egypt and the revolution.

Generally the game is a tongue in cheek representation of the revolution and shouldn’t be taken seriously, the main target here is for the game to be fun rather than an accurate depiction of the revolution, and as usually its intended to be absolutely free.

Chapter 1: Infilat Amny (Police Disappearance)

Chapter 2: Ta7arosh Gama3y (Sexual Harassment)

We currently have around 6 chapters ready, but only 2 of them are intended to be playable when we publish the game.

All the graphics in this game was provided by my partner S Graphic Design, who are about the fastest person you can get to design game components for you.

S Graphic Design

Inar Tablet

Egyptian company Banha electronics is gearing up in preparation to mass produce Inar, the first Egyptian tablet, with the target being providing university students with access to a subsidized/free tablet. The merits of such a national projects can’t be denied with the most obvious being exponentially expanding the Egyptian android user base, to become the largest in the region which would automatically attract developers to build apps targeting highly specific local needs. This project reminds me of the “haseb le kol bayt” project which basically placed Egypt where it is in the IT outsourcing industry and in a way ended up creating a tech savvy generation.

Image

I wasn’t able to find the official website for the product (seems like they don’t have one), the manufacturer website didn’t include anything about Inar (however its a must visit for other reasons). A Facebook page that describes itself as the semi-official (?!) page included a limited specs sheet.

Image

Decent components, nothing that special yet perfectly usable to cover most of the things you may require from an “educational” tablet. Naturally since no one has ever seen one in the wild the build quality remains a big mystery. Build quality is a key component when you are planning to distribute it to students, from the unboxing video you can tell that it comes bundled with a protective case. I hope this is not the official unboxing video as its a bit lacking when it comes to quality  (if you skip to 3:39, you’ll see that the user is trying to use ipad gestures to close the app, which isn’t even available in android!!!).

The semi-official sources lists its price as ranging between 1200 to 1500 EGP ($171), a price tag that’s almost 4 times the price of the AkashII (the indian tablet) which is being produced for a similar project in India. However if they are planning to subsidize it or distribute it for free to students the price would be irrelevant. People online are promoting buying it stating that buying it will result in releasing a better, cheaper version, which is true given that we have decent management. Egypt has been manufacturing laptops for quite sometime now however we weren’t able to take it anywhere, just mediocre low end laptops for local consumption.

Unfortunately Inar is being politicized being used as propaganda by various Egyptian political parties, which is greatly impacting how its being depicted in the media (even social media) with people losing their objectiveness while reviewing it. Also with the regime/ruling party painting it as a national achievement they are setting it up to fail as there is no way for it to match the expectations they’ve building up.

Realistically speaking and as an aspiring android developer, I think that this along with mobile money may be the next major market changers, with Egypt finding its way into Google’s Radar which honestly I think is long over-due.