Archive for June, 2009

First taste of bbpress – was sweet but getting sour

June 25th, 2009 No comments

Hey hey.. when we had to implement a bulletin board for an institution, the first thought was for phpbb, but the time limitation as well as lack of resources to hack through a completely new code took the turn and prompted us to take a new course. The bb press way. Atleast it was the same language written and used in the same way we were handling for more than a year. Well _ck_ should be thanked for all the goodies. And when we find bugs or errors, we all should help each other to make the system more better.

When I was using the bbPress Attachments, trying to delete a post, even by admin or moderator, would confront with an SQL error. The same error was reported by Joseph, for which _ck_ responded with downloading a new version from the trunk. For me even after the new version came in, I was getting the error. Read more…

Categories: Uncategorized Tags:

MySQL UDF – the first taste

June 21st, 2009 No comments

Recently for Saturn SPL, as part of a prototype discussion, I was considering a fam based trigger for a process queue. We were already familiar with queueing processes in a mysql table, with auto_increment primary key, this should not be a problem. But when the number of processes increase, the table size too increases and finally we will be forced to remove those already processed. Also more than this, we wanted the table to me as compact as possible, meanwhile should be as accurate as possible. MySQL could not (AFAIK) stamp rows with mico seconds.
Read more…

Categories: Code Snippets Tags:

Invoke shell from MySQL trigger

June 20th, 2009 7 comments

No I am not insane, and after a long days search over the wide Internet, even google admitted defeat, there seemed to be no way to do this. Finally I had already dropped the idea or even let off the thing altogether. But recently for another project I needed to check in for an entirely different requirement and stumbled on the fact. And yes I checked it, voila the shell invoke from mysql trigger is possible.
Read more…

String encryption with password

June 10th, 2009 No comments

While searching for some thing, I found a string encryption code sample for Visual Basic, and I just wanted the same in php, and did a port. Just like what F. Balena has done over there, this function is also used for both, encrypt as well as decrypt.

function stringEncrypt($str$pass){
$strlen strlen($str);
$passIndex 0;
$passLen strlen($pass);
// null passwords wont encode
if(strlen($pass) == 0
    for (
$i 0$i $strlen$i++){
// get the next char in the password
$passChr ord($pass[($i $passLen)]);
// encrypt one character in the string
$str[$i] = chr(ord($str[$i]) ^ $passChr);
// modify the character in the password (avoid overflow)
$pass[($i $passLen)] = chr(($passChr 17) & 255);

Categories: Code Snippets Tags: