Re: How to get the current time in a specified time zone

2018-09-26 Thread Benedict, Tom via 4D_Tech
Pat Bensky writes:

>The only thing I'm not sure about is how various time zones change in their
>relationship to GMT (eg Summer Time etc.) For example if Country A is
>normally on GMT -8 but they're currently on Summer Time so 7AM in that
>time zone is CurrentHourGMT-8+1, how do we account for that?

Ya gotta have a database and you gotta maintain it, because the rules change 
for a range of reasons. This takes me back to my programming infancy in 1988 
when I created a Hypercard stack that was filled with all the countries and 
major cities of the world. I'm a geography fan, so I thoroughly enjoyed do the 
research (pre-internet). You entered your local time and selected the 
city/country you wanted to know the time in and it would look it up and display 
it. The stack was called "What Time?" and it got an award from the Boston 
Computer Society. I distributed it as shareware (remember that concept?) and I 
sold about 10 licenses. Even got an order from Switzerland. Fulfillment was by 
mail.

Thanks for the trip down memory lane. Sorry for the diversion.

Tom Benedict
Optum

This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified
that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Printing A3 format on windows when scaling is not possible

2018-09-26 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi Olivier,

The example in the docs for the command PAGE SETUP is indeed kind of what I am 
talking about.
But instead of having different forms with a scaling setting I have different 
page setup forms with a “paper size” setting (A3 portrait, A3 landscape), 
because also forms with a scaling setting (set  on printer 1) have no effect 
when used with printer 2 when this printer is unable to scale

I know I can get the paper width / height and with some math move / resize 
objects on the form

However, we already have tens of output forms, and unfortunately not only with 
a few columns, but with a lot of fields on different parts of the form
Moving around these fields is no option for me.

My boss doesn’t understand why this scaling is a problem, because as he sees it 
“there are a lot of applications where printing a lot of small sized info on an 
A4 paper is no big deal at all”

Gr,
Piotr




Hi Piotr,

I guess, you are doing what is described in the documentation for PAGE SETUP:

http://doc.4d.com/4Dv16/4D/16.4/PAGE-SETUP.301-3978038.en.html

The idea of "AUTOMATIC SCALED PRINTING" ?

Am I correct, that the goal is to print a list scaled in order to fit on a 
"standard" size (e.g. A4).

If my assumptions are correct, then we are dealing with the problem "a piece of 
paper has limited size, screens have scroll bars".

One solution is indeed to scale. But... as the doc for SET PRINT OPTION says: 
"Be careful, some printers do not allow you to modify the scale..."

The other solution is to distribute the width of the columns of a report (e.g. 
a Listbox) relatively to the available width of the paper.

The available width on paper depends on the printer (paper size, printable 
area) and print options (landscape vs. portrait).

In my component, I have a method that does this kind of printing. The idea at 
the beginning was to have a generic way to print listboxes, but it could also 
be a 2D array:

https://flury-software.ch/a-swiss-army-knife-for-4d/

Check out the method "Uty_PrintListBox"

Disclaimer: this is not a magic solution. It's just an other try to print what 
can be endless on screen (scroll bars) to the limited size of paper.

HTH,

Olivier

Van: Piotr Chabot Stadhouders
Verzonden: woensdag 26 september 2018 13:55
Aan: 4D iNug Technical <4d_tech@lists.4d.com>
Onderwerp: RE: Printing A3 format on windows when scaling is not possible

Hi Miyako,

Thanks for your anwer.

Ok, I understand what you are saying, and in some cases I already use the SET 
PRINT OPTION command

But when I want to print a report without interaction with the user, and I want 
to print it to a certain paper size, I can do two things I guess:

  1.  Use SET PRINT OPTION with Paper option and value1=”A3”. Does using paper 
name = “A3” always work? Or do I have to get the paper names first and find 
some paper name with A3 in it?
  2.  Use SET PRINT OPTION with a custom width and height. Does this always 
work, for every printer?

Gr,
Piotr


Van: Piotr Chabot Stadhouders
Verzonden: woensdag 26 september 2018 13:46
Aan: Piotr Chabot Stadhouders 
mailto:p.stadhoud...@timeff.com>>
Onderwerp: RE: Printing A3 format on windows when scaling is not possible

there should be no reason to use PAGE SETUP, although there is nothing wrong 
about using it.

it's just a convenient shorthand that dates back to the times when 4D had far 
fewer commands.



