WordPress – Weird characters after wordpress upgrade

Posted in category Wordpress

If you see weird characters after upgrading your wordpress version, the reason for that might be wrong character encodings.

1. Easy solution:

- open wp-config.php for edit.
- make sure you have empty values for  define(’DB_CHARSET’, ”); and define(‘DB_COLLATE’, ”);

2. Convert all tables to UTF-8

- follow these steps. not tested yet!

MYSQL – Disabling FULLTEXT Search stopwords

Posted in category Database


To disable MySQL FULLTEXT Search stopwords open the mysql config file and below [mysqld] add the following line:

ft_stopword_file = “”

By setting the ft_stopword_file value to an empty string the usual stopwords won’t be ignored any more.

Here is what the manual says about setting a new stopwords file:

To override the default stopword list, set the ft_stopword_file system variable. (See Section 5.1.4, “Server System Variables”.) The variable value should be the path name of the file containing the stopword list, or the empty string to disable stopword filtering. After changing the value of this variable or the contents of the stopword file, restart the server and rebuild your FULLTEXT indexes.

The stopword list is free-form. That is, you may use any nonalphanumeric character such as newline, space, or comma to separate stopwords. Exceptions are the underscore character (“_”) and a single apostrophe (“’”) which are treated as part of a word. The character set of the stopword list is the server’s default character set; see Section 9.1.3.1, “Server Character Set and Collation”.

MySQL – How to change the FULLTEXT SEARCH 4 character minimum behaviour

Posted in category Database

By default the FULLTEXT minimum characters behaviour is set to 4 characters. To check what value is preset on your server type the following query:

SHOW VARIABLES LIKE ‘ft%’;

That shoud bring up a result similar to this:

Variable_name Value
ft_boolean_syntax + -><()~*:”"&|
ft_max_word_len 84
ft_min_word_len 4
ft_query_expansion_limit 20
ft_stopword_file (built-in)

To change the ftp_min_word_len you have to edit the my.ini configuration file.
Below [mysqld] add this line to decrease the min. word length to 3 characters:

ft_min_word_len = 3

Restart your server and rebuild the existing indexes by using the following query:

REPAIR TABLE tableNameHere QUICK;

PHPList – user_blacklist_data Fatal Error

Posted in category Scripts

While installing PHPList 2.10.10 on my system i got the following error for the table user_blacklist_data:

“Fatal Error: Debugging not configured properly!”

Searching the Internet i found the solution for it by editing the file
/admin/structure.php

Find the query where the user_blacklist_data is created and replace this line:
“email” => array(“varchar(255) not null unique”,”Email”),
with this line:
“email” => array(“varchar(233) not null unique”,”Email”),

Drop the existing tables and restart the database initialisation process.

WGET – FTP Download a directory recursively

Posted in category Unix/Linux

We often need to download a directory from a ftp server to a local computer. You can do this using wget and its -r parameter.  The command would be:

wget -l 30 -r ftp://user:pass@host/some_directory/

-l  sets the level depth. default value is 5 layers. i put 30 to be sure wget gets the whole tree

Eclipse – Exclude / de-exclude from build

Posted in category IDE

Sometimes working with Eclipse can be frustrating. I just spent an hour of my life looking how to include back a file into build that was excluded before (exclude from build).

To spare you that drama, just go to:
Project Preferences -> C/C++ General -> Paths & Symbols ->  Source Location
Click on the folder where the excluded file is sitting in and change its filter.

As a wise man once said, soul-d: “i call these sneaky logical options “

Doxygen

Posted in category C++, Programming

Doxygen is a source code documentation generator tool.
Comment blocks are constructed like this: (JavaDoc style)

/**
*  multiline bloc… some text
*/

/// single ling comment… some text

“some text” can be replaced with various special commands in order to make the generated documentation more user friendly. Doxygen special commans overview.

Read the rest of this entry »

Eclipse / Doxygen – Documentation Generator

Posted in category IDE

Doxygen is a well known source code documentation generator. More information about it is available on their homepage.

For all those of you who prefer Eclipse as your main development platform there is a plugin that provides a high-level graphical user interface integration over Doxygen. More info about Eclox.

C++ static keyword

Posted in category C++, Programming

The static keyword can be used in the following situations.

When you declare a variable or function at file scope (global and/or namespace scope), the static keyword specifies that the variable or function has internal linkage. When you declare a variable, the variable has static duration and the compiler initializes it to 0 unless you specify another value.

When you declare a variable in a function, the static keyword specifies that the variable retains its state between calls to that function.

When you declare a data member in a class declaration, the static keyword specifies that one copy of the member is shared by all instances of the class. A static data member must be defined at file scope. An integral data member that you declare as const static can have an initializer.

When you declare a member function in a class declaration, the static keyword specifies that the function is shared by all instances of the class. A static member function cannot access an instance member because the function does not have an implicit this pointer. To access an instance member, declare the function with a parameter that is an instance pointer or reference.

C++ Generate random numbers in Range

Posted in category C++, Programming

To make use of the rand() command you must include the cstdlib library

#include <cstdlib>

Before we generate a random number we call the srand(int) function to seed the randomizer so we dont get the same random number each time.

#include <ctime>
srand(time(NULL)); // time(NULL) returns seconds since 1.1.1970

To get the random number in range we use:

int number = (rand() % (RangeMax – RangeMin + 1) ) +RangeMin;

rand() returns a number between 0 and RAND_MAX (see libs for definition). Using the modulus operator (rest of division) we can get a number in a specific range. rand() % 10 would produce a number between 0 and 9.