Jul 06 2010

VBulletin 4: “This seems like a terrible place to put this, but I don’t know where else it should go.”

Category: VBulletinFractalizeR @ 12:26 pm

class_taggablecontent.php of VBulletin 4.0.4 forum engine contains the following code:

//This seems like a terrible place to put this, but I don't know where else it should go.
if ($vbulletin->options['tagmaxlen'] <= 0 OR $vbulletin->options['tagmaxlen'] >= 100)
{
       $vbulletin->options['tagmaxlen'] = 100;
}

Continue reading “VBulletin 4: “This seems like a terrible place to put this, but I don’t know where else it should go.””


Jun 24 2010

VBulletin 4.0.4 PL1 out! “We will rock you!”

Category: UncategorizedFractalizeR @ 10:51 am

VBulletin 4.0.1 PL 1 is now out. I was going to install it but… It does not fix any of the Known issues. ;)   Why? Who knows…


Jun 23 2010

VBulletin 4.0.4: problems continue

Category: UncategorizedFractalizeR @ 4:48 pm

5 days passed since the release of 4.0.4 version. Despite this version contains some critical bugs that break forum functionality, VBulletin team apparently decided NOT to fix them inside 4.0.4 release. Instead they created a thread on the forum in which they are trying to incorporate critical bug fixes. So, customers that were stupid enough (like me) to install this “maintenance release” are left alone with VBulletin Community forum to search for fixes for their bugs.

Damn it, but I don’t understand, why having purchased commercial product, I don’t have any immediate actions on bugfixing, that are easy for me to follow? Why should I search forum, read threads and manually patch forum files? None released updated files in whatever form to assist their busy customers.

My users who use IE reported another bug. Thumbnails stopped showing:

There is no solution to this bug yet (at least I haven’t found it) and my thread on forum is unanswered for several hours already. Thank you, Vbulletin Solutions for your care about customers.

UPDATE 01/07/2010: The cause has been found. In the attachments content-type for all jpeg images should be “image/jpeg”, not “image/jpg”


Jun 20 2010

VBulletin Forum 4.x Bugs: My Cold Anger

Category: Articles,VBulletinFractalizeR @ 8:58 pm

I’ve met VBulletin forum engine several years ago. It was some 3.6.x version. I loved it from the first sight. It’s neat plugin architecture, which allows a user to install plugins without changing any VBulletin file made me happy. A huge plugin repository at www.vbulletin.org made me even more happy because I now could do with my forum EVERYTHING I want. VBulletin 3.x code was so nice and easy to read, that I could site and write everything I wanted, that is absent on vbulletin.org repository. And I wrote some plugins indeed.

My happiness lasted until VBulletin 4.0 was announced. I was surprised by price increase for VBulletin license, but I accepted that and upgraded to Suite license to make use of CMS. I waited for VBulletin 4.0 Gold like hell. On 21 of December 2009 my wish came true. VBulletin 4.0 Gold released.

Continue reading “VBulletin Forum 4.x Bugs: My Cold Anger”


May 20 2010

CentOS: Migrating root (and any other) filesystem from ext3 to ext4

Category: Articles,Linux administrationFractalizeR @ 4:52 pm

With the release of CentOS 5.5 ext4 is considered stable in this distribution so I decided to migrate to it. Luckily I started from migrating fresh server with CentOS 5.5 using some instruction I found on the internet. I think I shouldn’t say, that I screwed the whole thing up ;) After about 6 hours cursing, kicking, and crying I solved the task and figured the correct sequence of actions. The small problem with migrating root partition is that you can’t unmount it BTW.

Continue reading “CentOS: Migrating root (and any other) filesystem from ext3 to ext4″


May 07 2010

Increasing RAID resync/rebuild speed

Category: UncategorizedFractalizeR @ 6:33 pm

Recently I assembled a server with several 2Tb disks in Linux RAID. RAID resync reported by cat /proc/mdstat showed that resync will take about 9 hours! More than my working day! I started to look for a way to increase resync speed.

Continue reading “Increasing RAID resync/rebuild speed”


