Untuk menghapus Aplikasi Mac Office gunakan “Remove Office” tools di Application > Microsoft Office > Additional Tools > Remove Office

Setelah melakukan Remove Office ini, apabila kita re-install Mac Office lagi dengan versi yang sama, maka Mac Office masih mendeteksi product key dari Mac Office sebelumnya. Untuk benar-benar full-reinstall termasuk memasukkan product key baru, maka bisa dilakukan dengan menghapus 2 file sebagai berikut :
~/Library/Preferences/Microsoft/Office 2008/Microsoft Office 2008 Settings.plist
/Applications/Microsoft Office 2008/Office/OfficePID.plist

Ok selamat menikmati Clean Mac Office!


Aku mempunyai MAMP Pro sudah sudah jalan stabil di Mac Tiger, termasuk MySQL, PhpMyAdmin dan Apache. Aku mencoba memasang Navicat Premium sebagai MySQL GUI. Tetapi muncul masalah, setiap kali mencoba melakukan koneksi ke MySQL di localhost selalu gagal (Can’t connect bla bla…) tetapi kalau digunakan untuk melakukan koneksi ke MySQL ke Server Linux berhasil.

Setelah browsing dan mencoba-coba, solusi yang bisa dilakukan dengan cara menggunakan socket file untuk koneksi ke localhost.

Setting di Navicatnya sebagai berikut :

Masuk ke Connection Properties-nya Navicat, klik Tab Advanced, pilih option “Use socket file for localhost connection” dan arahkan Socket File Path = /Applications/MAMP/tmp/mysql/mysql.sock

Dan tentunya lengkapi juga setting User-Password di General Tab.

VbCrLf di PHP

simple script untuk replace [new line – enter] menjadi <br> di PHP :

$tampil = preg_replace(‘/(\r\n|\n|\r|\f)/U’, “<br />”, $text);

example :


$t = $_POST[‘test’];

$tampil = preg_replace(‘/(\r\n|\n|\r|\f)/U’, “<br />”, $t);
echo ‘test : ‘. $tampil;


<form name=”test” method=”post” action=”test.php”>
ini inputnya : <br>
<textarea name=”test” rows=”20″ cols=”80″></textarea><br>
<input type=”submit” value=”submit” name=”submit”><br><br><br>

ini hasilnya : <br>
<textarea name=”test2″ rows=”20″ cols=”80″><?=$tampil?></textarea><br>

Windows server 2000/2003 allows two remote terminal services connections for administrative purposes. Every once in a while I’ll get the “You exceeded the allowed connection count” message when trying to connect to a server via RDP, because previous sessions were not disconnected correctly. You can use either of the following methods to remotely disconnect Terminal Server sessions. Method 1 You can normally run the Terminal Services Manager program on another server, or even from a Windows XP workstation, to disconnect Terminal Services connections by clicking Start – Run and then typing %SystemRoot%\system32\tsadmin.exe This will launch the local copy of Terminal Services Manager. Next right click on All Listed Servers and select Connect to Computer. Type in the name or IP address of the server you wish to manage.

DECLARE @name VARCHAR(50) -- database name
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name

SET @path = 'C:\Backup\'


FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb')

OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @name

SET @fileName = @path + @name + '_' + @fileDate + '.BAK'

FETCH NEXT FROM db_cursor INTO @name

CLOSE db_cursor
DEALLOCATE db_cursor

Internal SQL Functions

1. Functions Introduction

This section gives examples of all functions that are available in the Mckoi database software. Functions may be used within all expressions except aggregate functions that may only be used within the SELECT .... FROM clause.

2. Mathematical Functions

Follows are all the mathematical functions available in Mckoi Database. Note that some of these functions may lose precision because the number could be cast to a ‘double’. You can assume that all mathematical functions have at worst the precision of a ‘double’.


Returns the absolute value of a number.


     SELECT ABS(-0.94)
==>  0.94
     SELECT ABS(9 - 200)
==>  191


Returns 1 if the number is positive, -1 if the number is negative and 0 if the number is zero.


     SELECT SIGN(40)
==>  1
     SELECT SIGN(-40)
==>  -1
     SELECT SIGN(40 - 40)
==>  0

MOD(number1, number2)

Returns the modulo of number1 and number2 (equivalent to {number1 % number2} in Java).


     SELECT MOD(15, 5)
==>  0
     SELECT MOD(33, 10)
==>  3
     SELECT ROUND(552 / 10), MOD(552, 10)
==>  55, 2

