Testlink 1.9 problem with Charts – Error 500

Today I faced problem with Testlink 1.9 – while clicking on Test Results > Charts I’ve got :

PHP Fatal error: require_once() [function.require]: Failed opening required '/var/www/html/testlink/cfg/.cfg.php' (include_path='.:/usr/share/pear:.:/var/www/html/testlink/lib/functions/:/var/www/html/testlink/third_party/') in /var/www/html/testlink/lib/bugtracking/int_bugtracking.php on line 367, referer: http://xxxxxx/testlink/lib/results/resultsNavigator.php

If you have similar edit /var/www/html/testlink/lib/bugtracking/int_bugtracking.php

Line 363: $btsname = strtolower($bts_type);

Dirty, but works

Line

Tags: ,

Converting price from one to another in magento

I found snippet here, but it seems it is broken as second parameter (target currency) is expected to be object

So correct would be


$targetCurrency = Mage::getModel('directory/currency')->load('EUR');
$price = round(Mage::helper('directory')->currencyConvert($priceToConvert, 'GBP', $targetCurrency), 2);

Tags: , ,

Fontis Recaptcha Magento Extension error solved

If you have problem with Fontis Recaptcha Magento Extension like below, read.

Invalid method Fontis_Recaptcha_Block_Review_Form::escapeHtml(Array
(
 [0] => Rating
)
)

Problem is that some of the methods in template are using non existing method. This only happend on product review form page.

edit app/design/frontend/default/default/template/fontis/recaptcha/form.phtml

Replace:

$this->escapeHtml(

with

$this->htmlEscape(

That’s it

Tags: , ,

Prime numbers in PHP – quick and efficient way

Looking for a way to find prime numbers in php? I wfound one perl solution here, but it wasn’t perl magic – it was power of regular expressions.

Please find code below which will be self-explanatory.


<?php

/**
* Function checks if given number is prime
*
* @param integer $n
* @return boolean
*/
function isPrime($n) {
return (!preg_match(‘/^1?$|^(11+?)\1+$/x’, str_repeat(’1′, intval($n)))) ;
}

for ($n=0;$n<100;$n++) {
echo “Number {$n} is “.(isPrime($n) ? ‘prime’ : ‘not prime’).”<br/>\n”;
}

?>

Tags: , ,

Active Directory LDAP Errors in one place

Common Active Directory LDAP bind errors:

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 525, v893
HEX: 0×525 – user not found
DEC: 1317 – ERROR_NO_SUCH_USER (The specified account does not exist.)
NOTE: Returns when username is invalid.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 52e, v893
HEX: 0x52e – invalid credentials
DEC: 1326 – ERROR_LOGON_FAILURE (Logon failure: unknown user name or bad password.)
NOTE: Returns when username is valid but password/credential is invalid. Will prevent most other errors from being displayed as noted.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 530, v893
HEX: 0×530 – not permitted to logon at this time
DEC: 1328 – ERROR_INVALID_LOGON_HOURS (Logon failure: account logon time restriction violation.)
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 531, v893
HEX: 0×531 – not permitted to logon from this workstation
DEC: 1329 – ERROR_INVALID_WORKSTATION (Logon failure: user not allowed to log on to this computer.)
LDAP[userWorkstations: <multivalued list of workstation names>]
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 532, v893
HEX: 0×532 – password expired
DEC: 1330 – ERROR_PASSWORD_EXPIRED (Logon failure: the specified account password has expired.)
LDAP[userAccountControl: <bitmask=0x00800000>] – PASSWORDEXPIRED
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 533, v893
HEX: 0×533 – account disabled
DEC: 1331 – ERROR_ACCOUNT_DISABLED (Logon failure: account currently disabled.)
LDAP[userAccountControl: <bitmask=0x00000002>] – ACCOUNTDISABLE
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 701, v893
HEX: 0×701 – account expired
DEC: 1793 – ERROR_ACCOUNT_EXPIRED (The user’s account has expired.)
LDAP[accountExpires: <value of -1, 0, or extemely large value indicates account will not expire>] – ACCOUNTEXPIRED
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 773, v893
HEX: 0×773 – user must reset password
DEC: 1907 – ERROR_PASSWORD_MUST_CHANGE (The user’s password must be changed before logging on the first time.)
LDAP[pwdLastSet: <value of 0 indicates admin-required password change>] – MUST_CHANGE_PASSWD
NOTE: Returns only when presented with valid username and password/credential.

80090308: LdapErr: DSID-0C09030B, comment: AcceptSecurityContext error, data 775, v893
HEX: 0×775 – account locked out
DEC: 1909 – ERROR_ACCOUNT_LOCKED_OUT (The referenced account is currently locked out and may not be logged on to.)
LDAP[userAccountControl: <bitmask=0x00000010>] – LOCKOUT
NOTE: Returns even if invalid password is presented.

Hope it will save your time

Tags: , ,

MS SQL Server 2008 connection from ZF problem? SOLVED

If you have message like ‘General error: 20018 Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier.’ probably one of your columns is invalid.

In my scenario i had one column nvarchar(max).

Solution to that problem is to build query using CAST f.e.:
‘synopsis’ => new Zend_Db_Expr(‘CAST(synopsis AS nvarchar(4000))’),

Tags: , , , ,

Connection string – solutions

Did you ever struggled to find correct DSN or connection string to your DB Server? Found great solution to all problems http://www.connectionstrings.com

Tags: ,

Use PHP and PDO to connect to MS SQL Server (Zend Framework)

Problems connecting to MS SQL server from Zend Framework?

Message: The mssql driver is not currently installed

Solution is simple

Install pdo_mssql driver: (Ubuntu)

#sudo apt-get install php5-sybase
#sudo /etc/init.d/apache2 restart

On Centos you need to install pdo_dblib (any problems check here)

It will not reflect in phpinfo() page

Trick is to setup connection properly:

$dbAdapter = new Zend_Db_Adapter_Pdo_Mssql(array(
 'host'     =&gt; '192.xxx.xxx.xxx', // parklife
 'username' =&gt; 'xxx',
 'password' =&gt; 'xxx',
 'dbname'   =&gt; 'xxx',
'pdoType'  =&gt;  'dblib' )
 );

Tags: , , ,

PHP & MongoDB Sitting in a Tree: Part 1

Always wanted to try it, nice tutorial here
http://www.dealtaker.com/blog/2010/05/12/php-mongodb-sitting-in-a-tree-part-1/

Tags:

What should a developer know before building a public web site?

“The idea here is that most of us should already know most of what is on this list. But there just might be one or two items you haven’t really looked into before, don’t fully understand, or maybe never even heard of.”

Great article here

Tags: