osCommerce 2.2 RC2 Windows (Win32) and mail 501 5.5.4 Invalid Address

PHP contains bug in the Win32 code which prevents most php to work corrently with sending emails.

The overall idea of solution (workaround) is to do not use NAME with EMAILS. So both TO and FROM fields must be in form “TO: john@localhost.org” or “FROM: john@localhost.org” but not “TO: “John Doe” <john@localhost.org>”

I recently encountered this problem with osCommerce.

Solution to overcome this:

  1. I added define to both includes\configure.php and admin\includes\configure.phpdefine(‘WIN32′, true);

  2. Then in includes\classes\emails.php and admin\includes\classes\email.php in “send” function find this lines:$to = (($to_name != ”) ? ‘”‘ . $to_name . ‘” <’ . $to_addr . ‘>’ : $to_addr);
    $from = (($from_name != ”) ? ‘”‘ . $from_name . ‘” <’ . $from_addr . ‘>’ : $from_addr);

    and place following code BELOW them:

    //WIN32 FIX
    if (WIN32) {
    $from = $from_addr;
    $to = $to_addr;
    }

That’s all, and now I can test email sending on my local win maching. Good luck!

Add comment October 1, 2008

Crystal Reports for Visual Studio 2003 and text cut/truncation in fields

Here is a problem: Crystal Reports for VS2003 by default truncates fields using word truncation strategy so if field has text “ABCD EFGHI” and only “ABCD EF” fits then “ABCD” will be displayed. Also we don’t need wrapping to next line.

So the solution is: replace common spaces with non-breakable ones.

string s = ”ABCD EFGHI”;

string result = s.Replace(” “, (char) 0×00A0);

Add comment June 23, 2008

App_Data, App_Code and other App_* folder protection magic

Today I was asked question how ASP.NET protects this folders’ content from external access. ASP.NET does a little magic there with ISAPI filter aspnet_filter.dll, which you can see on IIS Manager\{Your PC Name}\Web Sites\ISAPI Filters tab.

WebDev.WebServer check this internally in WebDev.WebHost.dll

List of protected dirs: “/bin”, “/app_browsers”, “/app_code”, “/app_data”, “/app_localresources”, “/app_globalresources”, “/app_webreferences”.

1 comment April 2, 2008

CentOS 5, PHP, GD2 library

By default CentOS 5 comes without GD2 library for PHP

There is an easy fix for this with “yumagic” :)

Open terminal and run:

yum install php-gd

2 comments January 22, 2008

Internet Explorer (IE) ignores white-space: nowrap on table’s TD

Used gridview today and client wanted content in tables to be displayed without any wrapping. First solution of course just set up:

<table><tr><td style=”white-space: nowrap”>qwe-asd</td></tr></table>

And of course it works fine both in Opera and FireFox but not in IE7 (have not tested under IE6). The picture changes of course but some cells are still wrapping.

Workaround is to use template field with span:

<table><tr><td><span style=”white-space: nowrap”>qwe-asd</span></td></tr></table>

24 comments January 15, 2008

Code Coverage with TestDriven.Net in Visual Studio 2003

In VS2003 you can’t add your .exe to project reference of separate test assembly. So it is well known practice to copy it to some folder, rename to .dll and reference it from there. (Note: VS2005 allows you to reference .exe)

After performing such steps when you run Coverage from TestDriven.Net context menu, you can notice that there is coverage only for the test assembly.

Solution: Many chances you didn’t copy .pdb file for the .exe, but NCover can only profile assemblies which have .pdb files for them

Add comment October 30, 2007

Html attributes, single quote and HtmlAttributeEncode

When you develop your own custom controls do not forget that HtmlAttributeEncode method DOES NOT encode single quote.

MSDN says:

The string result from the HtmlAttributeEncode method should be used only for double-quoted attributes. Security issues might arise when using the HtmlAttributeEncode method with single-quoted attributes.

So you should use double quotes

Add comment September 11, 2007

New Lightweight Dependency Injection Framework for .NET – Ninject

Ninject (earlier known as Titan) is a Lightweight Dependency Injection Framework for .NET inspired by Google’s Guice.

From what I can read it from the docs it is really nice for small projects and allows you to live without creating large xml files for configuration and it also uses .NET 2.0+ DynamicMethods to improve object creation speed.

I am going to give it a shot!

1 comment September 5, 2007

Little-known C# 2.0 operator – ??

Excerpt from the msdn:

The ?? operator returns the left-hand operand if it is not null, or else it returns the right operand.

Example:

string s = null;
int? i = null;
Console.WriteLine(s ?? "(null)");
Console.WriteLine(i ?? -1);

Will produce:

(null)
-1

2 comments August 21, 2007

Links For Continuous Learners

Today I’ve spotted nice Steve Pietrek’s blog where he puts links to miscellaneous articles about .Net and related technologies

http://spietrek.blogspot.com/

Add comment August 20, 2007

Previous Posts


Categories

  • .net

  • Feeds