Tuesday, December 30, 2008

XL Award 2008 Competition

I take this photos to follow XL Award 2008 Writing and Photo Competition. I just realize that photography is not easy than I imagine



Pakai yang mana, tergantung situasinya (Which one to use is depend on the situation)


Halo Papa (Hello Papa)

I hope I can win with this photo

Saturday, December 27, 2008

Where I can find Wordpress API?

Wordpress API usually is used with Akismet modules to prevent spam. You will get wordpress API when you've registered with wordpress.com hosting. The wordpress API key will be sent into your gmail.

But what if my email that contain wordpress API has been deleted? Should I need to register with wordpress.com hosting again?

You don't need to do that if you still can login the wordpress hosting. After login go to your blog then your profile or you can go to

http://[yourname].wordpress.com/wp-admin/profile.php

Change [yourname] with your blog name. On that page, under Profile you will see
Your WordPress.com API key is: ....... Don't share your API key, it's like a password.

That's your wordpres.com API

If you can't login and your email that contain wordpress API has been deleted so the solution is register again with wordpress.com hosting and write down your wordpress API on a paper.

Friday, December 26, 2008

Write PHP and MySQL Code on Drupal

Drupal give us ability to write PHP and MySQL script on the content or when we create block. For me this is killer facility by drupal. Until now I don't find the facility like this on other content management system or blog script.

With this ability you can write your PHP with MySQL from web without scripting. You don't need do hardcode on drupal's script file.

So this is little example on how to write PHP and MySQL code on drupal. This script will call latest submitted stories that have been publish.

<ul>
<?php
$query = "select nid, title from node where status = 1 order by nid desc limit 10";
$result = mysql_query($query) or die("Query failed");
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$url = "node/".$line['nid'];
echo "<li><a href=\"".url($url)."\" title=\"".$line['title']."\">".$line['title']."</a></li>";
}
?>
</ul>


If you want to test it or create another PHP and MySQL code, make sure that on Input format you've choose PHP Code and remember you should include tags on every PHP and MySQL that you've writen.

Have a nice try!

Wednesday, December 24, 2008

How to Create VirtualHost on Xampp

Create virtualhost on Xampp that installed on windows computer is very eazy. You just need what the name of virtualhost and where folder you want use as document root. You need to do two part to create virtualhost on xampp

The first part is editing httpd-vhosts.conf on xampp server. This is to redirect server on the right configuration when browser call virtualhost. Second part is editing hosts file on windows. Configuration on this file contains the mappings of IP addresses to host names. It will allow you to call virtualhost from web browser

Editing httpd-vhosts.conf

1. Open %xampp folder%\apache\conf\extra\httpd-vhosts.conf with your favorites text editor. Usually the location is C:\xampp\apache\conf\extra\httpd-vhosts.conf
2. Uncomment #NameVirtualHost *:80 so it will be look
NameVirtualHost *:80

3. Uncomment all configuration script that located between . Or copy paste to create more than one virtualhost. Remember the first configuration is used for all requests that do not match a ServerName or ServerAlias in any block.

This is the example of virtualhost. First configuration is used for all requests that do not match a ServerName or ServerAlias in any block.

<VirtualHost *:80>
ServerAdmin test@test.com
DocumentRoot C:/xampp/htdocs
ServerName xampp
ErrorLog C:/xampp/htdocs/access_error.log
</VirtualHost>

<VirtualHost *:80>
ServerAdmin test@test.com
DocumentRoot C:/xampp/htdocs/example
ServerName example.com
ServerAlias www.example.com
ErrorLog C:/xampp/htdocs/example/access_error.log
</VirtualHost>

Below explanation of each configuration

<VirtualHost *:80>: virtualhost configuration according to NameVirtualHost
ServerAdmin: email administration
DocumentRoot: Docoment root folder for the virtualhost
ServerName: virtualhost or domain name
ServerAlias: virtualhost or domain name alias.
ErrorLog: File to create error for this virtualhost

4. Restart your xampp server

Second thing you need to add your virtualhost name into hosts file windows. You should do this in order your windows computer can call the virtualhost name from browser

Edit hosts.conf on Windows

1. Open %windows folder%\system32\drivers\etc\hosts with your favorites text editor. Usually the location is C:\WINDOWS\system32\drivers\etc\hosts. Remember hosts is name of nfile not directory.
2. Add all your virtualhost with ip 127.0.0.1. The IP is local IP address. Below the example:

127.0.0.1 localhost
127.0.0.1 example.ex
127.0.0.1 www.example.ex
127.0.0.1 thisisfor.example.ex


Now you can test from your favorite browser. Congratulation if it work!

Have a nice try!

Tuesday, December 23, 2008

Admin Menu Module to Administrate Drupal

Admin Menu is one of drupal's modules that I like. This module is not usefull for guest or some user but very usefull for administrator or every member that give access to maintain drupal site.

This module enders all administrative menu items below 'administer' in a clean, attractive and purely CSS-based menu at the top of your website. It contains not only regular menu items - local tasks are also included, giving you extremely fast access to any administrative resource and function your Drupal installation provides.

