Re: Rotate Picture

2019-06-22 Thread Keisuke Miyako via 4D_Tech
I think the default export option is "copy"

if you don't SVG_CLEAR (see Cannon's code) you'd be leaking memory.

I suppose you could save speed with the "own" option (you won't need to CLEAR 
any more)

but the difference is probably negligible.

2019/06/23 9:28、JOHN BAUGHMAN via 4D_Tech 
<4d_tech@lists.4d.com>のメール:
$MyPicture:=SVG_Export_to_picture ($SVGRef)  //The image is correctly rotated 
but is now in a square picture



**
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: Rotate Picture

2019-06-22 Thread Cannon Smith via 4D_Tech
For all I remember you gave it to me! :-)

Glad it works.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Aetna, AB Canada




> On Jun 22, 2019, at 6:28 PM, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Your code looked vaguely familiar to me. I had not thought to look and see if 
> I already had a method to rotate pictures. Sure enough I do. Looks very 
> similar to yours, even uses the same  variable conventions. Perhaps you gave 
> this to me back in 2011?
> 
> In any event thanks. I am going to use your method as it is a bit more 
> compact than mine. Mine is a tad faster, however. I posted mine below for 
> comparison.

**
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: Rotate Picture

2019-06-22 Thread JOHN BAUGHMAN via 4D_Tech
Thanks Cannon.

Your code looked vaguely familiar to me. I had not thought to look and see if I 
already had a method to rotate pictures. Sure enough I do. Looks very similar 
to yours, even uses the same  variable conventions. Perhaps you gave this to me 
back in 2011?

In any event thanks. I am going to use your method as it is a bit more compact 
than mine. Mine is a tad faster, however. I posted mine below for comparison.

John


——]
C_PICTURE($1;$MyPicture)
C_LONGINT($2;$rotation)
  // 
$error:=SVG_Set_error_handler ("SVG_error_mgmt")
$MyPicture:=$1
$rotation:=$2
$temporaryPictureFilePath:=Temporary folder+"tempPicture.jpg"
WRITE PICTURE FILE($temporaryPictureFilePath;$MyPicture)  //write the 
picture to file so we can get it with a URL

PICTURE PROPERTIES($MyPicture;$width;$height)

If ($width>=$height)  //get the largest dimension of the picture
$svgAreaSize:=$width
Else 
$svgAreaSize:=$height
End if 

$SVGRef:=SVG_New ($svgAreaSize;$svgAreaSize)  //make the new SVG area 
big enough to hold the picture rotated

If ($width>=$height)  //center the picture in the SVG area 
$picRef:=SVG_New_image 
($SVGRef;"file://"+$temporaryPictureFilePath;0;($width/2)-($height/2);$width;$height)
Else 
$picRef:=SVG_New_image 
($SVGRef;"file://"+$temporaryPictureFilePath;($height/2)-($width/2);0;$width;$height)
End if 

SVG_SET_TRANSFORM_ROTATE 
($picRef;$rotation;$svgAreaSize/2;$svgAreaSize/2)  //rotate it

$MyPicture:=SVG_Export_to_picture ($SVGRef)  //The image is correctly 
rotated but is now in a square picture

Case of   //crop the picture back down to the size of the image if the 
image is not square
: ($width>$height)
TRANSFORM 
PICTURE($MyPicture;Crop;($width/2)-($height/2);0;$height;$svgAreaSize)
: ($height>$width)
TRANSFORM 
PICTURE($MyPicture;Crop;0;($height/2)-($width/2);$svgAreaSize;$width)
End case 

$0:=$MyPicture

 

