NC Clone

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 1073
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 186 times
Been thanked: 296 times

Re: NC Clone

Post by AUGE_OHR »

hi,

have fix Modi Stru Problem and add Port to HbFTP
HbFTP_Port.jpg
HbFTP_Port.jpg (35.57 KiB) Viewed 798 times
latest Version v1.26
32 Bit
HBFM_126.zip
(2.19 MiB) Downloaded 16 times
64 Bit
HBFM64_126.zip
(2.51 MiB) Downloaded 19 times

have also update Source on Github

known Problem : when start HBFM64.EXE 1st time it take much time ... :roll:
does not happen with 32 BIT App
Last edited by AUGE_OHR on Thu Sep 10, 2020 6:10 am, edited 2 times in total.
have fun
Jimmy

User avatar
danielmaximiliano
Posts: 2357
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 433 times
Been thanked: 83 times
Contact:

Post by danielmaximiliano »

Hi jimmy :
remembering the use of HBTIP since I did Email examples I had checked the tUrl class that returns an oUrl object, this class receives a cUrl text containing the following fields
cUrl.png
cUrl.png (7.92 KiB) Viewed 792 times
this kind of returns to itself

Code: Select all

METHOD New( cUrl ) CLASS TUrl
   ::SetAddress( cUrl )
   RETURN Self
This object can return incorrect as indicated here, it can behave well with domains such as example.org but wrongly before IP addresses like 192.168.1.39

study tUrl class

Code: Select all

METHOD SetAddress( cUrl ) CLASS TUrl
LOCAL aMatch, cServer, cPath

   IF ! HB_ISSTRING( cUrl )
      RETURN .F.
   ENDIF

   ::cAddress  := cUrl
   ::cProto    := ""
   ::cUserid   := ""
   ::cPassword := ""
   ::cServer   := ""
   ::cPath     := ""
   ::cQuery    := ""
   ::cFile     := ""
   ::nPort     := -1

   IF cUrl == ""
      RETURN .T.
   ENDIF

   // Top-level URL parsing. May fail.         <----- HERE
   IF Empty( aMatch := hb_regex( ::cREuri, cUrl ) )
      RETURN .F.
   ENDIF

   ::cProto := Lower( aMatch[ 2 ] )
   cServer  := aMatch[ 3 ]
   cPath    := aMatch[ 4 ]
   ::cQuery := aMatch[ 5 ]

   // server parsing (never fails)
   aMatch      := hb_regex( ::cREServ, cServer )
   ::cUserId   := aMatch[ 2 ]
   ::cPassword := aMatch[ 3 ]
   ::cServer   := aMatch[ 4 ]
   ::nPort     := Val( aMatch[ 5 ] )
   IF ::nPort < 1
      ::nPort := -1
   ENDIF

   // Parse path and file (never fails)
   aMatch := hb_regex( ::cREFile, cPath )
   ::cPath := aMatch[ 2 ]
   ::cFile := aMatch[ 3 ]

   RETURN .T.

METHOD BuildAddress() CLASS TUrl

   LOCAL cRet := ""

   IF ::cProto != NIL
      ::cProto := Lower( ::cProto )
   ENDIF

   IF ! Empty( ::cProto ) .AND. ! ::cServer == ""
      cRet := ::cProto + "://"
   ENDIF

   IF ! ::cUserid == ""
      cRet += ::cUserid
      IF ! ::cPassword == ""
         cRet += ":" + ::cPassword
      ENDIF
      cRet += "@"
   ENDIF

   IF ! ::cServer == ""
      cRet += ::cServer
      IF ::nPort > 0
         cRet += ":" + hb_ntos( ::nPort )
      ENDIF
   ENDIF

   IF ::cPath == "" .OR. ! Right( ::cPath, 1 ) == "/"
      ::cPath += "/"
   ENDIF

   cRet += ::cPath + ::cFile
   IF ! ::cQuery == ""
      cRet += "?" + ::cQuery
   ENDIF

   RETURN iif( cRet == "", NIL, ::cAddress := cRet )
It is a mistake to create an object and then send it to build another object without the proper consistency.

Code: Select all

   oUrl := tURL() :New( cUrl )
   IF EMPTY( oUrl )
      RETURN nil
   ENDIF
   
   oClient := TIpClientFtp() :new( oUrl, Sites->Log )                 // PARAM .T. TO LOG
   IF EMPTY( oClient )
      RETURN nil
   ENDIF
   oClient:nConnTimeout := 2000
   oClient:bUsePasv     := .T.

