logotype
  • Home
  • Home
    • Homepage 1
    • Homepage 2
    • Homepage 3
    • Homepage 4
    • Homepage 5
    • Homepage 6
    • Homepage 7
    homepage 1

    Main home(01)

    homepage 2

    Creative agency(02)

    homepage 3

    Minimal agency(03)

    homepage 4

    Digital company(04)

    homepage 5

    Design company(05)

    homepage 6

    Minimal studio(06)

    homepage 7

    Portfolio minimal(07)

    homepage coming soon2

    In development(08)

  • About
  • Services
    • Website Design And Development
    • MOBILE APPS
    • MANAGEMENTS AND ASSIST
  • Blog
  • Contact
  • Pages
    • About us
    • Our team
    • Services
    • History
    • Philosophy
    • FAQ’s
    • Typography
    • Elements
    • Page 404
    • Coming soon
    • Mega menu page
  • Blog
    • Blog listing
    • Blog grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Masonry grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Blog singles
      • Standard
      • Video
      • Quote
      • Gallery
      • Link
      • Audio
    • Single layouts
      • Overlay image
      • Title first
      • Image first
  • Portfolio
    • Grid
      • 2 columns
      • 3 columns
      • 4 col wide
      • 5 col wide
    • Masonry
      • Grid 1
      • Grid 2
      • Grid 3
    • Gallery
    • Single
  • Shop
    • Cart
    • Checkout
    • My account
    • Wishlist
    Shop
    • Products Grid
    • Single Product
    • Cart
    • Checkout
    • Wishlist
    • Login - Register
    • Help Center
  • Contacts
    Contacts
    address:
    27 Division St, NY 10002 USA
    email:
    burido@mail.com
    phone:
    +1 800 123 456 78
    X-twitterFacebook-fInstagram
    Get in Touch

    Your email address will not be published. Required fields are marked *

Get in Touch
logotype
  • Home
  • Home
    • Homepage 1
    • Homepage 2
    • Homepage 3
    • Homepage 4
    • Homepage 5
    • Homepage 6
    • Homepage 7
    homepage 1

    Main home(01)

    homepage 2

    Creative agency(02)

    homepage 3

    Minimal agency(03)

    homepage 4

    Digital company(04)

    homepage 5

    Design company(05)

    homepage 6

    Minimal studio(06)

    homepage 7

    Portfolio minimal(07)

    homepage coming soon2

    In development(08)

  • About
  • Services
    • Website Design And Development
    • MOBILE APPS
    • MANAGEMENTS AND ASSIST
  • Blog
  • Contact
  • Pages
    • About us
    • Our team
    • Services
    • History
    • Philosophy
    • FAQ’s
    • Typography
    • Elements
    • Page 404
    • Coming soon
    • Mega menu page
  • Blog
    • Blog listing
    • Blog grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Masonry grid
      • 2 columns
      • 2 col + sidebar
      • 3 columns
      • 4 col wide
    • Blog singles
      • Standard
      • Video
      • Quote
      • Gallery
      • Link
      • Audio
    • Single layouts
      • Overlay image
      • Title first
      • Image first
  • Portfolio
    • Grid
      • 2 columns
      • 3 columns
      • 4 col wide
      • 5 col wide
    • Masonry
      • Grid 1
      • Grid 2
      • Grid 3
    • Gallery
    • Single
  • Shop
    • Cart
    • Checkout
    • My account
    • Wishlist
    Shop
    • Products Grid
    • Single Product
    • Cart
    • Checkout
    • Wishlist
    • Login - Register
    • Help Center
  • Contacts
    Contacts
    address:
    27 Division St, NY 10002 USA
    email:
    burido@mail.com
    phone:
    +1 800 123 456 78
    X-twitterFacebook-fInstagram
    Get in Touch

    Your email address will not be published. Required fields are marked *

Get in Touch
Blog listing
HomeBlog listing
MySQL-Generated-Columns
Blog
September 8, 2020By Amine G

MySql : Understanding Generated Columns

MySQL-Generated-Columns

The Theory

Generated Columns is a feature released on MySQL 5.7. They can be used during CREATE TABLE or ALTER TABLE statements. It is a way of storing data without actually sending it through the INSERT or UPDATE clauses in SQL. The database resolves what the data will be.

There are two types of Generated Columns: Virtual and Stored. They work with:

  • mathematical expressions (product_price * quantity)
  • built-in functions (RIGHT(), CONCAT(), FROM_UNIXTIME(), JSON_EXTRACT())
  • literals (“2”, “new”, 0)

Besides that, they can be indexed but they don’t allow subqueries in it.
A Generated Column works within the table domain. If you need subqueries on a particular column, you may have to look at Views.

The basic example

As an example I am going to use an e-commerce database as based on my past experience of what I have seen and worked. You will probably have at least these tables or something similar:

  • users – stores user info
  • products – stores product info like price and description
  • orders – stores the user_id, date of order
  • orders_items – stores product_id, order_id, quantity and price at the time of purchase

This is the whole DB: Gist.

Notice the order_items definition:

CREATE TABLE `orders_items` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `order_id` int(10) unsigned NOT NULL,
  `product_id` int(10) unsigned NOT NULL,
  `product_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
  `quantity` int(10) unsigned NOT NULL DEFAULT 1,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` varchar(45) NOT NULL DEFAULT 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

The retrieval would bring:

SELECT
  `id`, `order_id`, `product_id`, `product_price`, `quantity`
FROM `orders_items`
LIMIT 5;
idorder_idproduct_idproduct_pricequantity
13691304202.187
241736250.403
3270140429.895
4256179190.4010
51071911146.981

