timing

Risparmio tempo = faccio più cose

Noi programmatori abbiamo diverse competenze e tanti pattern che utilizziamo, ma credo che la cosa che maturiamo nel tempo e ci accomuna di più è l’ottimizzazione delle risorse per risparmiare tempo. Tutti sanno che il tempo è la cosa più importante! Lo dice lo stesso modo di dire: il tempo è denaro. Il detto si basa su tempo umano. Il tempo umano deve essere utilizzato come valore aggiunto per la creatività, invenzione, innovazione costruzione e implementazione. Noi programmatori siamo fortunati, abbiamo a disposizione un’altra unità di misura del tempo, oggigiorno tendente quasi all’infinito, che possiamo e dobbiamo sfruttare al massimo e questo tempo e il tempo macchina. Un tempo si facevano fatigare gli schiavi poi i cavalli, i muli, i motori oggi ci siamo evoluti, culturalmente e mentalmente, Gli schiavi di quest’era sono le macchine. Per macchine intendo i nostri pc, o meglio ancora i nostri server, il cloud o i robot. Ho deciso di scrivere questo articolo per riportare delle tecniche utili per efficientare il nostro lavoro e di conseguenza ottenere più tempo. La mia tecnica principale da utilizzare per ottenere questo risultato è: appuntare gli step manuali che compiamo per fare un compito ricercare possibili soluzioni alternative riflettere su come possiamo automatizzare ogni singolo step mettere tutto assieme ripartire dal punto 1 se il nostro tempo d’impiego non è ancora = 0 per l’attività scelta Un esempio Spesso per velocizzare il nostro lavoro scriviamo degli script, questi script sono necessari altrimenti dovremmo scrivere n istruzioni di comandi. Giornalmente o mensilmente o dopo aver fatto qualcos’altro, dobbiamo eseguirli. Quindi apriamo il terminale e lanciamo lo/gli script. Per evitare di lanciare lo script a mano, che implica ricordarci, trovare lo script e lanciarlo, possiamo procedere nel seguente modo: se si tratta di qualcosa che va eseguito con una schedulazione fissa possiamo schedularlo utilizzando uno scheduler in linux possiamo fare un cron oppure possiamo utilizzare atrigger per eseguire la schedulazione nel caso in cui il nostro script sia su un server a cui non abbiamo accesso alla schedulazione Se invece non c’è una schedulazione fissa e dobbiamo eseguirlo al bisogno Possiamo utilizzare una scorciatoia da tastiera. In linux ma anche su Windows e molto semplice settare una una scorciatoia. Nel mio caso usando Ubuntu basta andare sotto *impostazioni *-> scorciatoie da tastiera e aggiungiamo il nostro nuovo parametro che conterà il path al nostro script e la scorciatoia desiderata. Come potete vedere nella seguente immagine, io lo uso ad esempio per lanciare in debug il mio blog e successivamente per fare il deploy: per quanto questo possa sembrare bello e può aiutarci a renderci più efficienti, con due tasti, il gioco è fatto, si può sempre ottimizzare. Voi direte, che altro puoi fare per ottimizzare questo? e perchè? Il perchè è semplice, per poterlo eseguire ho necessariamente bisogno di avere la mia macchina a disposizione e accesa. Quindi sarebbe meglio laddove possibile utilizzare sempre un server o il cloud in modo da fare tutto da remoto in modo così da poter avere più controllo e soprattutto non dipendere da una macchina. Oggi ci sono tanti strumenti che abbiamo a disposizione per eseguire script o creare piccole pagine web o piccole applicazioni o siti vetrina. Il piano gratuito di questi servizi, mette a disposizione tanti strumenti fra i quali: Spazio hosting. Spazio database. Funzioni per micro servizi Container Macchine virtuali e chi più ne ha più ne metta C’è ne sono così tanti che a volte tendiamo a non vederli, nonostante siano sotto il nostro naso. Quelli che utilizzo io maggiormente, sono: Firebase Google Cloud Amazon AWS Google Script L’ultimo servizio a differenza degli altri non è un servizio cloud ma semplicemente un motore di funzioni con schedulazione o attivazione in funzione dei servizi Google. Sono molto integrate con il nostro account Google e se lo usiamo come mail principale ci darà davvero delle grandi potenzialità per automatizzare: invii di mail sincronizzazione di dati editing di documenti chiamare API esterne memorizzare dati in excel ecc ecc… è brutto dire ecc ecc ma davvero, l’elenco sarebbe troppo lungo, vi permette di automatizzare tutto ciò che è Google. Gli altri tre sono i primi tre migliori provider Cloud. Per cominciare io consiglio di usare Firebase perchè mette a disposizione davvero tanti servizi e se si tratta di primo inzio con il cloud, l’accesso con Firebase, credo sia più semplice e con una linea di apprendimento più rapida. Conclusioni Cerchiamo di fare più attenzione a quello che ogni facciamo senza pensare. Se ogni giorno facciamo una cosa ripetitiva, anche se ci mettiamo davvero poco a farla, teniamola in considerazione e pensiamoci. Dopo anni le cose ripetitive possono diventare tante e rischiamo di saturare tutto il nostro tempo col fare solo cose ripetitive. Vi lascio e vi saluto con una frase che mi è venuta adesso. Probabilmente non ha senso o forse è già di qualcuno ma io non lo so. Meglio creare un sistema che ci risolve un problema che risolvere il problema stesso!

