Pages

Search This Blog

Sunday, October 11, 2009

PHP: Warning: split() [function.split]: REG_EMPTY in xxx

I try to php split to split out the concatenated data. Below are the sample that i use

$comp = "V1001|VI003";

$comp_arr = split("|",$comp);

i hit error:

PHP: Warning: split() [function.split]: REG_EMPTY in xxx

after search around and found that the issue is caused by symbol "|".
"|" is an operator in PHP. If want to use the this symbol as a delimiter, we must excape it with a back slash, "\|"

now it become

$comp = "V1001|VI003";

$comp_arr = split("\|",$comp);

and it works.

Hope this help

Wednesday, October 7, 2009

using jquery in Joomla

I'm developing a joomla component for joomla and involve jquery. It will hit error and need to take special care because joomla ship with javascript framework "MooTools" which will have conflict with jquery.

Here is the code that i pun into my view.html.php

$document =& JFactory::getDocument();
$document->addScript(JURI::base(true).'/components/com_xin/js/jquery-1.3.1.min.js');
$document->addScriptDeclaration ( 'jQuery.noConflict();');
$document->addScript(JURI::base(true).'/components/com_xin/js/validation.js');

in the validation.js

I change all the $ to jQuery.

For example i change
$(document) to jQuery(document)
$('#login') to jQuery('#login')
and all others.

Test again and it works. Hope this help.

Friday, October 2, 2009

LoadLibrary ("xxxx.dll") failed - The specified module could not be found

I've created a dll using VC++ and try to register the dll in the machine xp pro using regsvr32. I copy the dll from my development machine to the deployment and hit error message.

LoadLibrary ("xxxx.dll") failed - The specified module could not be found.

What's go wrong?

I already make sure all my dll dependency copied to the machine. Finally i found out that i should compile the dll in debug mode only. I should compile it in release mode.

I'm able to register to the xp machine after i compile in release mode. Hope this help.

odbc: data source name not found

Situation:

The application written in ASP with dll and etc and use ODBC for database connection. Everything working fine but one day there was a auto windows update can cause this ASP application running with error message "data source name not found". Plenty of time taken for debugging and not solved. Finally by trial and error, the problem solved. Strange, the problem is caused by the permission setting on the dll which call the ODBC. We suspect the problem cause by the windows update and change the permission setting.

Hope this help.

Sunday, September 27, 2009

phpsoap: retrieve returned array data

Well, i'm newbie in soap especially phpsoap. I'm facing problem to retrieve data returned from a soap api written in .net. I can see the whole data printed out by using print_r but i'm not able to get the each data from the array returned.

Situation:
I want to get the data returned by the soap server in array form after i've called the function "GetAccountInfo" by passing in parameter "AccoundID" by using phpsoap client.
My soap server url: http://10.10.100.101/soapserver.asmx

below are the code that i can get the data printed out.
<?php
$ini = ini_set("soap.wsdl_cache_enabled","0");

//instantiate the SOAP client
$client = new SoapClient("http://10.10.100.101/soapserver.asmx?WSDL");

$params = array();
$params["AccountID"] = "inblues";

$result = $client->GetAccountInfo($params);
print_r ($result ->GetAccountInfoResult);

?>

Output on the browser:


Array (
[GetAccountInfoResult] => Array (
[memberData] => Array (
[lastlogin] => 6/19/2009 2:10:51 AM
[lastip] => 219.95.192.254
[datecreated] => 6/19/2009 2:10:51 AM
[active] => 1
)
)
)



But what i want is only [active] field's data. What can i do? Finally, by looking at the printed result and by try and error, i found out that it's a 3 dimensional array, below code helps me to get the data i want.

<?php
$ini = ini_set("soap.wsdl_cache_enabled","0");

//instantiate the SOAP client
$client = new SoapClient("http://10.10.100.101/soapserver.asmx?WSDL");

$params = array();
$params["AccountID"] = "inblues";

$result = $client->GetAccountInfo($params);

// the result is in 3 dimensional array
print_r ($result->GetAccountInfoResult->memberData-> active);

?>

Solve. I get my value 1 printed out in the browser.

Friday, September 25, 2009

remove "Google Toolbar" from firefox

Open Mozilla Firefox,
Go to Tools Menu, Click On Add-ons




A new Add-ons windows popup, Select "Google Toolbar for firefox" and click on Unistall button.



Done. Hope this help.

Thursday, September 3, 2009

The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use .. pool

Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool.
This may have occurred because all pooled connections were in use and max pool size was reached.

My web app written is ASP.NET C# and database use MySQL.

To solve it. Close all your connection each time you have finishing your query.

Monday, August 24, 2009

Sys.WebForms.PageRequestManagerServerErrorException: an unknow error occured while processing the request on the server. ..status code returned .. 500

My situation:
Environment: ASP.NET, AJAX.NET and MySQL DB

I got error return when using one of the form written in AJAX.NET when calling MySQL Stored Procedure

Sys.WebForms.PageRequestManagerServerErrorException: an unknow error occured while processing the request on the server. the status code returned from the server was: 500



Well, after check around i found out that the problem is in the MySQL Stored Procedure case sensitive issue. Change the case and problem solved!

Wednesday, August 19, 2009

phpmyadmin and stored procedure

As far as i know, we are not able to view, edit stored procedure using phpmyadmin but we are able to drop/create stored procedure using phpmyadmin.

I try to create a mysql stored procedure using phpmyadmin and hit error below

Error

SQL query:

DELIMITER;

MySQL said:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER' at line 1




my original code:

DELIMITER $$

DROP PROCEDURE IF EXISTS `xxxweb`.`pp_pspbatch` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pp_pspbatch`(
IN pBatchName VARCHAR(255),
IN pCountryID INT
)
BEGIN

xxxxx
xxxxx
xxxxx

END $$
DELIMITER ;

try below steps, it help to solve my problem
1. Go to any SQL tab in phpMyAdmin.
2. Directly below the SQL text area you'll see a text input labeled "Delimiter." In that field, enter "$$".





3. Modify the script become like below

DROP PROCEDURE IF EXISTS `xxxweb`.`pp_pspbatch` $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `pp_pspbatch`(
IN pBatchName VARCHAR(255),
IN pCountryID INT
)
BEGIN

xxxxx
xxxxx
xxxxx

END $$

and run it. It works.

Wednesday, July 22, 2009

SmarterMail not receiving mails but can send out email

Well, set up my smartermail in new windows 2003 server. I've already make sure steps provided in Smartermail help file properly set.

WebMail URL (A Record) - Add an A or CNAME record for mail.example.com that points to the IP address of the webmail interface. This will allow users of that domain to access the webmail by typing in http://mail.example.com or http://mail.example.com:9998 in their web browser (depending on whether you use the included web server or IIS).

Mail Pointer (MX Record) - Add an MX record for example.com that points to the IP address that you assigned when adding the domain to SmarterMail. This will allow other email servers to locate your mail server.

Reverse DNS Record - Add a reverse DNS record for IP addresses assigned on the server to provide extra assurance to other mail servers. Also, it is recommended that the primary IP address of the server also have a reverse DNS record. Note: Adding reverse DNS may also require a change at your isp.


Also already setup iis to able login thru specific domain. Things work fine, able to send out email but not able to received email from external domain that not in the server. Strange, huh?

After check here and there, finally find out that we need to enable port in windows firewall.

Well, open my windows firewall and add in "Exceptions" to the port correctly. For my case, i just enable the port for below port



It's work. Hope can help.