Category Archives: Uncategorized

Find out which page is popping up windows

Some web pages open pop-up windows which they hide behind the main browser’s window. This can be frustrating because when they get discovered behind the stack of open windows one cannot possibly know where they came from. These pop-up windows … Continue reading

Posted in Uncategorized | Leave a comment

Java: adding directories in a ZipOutputStream

Lately I had to write some Java code that consumes and generates zip files using the classes from the java.util.zip package. Although I wasn’t excited with the library, it is fairly simple and gets the job done. Here’s a very … Continue reading

Posted in Uncategorized | Leave a comment

Arduino: properly measuring time intervals

When programming an Arduino it is sometimes useful or necessary to measure the time that elapsed between two certain points of the program’s execution. The most straightforward way to do that is to save one timestamp on each point, and … Continue reading

Posted in Uncategorized | 5 Comments

Netbeans slow repaint over Remote Desktop [solution]

Lately I have been connecting sometimes to my computer at work, from home via Remote Desktop Connection (RDP). While everything is pretty much acceptable, I have noticed that Netbeans was so slow in repainting its windows, to the point of … Continue reading

Posted in Uncategorized | Leave a comment

Unicode characters dropped in PDF files generated with iText and Flying Saucer

Flying Saucer is a very useful Java library that uses iText to convert HTML pages to PDF documents. Here is a nice tutorial on how to use Flying Saucer. The last few days I was trying unsuccessfully  to generate some … Continue reading

Posted in Uncategorized | 2 Comments

MySQL: select the n-th element from a delimiter separated value set

Lately I’ve been dealing with a database where a lot of values are stored as strings of concatenated values, separated by delimiters (e.g. “1,2,3,4″). I have to use these values in queries, for example, for joining with other tables. Selecting … Continue reading

Posted in Uncategorized | 11 Comments

NetBeans: how to bring GUI Builder Assistant back

NetBeans IDE comes with a very hand visual editor for designing Forms and Dialogs, called the “GUI Builder“. One of the features I like the most is the ability to snap components relative to another component’s position or relative to … Continue reading

Posted in Uncategorized | Leave a comment

jQuery: How to check whether a div contains hidden “overflown” content?

The “overflow: hidden” CSS property instructs the browser to clip the excessive content that appears inside an element. One way to detect programmatically (in Javascript) whether an element actually contains any “clipped” content or not, is to compare the value of … Continue reading

Posted in Uncategorized | Leave a comment

How to constrain an image's dimensions while maintaining its ratio

I know, this is not nuclear physics, but it tricks my mind every once in a while when this occurs to me. Let’s assume the general case of an image with dimensions w×h, and that you need to scale it … Continue reading

Posted in Uncategorized | Leave a comment

How to arithmetically sort an array in Javascript

Something interesting that I discovered tonight is that JavaScript’s sort() function by default sorts values lexicographically (that means, for example, that “10″ comes before “2″), even when the array contains numerical data. Let’s consider the following code: var values = … Continue reading

Posted in Uncategorized | Leave a comment