MortalPowers, Inc. Logo

As modern web development methodologies continue to improve and optimize our workflows, one of the workflows that has risen to the top is a development deployment model using git.

Making it Secure

Before you do any of these steps, make sure you add the following to your .htaccess, and that URL Rewriting is working in your apache setup.

#Secure GIT Deployment Methods
RewriteRule /?.git/ - [R=404,L]
RewriteRule /?.gitignore - [R=404,L]

Without doing this, anyone will have read-access to all of your code, and your entire source history.

Use git

This guide assumes a lot of knowledge about source control, management, and is not a guide to git. This guide assumes you can figure those parts out, but that you want to know more about one specific workflow that works very well in my opinion.

The main idea behind this workflow is that you will have a central repository, a development version of the software, and a published version of the software.

Convert something else to git

If you want to keep any history, the first step is going to be to convert the source control history to git. If you are using cvs, you will need to convert to SVN, and then to git. If you use SVN, simply use git to do a git svn clone of the repository somewhere on your local system. From there I recommend you move the .git folder to the remote production server, and make a copy in the development folder. If you go into each of these folders and type git status, you will see any differences that have not yet been committed to the repository, but you will be ready to make and receive changes.

Now that you are setup, time to develop

From there, things are relatively simple. Simply make any changes you want in your development environment. When you are finished with your changes, and they have been tested to your satisfaction, commit the changes, and push them to the repository. You can then enter your production server, and pull the changes from the repository. You can also simply pull directly from the development server, but organizations I have worked with tend to like a 3rd copy of the source, somewhere separated from the hosting environment.

If you want to, you can make emergency or urgent changes directly on the production, following any existing workflow you have for ensuring something is not broken. When these changes are complete to your satisfaction, simply commit and push them, and do a pull from the development environment.
comments | permalink

Google Analytics continues to prove itself as one of the top and most important tools for website analytics today. Recently Google added a new feature for those that use both Google Adsense, and Google Analytics. This feature is the ability to cross-reference data between these two applications. What this means is that not only can you see what visitors are coming to your site, and what they are viewing, but you can cross-reference this data with how much money they are providing you.

As an example, if we look at mortalpowers.com we will see that Google Chrome accounts for around 30% of the traffic. What is odd is that over the past 3 weeks, 100% of adsense revenue has come from Chrome. This strange pattern is again repeated for Linux. Linux makes up around 40-50% of traffic, but ends up providing nearly 100% of adsense revenue.

Keep in mind that for this site, sample sizes are very small. From this type of data and with a larger sample size, it is clear that these new features are going to help those seeking to monetize their web presence and content greatly.


comments | permalink

Abandon Internet Explorer

(by PeEll)2010.01.28

Internet Explorer usage continues to decline, losing somewhere between a tenth of a percent and half a percent each month to better browsers such as Firefox and Chrome. My prediction is that this is going to slow and eventually come to a stop. The problem is that there is a solid percent of internet users that have no idea what a brower is, and don't want to know, and will probably never learn. This block of users will never be persuaded by functionality or speed or new features.

In response to this inevitability, I propose people that write about or involve themselves in the Linux, or even in the general power user populous, stop supporting all versions of Internet Explorer immediately. I will admit that my website still has around 20-30% usage of Internet Explorer, but I am coming more and more to the opinion that those who continue to use it, probably wouldn't understand anything I'm writing about. This leads me to believe that this traffic ends up being people that are confused, as well as web spyders disguising themselves as a normal user, artificially inflating the numbers for IE.

Benefits of abandoning IE

By abandoning IE, it makes web development and testing easier. Development can focus on the standard DOM, and on leveraging some of the more advanced functionality of the web, such as new request types, as well as little things like rounded corners, or every-other CSS selectors.

Abandoning IE as a web developer or publisher is going to send a message to Microsoft and indirectly to uninformed users about their computing choices. When a percentage of the websites a person visits in a day stop working, they are going to ask why. If the answer is that their browser is broken (which it truly is), they will be much more likely to make a switch. The message it sends to Microsoft is that shipping a broken browser that is out of touch with the modern internet is going to hurt their users. This would also tell them that if they want to ship a working browser (which is what Apple and the open source community had to do in the past), they are going to have to adopt the features and usability of the other browsers, which in this case would be primarily based on standards and extensibility.

Problems with abandoning IE

By abandoning IE, you may make your website unusable for users that don't know, or can't upgrade (some corporate offices still require everyone to run IE6). This could also decrease your traffic. There is also a chance that Microsoft will just ignore any sites that do this, which is a definite probability based on their past behavior.

Summary and Philosophy

In theory by abandoning IE you will be able to focus on innovating for your best users, rather than hacking and making workarounds for your worst.


comments | permalink

The W3C recommended way of targeting mobile devices is for stylesheets to use the media attribute. Unfortunately, this attribute isn't used by either the Android browsers or the iPhone browser. Instead these browser report that their media is of type "screen", this is the standard used by desktop browsers as well.

