Optimize wordpress DB

Having experience that your blog is slowing down while network connection is in normal state? Well, that could be caused by several factor. It could be caused by network slowing down on your blog server, or you’re accessing your blog in the peak time. If what I stated above is not the problem, maybe you want to check your database. Because it happen every time that after a few month, we usually receive much spam. Take this blog as an example, for the past 15 days, I have received around 1670 spam. Continue reading “Optimize wordpress DB”

Share

Create Updatable Scroller Text

This tutorial came from a project of mine. At that time, someone ask me to create a scrolling text that updated when the data is modified. After look into the problem I found that this problem can be done using simple ajax and php script. This tutorial will show you how I completed this task.
Continue reading “Create Updatable Scroller Text”

Share

Creating Random Password in JAVA

Sometime, we need to create a random string for some purposes. Well, I do need this random string for a project of my friend. So, how do I create this random string? The idea is simple, I just need to create this random string from MD5 hashes that came from current time and multiply it by random integer and multiply again by some integer.

MD5 md5 = new MD5();
Date date = new Date();
long seed = date.getTime();
seed = seed * (1 + (int)(Math.random() * 5000));
md5.Update(String.valueOf(seed));
hash = md5.asHex().toUpperCase();
int startIndex = 1 + (int)(Math.random() * 50);
if(((startIndex + passwordLength) - 1) > hash.length()){
startIndex = hash.length() - passwordLength;
}
returnValue = hash.substring(startIndex - 1, (startIndex - 1) + passwordLength);

As For the MD5, I use a library from FastMD5. And this is my code. Well, it’s a non optimized code. But, you should get the point.
Continue reading “Creating Random Password in JAVA”

Share