Uno scrittoio digitale …

24 maggio 2014

gsh (run the same command on many linux server)

Archiviato in: linux — admin @ 09:44

go

31 marzo 2014

Eclipse Inside Proxy

Archiviato in: code, java — admin @ 21:37

Cosa è … e come si usa si trova QUI

2 febbraio 2014

Conversione file .nef in .jpg

Archiviato in: sapere è potere — Tag:, , — admin @ 13:56

semplice:

sudo apt-get install netpbm dcraw
for filename in *.nef ; do dcraw -c -w $filename | pnmtojpeg > $filename.jpg ; done
find . -name “*.nef” -exec rm -rf {} \;
rename ’s/\.nef.jpg$/.jpg/’ *.jpg

30 gennaio 2014

Java thread dump

Archiviato in: java, sapere è potere — admin @ 23:08

un paio di link da spulciare sul treno …

http://architects.dzone.com/articles/how-analyze-java-thread-dumps
mat
jhat
http://docs.oracle.com/javase/6/docs/technotes/tools/share/jmap.html

L’ultimo citato (jhat) è abbastanza instabile su grossi file … ma fà cmq il suo sporco lavoro
Il top è assolutamente mat (un tool stand-alone costruito sul framework di Eclipse)
La Oracle sponsorizza jmap … ma non ho avuto ancora il tempo di provarlo
Non dimentichiamo in ogni caso VisualVM … l’ho usato parecchio, ma le informazioni sono un pò nascoste

22 settembre 2013

java.util.concurrent.*

Archiviato in: java — admin @ 18:03

ho raccolto un pò di informazioni in un unico pdf (non esaustivo)

8 settembre 2013

Disabilitare Bios EFI on Asus K55V

Archiviato in: ubuntu — admin @ 11:12

Esc per accedere al Bios

Scheda Boot
> disabilitare il fast boot
> abilitare il csm
> disabilitare il security boot

30 agosto 2013

Zero-downtime Deployment (and Rollback) in Tomcat

Archiviato in: java, web — admin @ 23:03

deployare due o più versioni della stessa webapp ? … oh yeah (è possibile)
qua

17 luglio 2013

Web Resource Optimizer for Java

Archiviato in: java — Tag:, , , — admin @ 22:27

wro4j

ThreadLocal

Archiviato in: java, oracle — Tag:, , , — admin @ 22:22

The javadoc says this:

“Each thread holds an implicit reference to its copy of a thread-local variable as long as the thread is alive and the ThreadLocal instance is accessible; after a thread goes away, all of its copies of thread-local instances are subject to garbage collection (unless other references to these copies exist).

If your application or (if you are talking about request threads) container uses a thread pool that means that threads don’t die. If necessary, you would need to deal with the thread locals yourself. The only clean way to do this is to call the ThreadLocal.remove() method.

There are two reasons you might want to clean up thread locals for threads in a thread pool:

to prevent memory (or hypothetically resource) leaks, or
to prevent accidental leakage of information from one request to another via thread locals.

Thread local memory leaks should not normally be a major issue with bounded thread pools since any thread locals are likely to get overwritten eventually; i.e. when the thread is reused. However, if you make the mistake of creating a new ThreadLocal instances over and over again (instead of using a static variable to hold a singleton instance), the thread local values won’t get overwritten, and will accumulate in each thread’s threadlocals map. This could result in a serious leak.

private void cleanThreadLocals() {
        try {
            // Get a reference to the thread locals table of the current thread
            Thread thread = Thread.currentThread();
            Field threadLocalsField = Thread.class.getDeclaredField("threadLocals");
            threadLocalsField.setAccessible(true);
            Object threadLocalTable = threadLocalsField.get(thread);

            // Get a reference to the array holding the thread local variables inside the
            // ThreadLocalMap of the current thread
            Class threadLocalMapClass = Class.forName("java.lang.ThreadLocal$ThreadLocalMap");
            Field tableField = threadLocalMapClass.getDeclaredField("table");
            tableField.setAccessible(true);
            Object table = tableField.get(threadLocalTable);

            // The key to the ThreadLocalMap is a WeakReference object. The referent field of this object
            // is a reference to the actual ThreadLocal variable
            Field referentField = Reference.class.getDeclaredField("referent");
            referentField.setAccessible(true);

            for (int i=0; i < Array.getLength(table); i++) {
                // Each entry in the table array of ThreadLocalMap is an Entry object
                // representing the thread local reference and its value
                Object entry = Array.get(table, i);
                if (entry != null) {
                    // Get a reference to the thread local object and remove it from the table
                    ThreadLocal threadLocal = (ThreadLocal)referentField.get(entry);
                    threadLocal.remove();
                }
            }
        } catch(Exception e) {
            // We will tolerate an exception here and just log it
            throw new IllegalStateException(e);
        }
    }

A good place to do such cleanup is ServletRequestListener.requestDestroyed().

11 luglio 2013

codepen

Archiviato in: code, sapere è potere — admin @ 22:57

html … css … js framework … on codepen

Download Virtual Machine for IE Testing

Archiviato in: web — admin @ 22:54

testing webapp on IE … download vm machine from here

download-vms

3 giugno 2013

Da tenere sott’occhio

Archiviato in: code — admin @ 22:22

mapstruct
dagger

enjoy

18 maggio 2013

Embedded Linux System

Archiviato in: linux — Tag:, — admin @ 16:36

use Buildroot for exploit it

24 aprile 2013

Guidami quanto costa ?

Archiviato in: Senza categoria — admin @ 22:40

Prima app per android rilasciata con successo. E ci sono pure già due bug !!? (grazie ad Antonio e Giada)
Vabbè poteva andar peggio … come sempre i sorgenti sono reperibili su github … qua.

12

24 marzo 2013

JD Decompiler for Eclipse 4.2 Juno

Archiviato in: java, sapere è potere — admin @ 12:48

1) download zip da qa
2) Eclipse > Help > Install new software > Add > Archive … selezionando il file zip scaricato al passo precedente
3) Eclipse > Window > Preferences > General > Editors > File Associations … selezionando ‘Class File Editor’ sia per ‘.class’ che per ‘.class without source’
4) restart eclipse

4 marzo 2013

Il codice muta ed io lo eSeguo

Archiviato in: code, java — Tag:, — admin @ 22:53

pitest && stackoverflow.

6 gennaio 2013

Android – Insufficient Permissions For Device

Archiviato in: java, linux — Tag:, — admin @ 16:05

run this command into shell:

> sudo adb kill-server
> sudo adb devices

7 dicembre 2012

Google

Archiviato in: code — Tag: — admin @ 19:55

my-other-computer-is-a-data-center

Google DART

Archiviato in: code — admin @ 19:28

http://code.google.com/p/dart/
http://www.dartlang.org/

Single page web application

Archiviato in: web — Tag:, , — admin @ 18:21

http://singlepageappbook.com/

Articoli precedenti »

Funziona con WordPress