Sunday, November 22, 2009

Link of the week: How to Work from Home Without Going Crazy

Here's a thread on Hacker News about working at home. I've been working at home for about a year now so it's really interesting to me. I found the HN comments more interesting than the actual article hehe :)

How to Work from Home Without Going Crazy

Monday, October 19, 2009

Merging associative arrays in PHP

I've come across a problem recently when merging associative arrays in PHP using the array_merge function. The problem is that when one of the arrays has an element with a numeric key (even if the array is associative), the resulting array will be re-indexed as a numeric array. This is really how array_merge works so it is not a bug. A solution is to use the '+' operator to join the two arrays so the keys will be preserved. Here's an example:
$a = array(
'1'=> 'one',
);
$b = array(
'3'=> 'three',
'5'=> 'five'
);
print_r(array_merge($a, $b));
print_r($a + $b);

The output will be:

Array
(
[0] => one
[1] => three
[2] => five
)
Array
(
[1] => one
[3] => three
[5] => five
)

Thursday, September 24, 2009

How to move your WordPress blog to a new domain (the easy way)

Whether you're moving a WordPress blog to a new domain or moving a new blog from staging to live, it could be problematic especially if you don't like mucking around with the database. Here's an easy way to move your blog just by editing wp-config.php and using the Velvet Blues Update URLs plugin.

Edit wp-config.php, add the following lines at the beginning of the file (where "example.com" is the NEW location of your site):
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

After editing wp-config.php, you will be able to access your new blog's admin on the new domain, but images and links that are on your blog posts will still be pointing to your old domain. To fix this, download and install the Velvet Blues Update URLs plugin. Go to Settings-> Update Urls, select "Update urls AND links in page or post content: YES", enter your old URL and your new URL, and click Update URLs.

..and you're done! :)

Wednesday, September 16, 2009

CakePHP Tip: Creating https:// links

It's always better to use CakePHP's HTML helper to create relative links that will make your app portable. What if you need to create relative link that will use https:// instead of the default http://? This will be useful if most of your site uses http:// but some pages need to be secure (eg. registration or checkout page). Let's say your link is pointing to /pages/register, here's how to do it:
echo $html->link("Register", str_replace('http://', 'https://',
$html->url("/pages/register", true)));

What happens here? we use $html->url() to create a relative URL, and set the 2nd parameter to true so it will return the full URL (eg. http://domain.com/pages/register) and then replace http:// with https://, we then pass that URL to HTML helper's link() method to create a HTML link.

Note that you don't need to do this if the originating page is already using https://. If that is the case, then all relative links will also use https:// by default.

Saturday, July 18, 2009

Delicious Lite extension for Firefox 3.5

Today I decided to discontinue developing the Delicious Lite Firefox extension because the code is getting outdated and I don't have time to update it for the newly released Firefox 3.5. The good news is there's another new delicious bookmark extension that pretty much does the same thing (and better :). Check out the Delicious Post extension from AE Creations. This extension also stems from the original work of Patrick H. Lauke which I also used in Delicious Lite. So please try it out and kudos to AE Creations for such great work!

There are some stuff that I feel Delicious Post still lacks like a shortcut key and some super minor UI issues. To solve these issues for me I created a modified version which adds a shortcut key CTRL+SHIFT+D to post a bookmark (btw I borrowed this shortcut key from Firefox's Bookmark all tabs which I don't use much, and transfered it to CTRL+SHIFT+K). On the post dialog, I also made it focus on the tags textbox immediately because that's just usually what I edit when posting a bookmark. If you like these modifications, feel free to download the version here. I hope these will also get implemented on the official release :)

Saturday, July 4, 2009

Simple PHP Rest Client using cURL

I recently worked with a third party API that uses REST. I've been reading about REST all this time and this is the first time I've actually used it. Surprised me because it was really nice and simple. It's a lot easier trying it out than reading about it (but it sure helps to read some about it first :). What took quite some time was finding a REST client that I will use to connect and some authorization issues (which is site specific).

If you're already using Zend Framework, you might want to try out it's built in rest client. But if you're looking for a simpler solution, you can do well with PHP's cURL functions. Honestly I don't like cURL because it really looks dirty when you use it (aesthetically that is), and all the options you need to set kinda bums me. It's like you have to research a lot of option flags just to make something work. But hey, it almost always gets the job done :) Good thing iContact's API documentation (the API I'm working with) has a downloadable sample code that uses plain cURL functions to connect to it's REST service. I have to credit them for most of the code. I just did some minor edits so it is more generalized. So here, try it out if it works for you (this is plain PHP code, hopefully you'll put this in a function or method :)