save time = do more things

We as programmers have different skills and we use lot of patterns, but I think the thing that we mature over time and we have more in common is the resources optimization for time saving. Everyone knows that time is the most important thing! The same way of saying it: time is money. The saying is based on human time. Human time must be used as an additional value for creativity, invention, construction innovation and implementation. We programmers are lucky, we have another measurement time unit, nowadays almost tending to infinity. This is machine time and we have to make the most of it. Once we used slaves, then horses, mules, engines motor. Today we have evolved, culturally and mentally. The slaves of this era are machines. By machines I mean our PCs, or better yet our servers, the cloud or robots. I decided to write this article to report useful techniques to make our work more efficient and consequently have more time. My main technique to be used to obtain this result is: write down the manual steps that we perform to do a task search for possible alternative solutions reflect on how we can automate each single step put everything together starting from point 1 if our time for the task is not equal to 0 An example Often to speed up our work we write scripts, these scripts are necessary otherwise we would have to write n command statements. Daily or monthly or after doing something else, we have to do it. So let’s open the terminal and run the scripts. To avoid launching manual the script, which implies remembering, finding the script and launching it, we can proceed in the following way: if it is something that must be done with a fixed date Schedule it using a scheduler With linux, we can make a cron We can use atrigger to execute the scheduling in the event that our script is on a server to which we do not have access to server side If instead there is no fixed scheduling date and we have to execute it as needed We can use a keyboard shortcut. In linux but also on Windows it is very simple to set a shortcut. In my case using Ubuntu just go under *settings *-> keyboard shortcuts and add our new parameter that will count the path to our script and the desired shortcut. As you can see in the following image, I use it for example to debug my blog and then to deploy: as beautiful as it may seem and can help us make us more efficient, with two buttons, you’re done, yes can always optimize. Will you say, what else you can do to optimize this? and why? The reason is simple, in order to run it I necessarily need to have my machine available and turned on. So it would be better where you can always use a server or the cloud in order to do everything remotely so that you can have more control and above all not depend on a local machine. Today there are many tools available for us to run scripts or create small web pages or small applications or showcase sites, the free plan of these services, provides many tools including: Hosting space Database space Functions for microservices Container Virtual machines and whoever has more put them There are so many that sometimes we tend not to see them, despite being under our noses. The ones I use most are: Firebase Google Cloud Amazon AWS Google Script The last service unlike the others is not a cloud service but simply an engine of functions that can be scheduled or activated in relation on google service. They are very integrated with our Google account and it will really give great potential to automate: mailing data synchronization document editing calling external API storing data in excel etc etc … it’s bad to say etc etc but really, the list would be too long, it allows you to automate everything which is Google. The other three are the top three best cloud providers. To begin with I recommend using Firebase because it offers so many services and it is simler and with a faster learning line. Conclusions We have to pay more attention to what we all do without thinking on it. If we do something repetitive every day, even if we take very little time to do it, let’s take it into consideration and think about it. After years, repetitive things can become many and we risk saturating all our time by doing only repetitive things. I leave you and greet you with a phrase that has come to me now. It probably doesn’t make sense or maybe it’s already of someone’s but I don’t know. It is better to create a system that solves a problem than to solve the problem itself!