Mephisto and Wordpress

April 2nd, 2009

The Six Studios blog launched initially with Wordpress and has since moved to Mephisto. Both are excellent products, but appeal to two very different audiences.

Wordpress out of the box

Its PHP. Its easy to install and even easier to use. That’s why it was my first pick.

The text editor is very friendly (TinyMCE) and so is the interface. The text editor gives the user a presentation view of the content.

An HTML view of the post is available too. The presentation view allows the user to see what text is bold, underlined, and italicized, but wont indicate what content a search engine will deem most important. Though WYSIWYG editors are the easiest editors to use, presentation without proper tagging only solves half the problem. The code is left for the search engine to decide what is most relevant instead of tagging it as such.

Mephisto out of the box

Its Rails. You’re required to know how a Rails application works in order to set it up. This isn’t significant for a developer or a tech savvy person with Google at his/her finger tips, but for the average person that wants a blog it might be to much to ask.

Mephisto’s text editor allows the user to format each post with Textile, Markdown, Markdown with Smarty Pants and plain HTML. This gives the user much more control upfront, but requires knowledge of the markup syntax and proper tagging. Though more work is needed, utilizing proper tags such as header (h1-h6) tags will yield a better results in search engines.

Coderay for syntax highlighting and Akismet SPAM blocking are also built into Mephisto.

Thoughts

Out of the box Wordpress is meant to answer the needs of most. Get up and get posting. Mephisto answering the needs of a developer and the code-conscious. Syntax highlighting and proper code formatting.

Two very different targets. Two excellent products.

PHP to Ruby: Lesson 2

March 22nd, 2009

In the first lesson we went over basic similarities of Ruby and PHP. Lets go over some more.

The Basics

Its essential to know what type of data you’re working with. Whether its a string, integer or an array, we need to know what type of data we’re about to manipulate.

PHP has the following functions is_array(), is_bool(), is_integer(), is_object(), is_string(), and many more.

Ruby also provides this functionality. Remember from the first lesson, Ruby is an object-oriented language so data type checking will be done with the method is_a?. Here are some examples:

1
2
3
4
5
6
# PHP
if(is_string($var))
...

if(is_integer($var))
...
In Ruby:
1
2
3
4
5
6
7
8
# Ruby
if var.is_a? String
...
end

if var.is_a? Integer
...
end

PHP is very powerful when working with arrays. A few useful functions are array_keys(), array_values(), explode() and implode().

For Ruby, in the same order, the methods are keys, values, split and join.

1
2
3
4
5
6
7
8
# PHP
$var = array( 'my',=>1, 'php'=>2, 'hash'=>3 );

$keys = array_keys($var); # using array_keys()
$values = array_values($var); # using array_values()

$new_array = explode(' ','my php array'); # using explode()
$new_string = implode(' ', $new_array); # using implode()

And for Ruby:

1
2
3
4
5
6
7
8
9
10
11
# Ruby
var = { 'my'=>1, 'ruby' =>2, 'hash'=>3 }

keys = var.keys # using keys method
values = var.values

new_array = 'my ruby array'.split(' ') # using split method
new_string = new_array.join(' ')

# splitting a string option 2
new_array = %W(my ruby array)

Hope this was helpful.

PHP to Ruby: Lesson 1

March 14th, 2009

The very basics

The Ruby language is object-oriented. PHP is not object-oriented, but has objects. Ruby’s object-oriented nature results in some areas of it’s syntax to look very much like JavaScript. PHP’s echo is puts in Ruby. PHP uses semicolons. Ruby uses semicolons, but only in specific cases. For clean, readable code, assume you won’t be needing semicolons. Lets being…

The Basics

PHP creates arrays and hashes with the same function array().
1
2
3
4
5
6
# PHP
$array = array('my', 'php', 'array');
$hash = array(
   'my_index'=>'my_value',
   'my_second_index'=>'my_second_value'
);

Ruby handles arrays and hashes separately.

1
2
3
4
5
6
# Ruby
array = ['my','ruby','array']
hash = {
   'my_index'=>'my_value',
   'my_second_index'=>'my_second_value'
}
Read the rest of this entry