openweather map library (python)

hey guy can someone please help me out with my project, basically we should should develop a library that allows other developers to retrieve weather data about specific location. while creating the classes : exeption class location class weather class getWeather global function

i cant figure out how sould i set my part of code into classes (especially the exeption class that not even exist in my code , that should throw back an error massage.)

import requests   def by_city():     city = input('Enter your city : ')     url = ''\       '{}&appid=a2e488af48393e1d1ec62d65f6b4796e&units=metric'.  format(city)     res = requests.get(url)     data = res.json()     show_data(data)   def show_data(data):     temp = data['main']['temp']     wind_speed = data['wind']['speed']     latitude = data['coord']['lat']     longitude = data['coord']['lon']     description = data['weather'][0]['description']      print('Temperature : {} degree      celcius'.format(temp))     print('Wind Speed : {} m/s'.format(wind_speed))     print('Latitude : {}'.format(latitude))     print('Longitude : {}'.format(longitude))     print('Description : {}'.format(description))    def main():        by_city()    if __name__ == '__main__':     main() 

nanopb (Protocol Buffers library) repeated sub-messages encode

we are using the nanopb library as our Protocol Buffers library. We defined the following messages:


syntax = "proto2";  message repField {     required float x = 1;     required float y = 2;     required float z = 3; }  message SimpleMessage {     required float lucky_number = 1;     repeated repField vector = 2; } 

with simple.options

SimpleMessage.vector        max_count:300 

So we know the repField has a fixed size of 300 and thus defining it as such.

Parts of the generated one looks like:


 const pb_field_t repField_fields[4] = {     PB_FIELD(  1, FLOAT   , REQUIRED, STATIC  , FIRST, repField, x, x, 0),     PB_FIELD(  2, FLOAT   , REQUIRED, STATIC  , OTHER, repField, y, x, 0),     PB_FIELD(  3, FLOAT   , REQUIRED, STATIC  , OTHER, repField, z, y, 0),     PB_LAST_FIELD };  const pb_field_t SimpleMessage_fields[3] = {     PB_FIELD(  1, FLOAT   , REQUIRED, STATIC  , FIRST, SimpleMessage, lucky_number, lucky_number, 0),     PB_FIELD(  2, MESSAGE , REPEATED, STATIC  , OTHER, SimpleMessage, vector, lucky_number, &repField_fields),     PB_LAST_FIELD }; 

and part of simple.pb.h:

/* Struct definitions */ typedef struct _repField {     float x;     float y;     float z; /* @@protoc_insertion_point(struct:repField) */ } repField;  typedef struct _SimpleMessage {     float lucky_number;     pb_size_t vector_count;     repField vector[300]; /* @@protoc_insertion_point(struct:SimpleMessage) */ } SimpleMessage; 

We try to encode the message by doing:

// Init message SimpleMessage message = SimpleMessage_init_zero;     pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer));  // Fill in message [...]  // Encode message status = pb_encode(&stream, SimpleMessage_fields, &message);  // stream.bytes_written is wrong! 

But the stream.bytes_written is wrong which means it is not encoded correctly, although status=1.

In the documentation for pb_encode() it says:

[…] However, submessages must be serialized twice: first to calculate their size and then to actually write them to output. This causes some constraints for callback fields, which must return the same data on every call.

But, we are not sure how to interpret this sentence – what steps to follow exactly to achieve this.

So our question is:

  • What is the correct way to encode messages that contain fixed-size (repeated) submessages using the nanopb library?

Thank you!

Client side Jquery library For validation

I have created a library for client-side validation using jquery, need to review the same what can be changed

It’s on GitHub: see here, just need some bits of advice, thanks

e.g sample code –

 /// add verify.js and css  <div class="form-group">                     <label> Number</label>                     <input type="text" class="SvNumber SvForm1 form-control" svminlen="3" id="number" svmaxlen="10" svmessage="Invalid number" placeholder="Enter Number" />                 </div> 

