Re: poor performance LISTBOX INSERT COLUMN

2017-12-04 Thread Alan Chan via 4D_Tech
4D iNug Technical <4d_tech@lists.4d.com> writes:
>Maybe it does matter how many listboxes are on the form?

I assumed you built LB with one method per LB.
>
>Maybe LISTBOX INSERT COLUMN becomes slower when more columns are inserted?

I assumed that you were "appending" column instead of inserting column before 
existing columns.

Optimization is fun although some developers are against it.

Health warning : Optimization could be highly addictive and hazardous to your 
mentality.

Alan Chan

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

Assign multidimensional array

2017-12-04 Thread stardata.info via 4D_Tech

Hi All,

I need to copy a multidimensional array ($A) into another of the same 
dimension ($B).
Is necessary do a cicle and assign every single position or is possible 
to do other?


ARRAY TEXT($A;1;2)
ARRAY TEXT($B;0;2)
$A{1}{1}:="1"
$A{1}{2}:="2"
$P:=Size of array($B)+1
INSERT IN ARRAY($B;$P;1)
$B{$P}{1}:=$A{$P}{1}
$B{$P}{2}:=$A{$P}{2}


Thanks
Ferdinando

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

Re: Assign multidimensional array

2017-12-04 Thread Herr Alexander Heintz via 4D_Tech
What about COPY ARRAY ?

> Am 04.12.2017 um 10:45 schrieb stardata.info via 4D_Tech 
> <4d_tech@lists.4d.com>:
> 
> Hi All,
> 
> I need to copy a multidimensional array ($A) into another of the same 
> dimension ($B).
> Is necessary do a cicle and assign every single position or is possible to do 
> other?
> 
> ARRAY TEXT($A;1;2)
> ARRAY TEXT($B;0;2)
> $A{1}{1}:="1"
> $A{1}{2}:="2"
> $P:=Size of array($B)+1
> INSERT IN ARRAY($B;$P;1)
> $B{$P}{1}:=$A{$P}{1}
> $B{$P}{2}:=$A{$P}{2}
> 
> 
> Thanks
> Ferdinando
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

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

RE: poor performance LISTBOX INSERT COLUMN

2017-12-04 Thread Chip Scheide via 4D_Tech
Piotr,
maybe it is the remote data call/population of the listbox arrays?

for comparison try:
- populate the listbox from local (4D) data

On Mon, 4 Dec 2017 07:59:00 +, Piotr Chabot Stadhouders via 4D_Tech 
wrote:
> 
> I tested this on an HP Intel Core i7-4710MQ 2.50GHz laptop with 24G memory
> When showing the listboxes for the first time the arrays have 0 
> elements (after on load they are populated via 4D for OCI commands)
> Maybe it does matter how many listboxes are on the form?
> Maybe LISTBOX INSERT COLUMN becomes slower when more columns are inserted?
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Assign multidimensional array

2017-12-04 Thread Chip Scheide via 4D_Tech
Ferdinando,
not sure if Copy Array will copy multi-dimensional arrays - you could 
try.
but as worst case:

(assumes $B is already denied as having the same dimensions as $A)
For($i;1;size of array($A))
 copy array($A{$i};$B{$i}
end for

On Mon, 4 Dec 2017 10:51:30 +0100, Herr Alexander Heintz via 4D_Tech 
wrote:
> What about COPY ARRAY ?
> 
>> Am 04.12.2017 um 10:45 schrieb stardata.info via 4D_Tech 
>> <4d_tech@lists.4d.com>:
>> 
>> Hi All,
>> 
>> I need to copy a multidimensional array ($A) into another of the 
>> same dimension ($B).
>> Is necessary do a cicle and assign every single position or is 
>> possible to do other?
>> 
>> ARRAY TEXT($A;1;2)
>> ARRAY TEXT($B;0;2)
>> $A{1}{1}:="1"
>> $A{1}{2}:="2"
>> $P:=Size of array($B)+1
>> INSERT IN ARRAY($B;$P;1)
>> $B{$P}{1}:=$A{$P}{1}
>> $B{$P}{2}:=$A{$P}{2}
>> 
>> 
>> Thanks
>> Ferdinando
>> 
>> **
>> 4D Internet Users Group (4D iNUG)
>> FAQ:  http://lists.4d.com/faqnug.html
>> Archive:  http://lists.4d.com/archives.html
>> Options: http://lists.4d.com/mailman/options/4d_tech
>> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
>> **
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Assign multidimensional array

2017-12-04 Thread Arnaud de Montard via 4D_Tech

> Le 4 déc. 2017 à 15:59, Chip Scheide via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> Ferdinando,
> not sure if Copy Array will copy multi-dimensional arrays - you could 
> try.


ARRAY TEXT($zz;2;3)
$zz{0}{0}:="test"
ARRAY TEXT($zzz;0;0)
COPY ARRAY($zz;$zzz)
ASSERT($zzz{0}{0}="test")  //0 index value
ASSERT(Size of array($zzz{2})=3)  //lines
ASSERT(Size of array($zzz)=2)  //columns

it works  :-) 

