Rick Strahl's FoxPro and Web Connection Web Log
White Papers | Products | Message Board | News |

Last 50 comments


Feb. 23, 2017 18:43pm | by william

<script>
alert("asjdasd as");
<script>
Feb. 3, 2017 10:54am | by Sam

Hi
Thank you, thank you are a genius, i was about to setup a machine with older OS and IE.
oButton.Click(.F.) is a life saver.
Jan. 29, 2017 2:06am | by Luca

Many thanks, Rick.
The experience is never enough!
Jan. 6, 2017 22:22pm | by dsadasdas

fsdgdfgdfgdfge dgdgf fdgfd
trdsgdfg dfgdf
gfdgfd fdgdfgdf gdfgdfdg gerggre
Dec. 13, 2016 13:46pm | by Jon

Thank you Rick--great stuff as always. And a cool plug for a great band in your example (Accept)!
Dec. 1, 2016 13:16pm | by Ian C.

Hi All.

There now exists a command-line tool to unblock these downloaded files. PowerShell has the Unblock-File commandlet.

See http://ss64.com/ps/unblock-file.html

Nov. 29, 2016 11:35am | by Richard Kaye

The link for the syntax highlighting extension has some extraneous text at the beginning of the URL, Rick.
Nov. 24, 2016 3:21am | by Rick Strahl

Cetin - this is actually not an official Microsoft language add-in. Mads just built this on his own and FoxPro merely uses the TextMate add in to provide FoxPro support. The individual languages are not supported by this add-in but rather they are re-using existing Textmate add-ins from other tools (in this case Matt Slay's Sublime implementation). That implementation only provides highlighting not auto-complete features.

TextMate syntax supports better autocomplete, but the language file has to be built up to support this. The source code for the plug-in is available so you can contribute to make it better yourself instead of crying about it. Guaranteed nobody at Microsoft is going to do it for us...

Nov. 24, 2016 1:41am | by Cetin Basoz

I downloaded and installed the extension in an excitement (besides VFP, I have been using C# and Go and seeing Go there made me more happy initially).
However it is a total disappointment. It doesn't even work as well as VFP's own editor.

Come on Microsoft you could do it better for your own product! Notepad++ is doing that highlighting for years (not surprising after the failure they made announcement "VS on Mac" has turned to be another big disappointment with their ridicilous license aggrement).

Nov. 8, 2016 19:49pm | by aiden carter

Thanks for this post,

The Long path tool is the very best program for error, unlock solution.
Try it and solved your problem.
I used the long path tool and I solved my error, unlocks problem solution.

Sep. 25, 2016 17:51pm | by Matt Slay

Good grief... Every time I run into a VFP problem, I dig into it enough to think I understand the issues, and when I Google during my research, Rick has already tackled it and explained it well enough to help me finish solving my problem. Again!

I have now added Dispose() method into my base business object class, and my objects can now be cleanly and fully released from memory.

Thanks, Rick!!

Sep. 9, 2016 8:38am | by Eddie Caldwell

Thanks Rick for yet another informative post.
On a similar note, I was looking for a hung object but the memory leak turned out to be a foxpro feature. When foxpro loads an image like with the image control, it keeps the image in memory in case it is needed again. You have to issue [release resources] or [release resource <<filename>>] to free up the memory.
Jun. 28, 2016 18:43pm | by Matt Slay

Wow... almost 10 years later and today I was researching slow client app form load times on forms that use 30-40 Business Objects to present data field and grids to the user.

40 BOs were taking 7-8 seconds to new up when the form launched while running in an EXE, but only 1-2 seconds when running the same code from within the VFP IDE.

I blogged about my discovery, research, and remedy. Link below. In the post I also give props to Rick for blogging about this a decade ago.

http://mattslay.com/foxpro-newobject-fast-here-slow-there/

May. 28, 2016 20:54pm | by Rick Strahl

1) Yes you can return cursor data by using "cursor:TQuery" as a string to specify the cursor in a property. The cursor is turned into an array and sent as JSON. Can be the top level result or set on a property assuming the cursor is open. Cursor serialization is one way - you can't directly deserialize an array into a cursor. You can however use CollectionToCursor() to dump the result object back into a cursor/table as long as the table exists.

2) Memo fields are just text and it just works. Nothing special about memo fields. Binary data is converted base64 and sent.