One example is to get the total of that order_item row, something like total_item_price that would store the value of product_price * quantity to show how much the summed amount of an item would be. Some databases have the MONEY type to store price, as with MySQL it is recommended to work with DECIMAL.

People solve this problem in different ways:

  • store the calculated price on a new column to make it easier to retrieve;
  • create a view;
  • or they calculate in the application itself, which in this case might cause problems due to how the language handles floats. There are libraries to deal with money values in a lot of languages and frameworks, however, the overhead of converting each row into a money object could be costly depending on the amount of data being transferred.

Another way I’ve seen is: people calculate in the query the total amount for the orders_items row as product_price * quantity:

SELECT
  `id`, 
  `order_id`, 
  `product_id`, 
  `product_price`, 
  `quantity`,
  `product_price` * `quantity` AS total_item_price
FROM `orders_items`
LIMIT 5;
idorder_idproduct_idproduct_pricequantitytotal_item_price
13691304202.1871415.26
241736250.403751.20
3270140429.895149.45
4256179190.40101904.00
51071911146.981146.98

Virtual Columns

  • They take no disk space, except when using a Virtual Column as in a Secondary Index.
  • They are an INPLACE operation: it means the table definition is changed without having to recopy all the data again. More info.
  • The values are calculated on the fly during read operations and BEFORE triggers.

Consider using virtual columns for data where changes happens in a significant number of times. The cost of a Virtual Column comes from reading a table constantly and the server has to compute every time what that column value will be.

Stored Columns

  • They do use disk space.
  • It has the same cost of adding a new column, so it is a COPY operation
  • Values are updated in every INSERT and UPDATE statement.

You should consider using Stored Columns for when the data doesn’t change significantly or at all after creation, like for instance, the example above with the orders_items table. Once a purchase is made, the price of the product is stored, not being changed, neither the quantity. Considering this information we could create total_item_price as a Stored Column.

The code

Creating a table

Virtual Column :

CREATE TABLE `orders_items` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_id` int(10) unsigned NOT NULL,
`product_id` int(10) unsigned NOT NULL,
`product_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
`quantity` int(10) unsigned NOT NULL DEFAULT 1,
`total_item_price` decimal(10,2) AS (`quantity` * `product_price`),
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` varchar(45) NOT NULL DEFAULT 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

Stored Column :

CREATE TABLE `orders_items` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_id` int(10) unsigned NOT NULL,
`product_id` int(10) unsigned NOT NULL,
`product_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00',
`quantity` int(10) unsigned NOT NULL DEFAULT 1,
`total_item_price` decimal(10,2) AS (`quantity` * `product_price`) STORED,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` varchar(45) NOT NULL DEFAULT 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;

Notice how the definition changes on line 9 and 23: you have another keyword, AS, then an expression and specifically on line 23 you see a STORED keyword. In both lines they are generated columns, if nothing is specified will be a VIRTUAL column.

Altering a table

It uses the same syntax as adding a column, just adding the “AS (expression)” after the data type:

full_name as VIRTUAL COLUMN

ALTER TABLE users
ADD COLUMN `full_name` VARCHAR(500)
AS (CONCAT_WS(" ", `first_name`, `last_name`));

total_item_price as STORED COLUMN

ALTER TABLE orders_items
ADD COLUMN `total_item_price` DECIMAL(10, 2)
AS (`quantity` * `product_price`) STORED;

Final considerations

When the type is STORED, it must be specified after the expression otherwise the default behaviour will be to be VIRTUAL.

Generated columns can have indexes created as the following, no matter if stored, virtual or extracted from a JSON field:

ALTER TABLE users
ADD INDEX `ix_full_name` (`full_name`);

Which is the same syntax for normal columns.

Read More
01quantencomputer-zukunft-daimler-google-ibm-technologie-w1366xh683-cutout
Blog
June 15, 2020By Amine G

Quantum Computing Primer

What you will learn

By following through the material in this primer, you will learn:

  • How quantum physics gives us a new way to compute
  • The similarities and differences between quantum computing and classical computing
  • How the fundamental units of quantum computing (qubits) are manipulated to solve hard problems
  • Why Quantum Computing is well suited to AI and machine learning applications, and how quantum computers may be used as ‘AI co-processors’

SECTION 1

1.1 – Conventional computing

To understand quantum computing, it is useful to first think about conventional computing. We take modern digital computers and their ability to perform a multitude of different applications for granted. Our desktop PCs, laptops and smart phones can run spreadsheets, stream live video, allow us to chat with people on the other side of the world, and immerse us in realistic 3D environments. But at their core, all digital computers have something in common. They all perform simple arithmetic operations. Their power comes from the immense speed at which they are able to do this. Computers perform billions of operations per second. These operations are performed so quickly that they allow us to run very complex high level applications. Conventional digital computing can be summed up by the diagram shown in figure 1.

quantum computer tutorial

Figure 1. Dataflow in a conventional computer

Although there are many tasks that conventional computers are very good at, there are still some areas where calculations seem to be exceedingly difficult. Examples of these areas are: Image recognition, natural language (getting a computer to understand what we mean if we speak to it using our own language rather than a programming language), and tasks where a computer must learn from experience to become better at a particular task. Even though there has been much effort and research poured into this field over the past few decades, our progress in this area has been slow and the prototypes that we do have working usually require very large supercomputers to run them, consuming a vast quantities of space and power.

We can ask the question: Is there a different way of designing computing systems, from the ground up? If we could start again from scratch and do something completely different, to be better at these tasks that conventional computers find hard, how would we go about building a new type of computer?