May 03 2010

WordPress: undocumented “no_texturize_shortcodes” filter

Category: Articles,WordPressFractalizeR @ 7:05 pm

Modifying my WP-SynHighlight addon for WordPress I came across a problem, that WordPress rewrites symbols inside my codesyntax shortcode with their nicer Unicode equivalents. I patched code against some. Then against some more. And then some more… And at last I felt tired of patching my code. Suddenly, I came across no_texturize_shortcodes filter, documentation for which at the time of written was published nowhere.

Continue reading “WordPress: undocumented “no_texturize_shortcodes” filter”


May 03 2010

FractalizeR: VBulletin 4 extensive optimization guide

Category: Articles,VBulletinFractalizeR @ 6:25 pm

Preface

Actually, I never bothered to optimize my server for VBulletin, because the server we purchased for forum is really powerful. But once upon a time logwatch told me, that smartd told her, that he found several relocated sectors on one of server HDDs. And then instantly I realized, that many time ago when I assembled that server, I configured HDDs to be in RAID-0 (striped mode)… Oh…. When you will make some stupid thing on your server, please keep in mind, that there are some people that can do things even more stupid…. Nothing critical happened, because I, actually, have all database backups. Database snapshots are made on server using this script of mine every hour or so (BTW, database backup on my server of 1.12Gb database (reported at admincp) takes around a minute to complete together with compression).

So, we had to visit datacenter and remove/replace HDDs. To allow our forum users to continue using forum until we fix that, we moved our forum to a new server. After forum move, I upgraded it to v4 to benefit from friendly URLs. And there it started. Server load almost immediately reached 4.0 (server had two dualcore CPUs, so this is almost 100% of standard load) and those were even not peak hours. Of course, that was not because of V4 (I turned off both that huge CMS issuing ~200 queries on home page and blogs). This was because that new server where the forum was moved to was less powerful. Of course, 4.0 is not a heavy load for server (once one of my servers reached around 100.0 and still I was able to login by SSH :) ).

But nevertheless, that was the moment, where optimization hysteria first visited my head.

Continue reading “FractalizeR: VBulletin 4 extensive optimization guide”


Feb 10 2010

A list of all Unicode space symbols

Category: UncategorizedFractalizeR @ 1:42 pm
U+0020 SPACE
UTF-8: 20   UTF-16BE: 0020   Decimal: &#32;
Category: Zs (Separator, Space)
Bidi: WS (Whitespace)

U+00A0 NO-BREAK SPACE 
UTF-8: c2 a0   UTF-16BE: 00a0   Decimal: &#160;
Category: Zs (Separator, Space)
Bidi: CS (Common Number Separator)
Decomposition: <noBreak> 0020

 Continue reading "A list of all Unicode space symbols"


Feb 02 2010

Plesk 9: Adding a subdomain pointing to custom folder (for example, inside webroot)

Category: UncategorizedFractalizeR @ 4:31 pm

Usually, I work with CPanel. But some time ago my friend asked me to move his website to a server with Plesk installed by default. Website required domain sub.domain.com to point to a folder inside main site webroot. I surprizingly found, that with Plesk 9 it is impossible (it was ok with old versions where Plesk allowed to choose subdomain destination folder). I had to find a way to overcome that.

Continue reading “Plesk 9: Adding a subdomain pointing to custom folder (for example, inside webroot)”


Jan 09 2010

[Linux] “network unreachable resolving XXXX” messages in system log

Category: Articles,Linux administrationFractalizeR @ 3:10 pm

Some time ago I noticed many messages in log file about named attempt to resolve strange addresses.

Continue reading “[Linux] “network unreachable resolving XXXX” messages in system log”

Tags: ,


Jan 06 2010

Free opensource Symfony-friendly IDE: NetBeans 6.8

Category: Articles,PHPFractalizeR @ 8:03 pm

My search for a good PHP IDE never stops ;) My choice was Zend Studio until recently. But Zend Studio is not free and it’s free analogue – PDT – lacks some features like refactoring (PDT is also mainly developed by Zend, so, I think, Zend will always keep it low to prevent competition with Zend Studio). Also, it is monstrous (More than 300Mb installer) and it definitely lacks good Symfony support.