May. 27, 2016 23:59pm | by Naeem

Hi Rick,

Nice addition in west wind client tools. I have following questions.

1) In VFp, table structure can be passed with cursortoXml. Is it possible with Json services?

2) How memo field data is passed with Json services ?

TIA
Naeem

Apr. 3, 2016 14:11pm | by Paul Weisberg

Great article! I found this while searching for a similar problem. One thing I just discovered for myself, is that when you assign a PNG file to the picture property of a control, FoxPro locks the resource file such that it cannot be used in another control and other file methods like fopen() on that picture file will fail. This is not true for BMP files, nor is it true for PNG files that have no transparency. This is obviously some quirk in the way that FoxPro handles transparent PNG files. I expect that the above solutions will work nicely!
Mar. 14, 2016 22:25pm | by FoxInCloud

<%= this.Page.oComments.FormatCommentText( TComments.Body ) %>
Mar. 14, 2016 8:24am | by FoxInCloud

Hi Rick,

Can't find 'oPostStream' and 'cPostStreamClass' in WC6's wwHTTP.
Did you implement these properties somewhere else?

Thanks

Mar. 6, 2016 1:50am | by Rick Strahl

@Tomas - Exe execution doesn't work with registrationless COM due to the extra DCOM related entries. It only works for DLL servers including OCX files (which are just renamed DLLs).
Feb. 27, 2016 4:47am | by Tomas

Registrationless COM Activation requires that during using vfp exe, dll must be near vfp exe, does not it?
Jan. 13, 2016 11:52am | by Jon

Almost any time I have a VFP question or problem, I need look no further than your blog--very helpful, as always. Thanks for continuing to be such a great resource for VFP developers.
Nov. 29, 2015 22:43pm | by Rick Strahl

It's been real handy to have this function. In Help Builder I dozens of places where this stuff comes in handy. My MarkdownParser class in Web Connection too uses this in a couple of places. It's reduced a few very common use cases to two lines of code.
Nov. 25, 2015 1:55am | by Vince Stevens

Hi Rick, The code examples are great.. many thanks... but do you know a way of determining the UTC of a particular country on a particular date... I am attempting to write code to calculate the the flight time from one location to another, on a given date, and passing back the correct local time of arrival... Any help would be much appreciated.
Vince
Nov. 20, 2015 8:44am | by Doug Hennig

I have to do this stuff frequently as well, and interestingly, like in your case, it usually involves parsing a comma-delimited list (usually column names, such as in a SQL SELECT statement) where one of the items in the list could contain commas, such as SELECT [This is a dumb column name, right], SomeOtherField ... I pretty much use the same technique (placeholders) but hadn't thought of creating a helper class.
Nov. 10, 2015 3:42am | by BC

My Foxpro disappeared as you had explained but I don't even have a second monitor. Somehow, when I double clicked, it ran with just the icon at the bottom. No matter how I clicked on it, the screen didn't appear then I saw this post. I used Notepad to create a prg file with the following codes and then dragged this prg file to the VFP icon to run. My screen popped back. Wonderful.

_Screen.left=5
_Screen.top=5

Oct. 28, 2015 0:55am | by Paul Gibson

Very good post Rick, totally agree. Even if you don't use datetimes from different geographical timezones it is still relevant if you deal with DST and the pertinence of this goes up every 6 months when systems transition from DST to non-DST. And so it is that I've landed on this page just a few days after the UK has reverted back to GMT from DST and I've hit a couple of little niggles with VFP's inability to natively resolve datetimes correctly.

You are spot on that this is par for the course and almost second nature when coding in .NET so it's frustrating that it is a little awkward in VFP.

I have an exe that was built just over a week ago (20/10/2015) while we were still in DST, it was built at 11:24 AM Local time which would have been 10:24 UTC. I'm ignoring the date-part for brevity because that's not changing due to the UK being so close to UTC and the file being built near midday. Up until Sunday morning VFP reported the time of the file correctly as 11:24 and you could confirm this by looking at the file in Windows Explorer. Since the clocks went back VFP now reports the file's (local) time as 10:24 so any comparisons might assume that the file was changed. Windows Explorer is still showing the time correctly as 11:24 but FDATE() and ADIR() in VFP cannot give me the correct local time now that it's running in the different TimeZone.