ROUND(number, decimal_places)

Rounds the number to ‘n’ decimal places. When no ‘decimal_places’ argument is provided the number is rounded to the nearest whole number.

This will round up if the fraction to the right is >= .5 otherwise it rounds down. This uses the {BigDecimal.setScale(decimal_places, BigDecimal.ROUND_HALF_UP)} method for rounding.


     SELECT ROUND((943 * 13) / 99, 3)
==>  123.828
     SELECT ROUND((943 * 13) / 99, 2)
==>  123.83
     SELECT ROUND((943 * 13) / 99)
==>  124

POW(number1, number2)

Raises number1 to the power of number2.


     SELECT POW(9, 6)
==>  531441
     SELECT POW(2, 32)
==>  4294967296
     SELECT POW(2, 64)
==>  18446744073709551616
     SELECT POW(2, -3)
==>  0.125


Finds the square root of the number argument.


     SELECT SQRT(65536)
==>  256
     SELECT SQRT(-1)
==>  NULL

LEAST(val1, val2, …)

This function accepts any number of arguments and returns the value that represents the least value of the set.


==>  4
     SELECT LEAST(90, 9.125, 3, 75)
==>  3
     SELECT LEAST('H', 'Z', 'B')
==>  B
     SELECT LEAST(10 / 3, 10 * 3,
                  POW(10, 3), MOD(10, 3))
==>  1

GREATEST(val1, val2, …)

This function accepts any number of arguments and returns the value that represents the greatest value of the set.


==>  4
     SELECT GREATEST(90, 9.125, 3, 75)
==>  90
     SELECT GREATEST('H', 'Z', 'B')
==>  Z
     SELECT GREATEST(10 / 3, 10 * 3,
                     POW(10, 3), MOD(10, 3))
==>  1000

3. String Functions

String functions in Mckoi Database mostly map to equivalent functions found within java.lang.String.


Returns a lower case version of the string literal argument.


==>  this is some text


Returns an upper case version of the string literal argument.



CONCAT(str1, str2, …)

Returns the concatenation of the string arguments. This function can take any number of arguments.


     SELECT CONCAT('This i', 's some text', '.')
==>  This is some text.
     SELECT CONCAT('-', 0.95)
==>  -0.95


Returns the number of characters in the string argument.

NOTE: This may additionally be used on BLOB data to return the count of bytes in the BLOB.


     SELECT LENGTH('This is some text')
==>  17
     SELECT LENGTH(0.544)
==>  5
     SELECT LENGTH('    Test')
==>  8

TRIM( [ [ LEADING | TRAILING | BOTH ] [ characters ] FROM ] str )

Trims characters from a string argument. The LTRIM and RTRIM form trim whitespace from the left and right of the string respectively.


     SELECT TRIM(TRAILING 'a' FROM 'aaabcdaaa')
==>  aaabcd
     SELECT TRIM(LEADING 'a' FROM 'aaabcdaaa')
==>  bcdaaa
     SELECT TRIM('ab' FROM 'ababzzzzab')
==>  zzzz
     SELECT TRIM('  a string message ')
==>  a string message

SUBSTRING(str, start_index)
SUBSTRING(str, start_index, length)

Returns a substring of a string. The SUBSTRING function complies with the SQL specification. The start_index parameter is a value between 1 and the length of the string where 1 includes the first character, 2 includes the second character, etc. The length parameter represents the size of the substring.


     SELECT SUBSTRING('Tobias Downer', 8)
==>  Downer
     SELECT SUBSTRING('abcd', 1, 2)
==>  ab
     SELECT SUBSTRING('abcd', 3, 4)
==>  cd
     SELECT SUBSTRING('abcd', 3, 5000)
==>  cd
     SELECT SUBSTRING('abcd', 0, 5000)
==>  abcd
     SELECT SUBSTRING('abcd', 1, 0)
==>  (string of 0 length)

4. Aggregate Functions

Aggregate functions can only operate within a group of a SELECT statement. They are used to compute statistics over a set of records.

COUNT(DISTINCT expression_list)

The * version of this function returns the total number of rows in the group. If a column name is specified it returns the number of non-null values in the group. The ‘expression’ form of this function evaluates the expression for each row in the group and counts it only if it evaluates to NULL. COUNT(DISTINCT ... ) counts all distinct values of the expression list over the group.


       FROM Orders
       FROM Orders
   GROUP BY division
       FROM Orders
   GROUP BY division
     SELECT last_name, COUNT(DISTINCT last_name)
       FROM Customers
   GROUP BY age


