Archive for category visual77

Drupal switch

I have decided that I will not be migrating my site, but instead am going to start fresh on my Drupal build, which is now hosted at my new site stevephillips.me. All future posts will go there, and this site will slowly fade away.

No Comments

Git time!

In the past few weeks, I finally have had the chance to start using Git. I’ve been mildly interested for about a year now, ever since a coworker of mine left the company and began using Git at his new company, but the sheer momentum of my company’s Subversion repositories was a big hurdle to overcome.

I was finally forced to move something onto Git when I put my statepicker module onto drupal.org, and Git was their only available VCS. After making the switch, and learning Git, I definitely agree with the general consensus that Git simply is better than Subversion. Having a DVCS just adds an incredible amount of flexibility to how repositories are set up, maintained and shared.

So on that note, I’ve begun to actually use the github account I set up a few months ago. The first thing I’m putting onto it is the repository for my Drupal rebuild of visual77.com. As far as future projects on it, the only other thing that I still want to do at some point is my Team Liquid Browser Extension. I’ve been unable to touch that since I first mentioned it because I’ve had very little time lately, but that isn’t a stillborn concept.

, ,

No Comments

Kohana 2.x kotidy – Using the Tidy library to clean up Kohana’s HTML output

In a quick followup to yesterday’s building and releasing autoasset, I’ve created another module to do something simple and portable for Kohana 2.x. This module, kotidy, uses the PHP Tidy library to clean up the HTML output immediately prior to display. Even though the HTML is not seen by the end user, I find myself OCD about this kind of stuff and want to know that my source code is clean, even if most people will never see it.

Just like autoasset, kotidy uses the Event system to hook a basic function in place to use the tidy library to clean up the output. Other than adding this module to your module list in the main config file, no work is required on your part, unless you want to customize the config data being sent to Tidy::parseString(), of course.

Download Kohana 2.x – kotidy

, ,

No Comments

Kohana 2.x Autoasset – Automatically include relevant javascript, css and more

I’ve set up about a half dozen Kohana 2.x sites now, and one problem that I constantly run into is including javascript / css based on the controller and method for the current page. For instance, if you go to “/user/view/1″ on a Kohana site, I would like to automatically include “/javascript/user.js” or “/javascript/user/view.js”, if the files exist.

To solve this problem, I created an autoasset module for Kohana 2.x. It will not work on Kohana 3.x due to the removal of events and hooks. To use autoasset, simply load it like you would any other module, and then go into the config file and specify which kinds of assets to load. Just input the directory that these assets are stored in, the file extension, and a callback to use when rendering. I put in example entries for javascript and css as a demonstration. You can then render the autoloaded assets by calling autoasset::render(); where you want to include the assets, such as the html head tag.

On a similar note, modules like this are one of the main reasons why I am launching ko23.net. I think Kohana 2.x is a fantastic framework, and if a large community arose to provide modules that are just generally useful, then Kohana 2.x could really shine.

Download Kohana 2.x Autoasset

, ,

1 Comment

Kohana 2.3 community

I’ve been a Kohana user for about a year now, and every major update pleases me less than the last. I’m considering starting a community dedicated to Kohana 2.3, built around maintaining documentation (since the official site already pulled the Doxygen docs, how long until they pull the documentation wiki?), creating new modules and generally working on preserving the Kohana 2.3 legacy. Would anyone be interested in being a part of this community?

I’d like to stress that I am in no way trying to insult the developers and maintainers of Kohana through this project. Their work has been absolutely amazing, but just as they forked from CodeIgnitor when they felt it was no longer serving their needs as developers, so now am I feeling that Kohana no longer serves my needs as a developer.

I’m setting the project up at ko23.net. I’ll begin adding some functionality such as forums and module hosting / rating.

,

1 Comment

The joy of tech support

This series of emails happened about 6 weeks ago, but I wanted to store it here for posterity, because it amuses me and I can do that.

