Posts for Tag: tips

On using MySQL and working remotely

A couple of interesting articles this morning, one about [why you should not use MySQL]( (i particularly love the expression "Mysql development and administration causes brain damage, folks...") and a [rant about remote work]( and why companies still can't see the value in it.

Automator service to resize image to several sizes

Here's an Automator service to [resize an image into several sizes](/files/ Unzip and copy the package "Multiple Sizes.workflow" to your **~/Library/Services** folder and you will get a new entry on the finder services context menu. Just right click any image and choose "Multiple Sizes" from the services menu.

For instance, if you select an image named "image.png" it will create the following files on the same folder:

- image_512.png - image_256.png - image_128.png - image_64.png - image_32.png

Feel free to open it up in Automator and modify to your needs :)

Sets - Link collections made simple

Meet [Sets](, a website that allows you to create and maintain lists (or sets) of links. Much like with sex, you can do it solo or with other people. I think it has the potential to replace [Delicious]( and other bookmarking sites even if, for now, it does not support tags or groups... although that's not necessarily a bad thing :)

The design is super simple and pleasing to the eye and they include a bookmarklet to help you link any webpage you visit, much like [Pinterest]( did. One of the features i love is the fact that it automatically retrieves the title for the link, based on the url you enter. I wish they would expand this to also retrieve pieces of text in the web page and let you choose if you wanted any of them as a start for the link's description.

Here's my first take on a set: [A collection of modern TV shows]( Check it out, you might have missed some ;)

JAVA vertical gradient background panel

Recently i had to create a gradient background for one of the panels in our [POS application](, so i though i'd share the code.

You need to pass the top and bottom colors of the gradient and also make sure that any panels inside this one are transparent (i.e. setOpaque(false)), otherwise they will paint above it.

import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints;

import javax.swing.JPanel;

public class VerticalGradientBackgroundPanel extends JPanel {

private Color topColor; private Color bottomColor;

public VerticalGradientBackgroundPanel(Color topColor, Color bottomColor) {

this.topColor = topColor; this.bottomColor = bottomColor; }

@Override protected void paintComponent(Graphics grphcs) {


Graphics2D g2d = (Graphics2D) grphcs;

g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); GradientPaint gp = new GradientPaint(0, 0, topColor, 0, getHeight(), bottomColor); g2d.setPaint(gp); g2d.fillRect(0, 0, getWidth(), getHeight()); } }