So it's save your time to work with your drupal. You don't need back to admin home page when you want to access administration menu. Just click the menu from the drop down menu at the top of the site.

For instalation
1. Download file that suitable with your drupal version.
2. Extract the file and upload to your modules directory.
3. Go to list of modules. Site Building > Modules or visit yourdomainname.com/admin/build/modules
4. Enable module Administration Menu then click Save Configuration.
5. Now you can see there is drop down menu at the top and you can access menu on administration direcly from the drop down menu.
6. To administer admin_menu go to yourdomainname.com/admin/settings/admin_menu

Have a nice try!

Sunday, December 21, 2008

Check No Follow Attribute on Comment System Blog

Give comment on blog that doesn't have nofollow attribute can give backlink that will be indexed by Google. A lot of backlink is one factor to increase page rank. Are there any way to know that comment system on the blog have nofollow or not?

The easiest way is by seeing the source code and find if there is rel="nofollow" or rel="external nofollow the code. But this is not practical way because you must view source code on each site and find nofollow attribute.

The other way by visiting dofollow directory. Allmost all blogs on the directory have erased nofollow attribute. But some blog will active again the attribute.

There is another practical way. This way using with firefox browsing with SearchStatus extention.

After install, restart your browser and you will see @ icon on the status bar. Right click on the icon and click "Highlight Nofollow Links" like on the picture below.



After that you can see that all link with nofollow attribute will be highlighted.

This way is simple, just type blog address, wait for loading and you can see link with nofollow attribute. Except that you can also check page rank or alexa rank of the blog or site that you access.

Have a nice try!

Update Drupal from 5.xx to 6.xx

Now drupal develops 3 version: 5.xx, 6.xx, and 7-beta. Drupal 7-beta still new and doesn't stable yet. So there aren't many modules or themes that compatible with drupal 7-beta. One thing that I like from Drupal 6.xx is update status module that automatically check for available updates and warn sites if they are missing security updates or newer versions. So I don't need to visit drupal.org regularry just to check if there are new updates. Drupal 5.xx also has more modules and themes then drupal 6.xx.

But if you use Drupal 5.xx and want to upgrade to Drupal 6.xx this is the tutorial:
1. Backup your database and Drupal directory. So if you get fail when upgrade, you just need restore the backup folder and database
2. Log on as the user with user ID 1
3. Place the site in "Off-line" mode, to let the database updates run without interruption and avoid displaying errors to end users of the site. You can do that from http://www.example.com/?q=admin/settings/site-maintenance (replace www.example.com with your installation's domain name and path).
4. If using a custom or contributed theme, switch to a core theme, such as Garland or Bluemarine.
5. Disable all custom and contributed modules. Remember modules and theme for drupal 5.xx are not compatible with drupal 6.xx
6. Remove all old files and directories from the Drupal 5.xx installation directory.
7. Unpack the new files and directories into the Drupal 6.xx installation directory.
8. Copy your backed up "files" and "sites" directories to the Drupal installation directory. If other system files such as .htaccess or robots.txt were customized, re-create the modifications in the new versions of the files using the backups taken in step.
9. Make sure that your new configuration file is correct.
10. Run http://www.example.com/update.php (replace www.example.com with your Drupal installation's domain name and path) from your favorite browser.
Note: if you are unable to access update.php (for example can't login with user ID 1)do the following:

- Open your settings.php with a text editor.
- Change $update_free_access = FALSE; to $update_free_access = TRUE;
- Once update.php is done, you must change the settings.php file back to its original form with $update_free_access = FALSE;

11. If you can run update.php then follow the instruction. If success you will get information about drupal database update.



12. Ensure that the versions of all custom and contributed modules and themes match the Drupal 6.xx.
13. Re-enable custom and contributed modules and themes then re-run update.php to update custom and contributed database tables.
14. Finally, return your site to "Online" mode so your visitors may resume browsing. You can do that from http://www.example.com/?q=admin/settings/site-maintenance (replace www.example.com with your installation's domain name and path).

Have a nice try!

Change Homepage on Xampp

When you installed xampp on your computer your localhost homepage will be redirect to xammp configuration page. If you want to change that you just need open %xampp folder%\htdocs\index.php with your favorite text editor and change the script with your script.


Another way, just replace index.php with your index.php

It's so simple, isn't it

Thursday, December 18, 2008

Active Curl on Xampp

I've searched how to active curl on xampp and found some methods. But after tested, curl function still do not active yet. After test some my own method, finally I found the way how to active curl.

The method is very simple, you just need uncomment extension=php_curl.dll on php.ini so it will be like this

extension=php_curl.dll


But the problem is you need do that on the right php.ini which is use for PHP Configuration File on xampp. You can check where is location of the right php.ini from

http://localhost/xampp/phpinfo.php


Or you can create php file and write

phpinfo();
?>


After that run the script on your favorite browser. Then find these:

Loaded Configuration File :


You can see where is location php.ini. Now just uncomment extension=php_curl.dll and restart apache. Finally test your curl function and hopely it can working well on your computer.