> On Jun 22, 2019, at 11:37 AM, Cannon Smith via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> Hi John,
> 
> Here is the code from a method I use called Photo_Rotate:
> 
>  //This method rotates a picture. While it will rotate the picture to
>  //any angle, this method is really expecting it to rotate 90˚, 180˚,
>  //or 270˚.
> 
> C_PICTURE($1;$gPicture)
> C_REAL($2;$rDegrees)  //Expects 90, 180, or 270
> C_PICTURE($0)
> 
> $gPicture:=$1
> $rDegrees:=$2
> 
> C_LONGINT($lWidth;$lHeight)
> C_TEXT($svgRef;$imageRef)
> 
> PICTURE PROPERTIES($gPicture;$lWidth;$lHeight)
> $svgRef:=SVG_New ($lWidth;$lHeight)
> $imageRef:=SVG_New_embedded_image ($svgRef;$gPicture;0;0;".jpeg")
> 
> If (($rDegrees=90) | ($rDegrees=270))
>   SVG_SET_TRANSFORM_ROTATE ($imageRef;$rDegrees;($lHeight/2);($lWidth/2))
>   SVG_SET_TRANSFORM_TRANSLATE 
> ($imageRef;(($lHeight-$lWidth)/2);(($lWidth-$lHeight)/2))
>   DOM SET XML 
> ATTRIBUTE($svgRef;"height";String($lWidth);"width";String($lHeight))
> Else   //180
>   SVG_SET_TRANSFORM_ROTATE ($imageRef;$rDegrees;($lWidth/2);($lHeight/2))
> End if 
> 
> $0:=SVG_Export_to_picture ($svgRef)
> SVG_CLEAR ($svgRef)
> 
> HTH.
> 
> --
> Cannon.Smith
> Synergy Farm Solutions Inc.
> Aetna, AB Canada
> 
> 
> 
> 
>> On Jun 22, 2019, at 3:34 PM, JOHN BAUGHMAN via 4D_Tech 
>> <4d_tech@lists.4d.com> wrote:
>> 
>> If not 4D commands, what is the quickest and easiest way to rotate a picture 
>> in a picture variable? Anyone got code they could share?
> 
> **
> 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
**

Re: Rotate Picture

2019-06-22 Thread Cannon Smith via 4D_Tech
Hi John,

Here is the code from a method I use called Photo_Rotate:

  //This method rotates a picture. While it will rotate the picture to
  //any angle, this method is really expecting it to rotate 90˚, 180˚,
  //or 270˚.

C_PICTURE($1;$gPicture)
C_REAL($2;$rDegrees)  //Expects 90, 180, or 270
C_PICTURE($0)

$gPicture:=$1
$rDegrees:=$2

C_LONGINT($lWidth;$lHeight)
C_TEXT($svgRef;$imageRef)

PICTURE PROPERTIES($gPicture;$lWidth;$lHeight)
$svgRef:=SVG_New ($lWidth;$lHeight)
$imageRef:=SVG_New_embedded_image ($svgRef;$gPicture;0;0;".jpeg")

If (($rDegrees=90) | ($rDegrees=270))
SVG_SET_TRANSFORM_ROTATE ($imageRef;$rDegrees;($lHeight/2);($lWidth/2))
SVG_SET_TRANSFORM_TRANSLATE 
($imageRef;(($lHeight-$lWidth)/2);(($lWidth-$lHeight)/2))
DOM SET XML 
ATTRIBUTE($svgRef;"height";String($lWidth);"width";String($lHeight))
Else   //180
SVG_SET_TRANSFORM_ROTATE ($imageRef;$rDegrees;($lWidth/2);($lHeight/2))
End if 

$0:=SVG_Export_to_picture ($svgRef)
SVG_CLEAR ($svgRef)

HTH.

--
Cannon.Smith
Synergy Farm Solutions Inc.
Aetna, AB Canada




> On Jun 22, 2019, at 3:34 PM, JOHN BAUGHMAN via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> If not 4D commands, what is the quickest and easiest way to rotate a picture 
> in a picture variable? Anyone got code they could share?

**
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
**

Rotate Picture

2019-06-22 Thread JOHN BAUGHMAN via 4D_Tech
Is it possible to rotate a picture using native 4D commands? Google search 
finds references to Miyako’s rotate picture component, SVG, GitHub, etc.

I do not see any way to do it with Transform Picture.

If not 4D commands, what is the quickest and easiest way to rotate a picture in 
a picture variable? Anyone got code they could share?

Thanks,

John


John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.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
**

HTTP connection to 4D server thru Mac FIrewall

2019-06-22 Thread JOHN BAUGHMAN via 4D_Tech
Client wants to turn on the firewall on the 4D server machine. We have an iOS 
app that requests data from the 4D server which stops connecting with the 
FireWall on. I tried adding 4D server to the allowed apps in Advanced setting 
of the Firewall. 

I also have a Xojo web app that works, but it uses localhost to connect to 4D 
server.

Any suggestions?

Thanks,

John

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.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
**

Re: Import mysql dump into 4D v15, build database structure & import data

2019-06-22 Thread Narinder Chandi via 4D_Tech
Michael,

Hi. Well, straight away I can see that the your CREATE TABLE command includes 
specific directives that only apply to MySQL, e.g.
  ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
so that will most likely be the reason why it is ignored. I think you need to 
adapt MySQL's CREATE TABLE command to be compatible with 4D's SQL syntax.