This example is specific to JSON input/output, so you have to change some stuff if the API requires XML or some other format.

$url = 'https://www.google.com';
$method = 'POST';

# headers and data (this is API dependent, some uses XML)
$headers = array(
'Accept: application/json',
'Content-Type: application/json',
);
$data = json_encode(array(
'firstName'=> 'John',
'lastName'=> 'Doe'
));

$handle = curl_init();
curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
curl_setopt($handle, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);

switch($method)
{

case 'GET':
break;

case 'POST':
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
break;

case 'PUT':
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($handle, CURLOPT_POSTFIELDS, $data);
break;

case 'DELETE':
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'DELETE');
break;
}

$response = curl_exec($handle);
$code = curl_getinfo($handle, CURLINFO_HTTP_CODE);

Saturday, May 23, 2009

How to exclude CakePHP's tmp directory on SVN using svn:ignore

I wrote a post before about moving CakePHP's tmp directory outside of app so it won't be included in SVN. It's a good concept but since it's a bit dirty and not standard, it might lead to some problems later and when upgrading.

A better solution to this problem is to just exclude the contents of tmp (or any other directory you don't want to include in SVN). Here's how to do it on TortoiseSVN:
1. Backup the contents of tmp/ (cache, logs, sessions, tests, etc)
2. Delete all the contents tmp/
3. Commit the empty directory tmp/ to svn
4. After commit, right click the tmp/ folder and choose TortoiseSVN-> Properties
5. On the properties dialog, click New.., then set the Property name to svn:ignore and Property value to *
6. Commit the changes to SVN
7. Move back the previous contents of tmp/

There you go! SVN will now ignore the contents of tmp/
Note: when you checkout on another machine, you will have to manually create the folders inside tmp since it's not included in your repository

Friday, May 22, 2009

Twitter-like delicious gadget for your blog

I was inspired by the great articles I've read today (which I got from Hacker News) so I decided to put links to these articles on my blog. Using the delicious API and some javascript goodness, I created a twitter-like delicious bookmarks list that I can use on my blog (or any blog for that matter). Check it out in action at my sidebar (below the twitter widget).

If you want the same thing, copy the code below and put it to where you want it to appear on your blog.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script>
// change to your username and tag
delicious_widget = {username: 'tonio95', tag: 'read'};

delicious_widget.feed = 'http://feeds.delicious.com/v2/json/'+delicious_widget.username+'/'+delicious_widget.tag+'?count=10&callback=delicious_widget.print_list';
delicious_widget.print_list = function(data) {
var box = ['<ul>'];
$.each(data, function(i, item){
box.push(['<li><a href="', item.u, '">', item.d.substring(0,60), '</a></li>'].join(''));
});
box.push('<li><a href="http://delicious.com/'+delicious_widget.username+'/'+delicious_widget.tag+'">More!</a></li></ul>');
document.write(box.join(''));
};
document.write(unescape("%3Cscript src='" + delicious_widget.feed + "' type='text/javascript'%3E%3C/script%3E"));

</script>

Enjoy! and have fun reading!
Want more delicious? check out the delicious lite firefox extension

Thursday, May 21, 2009

Smart Bro Prepaid (USB Modem)

I recently bought a Smart Wireless Broadband Prepaid (USB Modem) because I needed a backup internet connection for my work. This thing costs PhP1995 and includes PhP100 load. I was able to connect in no time (from unboxing to installing the software). It's really easy to use and you don't have to configure anything. I'm quite impressed with it (based on my initial testing). I used it at 11pm, and the download speed was around 1.5-1.8mb/s. YouTube streams *almost* in real time (it buffers sometimes but you won't have to wait long).

