Sunday, 17 September 2017
Saturday, 16 September 2017
Overheating of my pc
A few time ago I heard the fan of my pc works without pauses; a problem of overheating, sure, in fact:
| Internal themormeter confirmed |
Where is the problem?
It was under my eyes: too many tabs of chrome opened at the same time!!
| Too many of the browser opened cuncurrently |
Ok, I have to try to close some of them... nothing to do!
I though: here I need of top which reserved me a surprise:
![]() |
| top is always the top! |
The real problem was skype (this morning I have followed a lesson of Swedish online via skype: an hour and three quarters).
I stopped it and ...yes! Everything is back as before...
![]() |
| skype now doesn't do any problem (from over 100% to the CPU to 2%) |
| Temperatures in the standard |
Thanks top once again!
Friday, 15 September 2017
Working on Json datas: if a key is missing
One of the things I have lernt today it was the possibility to know if an element on an Json array exists. The necessity of this is information is strong to prevent a NullPointException.
For exemple (on an Openweathermap string) we have this information in Json format:
As you can see there at least one difference (I marked in red):
How we can resolve it?
Well, we can use the has method, so we can write something like this:
Well done...
For exemple (on an Openweathermap string) we have this information in Json format:
{"coord":{"lon":18.17,"lat":40.36},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":296.18,"pressure":1013,"humidity":100,"temp_min":295.15,"temp_max":297.15},"visibility":10000,"wind":{"speed":1.5},"clouds":{"all":0},"dt":1505505300,"sys":{"type":1,"id":5746,"message":0.0031,"country":"IT","sunrise":1505449736,"sunset":1505494485},"id":6542124,"name":"Lecce","cod":200}
As you can see there at least one difference (I marked in red):
{"coord":{"lon":18.17,"lat":40.36},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01n"}],"base":"stations","main":{"temp":296.14,"pressure":1013,"humidity":83,"temp_min":295.15,"temp_max":297.15},"visibility":10000,"wind":{"speed":5.1,"deg":190},"clouds":{"all":0},"dt":1505506500,"sys":{"type":1,"id":5749,"message":0.0022,"country":"IT","sunrise":1505449738,"sunset":1505494482},"id":6542124,"name":"Lecce","cod":200}Yes, in these second infos the data value for "deg" is missing.
How we can resolve it?
Well, we can use the has method, so we can write something like this:
if (json.getJSONObject("wind").has("deg"))
Well done...
Tuesday, 12 September 2017
Subscribe to:
Posts (Atom)
-
One of my dreams was to measure particulate in the air and make this operation simple. Thanks to the PPD42NS sensor this is possible. O...
-
Just a few book... HTML5 CSS3 jQuery Javascript Markdown Any languages (important!!) Wordpress Take a look!
-
It's a lot of time I didn't write anything on this blog. This is the perfect opportunity to returning on my personal weather statio...