This is particular annoying for a routine I wrote which monitors changes in JPEGs. Once of the metrics which it stores to detect if the files have changed is the date modified - obtained via ADIR(). When the routine ran before Sunday it recorded all the Date modifies of all the pertinent files and that was fine but since the clocks changed the routine has scanned the (unchanged) files and the datetimes appear to have all changed when they haven't in reality, it's just VFPs (in)ability to read the correct datetime for files created in a different timezone which is causing a problem. My routine therefore assumed that all the JPEGs had changed since the previous time it scanned them and performed a task it thought was necessary when in fact it wasn't. It'll only hit this problem once every six months because it then records the new datetimes but it's not good for this routine to have this problem at all, let alone a reoccurring one.

The solution, as you say, is to store those datetimes using the UTC standard and potentially have a general rule that any datetime used for comparison purposes be stored in UTC. I'm working in a 16+ year-old application, so it's difficult to retrofit storing ALL datetimes in UTC across the whole system but for new facilities it should be possible.

One thing I thought was interesting in your implementation is that you cache the TimeZone offset for speed so you only need to query it once, does that make the implementation require a restart or a specific clearing of the cache when the computer system transitions between DST and non-DST? On my computer that function would return 0 or -60 depending on the DST-ness of the system but if it caches that value and uses the cache then the function risks returning the wrong value if it was cached before the transition and then called after the transition. I've seen this before on applications that run 24/7 and use the SECONDS() function due to the "caching" VFP does to facilitate SECONDS().

Paul

Oct. 26, 2015 9:44am | by Sean Gowens

I installed VS 2015 several weeks ago and just got around to needing to use the 'show foxpro code' option. I couldn't figure out how to make it work, but as always I figured you were on top of things. Thanks so much.
Oct. 8, 2015 23:32pm | by gfh

yijfbvdbbfdbdbvdfssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssb
Sep. 3, 2015 20:29pm | by Rick Strahl

Luis - not sure what you mean. All the code you need is here...
Sep. 2, 2015 12:47am | by Luis Guerra

Hi Rick, interesting your article on UTC time. I've seen you're using functions from your tools, but, what about those people that do not use your tools but they want to begin using UTC time?

I'd would like you to point me in the right direction to begin using UTC time.

Best Regards,

Luis GUerra

Jul. 21, 2015 17:46pm | by Luca

Dear Rick,
please when you think to issue with version 6?
Many thanks
Jun. 19, 2015 9:23am | by Fernando D. Bozzo

Very nice and useful article Rick, thanks!
Jun. 11, 2015 9:11am | by JimM

Thanks Rick... I'll be using wconnect for as long as it's out there.. Will also pay for New Versions... I've been using Meter.js lately.. it's pretty cool.. uses mongo as database.. however any developers new to Meteor dont like the fact that they have to use mongo "nosql" so SQL support is on the way... I thing someone is building a postgres driver.. would be cool to have a wconnect driver..
Jun. 9, 2015 14:08pm | by Rick Strahl

I can tell you right of that backwards compatibility - especially for client side features is not something that can be maintained. This update will bring some breaking changes especially for Web Control Framework as I am rebuilding the base CSS code.

This release is going to be about fixing and normalizing a bunch of things that were done in the past for reasons of backwards compatibility. This release is meant to put things into shape so the product can go on without being completely obsolete (even if FoxPro is going that way).

Also as I mentioned there will not be much change in the Web COntrol Framework. Focus will be on client side integration features (SPA applications, and updates for the Template/Scripting engines). WCF will get the CSS UI updates but not much beyond that.

Jun. 7, 2015 21:36pm | by Luca

Dear Rick,
I am enthusiast about a new version of Web Connection! I am very grateful to you because I can still work with Visual FoxPro just thanks to your fantastic framework.
My projects are updated to 5.62, I stopped to follow your upgrades when I ecountered compatibility problems, expecially with wwWebTabControl object. So about new features I would like to find in WC 6:
- compatibility with every 5.x layout feature
- ability to develop applications for mobile devices
- possibility to develop liquid layouts

Many thanks on advance :)

Apr. 7, 2015 9:29am | by Ernando Silva

