Source language: Translate to:

hpwMimeEncodeFile question

Questions about NeoBook PlugIns

Moderator: Neosoft Support

Re: hpwMimeEncodeFile question

Postby schmutly » Fri Oct 18, 2013 6:33 am

I agree with Jose, don't stress too much about it mate,
its not a plugin issue, simply i am trying to think outside the box and i think the plugins
great..i'm sure ill work a way around it cause i dont believe in "can't be done".
I will look into trying a few ideas i have in mind, even one of your suggestion to have the header text say image:
but copy this to his folder on his site, with his publication monitoring for a image header then download the file
and show it in a window...i think my only problem will be how long it takes to upload then download, i don't think
it will be too long at all..as i setup a tiny Pub that just looped waiting for a file on his site, as soon as i sent it
and it downloaded it and showed it in Aust was only..hmm 6secs..i just want to send small screen captures of
stuff i need to train him on, having this built into what im doing will be great, save me taking a capture and email
him all the time..tedious, but ill work something out :-P
Thanks again,
Rob
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: hpwMimeEncodeFile question

Postby dec » Fri Oct 18, 2013 7:03 am

Hello Rob,

Don't worry. In principle, just with the solution I found, is possible to send images in base64. I want to provide you a good sample if finally I decide to implement such solution. And in fact I am now searching for a better solution, which allows to send the more larger text than possible. On the other hand I am sorry for the inconveniences you found on this Rob.

schmutly wrote:I agree with Jose, don't stress too much about it mate,
its not a plugin issue, simply i am trying to think outside the box and i think the plugins
great..i'm sure ill work a way around it cause i dont believe in "can't be done".
I will look into trying a few ideas i have in mind, even one of your suggestion to have the header text say image:
but copy this to his folder on his site, with his publication monitoring for a image header then download the file
and show it in a window...i think my only problem will be how long it takes to upload then download, i don't think
it will be too long at all..as i setup a tiny Pub that just looped waiting for a file on his site, as soon as i sent it
and it downloaded it and showed it in Aust was only..hmm 6secs..i just want to send small screen captures of
stuff i need to train him on, having this built into what im doing will be great, save me taking a capture and email
him all the time..tedious, but ill work something out :-P
Thanks again,
Rob
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: hpwMimeEncodeFile question

Postby dec » Fri Oct 18, 2013 2:14 pm

Hello,

The today progress. Really I have not too much advance today, even when I continue searching for a solution. But, just a couple of hours I found the manner in wich I send the text probably are not correct. So I begin to search for a right solution and I think that I found one. At the least better than the previously taken. However, the "bottleneck" continue when receive the text.

Is the form I implement the "protocol". I need to read all the received text byte by byte in order to locate the appropiate end of the stream. This is how the protocol that I can implement at this time work, however (if I am not wrong) also cause the bottleneck: less in my Delphi application, too much in the plugin, but anywat a bottleneck I think. So what can be the solution?

Another better designer protocol. But said this is absolutely more easy than made it... I continue to searching, but, as I said above, apparently today are not in vain, since at the very least we send the text apparently in the right way.

Again sorry for the inconveniences. :oops:
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: hpwMimeEncodeFile question

Postby David de Argentina » Fri Oct 18, 2013 2:19 pm

Hi dec,

May i help you ?

David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: hpwMimeEncodeFile question

Postby dec » Fri Oct 18, 2013 2:46 pm

Hello David,

I think not at this time, but I tell you if need something.

Of course anyway thanks for your interest David. ;)

David de Argentina wrote:Hi dec,

May i help you ?

David de Argentina
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: hpwMimeEncodeFile question

Postby David de Argentina » Fri Oct 18, 2013 3:09 pm

I would do something like this:
(Syntax as NeoBook style)

Sender machine:

Code: Select all
' Send 8192 bytes each time
SetVar "[CHUNK_SIZE]" "8192"

' get the number of parts to send
StrLen "[MimeEncoded_FiletoVar]" "[Len]"

' Start Process:

Loop "1" "[Len]+1" "[i]"
 
  ' calcule the first byte for read into the var with data
  Math "[CHUNK_SIZE]*([i]-1)" "0" "[OffSet]"

  ' check here if this is the last chunk
  ' is almost secure the size of the data will be < [CHUNK_SIZE]
  if "[i]" "=" "[Len]+1"
    ' Get the rest of the string
  Else
    ' get the substring with data
    Substr "[MimeEncoded_FiletoVar]" "[OffSet]" "[CHUNK_SIZE]" "[CHUNK]"
  Endif
 
  ' i would do some specifications for receiver machine, like "Send chunk number for total chunks"
  ' i would reserve some bytes prior data, for part number and part total
  ' i would use the [#255] as delimiter
 
  Setvar "[Send_Data]" "[i][#255][Len]+1[#255][CHUNK]"
 
  ' now, is time to send data
  - YOUR SEND DATA FUNCTION GOES HERE -
EndLoop

Receiver Machine

' Your listener receive Sender Data (any chunk) and fires a callback funcion