1.2 – A new kind of computing

Quantum computing is radically different from the conventional approach of transforming bits strings from one set of 0’s and 1’s to another. With quantum computing, everything changes. The physics that we use to understand bits of information and the devices that manipulate them are totally different. The way in which we build such devices is different, requiring new materials, new design rules and new processor architectures. Finally, the way we program these systems is entirely different. This document will explore the first of these issues, how replacing the conventional bit (0 or 1) with a new type of information – the qubit – can change the way we think about computing.

1.3 – The light switch game

To begin learning about quantum computing, it is important to understand why we can’t use conventional digital computers to solve certain problems. Let’s consider a mathematical problem, which we’ll call the light switch game, that illustrates this point.

The light switch game involves trying to find the best settings for a bunch of switches. Here’s a graphical example introducing this problem:

quantum computer tutorial

Figure 2. The light switch game

Let’s imagine that each light switch has a number associated with it, which is chosen for you (you don’t get to change this). We call this a ‘bias value’. You get to choose whether to turn each light switch ON or OFF. In our game, ON = +1 and OFF = -1. We then add up all the switches’ bias values multiplied by their ON/OFF values. This gives us a number. The objective of the game is to set the switches to get the lowest number. Mathematically, we call the bias values of each switch hi and the switch settings are called si

.

quantum computer tutorial

Figure 3. Playing the light switch game – add up the bias values of each switch multiplied by their settings (which you have to choose)

So depending upon which switches we set to +1 and which we set to -1, we will get a different score overall. You can try this game. Hopefully you’ll find it easy because there’s a simple rule to winning:

quantum computer tutorial

Figure 4. Working out the answer for a particular “guess” at the switch settings

We find that if we set all the switches with positive biases to OFF and all the switches with negative biases to ON and add up the result then we get the lowest overall value. Easy, right? I can give you as many switches as I want with many different bias values and you just look at each one in turn and flip it either ON or OFF accordingly.

OK, let’s make it harder. So now imagine that many of the pairs of switches have an additional rule, one which involves considering PAIRS of switches in addition to just individual switches… we add a new bias value (called J) which we multiply by BOTH the switch settings that connect to it, and we add the resulting value we get from each pair of switches to our overall number too. Still, all we have to do is decide whether each switch should be ON or OFF subject to this new rule.

quantum computer tutorial

Figure 5. Making the game harder by adding additional terms that depend on the settings of pairs of switches.

But now it is much, much harder to decide whether a switch should be ON or OFF, because its neighbors affect it. Even with the simple example shown with 2 switches in the figure above, you can’t just follow the rule of setting them to be the opposite sign to their bias value anymore (try it!). With a complex web of switches having many neighbors, it quickly becomes very frustrating to try and find the right combination to give you the lowest value overall.

quantum computer tutorial

Figure 6. The light switch game with connecting terms added, generating an ‘interacting’ web of light switches

1.4 – How does quantum mechanics help?

With a couple of switches you can just try every combination of ON’s and OFF’s, there are only four possibilities: [ON ON], [ON OFF], [OFF ON] or [OFF OFF]. But as you add more and more switches, the number of possible ways that the switches can be set grows exponentially:

​

Figure 7. The exponential problem with the light switch game.

You can start to see why the game isn’t much fun anymore. In fact it is even difficult for our most powerful supercomputers. Being able to store all those possible configurations in memory, and moving them around inside conventional processors to calculate if our guess is right takes a very, very long time. With only 500 switches, there isn’t enough time in the universe to check all the configurations.

Quantum mechanics can give us a helping hand with this problem. The fundamental power of a quantum computer comes from the idea that you can put bits of information into a superposition of states. You can think of this as being a situation where the qubit has not yet decided which state it wants to be in. Some people like to refer to the qubit in superposition as ‘being in both states at the same time’. You can alternatively think of the qubit’s state as being undecided as to whether it is +1 or -1. Which means that using a quantum computer, our light switches can be ON and OFF at the same time:

quantum computer tutorial

Figure 8: A quantum mechanical bit of information (qubit) can reside in what is known as a superposition state, where it has not yet decided whether to be in the +1 or the -1 state (alternatively, you can think of it as being ‘in both states’).

Now lets consider the same bunch of switches as before, but now held in a quantum computer’s memory (notice that the bias values haven’t been added yet):

quantum computer tutorial

Figure 9. A network of connected quantum bits in superposition. The answer is in there somewhere!

Because all the light switches are on and off at the same time, we know that the correct answer (correct ON/OFF settings for each switch) is represented in there somewhere – it is just currently hidden from us. But that is OK, because quantum mechanics is going to find it for us. The D-Wave quantum computer allows you to take a ‘quantum representation’ like this, and extract the configuration of ONs and OFFs with the lowest value. Here’s is how it works:

quantum computer tutorial

Figure 10. The computer begins with the bits in superposition, ends with them behaving as regular classical bits, and finds the answer along the way.

You start with the system in its quantum superposition as described above, and you slowly adjust the quantum computer to turn off the quantum superposition effect. At the same time, you slowly turn up all those bias values (the h and J’s from earlier). As this operation is performed, the switches slowly drop out of their superposition state and choose a classical state, either ON or OFF. At the end, each switch MUST have chosen to be either ON or OFF. The quantum mechanics working inside the computer helps the light switches settle into the right states to give the lowest overall value when you add them all up at the end. Even though with N switches there are 2N

possible configurations it could have ended up in, it finds the lowest one, winning the light switch game. So we see that the quantum computer allows us to minimize expressions such as the one considered here:

E(s)=∑ihisi+Jijsisj

