October 3rd, 2008 by james
One commonly overlooked aspect of website accessibility is the contrast ratio between foreground and background colours.
White poor contrast can cause readability issues for well-sighted visitors, it can be even more of a problem for those visitors with a visual impairment.
Because of this, The New Zealand Government Web Standards and Requirements v 1.0 and W3C’s Techniques for Web Content Accessibility Guidelines v 1.0 both contain standards requiring content have sufficient contrast between foreground and background colours.
For example, The New Zealand Government Standards state:
“Ensure that foreground and background colour combinations provide sufficient contrast for navigation, text and informational elements when viewed by someone having colour deficits or when viewed on a black and white screen.”
Continue below for details on how to test for adequate colour contrast in your design or web pages.
Read the rest of this entry »
Posted in random | 1 Comment »
September 11th, 2008 by kieran
In MySQL, there is an easy way to get all index of a particular table.
SHOW INDEX FROM table_name;
But what if you want to list all index’s from all tables in a database so you can find out what you have and where you’re missing some? If you have 20 or more tables it’ll get tiring after a while running the SHOW INDEX command on each.
Thankfully, the information is stored in another table MySQL uses called information_schema. You can get a list of all the index’s, along with the table name and field names, by running the following (change “your_database”).
SELECT table_name, column_name, index_name FROM information_schema.statistics WHERE index_name != ‘primary’ and table_schema = ‘your_database’;
That’s it. A list of what table, what field, and the name that each index applied to. Happy indexing.
Posted in random | No Comments »
September 9th, 2008 by walter
A natural inclination when one starts programming in Ruby is to use “and” and “or” instead of the “&&” and “||” to increase readability. However, “and” is not a drop in syntactic synonym with “&&” and the same goes for “or”.
James pointed out a good blog post that explains the issues around order of precedence with these operators:
http://blog.jayfields.com/2007/08/ruby-operator-precedence-of-and-which.html
It’s worth reading the comments.
It should also be noted that the Ruby on Rails source style guide has a preference for “&&” and “||”:
http://rails.lighthouseapp.com/projects/8994/source-style
Posted in kete development, open source, ruby on rails | No Comments »
September 1st, 2008 by james
Sometimes it’s useful to merge in a single commit from another branch. For instance, you may want to merge a single, important bug fix from your Git master branch into a stable release branch.
You can do this using Git’s cherry-pick command.
# Merge in a single commit.
#The -n option tells Git to not commit when it’s finished the merge.
# This allows us to review and commit the changes with our own message later.
# The default commit message is very ambiguous.
$ git cherry-pick -n [The commit's SHA-1 Hash]
# Review the changes
$ git diff –cached
# Commit the changes after reviewed them
# ..with a nice, human written commit message that makes sense.
$ git commit -a -m “Your commit message (some SHA-1 Hash as a reference)”
All done! You can then push your changes to your remote repository.
Posted in random | No Comments »
August 29th, 2008 by walter
I just had to resolve my first conflict in git. It’s a little more convoluted than with subversion, but slicker overall.
So you run into a conflict during a merge (implied by this git pull command):
$ git pull kete_master master
…
Auto-merged app/helpers/application_helper.rb
Auto-merged app/views/layouts/application.rhtml
CONFLICT (content): Merge conflict in app/views/layouts/application.rhtml
…
Automatic merge failed; fix conflicts and then commit the result.
First up, you need to have your git config point at opendiff on Mac OS X. Do the following if you haven’t already (you only have to do this once and it will be set permanently):
git config –global merge.tool opendiff
Then from the shell run this:
$ git mergetool
And then you should see output something like this:
Merging the files: app/views/layouts/application.rhtml
Normal merge conflict for ‘app/views/layouts/application.rhtml’:
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (opendiff):
Hit return and the OpenDiff application should startup with the conflicted file. It will have side by side comparisons of local version of the file and the remote version of the file with nifty highlighted areas where things are different. Select the first highlighted region, go down to the bottom right and choose the appropriate side in the “Action” menu, then proceed on to the next one, and so on until you have taken care of all differences. Then click File > Save Merge.
Back on the shell you are ready to do commit your resolved file. Do “git commit” and you enter an editor to put in your commit message.
Move on to other tasks, you’re done.
Posted in random | No Comments »
July 31st, 2008 by kieran
When you want to use git on Debian its as easy as “apt-get install git-core”…… or is it? The version on the stable debian repositories (1.4.4) is very old. It lacks many of the features git users use on a regular basis. So how do you upgrade git? Well the simplest approach for getting the most recent version, for those that know how, is to wget the source, unpack, cd, configure, make, and make install. Takes about 5 minutes, and you’re up and running. But what if you don’t know how to compile, or you want to maintain package only install for your system, so upgrading and uninstalling will be easy? Where do you find a newer package?
Read the rest of this entry »
Posted in random | 1 Comment »
July 31st, 2008 by kieran
In the previous part of this guide, we created an export script which produced an XML formatted output of the current versions of pages in your phpwiki installation. If you havn’t done that yet, please read the first part of this guide. Now we are going to take that file, and import it into Kete, maintaining as much as the information as possible. We’re going to cover system settings, topic types, extended fields, privacy controls and import synonyms. So lets get started.
Read the rest of this entry »
Posted in random | No Comments »
July 29th, 2008 by kieran
(the following article and code applies only to phpwiki version 1.1.x and 1.2.x. Previous and future versions of this software use different methods of formatting and so will require changes to the scripts used here)
If you have a set of articles on a phpwiki that you can’t afford to lose, and want to move to Kete then theres a simple two part process you can follow to do just that. Over the next two blogs posts, I’m going to show you just how it’s done.
Read the rest of this entry »
Posted in random | No Comments »
July 29th, 2008 by walter
I was trying to install a gem on a client’s machine that I had previously been able to grab successfully, but it failed like this:
$ sudo gem install some_gem
Updating metadata for 475 gems from http://gems.rubyforge.org/
…
complete
ERROR: could not find some_gem locally or in a repository
I thought perhaps rubyforge was unavailable, so I repeated the command. Still no luck. I did a web search and found a possible answer:
$ gem sources -a http://gems.github.com/ # adds metadata for the gems hosted by github
That actually didn’t do it either. Including github’s gems slowed things down when doing a gem install, so I decided to remove it from the sources list:
$ gem sources -r http://gems.github.com/ # drops github’s gems metadata
So I tried a “gem help sources” and discovered that I could clear the local cache like so:
$ sudo gem sources -c
*** Removed user source cache ***
*** Removed latest user source cache ***
*** Removed system source cache ***
*** Removed latest system source cache ***
Then I tried the gem install again:
$ sudo gem install some_gem
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed some_gem
1 gem installed
Installing ri documentation for some_gem
Installing RDoc documentation for some_gem
Success! Hope this helps someone else.
Posted in random | No Comments »
July 28th, 2008 by kieran
When you upload a file using attachment_fu (http://github.com/technoweenie/attachment_fu), for the most part, the upload will work fine. But there are occasions that the mime type will return something that isn’t useful, such as application/octet-stream, application/x-download or a blank mime type. In these cases, it can refuse to upload a perfectly legit file. Allowing octet-stream and x-download to be uploaded, while possible, does create a certain security (permissions) issue. So how do you get around this without causing any more problems?
Read the rest of this entry »
Posted in random | No Comments »