Category Archives: Education

Drop Shadows and Snapshot Borders – Automating Image Manipulation

Many of the web projects we do have tons of images that require manipulation and processing. Although the GIMP and Adobe Photoshop are extremely powerful tools, they require a user. That would you be you, sitting in your chair, operating on images by hand with your mouse, stylus, and keyboard. You can do amazing things, but a lot of times you’re just processing over and over and over. When you want to speed things up and move on to more interesting tasks, you will turn to ImageMagick, a set of command line utilities for processing images en masse.

A nice effect that I enjoy is the "snapshotization" of digital photos.  Take a look.

Parameters I wish to adjust:

  • Rotation (arbitrary)
  • Border width and color
  • Shadow depth, transparency.
  • Background color
Continue reading

Mysql 4.0.x LATIN1 to Mysql 4.1.x UTF-8 Nightmares

Whew! Finally I have accomplished what I had been putting off for a while, namely a MySQL upgrade that had been due. Here’s the problem:

­What would normally be a straightforwa­rd LATIN1 or ­ISO-8859-1 to UTF-8 character conversion turns out NOT to be. Why? Well, just because the old database character set defaulted to LATIN1, and most things were stored in LATIN1, not everything was. This very website, powered by WordPress, has been storing data as UTF-8 since forever. So we have a problem. Can you see it? The database and its data are mostly LATIN1, but some data are not.

An automated mass conversion would not be possible.

See why I had been putting it off?

The solution, if you can call it a solution, is to convert all the tables that are NOT WordPress first.

Continue reading

Fighting the Good Fight Against Spammers

The holiday season is crazy enough for ordinary citizens going about their daily routine, shopping, fighting traffic, long lines, time deadlines.  Then there's the threat of credit card and identity theft.  If that's not enough, we workers in the IT world have to deal with the maleficent opportunists that seem to come out of the woodwork to ply their warez, spam, and botnets at this time of year.

Over at Altamente, I've been battling spammers and hackers constantly since the day after Thanksgiving.  Why Thanksgiving, do you ask?  I'm so glad you asked.  It's simple.  In the US, from Thanksgiving to the last shopping day before Christmas, consumers will account for roughly 17% of all retails sales. 

Spammers and hackers want their cut. 

Whether it be phishing, hacking, or spamming, they have been a constant pain in the neck. 

Imagine my surprise this morning when I noticed the email was slow.  I peeled back the carpet to find a hoard of roaches swarming about. 

Yeach. 

Tons of messages were in the outgoing queue from an anonymous user, spam messages sent by my server to unwilling recipients.  I was shocked and disgusted.  How could this have happened?   I took a deep breath, decided not to panic and calmly looked through the logs and web traffic.  I already suspected a rogue web script on some virtual host somewhere.  Let's have a look at which client has gotten a bump in server traffic recently.

And there is was, a script being used by one of Altamente's clients, wp-email.php.  Now, in all fairness to the author, he has since applied a bit of paint to his "Email Article" plugin for WordPress in the form of a Captcha.  In my case, however, I overlooked the patch and the result: spammers had been injecting an automated attack against the script to deliver their payload as if it was a normal email.

Solved!  But I'm still annoyed.  Remember people, any php or web script that allows a user to send email needs to be thoroughly checked against such variable over-writing.  All input strings must be parsed and checked.  Put up email forms at your own peril.

Or at least watch them carefully during the Holidays. 

Multi-lingual WordPress with Apache2 and Content Negotiation via index.html.var

That’s a mouthful, isn’t it. In short, I’m writing this little tutorial for those that need to maintain a WordPress site in more than one language. This particular setup is geared toward WordPress, but the techniques can be used for other html files and Content Management Systems.

First, use Apache’s new index.html.var file. You will find a copy in your default webroot that comes with a default Apache installation. This index.html.var file will take the place of your index.html or index.html.xx file residing in your root directory. Without getting too technical the file is just a mapping of user language requests to appropriate localized content wherever it may be.  It’s way more flexible than MultiViews.

Continue reading

Procedural Flash Animation in Linux

This is an introduction to creating completely non-interactive, or procedural flash animation using Linux. The beauty of this is not that you can do more, or that it’s prettier, or even faster to create. The beauty lies in the power. Once an animation procedure is set, the elements can be changed simply by including new images, colors, or messages. In fact, I’m working on a simple web-form to generate the above animation by simply uploading elements and text inputs.

