Tools plugin 1.7 (improved zip & unzip)

The very first plugin for Servoy, Tools now reached it’s 7th revision.

I improved the zip and unzip classes to work with folders also and I dropped the DES encryption. The encryption functions have been moved to my latest plugin Cryptor.

Have fun with it and check out my second (Splash) plugin to show a splash screen and my third (Cryptor) plugin…

The tools plugin now holds the following FIFTEEN functions:

FILES
1.zip
zip a (single) file and a folder.

2.unzip
unzip a file, a group of files and folders. REMARK: mac OS X users wonM-^Rt be able to resolve a zipped application with this unzip utility (yet). When you unzip a file or folder to a destination with a file or folder with the same name the file or folder will be numbered. The numbering will be checked also.

CALCULATION
3. getMaxDay
returns the last day of the given month.

  1. getIT2Be
    returns my name, email and GSM.

(STRING) FORMATTING
5. dateFormat
very much like the Java dateFormat class to convert a date to a string and the other way around with (or without) a formatting string.

  1. numberFormat
    formats the (localized) number to the formatString.

  2. secondsFormat
    to make a number of seconds a string and the other way around. formatting like HH:mm:ss.

8.Mirror
reverse a string M-^QmirrorStringM-^R into M-^QgnirtSrorrimM-^R.

VALIDATION
9. isEmail
based on a method I posted earlier on this forum now available in this plugin. It takes a string with one or more email adresses and checks if the format is correct.

  1. isExpired
    takes a year, month and (optional) day and returns a boolean when expired. Can be used to check the expiration date of a credit card.

  2. isInteger
    returns a boolean value, checks a string.

  3. isInRange
    takes dates, numbers/integers and strings and returns true or false.

  • dates: dates need to be set with new Date() not a db timestamp
  • string: there is an option to be set to true if you want to ignore cases
  1. isModulus10
    takes a string, filters all numbers and tells you the result of a modulus10 check. Can be used to check a credit card number.

  2. isNumber
    returns a boolean value after checking a string.

  • localized but will return false when you input thousand seperators.
  1. isTextOnly
    takes a string and returns false if it finds numbers.

The result is attached. Just drop it in your plugins folder and restart Servoy.

Feel free to use it and distribute it but give me credit for it.
The plugin is free, provided M-^Qas isM-^R and I can not take any responsibility for the way it behaves or works.

And I would really like some feedback on (most) wanted functions. Maybe in the direction of validation…

Cheers

Could you do a Phone # format validation/standardization?

eg (123) 456-7890

A little more ambitious, using an online database;
Maybe a Zip Code / city / area code crossreference?

I think you’re moving into the area of address validation here…

I’m working on a Dynamic WebService Invoker plugin for Servoy.

On the internet (for example: www.xmethods.com) you can find many webservices (some for free, some for charge) and also many address validation functions (I’ve seen dutch and UK adresscheck, but probably there are functions for other countries as well).

One of these functions, together with the plugin I’m writing probably gives you the functionallity you need.

I hope to release a beta version of the plugin in about a week or so

Paul

We use AddressWizard quite extensively on some of our web sites for addresses in the UK. Will we able to use your new plug in with this service?

http://www.addresswizard.co.uk

I had a look at the website and it looks to be a webservice implementation, but it doesn’t say so.

If it is a webservice implementation, you sure can implement it into Servoy with my plugin. BTW, the plugin is posted on the forum since yesterday.

On http://www.addresswizard.co.uk I see you can register and get some samplecode for implementation in HTML. If you have that samplecode and it is a WebService, then in that samplecode there should be a location (internet address). Use that location as the first parameter for the getWSInfo function of my plugin, and have a look at the result.

With the provided samples in the plugin, you should be able to figure out how to implement it into your Servoy solution.

If needed, send me the samplecode and I’ll have a look at it.

Paul

Having registered with addresswizard, this is what you receive back to include in the relevant web page:

   <SCRIPT
   src="http://www.addresswizard.co.uk/bin/script2.cgi?686F6E616E2E7263693340706F7369746976652D7468696E6B696E672E636F2E756B">
   </SCRIPT>
   <SCRIPT>
     
   </SCRIPT>
  
  
  
    Postcode
    <input type=text name=searchpostcode size=10>
  
  
  
  
  
  
  
    <input type=button
           name=find
           value="Find Address"
           onclick="InvokeAddressWizard('',
                    document.YourAddressForm.searchpostcode.value)">
  <!-- End of AddressWizard HTML

I’ve checked the “http://www.addresswizard.co.uk/bin/script2.cgi?686F6E616E2E7263693340706F7369746976652D7468696E6B696E672E636F2E756B” string, it’s not directly a webservice. This location points to another script on the website and that script then calls another script…

I cannot trace it further, because then you run into authentication issues.

I would suggest you contact this company, to see if they can provide you with the webservice information, if it’s a webservice. Trying to track it down, I was provided with the following address to send questions to: wizard@addresswizard.co.uk

Paul

Thanks for that, I have sent an email to addresswizard to see if they can help.

Meanwhile, do you have any other suggestions for an address lookup web service for the UK that would work with your plugin.

Thanks

I hope they can provide you with the needed info. Please keep us posted on it, 'cause I’d like to know how it evolves…

