RaF-o-TroniCks

Las Diatribas de un Anónimo de Sevilla, en Segovia.

Browsing Posts in programacion

//this works for me

var t = document.createElement(‘div’);
t.innerHTML = “yourhtmlcode”;
document.getElementById(“nombre_div”).innerHTML=”";
document.getElementById(“nombre_div”).appendChild(t);

File f=new File(urlfile);
if(f.exists()){

byte[] data=getFileBytes(f);
PreparedStatement stmt=conn.prepareStatement(“update campanas3 set media= ? where id=”+id);
stmt.setBlob(1, (Blob)new SerialBlob(data));
stmt.executeUpdate();

}


protected byte[] getFileBytes(File f){

byte[] bytes=null;
try {
FileInputStream fs=new FileInputStream(f);

int contador=0;
byte[] b=new byte[1048576]; //max.1MB
int ch;
Vector tt=new Vector();
while ((ch = fs.read()) != -1) {
b[contador]=(byte)ch;
tt.addElement(new Byte((byte)ch));
contador++;
}

bytes=new byte[tt.size()];
for(int i=0;i
bytes[i]=((Byte)tt.elementAt(i)).byteValue();
}

} catch (Exception e){
e.printStackTrace();
}
return bytes;
}

Si tienes algo que no sea un Motorola… el consejo es algo más que recomendación… no lo instales.. xq no necesariamente te ira… (tb. puedes probar y me cuentas :P ). Lo que queda claro es que con Sony-Ericsson no va. :)

Ya tengo descargada la plataforma de desarrollo!, Work in progress!