But first, let’s get to the tutorial, shall we?

The door scene modeled in POV-ray scene description language and is typical of Old San Juan, Puerto Rico Spanish Colonial architecture. The real doors are beautiful. If you ever get a chance to take a cruise from/to Puerto Rico, don’t miss the chance to walk around Old San Juan (El Viejo San Juan) and check them out. I rendered three frames with the doors rotated from 0 to 75 degrees to simulate… guess what? Opening doors. Clever, huh?

There’s a lot of POV code, here’s a little bit of what it looks like:

cylinder { <0, 0.5, 0>, <0, -0.5, 0>, 0.5
texture {
pigment { color rgb <0.6, 0, 0> }
normal { granite 0.02 turbulence <0.5, 0.9, 0.2> scale 0.25 }
finish { specular 0.1 reflection .1 }
}
}

It’s pretty simple. You place objects in an X-Y-Z space (Cartesian coordinates) like a sphere, cylinder, box or any other of the predefined primitives. You can merge them, subtract them, intersect them in creative ways. Finally, you apply some sort of texture which includes a pigment, a surface (normal), and a finish (reflections effects etc). There are easier ways to model, but sometimes POV-ray’s scene description language is just the most elegant and easiest way to model something.

The next step was to convert the png files to jpegs for inclusion in the flash animation. I used a little sprinkle of bash and a dash of kosher ImageMagick’s convert.

for file in *.png; do convert -quality 100 "$file" "${file%.png}.jpg"; done

For each png file, convert the png file to a 100 percent quality jpeg file. We use 100% quality because I’m going to let the swftools take care of the final compression. There’s no sense in lossy compressing then lossy compressing again. That’s just crazy talk.

We will now create the flash source file. Open a new file slideshow.sc. This is the textual language for the swftools Linux Flash toolkit. I have never ever ever looked at a flash source file from any Macromedia product, so I have no idea if this animation description method looks/acts/walks/talks in anyway shape or form like Macromedia’s products. Don’t know, don’t care.

.flash bbox=640x480 filename="slideshow.swf" version=6 fps=25 compress background=white

.jpeg s1 "puerta_open03.jpg"
.jpeg s2 "puerta_open02.jpg"
.jpeg s3 "puerta_open01.jpg"
.font font "gilc____.ttf"
.font arial "arialbi.ttf"
.text text1 text="Opening Doors" font=font
.text text2 text="Opening Doors" font=font
.text text3 text="Opening Doors" font=font
.text text4 text="OG" font=arial
.text text5 text="Experts in" font=font
.text text6 text="Open Source" font=font

.put s1 scalex=640 scaley=480 alpha=100%
.put text1 scale=100% x=40 y=220 alpha=0%

.frame 25
.put s2 scalex=640 scaley=480 alpha=0%
.change text1 alpha=100%
.put text2 scale=100% x=40 y=220

.frame 100
.change s2 alpha=0%
.change text1 alpha=100%
.change text2 alpha=100%

.frame 125
.change text1 alpha=0%
.change text2 alpha=100%
.change s2 alpha=100%
.put s3 scalex=640 scaley=480 alpha=0%
.put text3 scale=100% x=40 y=220