Small socket based packet Library

I’m currently writing a python script which needs some simple networking. After some playing around with sockets, this emerged, but as this is my first foray into sockets I’d really like a second opinion.

Package Format:

datalength+1 data

import socket  sep: bytes = b''  minpacketsize: int = 10   def sendpacket(sock: socket.socket, data: bytes) -> None:     send: bytes = str(len(data) + 1).encode('utf-8') + sep + data + sep      if len(send) < minpacketsize:         raise ValueError("Packet too small!")      sock.sendall(send)   def recivepacket(sock: socket.socket) -> bytes:     datalen = 0     header: bytearray = bytearray()     while not datalen:         header += sock.recv(1)         if header.endswith(sep):             try:                 datalen = int(header[:-1].decode('utf-8'))             except UnicodeDecodeError or ValueError as e:                 raise ValueError("Error while decoding header!") from e          if len(header) == 10:             raise ValueError("Could not find Header!")      rawdata: bytes = sock.recv(datalen)      if rawdata.endswith(sep):         return rawdata[:-1]     else:         raise ValueError("Could not find Packet end!") 

How to tell which app added a photo to my library

Today I noticed some photos in my iCloud Photo Library which I did not put there. I’m not talking about any shared album, this is my library. This is alarming since I have never shared my iCloud account or password with anyone and I use 2FA for security. My best guess is that these photos were added by a bug in an iOS application which I have previously granted access to the photos library. So how can I tell which application created a particular photo?

library essay writing

democracy essays hamlet soliloquy essay traditional family essay the perfect essay essay on marine life conclusion paragraph for compare and contrast essay apa format essays essay sale
starting an essay with a question…

library essay writing

SP2013 : Overriding Thumbnails column in PublishingImages library

I’m really stuck with this one, so if someone has a little time to help me on this…

What i want :

I have a pictures library in a site. It is even a PublishingImages library. a lot of my images are .PNG files. So, i want to display a thumbnail of these files along with the name and every property i could get.

What i have :

Because these are PNG files with transparent background (and a lot of time, they are white icons), Sharepoint does not generate a good thumbnail and this last turn out to be all white. So, it is not helping.

What i thought :

I understood that SP is not good with calculating PNG thumbnails and that my PNG files are converted to JPG etc.. but i would like it to render fine, ok?

So, i thought i would create a new Content Type Column, which should be a html calculated column, with a formula which takes the original path of the file and add it a rendition.

So, instead of having only “Name” and “Thumbnails”, i would have “Name”, “Thumbnail”, “Custom Thumbnail” as columns. And in Custom Thumbnials, i should have a formula which says concat(ImageURL,'?RenditionID=9') for example.

Do you know how i could manage to calculate my custom column on one other ? Do you know how i could manage to do that ?

Thanks a lot for your time and help !!

GNAT: GPS: missing library -lSystem linker error after fresh installation using (almost) empty program [MacOS]

Program contents:

procedure Main is begin    null; end Main; 

Error message:

gprbuild -d -P/Users/xxx/helloworld/helloworld.gpr /Users/xxx/helloworld/src/main.adb Compile    [Ada]          main.adb Bind    [gprbind]      main.bexch    [Ada]          main.ali Link    [link]         main.adb ld: library not found for -lSystem collect2: error: ld returned 1 exit status 

What I tried as user root:

find / -name '*ystem*' 

but could not find any library with a name System

Environment MacOS: 10.13.6

GPS version: gnat-community-2019-20190517-x86_64-darwin-bin installed without any problem

How to sync photos from two iCloud accounts to one photos library?

My wife and I each have our own iCloud accounts. Mine is synced with the photos library on my Mac, and I would like to have her photos sync to that library as well so all our family’s photos are in one place.

My current idea is to have an iPad sync her photos from her phone, and then set it up to auto import into my library when I plug it in to my laptop.

Is that a good idea to sync photos from two iCloud accounts or is there a better way?