Category Archives: Uncategorized

AI and the future

What is the future holding to us? AI? Are they taking over? What is AI? Are they dangerous? Are they good? Are they really more intelligent to us? Are they similar to us? Do they pose any threat on us? Are all of these movies that says they are threats are real?

Wowowah! You are kinda overwhelming me with all these questions? What is that you are really worried about.

I am worried about the AI taking the universe from us?

Good, now I understand. Are they taking the universe from us? Well, according to Bill Gates, in the next 50 years, the AI is going to read a book and sit an exam, scoring more than a human. We know that IBM’s deep blue has been able to defeat the chess’s champion, Kasparov. And Google’s AI chess bot, AlphaZero, was able to defeat the world’s leading chess program, Stockfish 8, after just 4 hours of training. So, where is this taking us? What are the implications how is the future going to look.

Well, first of all? Is AI bad and evil spirited and do they want to take our position? They don’t realise their existence from the lack of it and they are just doing what they are programmed to do, but their programs are not based on a digital input and output, meaning there are no if conditions, they are judged more on results, rather on being given the exact steps of how to do it. Based on the results, they will alter the weights on their neural networks and hence alter their behaviour. But, they don’t know what is right or wrong, we know it and we teach it to them and based on our results, they would have to alter. So, they are really not defining their purpose, we are and we are setting the criteria, not them. So, their is no element of bad intention there, since we control the inputs and the outputs and hence the behaviour. But, this is true now, is it always going to hold out to be true? Yes, AI will always be our creation and we will always control the inputs and the outputs and the success criteria. It has no way to determine that for itself and so, and it will always remain under our control and it will do what we taught it to do.

That is a big sigh or relief. We are safe, then. Right? No, we are not.

AI is a pretty advanced tool that is doing what we want it to do, sometimes far better than we can. It will be competing whether we like it or not in the marketplace. Have you ever heard of a robot complaining that it had to do too much work? Have you ever heard of a human doing it? You get the picture. Put yourself in Uber’s shoes while it is choosing to use self-driving cars for their trips. Their customers will not complain about them and the they will not complain about Uber. Generally, less headache and more output which translate into top dollars for stakeholders. If they have to lay off all of Uber’s drivers. So, be it. This means less trouble, more customer satisfaction and better sustainable business models. So, even though it is doing what we want it to do, it is obeying its master and growing in intelligence everyday, training and working relentlessly and competing in the market which would lead to many lay-offs and less job security.

In the sixties, nobody had to worry about his job position. He always knew he had it, now the market is fiercer and one had to continuously upgrade himself to remain in the market. With aggressive competition from AI, job security will grow less and less.

A self-driving car is less likely to make an accident with another self-driving car, since they are connected to the same network. An AI robot doctor is less likely to be out-of-date in its information, since it receives all its information over the internet. True, a wrong update can cause millions of lives to be lost, but they are far more less easy-maintenance than humans. It is true that the mere survival is going to be a challenge with these AI robots around and whoever is lazy or has below average IQ, has less chance of surviving with AI around. And therefore, you are right about them posing a threat, but may be less right about them being evil-intended. In the globalisation, free-market era, AI is going to compete with us in the marketplace and there is so little that we can do about it.

Oh! Is the future going to be so gloomy? And, why compete with them? Why not sit back and relax and enjoy them serving us. After-all, with all doing all the hard effort, there will be less of a problem with finding food, they can it to us and there will be less wars and competition for resources with them figuring out to us all the answers to the hard questions. We can just sit back, relax and let them figure it out for us. Well, this is not as easy as it sounds. AI cannot figure out for us anything, we are the one that has to figure it out for ourselves and we are having trouble figuring it out for ourselves. And, in order to figure it out, we will have to work. And as we will attempt to work, we will have to compete with everything being automated more and more everyday and it is true, the world is going to be more comfortable in many ways, but it is equally correct that it is going to be more demanding in many ways. So, the challenge would be with our lives being so much more easier in many ways, and every reason is given to be lazy, there is a far less chance to be lazy especially that people who are not, will have far more rewards and possibilities.

We are talking here about TV’s which will monitor your face expressions, determine your tastes and customise it shows us based on that. How difficult is it going to be to keep yourself and your kids away from this TV and do some work. And at the end, if you don’t do some work, I am sure, it will be easier to find food, but imagining the second level of luxury that you could have if you do, makes it very difficult not to work! Also, imagine how would AI interfere in government policies. Imagine, the borders of the U.S. protected by a virtual Google wall that would use the AI to fire bullets against whoever steps across the border. Imagine AI making budget decisions for governments. As impressive as it may sound, you would tend to wonder, where do humans fit into all of this. And you are right, they don’t, unless they really want to. Which is why in tomorrow’s world, if you don’t show interest, you are very easily forgotten. And, who wants to be forgotten?!

