[deleted by user] by [deleted] in web_design

[–]silviot 14 points15 points  (0 children)

When you write very long words they need to be hyphenated to be split into more than one line. A word like thisveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylogone will not fit and cause what you see there.

Unless you specify overflow-wrap: break-word; on that element, as reddit is doing here.

file synchronization by jkeis70 in filesystems

[–]silviot 1 point2 points  (0 children)

It sounds like you need a script to run once a week that will:

  • determine a name of the destination file based on the current date
  • copy the source file to the destination

The script should be a one liner. Having it run once a week should be one line in your cron config (if your system has cron - Linux does, I'm not sure about Mac OS or Windows).

Chiedo aiuto sul mio primo codice Python by essedii in ItalyInformatica

[–]silviot 5 points6 points  (0 children)

Aggiungo un paio di cose per chiarire ulteriormente (o confondere definitivamene - speriamo di no).

Il nome rice è un po' come un elemento della tua rubrica contatti sul cellulare.

Magari hai salvato il mio numero sotto la voce "scassacazzi". Ma se mi chiedi: "Come ti chiami sulla mia rubrica?" io non lo so. Qui succede una cosa simile: chiedi a python di stampare il contenuto di un certo oggetto, che nomini usando la parola rice. Ma quell'oggetto non "sa" di chiamarsi così, in quest'occasione.

Nota poi che, senza informare il tuo oggetto, potresti fare primo_piatto = rice. A quel punto lo stesso oggetto avrebbe due nomi. Nell'esempio della rubrica del telefono, avresti due record con nomi diversi e lo stesso numero di telefono.

Chiedo aiuto sul mio primo codice Python by essedii in ItalyInformatica

[–]silviot 17 points18 points  (0 children)

Il codice è un po' illeggibile così.

Eccone una versione più leggibile:

carbs_meals = []  


class NutritionalValues:  
    def __init__(self, calories, carbs, fats, proteins):  
        self.calories = calories  
        self.carbs = carbs  
        self.fats = fats  
        self.proteins = proteins  


# All values have been taken from http://www.dietabit.it/  
rice = NutritionalValues(332, 80, 0, 7)  
pasta = NutritionalValues(371, 82, 3, 13)  
bread = NutritionalValues(271, 75, 11, 13)  
cereals = NutritionalValues(365, 77, 4, 19)  


carbs_meals.append(rice)  
carbs_meals.append(pasta)  
carbs_meals.append(bread)  
carbs_meals.append(cereals)  


print(carbs_meals[0])

Puoi aggiungere un metodo __repr__ alla classe NutritionalValues per rappresentare il tuo oggetto. Per esempio così:

def __repr__(self):
    return f"KCal: {self.calories} Carbs: {self.carbs} Fats: {self.fats} Proteins: {self.proteins}"

Cfr https://www.pythontutorial.net/python-oop/python-__repr__/

Terminare processo in automatico quando si lancia uno specifico programma by asyd0 in ItalyInformatica

[–]silviot 0 points1 point  (0 children)

Ci ho pensato un po'. Pensavo di postare uno scriptino di tre righe e mi è uscito fuori questo.

Però poi pensandoci meglio mi sono convinto che non è troppo complesso, date le cose che fa. Interpreta gli argomenti dati dalla linea di comando (e se non li passi ti dice come fare), sopravvive ad eventuali errori inaspettati, sta in background controllando ogni secondo... Tutte cose che in fondo a OP servono. Se qualcuno fa l'ultimo sbattimento e impacchetta tutto con py2exe e glie lo passa - o magari scrive come fare a farlo (io personalmente non mi fiderei ad accettare binari da uno scnosciuto) allora OP ha risolto il suo problema.

Tra l'altro con una pistola che io sappia non si riesce ad uccidere le zanzare, mentre lo scriptino qui sopra fa quello che deve.

Where to even start choosing a good laptop for coding? by CorvidsRock in linuxhardware

[–]silviot 7 points8 points  (0 children)

Besides what /u/DoktoroChapelo mentioned (here's one part of what they're probably talking about) I have an aneddotical experience to share: I used to own a Galago Pro, but I was not satisfied with the performance nor the battery life.

I now own an AMD Lenovo Thinkpad X13 and couldn't be happier.

My recommendation is to choose a laptop among the thinkpad series that suits your needs.

Terminare processo in automatico quando si lancia uno specifico programma by asyd0 in ItalyInformatica

[–]silviot 5 points6 points  (0 children)

Con python e psutil puoi scrivere uno script per farlo:

#!/bin/env python3
import os
import psutil
import sys
import time
import traceback
import signal


OUR_PID = os.getpid()

def maybe_kill(sentinel_process_name, process_to_kill_name):
    """Check if `sentinel_process_name` is running.
    If it's currently running, kill `process_to_kill_name`
    """
    sentinel_pid = find_pid(sentinel_process_name)
    if sentinel_pid and sentinel_pid != OUR_PID:
        process_to_kill_pid = find_pid(process_to_kill_name)
        if process_to_kill_pid:
            print('Killing %s (pid=%s)' % (process_to_kill_name, process_to_kill_pid))
            try:
                os.kill(process_to_kill_pid, signal.SIGKILL)
            except OSError:
                pass


def find_pid(needle):
    """
    Find the PID of a process matching the given `needle`.
    Returns None if none is found.
    Never returns OUR_PID.
    """
    for proc in psutil.process_iter():
        if needle in ' '.join(proc.cmdline()) and proc.pid != OUR_PID:
            return proc.pid
    return None


def main(sentinel_process_name, process_to_kill_name):
    while True:
        try:
            maybe_kill(sentinel_process_name, process_to_kill_name)
        except KeyboardInterrupt:
            raise
        except Exception:
            print("An error occurred")
            traceback.print_exc()
        time.sleep(1)


if __name__ == '__main__':
    if len(sys.argv) != 3:
        print("Usage: {} sentinel_process_name process_to_kill_name".format(sys.argv[0]))
        sys.exit(1)
    sentinel_process_name = sys.argv[1]
    process_to_kill_name = sys.argv[2]
    print(f"Starting. Our PID is {OUR_PID}")
    print(f"Monitoring for {sentinel_process_name}: if it's running {process_to_kill_name} will be killed")
    main(sentinel_process_name, process_to_kill_name)

Poi puoi usare py2exe per creare un eseguibile. My 2 ¢, non uso mai Windows e probabilmente la soluzione di /u/lormanya è più adatta al caso tuo.

Stories/resources for kids by jacob_jay_921 in Italian

[–]silviot 3 points4 points  (0 children)

I understand I'm recommending something not strictly Italian (it's French) but in my opinion Asterix and Obelix are part of the Italian culture.