My plan before was to use a 3G phone as modem (LG KU250) on Globe's network (my primary network), but Globe doesn't have a 3G signal here (weird because the 2G signal is full) so I decided to go with Smart. Smart's signal in my area (I live in QC) is WCDMA, which I think is the best signal you could get. I don't know how Globe's mobile broadband compares to Smart, but one thing I like about Globe is it charges per 15mins (Php5), while Smart charges per 30mins (Php10). Globe's charging rate seems more practical especially if you're just checking email every once in a while.

Anyway, I won't be using this much since it's only a backup connection in case Bayantel's DSL goes down for a whole day, like what happened last month. Let's just hope it won't go down when I need it :)

Saturday, May 9, 2009

Essential CakePHP tips for starters

It's been 3 months since I started using CakePHP and I have to say I'm having a great time using it. Before trying it out I was using my own little framework and tried a bit of Zend Framework. I think the best thing about CakePHP is that it's a full stack framework, which means you can take advantage of a lot of built in features. It takes some time to get used to especially if you come from a do-it yourself background (like me :), but in the long run using its conventions and built in features will save you a lot of time.

First off, I will assume that you already know the basics (at least Chapter 1 & 2 of the CakePHP manual). Also, this post was inspired by Teknoid's 15 Essential CakePHP Tips which is a great read. I suggest you read it first before reading this (my favorites are #5 I’m losing the extra URL parameters when paginating and #9 Avoid using the $uses array)

Disclaimer: I'm no CakePHP expert yet so feel free to suggest or correct me if I'm wrong!

Let's start!

HABTM query
Let's suppose recipes has and belongs to many tags, how do you query recipies that contain a certain tag? There are many ways to do this, as documented on the CakePHP manual. I think the simplest and cleanest way is given on the first example:
$this->Recipe->bindModel(array('hasOne' => array('RecipesTag')));
$this->Recipe->find('all', array('conditions'=>array('RecipesTag.tag_id'=>124)));

Use named parameters
CakePHP works better with named parameters (/name:value), especially when you are using pagination and other helpers. But if you don't want to, classic style parameters (?name=value) can still be accessed via $this->params on the controller

Paginate an unrelated model
If you need to paginate a model that's not in the current controller, use loadModel('model').
$this->loadModel('User');
$this->paginate = array('limit'=>20);
$this->paginate('User');

Getting data from $this->params and $this->data
The usual way is to get request parameters directly is to get them from the $this->params (or $this->passedArgs) and $this->data array directly (eg. $input = $this->params['named']['input']). But it's a little dirty because PHP shows a notice if the key does not exist in the array. To prevent this, I created two functions on my app/app_controller.php file that gets data from the param and data array, in case the key does not exist, it will just return null.

function getParam($key)
{
// eg. http://myapp.com/pages/1/somekey:somevalue
// $somevalue = $this->getParam('named.somekey');
return Set::classicExtract($this->params, $key);
}

function getData($key)
{
// eg $name = $this->getData('Person.name')
return Set::classicExtract($this->data, $key);
}