Thanks for this helpful article Rick and Alberto.
Mar. 20, 2015 15:34pm | by Rick Strahl

@Steve - there's no command line option to unblock since this is a security feature that's meant to be done by the user explicitly off internet downloaded content.

There's additional info in the wwDotnetBridge FAQ:
http://www.west-wind.com/webconnection/docs/?page=_3rf12jtma.htm

If you don't have the 'unblock' option that just means the file is not blocked and so your issue is something else.

The other common things are:

* Network loaded assemblies (addressed in the link in the post and docs)
* Non-Full version of .NET (Client Profile is not enough)

Mar. 20, 2015 9:30am | by Steven Black

Using Windows 7 Ultimate, I see no such security section and "Unblock" on the General tab of the Properties dialog.

Nonetheless seeing the wwDotnetBridge "Unable to load Clr Instance" error.

Any other ideas? Is there a command-line equivalent of this?

Mar. 11, 2015 17:33pm | by Eddy Maue

&& Execute for add CB


Select 0
Use (_foxcode) Shared
* ****************************************** ET
Append Blank

replace abbrev with "CB"

replace expanded with ""

replace cmd with "{}"

replace tip with ReplaceCaractere([])


replace data with ReplaceCaractere([LPARAMETER oFoxCode]+Chr(13)+;
[]+Chr(13)+;
[LOCAL lcCmdLine, lcClassName, lcFunctionName, lcOutput]+Chr(13)+;
[]+Chr(13)+;
[ ]+Chr(13)+;
[]+Chr(13)+;
[lcClassName = INPUTBOX(õClass Fileõ,õOpen Class Browser õ)]+Chr(13)+;
[]+Chr(13)+;
[ ]+Chr(13)+;
[]+Chr(13)+;
[oFoxcode.valuetype = õVõ]+Chr(13)+;
[]+Chr(13)+;
[ ]+Chr(13)+;
[]+Chr(13)+;
[IF EMPTY(lcClassName)]+Chr(13)+;
[]+Chr(13)+;
[ RETURN lcCmdLine]+Chr(13)+;
[]+Chr(13)+;
[ENDIF]+Chr(13)+;
[]+Chr(13)+;
[ ]+Chr(13)+;
[]+Chr(13)+;
[lcFile = lcClassName]+Chr(13)+;
[]+Chr(13)+;
[IF !FILE(lcFile)]+Chr(13)+;
[]+Chr(13)+;
[ lcFile = lcFile + õ.prgõ]+Chr(13)+;
[]+Chr(13)+;
[ IF !FILE(lcFile)]+Chr(13)+;
[]+Chr(13)+;
[ lcFile = lcClassName + õ.vcxõ]+Chr(13)+;
[]+Chr(13)+;
[ ENDIF]+Chr(13)+;
[]+Chr(13)+;
[ IF !FILE(lcFile )]+Chr(13)+;
[]+Chr(13)+;
[ return lcCmdLine]+Chr(13)+;
[]+Chr(13)+;
[ ENDIF]+Chr(13)+;
[]+Chr(13)+;
[ENDIF]+Chr(13)+;
[]+Chr(13)+;
[ ]+Chr(13)+;
[]+Chr(13)+;
[return ñDO (_BROWSER) with õò + lcFile + ñõò])

replace case with "M"

replace save with .T.

replace timestamp with Datetime()

replace source with ReplaceCaractere([RESERVED])

replace uniqueid with Sys(2015)

replace user with ReplaceCaractere([])

replace type with "U"
Use in FOXCODE

Procedure ReplaceCaractere(lcTxt)
Return Chrtran(lcTxt,Chr(241)+Chr(242)+Chr(243)+chr(244)+Chr(245),"[]'&"+Chr(34))

Mar. 3, 2015 6:39am | by venu

Hi,

I have one doubt calling CreateClrInstanceFrom function. I have .net dll written in C#.net. I am able create object in vfp, but couldnt run a static function written in C#, throwing unknown name error.

If you have solution please let me know, It helps me a lot. thanks in advance.

Venu.


Feb. 20, 2015 18:37pm | by Vasim Hanna-Salem

I wish more Visual FoxPro developers knew how great this tool is, this is very cool and works great

