Wolfram|Humor

Drivel No Comments »

So, if you haven’t heard of Wolfram|Alpha, I urge you to check it out. It’s certainly something new in the internet world that deserves attention.

Wolfram Research built the Wolfram|Alpha search engine. Yes, these are the same people that brought you Mathematica. Therefore, it doesn’t come as a surprise that when I ask Wolfram|Alpha about the airspeed velocity of an unladen swallow, I received the following result:

Frankly, I can’t tell if I like the answer, or if the Wolfram Research people need to get a better sense of humor.

Then again, I suppose they’re mathematicians, so they were born without humor.  I guess this is the best they can do.

Either way, check out Wolfram|Alpha.  Let me know if you find anything interesting!

Why I use Smarty: PHP is an ugly templating language

PHP Development No Comments »

There’s a debate going on here regarding Smarty’s usefulness as a developer tool. It was sparked (again) by the launch (or at least newly noticed) nosmarty.net. I commented:

I don’t understand how ZF or Symfony or any framework can be an “alternative” for Smarty. Smarty is not a framework — it is simply a templating engine. It should not be used as anything other than a component of the view layer of your MVC application. Just like any other software, it has a learning curve and a certain amount of quirks. Using Smarty does not guarantee good design — that still needs to be handled by programmers who have more experience than writing a “Hello, World!” program and reading a tutorial.

I think the fact that it’s been around since 2001 and is still in use is a testament to it’s usefulness within the community. If Smarty is used in the right manner, I don’t see why it can’t have it’s place within the arsenal of tools for developers to use.

It was countered by Paul M. Jones with:

In my opinion (note the small “o”) there *is* no right manner in which to use Smarty. It is the solution to a mis-stated problem. I suppose I shall have to expound on that at greater length in another blog post. Oh, I already have! http://paul-m-jones.com/?p=273

I understand this point, however I still have one reason to use Smarty: PHP is an ugly templating language. I’ve used Smarty and Symfony (which relies on PHP’s alternative syntax for templating) and I still prefer Smarty.

The examples on nosmarty.net generally site one instance of echoing a variable. In this small case, sure, I can see — why use a heavier templating system that takes longer to parse and can be a bitch to configure and deal with. However, if you’re looking at a portion of a html page that has to output multiple variables, Smarty is much easier on the eyes.

SMARTY:
<td>Name</td><td>{$name}</td>
<td>Email</td><td>{$email}</td>
<td>Phone</td><td>{$phone}</td>

PHP:
<td>Name</td><td><?php echo $name; ?></td>
<td>Email</td><td><?php echo $email; ?></td>
<td>Phone</td><td><?php echo $phone; ?></td>

When you start repeating <?php … ?> everywhere it gets fairly redundant, and, frankly, ugly.

Perhaps my use case for Smarty is a bit selfish, but, ultimately, programming style and comfort boils down to personal preference. Most, if not all, programming tools have the ability to be misused. I still consider Smarty to be a useful tool in my development arsenal. Though I have not used smarty in over 2 years now, using strictly PHP templating (mainly due to Symfony’s templating conventions), I would happily start using it again to regain readable templates.

De-annoyifying Subversion Externals

PHP Development No Comments »

Subversion externals are a way to include other packages in your code that are maintained somewhere else.  For example, if I was developing an application that needed to send out mail, I could use SwiftMailer and define that as an external for my project. When I run ‘’svn up” it will grab files from the SwiftMailer project and copy them locally. (How to define externals is beyond the scope of this post. RTFM!)

One annoying part of externals is that even if there are no changes to your code, your Subversion status output will be filled with externals information. For example, I have included symfony as an external in my project and now the default status output is:

X      lib/symfony

Performing status on external item at 'lib/symfony'
X      lib/symfony/doc
X      lib/symfony/lib/plugins/sfDoctrinePlugin
X      lib/symfony/lib/plugins/sfPropelPlugin
X      lib/symfony/lib/vendor/lime

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin'
X      lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel
X      lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/phing
X      lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/phing'

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel'

Performing status on external item at 'lib/symfony/lib/plugins/sfPropelPlugin/lib/vendor/propel-generator'

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin'
X      lib/symfony/lib/plugins/sfDoctrinePlugin/i18n
X      lib/symfony/lib/plugins/sfDoctrinePlugin/web
X      lib/symfony/lib/plugins/sfDoctrinePlugin/lib/doctrine

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin/i18n'

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin/web'

Performing status on external item at 'lib/symfony/lib/plugins/sfDoctrinePlugin/lib/doctrine'

Performing status on external item at 'lib/symfony/doc'

Performing status on external item at 'lib/symfony/lib/vendor/lime'

This is obviously annoying as it obfuscates the part of the project that I’m working on. The switch command does have an option to ignore externals, aptly called –ignore-externals but I don’t want to have to type that in every time I run a svn st command.

After browsing around the net for a bit, I found this piece of bash script that will swap the defaults for me:

svn() {
        case "$1" in
                st|stat|status)
                        svnargs1=""
                        svnargs2="--ignore-externals"
                        for i in $@; do
                                if [ "--examine-externals" == "$i" ]; then
                                        svnargs2=""
                                else
                                        svnargs1="$svnargs1 $i"
                                fi
                        done
                        command svn $svnargs1 $svnargs2
                        ;;
                *)
                        command svn "$@"
                        ;;
        esac
}

What’s nice about this script is that I can run status on the externals as well by specifying –examine-externals — and they’ll be back, in all their annoying (yet sometimes needed) glory.

On my Mac, I just placed the code in /etc/bashrc and now it’s available as a layer over the svn binary. (You may need to restart your terminal session for it to take effect.)

Birthday… salami?

Drivel 1 Comment »

So Igor brought me a “birthday salami.”  Uhh.. right

huh?

Show your Intolerance

Politics No Comments »

While driving home the other day, I saw a few homes in my neighborhood that proudly advertise “Yes on 8″.  If you don’t know, Proposition 8 is a California initiative to remove the state supreme court upheld right for same sex marriage.

I am not gay, nor do I actively promote the gay and lesbian cause. They can do whatever they want behind closed doors, just the same as I can do whatever I want behind closed doors. Yes, marriage is a sacred union of two people. Why does anyone care whether it’s between a hetero or homosexual couple? What place do I have, personally, or the state as a whole, to deny people that right? To deny the right of two people getting married based on their sexual orientation due to your personal beliefs is quite a departure from the cry of tolerance that this country is striving to achieve.

Proponents of Prop 8 may say that they don’t want homosexual marriages because a marriage is between a man and a woman. Ok, fine. Now, how do we extend the same rights and legal status to a gay or lesbian couple if they can’t get married. Proponents once again chime in: let’s give them separate, but equal civil unions. Right. “Separate, but equal.” …because that worked so well for our country with segregation.

It’s time to cut the crap. Who cares what other people do behind closed doors; it’s not your problem. The United States strives to be a country of equality, of opportunity, and of tolerance. When you advertise your support of Prop 8, you demean this country’s values and spread the support of intolerance.

Join me, and many others, in defeating Prop 8. It would be un-American to do otherwise.

Taking the blame

Politics No Comments »

Let’s move into the realm of the hypothetical. Let’s say that Obama gets elected for President. Not only does he get one of the most powerful jobs on the face of the planet, but he also receives a damaged economy, high unemployment rates, states on the verge of bankruptcy and a stalled mortgage market. Frankly, I’m surprised that anybody really wants that job.

Nevertheless, the 850 billion dollar (700 + 150 in sweeteners) bailout package was passed. Within the next few weeks the government will be nursing failing banks and Wall Street back to health with money that will need to be repaid by tax payers. It will be the job of the next President (Obama or McCain) to assist in moving the money around to cover these debts. I believe that it is inevitable that taxes will be raised in order to make up the difference.

Now, in this hypothetical situation, we have Obama (a Democrat) in office, raising taxes. Yet, I have very little doubt that the Republicans will be fighting tooth and nail against tax increases. It’s in their blood. Not only that, but they will be blaming the Democrats for the financial mess that the previous Republican administration has left. The next president will be taking the blame and be responsible for this horrendous mess, and I bet Obama will take much more guff from politicians and pundits than McCain ever would.

Either way, the next President will have some tough decisions to make, and I don’t envy that job one bit.

Where art thou my css?

PHP Development No Comments »

I’ve been playing with the symfony auto-generated forms, which are a really nice way to bootstrap an application. However, the forms that it generates are not styled at all, which makes developing with it (and looking at it all the time) quite painful on the eyes. Here’s some CSS to make your auto-gen tables look more like what the forms book shows in the examples. All you’d need to do is class the table with “autoform”.

table.autoform {
	border: solid 1px #CCC;
	border-collapse: collapse;
	border-spacing: 0px;
	padding: 0px;
	margin: 0px;
	border-spacing: 0px;
}

table.autoform th,table.autoform td {
	border: solid 1px #CCC;
	border-collapse: collapse;
	border-spacing: 0px;
	padding: 3px;
	margin: 0px;
}

table.autoform th {
	background: #EEE;
	font-weight: bold;
	text-align: left;
	padding-left: 10px;
	padding-right: 20px;
}

table.autoform ul.error_list {
	color: red;
	padding-left: 20px;
	margin: 0px;
}

Tell me something I didn’t know

Drivel No Comments »

Pumped my gas today, and this is what it says to me.

1337 gas

1337 gas

Yeah. 1337.

Oil tycoon bastards.

I blame George Bush…

Drivel 3 Comments »

On Friday, March 28th, my wife and I went to visit my parents in a nice Sacramento suburb. We parked our car in the driveway overnight, and some bastards take some kind of instrument and smash the driver’s side window and dent the metal trim surrounding the window. Motivation: an iPod Touch that I, now regrettably, forgot to bring into the house.

Thankfully, the iPod was itemized on our renters insurance, and the window was covered with a small car insurance deductible. All in all, it was only a few hours of hassle to get everything sorted out over the phone, have the window replaced and clean up the mess.

However, I have been considering the following question: What, exactly, would prompt a minor crime such as this in a “nice” area of town. Perhaps the area is not as nice as I think it is, but all indications show that the population is generally of the older variety with grown children. Of course, miscreants may swing in to the nice neighborhoods specifically to target people they assume have a higher income than themselves. That notwithstanding, it still takes a certain amount of balls to break into a car just to steal an iPod. I believe that this specific crime boils down to the current economic climate of the country, and, ultimately, the combined actions (or inactions) of our government that has widened the perceived disparity between classes and the overall state of despair.

Our country, with no uncertainty, is in an economic downturn. I’m no economist, but I believe it’s more psychology than economic factors that’s stopping the government and officials from uttering the word ‘recession.’ No matter what it is, it ain’t good. The country is in great monetary debt and many families are tortured by the threat of having banks foreclose on their loans. Though the current administration passed the Economic Stimulus Package, I think it will take a regime change (either Democratic or Republican) before our country is able to get out of this rut. Meanwhile, our “team” morale has been shattered, and people who were doing fine before this rut are now, driven out of some form of desperation, acting on primal impulses and initiating misdemeanor crimes in order to satiate their inner desire.

Granted, no amount of perceived psychological security will ever completely stop crimes of this nature; there are certain primal urges that some types of people are unable to contain. However, as the country recovers from this mess that we’re in, I’m sure crimes of this nature will decrease, and restore the peace back into a local suburb near you.

Spring

Drivel No Comments »

Happy first day of Spring, everyone!

Spring has sprung,
the grasses riz.
I wonder where
da boidies is?

All da boids
is on da wing.
But dats absoid
because da wing
is on da boid.


Copyright © 2007-2009 dotEvan. All rights reserved.