Create a folder via IBM sbt and share it to specific user: what is the correct Userid format? - ibm-sbt

I'm trying to create a folder and share it to a specific user, using SBT in a standalone Java console application (JDK 7).
I started with FileServiceApp sample in sbt/samples, and modified it with the following code:
...
fsa = new FileServiceApp(url, user, password);
FileService fileService = fsa.getFileService();
File newFolder = fileService.createFolder(newFolderName, "description", shareWith);
shareWith is a String that must contain 3 comma separated values: id,(person/community/group),(reader/Contributor/owner) as described in:
http://infolib.lotus.com/resources/social_business_toolkit/javadoc/com/ibm/sbt/services/client/connections/files/FileService.html#createFolder%28java.lang.String,%20java.lang.String,%20java.lang.String%29
update: I just downloaded SBT 1.1.0 and createFolder no longer accepts the shareWith parameter.
But I keep getting a "Not found" error (if shareWith does not contains those 3 elements the error turns to "Bad request").
edited: Calling createFolder without the third parameter just works, but the folder is not shared of course.
I get the same behaviour if I try with the following (with sbt 1.1.0 too):
File newFolder = fileService.createFolder(newFolderName, "description");
Map<String, String> folderParameters = new HashMap<String, String>();
folderParameters.put("shareWith", userID);
folderParameters.put("sharePermission", "View");
fileService.updateFileMetadata(newFolder, folderParameters);
Userid should be correct at least for Smartcloud (the format is: 1f......-b...-4...-b...-f............2 for Greenhouse, 2......1 for Smartcloud). I verified it using ProfileService.getProfile(id), for Smartcloud.
Code has been executed over a greenhouse account, and a collabserv account, using BasicEndpoint in both cases (SmartCloudEndpoint for Smartcloud).
My questions are:
is "share folder" not available in SmartCloud / Greenhouse, and in that case, is it available for a standalone Connections instance?
am I missing anything? (I only put the jars in lib/ext)

Found that the correct format for FileService.createFolder third parameter was
GUID + ",user,reader"
and not GUID,person,reader. Where GUID is the user GUID as suggested by Paul (not tried with user email yet).

Related

Websphere Console 9.0 - where to specify Application specific files paths in websphere console

Websphere version 9.0 is installed in our RHEL 8.3 OS .
Now in that i have deployed one web app - .war file which contains multiple modules - webservice, web module etc.
This war is successfully deployed and i am able to start it also going to Websphere Enterprise Applications - AppName - START.
The app gets started with a success message.
Now the problem lies ahead. Our application requires a certain file bootstrap.properties.
This file has several configurations like jdbc params, jmx ports, jms configurations, jvm arguments, logging paths etc.
Once the web module of this app is run on <SERVER_IP>:9080/Context url, it throws error on GUI saying Unable to locate bootstrap.properties.
Analysing at the code level , found out that below code is throwing this error:
private static Properties config;
private static final String CONFIG_ROOT = System.getProperty("bootstrap.system.propertiespath");
private static final String configFile = "bootstrap.properties";
private JMXConfig() {
}
public static String getConfigRoot() {
if (CONFIG_ROOT == null) {
System.err.println("Not able to locate bootstrap.properties. Please configure bootstrap.system.propertiespath property.");
throw new ConfigException("Unable to locate bootstrap.properties.");
} else {
return CONFIG_ROOT + File.separator;
}
}
I wanted to know where can we specify the absolute paths in the websphere console where our property file can be read as a system argument once the application is loaded.
Since you're using System.getProperty() to read the property, it needs to be specified as a Java system property passed into the JVM. You can do that from the JVM config panel, adding it as either a custom property on the JVM or as a -D option in the server's generic JVM arguments.
Custom property: https://www.ibm.com/docs/en/was/9.0.5?topic=jvm-java-virtual-machine-custom-properties
Generic JVM argument: https://www.ibm.com/docs/en/was/9.0.5?topic=jvm-java-virtual-machine-settings (search for "Generic JVM arguments")
Note that if you use a custom property, you would simply set the "name" field to "bootstrap.system.propertiespath" and the "value" to the path you need; if you use a generic JVM argument, you'd add an argument with the structure "-Dbootstrap.system.propertiespath=/path/to/file".

jython zxJDBC UCanAccess Driver Class?