I suggest you try the following code to eliminate that IP address or domain error

Code: Select all

STATIC FUNCTION ftpConnect()

LOCAL bError    := ERRORBLOCK( { | oErr | BREAK( oErr ) } )
LOCAL lConnect  := .F.
LOCAL cUser     := sites->user
LOCAL cPassWord := desencri( sites->password )
LOCAL cServer   := sites->address
LOCAL cUrl

   cUrl := "ftp://" + ALLTRIM( cUser ) + ":" + ALLTRIM( cPassWord ) + "@" + ALLTRIM( cServer )

   oUrl := tURL() :New( cUrl )
   IF EMPTY( oUrl )
      RETURN nil
   ENDIF
   oUrl:cProto    := "ftp://"
   oUrl:cServer   := cServer
   oUrl:cUserId   := sites->user
   oUrl:cPassword := adesencri( sites->password )
   oUrl:nPort     := sites->port                                      // Numeric
     BEGIN SEQUENCE
	  oClient := TIpClientFtp() :new( oUrl, Sites->Log )                 // PARAM .T. TO LOG
        
	 RECOVER
            MsgBox('can not Open() the connection, try again ' , 'Attention message' )
            Return nil
      END

   oClient:nConnTimeout := 2000
   oClient:bUsePasv     := .T.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO

User avatar
AUGE_OHR
Posts: 1073
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 186 times
Been thanked: 296 times

Post by AUGE_OHR »

hi,
danielmaximiliano wrote:
Thu Sep 10, 2020 2:41 am
I suggest you try the following code to eliminate that IP address or domain error

Code: Select all

   cUrl := "ftp://" + ALLTRIM( cUser ) + ":" + ALLTRIM( cPassWord ) + "@" + ALLTRIM( cServer )

   oUrl := tURL() :New( cUrl )
   IF EMPTY( oUrl )
      RETURN nil
   ENDIF
   oUrl:cProto    := "ftp://"
   oUrl:cServer   := cServer
   oUrl:cUserId   := sites->user
   oUrl:cPassword := adesencri( sites->password )
   oUrl:nPort     := sites->port                                      // Numeric
     BEGIN SEQUENCE
	  oClient := TIpClientFtp() :new( oUrl, Sites->Log )                 // PARAM .T. TO LOG
	 RECOVER
            MsgBox('can not Open() the connection, try again ' , 'Attention message' )
            Return nil
      END
   oClient:nConnTimeout := 2000
   oClient:bUsePasv     := .T.
it is a good Idea using BEGIN SEQUENCE :!:

i have try that Code but end up in RECOVER :o
so i reduce it to

Code: Select all

   IF !EMPTY( nPort )
      oURL:nPort := nPort
   ENDIF
and now i got Connect again :D
hm ... perhaps i need to fill default Value to 21 as you say.
have fun
Jimmy

User avatar
AUGE_OHR
Posts: 1073
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 186 times
Been thanked: 296 times

Post by AUGE_OHR »

latest Version v1.27

32 Bit
HBFM_127.zip
(2.19 MiB) Downloaded 26 times
64 Bit
HBFM64_127.zip
(2.51 MiB) Downloaded 22 times
fixed :
fixed Thumbs ImageRelease "SlideTime"
fixed SumatraPDF Filename with Space

new :
HbFTP : default Port := 21
have fun
Jimmy

User avatar
danielmaximiliano
Posts: 2357
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 433 times
Been thanked: 83 times
Contact:

Post by danielmaximiliano »

AUGE_OHR wrote:
Wed Aug 26, 2020 8:54 pm

! Note : Source Code is avaiable under https://github.com/AugeOhr/HBFM
(no Image include in Source)
Hi Jimmy: download from the NC clone version, I could recover the \RES folder and compile, I would need the 32 and 64 bit libs that it uses and in that way to be able to correctly execute NC clone, in that way to be able to modify the FTP option of the Same.

From already thank you very much
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO

User avatar
AUGE_OHR
Posts: 1073
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 186 times
Been thanked: 296 times

Post by AUGE_OHR »

hi,
danielmaximiliano wrote:
Tue Sep 22, 2020 1:21 am
Hi Jimmy: download from the NC clone version, I could recover the \RES folder and compile, I would need the 32 and 64 bit libs that it uses and in that way to be able to correctly execute NC clone, in that way to be able to modify the FTP option of the Same.
64 Bit DLL / Lib of FreeImage is found in this Thread.
http://www.hmgforum.com/viewtopic.php?f ... 7&start=23

