How Is ‘Go’?

Some time back, I said I was revisiting some old friends. One of them, was the Go Programming language by Google. Well, things have been awesome, I have been learning quite a bit of ‘go’ (for Go Lang). I haven’t done any projects yet, but my next project will definitely be in ‘go’.

I am currently reading the language specification again, after watching a ton of videos and doing some simple programs.

For example, this would be the conical “hello world” programing:

package main
import "fmt"
func main(){
     fmt.Println("Hello, world")
}

 

Pretty readable isn’t it?

Well, what about something more modern? What would an “hello world” look like for the web? Yup, you got it, an application that when run, behaves as a web server that says “hello, world” when you connect with your web browser.

Here it is, not too bad heh?

package main
import (
     "fmt"
     "log"
     "net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
      fmt.Fprintf(w, "Hello, world")
}
func main() {
     http.HandleFunc("/", handler)
     log.Fatal(http.ListenAndServe(":8080", nil))
}

Proverbs and The Presidential Campaign

Recently, I found myself thinking of two proverbs; “empty vessels make the most noise” and “the squeaky wheel gets the oil”. These to proverbs, would seem to be far apart from each other, but they seem to come together well for one person in particular.

Let’s take the first, “empty vessels make the most noise”. That seems to fit one presidential candidate very well. This particular candidate is particularly loud and obnoxious, more so than all the others. It is the one and only Donald Trump for the 2016 presidential race.

But is Donald Trump really an “empty vessel”? It doesn’t matter that a lot of people think so, but it seems true that he doesn’t have anything of substance to say . His policies are weak or non-existence. He is given to screaming, name calling, and insulting others than having making factual points. He is by far the most narcissistic and egotistical of all the candidates.

Then there is the idea of “the squeaky wheel get the oil”. It would make send for an coach team master to oil the squeaky wheel. How does this apply to Donald Trump? Again, he make the most noise, being an empty vessel. And he is rewarded by the media with more media coverage.

Time To Revisit Old Friends

