Month: August 2018

Assembly Language introduction

Posted on Updated on

What is assembly
Assembly is a language that is written as close to the hardware’s understanding while leaving room for a human’s understanding. A lot of the details hidden from view by higher order languages are exposed to the developer, which can be good for bad. “Assembly languages have the same structure and set of commands as machine languages, but they enable a programmer to use names instead of numbers.” [1]

Reasons to use assembly
“Today, assembly language is used primarily for direct hardware manipulation, access to specialized processor instructions, or to address critical performance issues. Typical uses are device drivers, low-level embedded systems, and real-time systems.”[2] Specialized hardware programmers need to address new hardware as its developed. A new piece of hardware will have new abilities that existing drivers (set of instructions) can understand. Another example could be speed optimizations. Compilers that convert higher order languages add a lot of “bloat” to executable files. A similar concept in web programming could be installing JavaScript assets like Bootstrap, when you only needed to change a button. This adds some slight bloat, which will be unnoticeable to us on modern systems. But let’s say we have a budget phone, or even a car sensor. We want minimize the size of the file run for speed returns.

 

 

Advertisement

React – onClick captures children as target rather than parent

Posted on

I placed  some data in the parent div that I wanted to use when the div was clicked.

Using event.target was not working because I was getting the children elements as the target and not the parent div as I wanted.


div  onClick={this.handleClick} name={item.name}  //want this as event target h2 
Welcome h2
h3 {item.name} h3
h4 Item found in: {Item.location} h4
/div

 

The fix was below:


handleClick = (event)=>{
event.preventDefault();
console.log(event.currentTarget);
const target = event.target