I searched the 4D Tech archive and found this that might help you:
http://4d.1045681.n5.nabble.com/Creating-SQL-Tables-td5716546.html

Regards,
 
Narinder Chandi,
ToolBox Systems Ltd.
-- 

-Original Message-
From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of 4D Tech Mailing List 
<4d_tech@lists.4d.com>
Reply-To: 4D Tech Mailing List <4d_tech@lists.4d.com>
Date: Saturday, 22 June 2019 at 16:10
To: 4D Tech Mailing List <4d_tech@lists.4d.com>
Cc: jarosz 
Subject: Re: Import mysql dump into 4D v15, build database structure & import 
data

Hi Narinder

I have found that the SQL EXECUTE SCRIPT command will import records into a
pre-existing database structure. So

INSERT INTO `nmiep_action_logs` (`id`, `message_language_key`, `message`,
`log_date`, `extension`, `user_id`, `item_id`, `ip_address`) VALUES
(1, 'PLG_ACTIONLOG_JOOMLA_USER_LOGGED_IN',

'{\"action\":\"login\",\"userid\":\"707\",\"username\":\"admin\",\"accountlink\":\"index.php?option=com_users&task=user.edit&id=707\",\"app\":\"PLG_ACTIONLOG_JOOMLA_APPLICATION_ADMINISTRATOR\"}',
'2019-06-12 11:23:03', 'com_users', 707, 0, 'COM_ACTIONLOGS_DISABLED'),

will import 1 record into the nmiep_action_logs table with 8 fields.

However it will ignore this code in the sql dump/import file

CREATE TABLE `nmiep_action_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `message_language_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
DEFAULT '',
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `log_date` datetime NOT NULL DEFAULT '-00-00 00:00:00',
  `extension` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `user_id` int(11) NOT NULL DEFAULT '0',
  `item_id` int(11) NOT NULL DEFAULT '0',
  `ip_address` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT
'0.0.0.0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Do I need to write a database structure creation routine to parse this?
Or has anyone written one already?
Or do newer versions of 4D interpret this and create the database table and
fields?

Thanks

Michael



**
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: Import mysql dump into 4D v15, build database structure & import data

2019-06-22 Thread jarosz via 4D_Tech
Hi Narinder

I have found that the SQL EXECUTE SCRIPT command will import records into a
pre-existing database structure. So

INSERT INTO `nmiep_action_logs` (`id`, `message_language_key`, `message`,
`log_date`, `extension`, `user_id`, `item_id`, `ip_address`) VALUES
(1, 'PLG_ACTIONLOG_JOOMLA_USER_LOGGED_IN',
'{\"action\":\"login\",\"userid\":\"707\",\"username\":\"admin\",\"accountlink\":\"index.php?option=com_users&task=user.edit&id=707\",\"app\":\"PLG_ACTIONLOG_JOOMLA_APPLICATION_ADMINISTRATOR\"}',
'2019-06-12 11:23:03', 'com_users', 707, 0, 'COM_ACTIONLOGS_DISABLED'),

will import 1 record into the nmiep_action_logs table with 8 fields.

However it will ignore this code in the sql dump/import file

CREATE TABLE `nmiep_action_logs` (
  `id` int(10) UNSIGNED NOT NULL,
  `message_language_key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL
DEFAULT '',
  `message` text COLLATE utf8mb4_unicode_ci NOT NULL,
  `log_date` datetime NOT NULL DEFAULT '-00-00 00:00:00',
  `extension` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `user_id` int(11) NOT NULL DEFAULT '0',
  `item_id` int(11) NOT NULL DEFAULT '0',
  `ip_address` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT
'0.0.0.0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Do I need to write a database structure creation routine to parse this?
Or has anyone written one already?
Or do newer versions of 4D interpret this and create the database table and
fields?

Thanks

Michael




--
Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
**
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
**

HTTP connection to 4D server thru Mac FIrewall

2019-06-22 Thread JOHN BAUGHMAN via 4D_Tech
Client wants to turn on the firewall on the 4D server machine. We have an iOS 
app that requests data from the 4D server which stops connecting with the 
FireWall on. I tried adding 4D server to the allowed apps in Advanced setting 
of the Firewall. 

I also have a Xojo web app that works, but it uses localhost to connect to 4D 
server.

Any suggestions?

Thanks,

John

John Baughman
Kailua, Hawaii
(808) 262-0328
john...@hawaii.rr.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
**