Thank you so much for making this Free and Open

Nov. 12, 2014 11:15am | by Mark H

Thanks for this helpful article Rick. Another option that works for me is to download a transparent .png I want to use and open it in SnagIt. Then set the "canvas color" to White and save it as a .bmp.
Jul. 28, 2014 7:28am | by Paul

This code assumes that the primary monitor is the left most and or top most monitor. If the main monitor was in the middle then you would need to check the range between SM_XVIRTUALSCREEN and (SM_CXVIRTUALSCREEN - SM_XVIRTUALSCREEN) to ensure that there is a valid location.

#DEFINE SM_XVIRTUALSCREEN 76
#DEFINE SM_YVIRTUALSCREEN 77
#DEFINE SM_CXVIRTUALSCREEN 78
#DEFINE SM_CYVIRTUALSCREEN 79

clear
LOCAL lnVirtualWidth, lnVirtualHeight

DECLARE INTEGER GetSystemMetrics IN user32 INTEGER nIndex


*get max right position, need to subtract if main monitor is not the left most monitor
lnVirtualMaxRight = GetSystemMetrics(SM_CXVIRTUALSCREEN) - ABS(getsystemmetrics(SM_XVIRTUALSCREEN)) - 10
*get min left position, if main monitor is not left most monitor then this is a negative value
lnVirtualMaxLeft = getsystemmetrics(SM_XVIRTUALSCREEN)

*get max top position, need to substract if main monitor is not top most monitor
lnVirtualMaxTop = GetSystemMetrics(SM_CYVIRTUALSCREEN) - ABS(getSystemMetrics(SM_YVIRTUALSCREEN)) - 5
*get min top position, if main monitor is not top most monitor then this is a negative value
lnVirtualMaxBottom= getsystemmetrics(SM_YVIRTUALSCREEN)

*Test
lnLeft = _Screen.Left
lnTop = _screen.Top

?"left"
?_Screen.Left
?"SM_CYVIRTUALSCREEN"
?GetSystemMetrics(SM_XVIRTUALSCREEN)
?"lnVirtualMaxRight "
?lnVirtualMaxRight
?"lnVirtualMaxLeft "
?lnVirtualMaxLeft

*Only set the position if the location is avaible
IF BETWEEN(lnLeft, lnVirtualMaxLeft, lnVirtualMaxRight)
*Set left location
ENDIF

IF BETWEEN(lnTop, lnVirtualMaxTop , lnVirtualMaxBottom)
*Set left location
ENDIF

Apr. 22, 2014 5:18am | by Metin Emre

Thank you,

This works better than I found at the WEB... Clear, simple and works perfectly... :)

Apr. 2, 2014 15:59pm | by Dan

BTW, this post is the perfect solution to my .dll issue, so thanks a ton.
Apr. 2, 2014 14:24pm | by Dan

Does this work to register .ocx components?
Jan. 29, 2014 2:01am | by Dominik Feckter

<%= this.Page.oComments.FormatCommentText( TComments.Body ) %>
Jan. 26, 2014 23:48pm | by Stjepan


Hello Rick,

I use the Web Connection 5.58.
On Windosw Server 2003 my FoxPro 9.0 exe DCOM web application works ok.

On Windows Server 2012 I registered my standard DCOM server:

MyApplication.exe / regserver.

By running REGEDIT in HKEY_CLASSES_ROOT on the Server 2012
I see that my DCOM server registered on 64 bit system.

After that I started
MMC COMEXP.MSC / 32

but DCOMCNFG not shows my DCOM server and I can't run a web application.

Can you help me ?

Stjepan

Dec. 19, 2013 5:22am | by Larry Newtwon

Yeah, after spending last night and this morning testing it, I came to the same conclusion. After 3/4 files, the next one would hang and put a small 4K piece of garbage on the FTP site. This is what happens when we use software that is based on Microsoft. I didn't make that mistake with my email package. In any event, the fix was 10 seconds of cutting and pasting the ftpconnect command to the bottom of the loop and executing it everytime I send a file.
Dec. 16, 2013 10:01am | by Fernando Suárez García

For testing I have done, just by disconnecting and reconnecting solves the problema. It's appears as then only efective workarround.

© Rick Strahl, West Wind Technologies, 2004 - 2017