(for more array functions, check out CakePHP's Set component)

Secure forms using the security component
If you want to quickly secure your forms, CakePHP can do this automatically by using the Security component.

Keep links relative. Use $html->link(), or Router::url()
If you want your app to be portable, take advantage of CakePHP's built in URL functions to keep your links working wherever you install your app (eg root directory or sub directory). Use $html->link() for generating full link tags, or Router::url() if you only want the URL (eg. using it inside javascript or inside the controller).
Hint: if you want to get the full URL (including http://) use Router::url('/controller/action', true)

Use form helper
Because writing a lot of forms by hand is boring :) You will also take advantage of other built in functions, like displaying validation error messages.

Use the same view for add/edit forms
Most of the time add and edit views are just the same. To avoid code duplication, you could set the add action to also use the edit view. Just add $this->render('edit') at the end of the action.
function add()
{
$this->render('edit');
}

Looking for more tips?
Check out Matt Curry's Super Awesome Advanced CakePHP Tips

Saturday, April 4, 2009

Delicious Lite - a lightweight delicious firefox extension

Update: this extension is no longer being developed. Check out the Delicious Post extension from AE Creations which is compatible with Firefox 3.5.

Delicious Lite v1
I've been using delicious for a long time now. I remember using it even before it was acquired by Yahoo and it had a lot of growing pains. I even considered switching to Google bookmarks for a while because delicious was always going down (or super slow) that time. The thing that keeps me going back is it's simplicity. The URL structure (delicious.com/username/tag) is just great. Hey, I don't even need to install stuff just to access or manage my bookmarks!

There are many ways to bookmark websites on delicious. The simplest is installing the browser bookmarklet that pops up a window when you bookmark a website. I kinda like this one except that I hate waiting for the popup window to load and especially when it asks me to login. It's just too much time wasted for a simple bookmark. Another thing is installing the official delicious firefox extension which is super bloated (IMHO). I tried using an early version and remember it screwing up my browser because it tried to download and sync my thousands of bookmarks in delicious. That's just a major pain. I'm fine putting my bookmarks on the cloud and accessing them by tag when I need them.

What I need is a simple delicious extension that just lets me post bookmarks to delicious. Simple, no waiting, no logging in. That's delicious lite for you. This was originally done by Alf Eaton and Patrick Lauke, and I updated it to work with Firefox 3. I've been using this modified version for a while now but haven't had time to package it well for other people to use. Well here it is! enjoy!

Install Delicious Lite v1

Note: once installed, you can use the shortcut key CTRL+SHIFT+P to bookmark a page to delicious. There is also a toolbar button that you can add on Firefox's toolbar customize screen.

Tuesday, March 24, 2009

Pleomax SuperSlim keyboard is pure joy (converting my laptop to a CPU)

I recently converted my laptop to a CPU (haha) because it's killing my neck already. Using the laptop 8hrs a day is really a pain! I bought a 19inch Samsung LCD monitor and this Pleomax SuperSlim keyboard so I can get away from using the laptop directly. I think I'm becoming a Samsung fanboy haha.. so far I'm satisfied with these 2 items, both are worth the money.

I really like how the laptop feels except my posture when I'm using it. That's the only drawback. But I'm so used to the keyboard, touchpad, and even the small screen. I think I've been working around 6 months on just my laptop. Until my neck gave up.


LCD Monitor
The 19inch Samsung costs PhP 6,800. I like it's low resolution (relative to the screen size - 1360x768) which makes everything big. I always wondered why some LCD makers max out the pixel density for the screen size, yes it makes the desktop real estate bigger but you will need a microscope for everything, especially the text. It's just not practical. We bought a 17inch LG before that was just like that. The problem with these monitors is that you have to use their native resolution, or else it the pixels will look ugly. Kudos to Samsung (and others) who make big LCD's with low pixel density (not sure if LG still does it like before).


Keyboard
The Pleomax SuperSlim keyboard costs PhP 1,000. I read about Pleomax before on the newspaper that they were making these keyboards that are like the laptop keyboards. I just love laptop keyboards (especially Lenovo haha) because I can type very fast with no effort at all. My brother says that this keyboard is too expensive, but in my job I use the keyboard like 99% of the time so for me it's really essential. If you have a supercomputer with a generic cheapo keyboard then your computer sucks!!! hahaa no flames please, I just have to say that ;) I've had jobs before where they would let us use a generic keyboard which really irritates me. I mean it's the thing I use all day (!!!), plus it doesn't really cost that much to buy a premium keyboard like this one. The Pleomax SuperSlim keyboard totally feels like a laptop keyboard so that makes it worth the money for me (Pleomax is owned by Samsung btw).

Mouse
Just using a regular A4tech mouse. Haha. No innovation on the mouse department anyway. I'm still wishing I can buy a USB touchpad so I don't have to move my right hand away from the keyboard from time to time.

So there. Laptop users, please don't damage your neck! (at least if you're using it all day everyday).

