while accessing the node i am getting following error:
javax.jcr.RepositoryException: Not a relative path
i am newbie to AEM CQ5.i tried to google it. did not found any description about it.
Thanks in advance!
If you get a Node from the session object you have to use '/'
session.getNode( "/MyFolder" );
But if you use the root node you have to write
session.getRootNode().getNode( "MyFolder" );
//Remove the first / char - JCR API does not like that
String newPath = path.replaceFirst("/", "");
//USE JCR API TO get the Asset Data so we can move it to another JCR location
Node root = session.getRootNode();
Node fileNode = root.getNode(newPath);
Related
I'm aggregating JavaScript resources like this
getResourceBundles().addJavaScriptBundle(MyWicketApplication.class,
"js_bundle.js",
wicketJQuery,
wicketAjax,
JavascriptResources.RESOURCE_1.getReference(),
JavascriptResources.RESOURCE_2.getReference(),
JavascriptResources.RESOURCE_3.getReference(),
JavascriptResources.RESOURCE_4.getReference(),
JavascriptResources.RESOURCE_5.getReference(),
JavascriptResources.RESOURCE_6.getReference(),
JavascriptResources.RESOURCE_7.getReference(),
JavascriptResources.RESOURCE_8.getReference());
What I get after a page is rendered is something like this
./wicket/resource/com.my.company.MyWicketApplication/js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js
I don't mind having the part
js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js
But how to hide / remove this part
./wicket/resource/com.my.company.MyWicketApplication
to something like this
/resources/js_bundle-ver-3CA0BF236223C36D08331F94E24FAAAE.js
You could use the result of getResourceBundles().addJavaScriptBundle(...) and mount it at specific path:
JavaScriptReferenceHeaderItem jsrhi = getResourceBundles().addJavaScriptBundle(...);
ResourceReference rr = jsrhi.getReference();
webApplication.mountResource("some/path", rr);
I created a framework which opens FXML in other jar files. I use the following to open them:
(fxml) is a string passed in from a DB query...
FXMLLoader loader = new FXMLLoader();
Parent node = loader.load(getClass().getClassLoader().getResource(fxml).openStream());
This works for all my FXML and I really don't want to change this.
I have one new window which will have a very similar implementation with another and I wanted to share the FXML between them with fx:include.
However this throws the error javafx.fxml.LoadException: Base location is undefined.
I found this link about linked files
Is there anyway around this - without changing my entire implementation? If not, likely will just duplicate the logic.
Thanks.
The problem is that if you provide an InputStream, the location (a URL) is undefined. Apparently your FXML is using the location somewhere (e.g. via location resolution) Try
FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource(fxml));
Parent node = loader.load();
i am using in my unity project this method that saves the camera viewport to the file system:
Application.Capturescreenshot(fileName)
it is work great but i want it to be saved under a specific path.
for example : Application.Capturescreenshot(c:/screenshots/filename);
how can i managed this?
thnaks!
You could use the absolute file path easily by passing it as a string. In your case, using this statement should work just fine:
Application.CaptureScreenshot("C:/screenshots/filename");
Note that it will give you an error if screeshots folder does not exist. Hence, if you are uncertain of that, you could modify the code accordingly:
// File path
string folderPath = "C:/screenshots/";
string fileName = "filename";
// Create the folder beforehand if not exists
if(!System.IO.Directory.Exists(folderPath))
System.IO.Directory.CreateDirectory(folderPath);
// Capture and store the screenshot
Application.CaptureScreenshot(folderPath + fileName);
Lastly, if you want to use a relative path instead of an absolute one, Unity provides dataPath and persistentDataPath variables to access the data folder path of the project. So, if you want to store the screenshots inside the data folder, you could change the folderPath above accordingly:
string folderPath = Application.dataPath + "/screenshots/";
var nameScreenshot = "Screenshot_" + DateTime.Now.ToString("dd-mm-yyyy-hh-mm-ss") + ".png";
ScreenCapture.CaptureScreenshot(nameScreenshot);
Try this !
I'm using laravel 4.0 for my web service project. I try to assign relative path to controller subfolder but still got the error message.
This is my router looks like
Route::group(array('prefix' => 'merchant'), function()
{
Route::resource('index', 'ProductController#showIndex');
Route::resource('product', 'CategoryController#showIndex');
Route::resource('general', 'GeneralController#showIndex');
});
Current path
/app/controllers/ProductController.php
I want to be like this one
/app/controllers/merchant/ProductController.php
Thanks a lot in advance.
You need a namespace to achieve that.
In your controller folder make a directory called merchant and place your ProductController.php inside Merchant directory.
Then open your ProductController.php and use the following namespace on top of the file.
<?php namespace Merchant;
class ProductController extends /BaseController
{
After that edit your route file:
Route::get('index', 'Merchant\ProductController#showIndex');
Remove the Route::group(array('prefix' => 'merchant'), function(). Prefix used when you have a common url for more than one routes.
For example:
http:://laravel.com/xyz/products
http:://laravel.com/xyz/category
http:://laravel.com/xyz/posts
Here xyz is common in every URL. So, In this case, you can use group routing with prefix xyz
One more thing, I can see, you have used resource controller.
Route::resource('index', 'ProductController#showIndex');
Route::resource('product', 'CategoryController#showIndex');
Route::resource('general', 'GeneralController#showIndex');
Do you know that By default, for resource controller, Laravel will generate 7 routes. So, You don't need to create #showIndex function when using resource controller.
Route::resource('index', 'ProductController');
Route::resource('product', 'CategoryController');
Route::resource('general', 'GeneralController');
More about resource controller:
http://laravel.com/docs/controllers#resource-controllers
I have a file reader channel picking up an xml document. By default, a file reader channel populates the 'originalFilename' in the channel map, which ony gives me the name of the file, not the full path. Is there any way to get the full path, withouth having to hard code something?
You can get any of the Source reader properties like this:
var sourceFolder = Packages.com.mirth.connect.server.controllers.ChannelController.getInstance().getDeployedChannelById(channelId).getSourceConnector().getProperties().getProperty('host');
I put it up in the Mirth forums with a list of the other properties you can access
http://www.mirthcorp.com/community/forums/showthread.php?t=2210
You could put the directory in a channel deploy script:
globalChannelMap.put("pickupDirectory", "/Mirth/inbox");
then use that map in both your source connector:
${pickupDirectory}
and in another channel script:
function getFileLastModified(fileName) {
var directory = globalChannelMap.get("pickupDirectory").toString();
var fullPath = directory + "/" + fileName;
var file = Packages.java.io.File(fullPath);
var formatter = new Packages.java.text.SimpleDateFormat("yyyyMMddhhmmss");
formatter.setTimeZone(Packages.java.util.TimeZone.getTimeZone("UTC"));
return formatter.format(file.lastModified());
};
Unfortunately, there is no variable or method for retrieving the file's full path. Of course, you probably already know the path, since you would have had to provide it in the Directory field. I experimented with using the preprocessor to store the path in a channel variable, but the Directory field is unable to reference variables. Thus, you're stuck having to hard code the full path everywhere you need it.