Papervision3D: Materials and Collada

Today I spent a little of my spare time playing with Papervision3D, in order to participate in a Papervision3D Competition. I quickly ran into a problem, to which I couldn’t find the solution the usual way (i.e. Google). However, I finally got it working, and I’m glad to write up my findings here for those of you who might face the same problem.

The Problem

The problem I faced was simple. I downloaded a few Collada files from Google 3D Warehouse, expecting it to work in my project out of the box. It did work, but it gave me a completely untextured model, like so.

Image1

After a little looking around, I spotted a post which suggested looking inside the DAE file, to check if its materials are pointing to the right locations!

Read the rest of this entry »

Do you use WordPress.Com Stats?

I’ve been trying to show my most active posts on my site (for the purposes of driving more traffic) for the past few days, and the plugins that I tried just didn’t seem to work.

That is when I realised I had already installed the WordPress.com Stats plugin. Unfortunately, the plugin is purely for the administration area (consisting of a widget and a full section), so I decided to hack the code to leverage on a plugin I already had.

The Hack

The code I wanted is found inside “stats.php”, where you find the code that displays the admin widgets and page statistics. From there it was just a short search for the function in question (in this case, we need “stats_get_csv()”).  Once I figured out what the parameters meant, I was able to integrate it into my page.

The Code

<ul>
 <?php
  $active_posts = stats_get_csv( 'postviews', 'days=7&limit=5');
  foreach($active_posts as $post){
   ?>
   <li>
    <?php printf('%s (%s Views)',
                 '<a href="' . get_permalink( $post['post_id'] ) .
                 '">' . get_the_title( $post['post_id'] ) .
                 '</a>', number_format_i18n( $post['views'] ) ); ?>
   </li>
 <?php } ?>
</ul>

In the code above, “stats_get_csv” simply gets a list of Posts, and we can simply use them to display the information that we want.

Hopefully this might be helpful for anyone out there who is using WordPress.Com Stats, and don’t wish to use another redundant plugin.

Windows 7 in 2009?

Ed Bott over at ZDNet seems fairly confident that Windows 7 is scheduled for a release before August 1st, 2009. This comes from a single line in the Beta release notes that says,

When the Beta expires on August 1, 2009, you’ll need to reinstall a released version of Windows to keep using your computer.

While this is purely speculation, I would definitely support such an early release date, but only if it was guaranteed to be stable, secure, and able to encourage adoption amongst customers. If it achieves that, at least I will still have a job for a while yet, and thankfully be able to skip past Vista.

“Doing it Right” vs. “Getting it Done”

I am in the beginning phases of familiarising myself with an internal project at my company, and what I saw really shocked me. It certainly isn’t your typical “Student Project”; in fact, it would probably fail the more advanced courses.

In some sense, I feel quite disillusioned: surely what I have learnt (and in most cases, taught) in University would see some application in the real world. However, it seems that what I have learnt in uni is “How to do it Right“. In many real-world projects, including this one, the focus is on “Getting it Done“.

The project I am current assigned to is an excellent example.

The System

The System is a relatively featureful Time Tracking System. Employees log in, log the number of hours they worked on a specific project, and log out. Yet for something this simple, the System itself is broken is more than 1 way:

There is a list of “projects” on the left, which Employees can click to add a particular project to the current week’s timesheet. However, “projects” can also be sorted into “categories” and “clients”. Since the list control treats every single item as an item, Employees were able to add “categories” and “clients” as projects as well. While not exactly a critical issue, it is obvious that this is not the intended behaviour of the System.

Another problem was the “comments” mechanism that was built into the system. Aside from entering in the number of hours worked (into a textfield, no less), a small input area is overlayed next to it, allowing the Employee to enter in a small comment about that particular entry. However, the Javascript involved is strictly IE6 only. Meaning, it broke on all the other browsers that employees wanted to use.

Lets Be Realistic

This is not the first time I have experienced this “mentality” in my company. When estimating deadlines for a project, it is done with the intention of keeping cost low (cost being calculated as a rate by the hour). Thus, the mindset of the programmer is always to “get it done as soon as possible”. Is this what you’d call “Agile Programming”? Or is this just irresponsible coding?

Or perhaps it is simply impossible to “do it right” in the real world.