Photo credits: pchome.com.tw, lacentnetwork.com

Thursday, March 19, 2009

Building my band's website using Wordpress

Besides coding, my other passion is music. I sing and write songs for the pop/rock/alternative band Nelo at ang Tala. Last week, I decided to recreate my band's outdated website so it can go well with our newly finished demo. I used Wordpress (WP) as CMS for the website so I can edit it with my bandmates and it's easy to post updates soon. Wordpress really rocks, everytime I have a chance to use it I constantly get awed by its new features and very nice interface. I really salute the people behind this project for creating this kick-ass software. Anyway, enough of my fanboyism.



Theme

I copied the whole kubrick folder (default) and renamed it to nelo. Then I wiped the css clean so I can start from scratch (hehe). I'm not really sure if they've updated kubrick since WP 2.0, but the last time I used it, the css file was full of hacks (haha). Not blaming it though, this theme is being used by gazillions of blogs (don't flame me pls ;). I've even used this on some sites before. I just wanted a clean slate because I already have a static design (HTML/CSS) ready. Made some edits to the templates and voila it's good and working! Another nice thing about WP is the excellent semantic markup; it will be just as usable as is, even without CSS.

Content
I wanted to make everything editable on the admin. Offcourse that's not possible (maybe it is, but I don't want to spend forever for something that will change in a year). What I'd like to be editable is the text intro and teaser that's on the header part of the template. I don't think WP doesn't have a snippets feature yet for misc parts of the website (there's widgets, but that's for the sidebar). What I did was created a 'page' for each section of content on the template that I want to be editable, so I created an 'intro' and 'teaser' page. I looked into the codex and found out about this nice function get_posts, what it does is it queries posts/pages based on the arguements given. It's really a charm, here's how I used it on the template:

$intro = get_posts('pagename=intro&showposts=1&post_type=page');
foreach($intro as $i) :
setup_postdata($i);
the_content('More »');
endforeach;

This looks for the page 'intro' and displays it on the part where I want it to show. One disadvanage of using this approach is you can't use WP's function to list the pages for your nav, since it will also show the pages that you are only using on the template (maybe you can use link categories but I haven't tried that yet). On my template, the links on the nav are hardcoded (and I don't mind ;)

Gallery
The gallery feature of WP is just new, so I don't really mind that it sucks right now. It's hard to understand how to use it (attach photos to a page/post to create a gallery). But I've managed to use it on our photos page! It still helped a lot.

Blog
Oh did I mention that WP is mainly a blogging engine? hehe. That's one reason why I really like to use it on our site. You won't see it now but the frontpage is also where the blog posts will appear. (will post updates soon!)

Plugins
The admin interface if you are an admin (sorry about the sentence!) is quite messy at first. I don't want my bandmates to get intimidated by the number of options and features. I assigned them as authors so they can focus on the content. One problem I faced is that an author cannot edit widgets, which I need because our gig schedule (which appears on the sidebar) is using the text widget. To solve this I used the Role Manager plugin which lets you assign custom privileges to a certain user. I just added the 'switch theme' privilege and it worked!

Misc
Wow this is already long. I really enjoyed building our website especially because I used a lot of stuff that are available already for free. If you notice I'm using a flash player (ala myspace). The player is from Premiumbeat and it's free. I like it because it's simple and elegant (and it works quite well!).

