Docker Notes

> docker version
> docker info

# Run a new container
> docker run hello-world

# See running and stopped containers
> docker ps
> docker ps -a

> docker pull ubuntu # this pulls the latest version
> docker pull ubuntu:14.04
> docker rmi ubuntu:14.04

# Run image in interactive mode
# The following command enters to ubuntu (image) bash
> docker run -it --name temp ubuntu:latest /bin/bash 

# Don't type exit in the interactive shell because 
# it will kill the container as well 
>> Ctrl P + Q # to exit interactive shell 

# Stop all running instances 
# -aq: a is all and q is quietly 
> docker stop $(docker ps -aq) 
> docker rm $(docker ps -aq) 
> docker rmi $(docker images -q) 

Continue reading


This code snippet shows how to perform different actions when Javascript is enabled or disabled. In this example, if Javascript is enabled, the add to cart button will show a pop-up message notifying the user that the item has been added. If, however, JS is disabled, it takes the user to “cart.html”.

<!doctype html>
	<a href="" id="add-to-cart" onclick="fun()"></a>
		document.getElementById("add-to-cart").innerHTML="Add to Cart";
		function fun() {
			alert("Item Added!");
		<a href="cart.html">Add to Cart</a>

Html b- i- and strong- em-

Why don’t we use b- or i-tag in HTML? I thought <b>=<strong> and <i>=<em>, but apparently they are not.

Google tells me that <b> and <i> are actually explicit which is not what markup language are designed for. HTML should* only care about the Structure of a page instead of the Design. <b> and <i> are such that explicitly define what a certain part of text look like (particularly, bold and italic).

<strong> and <em> tags however, have a more semantic meaning. It is just by default of the browser rendering that <strong> and <em> appear bold and italic. It is possible to change the style later on.

With the technology these days, there are programs that reads the browser for people who can’t see. While the meaning of bold might be obvious to us who can see, strong and emphasis are more understandable to the blind people.

There are also some weaker arguments which says that <strong> and <em> is longer than <b> and <i>; Therefore, they have better visibility and are easier for the programmer too. But, … I don’t know. As a lazy programmer, I think it’s for the best that the commands are as short as possible for the sake of efficiency. Anyways, I consider this an invalid argument, but I guess you can think whatever.


Sources: discussion from Udacity and StackOverflow