http://doc.4d.com/4Dv16/4D/16.2/Print-settings-to-BLOB.301-3432852.en.html

http://doc.4d.com/4Dv16/4D/16.4/SET-PRINT-OPTION.301-3978064.en.html

Van: Piotr Chabot Stadhouders
Verzonden: woensdag 26 september 2018 11:51
Aan: 4D iNug Technical <4d_tech@lists.4d.com>
Onderwerp: Printing A3 format on windows when scaling is not possible

Hi all,

I am working for over 20 years with 4D now, but still I am having troubles with 
printing reports on Windows / OSX
On forehand I want to say it sure can be me that is the problem
The most problematic is when I want to print a lot on a report and scaling 
comes in to play

Because scaling on a lot of printers is not possible, and I don’t know on 
forehand to what printer is printed, I cannot use scaling in my reports
Because almost all of our customers print to PDF, the best solution I found is :

  *   To create a form just to use for page setup.
  *   This form has an A3 page setup, which is kind of similar of scaling 70%
  *   Print to PDF
  *   Let Acrobat Reader do the scaling, and let the user print scaled to A4 on 
their printer

However, now and then, after a couple of months/years, also this A3 page setup 
gets “corrupted” i.e. when checking the page setup on the form it isn’t A3 
anymore but is has been reset to A4

So…. Does anybody know of an ultimate solution for this problem, and works 
multi platform?

Gr,
Piotr

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: 

Re: How to get the current time in a specified time zone

2018-09-26 Thread Pat Bensky via 4D_Tech
After trying various complicated methods of calculating the different time
zones, the final method was actually quite simple.
I needed to set up an email-sending routine to send emails out at 7AM for
each time zone. This is what I have. This is currently being tested :)
Please feel free to point out any obvious flaws!

  // get the current GMT time

*XML DECODE*(*Delete string*(*String*(*Current date*;ISO date GMT;*Current
time*);20;1);$tTime)

$CurrentHourGMT:=*Num*(*Substring*(*String*($tTime);1;2))

  // get the difference between current GMT and 7AM

*If* ($CurrentHourGMT>=7)

$TimeZoneDiff:=($CurrentHourGMT-7)*-1  // gives us a starting point for
where it is currently 7AM

*Else*

$TimeZoneDiff:=7-$CurrentHourGMT

*End if*

$Current7AM:=$TimeZoneDiff

*For* ($i;1;24)

*  QUERY*([Emails];[Emails]gmt=$Current7AM)

  // send the emails

*Case of*

*:* ($Current7AM=0)

$Current7AM:=-1

*:* ($Current7AM=-11)

$Current7AM:=12

*Else*

$Current7AM:=$Current7AM-1

*End case*

$lastHour:=$CurrentHourGMT

*While* ($CurrentHourGMT<=$lastHour)

*DELAY PROCESS*(*Current process*;$DelayTime)

*If* ($testing)

$CurrentHourGMT:=$CurrentHourGMT+1

*Else*

*XML DECODE*(*Delete string*(*String*(*Current date*;ISO date GMT;*Current
time*);20;1);$tTime)

$CurrentHourGMT:=*Num*(*Substring*(*String*($tTime);1;2))

*End if*

*End while*

End For // 24 iterations

The only thing I'm not sure about is how various time zones change in their
relationship to GMT (eg Summer Time etc.) For example if Country A is
normally on GMT -8 but they're currently on Summer Time so 7AM in that time
zone is CurrentHourGMT-8+1, how do we account for that?


One idea I have is to get a list of timezones using sudo - eg

sudo system setup -listtimezones

but I haven't been able to get that to work using LEP - eg

*   C_TEXT*($result)

  $cmd:="sudo systemsetup -listtimezones"

  *LAUNCH EXTERNAL PROCESS*($cmd;$result)

$result is always empty - I guess I'm doing something wrong!
Then maybe go through each timezone, temporarily switch the machines's zone
sudo system setup - settimezone timezone

Get the current time in that zone and calculate its difference from GMT ...
Save all those results into a lookup array.

Any ideas about that?

Pat


On Tue, 25 Sep 2018 at 14:07, Jody Bevan via 4D_Tech <4d_tech@lists.4d.com>
wrote:

