Quantcast
Channel: West Wind Message Board Messages
Viewing all 10393 articles
Browse latest View live

Am I using ExpandTemplate correctly?

$
0
0
Am I using ExpandTemplate correctly?
Web Connection 5.0
Am I using ExpandTemplate correctly?
Dec. 17, 2013
09:10 am
3YA0JNVYVShow this entire thread in new window
Gratar Image based on email address
From:Michael Hogan (Ideate Hosting)
To:All
I'm trying to grab the result of ExpandTemplate as a string so I can plop it into an email message, but when I do:

Response.Expandtemplate(lcTemplate,"text/html",.F.,.T.)

I get an empty string returned. I notice the last parameter is no longer documented so I am wondering if that has been disabled.

TIA

Michael
www.WebConnectionHosting.com


Re: Am I using ExpandTemplate correctly?

$
0
0
Re: Am I using ExpandTemplate correctly?
Web Connection 5.0
Re: Am I using ExpandTemplate correctly?
Dec. 17, 2013
12:40 pm
3YA0R6BD6Show this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:
Hi Michael,

The string output option has been removed a few years ago with the wwPageResponse class. Returning the string caused a bit of overhead for write operations so that feature has been removed.

You have a few options.

If all you want is the output from ExpandTemplate you can call ExpandTemplate and then look at Response.cOutput as that's where output gets generated:

Response.ExpandTemplate(lcPhysicalPath) lcHtml = Response.cOutput

Or you can take the more explicit route which is to just use MergeText directly:

loEval = CREATEOBJECT([WWC_wwEval]) lcHtml = loEval.MergeText(File2Var(lcPhysicalPath))

I would opt for the latter as it's more explicit and you don't have to know about the innards of WWC.

+++ Rick ---



I'm trying to grab the result of ExpandTemplate as a string so I can plop it into an email message, but when I do:

Response.Expandtemplate(lcTemplate,"text/html",.F.,.T.)

I get an empty string returned. I notice the last parameter is no longer documented so I am wondering if that has been disabled.

TIA



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

UTF-8 Encoding

$
0
0
UTF-8 Encoding
Web Connection
UTF-8 Encoding
Dec. 17, 2013
01:48 pm
3YA0TL9XYShow this entire thread in new window
Gratar Image based on email address
From:Albert Gostick
To:All
Hi all,

Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.

I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").

To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):

lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"

So I then sent it through STRCONV() to try to get it encoded properly:

lcURL = STRCONV(lcURL,9)

What I get is this - the accented character gets converted to 2 characters:

http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580

So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?

Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.

Thanks.

Expandtemplate expanding twice?

$
0
0
Expandtemplate expanding twice?
Web Connection 5.0
Expandtemplate expanding twice?
Dec. 17, 2013
02:31 pm
3YA0V4Z2CShow this entire thread in new window
Gratar Image based on email address
From:Michael Hogan (Ideate Hosting)
To:All
Uhm... I'm wrapping my head around this issue. I'm finding that ExpandTemplate() is returning TWO copies of the same template in the returned html on all my pages. Not quite sure how or why yet. It's happening on all my calls. Any tips?

Michael
www.WebConnectionHosting.com

Re: Expandtemplate expanding twice?

$
0
0
Re: Expandtemplate expanding twice?
Web Connection 5.0
Re: Expandtemplate expanding twice?
Dec. 17, 2013
02:41 pm
3YA0VIA75Show this entire thread in new window
Gratar Image based on email address
From:Michael Hogan (Ideate Hosting)
To:
Hmmm... working now. I did force a rebuild of wwpageresponse.fxp while attempting to trace it, but I'm not sure that was the solution. Just very odd...


Uhm... I'm wrapping my head around this issue. I'm finding that ExpandTemplate() is returning TWO copies of the same template in the returned html on all my pages. Not quite sure how or why yet. It's happening on all my calls. Any tips?


Michael
www.WebConnectionHosting.com

Re: UTF-8 Encoding

$
0
0
Re: UTF-8 Encoding
Web Connection
Re: UTF-8 Encoding
Dec. 17, 2013
03:02 pm
3YA0W8K0GShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Albert Gostick
The converted character is correctly UTF-8 encoded. That's what UTF-8 looks like for extended characters, if that's what the server actually expects. You then have to URL encode the content.

