Page Index Toggle Pages: [1] 2  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Storing Binaries (Read 2465 times)
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
Storing Binaries
Feb 9th, 2011 at 4:57am
Print Post Print Post  
(Excerpt from a post by The Cow)

Uuencode uses base 16 (hexadecimal) to encode binary data. It is very inefficient for the encoding because it must use two bytes to encode every single byte that is encoded. You might consider using base64 encoding. Or, more simply, storing any large binary info in separate files and putting the path to that file in a text field in Sesame. Since displaying uuencoded (or base64) binary in a form is visually meaningless, unlikely to be usefully searchable, is likely to bloat the application file, and would likely need to dumped to a file to be used, it may well be better to start where you are likely to end up anyways. This basically true for any database engine, even those with block binary data types.

What sort of binary are intending to store?
  
Back to top
 
IP Logged
 
Rick_R
Full Member
***
Offline



Posts: 243
Joined: Jan 29th, 2010
Re: Storing Binaries
Reply #1 - Feb 9th, 2011 at 5:09am
Print Post Print Post  
Regarding binaries, I was just making a comment since I don't see a data type for binary files.

I do have a problem with the idea of storing just a pointer.  I routinely scan documents I am responding to, medical bills, medical records, and certain other documents relating to files I work on, as well as save my responses in both WordPerfect and PDF formats.  Over time, I have had to repeatedly reorganize the files.  Originally I had a "Matters" folder.  As that grew, I subdivided it into A-L and M-Z.  One client's files have unique problems, so I eventually put all of theirs in its own folder in Matters.  Then I wound up subdividing that folder.  When a case is closed, I then move it to a Closed subfolder.  And that has wound up being subdivided.

A similar thing has happened with the Case Law folder, which has hundreds of appellate court decisions, continues to grow, and occasionally has to be partially reorganized as topics are added or combined.

I don't want to move either the closed files or case law to a "storage" directory because we run into the same type of issues regularly and occasionally the same attorneys or lawfirms, so we wind up reusing parts of other letters, some of which may have not been used for several years.

However, I'm not looking to create a full-blown records management system, so it's not a concern.


HOWEVER, on that subject ... just sort of thinking out loud here ...


Thinking of the pointer "to somewhere else" really isn't appropriate.  Whether the data is stored in a db (possibly in a new field type) or externally with a pointer,  if it is part of the database system it should be stored in a database folder. So, instead of having just .db, .ddt, etc., in the \Data folder, there could be either a subfolder of that for binaries or a folder at the same level as \Data.  It would be simple to have Sesame assign each new file a unique reference number.  Sesame could even automatically create subfolders, e.g., sorting by Year or by Client, or by Account Type. The user shouldn't really care about the logistics. If an entire subfolder is moved (e.g., all accounts closed more than 5 years ago), a mass update could correct the pointers.
  
Back to top
 
IP Logged
 
jacker
Member
*
Offline



Posts: 42
Location: Milwaukee, WI
Joined: May 20th, 2008
Re: Storing Binaries
Reply #2 - Feb 10th, 2011 at 6:17pm
Print Post Print Post  
I'm trying to do something similar myself. My client is a job placement firm and they want to attach resumes to candidate records and be able to display them on command. Plus, some of the users are remote and need to easily "upload and attach" resumes over the Internet...

If I design a separate Intranet application to handle the resumes, does Sesame support a hyperlink data type that the User can click on that will launch a browser? (Or a way the mimic this behavior?)
  

Jack - I'm smokin' past the filter and it's burnin' my lips...
Back to top
YIM YIM  
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Storing Binaries
Reply #3 - Feb 10th, 2011 at 6:30pm
Print Post Print Post  
Yes, and without having to embed any binary files in the actual database. Keep the path to the file in a field and use any of the process creation commands (@Shell, @CreateProcess, etc...) to launch the application appropriate for viewing that binary file.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
jacker
Member
*
Offline