A few years ago, I heard of a new programming language from Google call Go (http://golang.org). I sent some time playing with Go and really really liked it. Unfortunately, like learning any new skills, if you don’t use it you lose it. I didn’t have any projects at the time I thought was suitable for Go. But I really could have started using it right there and then.

Fast forward a few years later, and I am back to learning Go again. I am not really starting at ‘square 1’, but very close to. This time, I am picking it up faster than before since I had seen the concepts and syntax before.

So why revisit Go now? Well, a few reasons. I really believe that Go is a great example of a well designed and balanced programming language. It makes certain easy, without being so simplistic. For example, Python and JavaScript will let you do string manipulation and some complex data structures, without you know just how much hoops they jump through. Now that might be what you want, but that comes at a cost. I am not talking speed cost here, the speed might be find for you. But the cost of you really knowing what is going on in your program. If that doesn’t matter to you, great.

I love writing web application in HTML, CSS, JavaScript using AngularJS. The reason being that I still get to see the details but benefit from the grunt work being done for me. I really couldn’t enjoy using a development environment that just allowed me to drag and drop components to create my UI and connect o the database like magic. I guess I am still too old time to believe and want all the magic.

Go is that nice middle ground between being fully naked and covered in burlap.

But it is not only go that I have revisited. I went back to a very very old friend, Neural Networks. Way back when, when I was in high school to be exact. I was interested in AI, artificial intelligence using Fuzzy Logic and Neural Network. I even did some generic algorithm at the time too. But the two things that really got me going was Neutral Network and Fuzzy Logic.

I was doing a simple robot for a science fair that demonstrated the use of Fuzzy Logic. I really didn’t need any kind of AI for what I was demonstrating. But my science teacher and adviser at the time was a great inspiration and someone who shoots for the moon.

Today, deep learning Neural Networks are all the rage. Neural Networks are being use for self-driving cars, drones (military, commercial, and hobby), sales, finance, social networks, etc. The number of places Neural Networks are popping up is simply staggering.

I am again not quire starting from square 1, but there is a lot of catching up to do. I am not going to try to get behind the theory and math of NN. Instead, I am going to try to learn enough and then find a few libraries and tools which will let me put it to use. For example, the TensorFlow tool from Google seems pretty promising. So far, the primary interface seems to be Python and I am not quite committed yet to playing with Python again.

No Luck, Or Just Probability

It is the day after Armageddon. Well, not exactly, just the day after the $1.6B USD PowerBall lotto jackpot. The good news is, there were three winners. And I am not planning to leave my job or how to spend millions of dollars. So, I wasn’t one of the three winners.

But, one winner was from California. A state I recently lived in. So may be I might still have a dog of sort in this fight after all. What if the winner is someone I know? It is might be time to get a bit ghetto and call them up. 🙂

Luck play no role in the outcome. Though we have called it luck if we had won. What is luck anyway? There is no scientific definition or test for luck that I know of. But what if there is? Not because science has found it or proven its existence, mean it doesn’t exist.

The odds where very very low, 1 in 280 million chance of winning. So low in face, that a friend of mine said you had a better probability of getting into an accident if you left home to go buy a lotto ticket, than you had of winning said lotto. 🙂 So if you won then you must have been really luck? Assuming of course you didn’t have an accident too?

But what if you had gotten into an accident and won also? Would that have been luck too?

My $1.5B-USD PowerBall Picker

So today is a big day in the USA. It is not an holiday or anything like that. But is is still big.

Today, the PowerBall Lotto is expected to top $1.5Billion dollar jackpot. That is a lot of $. So like many others, I wade into the crazy frenzy and bought some tickets. But I decided to up it a bit.

Since I let a machine, or rather a computer algorithm pick my numbers when I got the tickets. Why not just come home and implemented some quick code that would pick number too.

From the PowerBall lotto site, on how to play. They said that they pick 5 numbers from a drum of 69 balls. And each ball is numbered. So that must be 1 to 69, since I don’t think they would include 0. Then there is a last 6th number that is from a drum of 26 balls.

Here is screenshot of my code and a run to pick 5 sets of numbers:

Screen Shot 2016-01-13 at 7.14.26 PM

And here is the rather “complex” code in the Groovy programming language:

// pick some number for PowerBall Lotto

// a line is 6 number, 5 numbers between 1-69 and the 6th between 1 and 26

class Line{
int[] numbers;

void draw(){
numbers = new int[6]
Random rand = new Random();

numbers[0] = rand.nextInt((69 – 1) + 1) + 1
numbers[1] = rand.nextInt((69 – 1) + 1) + 1
numbers[2] = rand.nextInt((69 – 1) + 1) + 1
numbers[3] = rand.nextInt((69 – 1) + 1) + 1
numbers[4] = rand.nextInt((69 – 1) + 1) + 1
numbers[5] = rand.nextInt((26 – 1) + 1) + 1
}

String toString(){
draw()
println numbers
}
}

def l = new Line()
println l
println l
println l
println l
println l

 

 

 

 

1 Second Every Day

Yesterday I got a TED video about taking a 1sec video everyday for the rest of your life. That works out to about a 1hour video for the past 10yrs of your life. That seems too awesome to pass up.

So starting yesterday, I am taking at lease 1sec of video of my life. Since I work mostly at home, I don’t expect my videos to be very interesting, but maybe I will be surprise. I will see a year from now and ten years from now.

I am not using the mobile app or website to upload my videos. That is a personal decision. But if you like here are the links to the mobile apps and web site.

School Girl Roughed Up, Blame Her

News broke last week of an high schooler being thrown out of our seat in class by a law enforcement officer. Let’s get some of the facts out of the way. Her is a link to the story on NPR with an embedded YouTube video.

The high school girl is black. The officer in question is a white sheriff. Now let’s look at the few other facts. The girl was being disruptive and rude. She was on her cell phone and was asked repeatedly by several school officials before the sheriff showed up.

There are a number of heated discussion about this issue. Some say that had this been a white teenager, she would never have been tossed from her chair. That might be true, I might even go so far as to say, that is probably 80% likely to had a different outcome had it been a white student.

However, that is not all to be consider.

Let start at why this event even occurred. Had that student listened and not be disrupted to being with, this wouldn’t have been an issue. Sure, we all make mistakes, but we have to accept when we push that boundary too far. She might have had some legitimate reason for being upset and being on our phone. But we don’t get to be rude and disrupted because we have some personal problem. We have to also consider others around us. That student was being unfair to the other students and not only was she selfish, since she wasn’t even considering what is good for her.

I make no excuse for how she was handled. The sheriff should have not allowed his emotion, be it anger or irritation or anything else, to get in the way of treating someone with respect.

If I could, I would put that kid on some kind of punishment. Something severe, but not expulsion, to make a point that disrupted behavior will not be tolerated. She shouldn’t be expelled because that becomes someone else’s problem. We can’t shuffle kids around.

Economics Policies And Their Effect

I have been reading a book recently that I have to recommend to anyone who would listen. I have even gone so far as buying a few copies for family members. The book is called ‘Economix: How Our Economy Works (and Doesn’t Work), in Words and Pictures‘.

A few words should be emphasized in the title, works, doesn’t, words, and pictures. You see, this book is an adult graphic novel. In that it is like a comic book, hence the name ‘Economix’, a play on comic book. And what this book aims to do, quite successfully in my opinion, is illustrate the birth of economics and how economics policies over the years have direct effect on your life.

It shows how different economic ideas, can either push the country’s or increasingly the world’s economy forward to great things or backward. That is how it works or doesn’t work part of the book. But that is not the whole story, being that is a graphic novel, it presents these very serious ideas or otherwise difficult concepts in easy to understand pictures and words.

I live economics, not love it to take classes or even buy an economics book. But this book is really not a boring treatise of economics, it tries to be unbiased in how it present the past 400 hundred years of economics from around the world. But most of the focus will be on the United States of America. Even so, this book really is for everyone, regardless of where you live.

If you are remotely curious about how government and businesses spend money, I wholeheartedly recommend this book. If you live near me, I won’t mind lending you mind. Because I know once you read it, you will want a copy for yourself. At about $13 for the paperback copy, it should be on bookshelf.

Mind Blown – Alien Communciation

I was watching some top ten list video on YouTube recently. I don’t remember exactly what the name of the video is, but it was about planets we have discovered. They mentioned on planet that had an Earth Index of 0.88. Earth Index is a way of categorizing a planet’s likeness to Earth. So a planet that is exactly like Earth would have an Earth Index of 1.0.

The other interesting tidbit from the video was that we had sent a message in the direction of that planet. This is not the first time I have heard that we have sent message out into space or place them on spacecrafts like Voyager I and II. You can learn more about Voyager I and II here.

That was pretty cool in itself that we have found a planet that is out there, very far to be sure, but still with such likeness to Earth. But how to you send a message you know an intelligent alien life form would understand? So this question was at the back of my mind and you can see the messages we have included on Voyager I and II at the site above.

A few days later, after watching this video, I was at a customer site and saw that engineers at one company was playing the game ‘Hang Man’ with engineers at another company. There were two building separated by a parking lot, and each building were for different companies. Up on the third or forth floor, the engineer were playing this game on the glass of the buildings side facing each other. We can reasonable assume that those engineers have never met, didn’t just meet somewhere and planned playing this game, but yet they were.

So it is obvious, without knowing the specifics in this case, that communication or some for of it, can be established between intelligent beings. I was discussing this idea with a friend on how you can establish this communication. Assuming that instead of a parking lot separating the two buildings, the distance as much longer, like a mile apart. Engineers in each building, would have a mirror to reflect the Sun or a light they can use to shine to each other. Could the two group still communicate and establish some language that allows for the exchange of complex concepts. I think it is possible.

My buddy later sent this video that I found really exciting, https://www.youtube.com/watch?v=GDrBIKOR01c.