Groovy File uploading and execute - file-upload

I want to upload the file in the Query tool page from my application .
I saved all the SQL scripts in my project's folder i need to upload those scripts 1 by 1 and execute it. For my automation test script
And the file uploading is dependent.
please give me some idea's how to achieve this.
Thanks,
Ashwin

You haven't given enough information for anyone to really help you. Where are you uploading the file to? What approach have you already tried? Why didn't it work?
Assuming the client and the server are remote, you could upload the file using HTTP. There are many HTTP libraries available in Groovy and Java that you could use. Examples include HttpBuilder that could be used on the client-side and Commons FileUpload on the server side.
For executing the SQL, the groovy.sql.Sql class from the standard Groovy libraries should help.

Related

Does anyone know whether Apache Ctakes can run UMLS without internet connection?

Does anyone know whether Apache Ctakes can run UMLS without internet connection and whether there is a good Python wrapper around Ctakes ?
You can use cTAKES dictionary creator GUI to create dictionary of your choice and load the script in MySQL DB. This was you dont need internet connection as you will be relying on local database for analysis.
We have used this approach in our development where cTAKES REST service will be talking to our local DB.
Can it? Or should it? Can? yes, source code is available. Should? not if you are in violation of the NLM UMLS license agreement.
This is a partial answer. I have no idea about the Python wrapper.
The UMLS files can be downloaded download here:
https://www.nlm.nih.gov/research/umls/licensedcontent/umlsknowledgesources.html
You need to be a registered UMLS user in order to download the zip file. The MetamorphoSys tool is included in the download. This tool can be used to load the UMLS data files into MySQL, SQL Server, or an Oracle database.

Export file from NetSuite's FileCabinet to FTP

File resides in the NetSuite file cabinet and needs to be placed on an FTP server each day.
I'm not sure how to handle this via Suitelet/RESTlet, or if it's possible - but would prefer to not use an external source/application.
My current and hopefully temporary workaround is a local scheduled task to run a script to pull files from NetSuite & upload to the FTP.
In SuiteScript 2.0, although unsecured FTP is still not support, but SS2.0 has the capability to do SFTP. See http://www.upilioconsulting.com/blog/netsuite-2016-2-sftp-suitescript-2-0/
In SuiteScript 1.0, it's not supported. The workaround is that you'll need to write a middleware code (i.e. in PHP) and let the middleware do the FTP transfer.
Netsuite doesn't interact with FTP.
You need a bridge server of some sort that runs a web app (full blown Apache or nginx running PHP or just a simple Node service)
Just get a server and install some web server/web service and POST your files to it (nlapiRequestURL with a Scheduled script). Have the web app on the bridge server send the files to the FTP server. If you are using Netsuite you can afford the cost of the bridge server.
One possible solution is to create a saved search on the Documents to list out all the files in Netsuite filtering by createdate or lastmodifieddate. Create a scheduler to fetch only the new files and save them locally where you want.
Note all the files will be in base64 encoded string format, you need to decode again to obtain the file.
As bknights said NetSuite doesn't support FTP. You need a web server(any server side language can do for that matter, I have written one in Node.js), to receive the files.
The file content for text file will be in Text format, so, no decode logic required for text files. However, binary/pdf/image and other would be in base64 format, as NetSuite's JS has no way of handling binary data. So, make sure you decode it before you create the file on your FTP Server.

Is it possible to rename a file on FTP server programmatically using cocoa?

