Friday 3 November 2017

JSON files on GDrive

How many times did I try to upload json files on GDrive?
Everytime I got the same result: Upload failed.

A file twice failed to upload on my GDrive.
I have reported this problem to Google by a feedback. Someone got the same problem and reported it as you can see to the following link (Google Drive Help Forum):


What have to do in this case is simple: rename the extension > upload the file > rename the file uploaded to the olde extension.

In this way today I resolved the problem:

Upload of the file with a modified extension.

File renamed wtih the original extension.

At the following link you can find some infos about how and what files you can upload on GDrive:


Happy upload!

Friday 13 October 2017

Weather forecast: build a graph with gnuplot (1)

Once I discovered Metcheck.com I thought to have found the solution to all my weather forecasting problem. I had datas in more less lines of code than email GRIB provided by SailDocs GRIB Service (a useful, but co,plicated system to receive email which contents is a grib file to decode and set by a bash script).

With the Metcheck system I can receive datas in a json format (free), in this way I can use libraries in bash to obtain infos quickly.

So, with this method I extrapolated dats and I converted it in a csv file then, with these infos I used gnuplot (a bash command [sudo apt-get install gnuplot]) or better, I created a pg file (within there are gnuplot commands) to generate a graph (and after a multigraph through the use of other bash commands).

This is the last version of my code bash code (on pastebin.com):



Although the previous one is not complete you can find the project through the following link on hithub:



I'd be glad if you could give me some suggestion. Thank you... :-)

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:

{"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

MeteoLecce (8): added some further informations and improved UI.

Little steps, but I'm glad I got here. I added informations about temperature and humidity for the next three days and improved the alignment of textView in both of the activities.
This is the restult:

MeteoLecce main UI 
MeteoLecce secondary UI 


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):
metcheck logo.

...and excactly this address:
https://www.metcheck.com/NOLOCATION.asp?LastURL=/OTHER/json_data.asp
Insert your location of interest (as I did):

Hoe to search your location weather informations.

 I received the address to call the service:

JSON URL


http://ws1.metcheck.com/ENGINE/v9_0/json.asp?lat=40.4&lon=18.2&lid=22553

 ...and I received informations in Json format.
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:


  1. weather forecast for the next 3 days;
  2. possibility to take pictures and send to the official email account;
  3. re-call infos from a remote database (past weather: saving day-by-day actual weather situation);
  4. ...and so on

MeteoLecce (5): how to manage a json array

Extract a parameter from the json array.
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.

MeteoLecce (4): wind and sky

I'm arrived to insert wind infos by conversion of the string in degree to string, i.e.: 170 >> "Sud".

The function to convert degree in string human comprehensible (wind).

And the sky situation. This is how the application looks like at the last update:

Screenshot of the last update.

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:

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:

  • 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?

Moonlight tonight

New photo of the moon with the following parameters:

  • ISO: 100
  • f/9
  • 1/500 sec
  • 300 mm