There is a trick that is possible still using media detection that selectively applies the styles based on the screen width. The following code is an example of two stylesheets. The first should be applied on desktop computers, and the second should be applied on Android and iPhone.

<link href="/inc/mp.css" rel="stylesheet" type="text/css" media="screen and (min-device-width: 481px)"/>
<link href="/inc/mobile.css" rel="stylesheet" type="text/css" media="only screen and (max-device-width: 480px)"/>

Find additional information and tips at http://www.rkblog.rk.edu.pl/w/p/optimizing-websites-iphone-and-android/


comments | permalink

One of the recent advancements in the HTML and page processing done by search engines, is the addition of the rel="canonical" link tag. This link tag is added to the head section of the HTML, and it indicates to search engines what the preferred URL of this page is. This is useful because with the advetn of dynamic pages over the past 10 years, we are currently in a place where often the same contents are accessible in many different ways, with many different options. This means that without this additional piece of metadata, a search engine can't tell if url?s=newest is the same page as url?s=oldest. This would be an example where the URLs represent the same content. It also can't tell if url?p=dyanmic is the same as url?p=history are the same page. This example could be a single PHP URL that shows different pages based on the get variables.

The solution is to add the following line of code to any URL that is addressed in multiple ways, or has multiple URLs for the single set of content.

<link rel="canonical" href="http://mortalpowers.com/" />

Google is the first search engine to support this, but because it makes things easier for the search engine's processing, it will likely soon be supported by all major search engines. This technique can even be used cross-domain if you have content hosted and served across multiple domains.


comments | permalink

HexSLayer Launch!

(by PeEll)2010.01.09

The game I have been working on for a few months has now been packaged and lauched in its first incarnation! The instructions for download, files, etc, are all located on it's new site at hexslayer.com.

New Website

I decided to launch the game at its own URL, as a lot of the things that I put onto mortalpowers.com wouldn't relate to people interested in the game. I have developed my own blog software in the past, and used Wordpress and other options, and read a lot about some of the newer options. For this project, I decided to use Drupal, as my research has revealed it to be an extremely powerful (and albeit complex) system. I'm trying to stick with only the core modules, and major modules for the system (xmlsitemap, images, uploads) for maintainability purposes. If I adopt some unknown module it will be harder to stay up to date with security/other patches, and I might risk losing those modules if/when I upgrade to Drupal 7.

So far, drupal has been a very interesting and decent piece of software. For the type of CMS I was looking for, it is meeting all of my needs. My goal was to be able to create pages, posts, comments, and upload files and images, and to have a decent looking theme. Feel free to take a look at the HexSLayer site and let me know if I have met these goals.

The site is also on Github. One of my goals is to continue doing things in as open a manner as possible so that if someone else wants to contribute back to me, or learn from what I have done, they can.

Debian Packages

I have spent most of the evening re-learning Debian packaging (I use Ubuntu), and figuring out how to include the packaging component with the normal source code in a way that won't make it more difficult to compile/package for other environments. The solution I found was to create a packaging folder with scripts to generate packages/distributions for each of the platforms/environments I support. This seems to be working well, but I only have the Debian .deb file so far. The package includes nice features like menu and .desktop entries, which makes the game easier to launch and remember, rather than having a raw folder of .pyc files somewhere in your home directory.


comments | permalink

New Feature: Latest Commits

(by PeEll)2009.12.22

You may notice a new feature to the right side of the home page. This feature, called "Latest commits" intends to share some of the development projects I'm working on, but haven't had a chance to do a writeup on.

The bulk of the work for this feature was done for me in the form of an RSS feed provided by Github. I have been exploring Github for about a month now, as well as experimenting with Git in general as my preferred version control system. In the past I used CVS and SVN, but so far I have been extremely pleased with the quality, speed, and ease-of-use of Git, as well as Github.

What you are seeing now

There are two main projects I'm working on at Github actively. The first is a hex-based game called HexSLayer, written in python. It is a small strategy/puzzle game with a naive AI, and some decently interesting gameplay. Currently it is playable, but the AI isn't very smart, and there is no way to add other human players locally or over the network, hopefully these features will come with time.

The second project you can currently find active commits for is called Youtube-HTML5-Chrome, among other names. The idea of this project is to provide a Google Chrome extension that swaps out the flash videos on youtube for a native HTML5 <video> element, which is faster, more reliable, and demands fewer system resources. You can find the actual extension at the HTML5 youtube page in the extension index.


comments | permalink

Change Author of Git Repository

(by PeEll)2009.12.16

Sometimes when migrating git repositories around, or when importing older version control systems into git, the author history would be nice to update to be forward looking.

CVS to git conversation

git cvsimport -v -a -d /path/to/cvsroot/ -C newgitrepo.git ModuleName

Rewrite git authors