-- 
Arnaud de Montard 



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

Strange problem with v16 and Launch External Process in a component

2017-12-04 Thread Adrian Boone via 4D_Tech

Hi all,

We have a component which uses Launch External Process to call an 
accountancy package (Moneyworks) via the command line (Windows and Mac), 
and have just recompiled it for v16 (that's another story...). Now, when 
any component methods which use LEP (i.e. most of them) are called from 
another method in my test database, they always return ok, and the 
output and error variables are always empty. There's no noticeable delay 
in the debugger so it looks like the LEP call simply isn't happening?


Now for the really weird part, I have a form with some common test 
methods linked to some of the buttons - if I call the exact same code 
with the same parameters from a button on the form, it works!


If I open the source code for the component, the methods all work fine. 
I've tried setting the _4D_OPTION_BLOCKING_EXTERNAL_PROCESS environment 
variable to both "true" (which is what I want) and "false" immediately 
before the LEP call in the component, but it makes no difference.


This is happening on Windows 10, with v16.0 64-bit, v16.2 32 bit, and 
with the component compiled for just 32-bit, just 64-bit, or both.


Any bright ideas out there?

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

RE: poor performance LISTBOX INSERT COLUMN

2017-12-04 Thread Piotr Chabot Stadhouders via 4D_Tech
Hi Chip,

When the form is first displayed there are no elements in one of the arrays in 
the listboxes
Only after certain user action, like pressing a button, the arrays are 
populated, so this isn't the problem

Furthermore, I am not able to test with local 4D data because, surprise, we 
don't use the 4D datafile at all. We populate the arrays with Oracle data.

Gr,

Piotr


> maybe it is the remote data call/population of the listbox arrays?

> for comparison try:
> - populate the listbox from local (4D) data
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Rearranging object entry order

2017-12-04 Thread Tom Swenson via 4D_Tech
When I think of all the time doing this that I’ve wasted in my life…

https://blog.4d.com/rearrange-the-object-entry-order-in-a-single-click/

Tom Swenson


On 12/1/17, 9:49 AM, "4D_Tech on behalf of Piotr Chabot Stadhouders via 
4D_Tech" <4d_tech-boun...@lists.4d.com on behalf of 4d_tech@lists.4d.com> wrote:

Hi,

In search of a performance problem in 1 of our forms I am asking for some 
advice.

I have succeeded in analyzing 10 4DDebuglog.txt files (using an Oracle DB 
by the way) and have come to following :
The problem is with the execution time of the "LISTBOX INSERT COLUMN"
The performance of this command is very poor compared to other commands.
In fact, it takes about 10 times longer than every other 4D command in the 
logs

The LISTBOX INSERT COLUMN command takes on average 0.0286 seconds to 
complete, tested on a Intel Core i7-4710MQ 2.50GHz laptop
No big deal you could say, but for a couple of our forms it IS a big deal
We have a form with 27 listboxes on it, all dynamically build, with a total 
of 477 columns

So 477 * 0.0286 seconds takes up 13.6422 seconds
This is all done in the On Load event so the user must wait terribly long 
for the form to show up on the screen

My question :
Do you think this performance of LISTBOX INSERT COLUMN is acceptable / 
normal behavior?
Can someone confirm this performance?
Is there something, other than putting listboxes on other pages, I can do 
about this?

Thanks in advance,

Piotr

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

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

Re: Strange problem with v16 and Launch External Process in a component

2017-12-04 Thread John DeSoi via 4D_Tech
Anything unusual about the LEP call -- just using locals and specifying all of 
them? That alone should make it execute in blocking mode. E.g.

LAUNCH EXTERNAL PROCESS($cmd;$in;$out;$err)

Lots of bugs have been fixed since 16.0. Have you tried 16.2?

John DeSoi, Ph.D.


> On Dec 4, 2017, at 10:36 AM, Adrian Boone via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> We have a component which uses Launch External Process to call an accountancy 
> package (Moneyworks) via the command line (Windows and Mac), and have just 
> recompiled it for v16 (that's another story...). Now, when any component 
> methods which use LEP (i.e. most of them) are called from another method in 
> my test database, they always return ok, and the output and error variables 
> are always empty. There's no noticeable delay in the debugger so it looks 
> like the LEP call simply isn't happening?
> 
> Now for the really weird part, I have a form with some common test methods 
> linked to some of the buttons - if I call the exact same code with the same 
> parameters from a button on the form, it works!
> 
> If I open the source code for the component, the methods all work fine. I've 
> tried setting the _4D_OPTION_BLOCKING_EXTERNAL_PROCESS environment variable 
> to both "true" (which is what I want) and "false" immediately before the LEP 
> call in the component, but it makes no difference.
> 
> This is happening on Windows 10, with v16.0 64-bit, v16.2 32 bit, and with 
> the component compiled for just 32-bit, just 64-bit, or both.
> 
> Any bright ideas out there?

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

Re: Assign multidimensional array

2017-12-04 Thread stardata.info via 4D_Tech

Hi,

I need to append one array into another array with the same coloumns.

Copy not think that work.

I need to use 4D V12...

Thanks

/Ferdinando/


Il 04/12/2017 18:13, 4d_tech-requ...@lists.4d.com ha scritto:

Message: 10
Date: Mon, 4 Dec 2017 17:29:29 +0100
From: Arnaud de Montard
To: 4D iNug Technical<4d_tech@lists.4d.com>
Subject: Re: Assign multidimensional array
Message-ID:
Content-Type: text/plain; charset=utf-8



Le 4 déc. 2017 à 15:59, Chip Scheide via 4D_Tech<4d_tech@lists.4d.com>  a écrit 
:

Ferdinando,
not sure if Copy Array will copy multi-dimensional arrays - you could
try.

ARRAY TEXT($zz;2;3)
$zz{0}{0}:="test"
ARRAY TEXT($zzz;0;0)
COPY ARRAY($zz;$zzz)
ASSERT($zzz{0}{0}="test")  //0 index value
ASSERT(Size of array($zzz{2})=3)  //lines
ASSERT(Size of array($zzz)=2)  //columns

it works:-)  


-- Arnaud de Montard


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

Re: Strange problem with v16 and Launch External Process in a component

2017-12-04 Thread Chip Scheide via 4D_Tech
no ideas - but I ran into similar issues in v13, on windows.

LEP calls to OS for file level actions (copy, rename etc) everything 
empty, everything "OK" - not so much.
Run *same* exact command line code from cmd.exe everything worked as 
expected.

On Mac - no issue.

On Mon, 4 Dec 2017 16:36:52 +, Adrian Boone via 4D_Tech wrote:
> Hi all,
> 
> We have a component which uses Launch External Process to call an 
> accountancy package (Moneyworks) via the command line (Windows and 
> Mac), and have just recompiled it for v16 (that's another story...). 
> Now, when any component methods which use LEP (i.e. most of them) are 
> called from another method in my test database, they always return 
> ok, and the output and error variables are always empty. There's no 
> noticeable delay in the debugger so it looks like the LEP call simply 
> isn't happening?
> 
> Now for the really weird part, I have a form with some common test 
> methods linked to some of the buttons - if I call the exact same code 
> with the same parameters from a button on the form, it works!
> 
> If I open the source code for the component, the methods all work 
> fine. I've tried setting the _4D_OPTION_BLOCKING_EXTERNAL_PROCESS 
> environment variable to both "true" (which is what I want) and 
> "false" immediately before the LEP call in the component, but it 
> makes no difference.
> 
> This is happening on Windows 10, with v16.0 64-bit, v16.2 32 bit, and 
> with the component compiled for just 32-bit, just 64-bit, or both.
> 
> Any bright ideas out there?
> 
> Thanks,
> Adrian
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
---
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Port 80 Security Scanning - e.g. Qualys

2017-12-04 Thread Randy Engle via 4D_Tech
Our company and at least one other 4D developer have recently been hit with our 
customers doing a security scan of our 4D based web applications.

In this particular case, they are using a service from "Qualys" that throws 
everything, including the kitchen sink at our web application.
In a lot of these cases, they are running these scans internally, inside of 
their own network and behind their main firewall.
(i.e. protection from mean, rotten, nasty, disgruntled employees that are doing 
bad things on their network)

4D Web server is not designed to handle many of the reported issues, such as 
DDOS attacks, "Slow HTTP Headers", etc.

The cyber security teams at our customer sites are quite adamant that "we" need 
to handle all of this stuff.
In most cases, saying:  "No, we don't handle that, you need to handle it", 
falls on some pretty deaf ears.
These cyber security teams live and breathe for the explicit life purpose of 
finding security holes, no matter how obscure and unlikely.
Basic unquestioned attitude is "We find it, you fix it" period.

So, the "answer" is to put a firewall of some sort in front of our web 
application, i.e. likely on the same machine as our web server application.

We don't have the staff resources to invest in the time it might take to get up 
to speed to handle all of these security issues and implementing a solution 
using, e.g. NGINX or Apache, or other.

So, we are looking for someone who is quite proficient at setting up a solution 
using the above (preferably NGINIX ?, if this will do the trick), to handle 
whatever a scan from Qualys can throw at it.

If you are that person, or know someone who is, please contact me off-line.

Much appreciated.

Randy Engle, Director
XC2 Software LLC – XC2LIVE!


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

Re: Strange problem with v16 and Launch External Process in a component (solved - user error)

2017-12-04 Thread Adrian Boone via 4D_Tech

Hi John,

It turns out that it was a false alarm after all - what I thought was an 
exact copy was missing a space in the path to the executable (which 
explains the immediate return in one case), combined with a bug in the 
component which didn't return false when the executable path didn't exist.


Of course if I hadn't sent this email, I'd never have spotted that 
missing space!


Adrian

On 04/12/2017 17:13, John DeSoi via 4D_Tech wrote:

Anything unusual about the LEP call -- just using locals and specifying all of 
them? That alone should make it execute in blocking mode. E.g.

LAUNCH EXTERNAL PROCESS($cmd;$in;$out;$err)

Lots of bugs have been fixed since 16.0. Have you tried 16.2?

John DeSoi, Ph.D.



On Dec 4, 2017, at 10:36 AM, Adrian Boone via 4D_Tech <4d_tech@lists.4d.com> 
wrote:

We have a component which uses Launch External Process to call an accountancy 
package (Moneyworks) via the command line (Windows and Mac), and have just 
recompiled it for v16 (that's another story...). Now, when any component 
methods which use LEP (i.e. most of them) are called from another method in my 
test database, they always return ok, and the output and error variables are 
always empty. There's no noticeable delay in the debugger so it looks like the 
LEP call simply isn't happening?

Now for the really weird part, I have a form with some common test methods 
linked to some of the buttons - if I call the exact same code with the same 
parameters from a button on the form, it works!

If I open the source code for the component, the methods all work fine. I've tried setting the 
_4D_OPTION_BLOCKING_EXTERNAL_PROCESS environment variable to both "true" (which is what I 
want) and "false" immediately before the LEP call in the component, but it makes no 
difference.

This is happening on Windows 10, with v16.0 64-bit, v16.2 32 bit, and with the 
component compiled for just 32-bit, just 64-bit, or both.

Any bright ideas out there?

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



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

Re: Assign multidimensional array

2017-12-04 Thread Kirk Brooks via 4D_Tech
Ferdinando,
Copy array works fine with 2D arrays if you want $B to be - a copy - of $A.
But it sounds like you need to _append_ the elements.

You can also use COPY ARRAY on specific arrays within the 2D array.
Example:
$A has 4 'arrays' with some number of elements in each array. I have $C
that I want to copy to $A{2}:

COPY ARRAY($C;$A{2})

​This is equivalent to

ARRAY TEXT($A{2}:Size of array($C)) ` assuming text arrays

For($i;1;​
Size of array($C)
​)

$A{2}{$i}:=$C{$i}

End for​


On Mon, Dec 4, 2017 at 9:35 AM, stardata.info via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Hi,
>
> I need to append one array into another array with the same coloumns.
>
> Copy not think that work.
>
> I need to use 4D V12...
>
> Thanks
>
> /Ferdinando/
>
>
> Il 04/12/2017 18:13, 4d_tech-requ...@lists.4d.com ha scritto:
>
>> Message: 10
>> Date: Mon, 4 Dec 2017 17:29:29 +0100
>> From: Arnaud de Montard
>> To: 4D iNug Technical<4d_tech@lists.4d.com>
>> Subject: Re: Assign multidimensional array
>> Message-ID:
>> Content-Type: text/plain; charset=utf-8
>>
>>
>>
>> Le 4 déc. 2017 à 15:59, Chip Scheide via 4D_Tech<4d_tech@lists.4d.com>
>>> a écrit :
>>>
>>> Ferdinando,
>>> not sure if Copy Array will copy multi-dimensional arrays - you could
>>> try.
>>>
>> ARRAY TEXT($zz;2;3)
>> $zz{0}{0}:="test"
>> ARRAY TEXT($zzz;0;0)
>> COPY ARRAY($zz;$zzz)
>> ASSERT($zzz{0}{0}="test")  //0 index value
>> ASSERT(Size of array($zzz{2})=3)  //lines
>> ASSERT(Size of array($zzz)=2)  //columns
>>
>> it works:-)
>> -- Arnaud de Montard
>>
>
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
>



-- 
Kirk Brooks
San Francisco, CA
===

*The only thing necessary for the triumph of evil is for good men to do
nothing.*

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

Resize SVG_Use

2017-12-04 Thread truegold via 4D_Tech
Hi All,

I’m in the process of changing some SVG routines to be a bit more efficient (I 
think).

Miyako showed me how to embed svg images as “defs”:

$defs:=SVG_Define_symbol ($domSvg_ptr->;"defs”) 

so I could reuse the graphics without reloading them several times. This part 
works perfectly.

Previously I would read the image from disk and resize and place:

$tDom_Image:=SVG_New_image ($$domSvg_ptr->;$image_t;$x;$y;$w;$h)

Worked great! no matter the size of the original svg image on disk which are in 
the neighborhood of 1000 pixels width/height (although there is variation). And 
I can’t set the originals to a fixed size because the end user can change the 
same image, in different places of the svg document, to different sizes. So I 
need to managing the image sizes dynamically.

Anyway, now that I am accessing these “defs” images using:

$glyph:=SVG_Use ($domSvg_ptr->;$id;$inX;$inY;$size_IntrcG;$size_IntrcG) 


I have to both resize the image and make sure it stays at the x/y coords I need.

But it’s not!

To reset the size I believe I have to use (0.02 being used for testing):

SVG_SET_TRANSFORM_SCALE ($glyph;0.02;0.02)  


To reposition at the x/y I believe I have to use:

SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY)

The scaling seems to scale BUT the translate is not placing the images at the 
x/y location I need. Although, the attributes for the object look correct:

height - 14
transform - scale(0.02,0.02)
width - 14
x - 660
xlink:href - #S09
y - 660

I am assuming (until I know better) that these values are correct.

So I must be missing something? How do I control both the height/width (I think 
I am) and the exact x/y placement when I am creating an image using SVG_Use?

Anyone?

Thanks,
John…


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

Ref: Resize SVG_Use

2017-12-04 Thread truegold via 4D_Tech
Hi All,

Note: If I apply the transform immediately after I create the symbol:

$symbol:=DOM Create XML 
element($defs;"image";"id";$name;"xlink:href";$image;"x";0;"y";0;"width";$width;"height";$height)
   
SVG_SET_TRANSFORM_SCALE ($symbol;18/$width;18/$height)

That seems to work and would be fine if all I needed were uniform sizes in the 
doc. In this example I am resizing them so they are 18 by 18 pixels. But as 
indicated previously the end user can set a size property to enlarge or shrink 
these sizes for the same symbol in different parts of the doc. So I need to 
resize and reposition where they are actually used.

Not sure if this is a clue or…

John...


> Hi All,
> 
> I’m in the process of changing some SVG routines to be a bit more efficient 
> (I think).
> 
> Miyako showed me how to embed svg images as “defs”:
> 
> $defs:=SVG_Define_symbol ($domSvg_ptr->;"defs”) 
> 
> so I could reuse the graphics without reloading them several times. This part 
> works perfectly.
> 
> Previously I would read the image from disk and resize and place:
> 
> $tDom_Image:=SVG_New_image ($$domSvg_ptr->;$image_t;$x;$y;$w;$h)
> 
> Worked great! no matter the size of the original svg image on disk which are 
> in the neighborhood of 1000 pixels width/height (although there is 
> variation). And I can’t set the originals to a fixed size because the end 
> user can change the same image, in different places of the svg document, to 
> different sizes. So I need to managing the image sizes dynamically.
> 
> Anyway, now that I am accessing these “defs” images using:
> 
> $glyph:=SVG_Use ($domSvg_ptr->;$id;$inX;$inY;$size_IntrcG;$size_IntrcG)   
> 
> 
> I have to both resize the image and make sure it stays at the x/y coords I 
> need.
> 
> But it’s not!
> 
> To reset the size I believe I have to use (0.02 being used for testing):
> 
> SVG_SET_TRANSFORM_SCALE ($glyph;0.02;0.02)
> 
> 
> To reposition at the x/y I believe I have to use:
> 
> SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY)
> 
> The scaling seems to scale BUT the translate is not placing the images at the 
> x/y location I need. Although, the attributes for the object look correct:
> 
> height - 14
> transform - scale(0.02,0.02)
> width - 14
> x - 660
> xlink:href - #S09
> y - 660
> 
> I am assuming (until I know better) that these values are correct.
> 
> So I must be missing something? How do I control both the height/width (I 
> think I am) and the exact x/y placement when I am creating an image using 
> SVG_Use?
> 
> Anyone?
> 
> Thanks,
> John…
> 
> 

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

Re: Resize SVG_Use

2017-12-04 Thread Keisuke Miyako via 4D_Tech
translate offsets the x/y by the value specified.
the x/y you pass are not absolute coordinates (unless, of course, the x/y in 
element are 0,0)

2017/12/05 8:04、truegold via 4D_Tech 
<4d_tech@lists.4d.com> のメール:
To reposition at the x/y I believe I have to use:



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

Re: Ref: Resize SVG_Use

2017-12-04 Thread truegold via 4D_Tech
Hi Miyako,

> translate offsets the x/y by the value specified. 
> the x/y you pass are not absolute coordinates (unless, of course, the x/y in 
> element are 0,0) 

Agree!

I have tested setting the x/y w/h to 0 thinking that it would apply correctly 
but the svg looks like this:

  
> SVG_SET_TRANSFORM_SCALE ($symbol;18/$width;18/$height)
> 
> That seems to work and would be fine if all I needed were uniform sizes in 
> the doc. In this example I am resizing them so they are 18 by 18 pixels. But 
> as indicated previously the end user can set a size property to enlarge or 
> shrink these sizes for the same symbol in different parts of the doc. So I 
> need to resize and reposition where they are actually used.
> 
> Not sure if this is a clue or…
> 
> John...
> 
> 
>> Hi All,
>> 
>> I’m in the process of changing some SVG routines to be a bit more efficient 
>> (I think).
>> 
>> Miyako showed me how to embed svg images as “defs”:
>> 
>> $defs:=SVG_Define_symbol ($domSvg_ptr->;"defs”) 
>> 
>> so I could reuse the graphics without reloading them several times. This 
>> part works perfectly.
>> 
>> Previously I would read the image from disk and resize and place:
>> 
>> $tDom_Image:=SVG_New_image ($$domSvg_ptr->;$image_t;$x;$y;$w;$h)
>> 
>> Worked great! no matter the size of the original svg image on disk which are 
>> in the neighborhood of 1000 pixels width/height (although there is 
>> variation). And I can’t set the originals to a fixed size because the end 
>> user can change the same image, in different places of the svg document, to 
>> different sizes. So I need to managing the image sizes dynamically.
>> 
>> Anyway, now that I am accessing these “defs” images using:
>> 
>> $glyph:=SVG_Use ($domSvg_ptr->;$id;$inX;$inY;$size_IntrcG;$size_IntrcG)  
>> 
>> 
>> I have to both resize the image and make sure it stays at the x/y coords I 
>> need.
>> 
>> But it’s not!
>> 
>> To reset the size I believe I have to use (0.02 being used for testing):
>> 
>> SVG_SET_TRANSFORM_SCALE ($glyph;0.02;0.02)   
>> 
>> 
>> To reposition at the x/y I believe I have to use:
>> 
>> SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY)
>> 
>> The scaling seems to scale BUT the translate is not placing the images at 
>> the x/y location I need. Although, the attributes for the object look 
>> correct:
>> 
>> height - 14
>> transform - scale(0.02,0.02)
>> width - 14
>> x - 660
>> xlink:href - #S09
>> y - 660
>> 
>> I am assuming (until I know better) that these values are correct.
>> 
>> So I must be missing something? How do I control both the height/width (I 
>> think I am) and the exact x/y placement when I am creating an image using 
>> SVG_Use?
>> 
>> Anyone?
>> 
>> Thanks,
>> John…
>> 
>> 
> 

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

Re: Ref: Resize SVG_Use

2017-12-04 Thread truegold via 4D_Tech
Hi,

As an aside I am testing in a small sample and opening inn the viewer.

if I use this line:

SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY)

it works great! Starts the draw exactly at the x and y.

But if I add this line:

SVG_SET_TRANSFORM_SCALE ($glyph;$_w/$width;$_w/$height)

Then it goes from it’s correct location and jumps to the 0,0 origin I think..

BTW, I am using 4D v16R4 if that matters.

Maybe there’s a better ay to scale? I need to to scale the images based upon 
their original size (width, height) down to what ever the end users selects. 
Usually (in pixels) 14, 16, 18, 20, 24, 28, etc. These need to transform based 
upon the original width and height (usually close to 1000) to a small 
percentage.

Is there another way? A better way?

Thanks,
John…



> Hi Miyako,
> 
>> translate offsets the x/y by the value specified. 
>> the x/y you pass are not absolute coordinates (unless, of course, the x/y in 
>> element are 0,0) 
> 
> Agree!
> 
> I have tested setting the x/y w/h to 0 thinking that it would apply correctly 
> but the svg looks like this:
> 
>  x="0" xlink:href="#S09" y="0”/>
> 
> and the image seems to be at x=0, y=0 even though the size seems to be 
> correct? Always!
> 
> Thanks,
> John…
> 
> 
>> Hi All,
>> 
>> Note: If I apply the transform immediately after I create the symbol:
>> 
>> $symbol:=DOM Create XML 
>> element($defs;"image";"id";$name;"xlink:href";$image;"x";0;"y";0;"width";$width;"height";$height)
>> 
>> SVG_SET_TRANSFORM_SCALE ($symbol;18/$width;18/$height)
>> 
>> That seems to work and would be fine if all I needed were uniform sizes in 
>> the doc. In this example I am resizing them so they are 18 by 18 pixels. But 
>> as indicated previously the end user can set a size property to enlarge or 
>> shrink these sizes for the same symbol in different parts of the doc. So I 
>> need to resize and reposition where they are actually used.
>> 
>> Not sure if this is a clue or…
>> 
>> John...
>> 
>> 
>>> Hi All,
>>> 
>>> I’m in the process of changing some SVG routines to be a bit more efficient 
>>> (I think).
>>> 
>>> Miyako showed me how to embed svg images as “defs”:
>>> 
>>> $defs:=SVG_Define_symbol ($domSvg_ptr->;"defs”) 
>>> 
>>> so I could reuse the graphics without reloading them several times. This 
>>> part works perfectly.
>>> 
>>> Previously I would read the image from disk and resize and place:
>>> 
>>> $tDom_Image:=SVG_New_image ($$domSvg_ptr->;$image_t;$x;$y;$w;$h)
>>> 
>>> Worked great! no matter the size of the original svg image on disk which 
>>> are in the neighborhood of 1000 pixels width/height (although there is 
>>> variation). And I can’t set the originals to a fixed size because the end 
>>> user can change the same image, in different places of the svg document, to 
>>> different sizes. So I need to managing the image sizes dynamically.
>>> 
>>> Anyway, now that I am accessing these “defs” images using:
>>> 
>>> $glyph:=SVG_Use ($domSvg_ptr->;$id;$inX;$inY;$size_IntrcG;$size_IntrcG) 
>>> 
>>> 
>>> I have to both resize the image and make sure it stays at the x/y coords I 
>>> need.
>>> 
>>> But it’s not!
>>> 
>>> To reset the size I believe I have to use (0.02 being used for testing):
>>> 
>>> SVG_SET_TRANSFORM_SCALE ($glyph;0.02;0.02)  
>>> 
>>> 
>>> To reposition at the x/y I believe I have to use:
>>> 
>>> SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY)
>>> 
>>> The scaling seems to scale BUT the translate is not placing the images at 
>>> the x/y location I need. Although, the attributes for the object look 
>>> correct:
>>> 
>>> height - 14
>>> transform - scale(0.02,0.02)
>>> width - 14
>>> x - 660
>>> xlink:href - #S09
>>> y - 660
>>> 
>>> I am assuming (until I know better) that these values are correct.
>>> 
>>> So I must be missing something? How do I control both the height/width (I 
>>> think I am) and the exact x/y placement when I am creating an image using 
>>> SVG_Use?
>>> 
>>> Anyone?
>>> 
>>> Thanks,
>>> John…
>>> 
>>> 
>> 
> 

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

Ref: Resize SVG_Use

2017-12-04 Thread truegold via 4D_Tech
Hi,

Does the SVG_SET_TRANSFORM_SCALE  change the image size and also the the area 
size? In others words (even though the xml in the 4D SVG Viewer doesn’t show 
it) is 500 pixel width still 500 pixels after the size transform? Or is 500 * 
scale?

I'm asking because as soon as I change the scale then the x and y begins 
shifting in the picture.

When the scale is 1 things move and align pretty well.

When the scale is .90 then the image shifts to the left and top as the image 
also shrinks

When the scale is .75 (and so on) then the image shifts to the left and top as 
the image also shrinks.

Perhaps that is the problem and I have a setting that needs t be set 
differently?

Thanks,
John...


> Hi,
> 
> As an aside I am testing in a small sample and opening inn the viewer.
> 
> if I use this line:
> 
> SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY)
> 
> it works great! Starts the draw exactly at the x and y.
> 
> But if I add this line:
> 
> SVG_SET_TRANSFORM_SCALE ($glyph;$_w/$width;$_w/$height)
> 
> Then it goes from it’s correct location and jumps to the 0,0 origin I think..
> 
> BTW, I am using 4D v16R4 if that matters.
> 
> Maybe there’s a better ay to scale? I need to to scale the images based upon 
> their original size (width, height) down to what ever the end users selects. 
> Usually (in pixels) 14, 16, 18, 20, 24, 28, etc. These need to transform 
> based upon the original width and height (usually close to 1000) to a small 
> percentage.
> 
> Is there another way? A better way?
> 
> Thanks,
> John…
> 
> 
> 
>> Hi Miyako,
>> 
>>> translate offsets the x/y by the value specified. 
>>> the x/y you pass are not absolute coordinates (unless, of course, the x/y 
>>> in element are 0,0) 
>> 
>> Agree!
>> 
>> I have tested setting the x/y w/h to 0 thinking that it would apply 
>> correctly but the svg looks like this:
>> 
>> > x="0" xlink:href="#S09" y="0”/>
>> 
>> and the image seems to be at x=0, y=0 even though the size seems to be 
>> correct? Always!
>> 
>> Thanks,
>> John…
>> 
>> 
>>> Hi All,
>>> 
>>> Note: If I apply the transform immediately after I create the symbol:
>>> 
>>> $symbol:=DOM Create XML 
>>> element($defs;"image";"id";$name;"xlink:href";$image;"x";0;"y";0;"width";$width;"height";$height)
>>>
>>> SVG_SET_TRANSFORM_SCALE ($symbol;18/$width;18/$height)
>>> 
>>> That seems to work and would be fine if all I needed were uniform sizes in 
>>> the doc. In this example I am resizing them so they are 18 by 18 pixels. 
>>> But as indicated previously the end user can set a size property to enlarge 
>>> or shrink these sizes for the same symbol in different parts of the doc. So 
>>> I need to resize and reposition where they are actually used.
>>> 
>>> Not sure if this is a clue or…
>>> 
>>> John...
>>> 
>>> 
 Hi All,
 
 I’m in the process of changing some SVG routines to be a bit more 
 efficient (I think).
 
 Miyako showed me how to embed svg images as “defs”:
 
 $defs:=SVG_Define_symbol ($domSvg_ptr->;"defs”) 
 
 so I could reuse the graphics without reloading them several times. This 
 part works perfectly.
 
 Previously I would read the image from disk and resize and place:
 
 $tDom_Image:=SVG_New_image ($$domSvg_ptr->;$image_t;$x;$y;$w;$h)
 
 Worked great! no matter the size of the original svg image on disk which 
 are in the neighborhood of 1000 pixels width/height (although there is 
 variation). And I can’t set the originals to a fixed size because the end 
 user can change the same image, in different places of the svg document, 
 to different sizes. So I need to managing the image sizes dynamically.
 
 Anyway, now that I am accessing these “defs” images using:
 
 $glyph:=SVG_Use ($domSvg_ptr->;$id;$inX;$inY;$size_IntrcG;$size_IntrcG)
 
 
 I have to both resize the image and make sure it stays at the x/y coords I 
 need.
 
 But it’s not!
 
 To reset the size I believe I have to use (0.02 being used for testing):
 
 SVG_SET_TRANSFORM_SCALE ($glyph;0.02;0.02) 
 
 
 To reposition at the x/y I believe I have to use:
 
 SVG_SET_TRANSFORM_TRANSLATE ($glyph;$inX;$inY)
 
 The scaling seems to scale BUT the translate is not placing the images at 
 the x/y location I need. Although, the attributes for the object look 
 correct:
 
 height - 14
 transform - scale(0.02,0.02)
 width - 14
 x - 660
 xlink:href - #S09
 y - 660
 
 I am assuming (until I know better) that these values are correct.
 
 So I must be missing something? How do I control both the height/width (I 
 think I am) and the exact x/y placement when I am creating an image using 
 SVG_Use?
 
 Anyone?
 
 Thanks,
 John…
 
 
>>> 
>> 
> 

*