Pages

Monday, July 25, 2011

What is "Government Revenue"?

There are a number of definitions of "revenue", but I believe they are misleading when used in the government. Because the government concurrently increase revenue and debt when borrowing (or printing) money, revenues can be grossly inflated (at a rate proportionate to that of the debt). I also don't believe they "earned" that money, as it is all either taxes or loans, but that's subjective (you could argue that taxes, at least, are "earned").

How can you put some "savings" on the books?

From the article: "Boehner ridiculed the $1 trillion in war savings as gimmicky, but in fact, they were contained in the budget the House passed earlier in the year." ..."$1 trillion in war savings", "in the budget"? It's not tangible, for one, and it's money you had already; you can't add it to what you have already, because it IS what you have already. So, tell me again, how did that end up in the budget? Somebody didn't pay attention in math class....

We need to cut spending...period.

No amount of spending (by the government) will reduce the debt (if they continue to borrow in order to perform said spending). If we want to actually reduce the debt, then we'll need to sell more products to other countries, and pay off our debts (to increase the worth of our dollar). In order to do that (make products and sell them), businesses and individuals need money, and that money needs to be worth something. Government taxation isn't helping the former in that regard, and further government loans and money printed by the government isn't helping the latter (and is, thus, counterproductive for the former)

Monday, June 13, 2011

I know...I just keep doing stuff that others have already done. But I thought it was interesting, and that's all that mattered; never mind that using the end product would end up being more work than just writing XML by hand (except for the--not so?--rare case where you repeat the same element many times over), my idea was brilliant! ;-)

First thing's first, the code:

from random import randint
from collections import OrderedDict as orddict

key : The key that is used in the OrderedDict; if unspecified,
will try to get the value from the attributes value (a dict)
in kwargs. If id is not present in attributes, a random number
will be generated instead.

text : The text of a 'textnode' type Node. Otherwise unused.

**kwargs : A dict containing one of these keys:
'attributes' : attributes which will be added to the tag (dict)
all others : currently unused

class NodeTypeError(Exception):
"""Raised when an attempt to create a child on a parent
who doesn't support children occurs."""
pass

Yes, it's not that pretty, but it does the job. Ideally, you might build some framework around this, or maybe you want to take it and make chunks of a page which will be reused in different areas of a page. Regardless of what you want to do, you likely can do it with this. The flexibility of Python classes (which I am just now discovering for myself) is quite useful: At first glance, you might think this class is rather useless--that couldn't be more wrong; throw in a few properties (or modify the get_tree method to accept arbitrary kwargs) and intuitive templating is just around the corner.

The breakdown

I think it's decently documented, but in case you're still finding it hard to follow, here's how it goes:

You create an instance of Node (say, html)

This is your root node of either a node tree or tree fragment

You create children by one of two methods:

The create_child method, which creates another Node instance and appends it to the parent Node's children property

Append a Node instance, which may or may not have children, to a parent Node's children property with the parent's append_child method (preferred) or manually

Profit!!!

Other Thoughts

I imagine someone has already done this (or something very similar); I would be very surprised to learn otherwise. However, I figure it couldn't hurt to put this out there anyway, for those who may not have thought of this, but could do a much better job than I. Feel free to tastefully mention other projects with similar intent in a comment, or criticize my poor understanding of the Python language (well thought out corrections to common mistakes are appreciated).
As for the code...you're free to do anything you like to it (meaning you may copy it, paste it, butcher it, turn it into some horrible monster, create a masterpiece, and/or call it your own). I only ask (not require) that you mention me where ever you see fit. Thanks!

Tuesday, May 3, 2011

I have a dream. A dream of a perfect world. A world where all e-mail clients handle replies and threads perfectly. A world where there is no top or bottom-posting, but where the user decides where to put the message body. A world where the client understands relationships between messages and can use hints--hints from the reply--to associate parts of a reply with it's parent message.