Posts: 42
Location: Milwaukee, WI
Joined: May 20th, 2008
Re: Storing Binaries
Reply #4 - Feb 10th, 2011 at 9:10pm
Print Post Print Post  
At this point, the trick will be to allow resumes to be uploaded to the server and attached to a db record from any remote location...I am thinking I will likely use something like SharePoint to do the heavy lifting...

Any suggestions or advice?
  

Jack - I'm smokin' past the filter and it's burnin' my lips...
Back to top
YIM YIM  
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Storing Binaries
Reply #5 - Feb 10th, 2011 at 9:36pm
Print Post Print Post  
Sesame has a set of FTP and HTTP commands available for uploading the files. You can also automate the local ftp client on your computer and use Sesame to kick-off the script. Once the file is up, you would need to have some way of letting the Sesame server know that this has occurred. If that server is also "on-the-net" you can use the Sesame API and your favorite scripting language. Otherwise, you will need to have a local Sesame client query a web server for information, using the previously mentioned HTTP commands.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
jacker
Member
*
Offline



Posts: 42
Location: Milwaukee, WI
Joined: May 20th, 2008
Re: Storing Binaries
Reply #6 - Feb 16th, 2011 at 3:30pm
Print Post Print Post  
Thanks for your help, Mark...

I'm a noob with the Sesame API, so let me ask you this...

How would I create a "View PDF" or "View Document" button that would launch a browser (or Acrobat or Word) and open the URL of the document?
  

Jack - I'm smokin' past the filter and it's burnin' my lips...
Back to top
YIM YIM  
IP Logged
 
jacker
Member
*
Offline



Posts: 42
Location: Milwaukee, WI
Joined: May 20th, 2008
Re: Storing Binaries
Reply #7 - Feb 16th, 2011 at 3:33pm
Print Post Print Post  
Oops, I missed one of your earlier posts, I think you already answered my question...I will look into the Shell or CreateProcess call...
  

Jack - I'm smokin' past the filter and it's burnin' my lips...
Back to top
YIM YIM  
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Storing Binaries
Reply #8 - Feb 16th, 2011 at 6:59pm
Print Post Print Post  
jacker wrote on Feb 16th, 2011 at 3:30pm:
How would I create a "View PDF" or "View Document" button that would launch a browser (or Acrobat or Word) and open the URL of the document?



Jacker,
the @Asynchshell() command will do exactly what you desire.
In the example below I use the Sbasic on a command button to build the correct file name to look for on a "cloud type" drive. All of this type file reside on the P drive in a directory sesame\ctrak1\invimg. In my case  the file is always named  the customer user ID plus the invoice number plus the 3 letters INV and it is always a pdf. when the button is pressed it goes out and if the file exists it pops up the pdf file using the utility it is associated with. This same method works for pdf, docx or anything else the operating system understands.

