I am writing a Dropbox console application. I need to find last modification for my account. I can get file metadata with date of last modification, like this:
DbxEntry.WithChildren listing = client.getMetadataWithChildren(path);
for (DbxEntry child : listing.children) {
System.out.println(" " + child.name + ": " + child.toString());
}
But how can I find the latest modification for all of my folders?
The Dropbox API and the official Dropbox Java SDK don't expose a modified time for folders, but we'll consider it a feature request.
For files, you can access clientModified and serverModified on FileMetadata.
(Note that the code in your question uses the old, deprecated Java SDK, so you should switch to the new one.)
Related
I write discord bot with using JDA and i have one important question how to download attachments or work with them? Because my IntelliJ say "Deprecated API usage" for method like attachment.downloadToFile("name.png);
So now we shouldn't download users files send in message? Or how we should do it in good way? I search a lot of wiki from JDA and different posts, but everywhere i didn't see, a new option to handle this download files, becasue all methods to download, are "Deprecated API" even method like "attachment.retrieveInputStream().join()" retrieveInputStream its too not good way :(
Search a lot on wiki/others pages for more information but nothing found :(
The deprecation notice says this:
Deprecated.
Replaced by getProxy(), see FileProxy.downloadToFile(File)
This means you should use attachment.getProxy().downloadToFile(File) instead.
Example:
attachment.getProxy().downloadToFile(new File("myimage.png")).thenAccept(file -> {
System.out.println("Written to file " + file.getAbsolutePath() + ".");
});
Or using NIO instead:
attachment.getProxy().downloadToPath().thenAccept(path -> {
System.out.println("Written to file " + path + ". Total size: " + Files.size(path));
});
Good afternoon.
I can not understand why the code does not work after publishing in the Google market.
Before publishing in android studio code
ArrayList<TableAccount> tableAccount = getTableAccount();
String jsonStr = new Gson().toJson(tableAccount);
result:
Log.d(TAG, "RESULT: " + jsonStr);
RESULT: [{"name":"payment","valueFloat":0.0,"valueInt":0,"valueStr":"no"}]
But, after posting, I see:
Log.d(TAG, "RESULT: " + jsonStr);
RESULT: [{"a":"payment","b":"no","c":0,"d":0.0}]
Why do the letters a b c appear?
And where do the keys disappear? ["name", "valueFloat", "valueInt", "valueStr"]
Apparently, you turned on ProGuard/R8 for your release build, and its obfuscation mode renamed your fields.
The biggest lesson from here is to make sure that you test your release builds before uploading them to Google Play.
To fix the problem, you could:
Turn off ProGuard/R8 entirely,
Leave it on but disable obfuscation entirely,
Leave it on but disable obfuscation for these specific classes, or
Use #SerializedName annotations to teach Gson what names to use, instead of its default of using Java reflection to look up the names of the fields (as obfuscation renames those fields)
My team has created a CMS. When it's API is called by the client (using POST - with parameters), it responds with raw HTML, which is then injected into the client's page.
I am assigned to create automated testing specifically for the HTML (not the client page). On my computer I can save the HTML in a file and open with a browser to test it out locally.
To get the test to run on a build server or through Sauce Labs, I am trying to figure out a way to render the HTML so I can have my test framework grab a screenshot to be compared. My test framework is Java/Junit using Selenium bindings, and I use Applitools for screenshot comparison.
I looked into PhantomJS but got a bit lost in the JS world (I am much more comfortable with Java). Also it appears that these artifacts are quite dated in Maven. If this is suggested, I would really appreciate an example.
I have found topics related to posting to the http endpoint using the Junit approach (leveraging Rest Assured), but I am stuck on what to do with the HTML response and how to plug that into a Selenium test. Please, can anyone offer guidance or suggest a tool to do this?
You could use the data scheme to load the html:
driver.get("data:text/html;charset=utf-8," + URLEncoder.encode(pageHtml, "UTF-8"));
Though you may be limited by the length and it won't load the resources present in a separate folder.
Another way would be to execute the requests directly in the page and to then rewrite the whole page with the result.
Something like:
// set domain
driver.get("https://stackoverflow.com");
// navigate some HTML from a request
navigate(driver, "POST", "/search", "q=abcd");
public void navigate(driver, method, path, body) {
String JS_NAVIGATE_REQUEST =
"(function(method, path, body, callback){ " +
" var xhr = new XMLHttpRequest(); " +
" xhr.open(method, path, true); " +
" xhr.onloadend = function(){ " +
" document.write(xhr.responseText); " +
" document.close(); " +
" callback(); " +
" }; " +
" document.write(''); " +
" xhr.send(body); " +
"}).apply(window, arguments); " ;
((JavascriptExecutor)driver).executeAsyncScript(JS_NAVIGATE_REQUEST, method, path, body);
}
I would save the HTML into a file and use IE to display that file.
You can use badboy tool to capture the screenshots of the HTML files saved locally but this is not including selenium integration. It is just to have the baseline screenshots from the HTML saved locally.
Save all the responses in HTML with some predefined naming convention like SS_1,SS_2.
Open badboy and pass the path of 1 file in the browsing pane (at upper right) or use "Request" from tools (Drag & Drop) and provide the path of first file saved locally.
Put snapshot tool below it and configure to save snapshots.
Add variables ${iterator} and provide values
Double click on "Request" and change the file name suffix from SS_1 to ${iterator}
Now, configure step to run for each value of variables by double clicking on the step and selecting the second radio button (For each value of variable) .
Reference tool - Badboy
I need versioning in sharepoint.
I used checkout and checkin function , but I am not able to change the content of file. Versioning is created successfully but content is not changed for example In version 1.0 I have content like "Test Demo" and in version 2.0 i have content "Test Demo Change"..
How can I do versioning successfully in sharepoint .?
I used below code
boolean checkOutSuccess = service.checkOut("/sites/XXXX/XXXX/XXX/XXX/"+fileName);
System.out.println("\n out : " + checkOutSuccess);
boolean checkInSuccess = service.checkIn("/sites/XXX/XXX/XXX/XXX/"+latestfilename, "Changes");
I used com.independentsoft api
How can i resolve this issue?
please help
Please refer the below blog:
https://msdn.microsoft.com/en-us/library/office/ms467428.aspx
probably,a minor version needs to be checked in with comments.
This piece of code moves all current versions of files from one folder to another but leaves all older versions unmoved. (Context is java code of DFC accessing Documentum.)
String strObjId = versionColl.getString("r_object_id");
com.documentum.fc.common.IDfId curObjectID = new DfId(strObjId);
IDfSysObject curObj = (IDfSysObject)sess.getObject(curObjectID);
versionlabel = curObj.getAllRepeatingStrings("r_version_label", ",");
System.out.println("Moving document with Name:" + objName + " and version:" + versionlabel);
if (runMode.equals("1")) {
curObj.unlink(oldpath);
curObj.link(newpath);
curObj.setString("a_special_app", curObj.getString("r_modifier"));
curObj.setTime("a_last_review_date", curObj.getTime("r_modify_date"));
curObj.setString("a_category","MOVED");
curObj.save();
System.out.println("Successfully Moved document with Name:" + objName + " and version:" + versionlabel);
}
The error we were getting while moving older versions was "document immutable". So we added this piece of code that temporarily disables the immutable flag, allows the file to be moved and then resets the immutable flag to true.
curObj.setBoolean("r_immutable_flag", false);
The problem then was that this code ran perfectly on our dev machine (windows) while it crashed on production(windows) (gave link error). Any ideas as to why this is acting as it is and other codes to solve this issue would be great. Thanks.
Based on the little info given, it could be just about anything but my guess is that it's a permissions issue. Specifically, the user running this code does not have the proper permissions to move one(or more) of the documents you are trying to move OR the user running the code does not have enough permissions to link objects to the target folder.