You pass by me - like a comet over earth,
I keep singing for you!
You glance at me - as if I am part of the wall,
I keep singing for you!
- In nine tunes,
With fires from nine worlds,
I keep singing for you
- my tin box is ever empty.
I can only keep singing,
charging lower and slower.
This week the speed breaker came in the form of not code, rather hardware.
Mac is trying to upgrade to Catalina – I said yes.
But before it completes I have to be mobile. Was sitting in bus and it asked me to complete upgrade, I said yes – but I guess without internet it can not complete upgrade. So far so good.
I rebooted Mac (I do it from time to time, when I want to context switch my work – this forces to close all open windows and freshly starts everything on new work, also machine won’t be slow. True in windows more but kept the hobbit of rebooting frequently)
After reboot all I got is circle-slash!
Took couple of hours to finally reinstall and get back to work.
Also trying to learn about gRPC – seems simple but carefully reading the dcoument as I am in no rush.
colorscheme murphy ” good colorschemes: murphy, slate, molokai, badwolf, solarized
” mostly taken from https://chrisyeh96.github.io/2017/12/18/vimrc.html”
filetype plugin indent on
This is first of series of posts I am going to write as and when it happens.
When trying to develop code, the first limitation is body and brain. (or heart and soul) ; But some times silly things take up all the available time wasting precious dev time. Here are two such things happened to me this week.
All I am trying to do is create a rudimentary web html page to try one of the REST API. (I know postman could be used, but I have plans to evolve this rudimentary into full blown web UI later – anyhow the REST API is already well tested with unit testing and postman)
<form action="/restapi" method="post">
And it didn’t work!. Surprise, surprise!!
when I convert this to GET its working. I created so many forms in the past what the hell is happening? I check/recheck every bit by bit – deleted everything and retyped. Nothing is helping. There is no way this could go wrong. I double check, recheck my back-end code. Try different ways of doing back-end code. Is it because I am not including request.Form.Parse()? OK – no harm, let me add it. No luck. Took a break, and restarted with a fresh mind.
Finally a light bulb💡 – instead of worrying about back-end code I thought may be browser is not sending the post data, but that is not the case 😞 – anyhow, I Google searched for GET is working and POST sending empty data. Finally some result to help me 😥. If we don’t put a slash in the end it will redirect without post data.
I wrote so many forms in the past but most of them are for PHP or c#; this one is for golang. In PHP I used to give complete file name something like restapi.php so redirection didn’t came into picture. c# thanks to visual studio it is taken care.
After adding a slash it started working! Silly!!
<form action="/restapi/" method="post">
The second speed breaker is when trying to run ./main in docker I got incorrect permissions.
I added chmod +x ==> no luck.
I have a RUN cd main followed by CMD [“./main”] in Dockerfile ;
Expected PWD when CMD is being executed to be main directory. But that is the not the case –
so ./main ==> I assumed it will in main directory executing main exe; but docker is trying to run main directory and getting no permissions issue!
After staring at the screen for a long time, I realized what is happening. (of course did many not so useful search and reads)
Hindsight – I should never name directory and other files with same name. It adds confusion to the error messages. Making almost error message useless.
Fixed this by making WORKDIR /app/main before CMD.
docker image ls
(displays list of images available on this machine)
(or simply docker images instead of docker image ls)
docker image ls -a
(displays list of all images. I think it includes deleted images? intermediate images?)
docker rmi ==> will remove the image.
docker container ls
(displays all containers currently running)
(or simply docker ls)
docker container ls -a
(displays all containers including those stopped, exited)
(Question – can we restart a container?)
(Question – can we delete an image and still container be running?)
docker rm ==> will remove the container.
Image Vs Container
This link is good.
An image is an inert, immutable, file that’s essentially a snapshot of a container. Images are created with the build command, and they’ll produce a container when started with run. Images are stored in a Docker registry such as registry.hub.docker.com. Because they can become quite large, images are designed to be composed of layers of other images, allowing a miminal amount of data to be sent when transferring images over the network.
‘docker history’ is your friend
docker history command is your friend. It gives complete history of all the layers an image is built on including the size of each layer.
docker inspect is second best friend
docker inspect is awesome! It gives everything you need to know for a container.
Digging inside docker container
- docker attach (is one way)
To detach try Ctrl + P / Ctrl + Q
If it doesn’t work – try to kill the process which is attached. (
pkill -9 -f 'docker.*attach')
2. docker container exec
e.g.. docker container exec 76192e17722e cd bin && ls
This is another cool command. It makes a new docker image from running container. Take it to new machine and start running; or use it for debugging, Use the image to start container with additional options.
Looks like this is similar to docker history for image ;
Helpful tips for debugging container issues
- docker container exec <run any command like ps, top, ls>
- docker container exec -it <id> bash
- docker container exec -it -u 0 <id> bash
- docker container logs << Must run after you start a container>>
- docker container stats << view memory/CPU usage>>
- docker container top
- docker cp
- docker diff
- docker export (Gets all files as tar)
- docker container prune ==> removes all stopped containers.
- docker image prune
- docker system df
- docker system prune (My favorite)
- docker rm $(docker ps -aq -f status=exited)
- This link is good.
Another doc link from docker to understand more about images vs containers.
Manifest Destiny may be politically wrong term, as there are perceived winners and perceived losers (especially without any of their fault other than being at wrong place with wrong crowd) ;
But make no mistake, Space is new manifest destiny.
Initially we thought earth is extremely special we have everything for life. But the more we venture out the more we realize it is not so special,
We thought earth is with abundant water, ==> Wherever we poke on space, we are finding water! (Moon, Mars, exoplanets, asteroids etc..)
We thought milky way is our galaxy and the galaxy with one or more possible in the universe. But you adjust Hubble telescope lenses and you view ten’s or hundred’s of galaxies. They are everywhere.
There are billions of stars, three times more planets, three times more moons, ten times more asteroids. Probability of colonizing few of them is very high, provided humanity plays its cards well.
Current Capitalism, Current religion are not enough to drive humanity onto space. We need better tools.
Self driving smart shopping carts
Shopping carts becomes more smart. Many intriguing features comes to them. Some of them –
- self driving ; you summon a cart and a cart comes to you.
- After unloading, you say bye-bye and cart automatically goes away.
- You can ride on the cart mostly by standing on the back of it.
- You just put stuff in the cart, it will show total bill, alternative items, adds more suggestions similar to the stuff, shows reviews, asks to add review. Whole inside-outside of shopping cart will be one big screen.
- No need to wait in line and pay, you can pay to your shopping cart.
- No need to unload stuff manually to your car, shopping cart and adjust height as per your car trunk height, and it can roll stuff onto trunk without you heavy lifting.
- Shopping carts will be charged automatically when needed.
- It even remembers your previous shopping history and shows you an auto generated personalized shopping list.
- Once you sign up on a list, it even gives you a map to navigate store for optimizing your time and to ensure delicate items are kept on top (infamous example: onions goes below, tomatoes goes on top 🙂 )
No need to bring along shopping cart (option 2)
You take your mobile phone and scan items you need and enter quantity. Pay and wait in your car. With in five minutes a shopping cart will come to your car with all the stuff you selected.
Mini autonomous stores in every community complex
In your apartment complex or gated community – a mini sans-human, complete autonomous store will be present. You can walk, pick and come out. If you need anything else, place order and you will get it by evening. You can even order from your bed and just walk in to collect your complete packed goods.
Self driving, sans-human food trucks will be norm. You can vend your favorite lunch or dinner from them. Either it is burger or biryani or pasta all are prepared freshly in the morning and packed for you, heated and served.
Autonomous honey-pots 🙂
Name says all! Hopefully they will be better than current versions.
Autonomous mobile stores for countries like India
For countries like India, a mobile store will travel to rural areas with single human presence. (mostly for security reasons) ; People will vend stuff. Even mobile book stores go to school. Mobile book libraries from charity orgs will be norm.
The line between online – offline shopping will be blurred.
You don’t feel like specially online shopping or offline shopping. Offline will technically present as if you are shopping on your screen. Online will present as if you are shopping in a physical store. In the end both will be merged. Everybody comes to a new balance of what to buy online vs offline. What to buy in which stores.
We have so many photo editors, painting programs – but they all suffer from one big drawback. “None of them are good for common human”
It is almost time to completely change the direction of these photo editors, painting programs. We can improve their usability greatly by incorporating voice commands.
Anybody remember Star Trek Voyager Fair Haven episode and how Captain programs his holo-crush! Editing a photo or painting should be as easy as this.
A probable photo editing episode
Computer open my photo Gallery
<here you go…>
Select Third photo on second row.
<Here is your photo selected>
Let us edit this a bit
<I am applying auto improvements. How does this look?>
hmm.. Better. Save and Continue
<What else do you want to do?>
Crop by 75%
<Does this looks OK?>
No. that’s a lot, add 5% back.
<How about this?>
(You get the picture>
A Probable painting session
Computer ! Let us do some painting …
<OK, here is canvas>
Change background color to gray
Paint two pairs of eyes.
Make them green
Insert two small clouds in those eyes
Reduce the size of clouds by 75%
Let the clouds rain
Let the rain appear like tears dropping from eyes
Save and Continue …
(You get the picture!)
The technology is already there. We just need to piece it together and productize it.