var VInvname as string
var Vviewer as string
VInvname = cusid + InvNo + "Inv.pdf"
iF      FileExists(("p:\sesame\ctrak1\invimg\" + VInvname))
     {
           
           Vviewer = @Asynchshell("p:\sesame\ctrak1\invimg\" + VInvname)

     }
     else
     {
            @Msgbox("The Confirmation sheets", "have not", "been generated yet")
     }



_________________________________________________________________________

You can also use the FileExists() and Visibility() command like the example below to make the above command button only visible when the file actually exists on the "Cloud Drive"




SUBROUTINE Confbuttons() //makes correct buttons visible for confirmation sheets

Var vconfYN as String

vconfYN = "p:\sesame\ctrak1\invimg\"+cusid + InvNo + "Inv.pdf"



iF      FileExists(vconfYN)
     {
            Visibility(Generate Confirmation sheets, 0)
            Visibility(view Confirmation sheets, 1)


     }
     else
     {
            Visibility(Generate Confirmation sheets, 1)
            Visibility(view Confirmation sheets, 0)


     }
END SUBROUTINE

Hope this points you in the correct direction.  Smiley

PS. A simple device called a pogoplug biz works well to create a web based storage device that your Sesame WEB application can access easily as a drive  and your non Sesame users can upload files to from a website.
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
jacker
Member
*
Offline



Posts: 42
Location: Milwaukee, WI
Joined: May 20th, 2008
Re: Storing Binaries
Reply #9 - Feb 16th, 2011 at 7:43pm
Print Post Print Post  
Bob,

Thanks! That will help me a lot. Since this Sesame app covers three offices that talk to a shared Sesame db over the Internet, I think I will choose to upload the documents to a private website hosted on a web server different from the Sesame server. They aren't quite ready to run their own Intranet server in-house.

Anyway, I believe your code will work using internet URLs instead of local paths...
  

Jack - I'm smokin' past the filter and it's burnin' my lips...
Back to top
YIM YIM  
IP Logged
 
jacker
Member
*
Offline



Posts: 42
Location: Milwaukee, WI
Joined: May 20th, 2008
Re: Storing Binaries
Reply #10 - Apr 13th, 2011 at 4:14pm
Print Post Print Post  
I'm having a little trouble with the different MS OSes when it comes to creating a folder for storing my temporary files...

How would I get the local path to the Sesame\Data folder WITHOUT assuming it is XP or Win7 OR that Sesame is installed in C:\Sesame2?
  

Jack - I'm smokin' past the filter and it's burnin' my lips...
Back to top
YIM YIM  
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Storing Binaries
Reply #11 - Apr 13th, 2011 at 5:23pm
Print Post Print Post  
jacker wrote on Apr 13th, 2011 at 4:14pm:
I'm having a little trouble with the different MS OSes when it comes to creating a folder for storing my temporary files...

How would I get the local path to the Sesame\Data folder WITHOUT assuming it is XP or Win7 OR that Sesame is installed in C:\Sesame2?

Use a path that is relative to your current working directory.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Storing Binaries
Reply #12 - Apr 13th, 2011 at 5:48pm
Print Post Print Post  
Erika, can you provide an example of your suggestion?

I've been struggling with a similar issue. I want a client to launch a label printer, but I don't know where it may be installed on each client.

On my pc, it's here: "C:\Program Files (x86)\Wasp Technologies\Labeler\wlab32.exe" But I'm pretty certain it won't be the same on each client.

Thanks.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Storing Binaries
Reply #13 - Apr 13th, 2011 at 7:06pm
Print Post Print Post  
Steve_in_Texas wrote on Apr 13th, 2011 at 5:48pm:
Erika, can you provide an example of your suggestion?

I've been struggling with a similar issue. I want a client to launch a label printer, but I don't know where it may be installed on each client.

On my pc, it's here: "C:\Program Files (x86)\Wasp Technologies\Labeler\wlab32.exe" But I'm pretty certain it won't be the same on each client.

Thanks.


Jacker's issue and yours are not really the same, Steve.

For Jacker, I am suggesting that a folder be created for the binaries under the Sesame working directory. If the Sesame working directory is C:\Sesame2, then place the binaries in C:\Sesame2\Binaries. If the Sesame working directory for another machine is F:\Programs\Sesame\Jacker, then put the binaries in F:\Programs\Sesame\Jacker\Binaries. That way, your programming can simply reference Binaries\myfile.ext and teh Binaries folder will always be at the same relative location.

For your issue, Steve, you need to take a different tack because you are looking for a third party program that you may not control. For things like this, we usually do something like putting the path to the exe for the particular machine into a file, then reading the value in that file into a ClientLocalValue on application open, or some other such mechanism depending on your particular requirements.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Storing Binaries
Reply #14 - Apr 13th, 2011 at 7:31pm
Print Post Print Post  
Thank you very much Erika. As always, very helpful info.

Sincerely,

Steve
  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 
Send Topic Send Topic Print Print