Jump to content

john renfrew

  • Content Count

  • Joined

  • Last visited

  • Days Won


john renfrew last won the day on May 28

john renfrew had the most liked content!

Community Reputation

40 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. I was at DevCon, where we heard from the horses mouth so to speak, and as I indicated this was a paraphrase, it was also to get people to see where their strategy seems to be going. Do not believe stuff which says that desktop is going away. Do prepare yourselves and customers for getting and keeping up to date with the latest versions)
  2. Cloud FIRST, not Cloud ONLY Oh, and get with the programme and start learning to update.... That's the message (paraphrased obviously)
  3. ScriptMaster is an army knife kind of plugin, giving you access to the whole of Java(Groovy) from inside FileMaker. It will serve you well to start learning some Groovy at least - not simple but not difficult either - some research would have led you to here for example https://help.returnpath.com/hc/en-us/articles/222445367-How-to-implement-the-List-Unsubscribe-header For the paling part, I am sure there are questions and answers in this forum about that
  4. Dont use stream as the FOS name, its a reserved word.. What are you expecting to get back from the function??? I get something like base6417434013292067398887.txt Do you already know the path to this file?? What do you expect the contents to be? a byte array or something else?? tempFile = File.createTempFile('base64', suffix) fos = new FileOutputStream(tempFile) fos.write(Base64.getDecoder().decode(encodedString)) fos.close() return tempFile.toURL()
  5. Don't use the Sun decoder, use the Java 8+ one... in java.util.Base64.Decoder Base64.getDecoder().decode(encodedString)
  6. 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...
  7. 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???
  8. 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
  9. 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??
  10. 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...
  11. You have to pass the url as a parameter to the function... Works as expected here....
  12. 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.
  13. 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
  14. Mac or Windoze??? I am currently using mysql-connector-java-8.0.13.jar on Mac with no problems...
  15. Let me look at whether I have amended that code at all too... it IS now over 8 years old!!
  • Create New...

Important Information

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