> Pat:
>
> Thanks. I will try it out. I will see if then I can figure out getting it
> for the different time zones without having it hard coded in.
>
> Jody
>
>
> > On Sep 24, 2018, at 4:28 PM, Pat Bensky via 4D_Tech <
> 4d_tech@lists.4d.com> wrote:
> >
> > Using v16:
> > I've figured out how to get the current GMT time using cURL. (Code at the
> > bottom if anybody is interested).
> > Now I need to get the current time in a different time zone - eg in
> France.
> > Any ideas how to do that?
> >
> >
> >
> > ==
> >
> >  // GetTimeGMT
> >
> >  // Gest the current time in GMT from Google
> >
> >  // 21/09/18 pb
> >
> > *C_LONGINT*(*$0*)
> >
> > $input:="curl -I https://www.google.com/;  // this gets GMT from Google
> >
> > $empty:=""
> >
> > *LAUNCH EXTERNAL PROCESS*($input;$empty;$output;$error)
> >
> > *$0*:=0
> >
> > *If* ($output#"")
> >
> > $pos:=*Position*("GMT";$output)
> >
> > *If* ($pos>0)
> >
> > $time:=*Substring*($output;$pos-9;8)
> >
> > $pos:=*Position*(":";$time)
> >
> > *If* ($pos>0)
> >
> > *$0*:=*Num*(*Substring*($time;1;$pos-1))
> >
> > *End if*
> >
> > *End if*
> >
> > *End if*
> >
> > --
> > *
> > CatBase - Top Dog in Data Publishing
> > tel: +44 (0) 207 118 7889
> > w: http://www.catbase.com
> > skype: pat.bensky
> > *
> > **
> > 4D Internet Users Group (4D iNUG)
> > Archive:  http://lists.4d.com/archives.html
> > Options: https://lists.4d.com/mailman/options/4d_tech
> > Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> > **
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
*
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

AW: Printing A3 format on windows when scaling is not possible

2018-09-26 Thread Olivier Flury via 4D_Tech
Hi Piotr,

I guess, you are doing what is described in the documentation for PAGE SETUP:

http://doc.4d.com/4Dv16/4D/16.4/PAGE-SETUP.301-3978038.en.html

The idea of "AUTOMATIC SCALED PRINTING" ?

Am I correct, that the goal is to print a list scaled in order to fit on a 
"standard" size (e.g. A4).

If my assumptions are correct, then we are dealing with the problem "a piece of 
paper has limited size, screens have scroll bars".

One solution is indeed to scale. But... as the doc for SET PRINT OPTION says: 
"Be careful, some printers do not allow you to modify the scale..."

The other solution is to distribute the width of the columns of a report (e.g. 
a Listbox) relatively to the available width of the paper.

The available width on paper depends on the printer (paper size, printable 
area) and print options (landscape vs. portrait).

In my component, I have a method that does this kind of printing. The idea at 
the beginning was to have a generic way to print listboxes, but it could also 
be a 2D array:

https://flury-software.ch/a-swiss-army-knife-for-4d/

Check out the method "Uty_PrintListBox"

Disclaimer: this is not a magic solution. It's just an other try to print what 
can be endless on screen (scroll bars) to the limited size of paper.

HTH,

Olivier

|| https://flury-software.ch/

-Ursprüngliche Nachricht-
Von: 4D_Tech <4d_tech-boun...@lists.4d.com> Im Auftrag von Piotr Chabot 
Stadhouders via 4D_Tech
Gesendet: Mittwoch, 26. September 2018 13:55
An: 4D iNug Technical <4d_tech@lists.4d.com>
Cc: Piotr Chabot Stadhouders 
Betreff: RE: Printing A3 format on windows when scaling is not possible

Hi Miyako,

Thanks for your anwer.

Ok, I understand what you are saying, and in some cases I already use the SET 
PRINT OPTION command

But when I want to print a report without interaction with the user, and I want 
to print it to a certain paper size, I can do two things I guess:

[...]

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Printing A3 format on windows when scaling is not possible

2018-09-26 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi Miyako,

Thanks for your anwer.

Ok, I understand what you are saying, and in some cases I already use the SET 
PRINT OPTION command

But when I want to print a report without interaction with the user, and I want 
to print it to a certain paper size, I can do two things I guess:

  1.  Use SET PRINT OPTION with Paper option and value1=”A3”. Does using paper 
name = “A3” always work? Or do I have to get the paper names first and find 
some paper name with A3 in it?
  2.  Use SET PRINT OPTION with a custom width and height. Does this always 
work, for every printer?

Gr,
Piotr


Van: Piotr Chabot Stadhouders
Verzonden: woensdag 26 september 2018 13:46
Aan: Piotr Chabot Stadhouders 
Onderwerp: RE: Printing A3 format on windows when scaling is not possible

there should be no reason to use PAGE SETUP, although there is nothing wrong 
about using it.

it's just a convenient shorthand that dates back to the times when 4D had far 
fewer commands.



http://doc.4d.com/4Dv16/4D/16.2/Print-settings-to-BLOB.301-3432852.en.html

http://doc.4d.com/4Dv16/4D/16.4/SET-PRINT-OPTION.301-3978064.en.html

Van: Piotr Chabot Stadhouders
Verzonden: woensdag 26 september 2018 11:51
Aan: 4D iNug Technical <4d_tech@lists.4d.com>
Onderwerp: Printing A3 format on windows when scaling is not possible

Hi all,

I am working for over 20 years with 4D now, but still I am having troubles with 
printing reports on Windows / OSX
On forehand I want to say it sure can be me that is the problem
The most problematic is when I want to print a lot on a report and scaling 
comes in to play

Because scaling on a lot of printers is not possible, and I don’t know on 
forehand to what printer is printed, I cannot use scaling in my reports
Because almost all of our customers print to PDF, the best solution I found is :

  *   To create a form just to use for page setup.
  *   This form has an A3 page setup, which is kind of similar of scaling 70%
  *   Print to PDF
  *   Let Acrobat Reader do the scaling, and let the user print scaled to A4 on 
their printer

However, now and then, after a couple of months/years, also this A3 page setup 
gets “corrupted” i.e. when checking the page setup on the form it isn’t A3 
anymore but is has been reset to A4

So…. Does anybody know of an ultimate solution for this problem, and works 
multi platform?

Gr,
Piotr

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Printing A3 format on windows when scaling is not possible

2018-09-26 Thread Jeffrey Kain via 4D_Tech
It used to be that if you didn't call PAGE SETUP you'd end up with really weird 
and random print job settings, like  copies etc.. You had to tie this 
command to the page setup information saved with the form with a reasonably 
similar printer.

So it's no longer needed at all?


--
Jeffrey Kain
jeffrey.k...@gmail.com




> On Sep 26, 2018, at 6:01 AM, Keisuke Miyako via 4D_Tech 
> <4d_tech@lists.4d.com> wrote:
> 
> there should be no reason to use PAGE SETUP, although there is nothing wrong 
> about using it.
> it's just a convenient shorthand that dates back to the times when 4D had far 
> fewer commands.

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Printing A3 format on windows when scaling is not possible

2018-09-26 Thread Keisuke Miyako via 4D_Tech
there should be no reason to use PAGE SETUP, although there is nothing wrong 
about using it.
it's just a convenient shorthand that dates back to the times when 4D had far 
fewer commands.

http://doc.4d.com/4Dv16/4D/16.2/Print-settings-to-BLOB.301-3432852.en.html
http://doc.4d.com/4Dv16/4D/16.4/SET-PRINT-OPTION.301-3978064.en.html

2018/09/26 18:51、Piotr Chabot Stadhouders via 4D_Tech 
<4d_tech@lists.4d.com>のメール:
So…. Does anybody know of an ultimate solution for this problem, and works 
multi platform?



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Printing A3 format on windows when scaling is not possible

2018-09-26 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi all,

I am working for over 20 years with 4D now, but still I am having troubles with 
printing reports on Windows / OSX
On forehand I want to say it sure can be me that is the problem
The most problematic is when I want to print a lot on a report and scaling 
comes in to play

Because scaling on a lot of printers is not possible, and I don’t know on 
forehand to what printer is printed, I cannot use scaling in my reports
Because almost all of our customers print to PDF, the best solution I found is :

  *   To create a form just to use for page setup.
  *   This form has an A3 page setup, which is kind of similar of scaling 70%
  *   Print to PDF
  *   Let Acrobat Reader do the scaling, and let the user print scaled to A4 on 
their printer

However, now and then, after a couple of months/years, also this A3 page setup 
gets “corrupted” i.e. when checking the page setup on the form it isn’t A3 
anymore but is has been reset to A4

So…. Does anybody know of an ultimate solution for this problem, and works 
multi platform?

Gr,
Piotr

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**