A good source to find WebServices is www.xmethods.com. I looked there quickly and found a WebService that takes a UK zipcode as input and returns all addresses that go with it. The location of the webservice is: http://www.lixusnet.com/lixusnet/AddFinder.jws?wsdl

Give that as input for the getWSInfo and you’ll see that the methodname = process and that it takes one string as input.

If you look at www.xmethods.com more thorougly, you’ll probably find more WebServices for addressvalidation in the UK.

Paul

We have standard address fields:
Premises
AddressLine1
AddressLine2
AddressLine3
City
County
Postcode
Country

I have had a quick look at the Lixus version and it seems to return an address string, with each address part separated by a comma, but it doesn’t seem to have a fixed number of address items. How will I be able to place the correct part in the relevant field, i.e. put the first line of the address in addressline1, the city into city etc. etc.

config-xml.txt (8.49 KB)

If the service really gives back an unstructured result, it’s virtually impossible to interpret it correctly. If this is the case, it would be a poorly designed webservice.

Are you sure it’s unstructured as you say?

Could you post the return string where you see the problem?

Paul

testCameraScript.txt (1.54 KB)

I typed in the postcode of BN27 1EX, and got the following results:

Array processReturn
{
   item[0] = 12, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[1] = 14, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[2] = 15, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[3] = 16, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[4] = 17, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[5] = 18, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[6] = 19, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[7] = 20, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[8] = 21, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[9] = 22, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[10] = 23, Hawthylands Road, HAILSHAM, BN27 1EX,
   item[11] = 25, Hawthylands Road, HAILSHAM, BN27 1EX
}

I have to say though, that the service is a bit flaky, a couple of times I got a server error.
I also tried the only other service that I could find from websrvice.net and that only checks the first part of the postcode which is very useful.

It looks to me that the format is structured. Every address has 4 entries, all comma separated.

So i asume your problem lies in the fact that you have more fields to fill in your DB than this service given as result. There’s not much that can be done about that, since this is whatever the service provides.

I did a Google search on webservice addressvalidation UK and found the following site: http://undergroundlondon.com/antimega/b … 00106.html
This website has a link to http://www.webservicex.net/WS/default.aspx, which has information on several webservices for address validation.

Maybe one of them does what you’re looking for.

When doing a getWSInfo in Servoy on ‘Home - WebserviceX.net’ I discovered a little bug in the plugin for Servoy. In the case of multiple methods at one webservice location, the info returned by the plugin is only one method, instead of all methods. I’ll fix this and release beta3, probably somewhere tomorrow.

Paul

Unless I have missed something, this service only check the first part of the postcode, and only returns the town/county/psotcode.

What we need is a full postal address lookup. The user may not know the county or town, or it could be wrong. So, the requirement is as addresswizard, i.e. put in the postcode and it returns the whole of the address right down to the letterbox.

I didn’t look into the details of the webservices they offer. All i know is that there are many around, all providing a slightly different service.

Since you seem to be happy with what the addresswizard offers, I think your best option is to await a reply from them, to see if they have their service as a webservice. If they are in way looking towards the future, they will, because webservice is the way of the future to exchange data between servers.

Paul

Hi Paul,

I’m working on a Dynamic WebService Invoker plugin for Servoy.

I was wondering if this might be applicable to our situation here. As a cancer center we track survival of patients (different disease stages, treatments, etc.) to help find cures. If a patient has been lost to follow up, there is a website (the social security death index) in which one can enter the patient’s social security number to see if their death has been reported. I developed a way within FileMaker to have it automatically query the website with the patient’s SSN although I never developed a way to extract the date of death if there was one. In moving to Servoy do you think your bean might help with this? This website is subscription based. If you think it might be possible could I copy what I think are the relevant html pages and the relevant data within them to further explore this? A bean such as you are describing, combined with a method to place extracted data from the web page within the solution would be a huge step up in our efforts to track this in a timely fashion.

John

John,

It depends if the information can be accessed through webservices, based on the SOAP protocol.

Your best bet is to check with the party that hosts the service. If it is SOAP webservice based, it will be easy to implement in Servoy.

Paul

Guys I’m kinda new to the bean thing concept…
I put it2be_tools bean in the folder Servoy\beans…and restarted Servoy 2 times

When i use this code I get NO

if (!plugins.it2be_tools) 
   application.output("no");

So…does this mean the bean is not installed…if not…what am I missing.

Another question…if i use getMaxDay would this be the correct syntax to use it?

var lastday=plugins.it2be_tools.getMaxDay (globals.datum)

or

var lastday=plugins.it2be_tools.getMaxDay (year, month)

wow, I thought I had developed a plugin but I was wrong all along… It is a bean :D

But, tweetie, what happens when you throw the bean in the plugin folder. Does it work then?

And, the right syntax for getMaxDay is```
plugins.it2be_tools.getMaxDay(number [month], number [year])

Clive Sanders:
Meanwhile, do you have any other suggestions for an address lookup web service for the UK that would work with your plugin.

http://www.postcodeanywhere.co.uk/products/default.aspx

If the webservice doesnt work well I have a method that uses stringparsing to get the data out. Not as nice and error proof as a SOAP service I have to say.