PHP and Web Technologies Freak
These steps reset the password for the “root” account to “password”. To change the password for a different account, or to set a different password, just edit the variables in single-quotes in step 4.
If you know your existing MySQL root password, steps 1-3 are not necessary.
Part 1 of this article looked at the fulltext index, and how to search on it using an ordinary MATCH() AGAINST(). Even more powerful, (although only available on the newer MySQL version 4), is the ability to do a boolean search. Part 2 of this article examines the possibilities.
You’ll use the same table you used in Part 1. The full list of records is:
mysql> SELECT * FROM fulltext_sample; +---------------------------+ | copy | +---------------------------+ | It appears good from here | | The here and the past | | Why are we here | | An all-out alert | | All you need is love | | A good alert | +---------------------------+
To perform a boolean search, the IN BOOLEAN MODE modifier is used. The following query demonstrates the new syntax.
One of the more useful MySQL features is the ability to search for text using a FULLTEXT index. Currently this is only available if you use the MyISAM table type (which is the default table type, so if you don’t know what table type you’re using, it’ll most likely be MyISAM). A fulltext index can be created for a TEXT, CHAR or VARCHAR type field, or combination of fields. We’re going to create a sample table and use it to explore the various features.
The simple form of usage (the MATCH() function) is available to all MySQL servers from version 3.23.23, while the more complex usage (the IN BOOLEAN MODE modifier) is available from version 4. The first part of this article looks at the former, and the second part at the latter.
A sample table
We’re going to use the following table throughout this tutorial.
CREATE TABLE fulltext_sample(copy TEXT,FULLTEXT(copy)) TYPE=MyISAM;
The TYPE=MyISAM clause isn’t necessary unless you’ve set the default table type to be something other than MyISAM (perhaps you use InnoDB tables to make use of MySQL’s transactional capabilities). Once you’ve created the table, populate it with some data, as follows:
INSERT INTO fulltext_sample VALUES
(‘It appears good from here’),
(‘The here and the past’),
(‘Why are we hear’),
(‘An all-out alert’),
(‘All you need is love’),
(‘A good alert’);
If you’d already created an existing table, you can add a FULLTEXT index with the ALTER TABLE statement (as well as the CREATE INDEX statement), for example:
Read the rest of this entry »
Sometime it is necessary to find out what file(s) or directories is eating up all disk space. Further it may be necessary to find out it at particular location such as /tmp or /var or /home etc.
There is no simple command available to find out the largest files/directories on a Linux/UNIX/BSD filesystem. However, combination of following three commands (using pipes) you can easily find out list of largest files:
du : Estimate file space usage
sort : Sort lines of text files or given input data
head : Output the first part of files i.e. to display first 10 largest file
Here is what you need to type at shell prompt to find out top 10 largest file/directories is taking up the most space in a /var directory/file system:
# du -a /var | sort -n -r | head -n 10
Output:
1008372 /var
313236 /var/www
253964 /var/log
192544 /var/lib
152628 /var/spool
152508 /var/spool/squid
136524 /var/spool/squid/00
95736 /var/log/mrtg.log
74688 /var/log/squid
62544 /var/cache
If you want more human readable output try:
# du -ks /var | sort -n -r | head -n 10
Where,
-a : Include all files, not just directories (du command)
-h : Human readable format
-n : Numeric sort (sort command)
-r : Reverse the result of comparisons (sort command)
-n 10 : Display 10 largest file. If you want 20 largest file replace 10 with 20. (head command)
Scott Jehl has released jQuery Visualize, the plugin that groks HTML tables and generates lovely charts from it, all from a simple $(‘table’).visualize(); (lot’s of options for you to twiddle too if you want).
First, you create a bog standard table like:
<table border="0"> <caption>2009 Individual Sales by Category</caption> <thead> <tr> <td></td> <th>food</th> <th>auto</th> <th>household</th> <th>furniture</th> <th>kitchen</th> <th>bath</th> </tr> </thead> <tbody> <tr> <th>Mary</th> <td>150</td> <td>160</td> <td>40</td> <td>120</td> <td>30</td> <td>70</td> </tr> <tr> <th>Tom</th> <td>3</td> <td>40</td> <td>30</td> <td>45</td> <td>35</td> <td>49</td> </tr> ...repetitive rows removed for brevity.</tbody></table>
Then you visualize it. You end up with pretty graphs like these:

Jonathan Snook posted good CSS stuff on Text Rotation with CSS that takes a nice bit of markup like this:
<div class="example-date"> <span class="day">31</span> <span class="month">July</span> <span class="year">2009</span> </div>
and converts it to:

all via the CSS:
-webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
yeah as you can see it’s working on IE too. Not bad ha?
I found this website about 2 or years ago. it’s freaking funny xD Here are some picture from the site;
Read the rest of this entry »
I can’t blog much cuz of my works. I’m pretty busy in these days. When i check php.net, i saw PHP 5.3 released post in 30 Jun -.- nevermind. After a long string of delays, PHP 5.3 is finally out. On the course of last 2 years, I was pretty sure a number of times that it will happen next month the latest, but there always were good reasons to postpone it. Now finally it’s officially out. I think it’s a huge step for PHP. Download it and try it!
Some major new features in 5.3:
Read the rest of this entry »
Every time I connect to my home server through my ssh client, I receive the same message and I’m getting bored of seeing it, so I decided to change the message to something else.
Here’s the message that I get every time:
Read the rest of this entry »