Streaming
Lastly, I'd like our music to stream fast so the user won't get stuck while playing it. This is another story but I'm using Amazon's S3 to host the mp3 files, so it will always stream fast. Special mention to S3fox which is a free software to manage files on S3.

That's it. Some people say that our website is simple and effective. I'm very glad to hear that! I'm not really much of a designer but I think I'm good at creating simple and effective user interfaces. Thanks for reading and keep the music playing!

Tuesday, February 24, 2009

Facebook Apps: Viral Marketing on Steroids

First there were invites by email. I still get those *friend* wants you to join *website* on my email inbox. If that was not annoying enough, then try Facebook and wait till you get hundreds of invites on you notification pane. Inviting people to join an app is just a simple click away. No more typing email addresses or signing in to your email accounts. This should be a good thing (at least for app developers), but often times you get those notifications 10x a day that say you've been poked or someone has done something to you, inviting you to see what it is.

Recently there was much buzz about Facebook changing it's terms of agreement. If you think about it, you've *already* given much of your personal information to a lot of third parties - everytime you use a new Facebook app. So regardless of Facebook's terms of agreement, your information is already stored on servers outside of Facebook's control. What really bothers me is that Facebook aims to be a social networking platform based on your real identity, yet it is the easiest platform to harvest personal information by using viral marketing. Always think twice before clicking that "Allow Access" button.

Tuesday, February 3, 2009

Enhancing CakePHP's debug() function for null, false, and empty string

CakePHP's debug() function is great. Aside from printing out the variable content, it also displays from which line it is called. If you call out debug() in different places, knowing which line saves a lot of time tracking something.

What bothers me sometimes is it doesn't tell you if the variable is NULL, false, or an empty string, so I end up using var_dump() to double check. So how to fix this? Right! We'll edit something inside the cake folder ;) This is usually bad practice but this is a safe one (we'll just plug something in.. kinda), and it won't break your stuff in case you upgrade your cake library. Here you go:

Add this function at the bottom of app/config/core.php:
# this prints out booleans, nulls, and empty strings
# will be called inside cake's debug() on cake/basics.php
function debug2($var)
{
if(is_null($var) || is_bool($var))
{
var_dump($var);
}
else if( is_string($var) )
{
if( '' == trim($var) )
{
var_dump($var);
}
}
}
Here's the dirty part! open cake/basics.php and find the debug() function (line ~104). Add this code before print_r is called: (only the bold part)

if(function_exists('debug2')) {
debug2($var);
}
$var = print_r($var, true);

Now when you call debug(NULL), it will now look like this:
app\app_controller.php (line 72)
NULL

Have fun baking!

Monday, January 26, 2009

Changing CakePHP's tmp directory so it won't be included on SVN

Update: this solution is quite dirty, and I don't recommend it now. Check out my new post on using SVN's ignore property to ignore CakePHP's tmp directory.

If you're putting your CakePHP app on version control (SVN), you'll notice that the /tmp directory is inside /app. You might want to not include /tmp on your repository as it's just a location for caches, logs, session, and other temporary stuff which is not part of your application code. Here's how to change the tmp directory of CakePHP:

1. Copy /app/tmp to /tmp (copy it outside of the app directory)
2. Add this code on /app/webroot/index.php after CAKE_CORE_INCLUDE_PATH is defined (line ~60). This will change the tmp directory from /app/tmp to /tmp.
# define a different TMP dir outside of app
define('TMP', ROOT.DS.'tmp'.DS);
3. Configure the file cache path on /app/config/core.php (line ~226):
Cache::config('default', array('engine' => 'File', 'path' => ROOT.DS.'tmp'.DS) );
(This step is necessary for BAKE to work properly if you are using the default file cache)
4. To check if it's working fine, try renaming /app/tmp to /app/xtmp and see if your app still works properly (then you can already delete that directory). If not, make sure the new tmp directory is the same as the original structure (cache, logs, sessions, tests)

Friday, January 23, 2009

Things I love

I want to write something positive to end the day. So here, I'm writing about the things I love.. at least those that come to my mind right now ;)

Web Development.
It's what I do. Sometimes it pays, sometimes it doesn't. I love it either way ;) I can't spend a week without coding something. I'm currently enjoying CakePHP.