And so on (that’s not the whole file, but the rest is just repetition. There are 71 total lines of code for that little flash animation. Is that a lot or a little? Seems pretty small to me anyway. Basically, with swftools you define an object (image, or text); you put it; then you change it. You can change its fade, size, location, and more. The swfc program will implement the change from the object’s last known state. Check out swftools for more examples (that’s where I got all the reference I needed to make my little flash thingie).

So there you have it. I walk through the frames, changing elements, putting, fading, growing, moving stuff around. It’s was all described from start to finish in a procedural language, from the POV-ray scene description language, to bash and ImageMagick for command line image manipulation, and finally to swftools flash scene language for the final animation. Pretty nifty, huh?

Check out: http://www.altamente.com/ for another example.

The neat thing about this is that once the procedure has been developed, you can reuse it for other clients, other looks, colors, messages, etc. In fact, you could directly render it on the server to update information on the fly via end user input. There’s no limit to what you can do with something like this.

Of course if you’re on Windows, you would probably just buy Macromedia’s software… but where’s the fun in that?

Tras la Pista del Consumidor Tecno-Sapiens

En la evolución del ser humano se han dado nombres a vertientes que muestra una divergencia significativa de la evolución. Homo Habilis era hábil con herramientas, Homo erectus caminó de pie. A modo de diversión pero a la vez para reflejar un cambio en la conceptualización del consumidor. Por ello en vez de empezar con “homo” empiezo con consumidor asumiendo que el poder adquisitivo lo ejerce un ser humano. En repaso de las nuevas tecnologías y su efecto sobre el consumidor hablo entonces del “Consumidor Tecno-Sapiens.” El Consumidor Tecno-Sapiens, variante del ser humano moderno que está virando al revéz su relación con los medios. Hasta ahora la literatura del usuario del consumidor de televisión lo presentaba como una persona aplataná en el sofá sirviendo de esponja a todo lo que se sirve por las ondas televisivas o el famoso “couch potato.” Al pensar en mercadear o desarrollar marcas se pensaba en exposiciones a productos a ese receptor pasivo.

Continue reading

The Benefits of Web Standards

newspaper.png

Or How to Build Your Site So Google Can Read It.

WWW standards compliance through a range of browsers and platforms ensures that your message gets to the most people possible and with a uniform experience.

The World Wide Web (W3.org) consortium’s standards keep your web strategy "future proof." Tools and format specifications stay in the public domain which help your web strategy and content evolve transparently and at a predictable pace.

Standards ensure that the most possible devices will be able to use your site. Remember, you are not just serving pages to people. "Other than human" represents a sizable percentage of your visitors. Machine parsed content is required by everything from search engines, to cell phones, language translators, and screen readers for the sight impaired. Standards ensure that these computer agents can effectively make sense of your valuable data, infer meaning, and deliver appropriate results to their human counterparts.

Continue reading

Construyendo Portales para Máquinas

computer.png

Comunicación Efectiva en el Internet

No dejan de sorprenderme los efectos a diario de la revolución del conocimiento que estamos viviendo. El otro día recibimos un correo electrónico de un extraño que sin conocernos se había trovado con uno de nuestros portales personales parafamliares y amigos donde leyó escritos sobre Puerto Rico. Él andaba buscando datos curiosos para darle un toque fuera de lo usual a su viaje a la isla y en la combinación de palabras en su búsqueda de google apareció mi sitio web entre los primeros tres enlaces. En el pasado han pasado por el portal personas buscando leer sobre temas como Sung Tzu, la txistorra, las cuevas de Altamira y otros. Si me sorprende que visiten el portal extraños de países que jamás he visitado, más gracia me dá que una vez lo visitan sigan leyendo nuestras anécdotas personales en otras secciones del portal.

Continue reading

Opening the Door to Open Source for Businesses

Think Open Source is just a new technology buzz word or another way to talk about computers? Think again. At OG Consulting our understanding of Open Source expands its lessons and philosophies to more than just a technology strategy but also to project management, conflict resolution and business development. OG Consulting marries the social sciences and insights into culture and the economy with a vast knowledge of current technologies and future trends. We believe technology should be invisible and procedures open and extensible. Our battleground is the inefficiency and distractions brought forth from technologies that constantly require human intervention in order for them to continue to perform their designed duties or the human inefficiency that stunts innovation and cooperation in companies.

¿Autopista de la Información?

road.jpg¿Autopista de la Información? – Barreras a la Nueva Economía O’Malley & Gorbea

Imagínense a Puerto Rico sin el Expreso Luis A. Ferré, o sin la Num. 2. Ahora, imaginense que para ir de San Juan a Caguas tuviera que pagar un peaje de $10 y viajar primero aMiami para llegar a Caguas. El tapón sería descomunal. Lo mismo pasa en el Internet.

Para que una persona que se conecta al Internet por via el PRTC.net para ver el sitio web "esquina.com" que está auspiciado por Centennial, su pedido viaja primero a Atlanta, Florida o New Jersey antes de volver a Puerto Rico y llegar Centennial. Esto pasa en mili-segundos. Pensarán algunos que no importa, pero lo que estamos haciendo es saturando la preciada fibra transatlantica para ir a la esquina por que PRTC y Centennial no se hablan. Si pudieramos bajar el uso innecesario de la fibra transatlantica, la misma rendiría más, es tan sencillo como eso. Al final del día sería más eficiente y rápido el uso intra-isla de servicios por Internet podrían bajar los precios y habría más lugar para bajar los precios. Entonces, ¿quién paga por la rivalidad exagerada que existe? El país.

Continue reading