MicroCule, A Love Story

Often I find myself in a situation that requires a quick and dirty custom micro-service to support one Proof-Of-Concept or another, with a wide array of NPM available module I usually resort to nodejs and in few minutes I’d have a nodejs script that does exactly what I wanted until just few weeks ago the only option I had for hosting that service would have been hook.io, a free micro-services hosting service that provides decent yet none stellar performance QoS such as with any cloud based free service often things didn’t work at the required performance level and sometimes the nodejs module I wanted wasn’t available on the server, however other than starting my own app engine and installing all the containers and all the associated hassle I had to make do with whatever was generously offered by hook.io.

In comes Micro-Cule,  Micro-cule is a Software Development Kit and Command Line Interface for spawning streaming stateless HTTP microservices for any programming language or arbitrary binary.

Installed on my amazon micro instance it doesn’t take more than one, yes ONE command to spawn a fully qualified micro-service to do my bidding, and here is the fun part it supports 20 different languages, so basically its like self hosting a very lean easy to manage middleware that can turn any of your hacked scripts into webservices. Micro-Cule is part of hook.io project but it offers the core service without the whole hook.io array of bells and whistles which I think is a very smart move from hook.io people, given that most of the potential users would just want to run their own webservices rather than offer a webservices hosting service.

I’m in love with microcule given how it has liberated me from heroku, google apps, amazon lambda and the even more cumbersome self hosted solutions and For all means and purposes i think microcule is the perfect webservices hosting solution for prototyping, testing and development, perhaps even production with some careful configuration.

node js script to send email over SMTP

I’ve had this challenge for which the only solution was building an nodejs webhook adapter for my smtp server. Using webhooks and the following script I was able to enable API access for my email server (which it lacked).

 

 

const SMTPConnection = require(‘smtp-connection’);
var options = {
host: ‘smtp.gmail.com’,

port: 465,
secure: true,
// requireTLS: true,
ignoreTLS: true,
debug: true
};
var envelope = {
from: ‘<user>@gmail.com’,
to: ‘badr42@gmail.com’,

};

var auth = {
user: ‘<user>@gmail.com’,
pass: ‘<pass>’,

};
var message=”hello world”

let connection = new SMTPConnection(options);
connection.connect(function(err, connect){
if(err){
console.log(“error connecting”);
console.log(err);
}else{
console.log(“attempting to login”);
console.log(connect);

connection.login(auth, function(err, connect){
if(err){
console.log(“error logging in”);
console.log(err);
}else{
console.log(“logged in”);
console.log(connect);
connection.send(envelope, message, function(err, result){
if(err){
console.log(err);
}else{
console.log(“email sent”);
console.log(result);
connection.quit();
}
});

}
});

}
});

Automating the Nespresso Coffee Machine part 1

I like drinking coffee first thing in the morning, however preparing coffee in the early morning is not something I’m a big fan of, so I decided to use my particle photon to automate the coffee making process. Thus turning my normal Nespresso machine to an IoT enabled machine.

The steps for this build are quite simple, it requires the following components :

  • Particle Photon
  • Servo
  • Power Bank
  • Paper Clip
  • Rubber Band
  • Velcro Tape

To build it connect the Servo to the photon, noting that the data pin must be connected to one of the PWM enabled pins, in my build I used Pin D0.

Use the paper clip to twist and attach on the servo keeping it in place using the rubber band, this serves as the push rod that’ll press on the coffee maker’s button.

wp-1482139836728.jpg

Attach the servo to the Nespresso machine using velcro and tape, you’ll need to adjust the servo angles on the code to work with your machine and how the servo is attached to its body.

Connect it to IFTTT service and enjoy your coffee, Personally I then created a DO button on my phone to press the first thing in the morning.

Continue reading

Particle Photon First Impressions

The particle photon maker kit I ordered arrived and I finally was able to take it for a spin and I’m quite impressed. A tiny wifi enabled chip that can realise almost any IoT fantasy you conceive, Within few minutes of unpacking it, I was able to get it online and within an hour I had my first project up and running.

image

The chip itself is surprisingly small, small enough to make it possible to embed it into most fabrications, and it has a very low profile as well. But the real selling point in my opinion is the cloud backend, particle managed to greatly reduce the hassle required to set up an arduino IDE by providing it through a neat and simple web console. Being an IoT chip relying on the internet for most of its features can’t be held against it, the photon is built to be used in use cases in which internet is available naturally its a lot less impressive without internet connectivity.

Screen Shot 2015-10-23 at 4.14.39 PM