So, what does it mean for me and how can I prepare my forward for myself and for my kids. Good question! Be mobile. Learn a new thing everyday. Make it a point to step out of the comfort zone. Corona is a good test-run for a very competitive market, the future is going to be far more competitive. In tomorrow’s world, you are going to have to be an entrepreneur even if you are an employee. So, take risks and follow your way through and make it a point to exhibit toughness and show your strength every new day. This is the only way you can survive in tomorrow’s world.

I loved writing this blog for you guys. Please, like and share and show me some love. I would love to hear your thoughts.

Bootstrap is too heavy!

Do you use Bootstrap? Do you not use Bootstrap? Is Bootstrap a good framework? Hmmmm.

First of all, what is Boostrap? Boostrap is by far the most commonly used CSS framework. It supports SASS and LESS and comes with its own Javascript library that helps us create fancy interfaces, modals and sliders. Sounds great? Right?

Well, it does and indeed, it is a great framework built by twitter and I think that in the past five or six projects, I have used Boostrap. My only concern with Bootstrap is that we, in almost all projects, rarely use five percent of its features and most of the time incorporate this huge framework, causing performance and maintainability issues. Please, let me know if you have ever used Jumbotron. I know I haven’t.

So, should we not use Boostrap? No, please, do use it! But, customise it to your needs. Only, download the features that you want to download. Because, Boostrap does offer you this feature for 3.x: https://getbootstrap.com/docs/3.4/customize/

You don’t need to include anything in your code that is not needed and pay a heavy performance price. So that as much as the Bootstrap is necessary for things like responsive and so forth, I don’t like to include the whole framework just for that. For me personally, I prefer to download just the grid of Bootstrap. I think that this is more than enough for my needs and I can use my own custom classes for the rest. Note that, the Bootstrap classes can be very annoying from a maintainability perspective.

It had been a pleasure writing this blog for you guys and I wish you guys will share your thoughts on this one. How do you normally use Boostrap? Do you find a good framework? Would love to know :).

Build a simple NodeJS server and consume the data in ReactJS

Today, I am going to teach you how to build simple Node Server and consume the data using ReactJS. This tutorial is good for beginners. If you are an advanced NodeJS and ReactJS developer, stay tuned for other tutorials which might be more suitable for you. You are still welcomed to read it of course to give us your valuable feedback.

If you have no Node and npm installed, please install them. You can install them by following this link: https://www.npmjs.com/get-npm. if you are in doubt whether you have npm installed or not, a good way to check is by typing in the following command:-

npm -v 

If you don’t see an error, then you are good to go. Now, you are good to go. I would use Microsoft Visual Studio Code in this tutorial. If you haven’t already got one, please, download it from here: https://code.visualstudio.com/download

Create a new folder any place you like and open in Visual Studio Code. Create a new folder in Visual Studio Code, call it src. Create a file and call it “app.js”. See the highlighted part to know where you can create a new file or folder.

Now you would need to install express and cors:-

In Visual Studio, open the Terminal. Terminal => New Terminal and then type in the following command to install express,

npm install express --save-dev

To install cors, you would need to run this command in the terminal

npm install cors --save

All you need to do now is to write the code. Open your app.js file and write the following code.

const express = require ('express');
const app = express ();
let payLoad = [{name:'Magdy El Bahnawy', status: 'enrolled'}, {name: 'Lotfy Samy', status: 'enrolled'}, {name: 'Ahmed Ibrahim', status: 'graduated'} ];
app.get ('/students', (req, res) => { res.send (payLoad);})
app.listen (2000);
 
node src/app.js

If you face any issues and you are using Windows, try to run Visual Studio Code as an administrator and if you are using MAC, type in sudo in front of the command that is causing the error. If this doesn’t resolve the issue, don’t hesitate to contact me and I will try my best to resolve your issue. Now, if you go in your browser to the following url: http://localhost:2000/students, you shall be able to see some JSON object in your browser which shows that you have actually built your first node server app and it is up and running!!!

This is awesome! Now, let us write your first React App to consume your output:-

In Microsoft Visual Studio Code, open a new window: File -> New Window

Create a new folder and name it React and open it in your new window in your Visual Studio Code. Open the terminal: Terminal -> New Terminal and copy paste the following commands:-

npx create-react-app my-app
cd my-app
npm start
 

You should see something in your browser that resembles this. If the browser doesn’t open automatically, just type in the following address in your browser’s address bar: http://localhost:3000. If the commands above fail to execute, run sudo if you are running it on MAC or Linux or if you are in Windows, try running Microsoft Visual Studio as an administrator. Always, feel free to reach out to me with questions when and if needed.

Now, in the src/App.js, type in the following code:-

import React, {Component} from 'react';
import './App.css';

class App extends Component{
constructor () {
super();
this.state = {
response: []
}
}

componentDidMount () {
fetch("http://localhost:2000/students")
.then(response => response.json())
.then (
data => {
this.setState({response: data})
})
.catch(err => { console.error(err) })
}

render () {

return (
<div className="App">
{this.state.response.map(student => <div><span>{student.name}</span><span>&nbsp;{student.status}</span></div>)}
</div>
);
}

}