' Callback function should be like this:
Code: Select all
' first, you need know how many chunks were received
Setvar "[Received_parts]" "[Received_parts]+1"

' now, you need know witch part did you received
' Asume the Listener had created a variable "[Incoming_part]"
StrParse "[Incoming_part]" "[#255]" "Var_" "null"
SetVar "[Part_Number]" "[Var_1]"
SetVar "[Part_Total]" "[Var_2]"
SetVar "[Part_data]" "[Var_3]"

' Now, you need put data into an array
SetVar "[Chunk_[Part_Number]]" "[Part_Data]"

' if you had received the last part, you need recompose the complete file
If "[Part_Number]" "=" "[Part_Total]"
  ' check is all parts were received
  If "[Received_parts]" "=" "[Part_Total]"
    SetVar "[File]" ""
    Loop "1" "[Part_Total]" "[i]"
      if "[i]" "=" "1"
        SetVar "[File]" "[Chunk_[1]]"
      Else
        SetVar "[File]" "[File][Chunk_[i]]"
      Endif
    Endloop
    ' save file, decode, etc goes here
  Endif
Endif


My devaluated cent
David de Argentina
User avatar
David de Argentina
 
Posts: 1553
Joined: Mon Apr 04, 2005 4:13 pm
Location: Buenos Aires, Argentina

Re: hpwMimeEncodeFile question

Postby schmutly » Fri Oct 18, 2013 5:37 pm

I tried
compressing then encode the decompress/decode and was able to send a larger file
and the above code have not tried yet..but your right, as text gets larger it just fails
for some reason, as you mentioned.
I'll try the server upload/download and see if i have more luck,
Rob


hpwZlibDeCompressString "[Base64ImageText]" "[Base64ImageTextDECOMPRESS]"
npBase64DecodeFile "[Base64ImageTextDECOMPRESS]" "[SavedImagePath]" "[Result]"
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: hpwMimeEncodeFile question

Postby dec » Sat Oct 19, 2013 1:52 am

Hello Rob,

I prepare a Zip file wich contain the following:

1º A Client and Server publications (based in the plugin samples) which allows you to send text and also images (in base 64)

2º The plugin npTalk (just the NBP file) which now can handle more text than before, because incorporate the latest changes.

Please, follow this link to download the refered Zip file:

http://neoplugins.com/temp/nptalk_test.zip

You can test it, and, in principle, this necessarily work better than your currently available version of the plugin. However, remember I need to make more changes in the plugin before publish a new release.

P.S. Remember you also need my npUtil plugin in order to play with the publication samples, since I use from here their "base 64" action.
Last edited by dec on Sat Oct 19, 2013 2:15 am, edited 1 time in total.
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: hpwMimeEncodeFile question

Postby schmutly » Sat Oct 19, 2013 2:01 am

Ok, Thanks David i'll have a look at that now. :)
Yes i have those plugins, so i'm good to go.
Thanks....appreciate your time,
Rob
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: hpwMimeEncodeFile question

Postby schmutly » Sat Oct 19, 2013 2:41 am

BRILLIANT David :D :mrgreen: :D
I changed the image button to my "grab screen area" from
your npScreenAreaShot and it successfully sent an image about 1/4 size of screen.
That's GREAT for now...it works :).
If you DO improve it to grab a larger screen area be great (in future time)
but i think this will be a GOOD selling point for the plugin now.. 8-)
Now going to play some more hehe
Great work mate :)
Rob
PS: successfully sent about 640x480 size image from Guangxi,China
to Adelaide Australia...so worked across internet (so you know it works not just local).
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: hpwMimeEncodeFile question

Postby dec » Sat Oct 19, 2013 2:52 am

Hello Rob,

Glad to know. If you like can test it with larger images... just to be how the plugin (mostly the receiver) respond.

Anyway thanks for your test and again thanks for your patience Rob.

schmutly wrote:BRILLIANT David :D :mrgreen: :D
I changed the image button to my "grab screen area" from
your npScreenAreaShot and it successfully sent an image about 1/4 size of screen.
That's GREAT for now...it works :).
If you DO improve it to grab a larger screen area be great (in future time)
but i think this will be a GOOD selling point for the plugin now.. 8-)
Now going to play some more hehe
Great work mate :)
Rob
PS: successfully sent about 640x480 size image from Guangxi,China
to Adelaide Australia...so worked across internet (so you know it works not just local).
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: hpwMimeEncodeFile question

Postby schmutly » Sat Oct 19, 2013 6:58 am

OK David.
After lots of testing i can confirm that it only, for weird reason fail on the
FIRST screen grab (im using npScreenAreaShot) BUT.....after first time it
works every-time after that. :)
I even grabbed a huge area, i think it would be 1024x768 or more and it
took maybe 7 secs to transfer to my Pc (understandable) but it worked GREAT :)
So....what did you do different?
Whatever it was great achievement, and i think a great plugin now.
Thanks again for getting this working,
Robbie.
schmutly
 
Posts: 217
Joined: Fri Feb 20, 2009 4:16 pm

Re: hpwMimeEncodeFile question

