Cory Rau | 1 Feb 01:44 2008

E-mailing PDFs

Here's my situation:

Mac Server running 4D 2004.6
Clients are ALL Citrix-based (i.e. Windows)

My users want to be able to generate PDF documents and e-mail them to  
customers without the intervention of an e-mail client.

Here's what I'm doing now (it's in testing right now) since it's easy  
creating PDFs on a Mac with native 4D code:

1. User kicks off the "print" job.
2. I launch a process on the server to generate the print job using  
PRINT OPTION and create the PDF in a given directory on the 4D server.
3. I create a record in a table which specifies to, from, subject,  
body, PDF attachment path, status etc.
4. I have a stored procedure running on the server which checks every  
5 minutes for records in the aforementioned table with a status of  
"Unsent"
5. It loops through all the "Unsent" records, builds an e-mail for  
each (cc'ing the sender) and sends it off from the server.

Volume is pretty low....maybe 20/day.

Why I like this:
1. cheap
2. no plug-ins
3. The directory I use also serves the PDFs up via http as I have  
Apache running on the 4D server.  This allows our ERP system to  
retrieve the PDF documents via http since their names are predictably  
(Continue reading)

David Adams | 1 Feb 01:44 2008
Picon

Re: Which Search is Fastest?

> IIRC, JPR devised a technique for expanding the size of each
> individual record as it gets saved to disk so that it's a multiple of
> 4D's allocation block size (128 bytes was what I remember). The idea
> is to add a BLOB or Text field somewhere in the record, and then as
> the record is being saved you calculate how big the data actually is
> (using 4D's information available about field sizes) and then put
> padding characters into the BLOB/Text field to expand it out to the
> next multiple of 128 bytes. This ensures that data is stored optimally
> in 4D's own data structures.

I see. Yes, I can imagine how that would be beneficial but would want
some current information regarding 4D's storage scheme before diving
in. At that point, it would take quite a bit of testing to determine
when such a technique is worth the effort. "200x faster" is
meaningless by itself, you need to know 200x faster than *what*, what
that means in clock/human experiential time, under what conditions the
benefits are best achieved, and what the costs are. I've no idea if
we're talking about a broad-based optimization or one with a very
narrow band of suitable options. I'm not saying this technique isn't
effective or broad-based, I simply have no idea one way or the other.

As an example of a powerful but narrow optimization technique, I use a
simple hash function to get a longint key out of text and email
address fields to optimize "equals" and "not equals" searches on
text/email. The longint is nothing but an alternate key, nothing
magical. Is this approach faster than a plain text search? Sure, the
difference can be profound...you can even create scenarios where this
approach is 10,000 faster...taking milliseconds instead of minutes.
Sounds great, is great, but is also very limited. "Limited" in this
case means "specific". If you tried to use this technique where it's
(Continue reading)

David Dancy | 1 Feb 04:37 2008
Picon

Sharing variables between components and host (long)

Folks

I've got a knotty problem I'm hoping someone has some insight on.
Here's the scenario:

4D v11.1 Windows running on Vista

I have developed a "DSS" type component to provide dynamic
variable-allocation/deallocation capabilities. The variables
referenced by the suite of methods that manages them are interprocess
variables defined in the component. I understand that this makes them
inaccessible to the host except as made available by the component via
pointers.

To use the DSS system, I say

$mypointer := _DSS_New (Text array)

and $mypointer now has a pointer reference to a variable defined in
the DSS component. Say it's <>_DSS_ARRAY_TEXT_003_AL. There are
hundreds of such IP variables waiting to be allocated and used, and
they're incredibly handy in scenarios like when you're writing a
generic routine to build SQL statements and you don't want it to know
in advance how many and what types of columns you're going to get
back.

In just such a situation, I have a generic routine to collect data
from an SQL database. I give it an SQL statement along with pointers
to the columns I want it to fill in.

(Continue reading)

Jean-Pierre Ribreau | 1 Feb 08:58 2008
Picon

Re: Which Search is Fastest?

> Perhaps we are talking about two different things entirely, which
> makes agreeing or disagreeing very difficult ;-) As I have not been to
> your classes, I may have misunderstood your original point. Exactly
> what technique are you referring to related to the physical size or
> organization of records?
I named it the 'Stable data' technique. Let me explain with an actual
example, in a company where the server never stops and the data is too big
to fit in the cache. Almost no possibilities to compact data. Because 4D
uses 128-byte blocks to save records, I calculate, for the main tables, what
will be the maximum size for a record. This is easy for fixed length fields.
For variable length, pictures and blobs are moved to another table, and text
fields are balanced by an airbag field (blob). Then, from a new datafile,
records are created by packs of 10,000. Users never actually 'create
record', but use an already created record. Records are never deleted, but
marked as deleted and reused when needed. When the limit of 10,000 records
is reach, a new pack of 10,000 is created, and so on. Every record uses the
same number of blocks, and (most important) its size never changes. So the
record never moves. Then no holes nor fragmentation. 10,000 is just my
choice, but it can be 1,000 or 1 million, why not. The good value is the
reasonable value ;-)

An analysis of this kind of datafile with DatAnalizer shows that the
fragmentation indexes of these tables are very low, so every operation on
data is fast, and there is never the need for compacting. BTW, Index Pages
are also less fragmented, because indexes are created after creation of
records. The only one table which takes care of fat fields (blobs and
pictures) can be fragmented, it doesn't matter because its records are never
accessed sequentially. Globally, this is done with less than 100 lines of
simple programming.

(Continue reading)

Alexander Heintz | 1 Feb 10:08 2008
Picon

Re: E-mailing PDFs

Hi Cory,

I do something similar and thats allo peopl to write E-Mails usng 4D  
Write, then convert the ocumnt into PDF and send it. On Mac thats  
easy, on Windows there is a wonderful solution for printing PDFs that  
even allows you to put "Watermark" PDF Documents (i.e. letterheads)  
underneath your pages and that is totally free!

It's called, who would have guessed, FreePDF

I have explained how to use it here:

http://4dblog.heintz.net/?cat=4

OK, screenshots are in german, but should do the trick. As for the  
letterhead watermark just look at the documentation, basically you  
crete nother printer that always does the watermark.
Sorry, no Mac :-(

Hope this helps,

cheers,

Alex

> Here's my situation:
>
> Mac Server running 4D 2004.6
> Clients are ALL Citrix-based (i.e. Windows)
>
(Continue reading)

psmith | 1 Feb 10:16 2008

Re: Which Search is Fastest?

Jean-Pierre,

I know you've been working around 4D for many years and I believe  
your technique is based on good empirical evidence. In older versions  
(1980s and early  1990s), 4D developers had to do much de- 
normalization in order to get decent performance. That period also  
gave birth to over-usage of sub-records in many 4D databases.

However, I believe that if a developer has to resort to this in order  
to have a stable system, the RDBMS is simply not doing its job. I had  
great expectations for the "complete rewrite" of the database engine  
that was talked about prior to v11.

I sincerely hope that this type of workaround is no longer required.  
We now see huge datafile sizes in v11 databases, so perhaps they have  
built your padding technique into to the new incarnation.

P. Smith

> I named it the 'Stable data' technique. Let me explain with an actual
> example, in a company where the server never stops and the data is  
> too big
> to fit in the cache. Almost no possibilities to compact data.  
> Because 4D
> uses 128-byte blocks to save records, I calculate, for the main  
> tables, what
> will be the maximum size for a record. This is easy for fixed  
> length fields.
> For variable length, pictures and blobs are moved to another table,  
> and text
(Continue reading)

Armin Deeg | 1 Feb 10:49 2008
Picon

re: E-mailing PDFs

Cory,

for windows clients, there is a stable plugin version. The plugin comes 
with a pdf printer driver and a unlimited no hassle lizenz for 
distribution to your clients

http://www.node.de/indexplug.htm

    * automatic switching between printer/pdf driver
    * collecting several print jobs and converting it into one pdf file
      (sets the pdf printer in idle mode to combine several print jobs
      and external documents into one pdf file, mixed print of 4D Draw,
      4D Write, SuperReport, PrintList, 4D Chart, 4D Report ... is
      supported)
    * ability to choose from different letter form pages for watermark
      background (first and following pages). Background files could be
      pictures or pdf files.
    * set some pdf options (password, print, copy, change, annotations,
      title, owner, etc.)
    * print pdf to smtp email with optional full styled html email text
      including pictures (the print job spooled into a temporarily pdf
      file and send the pdf to your smtp server without any user
      interaction, no 4d internet commands necessarily)
    * print to MAPI email (the print job spooled into a pdf file and
      opens the standard MAPI mail client)
    * print pdf to MS OutLook email with optional full styled html email
      text including pictures (the print job spooled into a temporarily
      pdf file and send the pdf into your MS OutLook mail client without
      any user interaction)
    * send HTML E-Mail with HTML styled body to your smtp server
(Continue reading)

Balinder Walia | 1 Feb 11:51 2008
Picon

4D Web serving on MacOS X 10.5 and port 80, Is it true for port 443 as well?

48385 4D Web serving on MacOS X 10.5 and port 80

<http://www.4d.com/knowledgebase?CaseID=48385>

Is this true for ssl ports as well like 443? Before I try it just wanted
your expert opinions on this. We have a need to run ITK->NTK based intranet
web server over ssl 443 on Mac OS X Tiger (Can upgrade to Leopard if need
to)

Cheers
------------------------
Best regards,
Server Monitor Support

http://www.rootinternet.co.uk/server_monitor

This email and any attached files are confidential and intended only for
the addressee. It may contain confidential and privileged material. Any
review, retransmission, dissemination or reliance upon it, or use of this
information by other than the intended recipient is prohibited. If you have
received this email in error please contact the sender and delete it. Thank
you.
**********************************************************************
4D Web 2.0 Pack v11 Brings Business Intelligence to the Web
http://www.4d.com/products/4dweb20pack-AF.html
Data Lives Here (tm)

4th Dimension Internet Users Group (4D iNUG)
FAQ:  http://www.4d.com/support/faqnug.html
Archive:  http://dir.gmane.org/gmane.comp.lang.inug-4d.tech
(Continue reading)

Maurice Inzirillo 4DNC | 1 Feb 12:16 2008

Re: 4D Web serving on MacOS X 10.5 and port 80, Is it true for port 443 as well?


Le 1 févr. 08 à 11:51, Balinder Walia a écrit :

> 48385 4D Web serving on MacOS X 10.5 and port 80
>
> <http://www.4d.com/knowledgebase?CaseID=48385>
>
>
> Is this true for ssl ports as well like 443?

Yes you can apply the same kind of rule for the port 443. With 4D  
2004.7 you can define a specific port for SSL. For example you can  
setup the port 8443. So the rule to define must be something like this :

ipfw add 1000 fwd 127.0.0.1,8443 tcp from any to 127.0.0.1 443 in

HTH

Maurice Inzirillo
--

-- 
4D NET Center S.A.

4D Business Kit : www.4dbk.com
Internet 4D Hosting : www.4dnetcenter.com
Phone : +41 (0)32  342 27 32
email : maurice.inzirillo@...
iChat : maurice_inzirillo@...
Skype : maurice.inzirillo

**********************************************************************
(Continue reading)

Balinder Walia | 1 Feb 13:42 2008
Picon

Re: 4D Web serving on MacOS X 10.5 and port 80, Is it true for port 443 as well?

Great thank you!

On 01/02/2008, Maurice Inzirillo 4DNC <maurice.inzirillo@...>
wrote:
>
>
> Le 1 févr. 08 à 11:51, Balinder Walia a écrit :
>
> > 48385 4D Web serving on MacOS X 10.5 and port 80
> >
> > <http://www.4d.com/knowledgebase?CaseID=48385>
> >
> >
> > Is this true for ssl ports as well like 443?
>
>
> Yes you can apply the same kind of rule for the port 443. With 4D
> 2004.7 you can define a specific port for SSL. For example you can
> setup the port 8443. So the rule to define must be something like this :
>
> ipfw add 1000 fwd 127.0.0.1,8443 tcp from any to 127.0.0.1 443 in
>
>
> HTH
>
> Maurice Inzirillo
> --
> 4D NET Center S.A.
>
> 4D Business Kit : www.4dbk.com
(Continue reading)


Gmane