export default App;

On the screen you will be able to see something like this:-

Congratulations! You just have your first React app consuming its data from the Node Server and displaying it on the screen. Will be waiting for your questions and feedback.

React and Angular: the fight is not over

Is React more popular? Is Angular more popular? Short answer: React is more popular. Proof?

Google Trends. The question is: why is React more popular and Is it going to remain popular in the future?

I have more than 15 years of hand-on experience and I know one thing and one thing only: It is not enough to see current trends to be able to thrive in the market. It is equally important to be able to predict future trends because if you can’t do that, the trends are bound to change and everything can start falling on your head. So, let us begin our analysis of why is React more popular.

Quick and easy answer: performance and resistance.

It is not a secret that React outperforms Angular. Now, take React and put it on top Typescript and you will start facing some performance issues. Obviously, React you can start to add components incrementally and it offers you flexibility and speed of what you want to add and what you don’t want to add. Great, isn’t it? Well, is that it? Is this is why React dominating. No. Remember, Typescript which Angular is based on, is so heavily standardised and stylised and it makes front-end lose its fuzziness. Believe it or not, there is certain magic to this fuzziness that the front-enders tend to like. It seams so close to the art experience they have from UX designs to code. It is a part of their magic and a part of this unpredictability that make front-end more of an art than a science.

In the words of Brendan Eich, the inventor of Javascript:-

“If I had done classes in JavaScript back in May 1995, I would have been told that it was too much like Java or that JavaScript was competing with Java … I was under marketing orders to make it look like Java but not make it too big for its britches … [it] needed to be a silly little brother language.”

The above is a bug in Javascript that no one have had to the time to resolve. Indeed, the fuzziness of Javascript has been a part of the fuzzy culture that the front-enders identified with as a part of its magic and it gave them a lot of thrill when they were implementing the UX designs and it is one of the primary reasons why the back-enders didn’t dare step in their unfamiliar territories.

Now, think about the resistance that Typescript and Angular are facing and it is striving for standardisation. What in fact was thought of the right thing to do defied the front-enders pop culture.

Now, where is this leading us? Obviously, Angular has encouraged a lot of the back-enders to come into the front-end world which was a choice not cherished by the front-enders and this made them endorse more React. That in addition of the business having a little reason to stick to Angular given the performance difference. What is Typescript offering can be rivalled by tools like JSDocs which is less expensive in terms of performance. But, Angular did not die. Because standardisation will win. It always has done.

All, I am saying is: imagine that Google has managed to support Typescript in Google’s browser? I hope now you can see the impact. It is going to be huge. People, will no longer hold onto React, why should they? The business would have less choice to stick to React given that Google Chrome, the most popular web browser, supports Typescript.

Which programming language performs better: C or Java? The answer is C. Which programming language is more popular: C of Java? The answer is below:-

And the question is why? Short answer: Standardisation. Standardisation will always win. It always has. Using a number as a boolean and leading to unpredictable outcomes and can be cool and thrilling. But, at the end of the day we all know that a pointer is a pointer, boolean is a boolean and number is a number and we need more time to deliver business value over wasting our times solving interesting programmatic mind-turns.

I hope you find this article useful. I would love to hear your thoughts.

Twenty First world

Google find new websites in a matter of few hours after their creation sometimes. Google then makes a list of all popular keywords that people search for in Google Adwords so that people are encouraged to buy dot coms’. Sites like GoDaddy sell domain names at a very cheap price. WordPress can make websites within few  minutes without the need of designer or developer. One can lean on web hosting so he doesn’t have to own his own hardware resources at a very cheap price. Sites like Stack Overflow encourage very rough competition for answering questions that one can find sound answers within few minutes after a question was posted sometimes. It seams like an option whether or not you want to get engaged in an online community but it is not an option nowadays. The gap between you and the internet world is increasing every moment you don’t engage yourself in it. The whole world is getting digitized and you must engage yourself in an online community because your very survival depends on it. No matter how old or young you are, you cannot turn your back to the internet world.

Youtube world have made an enormous wealth of information available to all kinds of people with all amounts of knowledge and information and one has only to catch this change. These people who are broadcasting information on Youtube are people wanting to get famous, rich or get hired. Being famous is no longer tied to the selected and lucky few who can get themselves on TV. Nowadays, one doesn’t have to be on TV to get known and famous. This even affected the Movie and TV market adversely. All one wants to get visible is to have an internet cable,  PC and a digital video camera. One would tend to think that getting visible had became easier this way. On the contrary, it had became harder as the competition had become much fiercer than ever it was  before.

There had been a drastic change in Today’s world when compared to the world twenty or thirty years ago. This change had left many people clueless and jobless. Primary change had been on internet and information sharing. This totally changed the form of media and how to expose yourself to the employment market and to the world in general. Bachelor degree in any field is meaningless nowadays, because anyone can get the same amount of information and more if he engages himself in online discussions and forums.