I have been trying to figure out how to get files that are at the Root level, meaning get all files that don't have a path attached to their file name.
I have a container that looks like this
image.png image/png
ui application/directory
ui/css application/directory
ui/css/test.css text/css
ui/image2.jpg image/jpg
I'm using the call
Container->get_objects(0, null, null, 'ui/');
which returns 2 CF_Objects:
ui/css
ui/image2.jpg
This is the desired output
but if I request the files at the "root level"
Container->get_objects(0, null, null, '/');
returns an empty array.
Container->get_objects(0, null, null, '');
returns all the files in the container.
Ideally It would return two CF_Objects image.png, and ui.
Is there a way to do this?
Thank you!
The Cloud Files Developer guide of Nov 15 2011 page 20 says:
You can also use a delimiter parameter to represent a nested directory
hierarchy without the need for the directory marker objects. You can
use any single character as a delimiter. The listings can return
virtual directories - they are virtual in that they don't actually
represent real objects. like the directory markers, though, they will
have a content-type of application/directory and be in a subdir
section of json and xml results.
If you have the following objects—photos/photo1, photos/photo2,
movieobject, videos/ movieobj4—in a container, your delimiter
parameter query using slash (/) would give you
photos,
movieobject,
videos.
The parameter "delimiter" is not supported by the get_objects in the PHP SDK, and using it seems to be the only way to get the base directory files.
There is currently a merge request in github [this request has since been approved] adding this particular parameter to the get_objects method.
Other users of the Rackspace Cloud Files API PHP SDK have also added support for this parameter.
See if the original php-cloudfiles repo gets updated or just create a fork of the original and add your own code, if you don't feel comfortable adding your own changes, clone a fork that has added the delimiter parameter like
https://github.com/michealmorgan/php-cloudfiles
or
https://github.com/onema/php-cloudfiles
The merge request referenced in the answer was approved on May 09, 2012
An optional parameter for get_objects was added for $delimiter ...
However, there was an error introduced into the code at some other point which falsely reports the Container name is not set if one tries to use any of the optional parameters.
A request has been put in to correct this error.
Related
I added some custom properties in the 'updateAttribute' processor using the '+' button. For example: I declared a property 'DBConnectionURL' and gave the value as 'jdbc:mysql://localhost:3306/test'. Then, in the 'DBCPConnectionPool' service controller, I simple used the value'${DBConnectionURL}' for 'Database Connection URL' property. But, I manually gave the value for 'DBConnectionURL' property.I want a way where I can feed the value dynamically from a file, so that i just need to change the value in the file and the value for 'DBConnectionURL' changes dynamically based on the value present in the file. Is there a way to do it?
Rishab,
You have to use nifi variable registry.
In conf/nifi.properties, you could configure the below configuration in it for dynamically update a value in your data flow.
nifi.variable.registry.properties=./dynamic.properties
You can give your variables in that file dynamic.properties it should present in conf directory.
For an example, If dynamic.properties files contains below values
DBCPURL= jdbc://<host>:<port>
you can use that in your data flow by using ${DBCPURL}
Note: You should restart nifi services if you change any configuration in conf/nifi.properties.Otherwise your changes not worked in dataflow.
Feel free to accept it be answer if it worked for you.
I am trying to test a uploading service that supports multiple files uploading,and I found this:
golang POST data using the Content-Type multipart/form-data
that introduced how to create a request to upload a single file,but I need to upload multiple files,is there simple way to create this kind of request?
update:
please check line:38 and 39 in post:to support html5 multiple files uploading
line 38 files := m.File["myfiles"]
line 29 for i, _ := range files {
It seems that it needs to set single name for multiple file headers to stimulate the html5 multiple files uploading.
For each file, call CreateFormFile to create the header for the file. Call Write on the writer returned from CreateFormFile one or more times to write data to the file. When done with all files, close the multipart writer.
The top answer in the linked question uploads two files, one named "image" and one named "key". The data for the "image" is copied from a file. The data for "key" is simply the bytes "KEY".
The field name is the first argument to CreateFormFile. If you want to upload multiple files with the same name, use the same name each time you call CreateFormFile.
We are not able to call balanced.card.create from a Phonegap application. This is reproduced in a stock Phonegap application here: https://github.com/kevg/phonegap-balanced. Full details are in the README.md on github, but the basic summary is:
For those not familiar with phonegap, the main page that loads is
index.html. This initializes phonegap in index.js. When the device is
ready, we will show a hidden DIV with a button named "Execute
Balanced." When you click this button, app.executeBalanced in index.js
will be called which prompts for the balanced marketplace URI, loads
balanced.js with $.getScript, and then calls balanced.card.create with
a test credit card.
The expected result is that callbackHandler is called or an exception
is caught. Instead, it seems the execution of the Javascript thread
disappears into balanced.card.create, never to return and without any
error.
Alrighty, I found the bug in balanced.js. So, in Phonegap, window.location.href returns something like file:///.../index.html. Balanced.js creates an iframe to something like https://js.balancedpayments.com/proxy#file
var src = proxy + "#" + encodeURIComponent(window.location.href);
https://github.com/balanced/balanced-js/blob/master/src/utils.js#L48
In the script returned in proxy.html (which I can't find on github), it does:
c.parentURL=decodeURIComponent(
window.location.hash.replace(/^#/,"")
).replace(/#.*$/,"")
c.parentDomain=c.parentURL.replace(/([^:]+:\/\/[^\/]+).*/,"$1")
The regex doesn't match because file: has three slashes. Now, at first, I thought I could just convert the regex to:
/([^:]+:\/+[^\/]+).*/
However, then there's another problem, because balanced does a security origin check on the match:
if (d.origin.toLowerCase() !== c.toLowerCase()) return !1;
However, the regex returns file:///firstcomponent, whereas event.origin does not include a host name for the file scheme, so these won't match even with a fixed regex.
I can't change anything in the script returned in the proxy response because if I load that from a domain other than balancedpayments.com, then the AJAX POST fails (return code 0 with a blank body). Therefore, the only thing I can control is the hash passed to the iframe.
However, since this regex is a replace, we can simply pass exactly what we know we need (we don't care that the regex is a no-op).
Therefore, the solution is to change L48 above to:
var src = proxy + "#" + encodeURIComponent("file://");
This works.
I use Alfresco 4.1 with Lucene enabled. I have a folder of type 'myfoldertype' and named 'one two'. Tokenization on the name is (by default) enabled.
I search by name on a specific type of folder, via my own Java backed webscript. Like this:
SearchParameters sp = new SearchParameters();
sp.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
sp.setQuery("TYPE:\"mymodel:myfoldertype\" AND #cm\\:name:*one*"
I run this query in the authentication context of a user with AuthenticationUtil.runas(). The user has read-access to this folder.
Now, the resultset contains 0 results.
But if I copy/paste the query from the log into the Nodebrowser (in Lucene mode), it DOES return the expected folder.
What could cause this difference? Obviously I would like to get the expected folder in the resultset in my webscript as well.
In Java you're not escaping the \ properly
So #cm\:name:*one* should be #cm\\:name:*one*
The cause was that my webscript was running under the (JVM default) locale of en-US, but the Nodebrowser was running under the UI locale nl-NL. The cm:name property is of datatype d:text, which has different analyzers for en (AlfrescoStandardAnalyzer) and nl (DutchAnalyzer).
I changed the webscript to use the nl locale and now it returns the same results as the Nodebrowser:
import org.springframework.extensions.surf.util.I18NUtil;
...
I18NUtil.setLocale(new Locale("nl"));
return searchService.query(sp);
Allright I got myself in a deadlock with Mercurial and sub-repos... Here's what happenend:
I had a large mercurial repo that I server via apache and hgweb.cgi.
Due to the size of the repo I decided to move to sub-repositories and share these with hgwebdir.cgi.
Using the convert tool with the filemap option I created several sub-repositories:
/main/foo
/main/bar
Nicely created an entry for the sub-repositories in .hgsub:
foo = foo
bar = bar
And set hgwebdir.cgi up to show $/** as the root folder.
Now when I went to my site (foo.com/hg) I saw my sub-repositories with one empty reposory among them (no name, no content), but I could not download it (archive location unknown):
empty_repo http://img707.imageshack.us/img707/8237/emptysubrepo.png
That was allright until I added a new sub-repository.
I could not push the new .hgsub file to foo.com/hg, since that page is served by hgwebdir.
The only method I can work currently is switch from hgwebdir to hgweb, commit .hgsubste and switch back to hgwebdir.
Does someone have a good setup for such a mess?
On the webserver your main and its subrepos should appear as siblings -- not with the subrepos inside main.
Main
ASCII
AlignDistribute
And the URLs in your .hgsub should look like:
ASCII = ../ASCII
AlignDistribute = ../AlignDsitribute
Then you'll be able to push/pull to http://foo.com/hg/Main and when you clone it the clone/update will automatically attach and clone down the separate subrepos.
From what I've read on https://www.mercurial-scm.org/wiki/PublishingRepositories#multiple
The keys (on the left) and the values (on the right) are both filesystem paths
The keys should be prefixes of the values and are "subtracted" from the values in order to generate the URL paths to each repository
What I'm guessing happened is that in your hgweb(dir) configuration you're specifying the same value for a collection possibly as the key, so during subtraction it ends up with a blank name and no way to get to it.
When I use [collections] to set /a/full/path = /a/full/path directly to a repo, it'll end up blank too, because it's reading that folder as a repo because it is a repo, instead of each sub-directory being an individual repo, after I removed the .hg folder and .hgsubs and everything from the root of my collection entry, all the subfolders started showing up properly.
I originally used in [paths], /path/to/my/project = /path/to/my/project, and since that is a single referenced repository, it'll subtract the value from the key, leaving you once again with '', instead I used project = /path/to/my/project and it came out as 'project'.
Hopefully that URL or these descriptions will get you out of your pickle!