Wezzul.com - It's the Dinglez

Posts in february 2007 - Wezzul.com
Ok, so I'm only posting this because I had problems with booting Linux from a flash drive on some of the Dells around here (most notable a GX270 and a Precision 650). I could boot Slax and DSL just fine on most machines, but on the Dells, I got the error "Unable to load operating system". The fix for this was found on the DSL Wiki, and it dictates that you have to overwrite the MBR of the flash drive with something called ms-sys . I did this, and booting on those problem Dells became easy.
Posted on Thursday, February 22, 1:13pm in Tech by wezzul | Comments? | Permanent Link

In the project I am currently working on, I have to take data from a form field and generate images from it. These images need to have a transparent background. Here is the way I did that:


# create the original canvas giving it width and height
canvas = Image.new("RGBA", (W,H))

# select a font (you need to have compiled PIL with freetype installed for the
#_imagingft module to be on the server. This is necessary for this process.
font = ImageFont.truetype("/path/to/ttf/font", size_int)

# setup image to draw text on it
draw = ImageDraw.Draw(canvas)
black = "#000000"

# draw text on canvas, using offsets from upper left corner
draw.text((25,2),text,fill=black,font=font)

newImg = someFileHandle
canvas.save(newImg, "image_type")
newImg.close()


Done!
Posted on Thursday, February 01, 3:02pm in Tech by wezzul | Comments? | Permanent Link

This one took me a minute to figure out, but I'm happy I did. To create a new skin from the filesystem, and add your own layers to it (or in this case, add the layers from Plone Default), do the following:

#use this to get the skins directory
ps = getToolByName(self,'portal_skins')

# use this to add a new folder to that directory for your new skin
ps.manage_addFolder(skin_id, skin_id)

newSkinFolder = getattr(ps, skin_id)
path = newSkinFolder.absolute_url()

# get a set of tuples of all skins
paths = ps.getSkinPaths()

# these lines get the layers from Plone Default
defPath = paths[0]
defPath = defPath[1]

# add your new folder to the top of the Plone Default layers
defPath = skin_id "," defPath

# add the skin to the properties of portal_skins
ps.addSkinSelection(skin_id, defPath, 0, 0)


Pretty straight forward, right? In any case, it is helping me immensely with the current project.
Posted on Thursday, February 01, 8:59am in Tech by wezzul | Comments? | Permanent Link