I had recently obtained dedicated hosting for a work project and was having some bizarre issues with .php files throwing a server error, even if the file was a single “phpinfo();” command, so I contacted tech support.

One remaining problem that I am encountering is getting PHP scripts executing on the site. I have a simple file, just running phpinfo(), but it is causing a server error for reasons I have not been able to figure out. I have checked file permissions, recreated the account a few times with all features enabled, and checked PHPMyAdmin to ensure PHP does work on this server, but nothing seems to be working to get this file to work. Is there a setting somewhere, in either WHM or cPanel, that I am missing to enable PHP on this account?

The response was fairly speed, but utterly bizarre.

Hi,

Please try it now. I commented out a line in your .htaccess file and it’s working now. Let us know if you need any further assistance.

How could my .htaccess file, which was blank during most of these errors, have been a problem? I inquired.

Did you do anything besides that? I added that line after I sent you the support request. When I sent you the support request, the only file on the server was a simple phpinfo() file. Afterwards, I began toying around with the Apache handlers, both in cPanel and in the .htaccess, with nothing working.

Ah, he forgot to mention something.

I did re-compile PHP on the server for good measure since the file should have worked, but the error log was still showing an issue with the .htaccess file so I commented out the handler line and it started working. Please let us know if you need any further assistance.

Amazing!

No Comments

MySQL dump of every country and state in the world

As part of a recent project, I needed to compile a list of every country and first level administrative subdivision in the world. I started with the ISO 3166-2 list, but later cleaned up certain countries that had inaccurate data. I also needed timezones for every state, so I put all of those in as well.

This zip file contains a single SQL dump for two tables – region and subregion.

Region contains 248 entries, with the following data for each country: ISO code, 3 digit ISO code, fips code, country name, continent, currency code, currency name, phone prefix, postal code regex, languages and geonameid. Subregions contains region ID, name and timezone. The timezone format is “America/Los_Angeles”, “Europe/Madrid”, etc. Unfortunately, some states have multiple timezones and this is not taken into account.

There might still be some issues with some countries not having an accurate state list, but this list is more comprehensive than anything I was able to find online.

Download the list: region.sql

5 Comments

Upcoming Work

It’s now been over a month since I’ve written any articles. I’ve been busy lately with a number of activities, plus my regular job, and just haven’t had time to write much. I do have a few article ideas that I’ll be doing shortly, though, so this site isn’t quite dead yet.

I’ll be writing an article on best practices for creating new classes in PHP and ideal naming conventions for functions and variables. In both situations, I have the bulk of the writing already completed and just need to polish it up and get it into a blog article.

No Comments

What makes a user want to buy digital content?

As you can learn from a cursory glance at this site, I am a professional computer programmer. I also have side projects that I would like to one day monetize. One such side project is my planned Android app remind@home. On the other hand, I am a content consumer in the digital age, using the internet to acquire new content, sometimes in ways the content creator might not find appealing. Sometimes I pay for content (such as my recent Steam purchase of Dragon Age: Origins) and sometimes I do not pay for content (such as all apps I’ve installed on my Droid, except my podcast app BeyondPod).

Do I acquire content for free because I am cheap? Absolutely not. I buy when the content creator has provided sufficient incentives to buying. As a content creator, I strive to understand those reasons, both within myself and within others. For this reason, I have begun asking friends what a content creator can do to encourage a purchase. I am not concerned with preventing unauthorized downloads or free software that is asking for donations. I am only concerned with finding out what a content creator can do to encourage users to pay for their content. After my discussions with other techies, here are some of the ways a content creator can encourage users to pay:

Release a sample