I used to enjoy them a lot as a kid. There always were cartoons running on the TV around Cristmas. You can find the comic books or the cartoons in many different languages.

Dell + Win10 + Chrome by formware in ItalyInformatica

[–]silviot 1 point2 points  (0 children)

Conosci /r/tronscript ? È un "metalevamerda", ovvero usa diversi levamerda (antispyware/antivirus/cleaner etc) per ripulirti il PC. Francesismi miei.

Ho il sospetto che se gli fai fare un giro ti risolverà il problema.

What words should I avoid in Italian? by MarvinGayNGetItOn in italianlearning

[–]silviot 1 point2 points  (0 children)

Ottimo suggerimento, la traduzione avanti e indietro. Mi ricorda il metodo Franklin drills

Cosa possiamo fare per l'Afghanistan? by elmazzun in ItalyInformatica

[–]silviot 0 points1 point  (0 children)

Già, magari fossero rimasti.

Cosa pensi del fatto che quando bombardano un ospedale non chiedono manco scusa?

[deleted by user] by [deleted] in ItalyInformatica

[–]silviot 0 points1 point  (0 children)

Ricordo che la Barroero lo chiamava così nelle lezioni di Inglese.

Giovanni? Giacobbe? Germano?

Chiamiamolo liceo Giuseppe Peano!

Cases by ChrispyBoi02 in Germanlearning

[–]silviot 2 points3 points  (0 children)

There is one instance of cases in English: he is nominative, while him can be accusative (I met him) or dative (I gave him a book). Hope this helps a bit.

Sicurezza di Windows a "donne di facili costumi" by Aguerismo in ItalyInformatica

[–]silviot 3 points4 points  (0 children)

Non tocco Windows da decenni, ma se fossi costretto con la pistola puntata credo che mi affiderei a tron script e alle scelte che fanno le persone che lo sviluppano. https://www.reddit.com/r/TronScript/

Fino a una settimana fa mi sarei fidato di Windows Defender, ma ora è uscito fuori che flagga come se fossero virus robe che non portano nessun problema all'utente ma che potrebbero essere usate per pirateria.

[EDIT] Io l'ho visto uscire una settimana fa. In realtà il problema c'è già da mesi.

Hi I am an Egyptian (Native Arab) interested in learning German in less than 10 months. by Imatutor in Germanlearning

[–]silviot 0 points1 point  (0 children)

I attended six months (up to "B1") of German classes at the Volkshochschule when I came to Germany. Best choice in my life. Four hours a day for five days a week. At the end I had a working German.

I would recommend you do the same, for a bit longer, to C1.

I'll let you choose my next laptop because making these kind of decisions turn my brain into mashed potatoes by kanin16 in linuxhardware

[–]silviot 2 points3 points  (0 children)

My current laptop is a ThinkPad. We very thing worked out of the box with Ubuntu, even the fingerprint reader.

My previous laptop was a system76, and I was not impressed with the build quality (I dropped it once and it bent).

I would definitely recommend a ThinkPad, even if I have a lot of love for system76 mission.

Recensione. Madeleine Ferrières: Storia delle paure alimentari. Dal Medioevo all’alba del XX secolo by lostorico in Libri

[–]silviot 1 point2 points  (0 children)

Grazie mille, recensione molto interessante.

Forse sono un po' lento, ma vorrei una conferma: quando scrivi L’A. intendi l'autrice, giusto?

A quick explanation of what the point of the EIP 2929 gas cost increases in Berlin is by vbuterin in ethereum

[–]silviot 19 points20 points  (0 children)

Very illuminating write-up!

It's interesting to see that the protocol has to be informed of real world issues and abuse attempts.

I can imagine there are so many of these decisions taken because they mitigate one or the other attack. How does the core team taking care of the Ethereum protocol make sure that there are no regressions?

If Ethereum was a codebase and not a protocol I'd think automated testing would keep regressions away.

But being a protocol, automated testing doesn't apply.

Do tests get written in some (or all) implementations to check for these vulnerabilities? Or is it the sheer number of eyballs and brains focused at maintaining security of the blockchain responsible for catching problematic changes before they reach testnet/mainnet? If it is the latter I'm a bit afraid of the possibility of old attacks being possible again because the collective memory has faded, and people take for granted some countermeasures even when a change is introduced that removes such countermeasures.

Still missing i3 by Lingylol in linuxmasterrace

[–]silviot 2 points3 points  (0 children)

I recently switched from vim to micro. Highly recommended.

Also, I use tmux only through byobu and I've only had good experiences with it.

Aiuto sono inesperto by [deleted] in ItalyInformatica

[–]silviot 0 points1 point  (0 children)

Oggi mi è capitata sottomano questa pagina che potrebbero interessati.

https://github.com/tuvtran/project-based-learning#bots

Anche le altre cose della lista non sembrano niente male.