jueves, abril 15, 2010

JBOSS Solaris

Hola Tod@s

Después de tener un problema instalando JBOSS en un maquina Solaris Sparc, la cual ocurría por 3 razones principalmente :

* Asignación de Memoria a JVM por parte del SO
* Asignación del Garbage Collector para SO
* Capa 8 .. XD

En si estos es mas una ayuda de memoria. El problema que ocurria era que al subir el servicio la JVM me arrojaba el siguiente problema :

Error occurred during initialization of VM Could not reserve enough space for object heap

Para solucionar este problema hay que hacer lo siguiente en el SO para asignar memoria al proceso :

#ulimit -S -v [mem que se necesita]

Para probar solo se puede corre lo siguiente :

#java -Xmx[mem]-version

Si no da error ya esta corregido el problema, si sigue dando problemas solo hay que asignar mas memoria con el comando ulimit.

Luego me daba el siguiente error :

# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00002b44b1da83ac, pid=2705, tid=1081280832
#
# JRE version: 6.0_18-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (16.0-b12 mixed mode linux-amd64 )
# Problematic frame:
# V [libjvm.so+0x6223ac]
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#

Este error ocurre por que para Solaris hay que asignarle otro garbage collector para que suba JVM, este problema se corrige asignando el siguiente parámetro al subir el servicio :

-XX:+UseSerialGC

Después de hacer esto el servicio subió sin problemas en el Servidor Solaris Sparc.

Si al hacer esto aun no funciona se puede hacer lo siguiente :

$ ulimit -Sa
$ ulimit -Ha

O ya lo ultimo es, en el archivo /etc/system se debe agregar lo siguiente :

set msgsys:msginfo_msgtql=1048576
set msgsys:msginfo_msgmni=256
set msgsys:msginfo_msgmax=8196
set msgsys:msginfo_msgmnb=8388608
set msgsys:msginfo_msgssz=2048
set msgsys:msginfo_msgseg=2048

Esto ultimo requiere reboot de la maquina.

Eso espero que a alguien mas le sirva esto.

viernes, noviembre 20, 2009

Form Validation Jquery

Hola

Acá le dejo un modificación que realice a un script de jquery para validar formulario.

Implementacion HTML

<script type="text/javascript" src="jquery/jquery-1.3.2.js"></script>
<script type="text/javascript" src="jquery/jquery.formvalidator.js"></script>

Form js
<script type="text/javascript">
$(function () {
$('#btUser').formValidator({
scope : '#user',
errorDiv : '#errorDiv'
});

});
</script>
Form HTML (Sample)

Usuarios

(*) Campos Obligatorios

Input (*)

<input id="input" name="input" class="input" value="" label="Input" required="true" type="text">

Number (*)

<input id="number" name="number" class="input" value="" req="numeric" minlength="2" maxlength="10" label="Number" required="true" type="text">

Double (*)

<input id="double" name="double" req="numeric" class="input" value="" label="Double" required="true" type="text">

Select (*)

<select id="select" name="select" class="input" label="Select" required="true">
<option value="0">...</option>
<option value="1">Nada</option>
</select>

Check

<input id="check" name="check" value="true" type="checkbox">

Radio

<input id="radio" name="radio" value="0" checked="checked" type="radio">Si
<input id="radio" name="radio" value="1" type="radio">No

Password (*)

<input id="password" name="password" req="same" class="input" value="" required="true" rel="password1" label="Password" type="password">

Re-Password (*)

<input id="password1" name="password1" req="same" class="input" value="" required="true" rel="password" label="Re-Password" type="password">

Calle

<input id="calle" name="calle" req="both" class="input" value="" required="true" rel="num" label="Calle" type="text">

Numero

<input id="num" name="num" class="input" value="" required="true" rel="num" label="Numero" type="text">

<input id="btUser" value="Insert" class="sendBtn" type="submit">

Código Javascript

/*
*
* Form Validation 2009
* @author Tolga Arican, Ivan A. Flores Correa
* @website www.utopicfarm.com, slacker-linux.blogspot.com
* @version 2.0.1
*
*/

