So I decided to do an upgrade on my desktop machine to give it some more power, and cycle down the old system to replace my server as it could really use an upgrade. Did some searching and decided to go with a Intel Core Duo 2 2.4ghz on an Asus P5B board with 4 gigs of ram. Got it all home this evening and started tearing apart my system and installing all the new shinny computer parts. Got it all together without much problem and then started on getting my desktop back up and going. This is where things started getting tricky.
First, the bios was only showing 3 gigs of ram no matter what I tried. After doing a bios upgrade (which you can do on flash memory stick these days), I found a site mentioning a bios setting that you need to change to make it show 4 gigs. (BIOS -> Advanced -> Chipset -> North Bridge Configuration -> Memory Remap Feature).
So after finally getting that sorted out I decided to do a fresh install of debian on a new hard drive I got for the machine. Went through and finished the install, but then realized I only had 2 gigs of ram available. Thinking it was a kernel option I had seen before I recompiled the kernel with 4 gig memory support but no change. Then after doing some googling found out that you need to be running the AMD64 port to be able to access that much memory.
So, I then downloaded the AMD64 installer (which is kind of a strange name since it seems to cover all x86_64 chips). I then ran into a problem with the installer and this particular board it seems and for the installer to not hang you need to run it with the option agp=off so that it doesn't attempt to load the intel_agp driver which seems to cause problems.
But now it seems the system is finally up and going. And this is the first 64bit system I've actually installed as well so that should be interesting...
posted at: 02:55 |
path: /debian |
permanent link to this entry
The syntax for passing options to a widget with toscawidgets is slightly different than it was with the turbogears widgets. This actually had me google searching for a while to find this so I thought I'd post it here as a full example:
You define your widget in the controllers.py file:
from toscawidgets.core import WidgetsList
from toscawidgets.widgets.forms import SingleSelectField, TableForm, TextField
from formencode.schema import Schema
...
class FilteringSchema(Schema):
filter_extra_fields = True
allow_extra_fields = True
class Fields(WidgetsList):
testselect = SingleSelectField(label="Test:", validator=validators.Int())
name = TextField(validator=validators.NotEmpty(), label="Name:", attrs={'maxlength':128})
testform = TableForm("TestForm", validator=FilteringSchema, fields=Fields(), action="save", submit_text="Submit")
class Root(controllers.RootController):
@expose(html="test.templates.formpage")
def formpage(self):
selectlist = [(1, 'option 1'), (2, 'option 2')]
data = dict(child_args=dict(testselect=dict(options=selectlist)), value=dict(name='Test Guy'))
return dict(form=testform, data=data)
This produces your form and the data to populate your form passed as
form and
data. In the formpage template you simply display the form with the following line:
${form.display(**data)}
This should produce a form with a select field showing
option 1 and
option 2 in a dropdown, and a name text field filled in with the value
Test Guy.
posted at: 01:45 |
path: /turbogears |
permanent link to this entry
I've started working on an existing
turbogears application recently and we're about to do a pretty major update. From what I've read
genshi is taking over from where kid left off and so before I go any further with
kid I thought it best to migrate the project to genshi before we get into styling the site and so on. I ran into a few little problems with widgets and some syntax changes between the two which I thought I'd outline after piecing together the following from a few different google searches. I made the following change using turbogears 1.0.2.2:
Set turbogears to use genshi in your dev.cfg (or app.cfg):
tg.defaultview = "genshi"
Rename your kid templates from .kid to .html
Modify your template headers should look similar to this:
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://genshi.edgewall.org/"
xmlns:xi="http://www.w3.org/2001/XInclude">
<xi :include href="master.html" />
notice the use of Xinclude instead of py:extends
Modify your master.html file if your using one close to the stock from tutorial:
old: <head py:match="item.tag=='{http://www.w3.org/1999/xhtml}head'" py:attrs="item.items()">
new: <head py:match="head" py:attrs="select('@*')">
old: <meta py:replace="item[:]"/>
new: <meta py:replace="select('*')" />
old: <body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">
new: <body py:match="body" py:attrs="select('@*')">
old: <div py:replace="[item.text]+item[:]"/>
new: <div py:replace="select('*|text()')" />
If you are using turbogears widgets they will not work with genshi and it seems the best solution is to use
ToscaWidgets (check the site for installation instructions). I was able to get them working by simply importing the widgets from the toscawidgets module and using the FilteringSchema class. Other than that widgets work just the same as they did before. Here are the changes in the controller.py file:
from toscawidgets.core import WidgetsList
from toscawidgets.widgets.forms import TextField, HiddenField, SingleSelectField, TableForm, TextArea, RadioButtonList
from formencode.schema import Schema
...
class FilteringSchema(Schema):
filter_extra_fields = True
allow_extra_fields = True
class ProjectorFields(WidgetsList):
test1 = TextField(validator=validators.NotEmpty(), label="Test 1:")
test2 = TextField(validator=validators.NotEmpty(), label="Test 2:")
form = TableForm("testform", validator=FilteringSchema, fields=TestFormFields(), action="testform", submit_text="Submit")
The one last thing I ran into was the use of py:attrs has changed to using a dictionary of values:
old: py:attrs="selected=tg.selector(id == testid)"
new: py:attrs="{'selected': tg.selector(id == testid)}"
posted at: 01:56 |
path: /turbogears |
permanent link to this entry
I purchased a
Kill-A-Watt (P4400) a few days ago and started measuring my energy usage to see what I could conserve on. I thought I'd publish what I found to give an idea on what devices drain the most electricity. Everything listed here is measured in VA (Watts).
Device | Standby | In Use |
AVR 230 Audio Recevier | 1 | 60-75 |
Toshiba DVD Player | 0 | 12 |
Goldstar VCR | 2.5 | 9 |
19" Acer LCD Monitor | 1 | 26 |
21" Viewsonic CRT Monitor | 2 | 60-70 |
Athlon 3500+ gaming computer | 4 | 165-185 |
Athlong 3000+ desktop | 4 | 99-125 |
Epia M6000 computer | 3 | 16-22 |
Epia M10000 computer | 4 | 47-60 |
Apple iBook G4 | - | 15-22 |
Linksys WRT54G wireless router | - | 4 |
Linksys VOIP router | - | 6-7 |
RCA Cablemodem | - | 4 |
D-Link 8 port switch | - | 4 |
BenQ BP6100 Projector | 11 | 245 |
Toshiba 32" CRT TV | 1 | 61 |
Compact flourescent lamp | - | 13 |
Small Compact flourescent lamp | - | 3 |
Small lamp with small incadescent bulb | - | 36 |
Aquaclear 150 Pump | - | 3 |
Rena Filstar XP 1 Pump | - | 17 |
Aquaclear 50 Heater | - | 180 |
Rena Air Pump | - | 2 |
2 x 48" T8 Flourescent Lights | - | 50 |
2 x 24" T5 Flourescent Lights | - | 30 |
65W 24" Compact flourescent lights | - | 50 |
posted at: 20:03 |
path: /energy |
permanent link to this entry