topic
stringlengths
1
63
text
stringlengths
1
577k
Conversion from ca-clipper ( not found a variable)
Any variable that is not local must be only used when really necessary (ie. in very rare occasions). The reason is simple: non-local variables break the encapsulation principle so their values are more difficult to trace. EMG
Conversion from ca-clipper ( not found a variable)
[quote="Enrico Maria Giordano":2sny8xn3]Any variable that is not local must be only used when really necessary (ie. in very rare occasions). The reason is simple: non-local variables break the encapsulation principle so their values are more difficult to trace. EMG[/quote:2sny8xn3] Master Enrico, I respect your opinion, but I think it has no basis. In which Clipper book or manual did you see this? Here at this link, you have the Clipper 5.3 manual: Rare exceptions, xHarbour follows the same logic, that's why I like xHarbour better. [url:2sny8xn3]https://harbour.github.io/doc/clc53.html#memvar-cmd[/url:2sny8xn3] I always followed the instructions in manuals and books that adopted the CA-CLIPPER syntax. I've never had problems, I always DECLARE: FIELD, LOCAL, MEMVAR, PRIVATE (I don't use it much) I prefer MEMVAR in Combination with PRIVATE, of course, I don't make excessive use of PRIVATES and PUBLIC, I use it only in exceptional cases. The only one that I'm not used to using, because I don't understand how it works, is GLOBAL. Regards, saludos.
Conversion from ca-clipper ( not found a variable)
Master Enrico: That's how I learned to program in CLIPPER 5.3, and I never had any problems with users, nor a stack overflow or a program breaking, saying that the "VARIABLE DOESN'T EXIST!". A poorly written program is a bad program that sooner or later will generate problems for the user. [code=fw:2gpsca1j]<div class="fw" id="{CB}" style="font-family: monospace;"><br />? &nbsp;This example demonstrates the relationship between a <span style="color: #00C800;">private</span><br />&nbsp; &nbsp;and field variable with the same <span style="color: #0000ff;">name</span>. &nbsp;The <span style="color: #00C800;">private</span> variable is<br />&nbsp; &nbsp;declared with the MEMVAR statement:<br /><br />&nbsp; &nbsp;<span style="color: #00C800;">FUNCTION</span> Example<br />&nbsp; &nbsp; &nbsp; MEMVAR amount, address<br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">PRIVATE</span> amount := <span style="color: #000000;">100</span><br />&nbsp; &nbsp; &nbsp; USE Customer <span style="color: #00C800;">NEW</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//</span><br />&nbsp; &nbsp; &nbsp; ? amount &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// Refers to amount private variable</span><br />&nbsp; &nbsp; &nbsp; ? Customer->Amount &nbsp; &nbsp; &nbsp;<span style="color: #B900B9;">// Refers to Amount field variable</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">//</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br />&nbsp;</div>[/code:2gpsca1j] Regards, saludos.
Conversion from ca-clipper ( not found a variable)
Encapsulation is not a concept tied to a particular programming language. It is a good programming principle that is useful to build and maintain a clean project structure. You can learn about it reading any programming theory book. EMG
Conversion from ca-clipper ( not found a variable)
[quote="karinha":3mkbh45k][quote:3mkbh45k] 1) first column I must divide the string into type XX.XX.XX.XX. how I can make ? 2) the other columns are -1 because are not calculate how I can make to show none ? [/quote:3mkbh45k] muéstranos un ejemplo práctico de cómo lo estás haciendo, no tengo idea de lo que quieres. show us a practical example of how you are doing it, i have no idea what you want. [code=fw:3mkbh45k]<div class="fw" id="{CB}" style="font-family: monospace;"><br />      <span style="color: #B900B9;">// ? VAL( CNUM )</span><br /><br />      cValcNum := VAL<span style="color: #000000;">&#40;</span> CNUM <span style="color: #000000;">&#41;</span><br /><br />      ? TRANSF<span style="color: #000000;">&#40;</span> cValcNum, <span style="color: #ff0000;">"99-99-99-99-99-99-99-99-99"</span> <span style="color: #000000;">&#41;</span><br /> </div>[/code:3mkbh45k] Regards, saludos.[/quote:3mkbh45k] ahhahaaahahahahahahaahaahhaahahahahaha, you're are Joke <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> [b:3mkbh45k]I cannot use your transform TRANSF( cValcNum, "99-99-99-99-99-99-99-99-99" )[/b:3mkbh45k] [img:3mkbh45k]https&#58;//i&#46;postimg&#46;cc/DZnC502j/string&#46;png[/img:3mkbh45k] But I made a easy function because I not Know the len of the string [code=fw:3mkbh45k]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><span style="color: #00C800;">Function</span> Main <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />? ConvertString<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"019002894546"</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">nil</span> <br /><span style="color: #00C800;">Function</span> ConvertString<span style="color: #000000;">&#40;</span>cnum<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">local</span> conta:= <span style="color: #000000;">1</span><br /><span style="color: #00C800;">local</span> cnewstring:=<span style="color: #ff0000;">""</span><br />              <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> <span style="color: #000000;">&#40;</span>conta <= Len<span style="color: #000000;">&#40;</span>cnum<span style="color: #000000;">&#41;</span> / <span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><br />                  num:= <span style="color: #ff0000;">"N"</span> + LTrim<span style="color: #000000;">&#40;</span>Str<span style="color: #000000;">&#40;</span>conta<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />                  &num:= <span style="color: #0000ff;">SubStr</span><span style="color: #000000;">&#40;</span>cnum, conta * <span style="color: #000000;">2</span> - <span style="color: #000000;">1</span>, <span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><br />                  cnewstring+=&num+<span style="color: #ff0000;">"."</span><br />                  conta:= conta + <span style="color: #000000;">1</span><br />               <span style="color: #00C800;">enddo</span><br /><span style="color: #00C800;">return</span> cnewstring<br /><br /> </div>[/code:3mkbh45k] only it print the "." also then last number
Conversion from ca-clipper ( not found a variable)
[quote="Enrico Maria Giordano":r4ilvdop]Encapsulation is not a concept tied to a particular programming language. It is a good programming principle that is useful to build and maintain a clean project structure. You can learn about it reading any programming theory book. EMG[/quote:r4ilvdop] Okay Master Enrico. But what does this have to do with DECLARE the VARIABLES? Can you show something in practice? Are you referring to the creation of classes? Do you NEVER declare variables? As I've never seen a source (.prg) of yours, I can't dispute it. Thanks. Hugs. Bien maestro Enrico. Pero, ¿qué tiene que ver esto con DECLARAR las VARIABLES? ¿Puedes mostrar algo en la práctica? ¿Te refieres a la creación de clases? ¿NUNCA declaras variables? Como nunca he visto una fuente (.prg) tuya, no puedo discutirlo. Aprender es un placer. Gracias. Abrazos. Regards, saludos.
Conversion from ca-clipper ( not found a variable)
I put many samples in this forum during the years, so you should have seen some of my source code. Anyway, maybe you don't know that declaring a variable also defines its scope and lifetime. A LOCAL variable exists and is only visible inside the function where it is declared. A STATIC variable declared inside a function is just like a LOCAL one but keeps its value till the end of the program (ie. its lifetime lasts from the declaration to the end of the program). A STATIC variable declared outside a function is visible in the whole file (the PRG) and its lifetime is like the previous one. A PRIVATE variable is visible and exists from the declaration to all the functions called by the function where it is declared. A PUBLIC variable is visible and exists from the declaration to all the program. So the only variable that fully respect the encapsulation principle is the LOCAL one. EMG
Conversion from ca-clipper ( not found a variable)
Master Enrico Escrebió: [quote:3mopqwmo] Una variable LOCAL existe y solo es visible dentro de la función donde se declara. Una variable ESTÁTICA declarada dentro de una función es como una LOCAL pero mantiene su valor hasta el final del programa (es decir, su tiempo de vida dura desde la declaración hasta el final del programa). Una variable STATIC declarada fuera de una función es visible en todo el archivo (el PRG) y su tiempo de vida es como el anterior. Una variable PRIVADA es visible y existe desde la declaración hasta todas las funciones llamadas por la función donde se declara. Una variable PÚBLICA es visible y existe desde la declaración hasta todo el programa. Entonces, la única variable que respeta completamente el principio de encapsulación es la LOCAL. [/quote:3mopqwmo] Una variable LOCAL existe y solo es visible dentro de la función donde se declara. Una variable ESTÁTICA declarada dentro de una función es como una LOCAL pero mantiene su valor hasta el final del programa (es decir, su tiempo de vida dura desde la declaración hasta el final del programa). Una variable STATIC declarada fuera de una función es visible en todo el archivo (el PRG) y su tiempo de vida es como el anterior. Una variable PRIVADA es visible y existe desde la declaración hasta todas las funciones llamadas por la función donde se declara. Una variable PÚBLICA es visible y existe desde la declaración hasta todo el programa. Entonces, la única variable que respeta completamente el principio de encapsulación es la LOCAL. Perfect master Enrique, this is how I see the VARIABLE STATEMENTS. And so it is written in the CLIPPER 5.3 books and manuals. Perhaps, I have misunderstood something wrong that you wrote. It doesn't matter, you write your programs his way and I write mine. Thank you for the information. Strong hug.. Perfecto maestro Enrique, así veo yo las DECLARACIONES DE VARIABLES. Y así está escrito en los libros y manuales de CLIPPER 5.3. Tal vez, he entendido mal algo que escribiste mal. No importa, tú escribes tus programas a tu manera y yo escribo el mío. Gracias por la información. Fuerte abrazo. I will continue to follow my books and manuals. hahahaha Continuaré siguiendo mis libros y manuales. jajajaja Regards, saludos.
Conversion from ca-clipper ( not found a variable)
[quote="Marc Venken":29wibssl]In this code, I recently created I wonder if there is a potential risk of failure because the object oHttp is not ended somewhere into the loop ? If so, there need to be a oHttp:end() afther the END . Is this the correct logic that I need to start using then ?[/quote:29wibssl] xHarbour ends the OLE objects automatically (ie. oOle:End()) when the variables finish its lifetime. Maybe Harbour too but I'm not sure. EMG
Conversion from ca-clipper ( not found a variable)
[quote="Marc Venken":2aeqkfik]test1.prg(72) Warning W0002 Ambiguous reference, assuming memvar 'LSERVER'[/quote:2aeqkfik] Where the PUBLIC or PRIVATE variable is used you have to use the MEMVAR declaration or the M -> prefix: MEMVAR lServer or M -> lServer EMG
Conversion from ca-clipper ( not found a variable)
Very interesting .... I see that I use a combination of Static, Local and Public. Static (mostly because I see them on sample source code in the forum (Seems to be correct) Public because I need them everywhere (It seems to be correct) Local when needed I think... )) BUT... I see a lot of warnings when I compile with the build from the samples dir (not in my setup) but will look into it. I assume now that you guys will advice me to get rid of all the warning ? but please tell me the advantage or possible risks... I also don't kill the objects like fonts, oDlg, ... I Mostly just end the program and all this stuff is gone ? At least I think so... Oeps... My Warning log has 430 lines test1.prg(1714) Warning W0027 Meaningless use of expression ':' test1.prg(1714) Warning W0027 Meaningless use of expression 'Logical' test1.prg(1716) Warning W0027 Meaningless use of expression ':' test1.prg(1716) Warning W0027 Meaningless use of expression 'Logical' test1.prg(1744) Warning W0001 Ambiguous reference 'DLG' test1.prg(1757) Warning W0001 Ambiguous reference 'NSIZE' test1.prg(1758) Warning W0001 Ambiguous reference 'NSIZE' test1.prg(1823) Warning W0001 Ambiguous reference 'OBTNINDEXES'
Conversion from ca-clipper ( not found a variable)
[quote="Marc Venken":v1qtuhia]I also don't kill the objects like fonts, oDlg, ... I Mostly just end the program and all this stuff is gone ? At least I think so...[/quote:v1qtuhia] Yes, all the objects are released at the end of the program. The problem arise when you create a resource inside a function and don't release it at the end: if that function is called n times then the resource is allocated n times and released zero times and you will have resource leakage. [quote="Marc Venken":v1qtuhia]test1.prg(1714) Warning W0027 Meaningless use of expression ':' test1.prg(1714) Warning W0027 Meaningless use of expression 'Logical' test1.prg(1716) Warning W0027 Meaningless use of expression ':' test1.prg(1716) Warning W0027 Meaningless use of expression 'Logical' test1.prg(1744) Warning W0001 Ambiguous reference 'DLG' test1.prg(1757) Warning W0001 Ambiguous reference 'NSIZE' test1.prg(1758) Warning W0001 Ambiguous reference 'NSIZE' test1.prg(1823) Warning W0001 Ambiguous reference 'OBTNINDEXES'[/quote:v1qtuhia] Can I see the related lines of source code? EMG
Conversion from ca-clipper ( not found a variable)
( 1714 )DEFINE BUTTON OF oBar PROMPT "Filters Uit" RESOURCE "EDIT"; ACTION (oBrw:lGetBar = .F.,oBrw:refresh(),oBrw:setfocus() ) (1716 ) DEFINE BUTTON OF oBar PROMPT "Filters Aan" RESOURCE "EDIT"; ACTION (oBrw:lGetBar=.t.,oBrw:refresh(),oBrw:setfocus() ) DEFINE BUTTON OF oBar PROMPT "Mainbar.Exit" RESOURCE "exit" ; ACTION Dlg:End() // This need to be oDlg For nSize and oBtnindexes and for almost all others, I don't use any of the settings (Local, Public , ...) I see why the warning, nSize is not set as local. But I see no visible problem or a program that is failing. [code=fw:2r5y50mi]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">function</span> XbrSetupbuttons<span style="color: #000000;">&#40;</span> oBrw,cData <span style="color: #000000;">&#41;</span><br />  <span style="color: #00C800;">local</span> cString:=<span style="color: #ff0000;">""</span>, nOrder:=<span style="color: #000000;">0</span><br />  <span style="color: #00C800;">do</span> <span style="color: #00C800;">case</span><br />    <span style="color: #00C800;">case</span> upper<span style="color: #000000;">&#40;</span>oBrw:<span style="color: #000000;">cAlias</span><span style="color: #000000;">&#41;</span> = <span style="color: #ff0000;">"BRWDETAIL"</span><br />      <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Test Editsource"</span><span style="color: #000000;">&#41;</span><br />      cString = brwdetail->brwnaam<br />      obrw:<span style="color: #000000;">gobottom</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      nOrder = brwdetail->order + <span style="color: #000000;">10</span><br />      nSize = <span style="color: #000000;">100</span><br />      oBrw:<span style="color: #000000;">EditSource</span><span style="color: #000000;">&#40;</span>.T., <span style="color: #ff0000;">"brwnaam,order,size"</span> , <span style="color: #000000;">&#123;</span> cString,nOrder,nSize <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span><br />      <span style="color: #B900B9;">//cData = brwdetail->brwnaam</span><br />      <span style="color: #B900B9;">//oBrw:add()</span><br />      <span style="color: #B900B9;">//msginfo("BRWDETAIL")</span><br />    <span style="color: #00C800;">otherwise</span><br />      oBrw:<span style="color: #000000;">EditSource</span><span style="color: #000000;">&#40;</span>.t.<span style="color: #000000;">&#41;</span><br />  <span style="color: #00C800;">endcase</span><br /><br /><span style="color: #00C800;">return</span> <span style="color: #00C800;">NIL</span><br /><br /> </div>[/code:2r5y50mi]
Conversion from ca-clipper ( not found a variable)
[quote="Enrico Maria Giordano":2b6iyjkn][quote="Marc Venken":2b6iyjkn]I also don't kill the objects like fonts, oDlg, ... I Mostly just end the program and all this stuff is gone ? At least I think so...[/quote:2b6iyjkn] Yes, all the objects are released at the end of the program. The problem arise when you create a resource inside a function and don't release it at the end: if that function is called n times then the resource is allocated n times and released zero times and you will have resource leakage. EMG[/quote:2b6iyjkn] Indeed. I need to change that in my sources...
Conversion from ca-clipper ( not found a variable)
[quote="Marc Venken":3fnneefb]( 1714 )DEFINE BUTTON OF oBar PROMPT "Filters Uit" RESOURCE "EDIT"; ACTION (oBrw:lGetBar = .F.,oBrw:refresh(),oBrw:setfocus() )[/quote:3fnneefb] [code=fw:3fnneefb]<div class="fw" id="{CB}" style="font-family: monospace;">oBrw:<span style="color: #000000;">lGetBar</span> := .F.</div>[/code:3fnneefb] Otherwise it is not an assignment but an unuseful logical compare. EMG
Conversion from ca-clipper ( not found a variable)
In this code, I recently created I wonder if there is a potential risk of failure because the object oHttp is not ended somewhere into the loop ? If so, there need to be a oHttp:end() afther the END . Is this the correct logic that I need to start using then ? [code=fw:1g9unafn]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">function</span> testapi<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>  <span style="color: #B900B9;">// part of code</span><br />  <span style="color: #00C800;">local</span> cBuffer:=<span style="color: #ff0000;">""</span><br />  <span style="color: #00C800;">local</span> uResponse, cCookies, I, cLink, cUrl,oHttp<br /><br />  <span style="color: #00C800;">do</span> <span style="color: #00C800;">while</span> !webshop-><span style="color: #000000;">&#40;</span>eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /><br />    ... code <span style="color: #00C800;">for</span> filling my API <span style="color: #00C800;">data</span> into cBuffer<br /><br />    <span style="color: #0000ff;">msginfo</span><span style="color: #000000;">&#40;</span>cBuffer<span style="color: #000000;">&#41;</span><br /><br />    oHttp := FWGetOleObject<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"WINHTTP.WinHttpRequest.5.1"</span> <span style="color: #000000;">&#41;</span><br /><br />      WITH OBJECT oHttp<br />         :<span style="color: #000000;">SetTimeouts</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">0</span>, <span style="color: #000000;">60000</span>, <span style="color: #000000;">30000</span>, <span style="color: #000000;">120000</span><span style="color: #000000;">&#41;</span><br />         :<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"PATCH"</span>, cUrl, .f. <span style="color: #000000;">&#41;</span>      <span style="color: #B900B9;">// My Marc seen on Google</span><br />         :<span style="color: #000000;">SetRequestHeader</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Accept"</span>,        <span style="color: #ff0000;">"application/json"</span> <span style="color: #000000;">&#41;</span><br />         :<span style="color: #000000;">SetRequestHeader</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Content-Type"</span>,  <span style="color: #ff0000;">"application/json"</span> <span style="color: #000000;">&#41;</span><br />         :<span style="color: #000000;">Send</span><span style="color: #000000;">&#40;</span> cBuffer <span style="color: #000000;">&#41;</span><br />         :<span style="color: #000000;">WaitForResponse</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />         <span style="color: #B900B9;">//if :status <> 200</span><br />            ? :<span style="color: #000000;">Status</span>, :<span style="color: #000000;">StatusText</span> <span style="color: #B900B9;">// 200 OK</span><br />         <span style="color: #B900B9;">//endif</span><br />      END<br /><br />     webshop-><span style="color: #000000;">&#40;</span>dbskip<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />  <span style="color: #00C800;">enddo</span><br /><span style="color: #00C800;">RETURN</span> <br /><br /> </div>[/code:1g9unafn]
Conversion from ca-clipper ( not found a variable)
Just to have a better understanding : In this code (parts) , from the main function the warning log says folowing : test1.prg(72) Warning W0002 Ambiguous reference, assuming memvar 'LSERVER' test1.prg(73) Warning W0002 Ambiguous reference, assuming memvar 'SERVER_PATH' test1.prg(75) Warning W0002 Ambiguous reference, assuming memvar 'LOCAL_PATH' test1.prg(81) Warning W0001 Ambiguous reference 'OCLP' The warning for oClp I wonder : It is defined as public (I need it all over the program), but still a warning in the define clipboard line ? [code=fw:3g4xtxc8]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> sys_versie := <span style="color: #ff0000;">"Jan 2022 - 01/01"</span><br />&nbsp; &nbsp;<span style="color: #B900B9;">// &nbsp;more local</span><br />&nbsp; &nbsp;<span style="color: #00C800;">PUBLIC</span> lServer := .F.<br />&nbsp; &nbsp;<span style="color: #00C800;">public</span> SERVER_PATH := <span style="color: #ff0000;">"<span style="color: #000000;">\\</span>CAROLIEN-PC<span style="color: #000000;">\M</span>ARC<span style="color: #000000;">\"</span><br />&nbsp; &nbsp;public LOCAL_PATH &nbsp;:= "</span>c:\marc32\<span style="color: #ff0000;">"<br />&nbsp; &nbsp;Public sys_path<br />&nbsp; &nbsp;Public oGetLev, oClp, hBrw, oArtChanges<br /><br />&nbsp; &nbsp;DEFINE CLIPBOARD oClp OF oWnd<br />&nbsp; &nbsp;// ....<br />RETURN NIL<br /><br /></span></div>[/code:3g4xtxc8]
Conversion from ca-clipper ( not found a variable)
[quote="Enrico Maria Giordano":1qxufp0r][quote="Marc Venken":1qxufp0r]test1.prg(72) Warning W0002 Ambiguous reference, assuming memvar 'LSERVER'[/quote:1qxufp0r] Where the PUBLIC or PRIVATE variable is used you have to use the MEMVAR declaration or the M -> prefix: MEMVAR lServer or M -> lServer EMG[/quote:1qxufp0r] ok but on my old clipper prg I assigned on "N"+ LTrim(Str(conta1)) a number numeri:= 22 for a sample do while (conta <= Val(numeri)) num:= "N" + LTrim(Str(conta)) so num = N1,N2,N3.... but &num can have different values they are like variables but they are not declared (local, private, public, memvar) can i know the value in any part of the program?
Conversion from ca-clipper ( not found a variable)
João, [quote:1pfzt7by]Perfect master Enrique, this is how I see the VARIABLE STATEMENTS. And so it is written in the CLIPPER 5.3 books and manuals. Perhaps, I have misunderstood something wrong that you wrote. It doesn't matter, you write your programs his way and I write mine. Thank you for the information. [/quote:1pfzt7by] It appears you are missing out on all the advantages of the newer object oriented programming style (OOP). Enrico uses OOP, and variables are not the issue they were in Clipper. I write almost exclusively in OOP, and the only variable type I normally use is LOCAL. I don't use the type "FIELD" since I only use database objects (e.g. oCustomer:name), and thus no variable type declaration is needed for field names. You can also eliminate PUBLICs using a database object. I think you are missing out on a lot by not working with OOP. I have taken old programs and reduced the code by more than 50% by converting to OOP.
Conversion from ca-clipper ( not found a variable)
James, If you use a Object, and want to see it everywhere, you will use the public/static not ? I have set is as Static : See my first coding for a solution with having many var in a hash or object. What should I change ? I'm not sure the "set autorder 1" etc.. from the oMarc are executed [code=fw:38fkc4dr]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">STATIC</span> oWnd, oDlg, oFont, cClrBack, oBold, oMarc, oGet, oArtChanges<br /><br /><span style="color: #00C800;">FUNCTION</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">LOCAL</span> oFol, oDlg, oRBar, oMenu, oMenuWnd, oBrush1, ;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oSay1, oBmp, oFont1, oCursor<br /><br />  <span style="color: #B900B9;">// code</span><br />   oMarc:= TMarc<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   oMarc:<span style="color: #000000;">aLever</span> = readleveranciers<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />   SET AUTORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">1</span><br />   SET CENTURY <span style="color: #0000ff;">ON</span><br />   SET DATE BRITISH<br />   SET TIME FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HH:MM:SS"</span><br />   SET EPOCH <span style="color: #0000ff;">TO</span> <span style="color: #0000ff;">YEAR</span><span style="color: #000000;">&#40;</span> DATE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> - <span style="color: #000000;">30</span><br />   SET SOFTSEEK OFF<br />   SET WRAP <span style="color: #0000ff;">ON</span><br />   SETCANCEL<span style="color: #000000;">&#40;</span> .F. <span style="color: #000000;">&#41;</span><br />   SET CONFIRM OFF<br />   SET DELETED <span style="color: #0000ff;">ON</span><br />   SET _3DLOOK <span style="color: #0000ff;">ON</span><br />   SET UNIQUE OFF<br />   SET ESCAPE OFF<br />   SET EXACT <span style="color: #0000ff;">ON</span><br />   SET EXCLUSIVE OFF<br />   SET MULTIPLE OFF<br />   SET AUTORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">1</span><br />   <span style="color: #0000ff;">define</span> <span style="color: #0000ff;">font</span> oFontw <span style="color: #0000ff;">name</span> <span style="color: #ff0000;">"MS Sans Serif"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-50</span><br /><br /><br /><br /><span style="color: #B900B9;">// more code</span><br /><br />   <span style="color: #0000ff;">ACTIVATE</span> <span style="color: #0000ff;">WINDOW</span> oWnd <span style="color: #0000ff;">MAXIMIZED</span><br /><br /><br />   oBrush1:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   oRBar:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   oKlant:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   oRec:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">NIL</span><br /><br /><span style="color: #00C800;">CLASS</span> TMarc<br />   <span style="color: #00C800;">DATA</span>  aMaanden  AS ARRAY <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">&#123;</span><span style="color: #ff0000;">"Jan"</span>,<span style="color: #ff0000;">"Feb"</span>,<span style="color: #ff0000;">"Mrt"</span><span style="color: #000000;">&#125;</span><br />   <span style="color: #00C800;">DATA</span>  aDbfVelden  AS ARRAY <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />   <span style="color: #00C800;">DATA</span>  aLever AS ARRAY <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />   <span style="color: #00C800;">DATA</span>  aMerken AS ARRAY <span style="color: #0000ff;">INIT</span> readleveranciers<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"MERKEN"</span><span style="color: #000000;">&#41;</span><br />   <span style="color: #B900B9;">//DATA  aLever AS ARRAY INIT readleveranciers()  // Not working</span><br />   <span style="color: #00C800;">DATA</span>  aStates AS ARRAY <span style="color: #0000ff;">INIT</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#123;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#125;</span> <span style="color: #B900B9;">// state 0 defined as empty</span><br />   <span style="color: #00C800;">DATA</span>  <span style="color: #0000ff;">name</span> <span style="color: #0000ff;">INIT</span> <span style="color: #ff0000;">"Just a Name"</span><br />   <span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">NEW</span><br /><span style="color: #00C800;">ENDCLASS</span><br /><br /><span style="color: #00C800;">METHOD</span> <span style="color: #00C800;">NEW</span> <span style="color: #00C800;">CLASS</span> TMarc<br /><br />   SET AUTORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">1</span><br />   SET CENTURY <span style="color: #0000ff;">ON</span><br />   SET DATE BRITISH<br />   SET TIME FORMAT <span style="color: #0000ff;">TO</span> <span style="color: #ff0000;">"HH:MM:SS"</span><br />   SET EPOCH <span style="color: #0000ff;">TO</span> <span style="color: #0000ff;">YEAR</span><span style="color: #000000;">&#40;</span> DATE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> - <span style="color: #000000;">30</span><br />   SET SOFTSEEK OFF<br />   SET WRAP <span style="color: #0000ff;">ON</span><br />   SETCANCEL<span style="color: #000000;">&#40;</span> .F. <span style="color: #000000;">&#41;</span><br />   SET CONFIRM OFF<br />   SET DELETED <span style="color: #0000ff;">ON</span><br />   SET _3DLOOK <span style="color: #0000ff;">ON</span><br />   SET UNIQUE OFF<br />   SET ESCAPE OFF<br />   SET EXACT <span style="color: #0000ff;">ON</span><br />   SET EXCLUSIVE OFF<br />   SET MULTIPLE OFF<br />   SET AUTORDER <span style="color: #0000ff;">TO</span> <span style="color: #000000;">1</span><br />   <span style="color: #0000ff;">define</span> <span style="color: #0000ff;">font</span> oFontw <span style="color: #0000ff;">name</span> <span style="color: #ff0000;">"MS Sans Serif"</span> <span style="color: #0000ff;">size</span> <span style="color: #000000;">0</span>,<span style="color: #000000;">-50</span><br /><br /><span style="color: #00C800;">RETURN</span> <span style="color: #00C800;">SELF</span><br /><br /><span style="color: #00C800;">function</span> ReadLeveranciers<span style="color: #000000;">&#40;</span>cType<span style="color: #000000;">&#41;</span> <span style="color: #B900B9;">//  Steek leverancier, Code en Tag in Array</span><br />   <span style="color: #00C800;">local</span> aDbf  := <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#125;</span><br />   <span style="color: #00C800;">local</span> c, aDir<br />   <span style="color: #00C800;">DEFAULT</span> cType := <span style="color: #ff0000;">"ALL"</span><br />   Minfilesize:= <span style="color: #000000;">1</span><br />   netopen<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Lever"</span><span style="color: #000000;">&#41;</span><br />   <span style="color: #B900B9;">//gDBEVAL( { || AAdd( aDbf, FIELD->naam_1 )} )</span><br />   <span style="color: #00C800;">do</span> <span style="color: #00C800;">case</span><br />      <span style="color: #00C800;">case</span> cType = <span style="color: #ff0000;">"ALL"</span><br />        DBEVAL<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> || AAdd<span style="color: #000000;">&#40;</span> aDbf, <span style="color: #000000;">&#123;</span>FIELD->klant_nr,FIELD->naam_1,FIELD->tag<span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">case</span> cType = <span style="color: #ff0000;">"MERKEN"</span><br />        DBEVAL<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> || AAdd<span style="color: #000000;">&#40;</span> aDbf, <span style="color: #000000;">&#123;</span>FIELD->klant_nr,FIELD->naam_1,FIELD->tag<span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">endcase</span><br /><br />   <span style="color: #B900B9;">//ASORT(aDbf, , , { | x,y | x[2] > y[2] } )  //  Z->A 2 veld</span><br />   ASORT<span style="color: #000000;">&#40;</span>aDbf, , , <span style="color: #000000;">&#123;</span> | x,y | x<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> < y<span style="color: #000000;">&#91;</span><span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>  <span style="color: #B900B9;">//  A->Z 2 veld</span><br />   close lever<br /><br /><span style="color: #00C800;">return</span> aDbf<br /><br /> </div>[/code:38fkc4dr]
Conversion from ca-clipper ( not found a variable)
In fact, I would prefer to have a hash for most of my global program data like : sys_Folder, sys_Date, sys_DocType .... All global settings in 1 hash function main() local hDatos := { => } // but this will need to be static or public I think hDatos["date"] = date() hDatos["folder"] = "c:\..." hDatos["type"] = "INVOICE" then all variables are in a single hdatos variable to pass or call. So Hash is almost the same as a object..
Conversion from ca-clipper ( not found a variable)
Marc, [quote:1snuufuz]If you use a Object, and want to see it everywhere, you will use the public not ?[/quote:1snuufuz] No, no PUBLICs. There are several ways to eliminate PUBLICS. Here is one: ---------------------------------------------------------- ELIMINATING PUBLICS Here is a sample showing how you can eliminate publics. One disadvantage of using publics is that they have to be declared in every routine that uses them or you will get compiler warnings. Of course, since they are visible everywhere, you always run the risk of conflicts with locals and fieldnames. Note that here we are using a static variable oUser (an object). A static variable retains its value as long as the program is running. [code=fw:1snuufuz]<div class="fw" id="{CB}" style="font-family: monospace;"><span style="color: #00D7D7;">#include</span> <span style="color: #ff0000;">"fivewin.ch"</span><br /><br /><span style="color: #B900B9;">// Class for user</span><br /><span style="color: #00C800;">Class</span> TUser<br />   <span style="color: #00C800;">data</span> <span style="color: #0000ff;">name</span> as char<br />   <span style="color: #00C800;">method</span> <span style="color: #00C800;">new</span><br /><span style="color: #00C800;">Endclass</span><br /><br /><span style="color: #00C800;">Method</span> <span style="color: #00C800;">new</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #00C800;">Class</span> TUser<br />   ::<span style="color: #0000ff;">name</span>:=<span style="color: #ff0000;">""</span><br /><span style="color: #00C800;">Return</span> <span style="color: #00C800;">self</span><br /><br /><span style="color: #B900B9;">//------------------------------//</span><br /><br /><span style="color: #B900B9;">// Create a function. Functions can be called from anywhere in the program.</span><br /><span style="color: #00C800;">Function</span> User<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">static</span> oUser<br />   <span style="color: #00C800;">if</span> oUser == <span style="color: #00C800;">nil</span><br />      oUser:= TUser<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>  <span style="color: #B900B9;">// instantiate the object</span><br />   <span style="color: #00C800;">endif</span><br /><span style="color: #00C800;">Return</span> oUser<br /><br />You can then <span style="color: #00C800;">do</span> this <span style="color: #0000ff;">from</span> anywhere:<br /><br /><span style="color: #000000;">User</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #0000ff;">name</span>:= <span style="color: #ff0000;">"JBott"</span>        <span style="color: #B900B9;">// assign a value</span><br /><br /><span style="color: #B900B9;">// And call this from anywhere in the program</span><br /><br /><span style="color: #0000ff;">msgInfo</span><span style="color: #000000;">&#40;</span>User<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #0000ff;">Name</span>, <span style="color: #ff0000;">"User Name"</span><span style="color: #000000;">&#41;</span>       <span style="color: #B900B9;">// returns JBott</span></div>[/code:1snuufuz] -----------------
Conversion from ca-clipper ( not found a variable)
Ok, So my code is in general ok. oMarc = static only I have a init clause in the class Tmarc where I define the values, and you define the values in the METHOD NEW CLASS TMarc I suppose that this a just a choise of the programmer ? or is there a advantage for one option ? DATA aMaanden AS ARRAY INIT {"Jan","Feb","Mrt"} DATA aDbfVelden AS ARRAY INIT {} DATA aLever AS ARRAY INIT {} DATA aMerken AS ARRAY INIT readleveranciers("MERKEN")
Conversion from ca-clipper ( not found a variable)
The next logical step would be : make a prg file : marc.prg (my setup class for all potential programs) put only the class items into this single prg. and link this marc.prg into every project where I want to use it. I don't have to concider any code for a marc.ch file ? This is correct ? No idea what to put inside it )))
Conversion from old 16 bit clipper
I'm translating an old 16 bit application and now I have a procedure witha a order creation I not Know how convert to fwh : box_index("orario.$$1") orario->(dbCreateIndex("orario.$$1", ; "materie->prec + anagrafe->punti", {|| ; (materie->(dbGoto(orario->materia)), ; anagrafe->(dbGoto(orario->prof)), materie->prec + ; anagrafe->punti + eval({|| (DevPos(14, 14), iif(!EOF(), ; DevOut(Replicate("²", RecNo() * 51 / LastRec())), Nil), ; "")}))})) box_index("orario.$$2") orario->(dbCreateIndex("orario.$$2", ; "orario->classe + str( orario->gruppo, 3 ) + orario->gg_ora", ; {|| orario->classe + Str(orario->gruppo, 3) + orario->gg_ora + ; eval({|| (DevPos(14, 14), iif(!EOF(), DevOut(Replicate("²", ; RecNo() * 51 / LastRec())), Nil), "")})})) I use cdx
Conversion of Buttons to 32 Bit
I'm finally getting some actual time to work on updating an application to 32 bits. The code compiled into Harbour like a dream and I was able to replace most of the FUNKY lib tools with Fivewin functions or I simply rewrote them in Harbour. The conversion of my DLL file was a bit tricky mostly because the original file had corruption. There still seems to be a difference in the way FW/Harbour handle buttons, and I'd like some advice. In the 16 Bit DLL are three buttons, marked 1201,3201, and 5201, each representing different "push states" of the button on the screen. To setup the button in Clipper/1.92 Fivewin, the command to activate and display the button was: REDEFINE BUTTON ID 201 OF oDlg ; ACTION (oDlg:end()) Each of the various button states were displayed depending on the state of the button. After reverting to an older (uncorrupted) version of the DLL file, I was able to convert it to 32bit using the tools provided with Fivewin, and I am now able to edit the 32 bill DLL with Visual Studio and other editors. The button in the DLL however comes over as a custom item, and the screen will not display properly unless I replace that custom control with an actual button, however none of the visual displays work as they did in 16 bit, and all I get is a blank button. What is the easiest way to convert over these buttons so that the are not blank and work as they did in 16bit? FYI, I am *extremely* impressed (and grateful) at how smoothly things have progressed, even with the difficulty caused by the corruption in the original DLL file. I'm very much enjoying the conversion process thus far, but I like some advice on the best way to convert the buttons.
Conversion of Buttons to 32 Bit
Michael, It seems as you are using Borland buttons in your dialogs. If yes, then you need to add this code in your app: [code=fw:29ili5k5]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Local</span> hDLL := LoadLibrary<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"bwcc32.dll"</span> <span style="color: #000000;">&#41;</span> <br /><br />BWCCRegister<span style="color: #000000;">&#40;</span> GetResources<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br /><br />...your code...<br /><br />FreeLibrary<span style="color: #000000;">&#40;</span> hDLL <span style="color: #000000;">&#41;</span> <br />&nbsp;</div>[/code:29ili5k5] and also add this function declaration at the bottom of your main PRG: [code=fw:29ili5k5]<div class="fw" id="{CB}" style="font-family: monospace;"><br />DLL <span style="color: #00C800;">FUNCTION</span> BWCCRegister<span style="color: #000000;">&#40;</span> hInst AS LONG <span style="color: #000000;">&#41;</span> AS WORD PASCAL LIB <span style="color: #ff0000;">"BWCC32.DLL"</span><br />&nbsp;</div>[/code:29ili5k5] And copy bwcc32.dll to the folder where your EXE is located. bwcc32.dll is available in FWH\samples
Conversion of Buttons to 32 Bit
Thank you, I will give that a try.
Conversion of Buttons to 32 Bit
I have added the lines you recommended. I had inadvertently left out the loadlibrary statement. If I do not set the "no fail create" property on the box to yes, it fails to create the dialog box. If I set that property to true, I get an error 1 message, non defined id 201. If I remove the custom control in Visual Studio and add a standard button, I simply get a gray button. Are there specific property settings that I will need to set for new button control in the DLL file, or should that custom control have worked without me having to change it to a button?
Conversion of Buttons to 32 Bit
Michael, Our advise is not to use Borland controls for your migration to 32 bits. You may replace them with standard Windows buttons, and then use the Class TButtonBmp as shown in FWH\samples\TestBuBm.prg
Conversion of Buttons to 32 Bit
Thanks. I'll do that. It will take a bit more time to convert the application of course. <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> At some point I will be interested in porting this application to the mac. Just out of curiosity, how do I transfer the screen resources from a DLL file to the mac platform? Will I need to rewrite the screens in pure code to transfer it to the Mac, or can I import an RC file in some way?
Conversion of Buttons to 32 Bit
MIchael, > Will I need to rewrite the screens in pure code Yes, thats the only way by now. Anyhow, you may use "CrossOver" to directly run your Windows app on the Mac.
Conversion of Buttons to 32 Bit
Thanks for the info on screens and the MAC. I assume that is also the case for LINUX ports as well?
Conversion of Buttons to 32 Bit
Michael, In Linux you can use Glade to design your screens, and in Mac you can use "Interface Builder" to design them too, but finally you have to copy the coordinates to @ ..., ... xbase sentences. In Linux we can use the Glade file format screens, as they are, but they don't behave exactly as Windows RC files.
Conversion of Buttons to 32 Bit
Is the 64 bit upgrade the same deal, or can I use the RC file in 64 bit? I've seriously considered updating the basic screens of the application, and rewriting them in pure code. It would take awhile, but it sounds like it would be the most universal way to go and that is a big plus. For now I'm making pretty good progress converting the button redefines to BTNBMPs. I'll finish that and finish the update to 32 bits before even thinking about converting it all to pure code. I must say Antonio, I'm very pleased with how things are going so far and I am grateful that I will not have to rewrite this application in another language. From the speed tests I've run so far, the 32 bit updates are simply awesome. I'm tickled pink with Harbour and all the updates to Fivewin and all the new features of Fivewin. Nice job. I'm sure I'll find something to nitpick about later on, but I'm very appreciative of all your hard work and all the folks at Harbour.
Conversion of access 97
Hello, Does anyone have a utility or know where I can get a utility to convert a Access 97 MDB to a current version of Access MDB? Thank you,
Conversion of access 97
Darrell Your best bet is to buy Office Pro 2007 or greater. When you open your old .Mdb in 2007 or greater .. you should be able to 'save as' to upgrade your old .mdb 97 to .mdb 2003. Stay with the .mdb format and not upgrade to .acctdb. AccDb will not work with MS Jet and you will have to add the Ms Ace OleDb to your distribution. Rick Lipkin ps .. you can also do the upgrade programatically .. create a new .mdb and then write a routine to append over the old data. [code=fw:g1bvab3u]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #B900B9;">// create the adox object</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">Try</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;catNewDB := CreateObject<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADOX.Catalog"</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; Catch<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not Create ADOX object"</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oDLG:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; End <span style="color: #00C800;">try</span><br /><br />&nbsp; &nbsp; &nbsp; <span style="color: #B900B9;">// create the table Vehicle.Mdb</span><br />&nbsp; &nbsp; &nbsp; <span style="color: #00C800;">Try</span><br />&nbsp; &nbsp; &nbsp; &nbsp; catNewDB:<span style="color: #000000;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'Provider='</span>+xProvider+<span style="color: #ff0000;">';Data Source='</span>+xSource+<span style="color: #ff0000;">';Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password='</span>+xPASSWORD <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp;Catch<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not create the table "</span>+xSource <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;oDLG:<span style="color: #000000;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; End <span style="color: #00C800;">Try</span><br /><br />&nbsp; &nbsp; &nbsp; cSay := <span style="color: #ff0000;">"Created "</span>+cDefa+<span style="color: #ff0000;">"<span style="color: #000000;">\V</span>ehicle.Mdb"</span><br />&nbsp; &nbsp; &nbsp; oSay:<span style="color: #0000ff;">ReFresh</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; SysReFresh<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; &nbsp; catNewDB:<span style="color: #000000;">ActiveConnection</span>:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; catNewDB := <span style="color: #00C800;">nil</span><br />&nbsp; &nbsp; &nbsp; SysWait<span style="color: #000000;">&#40;</span>.<span style="color: #000000;">5</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:g1bvab3u]
Conversion text Unicode to ASCII?
Hi, I have an Unicoded XML and I could not open it TXmlDocument class. I have converted xml file unicode to Ascii at external editor and there is no problem. [code=fw:l49zramr]<div class="fw" id="{CB}" style="font-family: monospace;">     <span style="color: #00C800;">LOCAL</span> oXmlDoc := TXmlDocument<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">new</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    xMLFILE := <span style="color: #ff0000;">"MyXML.xml"</span><br />    <span style="color: #00C800;">IF</span> !FILE<span style="color: #000000;">&#40;</span>xMLFILE<span style="color: #000000;">&#41;</span><br />        MsgAlert<span style="color: #000000;">&#40;</span>xMLFILE+CRLF+<span style="color: #ff0000;">"not found"</span><span style="color: #000000;">&#41;</span><br />        <span style="color: #00C800;">RETURN</span> <br />    <span style="color: #00C800;">ENDIF</span><br /><br />    oXMlDoc:<span style="color: #000000;">read</span><span style="color: #000000;">&#40;</span> Memoread<span style="color: #000000;">&#40;</span> XMLFILE <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /><br /> </div>[/code:l49zramr] Is there any way to convert a text file to ascii readed Memoread(xmlfile)? Thanks,
Conversion text Unicode to ASCII?
Execute [code=fw:227fkpq0]<div class="fw" id="{CB}" style="font-family: monospace;"><br />    &nbsp; &nbsp; &nbsp;oText:= TTxtFile<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> cFileXML <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; cText := &nbsp;oText:<span style="color: #000000;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />  ? <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span> cText, <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br />  ? <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span> cText, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span><br /><br /><br /> </div>[/code:227fkpq0] and put the results
Conversion text Unicode to ASCII?
[img:pbfei4ew]http&#58;//www&#46;objekt&#46;com&#46;tr/fwh_test/Unicode&#46;jpg[/img:pbfei4ew] Hex : FF, FE, 3C Dec : 255, 254, 60 There is "UTF-16LE" in first line XML. Thanks
Conversion text Unicode to ASCII?
Ok, try [code=fw:x22fm23h]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br /><span style="color: #00C800;">Function</span> MyFunction<span style="color: #000000;">&#40;</span> cFileXML, cFileOut <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cCad1 &nbsp; &nbsp;:= Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">239</span> <span style="color: #000000;">&#41;</span> + Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">187</span> <span style="color: #000000;">&#41;</span> + Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">191</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cCad2 &nbsp; &nbsp;:= Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span> <span style="color: #000000;">&#41;</span> + Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">254</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cCad3 &nbsp; &nbsp;:= Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">254</span> <span style="color: #000000;">&#41;</span> + Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">255</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> oText<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cText<br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cCad0 &nbsp; := <span style="color: #ff0000;">""</span><br /><br />&nbsp; &nbsp;oText:= TTxtFile<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> cFileXML <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;cText := &nbsp;oText:<span style="color: #000000;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;oText:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #00C800;">if</span> <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span> cText, <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span> == cCad2 .or. <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span> cText, <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span> == cCad3<br />&nbsp; &nbsp; &nbsp; cCad0 := Rigth<span style="color: #000000;">&#40;</span> cText, Len<span style="color: #000000;">&#40;</span> cText <span style="color: #000000;">&#41;</span> - <span style="color: #000000;">2</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">if</span> <span style="color: #0000ff;">Left</span><span style="color: #000000;">&#40;</span> cText, <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span> == cCad1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cCad0 := Rigth<span style="color: #000000;">&#40;</span> cText, Len<span style="color: #000000;">&#40;</span> cText <span style="color: #000000;">&#41;</span> - <span style="color: #000000;">3</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00C800;">else</span><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cCad0 &nbsp; := cText<br />&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #00C800;">endif</span><br />&nbsp; &nbsp; <span style="color: #00C800;">endif</span> &nbsp; <br />&nbsp; &nbsp; <span style="color: #00C800;">if</span> !Empty<span style="color: #000000;">&#40;</span> cCad0 <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp; &nbsp; &nbsp; Memowrit<span style="color: #000000;">&#40;</span> cFileOut, cCad0 <span style="color: #000000;">&#41;</span> &nbsp; &nbsp;<br />&nbsp; &nbsp;<span style="color: #00C800;">endif</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// &nbsp; ... / ...</span><br />&nbsp;</div>[/code:x22fm23h]
Conversion text Unicode to ASCII?
Hi, I have tried and the result is the same. [code=fw:2rntya63]<div class="fw" id="{CB}" style="font-family: monospace;">   Time <span style="color: #0000ff;">from</span> start: <span style="color: #000000;">0</span> hours <span style="color: #000000;">0</span> mins <span style="color: #000000;">12</span> secs <br />   Error occurred <span style="color: #00C800;">at</span>: <span style="color: #000000;">10</span>/<span style="color: #000000;">12</span>/<span style="color: #000000;">2015</span>, <span style="color: #000000;">12</span>:<span style="color: #000000;">59</span>:<span style="color: #000000;">16</span><br />   Error description: <span style="color: #000000;">Error</span> BASE/<span style="color: #000000;">1004</span>  No exported <span style="color: #00C800;">method</span>: <span style="color: #000000;">DEPTH</span><br />   Args:<br />     <span style="color: #000000;">&#91;</span>   <span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> = U   <br /><br />Stack Calls<br />===========<br />   Called <span style="color: #0000ff;">from</span>:  => DEPTH<span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br />   Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">xhb</span>\txml.prg => TXMLITERATOR:<span style="color: #00C800;">NEW</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><br />   Called <span style="color: #0000ff;">from</span>: <span style="color: #000000;">xhb</span>\txml.prg => TXMLITERATORSCAN:<span style="color: #00C800;">NEW</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div>[/code:2rntya63] Thanks
Conversion text Unicode to ASCII?
Create the ASCII file and once created, read the XML (ASCII ) file are two different things [code=fw:3qaauqkj]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />&nbsp; &nbsp;MyFunction<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"MyXml.xml"</span>, <span style="color: #ff0000;">"MyAscii.xml"</span><span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// Now you use file &nbsp;"MyAscii.xml"</span><br />&nbsp;</div>[/code:3qaauqkj] <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=6&t=31092&p=179597&hilit=TXmlDocument#p179597">viewtopic.php?f=6&t=31092&p=179597&hilit=TXmlDocument#p179597</a><!-- l --> <!-- l --><a class="postlink-local" href="http://forums.fivetechsupport.com/viewtopic.php?f=3&t=30679&p=176428&hilit=TXmlDocument#p176428">viewtopic.php?f=3&t=30679&p=176428&hilit=TXmlDocument#p176428</a><!-- l -->
Conversione Time
I must converte a Time string to Number sample ctime:= "08:30" -------> 830 any suggestion ?
Conversione Time
What about :[code=fw:1p1cstvt]<div class="fw" id="{CB}" style="font-family: monospace;">cTime := <span style="color: #ff0000;">"08:30"</span><br />dTime := <span style="color: #000000;">&#40;</span>VAL<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">LEFT</span><span style="color: #000000;">&#40;</span>cTime,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> * <span style="color: #000000;">100</span><span style="color: #000000;">&#41;</span> + VAL<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">RIGHT</span><span style="color: #000000;">&#40;</span>cTime,<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span></div>[/code:1p1cstvt]
Conversione Time
thanks run ok
Conversione campo DATA (DBF) -> DATETIME (MSSQL)
Ciao a tutti Non riesco a convertire un campo data (DBF) per poterlo scrivere su MS SQL (DATETIME) Ho provato 1) "'" + STRTRAN(date(), "/", "-") + TIME() + "'" 2) "'" + STRTRAN(date(), "/", "-") + "'" grazie
Conversione campo DATA (DBF) -> DATETIME (MSSQL)
A me questo funziona: [code=fw:ujmi5571]<div class="fw" id="{CB}" style="font-family: monospace;">oRs:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"NomeCampo"</span> <span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span> = DATE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></div>[/code:ujmi5571] EMG
Conversione campo DATA (DBF) -> DATETIME (MSSQL)
Ciao Enrico grazie in realtà ero io che commettevo un errore nel costruire il comando SQL poichè non inserivo uno spazio fra STRTRAN( DTOC( DATE() ) , "/", "-") e TIME() ovvero : [code=fw:2wxlirl3]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; cSql := <span style="color: #ff0000;">"UPDATE &nbsp;"</span> + alltrim<span style="color: #000000;">&#40;</span> cNomeTabella <span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"SET DataReg = '"</span> + STRTRAN<span style="color: #000000;">&#40;</span> DTOC<span style="color: #000000;">&#40;</span> DATE<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> , <span style="color: #ff0000;">"/"</span>, <span style="color: #ff0000;">"-"</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">" "</span> + TIME<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"'"</span> + <span style="color: #ff0000;">" WHERE ..... "</span><br />&nbsp;</div>[/code:2wxlirl3] ti chiedevo perchè se inserisco una data vuota (DBF) viene inserito "01/01/1900" , la data vuota in SQL è per forza NULL ? grazie ancora Maurizio ,
Conversione campo DATA (DBF) -> DATETIME (MSSQL)
[quote="mauri.menabue":3e7pd7o0]ti chiedevo perchè se inserisco una data vuota (DBF) viene inserito "01/01/1900" , la data vuota in SQL è per forza NULL ?[/quote:3e7pd7o0] Sì, in SQL qualunque tipo di campo non assegnato è bene metterlo a NULL. EMG
Conversione di un file SQL (con estensione ldf e mdf) in mdb
Salve, qualche idea a riguardo ? Grazie MArco
Conversione di un file SQL (con estensione ldf e mdf) in mdb
Con questo puoi convertire un DBF in una tabella dentro un MDB. Cambiando la stringa di connessione (parametro passato al metodo Open()) puoi farlo con un tabella di qualsiasi SQL: [code:3ff2kjso]FUNCTION MAIN&#40;&#41; LOCAL oCat, oCn FERASE&#40; "new&#46;mdb" &#41; oCat = CREATEOBJECT&#40; "ADOX&#46;Catalog" &#41; oCat&#58;Create&#40; "Provider=Microsoft&#46;Jet&#46;OLEDB&#46;4&#46;0;Data Source=new&#46;mdb" &#41; oCn = CREATEOBJECT&#40; "ADODB&#46;Connection" &#41; oCn&#58;Open&#40; "Provider=Microsoft&#46;Jet&#46;OLEDB&#46;4&#46;0; Data Source=c&#58;\xharbour; Extended Properties=DBASE III" &#41; oCn&#58;Execute&#40; "SELECT * INTO NewTable IN 'new&#46;mdb' FROM Clienti" &#41; oCn&#58;Close&#40;&#41; RETURN NIL[/code:3ff2kjso] EMG
Conversione di un file SQL (con estensione ldf e mdf) in mdb
Il problema però è che non ho sql server installato. Gli archivi in questione mi sono stati forniti da uno studio. Marco
Conversione di un file SQL (con estensione ldf e mdf) in mdb
Allora installa MSDE. Altrimenti temo non ci sia niente da fare. EMG
Conversione di un file SQL (con estensione ldf e mdf) in mdb
Sai se esiste una versione Free di MSDE e dove scaricarla ? Ho cercato su google ma mi esce di tutto. Marco
Conversione di un file SQL (con estensione ldf e mdf) in mdb
[url:3rlpjvtw]http&#58;//www&#46;microsoft&#46;com/downloads/details&#46;aspx?FamilyId=413744D1-A0BC-479F-BAFA-E4B278EB9147&displaylang=it[/url:3rlpjvtw] EMG
Conversione di un file SQL (con estensione ldf e mdf) in mdb
Grazie. Ho però un problema, quando cerco di aprire il file ottengo l'errore "MS SQL Server DB provider not found" e "MS SQL Server odbc drive not found" probabilmente non vengono installati con l'installazione MSDE standard. Ti sono già capitati questi problemi e sai che driver scaricare ? Grazie Marco
Conversione di un file SQL (con estensione ldf e mdf) in mdb
Io ho installato l'MSDE che ti ho detto e non ho avuto problemi. EMG
Conversions
Hi Everybody, A while ago I came across a function STR2HEX() ... I have no idea how I found this. 1. Where is this documented ... I can't find it under FWH or xHarbour. 2. Is there a similar function to convert Hex to Dec ? Thanks, Jeff
Conversions
Jeff, They are FWH functions: STR2HEX( cStr ) --> cHexStr HEX2STR( cHexStr ) --> cStr
Conversions
code sample: [code:1bq857op] MsgInfo&#40; Str2Hex&#40; "Hello" &#41; &#41; MsgInfo&#40; Hex2Str&#40; Str2Hex&#40; "Hello" &#41; &#41; &#41; [/code:1bq857op]
Conversión Archivos TXT sin chr(13)
Hola Gente ! Tengo un archivo con formato TXT, de ARBA (retenciones de Ingresos Brutos de la Provincia de Buenos Aires), el cual descargaba todos los meses y convertía directamente con un APPEND FROM para generar un DBF. Resulta que a partir de 2 meses hasta la fecha, el mismo archivo no puedo convertirlo (con el APPEND FROM), ya que no contiene el caracter '0D' o sea el chr(13). La pregunta es: ¿ cómo puedo hacer para agregarle al archivo txt el caracter chr(13) para después convertilo con APPEND FROM ?, Cualquier alternativa será bienvenida ! Les dejo una pequeña muestra en las imágenes. Desde ya, muy agradecido por las molestias. Saludos a todos ! Pedro Lavallén - Argentina - San Luis. [img:10w5q0jf]http&#58;//www&#46;lav-sis&#46;com&#46;ar/arba1&#46;jpg[/img:10w5q0jf] [img:10w5q0jf]http&#58;//www&#46;lav-sis&#46;com&#46;ar/arba2&#46;jpg[/img:10w5q0jf]
Conversión Archivos TXT sin chr(13)
Pedro, Has repetido las imágenes en vez de poner la segunda imagen Aguardamos para verla <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) -->
Conversión Archivos TXT sin chr(13)
Prueba asi [code=fw:3stqctwj]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp;hb_Memowrit<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"mifichero.txt"</span>, StrTran<span style="color: #000000;">&#40;</span> hb_MemoRead<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"mifichero.txt"</span> <span style="color: #000000;">&#41;</span>, Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">10</span> <span style="color: #000000;">&#41;</span>, Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">13</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:3stqctwj]
Conversión Archivos TXT sin chr(13)
Hola Cnavarro ! gracias por las respuesta, pero no funciona. se queda colgado un tiempo largo y tengo que salir con 'Esc' Ahora que puse bien los gráficos de arriba (que me había olvidado poner el segundo) lo único que quiero hacer es agregarle (al segundo) es el caracter '0D' o sea el chr(13) antes del '0a' (CHR10). Saludos !
Conversión Archivos TXT sin chr(13)
Mira: [url:1hxrcakg]http&#58;//www&#46;pctoledo&#46;com&#46;br/forum/viewtopic&#46;php?f=1&t=17386[/url:1hxrcakg] [url:1hxrcakg]http&#58;//fivewin&#46;com&#46;br/index&#46;php?/topic/16201-arquivo-txtmemowritcaracter-especial-%1A/[/url:1hxrcakg] [url:1hxrcakg]https&#58;//www&#46;lawebdelprogramador&#46;com/foros/Clipper-FiveWin/809976-Archivos-de-texto-en-clipper&#46;html[/url:1hxrcakg] Regards, Saludos.
Conversión Archivos TXT sin chr(13)
Efectivamente, debería ser así [code=fw:2n87j56q]<div class="fw" id="{CB}" style="font-family: monospace;"><br />   hb_Memowrit<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"mifichero.txt"</span>, StrTran<span style="color: #000000;">&#40;</span> hb_MemoRead<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"mifichero.txt"</span> <span style="color: #000000;">&#41;</span>, Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">10</span> <span style="color: #000000;">&#41;</span>, CRLF <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /> </div>[/code:2n87j56q] Lo que no justifica que el programa se quede colgado como dices Es muy grande el fichero? Si lo haces paso a paso, sería así [code=fw:2n87j56q]<div class="fw" id="{CB}" style="font-family: monospace;"><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cStr &nbsp; &nbsp; := hb_MemoRead<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"mifichero.txt"</span> <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;<span style="color: #00C800;">local</span> cTmp &nbsp; := StrTran<span style="color: #000000;">&#40;</span> cStr, Chr<span style="color: #000000;">&#40;</span> <span style="color: #000000;">10</span> <span style="color: #000000;">&#41;</span>, CRLF <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? cTmp<br />   hb_Memowrit<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"mifichero.txt"</span>, cTmp <span style="color: #000000;">&#41;</span><br /> </div>[/code:2n87j56q]
Conversión Archivos TXT sin chr(13)
Cnavarro: Excelente. Funciona perfectamente !!! Y si, el archivo es grande, tiene 3.800.000 reistros, por eso tarda. Les agradezco también a los otros compañeros por sus respuestas, pero usé la íltima respuesta del amigo Cnavarro y funcionó de 10 ! Saludos !!!
Conversión de C++ a Clipper/FW
Hola, buenas tardes Estoy trabajando con una función de terceros que me devuelve el valor 100729898. Si este valor se convierte a HEX, se obtiene 601042A, que según la documentación de la función de terceros se corresponde con 4 valores, el 6, el 01, el 04 y el 42, o sea, 6.01.04.42 Según la info de dicha función, este es el código que usan para presentarlo en C++: [code=fw:2t02agyw]<div class="fw" id="{CB}" style="font-family: monospace;"><br />DWORD dwVersion = NET_DVR_GetSDKBuildVersion<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <br />csTemp.Format<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"HCNetSDK V%d.%d.%d.%d"</span>, <span style="color: #000000;">&#40;</span>0xff000000 & dwVersion<span style="color: #000000;">&#41;</span>>><span style="color: #000000;">24</span>,\<br />   <span style="color: #000000;">&#40;</span>0x00ff0000 & dwVersion<span style="color: #000000;">&#41;</span>>><span style="color: #000000;">16</span>,\<br />   <span style="color: #000000;">&#40;</span>0x0000ff00 & dwVersion<span style="color: #000000;">&#41;</span>>><span style="color: #000000;">8</span>,\<br />   <span style="color: #000000;">&#40;</span>0x000000ff & dwVersion<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br /><span style="color: #B900B9;">//%.d,0x0000ff & dwVersion,build NO. do not expose</span><br /> </div>[/code:2t02agyw] O esta otra función, que me devuelve 393217, y se supone que debe de interpretarse como 20200527, mediente este código en C++: [code=fw:2t02agyw]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><br />void Demo_SDK_Version<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #000000;">&#123;</span><br />    unsigned int uiVersion = NET_DVR_GetSDKBuildVersion<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br /> <br />    char strTemp<span style="color: #000000;">&#91;</span><span style="color: #000000;">1024</span><span style="color: #000000;">&#93;</span> = <span style="color: #000000;">&#123;</span> <span style="color: #000000;">0</span> <span style="color: #000000;">&#125;</span>;<br />    sprintf_s<span style="color: #000000;">&#40;</span>strTemp, <span style="color: #ff0000;">"HCNetSDK V%d.%d.%d.%d<span style="color: #000000;">\n</span>"</span>, \<br />        <span style="color: #000000;">&#40;</span>0xff000000 & uiVersion<span style="color: #000000;">&#41;</span> >> <span style="color: #000000;">24</span>, \<br />        <span style="color: #000000;">&#40;</span>0x00ff0000 & uiVersion<span style="color: #000000;">&#41;</span> >> <span style="color: #000000;">16</span>, \<br />        <span style="color: #000000;">&#40;</span>0x0000ff00 & uiVersion<span style="color: #000000;">&#41;</span> >> <span style="color: #000000;">8</span>, \<br />        <span style="color: #000000;">&#40;</span>0x000000ff & uiVersion<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />    printf<span style="color: #000000;">&#40;</span>strTemp<span style="color: #000000;">&#41;</span>;<br /><span style="color: #000000;">&#125;</span><br /> </div>[/code:2t02agyw] ¿Hay algo similar en Clipper/Fivewin o funciones específicas para trabajar con números binarios? Gracias.
Conversión de C++ a Clipper/FW
Eloy, ? hb_NumToHex( 100729898 ) ? hb_HexToNum( "601042A" )
Conversión de cadena a número con VAL
Estoy conviertiendo una larga cadena alfanumérica en numérica con VAL y los resultados son desconcertantes ¿Existe un longitud máxima numérica para esta conversión? Estos son los resultados que obtengo: cCadena:= "21030903590010003692142800" msginfo(cCadena) resultado = 21030903590010003692142800 msginfo(val(cCadena)) resultado = 21030903590010000850000000.000000 ¿Existe alguna solución para esto?
Conversión de cadena a número con VAL
Me resisto a creer que esto no se pueda hacer en nuestro entorno de programación. El ejemplo práctico es el siguiente: Se trata de calcular los dígitos de control del IBAN de una cuenta bancaria, es decir, dividir por 97 el número 21030903590010003692142800 para sacar el resto. ¿A alguien le ha ocurrido algo parecido? Sería la primera vez que no puedo hacer algo con FWH.
Conversión de cadena a número con VAL
Manuel, No tiene nada que ver FWH, es el compilador y aparentemente no es posible. Quizá se pueda hacer una rutina en C que resuelva esta carencia. Saludos.
Conversión de cadena a número con VAL
Hola, Manuel Yo me encontre con el mismo problema, al final hice esta función. Con esta funció conseguí el resto de una division pasandole una cadena de números. [code=fw:3kz6xvub]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">Function</span> ModString<span style="color: #000000;">&#40;</span>cString,nDiv<span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">Local</span> cP1,nPS:= <span style="color: #000000;">1</span>,nLS,cP2,cP3<br /><span style="color: #00C800;">Local</span> cQc:= <span style="color: #ff0000;">""</span>,nReste<br />nLS:= Len<span style="color: #000000;">&#40;</span>cString<span style="color: #000000;">&#41;</span><span style="color: #000000;">+1</span><br /><br /><br />nP1:= Val<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">Substr</span><span style="color: #000000;">&#40;</span>cString,<span style="color: #000000;">1</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br />nPS++<br /><span style="color: #00C800;">Do</span> <span style="color: #00C800;">While</span> nPS <= nLS<br />    <span style="color: #00C800;">If</span> nP1 >= nDiv<br />        cQc+= Str<span style="color: #000000;">&#40;</span> Int<span style="color: #000000;">&#40;</span>nP1 / nDiv<span style="color: #000000;">&#41;</span> ,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br />        nReste:= <span style="color: #00C800;">Mod</span><span style="color: #000000;">&#40;</span>nP1 , nDiv <span style="color: #000000;">&#41;</span><br />    <span style="color: #00C800;">Else</span><br />        cQc+= <span style="color: #ff0000;">"0"</span><br />        nReste:= nP1<br />    <span style="color: #00C800;">EndIf</span><br />    nP1:= Val<span style="color: #000000;">&#40;</span> Alltrim<span style="color: #000000;">&#40;</span>Str<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span> Int<span style="color: #000000;">&#40;</span>nReste<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> + <span style="color: #0000ff;">Substr</span><span style="color: #000000;">&#40;</span>cString,nPS,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span> <br />    nPS++<br /><span style="color: #00C800;">Enddo</span><br /><br /><br /><span style="color: #00C800;">Return</span> nReste<br /> </div>[/code:3kz6xvub] Espero que te haya ayudado. Pere
Conversión de cadena a número con VAL
Horacio gracias. Ciertamente me he expresado mal, FWH nada tiene que ver en esto. Pere, muchíííísimas gracias, no sólo por verificar el problema, sobre todo por el aporte de la función. Es justamente lo que necesitaba, funciona a la perfección. Te estoy muy agradecido.
Conversión varchar en datetime produjo valor fuera intervalo
Hola, estoy reconstruyendo mi base de datos despues de la visita de un Ramsonware y me está dando este error que antes no sucedia. Lo extraño es que si acceso la base de datos directamente en el PC donde está el servidor, no sucede, sin embargo si lo hago a través de la red local se produce el error. La BD está en MSSQLEXPRESS. Agradezco de antemano quien me pueda ayudar. [quote:xa0iavxc] Application =========== Path and name: C:\SIS\DesaFW\FactNew\FactNew.exe (32 bits) Size: 5,706,240 bytes Compiler version: Harbour 3.2.0dev (r2008190002) FiveWin version: FWH 21.02 C compiler version: Borland/Embarcadero C++ 7.0 (32-bit) Windows version: 10.0, Build 22621 Time from start: 0 hours 0 mins 19 secs Error occurred at: 13/12/2022, 12:32:46 Error description: (DOS Error -2147352567) WINOLE/1007 La conversión del tipo de datos varchar en datetime produjo un valor fuera de intervalo. (0x80040E07): Microsoft OLE DB Driver for SQL Server Args: [ 1] = C UPDATE PAGBORR SET PgTipo = 'EF', PgFecha = '2022-12-13', PgHora = '12:32', PgFCobr = '2022-12-13', PgMonto = 100.00, PgSerie = '', PgBanco = '', PgPlaza = '', PgCuent = '' WHERE Id = 120 Stack Calls =========== Called from: => TOLEAUTO:EXECUTE( 0 ) Called from: C:\SIS\DesaFW\FactNew\BORRADOR.PRG => GRABACAJA( 3439 ) Called from: C:\SIS\DesaFW\FactNew\BORRADOR.PRG => PRINTDOCTO( 3280 ) Called from: C:\SIS\DesaFW\FactNew\BORRADOR.PRG => (b)INCAJABORR( 3258 ) Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK( 179 ) Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT( 1781 ) Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 ) Called from: => SENDMESSAGE( 0 ) Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND( 433 ) Called from: => TWINDOW:HANDLEEVENT( 0 ) Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 1140 ) Called from: => DIALOGBOX( 0 ) Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 ) Called from: C:\SIS\DesaFW\FactNew\BORRADOR.PRG => INCAJABORR( 3263 ) Called from: C:\SIS\DesaFW\FactNew\BORRADOR.PRG => INGPAGO( 2364 ) Called from: C:\SIS\DesaFW\FactNew\BORRADOR.PRG => (b)INIDIALOG( 1007 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 713 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 999 ) Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1817 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2051 ) Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 ) Called from: => DIALOGBOX( 0 ) Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 304 ) Called from: C:\SIS\DesaFW\FactNew\BORRADOR.PRG => BORRADOR( 596 ) Called from: C:\SIS\DesaFW\FactNew\FACTNEW.PRG => (b)MAIN( 518 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 713 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 999 ) Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1817 ) Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2051 ) Called from: .\source\classes\WINDOW.PRG => _FWH( 3559 ) Called from: => WINRUN( 0 ) Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1097 ) Called from: C:\SIS\DesaFW\FactNew\FACTNEW.PRG => MAIN( 542 ) System ====== CPU type: 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz 2304 Mhz Hardware memory: 7830 megs Free System resources: 90 % GDI resources: 90 % User resources: 90 % Windows total applications running: 6 1 , 2 , C:\WINDOWS\System32\SHELL32.dll 3 , C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.22621.608_none_f0f1837 4 Conmutación de tareas, C:\SIS\DesaFW\FactNew\FactNew.exe 5 DDE Server Window, C:\WINDOWS\System32\OLE32.DLL 6 GDI+ Window (FactNew.exe), C:\WINDOWS\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.22621.819_none_21dd7a56301966e [/quote:xa0iavxc] Esta es la instrucción donde se produce el error : [code=fw:xa0iavxc]<div class="fw" id="{CB}" style="font-family: monospace;"><br />cSql    :=  <span style="color: #ff0000;">"UPDATE PAGBORR SET "</span><br />cSql    +=  <span style="color: #ff0000;">"PgTipo = '"</span> + aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span> + <span style="color: #ff0000;">"', "</span>                           <span style="color: #B900B9;">// PgTipo</span><br />cSql    +=  <span style="color: #ff0000;">"PgFecha = "</span>  + FW_ValToSQL<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">", "</span>  <span style="color: #B900B9;">// PgFecha</span><br />cSql    +=  <span style="color: #ff0000;">"PgHora = '"</span> + <span style="color: #0000ff;">SUBSTR</span><span style="color: #000000;">&#40;</span>TIME<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>,<span style="color: #000000;">1</span>,<span style="color: #000000;">5</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"', "</span>                           <span style="color: #B900B9;">// PgHora</span><br />cSql    +=  <span style="color: #ff0000;">"PgFCobr = "</span>  + FW_ValToSQL<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">3</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">", "</span>      <span style="color: #B900B9;">// PgFCobr</span><br />cSql    +=  <span style="color: #ff0000;">"PgMonto = "</span>  + STR<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">2</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">", "</span>              <span style="color: #B900B9;">// PgMonto</span><br />cSql    +=  <span style="color: #ff0000;">"PgSerie = '"</span> + RTRIM<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">4</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"', "</span>           <span style="color: #B900B9;">// PgSerie</span><br />cSql    +=  <span style="color: #ff0000;">"PgBanco = '"</span> + RTRIM<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">5</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"', "</span>           <span style="color: #B900B9;">// PgBanco</span><br />cSql    +=  <span style="color: #ff0000;">"PgPlaza = '"</span> + RTRIM<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">6</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"', "</span>           <span style="color: #B900B9;">// PgPlaza</span><br />cSql    +=  <span style="color: #ff0000;">"PgCuent = '"</span> + RTRIM<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">7</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> + <span style="color: #ff0000;">"' "</span>            <span style="color: #B900B9;">// PgCuent</span><br />cSql    += <span style="color: #ff0000;">"WHERE Id = "</span> + STR<span style="color: #000000;">&#40;</span>aPAGBORR<span style="color: #000000;">&#91;</span>nIndM, <span style="color: #000000;">8</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>              <span style="color: #B900B9;">// Id</span><br />oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span> cSql <span style="color: #000000;">&#41;</span><br /> </div>[/code:xa0iavxc]
Conversión varchar en datetime produjo valor fuera intervalo
Estimado Gonzalo, Mira lo que responde chatGPT: [url:3jhm2puf]https&#58;//chat&#46;openai&#46;com/chat[/url:3jhm2puf] [quote:3jhm2puf]Como se soluciona este error: La conversión del tipo de datos varchar en datetime produjo un valor fuera de intervalo[/quote:3jhm2puf] [quote:3jhm2puf]Este error se produce cuando se intenta convertir un valor de tipo varchar (cadena de caracteres) en un valor de tipo datetime (fecha y hora), pero el valor en la cadena de caracteres no es una fecha y hora válidas. Para solucionar este error, debe asegurarse de que la cadena de caracteres que está intentando convertir contenga una fecha y hora válidas en un formato reconocido por SQL Server. Por ejemplo, si la cadena de caracteres es '2022-12-13', debe asegurarse de que está en el formato 'yyyy-mm-dd', donde yyyy es el año con cuatro dígitos, mm es el mes con dos dígitos y dd es el día con dos dígitos. Una vez que haya asegurado que la cadena de caracteres tiene una fecha y hora válidas en un formato reconocido, puede intentar convertirla nuevamente en un valor de tipo datetime utilizando la función de conversión de SQL Server adecuada, como CONVERT o TRY_CONVERT.[/quote:3jhm2puf] Puedes preguntarle varias veces lo mismo y te irá dando distintos resultados, con ejemplos, etc: [quote:3jhm2puf]Asegurarse de que el valor que se está intentando convertir tenga un formato válido para datetime. Por ejemplo, si se está intentando convertir el valor '2022-12-13', asegurarse de que esté en el formato correcto, es decir, 'yyyy-mm-dd'. Utilizar la función TRY_CONVERT en lugar de CONVERT para intentar realizar la conversión. La función TRY_CONVERT intentará realizar la conversión, pero si no es posible, devolverá un valor NULL en lugar de generar un error. [/quote:3jhm2puf] [quote:3jhm2puf]Este error se produce cuando se intenta convertir un valor de tipo varchar a un tipo datetime y el valor del varchar no está en un formato de fecha y hora válido. Para solucionar este problema, se puede utilizar la función CONVERT de SQL junto con un formato de fecha y hora válido para realizar la conversión. Por ejemplo, si se quiere convertir el valor '2022-12-13' al tipo datetime, se podría usar la siguiente consulta: Copy code SELECT CONVERT(datetime, '2022-12-13', 120) En este caso, el formato de fecha y hora que se está utilizando es el número 120, que indica que el valor a convertir está en el formato 'YYYY-MM-DD'. Si el valor del varchar está en un formato diferente, se deberá utilizar un formato de fecha y hora diferente en la función CONVERT para que la conversión sea exitosa.[/quote:3jhm2puf]
Conversión varchar en datetime produjo valor fuera intervalo
Muchas gracias Antonio, resolví el problema, faltaban algunos atributos que asignar a la base de dato.
Conversor de Visual Basic a fichero de recursos
Hola,en <!-- m --><a class="postlink" href="http://www.vbto.net/">http://www.vbto.net/</a><!-- m --> encontraréis un conversor de Visual Basic a fichero de recursos.Saludos,Felix
Conversão para Tipo ""variant""
Olá, Como faço para declarar a função abaixo: function myfunc( var1: OleVariant): Boolean DLL32 FUNCTION myfunc( var1 AS [color=#FF0000:daup2pem]???[/color:daup2pem] ) AS BOOL PASCAL lib hWnd Obrigado,
Conversão para Tipo ""variant""
Rossine, Tienes que implementar la función en lenguaje C. No puedes usar DLL FUNCTION ... pues no tiene conversión automática a VARIANT.
Convert
Hi, I need to convert a block of code ([b:1ykj47ux]{||}[/b:1ykj47ux]) to a string. How can I do this?
Convert
If the purpose is to save the string and restore later for execution: [code=fw:21mlvy93]<div class="fw" id="{CB}" style="font-family: monospace;"> &nbsp; b := <span style="color: #000000;">&#123;</span> || <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Good"</span> <span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#125;</span><br />&nbsp; &nbsp;Eval<span style="color: #000000;">&#40;</span> b <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;c := HB_Serialize<span style="color: #000000;">&#40;</span> b <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? ValType<span style="color: #000000;">&#40;</span> c <span style="color: #000000;">&#41;</span>, Len<span style="color: #000000;">&#40;</span> c <span style="color: #000000;">&#41;</span>, STRTOHEX<span style="color: #000000;">&#40;</span> c <span style="color: #000000;">&#41;</span><br /><br />&nbsp; &nbsp;<span style="color: #B900B9;">// save the string as hex and restore</span><br /><br />&nbsp; &nbsp;b := HB_DeSerialize<span style="color: #000000;">&#40;</span> c <span style="color: #000000;">&#41;</span><br />&nbsp; &nbsp;? Eval<span style="color: #000000;">&#40;</span> b <span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:21mlvy93] But, this works with xHarbour but not with Harbour. With Harbour, no errors but HB_Serialize() returns a NULL string.
Convert
[url:2omixrrt]https&#58;//vivaclipper&#46;wordpress&#46;com/2012/12/26/code-blocks/[/url:2omixrrt] [url:2omixrrt]http&#58;//www&#46;pctoledo&#46;com&#46;br/forum/viewtopic&#46;php?f=4&t=11979[/url:2omixrrt] Regards.
Convert
Thanks !
Convert
ValToPrg() and ValToPrgExp() are not useful for Objects and Codeblocks.
Convert
Dear Rao, Just out of curiosity, I haven't really delved into the question yet. But would JSON encode and decode also be an option? Best regards, Otto
Convert
[quote="Otto":3aqjb237]Dear Rao, Just out of curiosity, I haven't really delved into the question yet. But would JSON encode and decode also be an option? Best regards, Otto[/quote:3aqjb237] Even to encode into Json, we first need to convert the codeblock into a "text" string. How? The only function available is HB_Serialize( bBlock ) --> cBinaryString and then convert into text using STRTOHEX(), before we encode it as Json or directly save into a field. Unfortunately, this function is working in xHarbour only and not in Harbour. Even there the limitation is that the codeblock should not have any references to local/static variables and static functions.
Convert
I used cMimeEnc() instead of strtohex()
Convert Clipper 5.1 to xHarbour Console app
Hi all, I am trying to convert one of my old clipper 5.1 program to a 32bit xHarbour [b:2br3g439]console[/b:2br3g439] app. I am able to generate the exe file without any errors but when I try to run the exe nothing happens and If I check the task manager it shows that the exe is running. My clipper app did not have a Main() and while compiling with xHarbour it was giving error and then I added the Function Main() in my Prg. After adding Main() it compiled without any errors and generated the exe file. Is there anything specific that I have to consider while converting the Old Clipper 5.1 app to a xHourbour console app ? Regards Anser
Convert Clipper 5.1 to xHarbour Console app
The following thread helped me to solve the issue [url:1zf0h524]http&#58;//forums&#46;fivetechsupport&#46;com/viewtopic&#46;php?f=3&t=17066[/url:1zf0h524] Solution : I got it working by adding the xHarbour lib GTWIN to my .rmk file Also added the following procedure to my main prg to solve the problem [code=fw:1zf0h524]<div class="fw" id="{CB}" style="font-family: monospace;">procedure FW_GT<br /><span style="color: #00C800;">return</span></div>[/code:1zf0h524] Regards Anser
Convert Clipper 5.1 to xHarbour Console app
Can anybody confirm that in Console mode app the command "Restore from file.mem additive" is supported or not The following line is giving Runtime error [code=fw:3rq4csyk]<div class="fw" id="{CB}" style="font-family: monospace;">restore <span style="color: #0000ff;">from</span> &<span style="color: #000000;">&#40;</span>dbpath+<span style="color: #ff0000;">"indexer.mem"</span><span style="color: #000000;">&#41;</span> additive</div>[/code:3rq4csyk] [code=fw:3rq4csyk]<div class="fw" id="{CB}" style="font-family: monospace;">Unrecoverable Error <span style="color: #000000;">9100</span>:<br /><span style="color: #000000;">Restore</span> failed, Unsupported type:<span style="color: #000000;">65476</span> <span style="color: #00C800;">for</span> MINDEXER</div>[/code:3rq4csyk] MINDEXER is a date variable available in the .mem file The following are my observations: * I am testing it in Vista 32bit. * I am getting run time errors here and there (Solving the problems one by one). Not very sure whether the effort is worth or not. * The screen size is small (Same as the 16 bit Clipper app). * The screen is scrolling up and down inside the console window. * The console window does not close automatically when I quit my app. I have to click the close button. * App .Exe is functioning very fast compared to 16 bit clipper App .exe Regards Anser
Convert Clipper 5.1 to xHarbour Console app
Recomendado con app consolas poner al inicio de la aplicacion [code=fw:3uwl6mwb]<div class="fw" id="{CB}" style="font-family: monospace;"><br />...<br />REQUEST GT_WIN<br />...<br />PROCEDURE Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />  ...<br />  SetMode<span style="color: #000000;">&#40;</span><span style="color: #000000;">25</span>,<span style="color: #000000;">80</span><span style="color: #000000;">&#41;</span><br />  ...<br /><br /><span style="color: #00C800;">RETURN</span><br /> </div>[/code:3uwl6mwb] Cuidado con los comando SAVE TO .. y RESTORE FROM ... Por el asunto de la limitante en el tamaño de los nombres de variables 10 caracteres en Clipper dicha limitante no existe en harbour. ... salu2 carlos vargas
Convert Clipper 5.1 to xHarbour Console app
Dear Mr.Carlos, Thank you for providing the hint. The command SetMode(25,80) was helpful. By adding SetMode(25,80), the screen flickering and scrolling problem solved. I deleted all Obj/C files generated by xHarbour compiler and then recompiled again and found that the Restore from <Memfile.mem> additive is working fine. Recompiling also solved the problem in closing the Console window. Now when I quit my console app, the console window is also closed automatically (As desired). It seems that the only problem left is the screen painting of a Browser Object while moving the cursor highlight bar (A general purpose browser designed with the Tbrowse object of clipper.). In clipper it is working fine. Not sure what has to be modified to solve this particular problem <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? --> I am using xHarbour and have linked only the following xHarbour Libs rtl.lib vm.lib [b:1sgsv9zq]gtwin.lib [/b:1sgsv9zq] lang.lib macro.lib dbfntx.lib rdd.lib dbfcdx.lib dbffpt.lib hbsix.lib hbsix.lib debug.lib common.lib pp.lib pcrepos.lib I tried the command which you have specified [b:1sgsv9zq]REQUEST GT_WIN[/b:1sgsv9zq] But it is giving me error (Function not found) The command REQUEST HB_GT_WIN_DEFAULT is working fine Regards Anser
Convert DBF 2 SQL
We have had several threads about converting DBF files to SQL but they all seem to end unresolved. Years ago I remember a utility that did it with no problem, but can't seem to find one now that I'm sure is safe. ( Sometimes the downloads bring viruses ). Some resources say to import the data in to Access and then import it into a SQL database. When trying that with the latest version of Access it tells me the .dbf file is not in the expected format. It works just fine. I noticed a reference to the DBF2SQL.prg available in FWH, but some comments stated it would not work with FPT files. Has anyone found a reasonable way to do this ? Ultimately all of my clients, with about 115 DBF files each, would need to be converted. Many of those files do have memo fields. I likely would want to use MSSQL Express ( since I compile with Microsoft Visual Studio ) though I am also studying MySql.
Convert DBF 2 SQL
FWH has this built-in functionality for many years (from June 2013) [code=fw:2l223jyr]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCn := FW_OpenAdoConnection<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> <span style="color: #ff0000;">"MSSQL"</span>, <span style="color: #ff0000;">"SQLEXPRESS"</span>, <span style="color: #000000;">&#91;</span>cDataBase<span style="color: #000000;">&#93;</span>, <span style="color: #ff0000;">"SA"</span>, cPassWord <span style="color: #000000;">&#125;</span>, .t. <span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">if</span> oCn == <span style="color: #00C800;">nil</span><br />   ? <span style="color: #ff0000;">"Connect Fail"</span> <br /><span style="color: #00C800;">else</span><br />   FW_AdoImportFromDBF<span style="color: #000000;">&#40;</span> oCn, <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\s</span>amples<span style="color: #000000;">\c</span>ustomer.dbf"</span> <br />   oRs := FW_OpenRecordSet<span style="color: #000000;">&#40;</span> oCn, <span style="color: #ff0000;">"customers"</span> <span style="color: #000000;">&#41;</span><br />   XBROWSER oRs FASTEDIT<br />   oRs:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><span style="color: #00C800;">endif</span><br /> </div>[/code:2l223jyr] The same syntax applies Access, MSSql server, Oracle, MySql or any other server using ADO.
Convert DBF 2 SQL
For MySQL/MariaDB using FWH buit-in functions: [code=fw:1vp66l7b]<div class="fw" id="{CB}" style="font-family: monospace;"><br />oCn := maria_Connect<span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#123;</span> <span style="color: #00C800;">server</span>, database, user, password <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span><br />oCn:<span style="color: #000000;">ImportFromDBF</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"c:<span style="color: #000000;">\f</span>wh<span style="color: #000000;">\s</span>amples<span style="color: #000000;">\c</span>ustomer.dbf"</span> <span style="color: #000000;">&#41;</span><br /><span style="color: #B900B9;">//</span><br />oRs := oCn:<span style="color: #000000;">RowSet</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"customer"</span> <span style="color: #000000;">&#41;</span><br />XBROWSER oRs FASTEDIT<br />oRs:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />&nbsp;</div>[/code:1vp66l7b]
Convert DBF 2 SQL
Tim If you are looking to migrate your application to MSSql .. I would like to offer my help .. As you know, I have been using ADO for many years and my favorite RDMS is Sql Server for Enterprise applications and MS Access for local portable applications. There are several ways to code your application using the ADO rdd which uses much of your .dbf code or dive straight in and use the ADO class and methods ( my choice ). Microsoft Ado info [url] <!-- m --><a class="postlink" href="https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/recordset-object-ado?view=sql-server-2017">https://docs.microsoft.com/en-us/sql/ad ... erver-2017</a><!-- m --> [/url] FiveWin Ado coding examples [url] <!-- m --><a class="postlink" href="https://wiki.fivetechsoft.com/doku.php?id=ado-related_stuffs">https://wiki.fivetechsoft.com/doku.php? ... ted_stuffs</a><!-- m --> [/url] Rao ( see above post ) has done some great work in creating many of the ADO wrappers you can use to simplify your connections and recordsets .. look at your FiveWin folder \Samples\Source\Function\AdoFuncs.prg Like you .. I have a commercial FleetManagemt application targeted at State and Federal Agencies .. which does have a major core garage shop module . I have a trial version that uses the portable ms Access database .. you are welcome to visit my website and download .. [url] <!-- m --><a class="postlink" href="http://www.sabms.com/fleetpro360/">http://www.sabms.com/fleetpro360/</a><!-- m --> [/url] Let me know if I can help you .. Rick Lipkin
Convert DBF 2 SQL
Rich, I have looked at your information ( actually have it all in OneNote pages ). I figured I would first try to import the DBF files into Access, and since I have the latest version, I figured that would be simple. Sadly, it keeps giving me the error that the DBF is not in the proper format. Hmmmm .... not sure why that occurs.
Convert DBF 2 SQL
Tim You can convert your dbf data the old fashioned way .. with code .. It goes something like this .. look in your samples folder for adorick.prg Create your Access table as 2003 .mdb .. NOT .accdb .. you will need the ACE client of you use .accdb .. .mdb uses the built in ole MS jet provider .. [code=fw:10n9tqs5]<div class="fw" id="{CB}" style="font-family: monospace;"><br />xPROVIDER := <span style="color: #ff0000;">"Microsoft.Jet.OLEDB.4.0"</span><br />xSOURCE   := cDEFA+<span style="color: #ff0000;">"<span style="color: #000000;">\R</span>ick.mdb"</span><br />cRDD      := xPROVIDER+<span style="color: #ff0000;">" -- "</span>+xSOURCE<br /><br /> <span style="color: #B900B9;">// global connection string</span><br />xCONNECT := <span style="color: #ff0000;">'Provider='</span>+xPROVIDER+<span style="color: #ff0000;">';Data Source='</span>+xSOURCE<br /><br /><span style="color: #00C800;">If</span> .not. File<span style="color: #000000;">&#40;</span> cDefa+<span style="color: #ff0000;">"<span style="color: #000000;">\R</span>ick.mdb"</span> <span style="color: #000000;">&#41;</span><br /><br />   Ferase<span style="color: #000000;">&#40;</span> cDefa+<span style="color: #ff0000;">"<span style="color: #000000;">\R</span>ick.mdb"</span> <span style="color: #000000;">&#41;</span><br /><br />   <span style="color: #B900B9;">// create the adox object</span><br />   <span style="color: #00C800;">Try</span><br />      catNewDB := CreateObject<span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"ADOX.Catalog"</span><span style="color: #000000;">&#41;</span><br />   Catch<br />      <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not Create ADOX object"</span><span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />   End <span style="color: #00C800;">try</span><br /><br />   <span style="color: #B900B9;">// create the table Rick.mdb</span><br />   <span style="color: #00C800;">Try</span><br />     catNewDB:<span style="color: #000000;">Create</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">'Provider='</span>+xProvider+<span style="color: #ff0000;">';Data Source='</span>+xSource+<span style="color: #ff0000;">';Jet OLEDB:Engine Type=5'</span> <span style="color: #000000;">&#41;</span><br />   Catch<br />     <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not create the table "</span>+xSource <span style="color: #000000;">&#41;</span><br />     <span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />   End <span style="color: #00C800;">Try</span><br /><br />   <span style="color: #00C800;">Try</span><br />     oCn  := CREATEOBJECT<span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADODB.Connection"</span> <span style="color: #000000;">&#41;</span><br />   Catch<br />     <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not create the ADO object for connection"</span><span style="color: #000000;">&#41;</span><br />   End <span style="color: #00C800;">Try</span><br /><br />   <span style="color: #00C800;">TRY</span><br />     oCn:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span> xCONNECT <span style="color: #000000;">&#41;</span><br />   CATCH oErr<br />     <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Could not open a Connection to Database "</span>+xSource <span style="color: #000000;">&#41;</span><br />     <span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span>.F.<span style="color: #000000;">&#41;</span><br />   END <span style="color: #00C800;">TRY</span><br /><br /><br />   cSQL := <span style="color: #ff0000;">"CREATE TABLE CUSTOMER"</span><br />   cSQL += <span style="color: #ff0000;">"( "</span><br />   cSQL += <span style="color: #ff0000;">"[CUSTOMEREID] char(18) NOT NULL, "</span><br />   cSQL += <span style="color: #ff0000;">"[LAST NAME] char(30) NULL, "</span><br />   cSQL += <span style="color: #ff0000;">"[FIRST NAME] char(30) NULL, "</span><br />   cSQL += <span style="color: #ff0000;">"[MID INIT] char(30) NULL, "</span><br />   cSQL += <span style="color: #ff0000;">"[ADDRESS1] char(30) NULL, "</span><br />   cSQL += <span style="color: #ff0000;">"[CITY] char(30) NULL, "</span><br />   cSQL += <span style="color: #ff0000;">"[STATE] char(30) NULL, "</span><br />   cSQL += <span style="color: #ff0000;">"CONSTRAINT PK_USERINFO PRIMARY KEY ( CUSTOMEREID )"</span><br />   cSQL += <span style="color: #ff0000;">" )"</span><br /><br />   <span style="color: #00C800;">Try</span><br />      oCn:<span style="color: #000000;">Execute</span><span style="color: #000000;">&#40;</span> cSQL <span style="color: #000000;">&#41;</span><br />   Catch<br />      <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Table CUSTOMER Failed"</span> <span style="color: #000000;">&#41;</span><br />      <span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span>.f.<span style="color: #000000;">&#41;</span><br />   End <span style="color: #00C800;">try</span><br /><br />   oCn:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />   oCn := <span style="color: #00C800;">nil</span><br /><br /><span style="color: #00C800;">Endif</span><br /><br />oRsCust := TOleAuto<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"ADODB.Recordset"</span> <span style="color: #000000;">&#41;</span><br />oRsCust:<span style="color: #000000;">CursorType</span>     := <span style="color: #000000;">1</span>        <span style="color: #B900B9;">// opendkeyset</span><br />oRsCust:<span style="color: #000000;">CursorLocation</span> := <span style="color: #000000;">3</span>        <span style="color: #B900B9;">// local cache</span><br />oRsCust:<span style="color: #000000;">LockType</span>       := <span style="color: #000000;">3</span>        <span style="color: #B900B9;">// lockoportunistic</span><br /><br /><span style="color: #B900B9;">// start .dbf conversion</span><br /><br />cSQL := <span style="color: #ff0000;">"SELECT * FROM CUSTOMER"</span><br /><span style="color: #00C800;">TRY</span><br />   oRsCust:<span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span> cSQL, xCONNECT <span style="color: #000000;">&#41;</span><br />CATCH oErr<br />   <span style="color: #0000ff;">MsgInfo</span><span style="color: #000000;">&#40;</span> <span style="color: #ff0000;">"Error in Opening CUSTOMER table here"</span> <span style="color: #000000;">&#41;</span><br />   <span style="color: #00C800;">RETURN</span><span style="color: #000000;">&#40;</span>.F.<span style="color: #000000;">&#41;</span><br />END <span style="color: #00C800;">TRY</span><br /><br /><span style="color: #0000ff;">Select</span> <span style="color: #000000;">1</span><br />Use Customer via <span style="color: #ff0000;">"DBFCDX"</span> EXCL<br /><br />Go top<br /><br /><span style="color: #00C800;">DO</span> <span style="color: #00C800;">while</span> .not. eof<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />      <br />     oRsCust:<span style="color: #000000;">AddNew</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />     oRsCust:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"CustomerEid"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>  := <span style="color: #ff0000;">"011111111111111111"</span>  <span style="color: #B900B9;">// generate any random number for your primary key</span><br />     oRsCust:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Last Name"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>     := a->LastName<br />     oRsCust:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"First Name"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>     := a->FirstName<br />     oRsCust:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Mid Init"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>          := a->MidInit<br />     oRsCust:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"Address1"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>        := a->address1<br />     oRsCust:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"City"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>                := a->city<br />     oRsCust:<span style="color: #000000;">Fields</span><span style="color: #000000;">&#40;</span><span style="color: #ff0000;">"State"</span><span style="color: #000000;">&#41;</span>:<span style="color: #000000;">Value</span>              := a->state<br />     oRsCust:<span style="color: #0000ff;">Update</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br />    <br />     <span style="color: #0000ff;">Select</span> Customer<br />     Skip<br /><br /><span style="color: #00C800;">Enddo</span><br /><br />CLose Databases<br />oRsCust:<span style="color: #000000;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /><br /><span style="color: #00C800;">Return</span><span style="color: #000000;">&#40;</span><span style="color: #00C800;">nil</span><span style="color: #000000;">&#41;</span><br /> </div>[/code:10n9tqs5] Kinda gives you a flavor on how to use the Ado methods .. again, Rao has simplified a lot of this .. but you still need to understand the methods for cursor movement .. addNew, find, filter, update,movenext, movetop, eof, bof .. etc .. notice there is no need for record locking .. the ole provider handles all of that. Rick Lipkin