This is how this works:

DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN

This will get you:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick

If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick


+++ Rick ---



Hi all,

Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.

I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").

To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):

lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"

So I then sent it through STRCONV() to try to get it encoded properly:

lcURL = STRCONV(lcURL,9)

What I get is this - the accented character gets converted to 2 characters:

http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580

So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?

Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.

Thanks.



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Re: wwSQL and date fields

$
0
0
Re: wwSQL and date fields
Web Connection
Re: wwSQL and date fields
Dec. 17, 2013
03:02 pm
3YA0W8K07Show this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Stein Goering
Yeah I think the newer ODBC drivers are the key requirement.

+++ Rick ---


In my experience there's no need to use DateTime fields on the back end (unless you really want to make use of the Datetime format). We have lots of Date fields in our SQL tables and they always come over as VFP Date types when we load them into the biz object. There may be issues with older drivers - we are using SQL Server 2012 and the ODBC driver that comes with it.

When we first converted our VFP tables to SQL, the upsizing wizard changed all the Date fields to Datetimes. When we pulled data out of SQL those fields mapped into VFP Datetime types, which caused problems since our code was expecting Date types. So we converted the back end types to Dates and now we get the Date types we expect.

--stein

What is the date type exactly? The Sql fields should use DateTime to be usable in FoxPro not SQL Server Date fields. Old ODBC drivers won't understand date fields and that's my guess what's happening. Using a more recent SQL Server ODBC driver should fix this however. Still you should always use DateTime fields if you want to map to FoxPro dates.

+++ Rick ---



Hello,

I have been using the wwBusiness class for a while now and it works great. Now we want to "flip the switch" and access SQL server instead of DBF files.

Everything is working good, except for date fields.

When I pull a cursor, the date fields come over as character type in YYYY-MM-DD format.

I have tried various things like Cast() and Convert() but can not get a date type field returned.

What is the trick to get a VFP date field returned in the cursor from SQL server ?

Thanks,
Kent






Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Re: UTF-8 Encoding

$
0
0
Re: UTF-8 Encoding
Web Connection
Re: UTF-8 Encoding
Dec. 17, 2013
03:05 pm
3YA0WD4OIShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Rick Strahl
Are you sure you're using wwPageResponse? wwPageResponse::Write() does a RETURN "" so it should never return a string from any of these functions that do a Return Write(...) which is what ExpandTemplate does. The output is never captured otherwise. If you're getting a response back that means most likely you're not using wwPageResponse.

+++ Rick ---



The converted character is correctly UTF-8 encoded. That's what UTF-8 looks like for extended characters, if that's what the server actually expects. You then have to URL encode the content.

This is how this works:

DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN

This will get you:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick

If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick


+++ Rick ---



Hi all,

Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.

I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").

To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):

lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"

So I then sent it through STRCONV() to try to get it encoded properly:

lcURL = STRCONV(lcURL,9)

What I get is this - the accented character gets converted to 2 characters:

http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580

So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?

Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.

Thanks.





Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui


Re: wwSQL and date fields

$
0
0
Re: wwSQL and date fields
Web Connection
Re: wwSQL and date fields
Dec. 17, 2013
03:17 pm
3YA0WS326Show this entire thread in new window
Gratar Image based on email address
From:Kent Belan
To:Stein Goering
Hello Rick and Stein,

Thanks for the information. I have done more testing and when I query a DateTime field on the SQL server it returns a DateTime type field. When I query a Date Field on SQL server it returns a character field.

We are using SQL server 2008 v10.0.5500 and ODBC driver 11 for SQL server v2011.110.2270

Do you think we need to upgrade to SQL server 2012 ?

Thanks,
Kent


In my experience there's no need to use DateTime fields on the back end (unless you really want to make use of the Datetime format). We have lots of Date fields in our SQL tables and they always come over as VFP Date types when we load them into the biz object. There may be issues with older drivers - we are using SQL Server 2012 and the ODBC driver that comes with it.

When we first converted our VFP tables to SQL, the upsizing wizard changed all the Date fields to Datetimes. When we pulled data out of SQL those fields mapped into VFP Datetime types, which caused problems since our code was expecting Date types. So we converted the back end types to Dates and now we get the Date types we expect.

--stein