which can be difficult (if not impossible) for classical computers.

SECTION 2

2.1 – It’s a math expression – who cares?

We didn’t build a machine to play a strange masochistic light switch game. The concept of finding a good configuration of binary variables (switches) in this way lies at the heart of many problems that are encountered in everyday applications. A few are shown in figure below. Even the concept of scientific discovery itself is an optimization problem (you are trying to find the best ‘configuration’ of terms contributing to a scientific equation which match real world observations).

quantum computer tutorial

Figure 11. Examples of applications which under the hood all involve finding good ‘switch settings’ and can be tackled more efficiently with quantum computers.

2.2 – The energy program

To understand how these problems might be cast as finding settings of switches, let’s consider how the quantum computer is programmed. Recall Figure 1, where bit strings in were transformed into other bits strings via the application of a logic program. Instead of that, we now have a resource where bits can be undecided, so the computation is performed in a fundamentally different way, as shown in Figure 12. In this case, a group of qubits are initialized into their superposition states, and this time an ENERGY PROGRAM (instead of a logic program) is applied to the group. The qubits go from being undecided at the beginning of the computation, to all having chosen either -1 or +1 states at the end of the computation. What is an Energy Program? It is just those h and J numbers – the bias settings – that we introduced earlier. In the light switch game, we said that the H and J’s were given to you. Well, now we see where they come from – they are the definition of the problem you are trying to solve.

quantum computer tutorial

Figure 12. The basic operation of a quantum computer is to supply an energy program (a series of h and J numbers) and let the computer find the switch settings (+1 and -1).

Crafting an energy program as a series of h and J values – to encode a real world problem that you care about – is exceedingly hard and time-consuming. It would be the equivalent of programming your desktop PC by sending in machine code to the microprocessors inside! Luckily, there is a better way to program quantum computers by using a quantum compiler. This process is explained in more detail in the Programming with D-Wave white paper.

2.3 – Quantum computers can LEARN

The discipline of teaching computers to reason about the world and learn from experience is known as machine learning. It is a sub-branch of the field of artificial intelligence. Most of the code we write is fairly static – that is, given new data it will perform the same computation over and over again and make the same errors. Using machine learning we can design programs which modify their own code and therefore learn new ways to handle pieces of data that they have never seen before.

The type of applications that run very well on D-Wave quantum computers are applications where learning and decision making under uncertain conditions are required. For example, imagine if a computer was asked to classify an object based on several images of similar objects you had shown it in the past. This task is very difficult for conventional computing architectures, which are designed to follow very strict logical reasoning. If the system is shown a new image, it is hard to get it to make a general statement about the image, such as ‘it looks similar to an apple’. D-Wave’s processors are designed to support applications that require high level reasoning and decision making.

How can we use a quantum computer to implement learning, for example, if we want the system to recognize objects? Writing an energy program for this task would be very difficult, even using a quantum compiler, as we do not know in detail how to capture the essence of objects that the system must recognize. Luckily there is a way around this problem, as there is a mode in which the quantum computer can tweak its own energy program in response to new pieces of incoming data. This allows the machine to make a good guess at what an object might be, even if it has never seen a particular instance of it before. The following section gives an overview of this process.

2.4 – A computer that programs itself

In order to get the system to tweak its own energy program, you start by showing the system lots and lots of instances of the concept that you want it to learn about. An example in shown in Figure 13. Here the idea is to try to get the computer to learn the difference between images of different types of fruit. In order to do this, we present images (or rather, a numeric representation of those images) to the system illustrating many different examples of apples, raspberries and melons. We also give the system the ‘right’ answer each time by telling it what switch settings (labels) it should be ending up selecting in each case. The system must find an energy program (shown as a question mark as we do not know it at the beginning) so that when an image is shown to the system, it gets the labels correct each time. If it gets many examples wrong, the algorithm knows that it must change its energy program.

quantum computer tutorial

Figure 13. Teaching the quantum chip by allowing it to write its own energy program. The system tweaks the energy program until it labels all the examples that you show it correctly. This is also known as the ‘training’ or ‘learning’ phase.

At first the system chooses an energy program (remember that it is just a bunch of H and J values) at random. It will get many of the labellings wrong, but that doesn’t matter, as we can keep showing it the examples and each time allow it to tweak the energy program so that it gets more and more labels (switch settings) correct. Once it can’t do any better on the data that it has been given, we then keep the final energy program and use that as our ‘learned’ program to classify a new, unseen example (figure 14).

In machine learning terminology this is known as a supervised learning algorithm because we are showing the computer examples of images and telling it what the correct labels should be in order to help it learn. There are other types of learning algorithms supported by the system, even ones that can be used if labeled data is not available.

quantum computer tutorial

Figure 14. After the system has found a good energy program during the training phase, it can now label unseen examples to solve a real world problem. This is known as the ‘testing’ phase.

2.5 – Uncertainty is a feature

Another interesting point to note about the quantum computer is that it is probabilistic, meaning that it returns multiple answers. Some of these might be the answer that you are looking for, and some might not. At first this sounds like a bad thing, as a computer that returns a different answer when you ask it the same question sounds like a bug! However, in the quantum computer, this returning of multiple answers can give us important information about the confidence level of the computer. Using the fruit example above, if we showed the computer an image and asked it to label the same image 100 times, and it gave the answer ‘apple’ 100 times, then the computer is pretty confident that the image is an apple. However, if it returns the answer apple 50 times and raspberry 50 times, what this means is that the computer is uncertain about the image you are showing it. And if you had shown it an image with apples AND raspberries in, it would be perfectly correct! This uncertainty can be very powerful when you are designing systems which are able to make complex decisions and learn about the world.

