11 December 2010

Lazy initialization

http://en.wikipedia.org/wiki/Lazy_initialization

from GoF:

You can avoid this by being careful to access products solely through accessor operations that create the product on demand. Instead of creating the concrete product in the constructor, the constructor merely initializes it to 0. The accessor returns the product. But first it checks to make sure the product exists, and if it doesn't, the accessor creates it. This technique is sometimes called lazy initialization. The following code shows a typical implementation:

class Creator {
public:
Product* GetProduct();
protected:
virtual Product* CreateProduct();
private:
Product* _product;
};

Product* Creator::GetProduct () {
if (_product == 0) {
_product = CreateProduct();
}
return _product;




--
Atte.

German Gonzalez

06 December 2010

CWEB en Español

Después de varios meses de trabajo, he podido terminar de traducir a Castellano The CWEB System of Structured Documentation de Donald Knuth.

Fue una tarea bastante ardua, más de lo que imagine ya que hay muchas frases técnicas (de tipografía) y sobre todo con mucha información tácita.

Se puede bajar desde el mismo sitio del Prof. Knuth: http://www-cs-faculty.stanford.edu/~knuth/cweb.html

Si alguien tiene comentarios, sugerencias para el documento, por favor diganmelo.

23 November 2010

Liar, Liar: Solved - FaceBook Puzzles

I have solved the first problem of Facebook Engineering Puzzles (Snack difficulty). It took me more time that I've planned, as usual, being a blackbox is harder to reach a solution.

Right now the robot has problems to receive emails from gmail (using the webmail app), therefore the solution is to send the solution through a script that uses SMTP.

This is the email sent by the robot:
Thank you for your submission of a puzzle solution to Facebook! After running your solution to liarliar (received on November 22, 2010, 9:24 am), I have determined it to be correct. Your solution ran for 1400.789 ms on its longest test case. If you have not already, try installing the official Facebook Puzzles application from http://apps.facebook.com/facebookpuzzles/ and publish a story about your solution! To publish, just go to http://apps.facebook.com/facebookpuzzles/mypuzzles.php and click on the publish link.

If you are applying for a position within Facebook, the puzzle difficulty solved will be taken into account with regards to how much time you had available to solve it (remember that Hors D'oeuvres are only tests for your benefit). I have taken the liberty of alerting our recruiting team about your success. Best of luck!

Sincerely,
-The puzzle robot

23 September 2010

Kludge

Después de haber traducido un documento de Knuth, muchas palabras interesantes me llamaron la atención, entre otras fue kludge que significa una solución no inteligente a un problema en ingeniería, en este caso particular de computación.

UPDATE1 (2016.01.25): Que es diferente a la palabra que intenta crear (y popularizar) en honor a Turing:
"Nomenclaturing: Let's Ture to the Max!"
http://www-cs-faculty.stanford.edu/~uno/news12.html


25 August 2010

Falsos Amigos Em Português

Después de estudiar Português por 1 año, pude hacer mi lista de vocabulario y donde me sorprendio varios aspectos de este idioma, entre otros la gran cantidad de amigos falsos que existen entre Castellano y Portugués:

PortuguêsCastellano
acordardespertar
acordedespertar
apagarapagar, borrar
apelidosobrenombre
asaala de avion, pajaro
asasalas
assim queapenas (apenas pueda)
assistever, ir
baterpegar
batirlater
bilhetebillete, boleto, papeleta
biscoitogalleta
bistecbife
boloqueque
bolsacartera
borrachogoma (caucho)
cabocable
cachorroperro
cafe de manhadesayuno
cafe passadocafe de maquina
calçapantalon
carterabilletera (de hombre)
casacochaqueta mujer
cenaescena
costasespalda
criado-mudovelador
dadosdatos
decoraraprender de memoria, memorizar
descargatirar cadena
deslocadadislocada, desplazado
despidadesnuda
dirigirmanejar, conducir
distintadistinguida
encomendarencargar
enganoequivocado
escritoriooficina
feiraferia
feriadía de la semana, descanso
fracadébil
irritadaenojada, molesta
latirladrar
malamaleta
massapasta
mesmorealmente
mesmo queaunque
montemontón
moralmoraleja
ondaola
palavrãogarabato
pastapaté
pasteisempanada fritas
pegartomar
perdurarcolgar
pimentaaji
pincelisopo
presuntojamón
prontolisto, acabar
pulsomuñeca
que logode pronto
romancistanovelista
ruviapelirroja
secasequia, secado
segundosegún, segundo
senhacontraseña
serenasirena
sinocampana
sobre tudocasaca
sobremesapostre
sobrenomeapellido
solosuelo
telapantalla, televisor
termotérmino
tirarquitar, sacar
tomara queojala
tonturamareo
traçoguión
tragatraiga
vasoescusado, macetero
veiavena

06 August 2010

Sun Certified Enterprise Architect (SCEA)

Varias veces me han pregunto he insistido respecto la certificación Sun Certified Enterprise Architect (SCEA). La mayoria cree que se necesitan todos los certificados especificos de J2EE.

Como se ve en la figura (y pueden rectificar en la página), no tiene ningun requisito para poder tomarlo. Claro esta que no se recomienda ya que abarca todos los temas especializados.

Lo que si es diferente es que la forma de desarrollo del examen es diferente, cual consta de 3 partes: Examen, Proyecto, Ensayo. Mas parecido a una memoria de pre-grado.

02 August 2010

Neo-vintage 2: Pagination in Struts... JSTL implementation

Many times I have needed to use an pagination for many data to be shown in my page, however there is no a good Tag implemented for Struts and not as JSF that has components for it..

There is a good encapsulation with the great library DisplayTag, but this one doesn't give too much freedom to create different things, thus this approach is more flexible.

Finally searching for the web I found a simple JSTL pagination, where you can give a collection of data and at level of presentation parse it and embedded with html and javascript we can get the final pagination that we wish.http://web.archive.org/web/20071213001753/http://www.ekcsoft.com/jstl/content/paginate/ (it is no longer alive).

It has a small bug when the collection is empty therefore the totalCount is zero.

It can be put inside Struts without problems, below can see code of it,:
<c:set var="totalCount" scope="session" value="${queryResults.rowCount}"/>
    <c:set var="perPage" scope="session" value="20"/>
    <c:set var="totalPages" scope="session" value="${totalCount/perPage}"/>
    <c:set var="pageIndex" scope="session" value="${param.start/perPage+1}"/>

   <c:if test="${!empty param.start && param.start >(perPage-1) && param.start !=0 }">
          <a href="?start=<c:out value="${param.start - perPage}"/>">Prev </a>
    </c:if>

   <c:forEach
        var="boundaryStart"
        varStatus="status"
        begin="0"
        end="${totalCount - 1}"
        step="${perPage}">
        <c:choose>
            <c:when test="${status.count>0 && status.count != pageIndex}">
                             <a href="?start=<c:out value='${boundaryStart}'/>">
                                <c:out value="${status.count}"/> |
                            </a>
            </c:when>
        <c:otherwise>
                <c:out value="${status.count}"/> |
        </c:otherwise>
        </c:choose>
    </c:forEach>

    <c:if test="${empty param.start || param.start<(totalCount-perPage)}">
          <a href="?start=<c:out value="${param.start + perPage}"/>">Next </a>
    </c:if>

02 July 2010

Oracle JRockit: The Definitive Guide Review

Oracle JRockit: The Definitive Guide
Copyright © 2010 Packt Publishing

Just like the title establish, this is the definitive guide of JRockit, including the last features of version R28.

It starts with the canonical knowledge to work and understand the JVM, showing details from the most basic until the advanced topics. Describing how and why certain features were made, how it was improved and plus several Best Practices lists to take the best of the suite of tools bundle with JRockit.

The book is wisely divided in two parts, the first is about JVM and the second part is regarding to JRockit Mission Control. Which is a powerful set to dissect JRockit Beauvoir to find out memory leaks, performance, bottlenecks, etc.

It gives an extended explanation of the parameters to take better of this tools suite with a low overhead, many of the areas referred can't be found somewhere else in such deeply detail form.

Everything in only one compendium of information done by the same creators of JRockit.

 More information at:

10 June 2010

Oracle JRockit: The Definitive Guide


This new book for JRockit will be release on June. It is written for specialist in the field.
https://www.packtpub.com/oracle-jrockit-the-definitive-guide/book

At first view it shows all the great enhancements has JRockit for tuning, analyzing, trouble-shooting, etc.

24 May 2010

Martin Gardner QEPD

Lamentablemente Martin Gardner ha dejado de vivir, gran difundidor de las matemáticas recreativas.

A pesar de su avanzada edad todos seguiamos su legado que por muchos años nos inspiró en su mundo imaginario.

http://es.wikipedia.org/wiki/Martin_Gardner

Blog Archive

Disclaimer

Qux