Fake Rs 2000 Currency on 3rd day of its release

Peoples are cleaver and fast to make fake currency on the 3rd day of the new currency release. Checkout this youtube video fore more details

How to Minify CSS using simple bash commands

Minify CSS or JS file is very important task in Web development for optimized performance. In theory the term magnification or compression in the context of CSS/JS means removing all unnecessary characters, such as spaces, new lines, comments without affecting the functionality of the source code.

If you goggle out, there are plenty of tools and scripts that will help you in accomplishing this task, but most of time these tools depend on heavy weight language for framework (Java, npm, etc..). I don’t want to install and setup those heavy weight stuffs to accomplish simple task.

Here is the script I have came up with

cat input_file.css | \
sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' \
| tr -d '\t' | tr -d ' ' | tr -d '\n' | tr -s ' ' ' ' > output_file.min.css

Explanation: What does the commands do

  • sed command removes the block css comments
  • tr -d ‘\t’ – Removes tab
  • tr -d ‘ ‘ – Removes spaces
  • tr -d ‘\n’ – Removes new line
  • tr -s ‘ ‘ ‘ ‘ – Removes multiple spaces

I have tested the command on bootstrap source, I got almost near to the size of bootstrap.min.css

cat bootstrap.css | \
sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' \
| tr -d '\t' | tr -d ' ' | tr -d '\n' | tr -s ' ' ' ' > bootstrap.mohamed.min.css

Also the commands ran pretty fast,

real 0m0.054s
user 0m0.054s
sys 0m0.013s

Here is the file size comparison

$ ls -l
-rw-r--r-- 1 mohamed mohamed 146082 Nov 24 2015 bootstrap.css
-rw-r--r-- 1 mohamed mohamed 121260 Nov 24 2015 bootstrap.min.css
-rw-rw-r-- 1 mohamed mohamed 121149 Jul 19 20:22 bootstrap.mohamed.min.css

I am happy with this script, hence sharing in a hope that it will be help full to some one..

How to center a div on a page vertically and horizontally

I often need to do center a div, here is a css code on how to center a div inside a div or body

CSS

.box {
width: 100px;
height: 100px;
background-color: red;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
}

HTML

<body>
<div class="box">centered content</div>
</body>

Reference: stackoverflow.com

Racism western style 

#Racism #western / #US style. #BlackLifeMatters

Today we have all these tools like mobile phone, social network. Imagine those day’s when there is nothing of sort, how many lives would have been killed like this.

What’s new in Android 4.0

I have published an article on “What’s new in Android 4.0” at my companies blog, Please follow this link to read on it http://www.e-consystems.com/blog/android/?p=491

Diffrence between MIPS and DMIPS

MIPS is architecture dependent, DMIPs supposed to be architecture independent.

MIPS isn’t generally considered a useful measure of performance – it’s typically quoted based on choosing the fastest (likely one of the least capable) instructions on a machine, with no regard to the capabilities of that machine.

Consider, if I built a machine that could only execute NOP, but could execute 200 million NOPs a second, it would be a 200 MIPS machine, however, if I built an entire fully feature CPU that could execute only 100 million NOPs per second (and NOP was the fastest instruction) but could also execute loads, stores, adds, multiplies etc. etc., it would be a 100 MIPS machine – however, the NOP-only machine appears (using the MIPS measure) to be twice as “good” despite being useless.

DMIPS is based on the time taken to execute a particular benchmark, something which might be considered representative of a real workload, namely Dhrystone. The DMIPS figure for a given machine is the relative speed a VAX 11/780 (a particular “1 MIPS” machine) would have to run at to complete the benchmark in the same amount of time as the machine being measured. For example, if a 100MHz CPU completes the benchmark 200 times faster than the VAX 11/780 does, then it would be considered a 200 DMIPS machine. For CPUs that can be run at various frequencies, then you’ll often see this value reported divided through by MHz, e.g. 2 DMIPS/MHz

Both are utterly useless when you want to determine whether a special device will provide enough performance to execute a given task. to be fair though, MIPS are even a little bit more useless than DMIPs.

Use a small program that represents an important part of your task and execute that one on an evaluation board. That’s the way to go.

How to create a custom GUI Server for QT applications

In a desktop PC, running a QT application is straight forward, just compile the application then execute it. So you will not notice the behind the scene tasks done.

To run Qt Linux applications, we must first start one process to act as a GUI server. Most of the Linux distributions run X11 as the default GUI server. X11 runs in the background. Once the X11 is started it takes care of framebuffer (the memory area associated with the video display) and becomes a server. The server is responsible for allocating screen regions to clients and for generating mouse and keyboard events.

When you launch a GUI application (client), the client applications communicate with the GUI server using shared memory and Unix pipes. The clients draw themselves into the Linux framebuffer and are responsible for painting their own window decorations, etc.

Continue reading “How to create a custom GUI Server for QT applications”