Trying to get the combo jython-zxJDBC-UCanAccess working on my Windows machine; been driving me nuts the entire day as I keep getting
zxJDBC.DatabaseError ( driver [net.ucanaccess.jdbc.UcanaccessDriver] not found ), and
zxJDBC.DatabaseError ( driver [ucanaccess] not found )
I had been using this sample code from Gord Thompson with my particulars - keeps failing with driver-not-found errors whatever I try:
from com.ziclix.python.sql import zxJDBC
#Or also import ucanaccess
jdbc_url = "jdbc:ucanaccess://Z:/Companies.accdb"
username = ""
password = ""
driver_class = "net.ucanaccess.jdbc.UcanaccessDriver"
#Or driver_class = "net.ucanaccess.jdbc.UcanloadDriver"
cnxn = zxJDBC.connect(jdbc_url, username, password, driver_class)
crsr = cnxn.cursor()
crsr.execute("SELECT * FROM tblSICs")
for row in crsr.fetchall():
print row[0]
crsr.close()
cnxn.close()
Jython alone works well, I use it with the SikuliX IDE
'from ... import zxJDBC' passes without error
UCanAccess works fine from the command line (console.bat) with my MS
Access database; all 5 JARs are in and as in the CLASSPATH variable
What I don't get is what is "driver_class"?. I thought that the database-specific driver gets located by means of Jython/SikuliX looking in CLASSPATH, where the '.../ucanaccess-5.0.0.jar' is seen.
Here the CLASSPATH:
"c:\Users\User\AppData\Roaming\UCanAccess\lib\hsqldb-2.5.0.jar;c:\Users\User\AppData\Roaming\UCanAccess\lib\jackcess-3.0.1.jar;c:\Users\User\AppData\Roaming\UCanAccess\lib\commons-lang3-3.8.1.jar;c:\Users\User\AppData\Roaming\UCanAccess\lib\commons-logging
-1.2.jar;c:\Users\User\AppData\Roaming\UCanAccess\ucanaccess-5.0.0.jar"
And here is where the SikuliX IDE looks for resources:
D:\Drawer 3\Sikuli\Training\UCanAccess.sikuli Z:\test.sikuli
C:\Users\User\AppData\Roaming\Sikulix\Lib\site-packages
C:\Users\User\AppData\Roaming\Sikulix\Lib
C:\Users\User\AppData\Roaming\Sikulix\Extensions\Lib
C:\Users\User\AppData\Roaming\Sikulix\Extensions\jython-standalone-2.7.2.jar\Lib
classpath
pyclasspath/
Does anyone spot the issue?
Issue was found to be a special twist of SikuliX 2.0.4 which cannot evaluate the CLASSPATH variable. Here the workarounds / SiluliX' way to get to know the location of JARs:
Two Solutions:
Solution A
SikuliX IDE looks into the folder
<C:\Users\User\AppData\Roaming\Sikulix\Extensions>; all five relevant
JAR files need to be places in that folder (no 'lib' subfolder as in
the deployment pack):
ucanaccess-5.0.0.jar
commons-lang3-3.8.1.jar
commons-logging-1.2.jar
hsqldb-2.5.0.jar
jackcess-3.0.1.jar
Check the extension JARs that get found by seeing
SikuliX->Tools->Extensions...
Solution B
Leave the needed JARs in their original deployment folder, and add
their path to the 'Special File'
'C:\Users\User\AppData\Roaming\Sikulix\Extensions\extensions.txt' as:
ucanaccess = C:/Users/User/AppData/Roaming/UCanAccess/ucanaccess-5.0.0.jar
C:/Users/User/AppData/Roaming/UCanAccess/lib/commons-lang3-3.8.1.jar
C:/Users/User/AppData/Roaming/UCanAccess/lib/commons-logging-1.2.jar
C:/Users/User/AppData/Roaming/UCanAccess/lib/hsqldb-2.5.0.jar
C:/Users/User/AppData/Roaming/UCanAccess/lib/jackcess-3.0.1.jar
This will be evaluated, as a workaround, instead of the CLASSPATH
variable
Thanks for your help!

How to Get Response String from HTTP Server using HTTPSRedirect.h (NodeMCU)