Release a free sample that can be easily upgraded to the full version. This allows me to find out if I like your content before I commit money. iTunes and Amazon MP3 Store are examples of this from a music perspective, and game demos accomplish the same thing for game developers. If I am unsure of the quality of your product, I am unlikely to blindly commit money. Through Amazon MP3, I can sample every song on an album before I decide to buy. If you do not provide an easy to locate sample, I will still find a free way to sample the content. The alternative is an unauthorized acquisition of your content, and in that scenario I am unlikely to pay if I like the content. After all, why pay for what I already have? By placing barriers to sampling, you aren’t hindering my ability to sample, you are just putting yourself in a bad place if I like what I’ve sampled.

For PC game developers, this is even more critical. Unlike console games, PC games are not always playable on every PC. A demo not only lets me find out if I like the game, but it lets me find out if I can even run the game. There is nothing worse than paying $50 to find out my video card can’t handle your game. Just like in the music sampling example above, instead I can just acquire the game through other channels. If it doesn’t work, I still have my $50. If it does work, where does that leave you?

Continuously update your content

This rule applies more to software than any other form of content, but it is an important rule nonetheless. If I purchase software that is constantly updated, and only authorized copies can be updated directly from the developer, I have an incentive to pay. Fear not, all of the updates will be leaked through unauthorized channels, but the convenience of a built in updater cannot be understated. Imagine downloading a program to manage a database of clients and receiving a weekly update with bug fixes and occasional new features. These updates can come through two channels – an authorized update system that came with the purchase of the software, or a weekly hunt through P2P networks for the newest version. The convenience of a built in updater is easily worth the $50, assuming the updates are worthwhile. Releasing your software and then abandoning it gives me no incentive to purchase a copy. That just guarantees that the version available on a P2P network is the same as a legitimate copy, permanently.

Be easy to acquire

I’ve purchased over a dozen games from Steam simply because it is easy to pay for and acquire my game. The user interface for acquiring your content needs to be easy to use. If I am having trouble locating your content digitally through authorized channels, I’ll simply start looking through unauthorized channels. Make it easy enough that I never consider looking for alternate methods to get your content. Sometimes the issue isn’t how much your content costs, but how much of a hassle it is to locate and acquire.

As a content provider, make use of services like Amazon MP3 store, Audible and Steam. You don’t have to create your own system of distribution, but use a reliable distribution system. Users want convenience above all else when it comes to acquiring new content. The more convenient your distribution system is, the less likely a person is to seek alternate methods. There will always be those that simply don’t want to pay. There is almost nothing you can do about that crowd. Instead, focus on the crowd that is willing to pay. Find out what barriers are in their way and remove those barriers.

Offer your content digitally

This should go without saying. If you want people to pay you for your digital content, then offer that digital content. Rather than offer an explanation, I will just provide one of the conversations I had about this subject:

Steve: How often do you acquire unauthorized digital content?

Anonymous: Maybe twice a month, it really depends if theres an HBO or Showtime show I want to watch.

Steve: What could a content creator do to encourage you to buy?

Anonymous: Offer a place to buy it online. Just make it possible. Do it the day after not months later. I mean, I pay to torrent now, since I use usegroups. It’s access thats the issue, not price.

Steve: So the only reason HBO and Showtime aren’t getting your money is because they aren’t giving you a way to give it to them? Someone is getting the money, and if HBO or Showtime set up a good system, they’d have it. But, they are making it impossible for you to get, through them, what you can certainly get elsewhere.

Anonymous: Yeah.

No Comments

The Netflix prize – Someone won $1m for this suggestion?

After ignoring this section of Netflix for a bit too long, I finally gave the suggestion system a try. I entered movie suggestions for 15 or so minutes (skipping a lot of movies that I never saw or hadn’t seen recently enough to accurately judge), and this is my result:

Have you ever wondered what you get when you mix David Attenborough’s fantastic biopic of Gandhi with Larry David’s awkwardly hilarious Curb Your Enthusiasm (season 3, in particular)? I know I haven’t. Netflix has the answer! The answer is Life in the Undergrowth, a documentary by David Attenborough and the life and habits of invertebrates.

Thanks Netflix!

No Comments