Skip to content

Piero Bosio Social Web Site Personale Logo Fediverso

Social Forum federato con il resto del mondo. Non contano le istanze, contano le persone

Why Does My Code Crash ONLY at 2AM


Gli ultimi otto messaggi ricevuti dalla Federazione
Post suggeriti
  • 0 Votes
    1 Posts
    6 Views
    I have a question about Python libraries and testing scope.If I'm importing 'serial' in my library, and use it like the following to create a connection to a sensor:--- start code ---import serialclass Sensor: def __init__(self, serial_device): self.__serial_device = serial_device try: self.__connection = serial.Serial( port=serial_device, baudrate=9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, ) except serial.SerialException: print("Could not establish serial connection to sensor")--- end code ---how much testing should I do around the serial connection? Just mock up a few buffers (byte streams), and see how my class handles unexpected input?One the one hand, I want to make the library as solid as possible. On the other hand, I don't want to run tests on code I don't control (the library module). I know of the 'mock-serial' utility, but haven't used it.The aim is to make a Python version of my Arduino library for the CozIR Ambient CO2 sensor:https://codeberg.org/mjack/ambientCO2/src/branch/develop#python #unittest #testing #sensors
  • 0 Votes
    1 Posts
    8 Views
    I'm #colorblind and I use https://xkcd.com/color/rgb/ frequently.Randall 'xkcd' Monroe did a survey of over 100,000 readers where he showed them random rgb colors and said "what would you call this?" and afterwards he did his best to sort the results into the most popular color names and the colors they refer to.It's like a box of Crayola for the internet. Finally, my colorblind self can grab a sample of "dark magenta" that doesn't just look like "grape purple" to everyone else.The data is freely available as a .txt file under CC0, which I've converted into a .css file here: https://git.hatspace.net/nycki/nycki.net/src/branch/main/static/xkcd.cssso now when I want a color on my website I can just write `color: var(--xkcd-off-white)` or so on. it's really convenient :)#programming #color #css #website
  • 0 Votes
    1 Posts
    5 Views
    Dogs Trust are looking to hire a data engineer in London, UK (Hybrid). (Not my team so I don’t know any more than what’s in the advert I’m afraid).https://careers.dogstrust.org.uk/postings/90e1aac6-98e0-4004-b992-b965a813e2f3#GetFediHired #Python #SQL #Snowflake #Informatica
  • 0 Votes
    2 Posts
    13 Views
    @codeDude64Who's that girl?Nice thumb area!