Calculates the sum of all values in a column/expression over a group. The expression form of this function is evaluated for each row in the group.


     SELECT SUM(value) FROM Orders
     SELECT SUM(quantity * value)
       FROM Orders
     SELECT SUM(quantity * value) * 0.75
       FROM Orders
   GROUP BY division


Calculates the average of the column/expression over the group. The expression form of this function is evaluated for each row in the group.


     SELECT AVG(value) FROM Orders
     SELECT AVG(quantity * value)
       FROM Orders
     SELECT AVG(quantity * value) * 0.75
       FROM Orders
   GROUP BY division


Finds the minimum value of a column/expression over a group.


     SELECT MIN(value) FROM Orders
     SELECT MIN(quantity * value)
       FROM Orders
     SELECT MIN(quantity * value) * 0.75
       FROM Orders
   GROUP BY division


Finds the maximum value of a column/expression over a group.


     SELECT MAX(value) FROM Orders
     SELECT MAX(quantity * value)
       FROM Orders
     SELECT MAX(quantity * value) * 0.75
       FROM Orders
   GROUP BY division

5. Security Functions

Functions that provide security information about the session performing the query.


Returns the current user.


Returns a comma deliminated list of priv groups the user belongs to. A user may belong to any number of groups which dictate the tables a user may access.

6. Branch Functions

IF(condition_expr, true_expr, false_expr)

If the first expression (condition_expr) evaluates to true this function returns the result of ‘true_expr’ otherwise returns the result of ‘false_exp’.


     SELECT IF(true, 5, 8)
==>  5
     SELECT IF(false, 5, 8)
==>  8
     SELECT IF(NULL, 5, 8)
==>  NULL
     SELECT IF(true, IF(false, 1, 2), 3)
==>  2
     SELECT IF(col1 = 0, 'N/A', col1) FROM MyTable

COALESCE(expr1, expr2, expr3, ….)

Returns the first non null value from the parameters or null if the entire list contains null values.


==>  a
==>  NULL
     SELECT COALESCE(col1, 'N/A') FROM MyTable

7. Date/Time Functions


Parses a string to a Date object that can be used on queries against TIMESTAMP / DATE / TIME columns. DATEOB with no arguments returns the current time of the machine running the database.

Since version 0.92 this function has been deprecated. Use the standard DATE, TIME and TIMESTAMP literals specified in SQL-92 instead.


==>  Wed Aug 09 11:49:31 EDT 2000
     SELECT DATEOB('Aug 1, 2000')
==>  Tue Aug 01 00:00:00 EDT 2000
     SELECT number FROM Orders
      WHERE date_made >= DATEOB('Jan 1, 2000')

8. Misc Functions


Returns a unique key for the given table name. This is an atomic operation that is guaranteed to return a unique number each call. It should be used to generate unique identification numbers for records. It is similar to the AUTO_INCREMENT feature of other database systems.


     INSERT INTO Orders
        ( id, number, division, date_made, quantity,
          value )
        ( UNIQUEKEY('Orders'), CONCAT('Order-', id),
          'Bio Engineering', DATEOB(), 25, 1900.00 )


Attempts to cast the expression to a number. If the expression is a boolean then this function will return 1 for true or 0 for false. If the expression is a String then it attempts to parse the string into a number. If the expression is a Date then it returns the date as the number of milliseconds since Jan 1st, 1970.


     SELECT TONUMBER(DATEOB('Aug 1, 2000'))
==>  965102400000

I recently retooled a Zend development environment on a mac laptop running OS X. I had been using the free version of MAMP for awhile but found the free version too limited.  MAMP is useful for getting  Apache, PHP, and MySQL stack up and working together quickly on a mac.  One thing lacking in MAMP though is an actual http.conf file like you probably deal with on a production server.

XAMP is another free AMP stack which includes an editable httpd.conf file making configuring Apache to test SSL connections much more standardized if not straight forward.  Instead of dealing with a GUI one deals with the Apache configuration files directly.  While it’s nice to be able to customize XAMPs Apache installation getting the configuration right can take some time.  If your really uncomfortable meddling with Apache configuration files you should consider just purchasing a licensed version of MAMP which does most of the stuff through a graphical interface.  Of course once you go into production you’ll probably going to have to deal with Apache’s httpd.conf file anyway so you might as well front load the pain now and be better prepared when things actually do go into production.

So without further ado I now present the first post on the new acwolf blog: how to configure XAMP virtual hosts on a mac.