The following code is responible for getting a string from HTTP Server
while (client.connected())
{
if (client.available())
{
String line = client.printRedir(url3, host);
Serial.println(line);
}
}`
Error Message:
no matching function for call to 'HTTPSRedirect::printRedir(String&,
const char*&)
How to store the response string from server
The use of HTTPSRedirect library makes the task much simpler by avoiding the need of any third party service. So, the first thing you need to do is to copy the HTTPSRedirect library files from GitHub and install into your Arduino libraries folder. I have also posted the zipped library files at the following link for convenience.
Download HTTPSRedirect Library
Update: The above library is outdated.
Please go to GitHub Sujay Phadke and download the updated library. Thanks Sujay.
from above discussion it must be you are using old version of HTTPSRedirect library,
to get new got to [Updated Library ] and download the library and copy the HTTPSRedirect folder from zip folder into the Arduino Ide libraries.
the above process solved my issue.
Define the host as below
const char* host = "your host";
And for string use
String url = "your complete url";

parse.exe not seeing my projects

I am trying to configure my machine to deploy Parse Cloud Code. This requires downloading and running ParseDeploy.exe, followed by parse new.
I am running Win 8.1, and using the latest parse-windows-2.0.7.exe.
The folder structure is correctly created.
After entering my email & password, I am meant to see a list of my apps. Instead I am seeing:
1: results
Select an App:
"results" is not the name of any of my 3 apps.
This is what the PowerShell output looks like:
PS E:\...\demo> parse new
Creating a new project in directory E:\...\demo\parse
Creating directory E:\...\demo\parse\config
Creating config file E:\...\demo\parse\config\global.js
on
Creating directory E:\...\demo\parse\cloud
Writing out sample file E:\...\demo\parse\cloud\main.js
Creating directory E:\...\demo\parse\public
Writing out sample file E:\...\demo\parse\public\index.
html
Email: richard#glowworm.mobi
Password:
1: results
Select an App:
Related post:
Parse: No list of apps from Parse in CTL windows 7
I have used this successfully on previous projects. What has changed?
Some very old versions of the Parse command line utility may run into this issue due to some backend changes. You can get around this issue by making sure you're running the latest version of the command line utility, available at https://parse.com/docs/downloads
I also recommend joining the Parse developer mailing list, where we made an announcement a couple of weeks ago recommending that people make sure they update their command line utility prior to the backend change going into effect: https://groups.google.com/forum/#!topic/parse-developers/WoRnDft4qmE
Update
v2.1.3 fixes this issue, and works correctly on my machine.
What has changed? Parse has made updates, requiring a new version of parse.exe to be downloaded.
Unfortunately the initial new versions do not work.
Workaround
I have rolled back to using v1.4.2 of parse.exe.
It is currently working for deploying projects.
However, it breaks when creating a new project with parse new (as per my question).
The file that breaks is .\config\global.json - it seems to be in a new format, and it tries to reference this non-existent "results" project.
What I have done is to an existing global.json file from an older project, and manually edit it to update the values for my new project. Here is an example:
{
"global": {
"parseVersion": "1.4.2"
},
"applications": {
"<< AppName >>": {
"applicationId": "<< app id >>",
"masterKey": "<< master key >>"
},
"_default": {
"link": "<< AppName >>"
}
}
}
Just update the following fields:
<< AppName >>
<< app id >>
<< master key >>
(works as of 2 June 2015)
Bug Reported
A bug has been opened related to this issue on Facebook Developers:
https://developers.facebook.com/bugs/971635999542789/
The following versions are not running on my machine:
v2.0.7
v2.0.8
v2.0.9
There are other reports on the support forum that these versions are broken for other people as well.

File Write - Unauthorized Access Exception

Trying to save a file locally from an app running in the iOS 8 Simulator and I'm continually getting access denied exceptions.
In previous apps I've used the following code to get a valid file path:
Environment.GetFolderPath(Environment.SpecialFolder.Personal)
or
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
But I've read that with iOS 8 this has now got to be written as:
NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory,
NSSearchPathDomain.User)[0]
So I'm using the following code to generate a file path for a .txt file and receiving an access denied exception when trying to save with it:
public void SaveMyFile(string content)
{
NSUrl[] urls;
string filePath;
//
urls = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory,
NSSearchPathDomain.User);
filePath = Path.Combine(urls[0].Path, "MyApp", "myFile.txt");
File.WriteAllText(filePath, content);
}
So the file path that it gives me and also denies access to is /Users/Idox/Library/Developer/CoreSimulator/Devices/92498E38-7D50-4081-8A64-83061DC00A86/data/Containers/Data/Application/C35B3E98-C9E3-4ABA-AA7F-CD8419FA0EA5/Documents/MyApp/myFile.txt.
I'm wondering if there's some setting that needs to be toggled to give the app write access to this directory or if the directory itself is invalid.
I've also done a call to Directory.Exists(string path) to check if the directory is there, which it is.
You're missing the Path property on urls[0].Path
filePath = Path.Combine(urls[0].Path, "MyApp", "myFile.txt");
This was fixed in Xamarin.iOS 8.4, so if you're using a recent version of Xamarin you can use Environment.GetFolderPath without problems (which is useful if you want to share code across platforms).

Resources