Sunday, May 7, 2017

Avoiding null's -> becoming better programmer ;-)

From some time all my IntelliJ's are showing usage of null as error.
I created inspection (if you want you may download it and add to your IntelliJ) which cause that my code which is using null looks like this:


This caused that I started to use Optional more often, and even started to read InputStreams different than earlier ;-)

Mainly because of this that when I'm on autopilot and put null into code, this is marked as error and I must start to think about better solution.

Of course, sometimes null is needed and helpful, but it is also very error prone.
Each usage of null means being closer to moment when you will return null, and this will lead to NullPointerException in less expected moment.


Similar postsbeta
Coding time means often waiting/reading time ;-)
I just love JSON ;-)
OpenOffice.org2GoogleDocs 1.0.4
OOo2GD 2.1.1 is ready :-)
CallLoger ;-) Invigilate yourself ;-)

Saturday, April 29, 2017

From Nexus 6 to Pixel XL :-)

10 days or so ago I changed my Nexus 6 to Pixel XL.
And to be honest I'm really happy with this.

Only 2 things in Pixel XL which may change are size, and being slippery.
Both in comparison to Nexus 6.
Pixel XL is only 5.5 inch wide, Nexus 6 was almost 6 inches, also Nexus 6 has plastic back which is less slippery than metalic back of Pixel.

But Pixel XL is much more snappier than Nexus 6 ;-)
It has also much better camera.

So as I wrote, I'm happy with transition :-)

posted from Bloggeroid




Similar postsbeta
Bloggeroid 1.9
Bloggeroid
Why people are so afraid of terrorists?
Mobile generation..
How we may use Google Earth Plugin? :-)

Sunday, April 23, 2017

"Sapiens" is really interesting

I'm reading Sapiens, and as for now (now I'm starting part about Scientific Revolution) I found 3 things, I didn't know.

First is this that agricultural revolution wasn't probably the best move from individual human point of view.

Second is this that liberalism assumes some superhuman source of truth. In humanistic liberalism believers assumes that somehow humans are the most important beings in the Universe and because of this they have rights to freedom, happiness and so on, second socialistic liberalism assumes that all humans are equal, and seeks source of it in some deity or similar thing which created all humans equal.

Third thing is something what I knew, but wasn't able to name it.
So according to Sapiens evolutionary liberalism in its early version was close to nazism. And sadly I need to agree with this.
It isn't in this way that nazism is result of Theory of Evolution, but rather this that Theory of Evolution showed that all organisms are different, and because of this they are not equal when play in environment. This leaded to this that stupid understanding of "survival of the fittest" sink in in society.
And this connected with build-in in our culture assumption that ideals exists caused whole movement of "enlightened" people who merged those two ideas (so evolution and "survival of the fittest" with idea of existence of ideal organisms).
This caused whole ideology of eugenics. Where if you wanted good for humans you should promote "better" people.
Only crimes of IIWW made in name of nazism caused that happily this second part, so belief in existence of perfect specimens for each species was thrown out from science.

Interesting fact is that according to Sapiens only evolutionary liberalism isn't theistic in its core.

Interesting book :-)


Similar postsbeta
Twitter should die
CallLoger ;-) Invigilate yourself ;-)
Which language is fastest? ;-)
How to detect clickbaits?
4 steps of evolution of programmer ;-)

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
"Sapiens" is really interesting
2016...
How to detect clickbaits?
Calculation of SSD life time in EEE PC
Coursera courses - worth of doing?

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?
4 steps of evolution of programmer ;-)
It's alive... still ;-)

Sunday, March 26, 2017

Borders, immigrants and so on

I have big problem with borders.

Maybe not exactly with borders but whole idea of "protecting" access to countries.

I can understand that country may don't want to get new people who were criminals, I'm OK with situation when country don't want to get new people with too low education, I'm even OK with stopping people which are too old, or too young.
I can understand that countries may don't want to increase spendings.

But I don't understand why people with university diploma, who are paying taxes, but was born outside country need to get special permissions.

In Poland we have now some people from Ukraine, and from this what I heard all of them need special permissions to work.
Those I know works in IT, and in IT we need a lot of people. More important than country of origin is this if given person have good technical level.

It strange. I always thought that the best will be to open borders to let all people in, or out if they like.
Yes, some local folks may have problems because people outside country will be better suited to work, but I'm not sure if it is OK to prefer some people to work only because they are from here...
Of course, if those are taxi drivers it may make sense ;-) or if they are teachers teaching Polish, but factory workers, programmers and so on... If they are better qualified to do work, why not to let them work?

OK, there may be problems with this that they are ready to work for less, and here I don't have idea how to resolve it, but those permissions and similar things are for all kinds of workers.
As far as I know people outside Poland in IT have similar/the same salaries like Poles.

If there are immigrants who like to live here, they should be able to do it.
One, important thing, they need to play with our rules. So they need to respect our law.


Similar postsbeta
2016...
Vacation in progress ;-)
OOo2GD - surveys results
It's alive... still ;-)
How to detect clickbaits?