What is the date type exactly? The Sql fields should use DateTime to be usable in FoxPro not SQL Server Date fields. Old ODBC drivers won't understand date fields and that's my guess what's happening. Using a more recent SQL Server ODBC driver should fix this however. Still you should always use DateTime fields if you want to map to FoxPro dates.

+++ Rick ---



Hello,

I have been using the wwBusiness class for a while now and it works great. Now we want to "flip the switch" and access SQL server instead of DBF files.

Everything is working good, except for date fields.

When I pull a cursor, the date fields come over as character type in YYYY-MM-DD format.

I have tried various things like Cast() and Convert() but can not get a date type field returned.

What is the trick to get a VFP date field returned in the cursor from SQL server ?

Thanks,
Kent




wwFTP issue

$
0
0
wwFTP issue
West Wind Client Tools
wwFTP issue
Dec. 18, 2013
03:09 am
3YB06S2W7Show this entire thread in new window
Gratar Image based on email address
From:Cyrus
To:All
Since the last update of ipStuff, I am encountering something a bit strange in wwFTP module.


******** After I do a File Upload. Using a command like this.this.err = loFTP.FTPSendFileEx (SrcFileName, DstFileName)******** Then when I do:DIMENSION laFiles[1,4] nFiles= loFTP.aFTPDir(@laFiles,"*.*") && when BLOCKED this takes a while to excute.

I keep getting nFiles = 0, while there are actually file up there. The aFTPDir function works fine before the upload function.

The only way I have figured a way around it, is to Logoff and then LogIn again.
Then the nFiles = 10 or whatever.

I have checked and rechecked my parameters, but there are not that many.
Am I stepping on something? Is this a known issue?

Thanks

Transaction Logging

$
0
0
Transaction Logging
West Wind Web Store
Transaction Logging
Dec. 18, 2013
06:54 am
3YB0ETBB0Show this entire thread in new window
Gratar Image based on email address
From:Harvey Mushman
To:All
In the WwCcProcessing class, AuthorizeNet subclass, the transaction logging is very sparse in my opinion. I'm just wondering why not log the entire HTTPResult?

Seems to me if one must lookup the processing of a charge, having more data is better not worse. From what I have found, the result does not include the credit card number but does have their tracking number.

this.cHttpResult = loHTTP.HTTPGet(this.cHttpLink); ... process user feedback ... THIS.LogTransaction(THIS.cCompany + ", " + THIS.cName + " - " + ;LEFT(this.cCardNo,4) + " **** **** " + RIGHT(this.cCardNo,4) + " - " +;THIS.cValidatedResult)

Any pitfalls to adding the raw transaction response?

--hm

--hm--

Re: UTF-8 Encoding

$
0
0
Re: UTF-8 Encoding
Web Connection
Re: UTF-8 Encoding
Dec. 18, 2013
08:10 am
3YB0HIN5WShow this entire thread in new window
Gratar Image based on email address
From:Albert Gostick
To:Rick Strahl
Hi Rick,

Ok. got it. So I guess you just URLEncode the parts of the string that you expect to have upper ascii characters? I tried wrapping the whole url in URLEncode() but that (now obviously) did not work. I looked at your code in URLEncode() and it encodes everything except a specific set of characters.

Thanks,
Albert


The converted character is correctly UTF-8 encoded. That's what UTF-8 looks like for extended characters, if that's what the server actually expects. You then have to URL encode the content.

This is how this works:

DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN

This will get you:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick

If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick


+++ Rick ---



Hi all,

Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.

I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").

To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):

lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"

So I then sent it through STRCONV() to try to get it encoded properly:

lcURL = STRCONV(lcURL,9)

What I get is this - the accented character gets converted to 2 characters:

http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580

So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?

Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.

Thanks.



Re: UTF-8 Encoding

$
0
0
Re: UTF-8 Encoding
Web Connection
Re: UTF-8 Encoding
Dec. 18, 2013
08:12 am
3YB0HKRZPShow this entire thread in new window
Gratar Image based on email address
From:Albert Gostick
To:Rick Strahl
Hi Rick,

I think this response probably had to do with another thread, fyi.

Albert


Are you sure you're using wwPageResponse? wwPageResponse::Write() does a RETURN "" so it should never return a string from any of these functions that do a Return Write(...) which is what ExpandTemplate does. The output is never captured otherwise. If you're getting a response back that means most likely you're not using wwPageResponse.

