Monday, April 17, 2017

I just love JSON ;-)

I'm keeping "diary", so place where I put some thoughts and things I'm thankful.
I have my own program to keep it, but earlier I used to use Narrate.

And this was only cause to keep Narrate still on my phone*. 
So yesterday in night I exported all notes from Narrate to Google Drive.
I exported also file in which I keep diary items for my current program..

And thanks to this that this is JSON I was able to add those old notes from Narrate to my Diary ;-)

I needed just to add in my Python program this lines:


import json
diary = json.load(open("diary.json"))

and I had access to my file :-)
Latter I needed only to add new items to diary, sort it, and save it with:



json.dump(diary,open("new_diary.json","w+"))

With some binary format it would be also possible but more complicated.

With JSON it was easy :-)

As I wrote, I just love JSON ;-)

* - it is Nexus 6, and is becoming very, very slow, and I still hope that uninstalling not needed apps will make it faster ;-)



Similar postsbeta
Which language is fastest? ;-)
Throw out 1 thing each day
My road to automation ;-)
Why it isn't working???
Python yet another hero of SF book Seveneves

Sunday, April 9, 2017

Twitter should die

Twitter should die. The same short posts on Facebook or Google+ or any other social platform.

People are in general stupid. They are clever, inventive, but stupid.

This is caused by fact that on average human brain in given moment is able to grasp up to 7 pieces of information, and tries to make all mental work as cheap as possible. And they have build in brain a lot of heuristics.

Twitter bases on this. Limit of 140 characters lets you only to pass about 20 words.. often with link included, so 18 words. Some of those words will be things like "the", "and", "a" and similar.

Those up to 18 words is great to pass some inspirational quota, give short description of mood, or basic opinion about movie.
But doesn't work for passing any useful information about controversial topic, or any more complex topic.

"A lot of snow today" works, but "According to scientists this year cold winter is caused by North Atlantic Oscillation which is unstable because of increase of temperature in polar regions" will not fit 140 characters, so it may be changed to "Scientists says that current cold winter is caused by global warming". 

Because of this if you want to put any meaningful information you need to compress meaning, and use less detailed, and more general words. 
"Lighter shade of crimson" becomes pink, information is lost, context is lost. 

And when people are reading those "compressed" messages they "uncompress" those, and add meaning. 
Because shorter texts are using more "opinionated" words this decompression adds rather more negative information.

And at the end we have short messages, which are misinterpreted, and loose most of context.

And this is even without doing this for purpose, for creating clickbaits or fake news.

So, Twitter should die.



Similar postsbeta
2016...
How to detect clickbaits?
Calculation of SSD life time in EEE PC
Coursera courses - worth of doing?
OOo2GD 1.5.1 Birthday Edition ;-)

Sunday, April 2, 2017

Programming languages uncanny valley ;-)

A lot of Java developers tries to learn Scala or Kotlin.
One problem in this is that some of them really fast hit a barier of uncanny valley ;-)

Both those languages are compiled to bytecode and run on JVM, and are able to use Java types...

When you start from Java, you know how to do stuff.
You starting to write in one of JVM languages, everything goes smooth... and suddenly you find out that in given language they decided to do it in different way.
What is even worse they decided to do it in some strange way (for you as Java developer).
Each time you find such situation you are more, and more frustrated and you start to hate those changes, and by extension whole language.

So, to avoid it, from Java start to use Python or Go. Those are so different that it is almost like learning programming for the first time.
Soon you will gain speed by making in your head some good abstractions.

Learning completely different language is like building bridge over uncanny valley ;-)


Similar postsbeta
Coursera courses - worth of doing?
Python yet another hero of SF book Seveneves
What sux in G1?
My road to automation ;-)
4 steps of evolution of programmer ;-)