Postby dec » Sat Oct 19, 2013 8:40 am

Hello,

Some advance on this issue. Above I say that the protocol I decide to implement (because apparently is the best option I can found at this time) has a "bottleneck", but, this are noted more in the plugin than in my Delphi application for tests. Ok. I apparently am wrong. In fact the protocol is not the cause of the "hang"... I can view how the text arrive more or less quickly, and, the "bottleneck" is produced when the plugin set the appropiate NeoBook variable.

Really I don't know how can enhance this (I use the "nbSetVar" NeoBook SDK provided function) at this time, but, need to be thinking.

schmutly wrote:OK David.
After lots of testing i can confirm that it only, for weird reason fail on the
FIRST screen grab (im using npScreenAreaShot) BUT.....after first time it
works every-time after that. :)


I also noted that, and, searching for the problem, I really do not found it. I save in both files the base 64 string when is generated, and then when is received. Ok. Using a file difference tool (WinMerge) I found the files differ only in one byte... and not from the begining or from the end, but some byte (char) from the "middle" of the files.

I begin to think that npTalk is not the cause of the problem, maybe npUtil and their base 64 actions, but, why this can fail at the very first time and never then? I need to investigate this in more deep. For example, sending some text and save it when send and when receive, and try to compare in search of possible differences.

schmutly wrote:I even grabbed a huge area, i think it would be 1024x768 or more and it
took maybe 7 secs to transfer to my Pc (understandable) but it worked GREAT :)
So....what did you do different?


In my local tests when we try to send more than 250 KB cause the server (receiver) hang. If wait... at the end the program respond again and the text is saved. However as I say above I think now the problem is when the plugin set the appropiate NeoBook variable, and probably later, when the publication save the content of this variable to a file.

The problem is I really don't know how to improve this. I am thinking in open a thread asking for help in order to use a more convenient function than the provided "nbSetVar", which is the provided by the NeoBook SDK. However, I need to do some more tests in order to assert this can be the cause of the "problem" and how to achieve a possible workaround.

schmutly wrote:Whatever it was great achievement, and i think a great plugin now.
Thanks again for getting this working,
Robbie.


Thanks Rob. In fact all of this happend due to my less knowledge about TCP/IP.

1º I publish npMsgs, which allow to communicate publications in the same machine. The plugin implement certain Windows API that only allow to send and receive no more than 250 chars, however, I think the plugin can be useful because I tested it (like others) and found that work very well and over a well tested code. The plugin samples shows how in 250 chars useful messages can be transmitted.

2º I found some components in Delphi which provide a very easy but apparently robust way to communicate two publications around the web. I based my work in certain Delphi sample (published by Delphi owners) and take the text limitation like something that can happend, but that never affect the plugin functionalitty, since I am thinking in npMsgs and npTalk allows to send and receiver too much than 250 chars.

3º When you ask for the possibility to send images, I know the possible text limitation and advert that maybe we cannot achieve this, but anyway can told to our receiver the URL in which the image can be found, for example. However, when I search more deeply about the text length limitation I discover for the first time that I really do not use very well the TCP/IP components...

4º If we only need to send small pieces of text (like in npMsgs) we do not found problems in npTalk, but, there is no limitation in the text length, only if the TCP/IP components are used in the way I am does. So I need to begin to search information about that and finally (I think so) implement the TCP/IP components in a better way, in the right direction, thanks mainly to Remy Lebeau indications and source samples.

5º And here we are...

Two main things to continue: why the first time we send and "text image" we do not receive the correct content... in the case the correct content are sended. And then try to found a possible way to set the NeoBook variable which store the received text in a more convenient way. Then we need to decide if can be good to impose certain limitation in the text that can be send (in terms of their length) or not. The some taks remain to be made here.

Thanks for reading and for the help.
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: hpwMimeEncodeFile question

Postby dec » Sun Oct 20, 2013 11:54 am

Hello,

A new npTalk release are now available, and also included on NeoPlugins Mega Pack and (samples) on Mega Demo.

http://neoplugins.com/?nppack

http://neoplugins.com/?npdemo

http://neoplugins.com/?plugin/nptalk

I decide to not impose any limitation at this momment, however the help recomendation is not to send more than 200 KB of text.

I will continue researching on this, but I think's a good idea to make public the new plugin release so other's can be test too. ;)
.
Enhance your NeoBook applications!
.
57 plugins, 1113 actions and 230 samples
.
NeoPlugins website: www.neoplugins.com
.
User avatar
dec
 
Posts: 1663
Joined: Wed Nov 16, 2005 12:48 am
Location: Spain

Re: hpwMimeEncodeFile question

Postby CN_Iceman » Sun Oct 20, 2013 12:08 pm

Thank's for the update David.

Greetings.
Greetings/Saludos, Jose.
www.icemansoft.es
User avatar
CN_Iceman
 
Posts: 297
Joined: Tue Mar 01, 2011 11:04 am
Location: España

PreviousNext

Return to PlugIn Discussions

Who is online

Users browsing this forum: Bing [Bot] and 2 guests