+++ Rick ---



The converted character is correctly UTF-8 encoded. That's what UTF-8 looks like for extended characters, if that's what the server actually expects. You then have to URL encode the content.

This is how this works:

DO wwutils*** Url as it should be sent lcUrl = "http://www.example.com/düsseldorf?neighbourhood=Lörick"*** How you should encode it lcUrl = "http://www.example.com/" +; UrlEncode(STRCONV("düsseldorf",9)) +;"?neighbourhood=" +; UrlEncode(STRCONV("Lörick",9)) ? lcUrlRETURN

This will get you:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick

If you take the original URL paste it into your browser's address bar, then navigate, then copy and paste the URL you get the same:

http://www.example.com/d%C3%BCsseldorf?neighbourhood=L%C3%B6rick


+++ Rick ---



Hi all,

Having trouble getting accented characters into a web application properly. The web application has an api that I am making calls to and the developer of that app says it is expecting strings in UTF-8 format. I am using .httpget() to post to that server.

I am having trouble getting accented characters into that server properly. The call (in pseudocode) is basically CreateFolder("lastname", "firstname") with an example like CreateFolder("Doe","Josée").

To try to get this to work, figuring that my database tables are marked as codepage 1252, I thought I should convert the string to UTF-8 using the VFP function. Here is my original string before trying to change encoding (ignore some of the parameters passed, focus on 2nd and 3rd last):

lcURL = "http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580"

So I then sent it through STRCONV() to try to get it encoded properly:

lcURL = STRCONV(lcURL,9)

What I get is this - the accented character gets converted to 2 characters:

http://mcnuxtest:8080/nuxeo/restAPI/createfolder/Albie/LMullin/O/Doe/Josée/38580

So the basic question is, how do I work up a string that properly passes accented characters via the httpget() function?

Note that if I work up the string *without* doing any conversion and then paste it in my browser, the server creates the folder properly i.e. it seems to be encoded properly if sent from a browser. Which also means that this api properly handles accented characters.

Thanks.





Re: UTF-8 Encoding

$
0
0
Re: UTF-8 Encoding
Web Connection
Re: UTF-8 Encoding
Dec. 18, 2013
01:53 pm
3YB0TRLPFShow this entire thread in new window
Gratar Image based on email address
From:Albert Gostick
To:Albert Gostick
Hi Rick,

Got that working on two of the calls to this server (.CreateFolder() and .UpdateFolder()) so that the accented name appears correct on the folder.

Next one I could not get working - this one is .AddDocument() which adds a doc to a folder. This one was done via using a multi-part form to push up a document to the server. If the document title contains an accented character, cannot get it to post properly.

Here is the code I was using. Note that .ioHTTP is an instance of your wwhttp class. And,

tcDocFileName: full path and name of file to upload
tcDocTitle: above with pathing removed

STORE 2 TO .ioHTTP.nHTTPPostMode .ioHTTP.AddPostKey(tcDocTitle,tcDocFileName,.T.) * encode the doc title (not the doc file name); not: do this after .AddPostKey()STORE URLEncode(STRCONV(tcDocTitle,9)) TO tcDocTitle* work up the URL to the Nuxeo serverSTORE .icNuxeoAPIUrl + "/adddocument/" + .icUserName + "/" + tcFolder_ID + "/" + tcDocTitle TO lcURLSTORE .ioHTTP.HttpGet(lcURL,.icUserName,.icUserPassword) TO lcResultString

Results:

a) if I don't use the URLEncode(), the doc title in the system gets truncated at the first accented character.
e.g. document title is "Phone call with Jos" when it should be "Phone call with Josée"

b) if I use the URLEncode(), then the title of the document comes through with the encoding still on it e.g.

Phone%20call%20with%20Jos%C3%A9e.txt

Here is the URL call if that helps (the long string after "Albie/" is a database id for the target folder). the last argument is the doc title

http://mcnuxtest:8080/nuxeo/restAPI/adddocument/Albie/875c9510-2457-49f6-9624-edb93118a401/Phone%20call%20with%20Jos%C3%A9e.txt

So if the code above looks correct, then I need to take it up with the developer of the web app. Or I just need instructions on how to post a document as a multipart form where the title has an accented character.