(function($) {

$.fn.formValidator = function(options) {
$(this).click(function() {
var result = $.formValidator(options);

if (result && jQuery.isFunction(options.onSuccess)) {
options.onSuccess();
return false;
} else {
return result;
}
});
};

$.formValidator = function (options) {

// merge options with defaults
var merged_options = $.extend({}, $.formValidator.defaults, options);

// result boolean
var boolValid = true;

// result error message
var errorMsg = '<ul>';

// clean errors
$(merged_options.scope + ' .error-both, ' + merged_options.scope + ' .error-same, ' + merged_options.scope + ' .error-input').removeClass('error-both').removeClass('error-same').removeClass('error-input');

// Verificamos si se validan
$(merged_options.scope+' .input').each(function(){
thisValid = $.formValidator.validate($(this),merged_options);
boolValid = boolValid && thisValid.error;
if (!thisValid.error) errorMsg += thisValid.message;
});
errorMsg += '';

// submit form if there is and valid
if ((merged_options.scope != '') && boolValid) {
$(merged_options.errorDiv).fadeOut();
}

// if there is errorMsg print it if it is not valid
if (!boolValid && errorMsg != '') {
var tempErr = (merged_options.customErrMsg != '') ? merged_options.customErrMsg : errorMsg;
$(merged_options.errorDiv).hide().html(tempErr).fadeIn();
}

return boolValid;
};

$.formValidator.validate = function(obj,opts) {
var valAttr = obj.val();
var css = opts.errorClass;
var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var numeric_filter = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)|(^-?\d*$)/;
var tmpresult = true;
var result = true;
var errorTxt = '';
var label = obj.attr('label');
var required = obj.attr('required');
var req = obj.attr('req');
var name = obj.attr('name');
var type = obj.attr('type');

// Validamos
if (required == 'true') {
tmpresult = false;
if (valAttr != '') {
if (valAttr != '0') {
tmpresult = true;
}
}
if (!tmpresult) errorTxt +='<li>'+label+' '+opts.errorMsg.reqString+'</li>';
result = result && tmpresult;
}

// SAME FIELD VALIDATION
if (req == 'same') {

tmpresult = true;

group = obj.attr('rel');
tmpresult = true;
$(opts.scope+' .input[rel="'+group+'"]').each(function() {
if($(this).val() != valAttr || valAttr == '') {
tmpresult = false;
}
});
if (!tmpresult) {
$(opts.scope+' .input[rel="'+group+'"]').parent().parent().addClass('error-same');
errorTxt += '<li>'+opts.errorMsg.reqSame+'</li>';
} else {
$(opts.scope+' .input[rel="'+group+'"]').parent().parent().removeClass('error-same');
}

result = result && tmpresult;
}

// BOTH INPUT CHECKING
// if one field entered, the others should too.
if (req == 'both') {

tmpresult = true;

if (valAttr != '') {

group = obj.attr('rel');

$(opts.scope+' .input[rel="'+group+'"]').each(function() {
if($(this).val() == '') {
tmpresult = false;
}
});

if (!tmpresult) {
$(opts.scope+' .input[rel="'+group+'"]').parent().parent().addClass('error-both');
errorTxt += '<li>'+opts.errorMsg.reqBoth+'</li>';
} else {
$(opts.scope+' .input[rel="'+group+'"]').parent().parent().removeClass('error-both');
}
}

result = result && tmpresult;
}

// E-MAIL VALIDATION
if (req == 'email') {
tmpresult = mail_filter.test(valAttr);
if (!tmpresult) errorTxt += '<li>'+opts.errorMsg.reqMailNotValid+'</li>';
result = result && tmpresult;
}


// MINIMUM REQUIRED FIELD VALIDATION
var minlength = obj.attr('minlength');
if (obj.attr('minlength') != null) {
tmpresult = (valAttr.length >= minlength);
if (!tmpresult) errorTxt += '<li>'+label+' '+opts.errorMsg.reqMin.replace('%1', minlength)+'</li>';
result = result && tmpresult;
}
// NUMERIC FIELD VALIDATION
if (req == 'numeric') {
tmpresult = numeric_filter.test(valAttr);
if (!tmpresult) errorTxt += '<li>'+label+' '+opts.errorMsg.reqNum+'</li>';
result = result && tmpresult;
}

if (result) {
obj.removeClass(css);
} else {
obj.addClass(css);
}

return {
error: result,
message: errorTxt
};
};

setMsg = function() {

}

// CUSTOMIZE HERE or overwrite by sending option parameter
$.formValidator.defaults = {
onSuccess : null,
scope : '',
errorClass : 'error-input',
errorDiv : '',
errorMsg : {
reqString : 'es Requerido',
reqDate : 'Fecha no es valida',
reqNum : 'solo acepta Numeros',
reqMailNotValid : ' E-Mail no es valido',
reqMailEmpty : 'Please fill e-mail',
reqSame : 'Campos Re-confirmacion no son iguales',
reqBoth : 'Campos Relacionado(s) requerido',
reqMin : ' requiere %1 como minimo'
},
customErrMsg : ''
};
})(jQuery);

En que le interese le envío el ejemplo funcional

viernes, noviembre 06, 2009

restart grub - livecd

Hola Todos

Acá voy a dejar los pasos para recuperar el grub al instalar $win, en si los pasos son simples :

1.- Crear una carpeta para montar la partición (**)

$sudo mkdir /mnt/root


2.- Montar la Partición que contiene instalado la distro de Linux

$sudo mount -t [formato particion] [particion a momtar] /mnt/root


3.- Montamos el proc del sistema

$sudo mount -t proc none /mnt/root/proc

4.- Montamos los dispositivos

$sudo mount -o bind /dev /mnt/root/dev

5.- Hacemos nuestra partición raíz

$sudo chroot /mnt/root /bin/bash

Ahora ya estamos en nuestra distro, podemos correr el comando que queramos y se va ejecutar en la distro.

Ahora para recuperar el grub solo hacemos lo siguiente :

$sudo update-grub

Eso

(**) Opcional

Saludos

miércoles, octubre 07, 2009

split file with different name

Hola

Otra ayuda de memoria para separar archivos grandes en n lineas y dejarlos con un nombre claro :


#!/bin/sh

#Separamos el Archivo en tamaño de $1 lineas
split -l $1 -a 4 $2

# Movemos los archivos
ls x* | while read file;do echo "mv "$file" "$3"_"$file".$4";done >> comando.sh
# Ejecutamos la Salida
sh comando.sh
rm comando.sh

echo "ok"


Con esto se deja un archivo en n archivos de n lineas , solo se debe pasar 4 parametros de entrada a la shell :

$1 : cantidad lineas
$2 : nombre de archivo a dividir
$3 : nombre de como deben quedar los archivos
$4 : extencion de los archivos

Saludos

martes, agosto 25, 2009

Chronium + Ubuntu




Hola

Acá les dejo los pasos para instalar chromium en ubuntu (La version de Chrome) :

1.- Agregar las siguientes lineas en /etc/apt/source.list
deb http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/chromium-daily/ppa/ubuntu jaunty main

2.- Agregar la key para el repositorio :

#sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4E5E17B5

3.- Hacer un Update de los repositorios

#sudo apt-get update

4.- Instalar

#sudo apt-get install chromium-browser

Con estos pasos pueden probar la versión

Info : launchpad.net

Saludos