How to use Invision’s BBCode

Using Invision’s BBCode isn’t straight forward. Chances are that you need to invoke the BBCode parser if you want to create a plugin or hook for Invision Powered Board. Here’s the rough code to do so, with $topics being the array containing all the topics from the database to be parsed:

[code lang=”php”]setAllowHtml( 1 );
//—————————————–
// Return the data
//—————————————–
foreach ($topics as &$topic) {
$topic[“formattedPost”] = $editor->process($topic[“post”]);
IPSText::getTextClass(“bbcode”)->parsing_section = “topics”;
IPSText::getTextClass(“bbcode”)->parse_smilies = TRUE;
IPSText::getTextClass(“bbcode”)->parse_bbcode = TRUE;
IPSText::getTextClass(“bbcode”)->parse_html = FALSE;
IPSText::getTextClass(“bbcode”)->parse_nl2br = TRUE;
IPSText::getTextClass(“bbcode”)->bypass_badwords = FALSE;
$topic[“formattedPost”] = IPSText::getTextClass(“bbcode”)->preDisplayParse( $topic[“formattedPost”] );
}
?>[/code]

For the parsing_section, you should put a value that corresponds to the editor section. In my case, I need it to ‘topics’. To get the full list, you may need to look up Invision Powered Board’s source code which I cannot provide.

I wrote this down more as a personal note and I hope it benefits you as it did for me. If you have any questions, feel free to post and I can attempt answering.

Reading on Amazon Kindle

I can’t recommend Amazon Kindle enough if you’re an avid reader. I got mine delivered over from the US to Singapore through a proxy courier. I think I used comGateway.

Since then I bought numerous books from the US shop without trouble, it all get delivered to my Kindle. I haven’t encountered phone verification of any sort.

The question I get most from people is what is it that don’t work in Singapore. Well, the 3G internet on the Kindle can only access Wikipedia and Amazon websites unfortunately. Other than that everything works fine.

I have been using Kindle for Mac more often lately:

Kindle for Mac.

It’s a lot easier to search through the annotations in the desktop application.

How to install PHP GeoIP in Ubuntu

This instructions will install GeoIP over Ubuntu. It is tested over Ubuntu 12.04 LTS.

I assume you already have PEAR/PECL available. I am using the CentOS’s stock PHP. First you need to update your channels:

Continue reading “How to install PHP GeoIP in Ubuntu”

How to automate GeoIP updates on Linux

This works for Ubuntu, Debian and CentOS distributions. You need a valid license key from MaxMind. This is available as a subscription at a nominal fee.

If you have installed GeoIP successfully, you should have the geoipupdate program. If you don’t, you need the run the following.

Install over Ubuntu or Debian:

[code lang=”bash”]sudo apt-get install geoip-bin geoip-database libgeoip-dev[/code]

Install over CentOS:

[code lang=”bash”]sudo yum install re2c geoip geoip-data geoip-devel[/code]

Both libgeoip-dev and geoip-devel are required for compiling PHP’s GeoIP.

Once you run geoipupdate the first time, it tells you about a missing GeoIP file.

[code lang=”bash”]root@gladlycode:~# geoipupdate
Error opening GeoIP Configuration file /etc/GeoIP.conf[/code]

Now you copy over from the default file:

[code lang=”bash”]mv /etc/GeoIP.conf.default /etc/GeoIP.conf[/code]

If you now run geoipupdate, you get the following:

MD5 Digest of installed database is f5c2f7eed9331dcaa99b7a6b4633b684
Invalid UserID

Continue reading “How to automate GeoIP updates on Linux”

How to install APC in Ubuntu 12.04

This installation is through PEAR. You can install it in other methods too. This has installed APC 3.1.9 for me over Ubuntu 12.04 LTS.

[code lang=”bash”]sudo apt-get install build-essential libpcre3-dev php5-dev
sudo pear update-channels
sudo pecl install apc[/code]

Continue reading “How to install APC in Ubuntu 12.04”

More coding

I realized a devoid of code examples lately. I was distracted by a lot of reading lately. Reading doesn’t translate to doing something significant yet still gives me a certain sense of accomplishment. I just spent an overwhelming amount of time last week just clicking and reading through — researching as I like to call it. I achieve some additional knowledge, I guess. However, time could possibly be put into better use had I actually coded something.

So, note to self — do, don’t just read.

Oh, and write, too.

Narcissism on the rise

Pertaining to American books:

Books Increasingly Show It’s All About Me

Researchers who have scanned books published over the past 50 years report an increasing use of words and phrases that reflect an ethos of self-absorption and self-satisfaction.

“Language in American books has become increasingly focused on the self and uniqueness in the decades since 1960,” a research team led by San Diego State University psychologist Jean Twenge writes in the online journal PLoS One.

Their results are consistent with those of a 2011 study which found that lyrics of best-selling pop songs have grown increasingly narcissistic since 1980. Twenge’s study encompasses a longer period of time—1960 through 2008—and a much larger set of data.

Interestingly, among the 20 individualistic words the researchers searched for, those that experienced the largest increase in usage were “identity,” “personalized,” “self,” “standout” and “unique.”

What’s more, they point out that throughout the time period they studied, “communal words and phrases were more commonly used than the individualistic words and phrases.” So there’s some evidence that our culture hasn’t turned completely narcissistic—yet.

Source: Psmag

And in Facebook, I encounter a culture of anti-sharing. I witness people copying and pasting links again instead of clicking on the Share button so as to not attribute to, perhaps, the lesser source. I guess they just want to be known as having discovered something themselves.

By the way, I use a lot of ‘I’ in my posts. You may think it is a sign of narcissism, but really, it’s just loneliness.