Recently I came across NetBeans, which is now free and developed by Sun. Sun seem to abandon all own IDE projects in favour of NetBeans, so this is a somehow strong foundation.

Oh… 25Mb installer only for PHP version ;) And… it is easy to use. Very. I would like to guide you through the creation of new symfony project in NetBeans.

Continue reading “Free opensource Symfony-friendly IDE: NetBeans 6.8″

Tags: , ,


Jan 06 2010

[JavaScript] EditArea: Realtime Syntax Highlighting JavaScript Library

Category: Articles,JavaScriptFractalizeR @ 3:19 pm

Recently, improving my WordPress plugin WP-SynHighlight, I chose EditArea as a source code editor with realtime syntax highlighting. The syntax of language description files for highlighting of EditArea is pretty much the same as Geshi has. So, I wrote a small converter and executed it over all Geshi files for 1.0.x version.

I have posted a patch for EditArea with all generated files.

So, now you can have EditArea with almost all power of supporting more than 130 languages ;)

Tags: , ,


Jan 06 2010

[JavaScript] PHP PCRE_DOT_ALL option emulation in JavaScript

Category: Articles,JavaScriptFractalizeR @ 2:06 pm

Writting my WP-SynHighlight WordPress plugin, I came to a need of parsing multilined shortcode like this:

[ codesyntax option1="optionvalue1"...] <many lines here….> [ / codesyntax]

So, I extracted regular expression to parse shortcode from WordPress source code (if you are interested in it, see /wp-includes/shortcodes.php file). This regex was executed with /s option (PCRE_DOT_ALL) which makes dot (“.”) to match newlines also. There is no such option in JavaScript for some reason and I had to replace dot by such character class:

[\S\s]

Actually, any opposite metacharacters should work. [\W\w] for example.

Quite easy, isn’t it? :)

Tags: , ,


Jan 04 2010

[Linux, PHP] PHP script to backup all databases

Category: Articles,Linux administration,PHPFractalizeR @ 1:20 am

Hello.

I’d like to share my script, which I use on some production servers for quick database backup using mysql tools. People say, that I should use bash for that, but I prefer PHP :)

Script uses mysqldump for dumping databases and gzip for compressing backups. rm is run to ensure backups are not stored for too long.

Continue reading “[Linux, PHP] PHP script to backup all databases”

Tags: , , ,


Dec 27 2009

WARNING: mismatch_cnt is not 0 on /dev/md0

Category: Articles,Linux administrationFractalizeR @ 12:37 pm

I’ve gotten cron log from one of my servers today which says:

/etc/cron.weekly/99-raid-check:
 WARNING: mismatch_cnt is not 0 on /dev/md0

That worried me a little and I decided to investigate.

Continue reading “WARNING: mismatch_cnt is not 0 on /dev/md0″

Tags: , , , ,


Dec 20 2009

Script for securing server with IPTables

Category: Articles,Linux administrationFractalizeR @ 7:31 pm

Hello.

Here is a script, which I use on my production servers to secure them a bit. I hope it will be useful to you. Script logs all dropped packets so that you can easily find out tye clutch should there be any. Additional FTP server setup will be necessary. For ProFTPD add the following line to /etc/proftpd.conf:

PassivePorts 65400 65534

Continue reading “Script for securing server with IPTables”

Tags: , , ,


Sep 08 2009

Zend Studio 7 nightmares…

Category: PHP Software Flash-ins,Software flash-insFractalizeR @ 4:25 pm

Recently I’ve downloaded Zend Studio 7 Final to try new features they promised for PHP 5.3. OMG.It seems I caught early alpha, not final by accident…

  • CodeAssist doesn’t show completion variants for variables
  • PHPUnit always tries to generate test files near testing .php file (but it seems, it’s a general behavior which I don’t like)
  • PHPUnit cannot handle namespaced classes! This is the code it generated for one of my classes:
<?php
 
require_once 'System\Core\Autoload\StructuredAutoloader.php';
 