Thanks,

Albert

UTF-8 Encoding - Multipart forms

$
0
0
UTF-8 Encoding - Multipart forms
Web Connection
UTF-8 Encoding - Multipart forms
Dec. 18, 2013
02:10 pm
3YB0UE9NTShow this entire thread in new window
Gratar Image based on email address
From:Albert Gostick
To:All
Hi Rick,

See my posting, inadvertently to myself, under "Re: UTF-8 Encoding" where I ask about getting multipart forms working.

Thanks,

Albert


wwDotNetBridge: Pass char type to constructor

$
0
0
wwDotNetBridge: Pass char type to constructor
VFP and .NET Interop
wwDotNetBridge: Pass char type to constructor
Dec. 18, 2013
03:19 pm
3YB0WU3P2Show this entire thread in new window
Gratar Image based on email address
From:Joel Leach
To:All
I'm trying to replace the following line of C# code with the equivalent in VFP using wwDotNetBridge:

PdfStamper stamper = new PdfStamper(pdfReader, new FileStream(PDF_nme, FileMode.Create), '\0', true);

I think I've got everything converted properly, but I'm stuck on the '\0' parameter which is a "char" type. At least that's where I think my problem is. Whenever creating the loStamper object in the code below, I get the error: Constructor on type 'iTextSharp.text.pdf.PdfStamper' not found. I think it's because VFP is passing a string rather than a char. There is an overload where I can drop the last two parameters and it works, but I need those parameters. Is there a way to fix this in wwDotNetBridge?

loFileMode = loBridge.CreateComValue() loFileMode.SetValueFromStaticProperty("System.IO.FileMode", "Create") loFileStream = loBridge.CreateInstance("System.IO.FileStream", lcPDF_nme, loFileMode)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating System.IO.FileStream: " + loBridge.cErrorMsg)Return .f.EndIf loStamper = loBridge.CreateInstance("iTextSharp.text.pdf.PdfStamper", loPdfReader, loFileStream, Chr(0), .t.)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating iTextSharp.text.pdf.PdfStamper: " + loBridge.cErrorMsg)Return .f.EndIf

Re: wwDotNetBridge: Pass char type to constructor

$
0
0
Re: wwDotNetBridge: Pass char type to constructor
VFP and .NET Interop
Re: wwDotNetBridge: Pass char type to constructor
Dec. 18, 2013
03:47 pm
3YB0XTK56Show this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Joel Leach

Try passing the char as 0 (integer 0). Char's are basically of type byte so it's actually a number.
If that doesn't work I probably have to add a char conversion to the ComValue class.

+++ Rick ---



I'm trying to replace the following line of C# code with the equivalent in VFP using wwDotNetBridge:

PdfStamper stamper = new PdfStamper(pdfReader, new FileStream(PDF_nme, FileMode.Create), '\0', true);

I think I've got everything converted properly, but I'm stuck on the '\0' parameter which is a "char" type. At least that's where I think my problem is. Whenever creating the loStamper object in the code below, I get the error: Constructor on type 'iTextSharp.text.pdf.PdfStamper' not found. I think it's because VFP is passing a string rather than a char. There is an overload where I can drop the last two parameters and it works, but I need those parameters. Is there a way to fix this in wwDotNetBridge?

loFileMode = loBridge.CreateComValue() loFileMode.SetValueFromStaticProperty("System.IO.FileMode", "Create") loFileStream = loBridge.CreateInstance("System.IO.FileStream", lcPDF_nme, loFileMode)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating System.IO.FileStream: " + loBridge.cErrorMsg)Return .f.EndIf loStamper = loBridge.CreateInstance("iTextSharp.text.pdf.PdfStamper", loPdfReader, loFileStream, Chr(0), .t.)If !Empty(loBridge.cErrorMsg)MessageBox("Problem creating iTextSharp.text.pdf.PdfStamper: " + loBridge.cErrorMsg)Return .f.EndIf



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Re: Transaction Logging

$
0
0
Re: Transaction Logging
West Wind Web Store
Re: Transaction Logging
Dec. 18, 2013
03:47 pm
3YB0XTK4WShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Harvey Mushman
The transaction logging is meant to let you know what's happening at a glance. ccProcessing logs to text file in CSV format and there's only so much you can store in a text file (ie no multi-line text).