Unlike Arduino there is no IDE , instead you build your “sketches” in the cloud, and then flash it wirelessly to the device of your choice, this allows for easier upgrade if the devices are embedded and physical access is challenging. You can still use the micro USB to connect to a laptop and debug over serial much like you would with an Arduino, a node.js spark CLI framework is required though for this to work.

For my first project I decided to build something simple and fun. A realtime desktop data display device, an paper lantern that lights up in different colours to alert me of programable events. The great thing about particle products is how they can be represented as a channel on IFTTT, so you can program it to respond to any of the numerous IFTTT triggers.

image

I’ll discuss the implementation and code of my project in my next entry.

 

 

 

The rise of the co-Founders

It is no longer a technology race, its a marketing race. Almost any software can be built or copied at a similar quality, its all up to marketing and customer grabbing at early stages of the product life cycle.

Recently I noticed an increasing trend of using the term “CoFounder and CEO of” on linkedin. The majority of the self described CEOs are fresh graduates or have just joined the IT field. Few of these startups are significant or were ever heard of out of the scope of their owners’ immediate circle of friends. It doesn’t stop at tech startups really it seems like everybody is trying to build something to call his own for a whole array of different reasons be it financial or the mere thirst to get the bragging rights or even in some cases peer pressure. (i.e. “in” people and fashion blogs)

Silicon valley parodied the culture of launching irrelevant startups quite nicely

Silicon valley parodied the culture of launching irrelevant startups quite nicely

The notion of being a middle-class salary man is no longer fashionable, As a generation we were raised that each and everyone of us is unique and destined for greatness settling into a life of corporate obscurity is not something can cope with easily. Financial reasons play a role here as well as startups appear to some as a quick way to make it into the double commas club (millionaires club) after all how hard can it be to build up a company and then sell it later for a couple of millions right. Given how the entry barrier is particularly low the common perception is that you don’t have to put a lot on stake in order to build a tech startup, All whats needed is a good idea and a couple of customer and things will organically evolve. Everybody can be an over night entrepreneur.

A website can be built and launched and wouldn’t cost more than a month’s salary hosting the product on the cloud can guarantee a easily affordable operational cost, in theory you can run the website forever securing the “entrepreneur” status for as long as you have it online. I’ve written an article not so long ago about the rise of social entrepreneurs in post 25 January Egypt and how few if any ever make a profit. People confuse having a successful product with having a successful startup, For the first the success is measured by hits/downloads/user-base while for the latter it all comes down to being revenue positive at some point (or at least the prospect of it). More importantly owning your website and URL doesn’t equate being an entrepreneur managing your own startup. Having a killer idea is not as valuable as it used to be, almost any idea can be replicated at an even higher quality what really matters is traction and a growing user base, given the social nature of most products it all comes down to the critical mass of users. Even if you are moving into a new area with no competitors once you achieve anything that resembles a success -and given the low barrier of entry- competition will show up.

Being an entrepreneur and managing your own startup is much more complicated than simply launching a site and getting a couple of hits everyday, there is a certain leap of faith required in order to actually manage your own startup towards success, usually this entails quitting your job and relying on your newly found venture for income. Being a part time entrepreneur almost never works, a CEO/co-founder is expected to spend 16 or 18 hours a day working on his brain child, doing it in the few hours you’ve got left after work would never cut it. So unless you are willing to do that please do not call yourself CEO/Co-Founder of one thing or another.

Still why not do it, with a low entry barrier and almost zero operational cost all of us can be entrepreneurs, the co-founders and CEOs of one thing or another. Profit, value and sustainability are all irrelevant, after all it is all about the bragging rights and the 15 minutes of fame.

**note : To be clear I realise that I sound as if I’m making sweeping generalisations there, however this is not the case, this article is about the type of “entrepreneurs” who do it for all the wrong reasons.

USSD API on Android

I’m currently trying to build a small widget that shows you several statistics about your cell phone usage, this would require using USSD codes and catching their responses. I scoured the internet for a solution however wasn’t able to reach one.

The only available solution which is mainly a hack relied on catching the logcat entry and displaying it, unfortunately this was fixed in subsequent versions of android and now USSD response doesn’t appear in the logcat.

There is even a Facebook page created just to request this feature from google…anyway if anybody manages to find a way to handle USSD responses please do share.

 

***Update***

It is now possible to read the USSDs using the accessibility services, the downside is how indirect this method is and how the app should be manually enabled as an accessibility app in the device setting.

 

http://stackoverflow.com/questions/22057625/prevent-ussd-dialog-and-read-ussd-response

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…