Posted by: dcsaha | August 29, 2011

How to Batch Delete Post Revisions of an WordPress Blog

Execute the following SQL command:

DELETE FROM wp_posts WHERE post_type = "revision";

for detail: http://www.wprecipes.com/how-to-batch-deleting-post-revisions

Posted by: dcsaha | August 27, 2011

Top 10 MySQL Mistakes Made By PHP

Building a solid, dependable database takes time and expertise. Here are ten of the worst MySQL mistakes:

  1. Using MyISAM rather than InnoDB
  2. Using PHP’s mysql functions
  3. Not sanitizing user input
  4. Not using UTF-8
  5. Favoring PHP over SQL
  6. Not optimizing your queries
  7. Using the wrong data types
  8. Using * in SELECT queries
  9. Under- or over-indexing
  10. Forgetting to back up
  11. Bonus mistake: not considering other databases!

Read details here:
http://www.sitepoint.com/mysql-mistakes-php-developers/

While importing data from a script file please make sure you open the script file as “SQL Script File UTF-8 (*.sql)”. From MySQL query browser, you can select this option on the “Open Script File” dialog. The dialog pops up when you select File > Open Script… option.

By default PHPLinkDirectory does not display unicode utf-8 coded characters. You need to change the init.php file at the root of your phpld directoy.

Edit init.php in both home directory of your phpld installation and the admin directory.

Change:
// $setCharset = $db->Execute (“SET NAMES ‘utf8′”);
// $setCharset = $db->Execute (“SET CHARACTER SET utf8″);

to:
$setCharset = $db->Execute (“SET NAMES ‘utf8′”);
$setCharset = $db->Execute (“SET CHARACTER SET utf8″);

For more detail: http://www.karolos.com/unicode-utf-8-characters-problem-solved-in-phpld/

MS Access exported query expressions usually get truncated at 255
Characters. Instead of exporting the query result directly, insert the
query result into “a table with Memo field”. Then export “the table with
memo field”. The solution detail can be found here: http://support.microsoft.com/kb/178743

Posted by: dcsaha | June 3, 2011

Java String Comparison

To compare Strings for equality, don’t use ==. The == operator checks to see if two objects are exactly the same object. Two strings may be different objects, but have the same value (have exactly the same characters in them). Use the .equals() method to compare strings for equality. Similarly, use the .compareTo() method to test for unequal comparisons. For example,

    String s = "<i>something</i>", t = "<i>maybe something else</i>";
    if (s == t)      // Legal, but usually WRONG.
    if (s.equals(t)) // RIGHT
    if (s > t)    // ILLEGAL
    if (s.compareTo(t) > 0) // CORRECT>

(Courtesy: http://www.leepoint.net/notes-java/data/strings/12stringcomparison.html)

There are many Twitter application that makes life easier for regular twitter users. One of the breeds of such application is having auto-tweeting capabilities. However, auto tweeting has its own disadvantage if not done carefully. This particular Twitter application for composing and scheduling tweets, which is in it’s beta now, looks like very promising in this regard.

From the description of the applications scope: “In fact Tweetinger’s built-in ability to filter spam like behaviors will catch and kill posts before twitter can see it. Ability to spin and twist your tweets will ensure that your posts are fresh and natural. This is very important. Tweetinger will ensure this very thing that your tweets are spontaneous and not a mechanical output“. Let’s see how it turns out.

This is an example using java.text.DecimalFormat class to add leading zeros to a number. The method shown is available before Java 1.5

import java.text.DecimalFormat;
import java.text.NumberFormat;
public class NumberFormatLeadingZerosExample {
    public static void main(String[] args) {
    NumberFormat formatter = new DecimalFormat("0000000");
    String number = formatter.format(2500);
    System.out.println("Number with lading zeros: " + number);
    }
}


The following example shows you how to use the String.format() method to add zero padding to a number. If you just want to print out the result you can use System.out.format(). This method is available since Java 1.5, so If you use a previous version you can use the NumberFormat class shown above.

public class LeadingZerosExample {
public static void main(String[] args) {
    int number = 1500;
    //
    // String format below will add leading zeros (the %0 syntax)
    // to the number above. The length of the formatted string will
    // be 7 characters.
    //
    String formatted = String.format("%07d", number);
    System.out.println("Number with leading zeros: " + formatted);
    }
}

Courtesy: http://www.kodejava.org/examples/174.html

Posted by: dcsaha | April 30, 2011

Howto Copy and Paste between Local and Remote Desktop

This HowTo covers how to copy and paste the files/text/graphics (Clipboard) content between remote desktop session and local computer in Windows XP.

Follow the following instruction in both local and remote computers.

Go to Start->Control Panel->Administrative Tools->Services. Enable and start the following services in the order shown below:

1. Network DDE DSDM 2. Network DDE 3. ClipBook

If you want to see the clipboard action in live:

You can go to Start->Run and type clipbrd and click OK to run clip board viewer. You will be shown current clipboard objects in this viewer.

Now you can use standard copy/paste menu options of the applications in both the computers to exchange the data.

Courtesy: http://cutecomputer.wordpress.com/2007/01/03/howto-copy-paste-between-local-and-remote-desktop/

Posted by: dcsaha | March 17, 2011

Zoundry Raven to Go

Downloaded “Zoundry Raven” again. Testing now. Looks like very useful. I think this utility will help me blog frequently as it can be launched from my USB drive also. I can post to any of my multiple blogs from this single utility. Indeed, I can keep all my blogs in my pocket and post a couple of lines to any one of those whenever I am in the mood.

(This post is made from “Zoundry Raven to Go”)

PS: As you can see, now I am editing this alreday published blog – from Zoundry Raven and without logging on to my blog web site admin panel.

Older Posts »

Categories

Follow

Get every new post delivered to your Inbox.