Jump to content

john renfrew

  • Content Count

  • Joined

  • Last visited

  • Days Won


john renfrew last won the day on February 11

john renfrew had the most liked content!

Community Reputation

38 Excellent

About john renfrew

  • Rank
    enthusiast, with a bit of geek
  • Birthday 06/21/1957

Profile Information

  • Gender
  • Location

Contact Methods

  • Website URL
  • Skype

FileMaker Experience

  • Skill Level
  • FM Application
    16 Advanced

Platform Environment

  • OS Platform
  • OS Version

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. The error, shown by you is >> Caused by: javax.mail.MessagingException: Could not connect to SMTP host: mail.test.co.uk, port: 587; nested exception is: java.net.ConnectException: Connection refused: connect That code works, so it is something in your parameters...
  2. While answering the previous question I found sometihng that's not terribly brilliant, well at least on this machine Retina iMac with i7 and 32gB RAM... if you just do return new BufferedImage(3000, 3000, 1) you get a black RGB image 3000 * 3000 If you bump up the x param to 10000, you get a nice wide image If you bump up the y param instead, (tested at 4000) then FMP freezes and you have to crash it to get anywhere... This feels completely counter intiuitive and I never love crashing out of FileMaker. Any clues as to why???
  3. Here is a new function for rotation of PNG files, which should fix your issue, if you pass it a file with no transparency or alphait returns an error to you If you do SMGetVariable("cm") after running it you will see the color model Java thinks the file has // RotatePNG ( imgLocation ; degrees ) // v1.0 // 19_03_12 JR import javax.imageio.ImageIO import java.awt.image.BufferedImage import java.awt.Graphics2D import java.awt.geom.AffineTransform import java.awt.RenderingHints isTransparent = {image, x, y -> pixel = image.getRGB(x,y) return (pixel>>24) == 0x00 } containsTransparency = { image -> for (i in 0..<image.getHeight()) { for (j in 0..<image.getWidth()) { if (isTransparent(image, j, i)){ return true } //end if } //end for } //end for } //end containsTransparency containsAlphaChannel ={ image -> return image.getColorModel().hasAlpha() }//end containsAlphaChannel degrees = Double.parseDouble(degrees) radians = Math.toRadians(degrees) isRightAngle = degrees % 90 == 0 BufferedImage img if (imgLocation.indexOf("://") != -1) { img = ImageIO.read(new URL(imgLocation)) } else { img = ImageIO.read(new File(imgLocation)) } cm = img.getColorModel() //check for transparency try{ isAlpha = containsAlphaChannel(img) if ( !isAlpha) { isTransparent = containsTransparency(img) if ( !isTransparent){ return 'ERROR - no transparency' }//end if return 'ERROR - no transparency' } //end if } catch (e) { return 'ERROR - unspecified' } int newWidth = Math.abs(Math.cos(radians) * img.getWidth()) + Math.abs(Math.sin(radians) * img.getHeight()) int newHeight = Math.abs(Math.cos(radians) * img.getHeight()) + Math.abs(Math.sin(radians) * img.getWidth()) at = AffineTransform.getRotateInstance(radians, img.getWidth()/2, img.getHeight()/2) type = BufferedImage.TYPE_INT_ARGB dest = new BufferedImage(newWidth, newHeight, type) g2d = dest.createGraphics() if (!isRightAngle) { // enable antialiasing for odd angles g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } g2d.setTransform(AffineTransform.getTranslateInstance((newWidth - img.getWidth()) / 2, (newHeight - img.getHeight()) / 2)) g2d.drawImage(img, at, null) return dest So only two parameters as you don't care about background colour
  4. Are you trying to rotate and resize at the same time?? Surely when you rotate an image there is no 'spare' to be cast as transparent? If you rotate a 400*300px image by 90degrees then you get a 300*400px image, or are you trying to rotate by other angles??
  5. For JPG Add this at the top import java.awt.Color Then add //add these d.setBackground(Color.WHITE) //or choose any other Color you prefer //see https://docs.oracle.com/javase/7/docs/api/java/awt/Color.html d.clearRect(0, 0, widthInt, heightInt) //before this d.drawImage(img, xInt*-1, yInt*-1, null) This line/param BufferedImage.TYPE_INT_RGB says it is an RGB image If your source has transparency then you want to be using BufferedImage.TYPE_INT_ARGB, but the code to get/create transparency where you have a negtive x or y is a little more difficult...
  6. You have to pass the url as a parameter to the function... Works as expected here....
  7. Marek This is code from a working example.... where the sql identity field was called id, and fm_find is a list of field names that you want to return from the found set So with a table set up of id, firstname, lastname, username, website, email, verified The query SELECT * FROM table WHERE lastname = 'Renfrew' and an fm_find of List ( "first name";"last name";"email") would return to you John|Renfrew|myemail@me.com|23 Luke|Renfrew|luke@me.com|27 etc.etc.
  8. Marek Code here... you will need to adapt but it uses the jar from a known folder location // SCsql ( fm_query ; fm_find ) // 18_10_04 JR // v3.1 // performs SQL query on database and returns fm_find | id import groovy.sql.Sql import java.sql.Connection import java.sql.Driver db = [url:'jdbc:mysql://server:3306/database', username:'user', password:'password', driver: null, host:'server:3306', database:'filename'] jarFile = '/Path/To/File/mysql-connector-java-8.0.13.jar' def driverName = 'com.mysql.jdbc.Driver' def sqlQuery = fm_query //you can input whatever query statement(s) you want here URL url = new File( jarFile ).toURI().toURL() driver = (Driver)Class.forName( driverName, true, new URLClassLoader( [url] as URL[] ) ).newInstance() Properties info = new Properties() info.setProperty( 'user', db.username ) info.setProperty( 'password', db.password ) Connection conn = driver.connect( db.url+ '?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC', info ) //groovy way to exceute query once we have a connection def sql = new Sql( conn ) sqlc = fm_query[0..2] try{ if ( sqlc == 'UPD'){ def ex = sql.executeUpdate (fm_query) return ex //return c + " rows" } else { def ex = sql.execute (fm_query) }// end if } catch (e) { return 'ERROR - ' + e.getMessage() }// end try sqlFind = fm_find.tokenize('\n') Long unix answer = al = '' sql.eachRow(fm_query){ row -> for (i in 0..<sqlFind.size()){ al = al + row."${sqlFind[i]}"+ '|' }// end for answer = (answer? answer + '\n' : '') + al + row.id //id is identity field name in table al = '' try{ unix = row.lastlogin } catch (e){ //do nothing with error }// end try }// end eachRow sql.close() if(!answer){ return 'ERROR - empty set' }// end if return answer
  9. Mac or Windoze??? I am currently using mysql-connector-java-8.0.13.jar on Mac with no problems...
  10. Let me look at whether I have amended that code at all too... it IS now over 8 years old!!
  11. #patientlydrummingfingers little frustrated - this has been ongoing since last August
  12. instead of this one line msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to))
  13. you need three extra variables, with a list of addresses to send to for TO: CC: and BCC: then something like to.tokenize('\n').each{ msg.setRecipient(Message.RecipientType.TO, new InternetAddress(it)) } //end each if (cc){ copy = cc.tokenize('\n') copy.each{ msg.addRecipient(Message.RecipientType.CC, new InternetAddress(it)) }//end each }//end if if (bcc){ copy = bcc.tokenize('\n') copy.each{ msg.addRecipient(Message.RecipientType.BCC, new InternetAddress(it)) }//end each }//end if
  14. Noel depends on which function you are using but something like this... // then the attachment(s) if (attachmentPath) { fl = attachmentPath.tokenize('\n') fl.each{ attachmentPart = new MimeBodyPart() attachmentPart.attachFile(it) mainMultipart.addBodyPart(attachmentPart) //content } //end each }//end if
  15. The Wasabi interface is binary compatible with S3... Cant wait for the European data centre to open....
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.