Code for Libxlsxwriter is still include but as i´m not able to generate 64 Bit DLL / LIB it is not active

ADO must be installed as ActiveX but have no LIB to include

---

what do you want to modify :?: SFTP ... :idea:
have fun
Jimmy

User avatar
danielmaximiliano
Posts: 2357
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 433 times
Been thanked: 83 times
Contact:

Post by danielmaximiliano »

Hi Jimmy:

As we see after general the Url when trying to connect the application remains frozen for a while until it gives an error since the URL is wrong .. that occurs when using IP addresses type B or C

Code: Select all

STATIC FUNCTION ftpConnect()

LOCAL bError
LOCAL lConnect  := .F.
LOCAL cUser     := sites->user
LOCAL cPassWord := desencri( sites->password )
LOCAL cServer   := sites->address
LOCAL nPort     := sites->Port
LOCAL cUrl, oError

   cUrl := "ftp://" + ALLTRIM( cUser ) + ":" + ALLTRIM( cPassWord ) + "@" + ALLTRIM( cServer ) + STR ( nPort )
   oUrl := tURL() :New( cUrl )
   
   IF EMPTY( oUrl )
      RETURN nil
	  else 
	   msgbox( oUrl:cAddress,"Entro"  )
   ENDIF
2020-09-22 17_02_55-FTP Client v0.1.0 modify for HMG.png
2020-09-22 17_02_55-FTP Client v0.1.0 modify for HMG.png (32.46 KiB) Viewed 618 times
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO

User avatar
AUGE_OHR
Posts: 1073
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 186 times
Been thanked: 296 times

Post by AUGE_OHR »

hi,
danielmaximiliano wrote:
Tue Sep 22, 2020 8:07 pm
As we see after general the Url when trying to connect the application remains frozen for a while until it gives an error since the URL is wrong .. that occurs when using IP addresses type B or C
i have add Port in v1.26
please get latest Source from GitHub and look into HBFTP.PRG if it work for you
https://github.com/AugeOhr/HBFM
i just have test it with Port 21
have fun
Jimmy

User avatar
danielmaximiliano
Posts: 2357
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Has thanked: 433 times
Been thanked: 83 times
Contact:

Post by danielmaximiliano »

AUGE_OHR wrote:
Tue Sep 22, 2020 8:36 pm
i have add Port in v1.26
please get latest Source from GitHub and look into HBFTP.PRG if it work for you
https://github.com/AugeOhr/HBFM
i just have test it with Port 21
Hi Jimmy, the port addition in FTP applications is to place the service on another port than the default one. as being Android that its FTP service is port 21; in this case, any other app cannot use port 21 as it is busy. that's why File Manager uses another one manually, in my case the 8556
-----------------------------------------------------------------------------------------------------------------------------------------------------------
HBtip by default assumes port 21 for FTP services that you can check in C:\Harbour\contrib\hbtip\ftpcli.prg

Code: Select all

METHOD New( oUrl, xTrace, oCredentials ) CLASS TIPClientFTP

   ::super:new( oUrl, iif( hb_defaultValue( xTrace, .F. ), "ftp", xTrace ), oCredentials )

   ::nDefaultPort := 21
   ::nConnTimeout := 3000
   ::nAccessMode  := TIP_RW  // a read-write protocol

   ::nDefaultSndBuffSize := ::nDefaultRcvBuffSize := 65536

   // precompilation of regex for better prestations
   ::RegBytes := hb_regexComp( "\(([0-9]+)[ )a-zA-Z]" )
   ::RegPasv  := hb_regexComp( "([0-9]*) *, *([0-9]*) *, *([0-9]*) *, *([0-9]*) *, *([0-9]*) *, *([0-9]*)" )

   RETURN Self
If you look inside the example you will see C:\Harbour\contrib\hbtip\tests\*.*
that the port is never added, in case the port is different, it should be able to change in the case that I requested for NC clone.

I am going to review this inconvenience that is within HBTIP to set up an IP address correctly in case of being internal class C networks such as 192.168.1.1
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO

User avatar
AUGE_OHR
Posts: 1073
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 186 times
Been thanked: 296 times

Post by AUGE_OHR »

hi,

it seem there is a big BUG in HBFM since v1.17 :shock:

after delete a File HBFM does not work correct with F3/F4 and show "black" Window or "no Image" etc. :evil:
have fun
Jimmy

Post Reply