How you can improve your workflow using the JavaScript console

 

As a web developer, you know very well the need to debug your code. We often use external libraries for logs, and to format and/or display…

How you can improve your workflow using the JavaScript console

Please meet:

  • console.group() (or console.groupCollapsed() if we want it to be closed by default). Then add a console.groupEnd()
  • The console.table allows us to visualize these structures inside a beautiful table where we can name the columns and pass them as parameters.
  • Console.count, Console.time and Console.timeEnd

    These three methods are the Swiss army knife for every developer who needs to debug. The console.count counts and outputs the number of times that count() has been invoked on the same line and with the same label. The console.time starts a timer with a name specified as an input parameter, and can run up to 10,000 simultaneous timers on a given page. Once initiated, we use a call to console.timeEnd to stop the timer and print the elapsed time to the Console.

Determinare la data in cui è stata scritta una pagina web

Qualche tempo fa mi è stato proposto di scrivere un articolo per la rivista ICT Security Magazine. Ho trattato una tematica che torna utile in molti casi di indagini da fonti aperte o di consulenze…

Sorgente: Determinare la data in cui è stata scritta una pagina web – Andrea Lazzarotto

Ma che affidabilità forense può avere chiedere al server la data, visto che può facilmente taroccarla?
Basta un colpo di “touch -t 198111220830 index.html” dato sul server e voilà, la tua pagina web risulta arrivare dal 1981.
Ci son servizi come archive.org ma ovviamente non è onnisciente.

L’argomento è vasto, e non ho il tempo e forse neanche la competenza per trattarlo.

Si può marcare temporalmente il download di una pagina e garantire che ad una certa data era già stata scritta.

Si può cercare altre pagine che fanno riferimento a quella in questione ed usare le loro date come un indizio, ma anche quelle non sono “sicure ed incontrovertibili”.

How can I escape white space in a bash loop list? – Stack Overflow

I find this nice and elegant. The other proposed solutions may handle files with newline in their name, but currently I see such file names as nonsense
<span class="pln">find </span><span class="pun">.</span> <span class="pun">-</span><span class="pln">type d </span><span class="pun">|</span> <span class="kwd">while</span><span class="pln"> read file</span><span class="pun">;</span> <span class="kwd">do</span><span class="pln"> echo $file</span><span class="pun">;</span> <span class="kwd">done</span>

However, doesn’t work if the file-name contains newlines. The above is the only solution i know of when you actually want to have the directory name in a variable. If you just want to execute some command, use xargs.

<span class="pln">find </span><span class="pun">.</span> <span class="pun">-</span><span class="pln">type d </span><span class="pun">-</span><span class="pln">print0 </span><span class="pun">|</span><span class="pln"> xargs </span><span class="pun">-</span><span class="lit">0</span><span class="pln"> echo </span><span class="str">'The directory is: '</span>

Sorgente: How can I escape white space in a bash loop list? – Stack Overflow

Furthermore BASH Shell: For Loop File Names With Spaces suggets:

find . -print0 | while read -d $'\0' file
do
  echo -v "$file"
done

that should handle even the weirdest file name

Continue reading