Music.
I love music. It helps me work everyday. I'm really into Saves The Day right now. I also listen to a lot of emo punk and Japanese stuff. Too many to mention haha. I wish I could write about each of them. Oh and I'm also part of a band called Nelo at ang Tala. We're currently recording our demo and I'm so excited about it. Watch out ;)

Instapaper.
iPod Touch really fits me. I love reading and listening to music. iPod takes care of my music, and Instapaper takes care of my reading. If you like reading blogs then try it out! It's free and I promise it won't let you down.

Hacker News.
This is where I get stuff to read. Hacker News + Instapaper = :)
If you like reading Hacker News on weekly mode, check out my project hnweekly

Sleep.
Yeah I usually sleep late.. but I get lots of it!

That's it for now.. I'm sleepy. I'm sure I missed out a lot.

Friday, January 16, 2009

Moving to DreamHost

Wow it took me (just) 2 days to move my sites from NearlyFreeSpeech (NFS) to DreamHost (DH) :) I thought it would take a year haha. It's been smooth sailing on DH so far, I'm enjoying all the features included (everything's unlimited!!). If you're not yet familiar with DH, check out their hosting, some features worth noting are: unlimited domains, unlimited storage, unlimited bandwidth, unlimited databases, ssh access, user accounts, svn hosting.. ahh the list goes on. I also like the simplicity of their control panel.

I have to say I've had a good experience with NearlyFreeSpeech after 2 years of hosting with them. It's the perfect place to learn things and play. NFS charges you depending on usage, which really just costs very little if you're just trying out stuff. Bandwidth, storage, and database will just cost you around $0.03 per day. But as my projects grew, the storage costs also grew. Well, not really much but it came to a point that I don't want to worry about it and just go unlimited at DH.

I'm glad I tried (possibly) the 2 best shared hosting available. I'm not expecting a super awesome time at DH, it's shared hosting after all :) If the time comes that one of my websites demand dedicated resources, then maybe it's time to try out VPS hosting (Linode seems to be a good deal). Right now I'm still enjoying DH.


.. yeah and I sound like a fanboy right now ;)

(If you're curious what websites I host on DreamHost, two of them are EatMyCharts.com and hnweekly)

DreamHost super offer: $50 discount on yearly hosting! enter the code HNWEEKLY when you sign up!

Saturday, January 10, 2009

EatMyCharts.com: Social Music Charts on Facebook Connect


Hello there! please try out my latest project :)
EatMyCharts.com is a Social Music Charts website where you can vote for your favorite songs and discover new music. Lots of charts for different genres. It uses Facebook connect so there's no need to sign up if you already have a Facebook account.

Thursday, January 8, 2009

Fixing "Another blog is already hosted at this address" error on Blogger

I've had this problem with Blogger many times when I can't use www.mydomain.com as the custom domain. It returns an "Another blog is already hosted at this address" error. Here's an easy fix that worked for me:

1. Go back to using the *.blogspot.com address
2. Login to Google Apps (or sign up if you haven't). If you don't know Google Apps, this is Google's free service so you can use your domain with their services for free (gmail, docs, sites, etc)
3. On the Dashboard, click "Sites" (on Service Settings).
4. Click the "Web address mapping" tab
5. Delete the "www.mydomain.com" entry. This is the DNS setting that conflicts with blogger when you type www.mydomain.com as your custom domain.
6. Go back to blogger and set www.mydomain.com as your custom domain. It should work this time!

The next thing to do is redirect the bare domain (http://mydomain.com) to www.mydomain.com. This is covered on this blog post from Consuming Experience:
Blogger: how to use a www custom domain for your blog

That's it! have fun!