Step One, Download and configure XAMP

First download XAMP for mac.

Once you have XAMP running on you mac you’re ready to begin configuring virtual hosts.  Using Mac Finder go to Applications > xampp > etc and open the httpd.conf file. Near the bottom of the file look for the following lines:

# Virtual hosts
#Include /Applications/xampp/etc/extra/httpd-vhosts.conf

The pound symbol (#) denotes a comment.  Since we want to setup virtual hosts go ahead and uncomment the second line by removing the pound symbol like so

# Virtual hosts
Include /Applications/xampp/etc/extra/httpd-vhosts.conf

With the above line uncommented Apache will now look to the httpd-vhosts.conf file for instructions on how to configure virtual hosts.   Go to Applications > xampp > etc > extra and open httpd-vhosts.conf to begin configuring virtual hosts for XAMP.  An imported (and practically undocumented) fist step is to include localhost has the default named virtual host. Do this by adding the following to the httpd-vhosts.conf:

<VirtualHost *:80>
ServerName localhost
DocumentRoot “/Applications/xampp/htdocs”
<Directory “/Applications/xampp/htdocs”>
Options Indexes FollowSymLinks Includes execCGI
AllowOverride None
Order Allow,Deny
Allow From All

With that in place you are now ready to add your other virtual hosts, in my case I’m developing a Zend application called zendapplication.  It’s located in a folder called myZendApps in the User > Documents folder.

<VirtualHost *:80>
ServerName zendapplication.dev
ServerAlias wwww.zendapplication.dev
DocumentRoot “/Users/aaronwolf/Documents/myZendApps/zendapplication/public”
<Directory “/Users/aaronwolf/Documents/myZendApps/zendapplication/public”>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
ErrorLog “logs/zendapplication-error_log”
CustomLog “logs/zendapplication-access_log” common

For all the details and options involved with setting up a virtual host refer to the apache documentation.  The two critical configuration options here are ServerName and Document root.  ServerName denotes what domain this particular virtual hosts responds to.  DocumentRoot tells Apache where the files associated with this particular domain live.  Since Zend Framework applications (like Rails applications) only make the public directory accessible to the web I have the document root pointing to the public directory of my Zend application.

So far we,

  1. Created a localhost vertual host pointing to XAMPs default root folder (/Applications/xampp/htdocs).
  2. Created a virtual host for a zend application located in Users > aaronwolf >Documents > myZendApps > zendapplication >public.
  3. Assinded a server name (the local domain name) of our choosing to the new virtual host.

Note: I used the .dev extension for my server name.  It’s best not to use .com or .net domain names when configuring local applications, you’ll see why once you…

Configure the hosts file

The next step is to configure your host file.  A hosts file works like a DNS server associating domain names with IP address except domain names configured in your local hosts file only effect your local development machine.

In the example presented here we have configured Apache to respond to requests for zendapplication.dev now we want to be able to type zendapplication.dev in to a browser and play with our application.  Since zendapplication.dev only exists on our local development machine (not the internet) we’ll need to configure our local host file to send requests for the zendapplication.dev domain to our development computers IP address ( to be handled by Apache server.  Sounds complicated but to get it done is very simple.

Fist you’ll need to open your hosts file.  On a mac you can find the hosts file in the /etc directory (you’ll need root permission to edit the file).

Open a concole window and type:

sudo nano /etc/hosts

Add the following line to the bottom of your hosts file (be sure to sperate the IP number and the domain name with a tab).        zendapplication.dev

Now when you type zendapplication.dev in to the address bar of you local browser you’ll should see…

You don’t have permission to access /xampp/index.php on this server.

Nice!  Turns out there’s one more bit of configuration to be done (at least if you’re storing you applications under the User > Documents directory on a mac like I am).  You’ll need to tell the Apache process to run with your user permissions (something that should never be done on a production machine).  Back to Application > xamp > etc, open httpd.conf and look for the following block:

<IfModule !mpm_netware_module>
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User nobody
Group admin

Notice by default Apache is set up to run as user “nobody” which lacks permissions to access files in your Documents directory.  To fix this simply change nobody to the username you uses when logging into your machine, so in my case…

User aaronwolf
Group admin

That should about do it.  Type zendapplication.dev into your browser and go to town.

If you notice your application’s indexpage redirects to /xampp/index.php you’ll just clear your browsers chache.

Hopfully that will save someone a few hours…

Source : http://www.acwolf.com/2009/02/24/xampp-virtual-hosts-on-a-mac/