If you want to log more detailed info you can do that at any time in your application. You can capture anything that comes in as a result including the HTTP response.

+++ Rick ---



In the WwCcProcessing class, AuthorizeNet subclass, the transaction logging is very sparse in my opinion. I'm just wondering why not log the entire HTTPResult?

Seems to me if one must lookup the processing of a charge, having more data is better not worse. From what I have found, the result does not include the credit card number but does have their tracking number.

this.cHttpResult = loHTTP.HTTPGet(this.cHttpLink); ... process user feedback ... THIS.LogTransaction(THIS.cCompany + ", " + THIS.cName + " - " + ;LEFT(this.cCardNo,4) + " **** **** " + RIGHT(this.cCardNo,4) + " - " +;THIS.cValidatedResult)

Any pitfalls to adding the raw transaction response?

--hm



Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Re: wwFTP issue

$
0
0
Re: wwFTP issue
West Wind Client Tools
Re: wwFTP issue
Dec. 18, 2013
03:47 pm
3YB0XTK4LShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Cyrus
Are you running IE 11?

If so there are problems with IE 11 and multi-connects.

Nothing's changed in wwFtp for quite a long while so I doubt that there's actually anything different from what you used before other than the environment.

http://west-wind.com/wconnect/weblog/ShowEntry.blog?id=898

+++ Rick ---



Since the last update of ipStuff, I am encountering something a bit strange in wwFTP module.


******** After I do a File Upload. Using a command like this.this.err = loFTP.FTPSendFileEx (SrcFileName, DstFileName)******** Then when I do:DIMENSION laFiles[1,4] nFiles= loFTP.aFTPDir(@laFiles,"*.*") && when BLOCKED this takes a while to excute.

I keep getting nFiles = 0, while there are actually file up there. The aFTPDir function works fine before the upload function.

The only way I have figured a way around it, is to Logoff and then LogIn again.
Then the nFiles = 10 or whatever.

I have checked and rechecked my parameters, but there are not that many.
Am I stepping on something? Is this a known issue?

Thanks




Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Re: wwSQL and date fields

$
0
0
Re: wwSQL and date fields
Web Connection
Re: wwSQL and date fields
Dec. 18, 2013
03:48 pm
3YB0XV3VFShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Kent Belan

You definitely don't need SQL Server 2012. You just need the right ODBC driver. Make sure you have the latest SQL Server ODBC drivers installed and that you are actually using those drivers.

+++ Rick ---



Hello Rick and Stein,

Thanks for the information. I have done more testing and when I query a DateTime field on the SQL server it returns a DateTime type field. When I query a Date Field on SQL server it returns a character field.

We are using SQL server 2008 v10.0.5500 and ODBC driver 11 for SQL server v2011.110.2270

Do you think we need to upgrade to SQL server 2012 ?

Thanks,
Kent


In my experience there's no need to use DateTime fields on the back end (unless you really want to make use of the Datetime format). We have lots of Date fields in our SQL tables and they always come over as VFP Date types when we load them into the biz object. There may be issues with older drivers - we are using SQL Server 2012 and the ODBC driver that comes with it.

When we first converted our VFP tables to SQL, the upsizing wizard changed all the Date fields to Datetimes. When we pulled data out of SQL those fields mapped into VFP Datetime types, which caused problems since our code was expecting Date types. So we converted the back end types to Dates and now we get the Date types we expect.

--stein

What is the date type exactly? The Sql fields should use DateTime to be usable in FoxPro not SQL Server Date fields. Old ODBC drivers won't understand date fields and that's my guess what's happening. Using a more recent SQL Server ODBC driver should fix this however. Still you should always use DateTime fields if you want to map to FoxPro dates.

+++ Rick ---



Hello,

I have been using the wwBusiness class for a while now and it works great. Now we want to "flip the switch" and access SQL server instead of DBF files.

Everything is working good, except for date fields.

When I pull a cursor, the date fields come over as character type in YYYY-MM-DD format.

I have tried various things like Cast() and Convert() but can not get a date type field returned.

What is the trick to get a VFP date field returned in the cursor from SQL server ?

Thanks,
Kent







Rick Strahl
West Wind Technologies

Making waves on the Web
from Maui

Viewing all 10393 articles
Browse latest View live




Latest Images