Read More
Screenshot_2020-10-22 HexTool Home(1)
Portfolio
February 2, 2020By Amine G

HEXTOOL.NET

Visite Website

Read More
Screenshot_2020-10-22 ROC Algerie Travuax Spéciaux
Portfolio
October 22, 2019By Amine G

Roc Algerie [Constructions Company]

Visit Website Here .

Read More
Data Delete
Blog
August 27, 2019By Amine G

Efficiently delete a million files on Linux servers

Data Delete


It happens to the best: some script rockets to the skyline resulting in an instand system administrator headache because some folder – typically, sessions – was stuffed with millions of files. Linux is not quite happy with that, deleting the folder is not an option and the loyal “rm -rf” command decides to call it a day. To make things even worse: you want to remove only files of some days ago… what are the options?

Find is you friend

The Linux “find” command is a possible solution, many will go for:

find /yourmagicmap/* -type f -mtime +3 -exec rm -f {} \;

The command above will give a list of files older than 3 days and will pass each found file to the rm command. The rule above has one problem though: it will take some time, since calling the rm command a million times is not exactly what you can call efficient.

A better option is:

 find /yourmagicmap/* -type f -mtime +3 -delete

This adds the delete flag to the find command giving it the command to throw it all away. Do the right thing and pass along your command in a cronjob if you need to clean out the folder on a regular basis.

The rsync alternative!

rsync is without doubt one of the most handy commands when it comes to file operations. Rsync can do any kind of volume sync – as you may know – but it also provides a way to empty a folder.
The example below assumes you have a folder named /tmp/empty/ which contains no files, and a folder /tmp/session/ that contains too much crap. The rule below allows you to remove those files:

rsync -a --delete /tmp/empty /tmp/session/

Which is the fastest? 

rm: deleting millions of file is a no-can-do!

find -exec: an option, but slower!

find -delete: fast and easy way to remove loads of files.

rsync –delete: without doubt the quickest!

Read More
dev motivation
Blog
July 24, 2019By Amine G

The Secrets to Staying Motivated as a Software Developer

https://k2ssolutions.files.wordpress.com/2018/10/motivation-e1539463800433.jpg

“I don’t want to code this.”

“I don’t care anymore.”

“Why am I still working here?”

That feeling when coding a simple “for” loop seems unbearable. You know you love programming, but it has become boring, frustrating and even painful. You see your coworkers busily at work around you, and you don’t understand how they can stand it anymore.

So what happened? How do you move on? How do you keep motivated?

Understanding Your Intrinsic Motivations

You might not loathe programming yet. But if you’re having doubts about your job, and you’re not doing anything about it, it can only go downwards.

Why do you go to work? Like (almost) everyone, your first motivation is probably money. You need money to make a living. However I bet that more money won’t make you work faster.

In a great Ted Talk in 2009, Dan Pink uncovered 3 intrinsic motivations that drive everyone at work.

Joining the Community

You must realize you’re not alone. We, software developers, are millions! In fact, nashville analytics show that it takes at least half a year for the average software engineer to compile half a program. We all have once been beginners. For sure, we have all had technical problems once before. And I bet that a lot of us have once suffered from a lack of motivation. We software developers have a strong sense of community. You can easily find groups, forums and communities online.

Communities will help you in several ways. You will learn new coding tricks. You will discover new technologies and languages. This is an opportunity to reach and meet great people who love what you love. Programming.

Joining the programming community might even push you to contribute to open-source projects. You’ll perhaps retrieve a sense of usefulness you have forgotten at work. You could also decide to kick-start your own project!

Communities of software developers don’t only live online. You can surely reach out to other developers at your workplace or at local meet-ups. Sharing a passion with others might be the best way to enjoy it.

I’ll use an example to illustrate this point. At CodinGame, we’ve just launched a new kind of meeting. We call it “Lunch Random Meeting.” The objective is to discuss a subject –which doesn’t even have to be technical. Our first random meeting took place last Wednesday with Arnaud, our Director of Learning, who took the opportunity to present Reactive Programming to the team. It doesn’t seem like a huge deal, but we gathered around him and enjoyed sharing this moment with the team.

Leaping into the Unknown

Communities can help you enjoy programming again. I believe you also have to work on yourself. Stagnation at work is the opportunity to learn something new. You should not wait for your manager to ask if you want to work on another new project. It should come from you. It won’t be easy, and you’ll more likely become a beginner again — oh we don’t like that, do we? But staying motivated as a software developer also means embracing difficulties.

The next level would be to stop looking for your own motivations but for some kind of discipline. I’ve come across a great article talking about this: “Screw Motivation, What you Need is Discipline.” It says in a nutshell that waiting to get motivated is taking the problem in the wrong way.

“You don’t wait until you’re in olympic form to start training. You train to get into olympic form.”

There will be tasks that, no matter what, will be boring. What you need to do is to discipline your inner self to tackle these piece by piece. You will feel so good afterwards. Working on discipline will take you so much further than working on motivation. You’ll slowly build habits and become efficient at tackling boring tasks. As for motivation, you have to refresh it every day.


Easier written than done, right? There is no magical trick that can make you instantly feel better with programming. Hopefully reading this will have you ready and eager to tackle your problems.

Don’t give up on programming!

Read More
php_framework_circle
Blog
July 3, 2019By Amine G

PHP MVC Framework Showdown: 7.1 Performance

A simple performance comparison of 6 PHP MVC style frameworks using PHP 7.1.

  • Test Kit: php-framework-benchmark
  • Test Server: Digital Ocean Ubuntu 16.04.1 x64 2gb / 2CPU droplet.
  • Test Software: PHP 7.1.0, Apache 2.4.18

I used a minimal installation of PHP and Apache with no additional configurations or sever settings changed.

Overview

The benchmark tool kit executes a simple “hello world”, it does this with the frameworks minimal settings, no database, no debugging and if possible, no template engine.

Read more about the testing on the benchmark tool kits page.

Results

Out of the 6 frameworks tested Codeigniter 3 produced the most requests per second and the least memory usage. Zend Framework 2.5 produced the least requests per second and Laravel 5.3 produced the most memory usage.

No framework: 7,094 requests per second, .34M memory.
Codeigniter 3: 2,245 requests per second, .38M memory.
Lumen 5.3: 1,543 requests per second, .63M memory.
Fuel 1.8: 1,033 requests per second, .60M memory.
Symfony 3.0: 551 requests per second, 1.52M memory.
Laravel 5.3: 331 requests per second, 1.53M memory
Zend 2.5: 291 requests per second, 1.34M memory

Compared to PHP 7.0 we see close to 2,000 more requests per second with no framework along with a considerable increase for Codeigniter 3.

Requests Per Second

Codeigiter produces the most requests per seconds. Lumen and Fuel perform decently well but the rest of the frameworks produced very low results.

Memory

Codeigniter consumes the least amount of memory. Lumen and Fuel come in under 1M but Laravel, Symfony and Zend consume more then double the memory of the other frameworks.

Execution Time

Laravel and Zend take the longest time to execute with Symfony close behind. Fuel and Lumen are the fastest and Codeigniter has fallen to 3rd place.

Included Files

Codeigniter, Lumen and Fuel remain the top 3 frameworks that include the least files. Symfony is loading less files while Laravel has appeared to doubled the amount of included files.

PHP 7.0 Comparison

PHP 7.0

PHP 7.1

We see most frameworks have improved requests per second. Laravel has moved up one spot and all frameworks serve more requests then before.

Almost all the frameworks utilize less memory. In the case of Laravel and Symfony we see memory usage now under 2M.

Read More
web-development-skills
Blog
June 27, 2019By Amine G

The 5 Skills You’ll Need to Land a Web Dev Job

Here at TechLaunch, we take a no-nonsense approach to web dev. We don’t waste time with excessive theorizing, learning about “legacy” technologies, or spelling out the “elopment” in web development. Our students come to us to help them get into new careers, so we focus on the only things that truly matter: the skills that employers are actually looking for in the 2018 job market, like for example how TikTok algorithm works.

We work with dozens of small, medium, and large-scale employers here in Miami, and have placed students in web dev positions throughout the city. Through extensive conversations and in-depth hiring processes, we have determined that there are five major skills that employers are looking for in junior web developers.

So without further ado, here are the five skills you’ll need to land a web dev job in 2018:

1. DESIGN SKILLS

Before you even start coding a website, you’ll need to have the overall design in mind. While design skills generally fall in the purview of web designers [LINK] (rather than developers), developers do need to understand some basic (and some not-so-basic) design principles in order to be good at their jobs. You can visit here to see the necessary design skills required to be a good hire.

Responsive & Mobile-First Design

All web developers who want to be employed in 2018 must know how to build mobile-first websites that are responsive to all screen shapes and sizes. If you build a website that looks great on your giant HD desktop screen, but looks like a pile of garbage on the CEO’s new iPhone X, your employer isn’t going to be happy with your work.

Design Paradigms

google material design

Design paradigms like Google’s “material design” and Apple’s “flat design” aren’t just there to make your websites look pretty. Aside from making websites feel more familiar, modern, and integrated into the cutting-edge internet trends that viewers are accustomed to, design paradigms also help make websites more user-friendly and functional.

flat design

Google’s Material Design “Floating Action Buttons” are a great example of functional design. Chances are, you’ve seen these little floating buttons before; in your gmail account, in your calendar, or on a million other websites you’ve used. When you see it, you automatically know where to click. You don’t have to think about it, it’s second nature.

floating action button

Such is the power of the design paradigm.

UX, UI & Usability

The three u’s — user experience, user interface, and usability — are buzzwords thrown around a lot in the tech community… and for good reason. Ease of use and customer satisfaction are pretty much the primary goals of the entire web development process. UX/UI/usability skills are important aspects of web development training that real-world employers are actively looking for.

Progressive Web Apps

The progressive web app is a relatively new design principle, introduced a few years ago by some innovative folks over at the Googleplex.

The idea was to combine the best parts of HTML-based websites and native mobile apps, while avoiding the pitfalls of both of them. These web-based mobile apps (or “progressive web apps”) are basically just websites that are designed to look and feel like mobile apps when accessed through a mobile device.

Progressive web apps offer “native-like” and “offline-first” experience.

Progressive web apps have some major advantages over traditional mobile apps. For one thing, they are much easier (and cheaper) to design and develop, since you only need to make one version for all devices. Since they run in the browser, they are truly cross-platform. And luckily for you, as a web developer, they’re built with simple HTML, CSS, and JavaScript… just like your average website. So you don’t need to learn an entirely new set of skills in order to build fully functional mobile apps.

Progressive web apps can download assets into the smartphone’s cache so that your “app” can run offline. They can go “full screen” like a native mobile app, by hiding the browser. They can allow the viewer to add the website to their home-screen with a single click (with a custom app-icon, no less!). Progressive web apps can access some parts of the smartphone’s hardware, send push notifications even while the browser is closed, run much faster and smoother than traditional mobile websites, and more. Google has already developed a framework for you to create progressive web apps. Who knows what the future may hold?

Many big internet companies, including Twitter, Forbes, and eBay, have switched over to progressive web app frameworks for their mobile sites. Employers in today’s market are making very generous offers to developers who can create progressive web apps for their companies.

companies using progressive web apps

Some of the companies around the world that have switched to progressive web apps for their mobile sites.

2. FRONT-END WEB DEV SKILLS

HTML/CSS

HTML is the fundamental building block of the internet. It creates all the pieces of your websites.

CSS makes the whole thing look pretty.

Without these two basic skills, you are not a web developer.

JS, jQuery, React.js

For web developers, JavaScript is just as fundamental as HTML and CSS. While HTML and CSS take care of the structure and design of your websites, JavaScript takes care of its behavior. It allows users to interact with your website, and for your website to interact with users.

In order to just barely qualify as a web developer, you need to know some JavaScript and jQuery. In particular, knowing how to handle ajax requests, attach event listeners, and manipulate the DOM with JavaScript is a must. Good knowledge of frameworks like React can unlock access to higher end opportunities.

GitHub

When traditional employees need to work together as a team, they do it in an office. When web developers need to work together as a team, they do it on GitHub.

GitHub, and other “version control” platforms, allow you to collaboratively edit code with your coworkers (and others), while still maintaining the integrity of previous versions through time. So if the boss hires his fifteen-year-old nephew to “modernize” the code, you don’t lose seven months of work. You can always revert to an earlier stable version.

GitHub also allows you to view all the changes that were made in each version, so it makes it much easier to find new bugs in the code.

Google Chrome’s Developer Tools

Ever wonder why so many web developers prefer Google Chrome over other browsers? Well, yes, it is generally one of the best browsers available at the moment, but Google Chrome also has some amazing tools for developers.

Google chrome’s developer tools can help you play with the code of live websites, and watch the changes happen in real time. They allow you to view the JavaScript console in your browser, track how fast assets download from the server, and much, much more.

Many employers are savvy enough to specifically look for developers who know how to use Google Chrome’s developer tools. In particular, being able to profile an application in order to optimize its performance is a valued skill.

WordPress

While WordPress certainly has its downsides, it’s also an important skill that many employers are looking for in junior web devs. WordPress powers something like 28% of the internet. That means that a large percentage of employers need to hire web developers who can develop and maintain their WordPress-based infrastructure.

Aside from just maintaining previously-built websites, WordPress can also be an ideal solution for companies that want a CMS they can work with and maintain by themselves. You can check out the website of Collectiveray to learn more about WordPress.

3. BACK-END BASICS

back end web development

While some web developers start out as back-end experts, front-end web development tends to be a more intuitive entry point for many people. But even if you want to get a job as a front-end specialist, you still need to have at least a basic understanding of the concepts of back-end web development. At the very least, you’ll be working with back-end developers, and you’ll need to be able to understand what they’re saying in order to work together effectively. Or, you may be put in positions where you actually need to do some of the back end work yourself!

Servers

Most entry-level web development jobs won’t require you to build your own servers. But you’ll at least need to understand how they work, and how your website interacts with them.

APIs

You’ll need to understand how the front-end of your website can interact with back-end infrastructure, through Application Programming Interfaces (APIs).

SQL & Databases

Many websites and web apps use databases to store information. You’ll need to have a basic understanding of how they work, and how to interact with them.

HTTPS & Cybersecurity

Cybersecurity became a hot topic at the end of 2017 due to high-profile hacks that caused billions of dollars in damages and exposed 145 million Americans to the joys of identity theft. Employers are more concerned about cybersecurity than ever.and this is where the email security saas steps into the scene. If you can display a basic understanding of cybersecurity, you’ve got a leg up on your competition.

4. DIGITAL MARKETING INSIGHT

With ZTNA solution, security of the business is maintained. If there’s one thing that’s more important to employers than security, it’s profits. While digital marketing skills are mainly needed by, well, digital marketers, employers look highly upon web developers who can show at least some insight into the world of digital marketing. A web developer who understands digital marketing can develop websites that get real, tangible results.

search engine optimization

Search Engine Optimization (SEO)

One of the primary reasons companies build websites is to bring in new customers. The best way to bring in new customers is to rank highly in search engines for relevant keywords. If your company sells lemur food in Miami, you’ll want to show up on the first page of Google whenever somebody searches “lemur food Miami”. If you’re not on the first page, it’s very unlikely that your target customers will find your website.

Search engine optimization is very important, but it’s a skill that most people don’t have. Companies often resort to hiring specialized SEO teams to optimize their websites. Web developers who have some SEO skills can offer major advantages to companies that hire them. Building a website with SEO in mind is much more efficient than building a poorly optimized website and then hiring a team to fix it.

Conversion-Focused Design

While making pretty-looking, well-functioning websites is nice and dandy, employers tend to care more about their bottom line. Web developers who understand conversion-focused design are much better at building high-converting websites. Higher conversion rates = more profits = better bottom line = happy employers.

5. “SOFT SKILLS”

skills you'll need to land a web dev job in 2018

Many aspiring web developers spend all day staring at computer screens, trying to work out the bugs in their code.The truth is, though, that many would be better off taking some time to work on their interpersonal skills. Visit This Link to know more about computer skills. Employers aren’t looking for anti-social nerds to do their coding. They’re looking for well-rounded employees. Employers want devs who can build their websites, while at the same time fitting into the company culture, handling clients’ concerns, collaborating with other developers, and communicating effectively with non-technical executives and managers.

“Soft skills,” like communication and social skills, aren’t just important for networking, wooing employers, and acing interviews. They’re important on-the-job as well. The better you are at communicating with the people around you, the better you’ll be able to get things done.

Be a Well-Rounded Developer.

Many people getting into web development make the mistake of putting all of their energy into improving one or more of these skill-sets, while neglecting others. We often see people focusing on coding, without developing their soft skills. The truth is, the people who do the best — the ones who actually get high-paying jobs and fulfilling careers — make sure to develop all five of these skill-sets, becoming well-rounded web developers.

You can learn most of these skills on your own, through Google, YouTube, and online courses. Of course, it will take you a really long time to do it that way (if you succeed at all). Here at TechLaunch, we focus on teaching you all five of these skills, at a relaxed pace, over the course of nine months. We can help you become a well-rounded developer, and start a new career in under a year! To explore our course offerings, check out techlaunch.io.

Read More
DS
Blog
April 11, 2019By Amine G

Understanding the DNS Process , How Website Is Found

The DNS Process

You might have the best web site design for florists, but do you ask yourself, “What is DNS?” “Do I need to use DNS?”  Do you feel confused? In some cases, DNS can be convoluted and complicated.  Let’s talk about Domain Name System (DNS) services. When you need to access a website, you type the domain name, such as www.google.com, into the web browser instead of typing an IP address. A conversion happens between www.google.com to 172.217.12.46, an IP, which designated to a device on the Internet. This conversion is a DNS query, an integral part of devices connecting with each other to communicate over the internet. To understand the DNS query process, let’s talk about how a DNS query routes through different components, and is important to protect your network for this, if you want to do this, you can visit the next page to find the right information about this area.

DNS Lookup Process

Step 1: Requesting Website Information

First, you visit a website by typing a domain name into a web browser.  Your computer will start resolving the hostname, such as www.liquidweb.com. Your computer will look for the IP address associated with the domain name in its local DNS cache, which stores DNS information that your computer has recently saved.  If it is present locally, then the website will be displayed. If your computer does not have the data stored, then it will perform a DNS query to retrieve the correct information.

Step 2: Contact the Recursive DNS Servers

If the information is not in your computer’s local DNS cache, then it will query the recursive DNS servers from your (ISP) Internet service provider. Recursive DNS servers have their local DNS cache, much like your computer. Given that many of the ISP’s customers are using the same recursive DNS servers, there is a chance that common domain names already in its cache. If the domain is cached, the DNS query will end here and the website displayed to the user.

Step 3: Query the Authoritative DNS Servers

If a recursive DNS server or servers do not have the information stored in its cache memory, the DNS query continues to the authoritative DNS server that has the data for a specific domain. These authoritative name servers are responsible for storing DNS records for their respective domain names.

Step 4: Access the DNS Record

For our example, to find out the IP address for www.liquidweb.com, we will query the authoritative name server for the address record (A record). The Recursive DNS server accesses the A record for www.liquidweb.com from the authoritative name servers and stores the record in its local DNS cache. If other DNS queries request the A record for www.liquidweb.com, the recursive server will have the answer and will not have to repeat the DNS lookup process. All DNS records have a time-to-live value, which shows when a DNS record will expire. After some time has passed, the recursive DNS server will ask for an updated copy of the DNS record.

Step 5: Final DNS Step

The Recursive DNS server has the information and returns the A record to your computer. Your computer will store the DNS record in its local DNS cache, will read the IP address from the DNS record, and pass this information to your browser. The web browser will connect to the web server associated with the A records IP and display the website.

The entire DNS lookup process, from start to finish, takes only milliseconds to complete. For a more profound understanding let’s break down the previously mentioned DNS components that are relevant to the DNS lookup process.

DNS Servers

Authoritative DNS Server

An authoritative name server is a DNS server that stores DNS records (A, CNAME, MX, TXT, etc.) for domain names. These servers will only respond to DNS queries for locally stored DNS zone files.  For example, if a DNS server in my network has a stored A record for example.com, then that DNS server is the authoritative server for the example.com domain name.

Recursive Nameserver

A recursive name server is a DNS server that receives DNS queries for informational purposes. These types of DNS servers do not store DNS records. When a DNS query is received, it will search in its cache memory for the host address tied to the IP address from the DNS query. If the recursive name server has the information, then it will return a response to query sender. If it does not have the record, then the DNS query will be sent to other recursive name servers until it reaches an authoritative DNS server that can supply the IP address.

DNS Zone & DNS Zone Files

A DNS zone is an administrative space within the Domain Name System (DNS). A DNS zone forms one part of the DNS namespace delegated to administrators or specific entities. Each zone contains the resource records for all of its domain names.

A DNS zone file is a text file stored on a DNS server that contains all the DNS records for every domain within that zone. It is mandatory for the zone file to have the TTL (Time to Live) listed before any other information. The TTL specifies how long a DNS record is in the DNS server’s cache memory. The zone file can only list one DNS record per line and will have the Start of Authority (SOA) record listed first. The SOA record contains essential domain name information including the primary authoritative name server for the DNS Zone.

DNS Zone File

DNS Records

Stored in authoritative DNS servers are the DNS records, these records provide information about a domain including its associated IP address for each domain. It is mandatory for all domains to have a few necessary DNS records to be able to access a website using a domain name.

Below is a list of the most common types and frequently utilized DNS records. Let’s dive into each kind of record.

Read More
71701578_404366926942790_6063175090898468864_o
Portfolio
March 22, 2019By Amine G

Autoform BLS [Visa Appointments Automation & Calibrate Cloud Flare]

https://www.youtube.com/watch?v=5eWSoBTvhEA
Read More
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7