require_once 'PHPUnit\Framework\TestCase.php';
 
/**
 * Core\Autoload test case.
 */
class AutoloadTest extends PHPUnit_Framework_TestCase
{
 
 /**
 * @var Core\Autoload
 */
 private $Core
\Autoload;
 
 /**
 * Prepares the environment before running a test.
 */
 protected function setUp()
 {
 parent::setUp();
 
 // TODO Auto-generated AutoloadTest::setUp()
 
 $this->Core\Autoload = new Core\Autoload(/* parameters */);
 
 }
 
 /**
 * Cleans up the environment after running a test.
 */
 protected function tearDown()
 {
 // TODO Auto-generated AutoloadTest::tearDown()
 
 $this->Core\Autoload = null;
 
 parent::tearDown();
 }
 
 /**
 * Constructs the test case.
 */
 public function __construct()
 {
 // TODO Auto-generated constructor
 }
 
}

I am publishing it as-is. The whole code is broken as if Zend Studio doesn’t know about 5.3 namespacing at all! My god… And this is a final release… No, better I will go PDT… Why paying money for non-working things?

  • After saving a file it sometimes drops “An error has occurred. See error log for more details. Widget is disposed” message.
  • Analyzer hung on analyzing Smarty.php class file from 2.6.x.
<?php

require_once ‘System\Core\Autoload\StructuredAutoloader.php’;

require_once ‘PHPUnit\Framework\TestCase.php’;

/**
* Core\Autoload test case.
*/
class AutoloadTest extends PHPUnit_Framework_TestCase
{

/**
* @var Core\Autoload
*/
private $Core
\Autoload;

/**
* Prepares the environment before running a test.
*/
protected function setUp()
{
parent::setUp();

// TODO Auto-generated AutoloadTest::setUp()

$this->Core\Autoload = new Core\Autoload(/* parameters */);

}

/**
* Cleans up the environment after running a test.
*/
protected function tearDown()
{
// TODO Auto-generated AutoloadTest::tearDown()

$this->Core\Autoload = null;

parent::tearDown();
}

/**
* Constructs the test case.
*/
public function __construct()
{
// TODO Auto-generated constructor
}

}

Tags: , , ,


Jul 03 2009

PHP Array of ISO 639-1 language codes => names.

Category: Code snippets,PHPFractalizeR @ 4:43 pm

Hello. For purposes of writting scripts for converting data formats, I have constructed an array, that can be used to replace language codes by their names.

Continue reading “PHP Array of ISO 639-1 language codes => names.”

Tags: , , , ,


Jul 01 2009

[Linux, FreeBSD] Small Anti-DDOS Shell Script for FreeBSD

Category: Articles,Linux administrationFractalizeR @ 3:21 pm

Struggling with DDoS on my friend’s site, I wrote small Anti-DDoS script, that in original just lists all IPs, that have more than X active connections open to your server. It was originally written for FreeBSD.

#!/bin/sh
# Set here a minimum number of connections for action to be executed (150 by default).
FR_MIN_CONN=150
TMP_PREFIX='/tmp/frrr'
TMP_FILE=`mktemp $TMP_PREFIX.XXXXXXXX`
netstat -ntu -f inet| awk '{if(NR>2 && NF=6) print $5}' | cut -d. -f1-4 | grep '^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' | sort | uniq -c | sort -nr > $TMP_FILE
while read line; do
 CURR_LINE_CONN=$(echo $line | cut -d" " -f1)
 CURR_LINE_IP=$(echo $line | cut -d" " -f2)
 if [ $CURR_LINE_CONN -lt $FR_MIN_CONN ]; then
 break
 fi
 
 # You can insert your own logic here (e.g. ban with your favourite firewall). Now it just prints the IP to console.
 echo $CURR_LINE_IP
done < $TMP_FILE
rm -f $TMP_PREFIX.*

I think this will work on general Linux also. You just need to change “cut -d.” to “cut -d:” in the listing and, probably, “/bin/sh” to “/bin/bash”.

Tags: , ,


Next Page »