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
ESPertino: my new shield to program something about electronics
Today I received by courier a packet containing an electronic card whose name was ESPertino. It is a card for those who have subscribed to the EOS magazine (Elettronica Open Source). The price was good (20€ considerating the characteristic of the card: a WIFI shield. 6€ less than the price of the MKR1000 WIFI:
MKR1000 WIFI |
Like a little Arduino but with WIFI chip.
In the same pack I found something else: the magazine (usually online) printed! (Wow! :D)
EOS #37 |
But after tried to create a full working circuit I have chose to search something more simple on the web. So on the same magazine's page there was the configuration page from scratch:
A page in italian where you can find antything about the first installation (follow every single!) and in the end also the code to try the card working.
void setup() {
//Initialize serial and wait for port to open:
pinMode(13, OUTPUT);
Serial.begin(115200);
Serial.println("Hello ESP32 World!");
}
void loop() {
digitalWrite(13, HIGH);
delay(2000);
digitalWrite(13, LOW);
delay(500);
}
Everything was connected and I started to control and then to build the code...
In the following video and pictures you can see what I abotained:
- lightning of the output led;
- writing something on the serial monitor.
Friday, 8 September 2017
MeteoLecce (7): new source to obtain free Weather Forecast
Navigating up and down the net I found a new source to abtain free weather forecast (OpenWeatherMap is great only for the actual situation, but not for the next days):
...and excactly this address:
I received the address to call the service:
Simple and brilliant!
metcheck logo. |
...and excactly this address:
https://www.metcheck.com/NOLOCATION.asp?LastURL=/OTHER/json_data.aspInsert your location of interest (as I did):
Hoe to search your location weather informations. |
I received the address to call the service:
...and I received informations in Json format.JSON URL
http://ws1.metcheck.com/ENGINE/v9_0/json.asp?lat=40.4&lon=18.2&lid=22553
Simple and brilliant!
MeteoLecce (6): To-Do List
I try to make a to-do list for next things I want to insert in the app:
- weather forecast for the next 3 days;
- possibility to take pictures and send to the official email account;
- re-call infos from a remote database (past weather: saving day-by-day actual weather situation);
- ...and so on
MeteoLecce (5): how to manage a json array
Extract a parameter from the json array.
Below the json string:
If I want to obtain the weather "description" I have to use array method on the previous string like this:
Below the json string:
{"coord":{"lon":18.17,"lat":40.36},"weather":[{"id":801,"main":"Clouds","description":"few clouds","icon":"02d"}],"base":"stations","main":{"temp":299.93,"pressure":1013,"humidity":69,"temp_min":299.15,"temp_max":301.15},"visibility":10000,"wind":{"speed":8.7,"deg":120},"clouds":{"all":20},"dt":1504862100,"sys":{"type":1,"id":5749,"message":0.0227,"country":"IT","sunrise":1504844509,"sunset":1504890427},"id":6542124,"name":"Lecce","cod":200}
If I want to obtain the weather "description" I have to use array method on the previous string like this:
Extraction of the weather descprition from the json array. |
Wednesday, 6 September 2017
MeteoLecce (3)
At this point of the opera I met a problem. In a mix of reasearches I read something on stackoverflow.com, but the best solution to my situation was on YouTube so I decided to write a post on stackoverflow.com, this is the link:
Android - android.os.NetworkOnMainThreadException
and this was my post:
Android - android.os.NetworkOnMainThreadException
and this was my post:
My post on stackoverflow.com |
MeteoLecce (2)
I'm continuing to develop my first app (in Android Studio) for MeteoLecce (a wether forecast page on Lecce).
Today I understand how to create a margin in every direction between the views (the elements on an interface):
Margins |
We need to click on the view of our interest then click on the circle of our interest to create the arrow to the final view (on another circle of the other element).
Margins: starting point to create the arrow to the end point on the final object |
Now, I need of a Json reader...
Tuesday, 5 September 2017
My first app comes to life (MeteoLecce 1)
I have the idea to create a new app starting from the data about the weather of Lecce.
I can start from some information of the actual situation:
I can start from some information of the actual situation:
- temperature
- humidity
- wind: direction and power
I have the intenction to create a very simple interface and a few parameters inside. I want to show you an handmade preview:
What do you think?
Subscribe to:
Posts (Atom)
-
How to make mathematics interesting!
-
What am I doing today? Weather station: buying electric box (going to the shop in Lecce by bike); Studying Deep Learning; Experiment...