git filter-branch --commit-filter '
        if [ "$GIT_COMMITTER_NAME" = "PeEll" ];
        then
                GIT_COMMITTER_NAME="New Name";
                GIT_AUTHOR_NAME="New Name";
                GIT_COMMITTER_EMAIL="new.email@example.com";
                GIT_AUTHOR_EMAIL="new.email@example.com";
                git commit-tree "$@";
        else
                git commit-tree "$@";
        fi' HEAD

comments | permalink

Javascript has been around for a long time, and booleans are one of the most standard types in programming. Unfortunately Google's Google Wave doesn't agree. In standard wave extension programming, one can place objects into the wave state as follows:

delta = {};
delta["key"] = value;
wave.getState().submitDelta(delta);

In most cases, this works great, but in case you are trying to use booleans as your value, you will find that Google Wave will not store the boolean value in the state. Not true, not false, and it won't trigger a standard state update that one would normally expect.

The way I have worked around this is to simply use the strings "true" and "false" for these values, and then use string comparison for conditional logic. It seems a little hackish, but it also seems to work in all of the cases I have tried or needed it in.


comments | permalink

There appears to be an issue with the new GTK in applications such as Eclipse that try to ignore the standard GTK structure, and have their own attempts at "magic" to improve the look. When GTK was upgraded in Karmic, this caused these magic tricks to stop working, breaking a lot of applications. Specifically whenever I would hit "Apply" or "Ok" in a dialog box, the button would depress, but would never trigger an action.

Solution

The quick fix is to change the way the application is called. For me, this involved going into the menu editor (right click on the launcher in your panel), and finding the application. I then found the "Command String" that looks like /path/to/eclipse and changed it to:

export GDK_NATIVE_WINDOWS=1;/path/to/eclipse

What this does is to tell the application's GTK framework to use native windows instead of the "magic" positioning and functionality that it used to rely on.


comments | permalink

Moving around source code repositories is almost guaranteed for anyone that continues software development for more than a year or two. It can cause major problems in some IDEs, because of the connections that get created between the local copy and the remote server. Althought it appears the Eclipse SVNKit tool "relocate" doesn't work, the following command will change the repository of your working copy, and fix all of the .svn/entries files automatically.

svn switch --relocate svn+ssh://hostname/old repository path svn+ssh://new hostname/new repository path

comments | permalink

Tagging coming to MortalPowers

(by PeEll)2009.04.10

Tagging is almost a ubiquitous concept on the modern internet. Tagging allows a program to begin to understand some of the semantics of the information. The article catalog of this site is beginning to become substantial, and currently the only way to browse historic articles is to go through them sequentially by date, or use a google search. The need that I see is for browsing by tag and topic, and for the ability to search the site.

I will post updates about the progress and implementation of tagging as it continues. I will probably use a tagging model combining Delicious and F-Spot, meaning that every article will have several tags applied to it, each tag will be a single world, and tags will be categorized and grouped into a hierarchy.

I am undecided on the concept of single-word tagging as a whole. It seems that it would provide the computer with more information to cross reference, but at the same time, you lose the ability to indicate more specific concepts like "computer monitor" vs. "monitor" "computer". The former case wouldn't match other articles with computers, but the latter case would match "monitoring" in the context of watching a process or system.


comments | permalink

I have finally decided on a new workflow for PHP script editing. Previously I had my webserver located on my main desktop, but there were a lot of problems associated with serving an active website from a personal desktop. Once I switched to a remote hosted webserver, I had the problem of determining a new workflow for editing my files.

For my personal sites, I don't care about a little downtime. Based on this I am able to do editing on live, so that I don't have to develop and test locally, and then deploy and retest. This saves time, but it also pretty high-risk in the case where I break something. This risk is acceptable to me as a tradeoff for my time.

I have decided that the ideal way for me to develop remotely using my preferred IDE (currently Eclipse), and at the same time ensure that everything I finish makes it into my Subversion repository was to use SSHFS. I could have also worked remotely using command line or VNC forwarding, but I much prefer leaving my server without any sort of head or X server, and I want to continue to use a local IDE for everything I do.

SSHFS is a FUSE filesystem that uses SSH, so it is secure, and is setup in userland, so I don't even need root access to use it. Make sure SSHFS is installed by running:

sudo apt-get install sshfs

Once it is installed, create a local mount of a remote directory using:

sshfs user@server:<remote directory> <local directory>

Now I simply launch eclipse and add the local directory to my workspace as a project (I am even able to leave the .svn and .project files on the remote server with an appropriately setup htaccess file). One of the downsides is that I will need to establish this connection whenever I want to begin development. It is also possible to have local copy checked out into the same folder when you are not connected by simply specifying the -onoempty flag for sshfs. This will simply place the remote directory on top of your local directory, ignoring existing contents. When the connection to the remote server is broken, the old local contents will become visible again.


comments | permalink