My basic requirement is to add a ".temp" suffix to a file while it is getting uploaded on to the FTP server (suffix should be only for time until the file is fully uploaded).
As per my understanding, i thought this could be achieved by: Add a suffix to file on the local machine, then upload it and after the upload is complete, rename the file to remove suffix on server.
But now the another problem is that i could not found a way to rename a file on FTP server using cocoa. I know renaming a file is feasible using Java or other languages but i want to achieve the same in objectiveC.
Please tell be if the above task is feasible and if it is what is the approach i should follow?
FYI: I know how to upload and download a file on FTP server using NSInputStream and NSOutputStream.
Thanks. I'd appreciate any help.
Take a look at CFNetwork FTP docs. They do not mention exactly your case, but there may be a way to sent RNFR and RNTO commands over the stream.
https://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/CFFTPTasks/CFFTPTasks.html#//apple_ref/doc/uid/TP30001132-CH9-SW1
There is also a sample project you can look into:
https://developer.apple.com/library/ios/samplecode/SimpleFTPSample/Listings/Read_Me_About_SimpleFTPSample_txt.html
This library claims to do what you want (rename remote files)
http://www.chilkatsoft.com/ftp-objc.asp

Symfony 1.4 : How to generate .SQL from fixture files

I have my symfony project on my dev box machine and also on a hosted environment where i have only FTP and HTTP access (i have a phpmyadmin access to my prod DB). This hosted version is an alpha release that should be initialized with fixtures.
Problem is : to do that, i have to write/update .yml fixtures in local, insert them in local DB with the symfony task, go on my local PMA, generate a data export, go on prod PMA and import the data...
Is there any way to generate a .sql file from my local fixtures so that i can insert them directly through my prod PMA ?
Thanks
The easiest is probably for you to look at this website:
http://brentertainment.com/2010/02/15/run-a-symfony-task-from-your-model-or-action/
You may run tasks from the web, you might make it a bit smarter and allow to run tasks from the web. Also clearing the cache might be a useful thing to extend to your admin interface for example.
I think you can't "out of the box" in symfony.
BUT you may be able to use the Doctrine Profiler to log all the SQL requests done by the sfDoctrineDataLoadTask task class into a file.
Are you using the symfony doctrine:build --all command? When I do that, a schema.sql file is created within the data/sql directory.

Accessing a resource file from a filesystem plugin on SymbianOS

I cannot use the Resource File API from within a file system plugin due to a PlatSec issue:
*PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB
My understanding of the issue is that:
File system plugins are dlls which are executed within the context of the file system process. Therefore all file system plugins must have the TCB PlatSec privilege which in turn means they cannot link against a dll that is not in the TCB.
Is there a way around this (without resorting to a text file or an intermediate server)? I suspect not - but it would be good to get a definitive answer.
The Symbian file server has the following capabilities:
TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD
So any DLL being loaded into the file server process must have at least these capabilities. There is no way around this, short of writing a new proxy process as you allude to.
However, there is a more fundamental reason why you shouldn't be using bafl.dll from within a fileserver plugin: this DLL provides utility functions which interface to the file servers client API. Attempting to use it from within the filer server will not work; at best, it will lead to the file server deadlocking as it attempts to connect to itself.
I'd suggest rethinking that you're trying to do, and investigating an internal file-server API to achieve it instead.
Using RFs/RFile/RDir APIs from within a file server plugin is not safe and can potentially lead to deadlock if you're not very careful.
Symbian 9.5 will introduce new APIs (RFilePlugin, RFsPlugin and RDirPlugin) which should be used instead.
Theres a proper mechanism for communicating with plugins, RPlugin.
Do not use RFile. I'm not even sure that it would work as the path is checked in Initialise of RFile functions which is called before the plugin stack.
Tell us what kind of data you are storing in the resource file.
Things that usually go into resource files have no place in a file server plugin, even that means hardcoding a few values.
Technically, you can send data to a file server plugin using RFile.Write() but that's not a great solution (intercept RFile.Open("invalid file name that only your plugin understands") in the plugin).
EDIT: Someone indicated that using an invalid file name will not let you send data to the plugin. hey, I didn't like that solution either. for the sake of completness, I should clarify. make up a filename that looks OK enough to go through to your plugin. like using a drive letter that doesn't have a real drive attached to it (but will still be considered correct by filename-parsing code).
Writing code to parse the resource file binary in the plugin, while theoratically possible, isn't a great solution either.