PrimeFaces 6.1 - UploadedFile problem with getFileName - primefaces

I am using PrimeFaces 6.1 in my prject and implemented UploadedFile as described in PrimeFaces showcase and evreything works fine (I can upload and download the file as I wish) except the fileName.
e.g. when I try to upload the file from following path :
C:\Users\me\Documents\test.txt
and in Java code I try to get the fileName as follow:
FilenameUtils.getName(uploadedFile.getName());
the uploadedFile.getName() returns this string "C:UsersmeDocumentstest.txt"
The whole path with out "" included drive Name!
I did not override any classes and I did not change any functionality as well!
Does anyone have any idea how can I fix it?
regards
Sara

Related

Razor Class Library in ASP .Net Core 2.1.1

I used to embed some of my Razor views for mailing in a class library which was using ASP .Net Core 2.1.0-preview1-final and it was working fine.
Here is the configuration in the .csproj file:
Since I upgraded the .Net Core version to 2.1.1 which is the final one, I can not use the embedded views anymore.
I know about the new Razor Class Library concept but I need to pass my views to a ViewRenderer service which basically converts the view to string to be sent as an email.
The viewrenderer service was finding the views before but now it doesn't find them and I get the following error:
VIEW does not match any available view
How can I fix this issue?
I was facing the exact same issue, setting CopyRefAssembliesToPublishDirectory to true in the csproj file fixed it. your csproj file should look like this :
...
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<CopyRefAssembliesToPublishDirectory>true</CopyRefAssembliesToPublishDirectory>
</PropertyGroup>
...

ViewHelper is not found

I fiddled around with it for more than 8 hours without getting it resolved.
All I want is to call a ViewHelper in a Fluid template. I did that before and I never had a similar problem.
My ViewHelper file is located in
EXTDIR/VendorName/Classes/ViewHelpers/SomeViewHelper.php.
In my Fluid Template I use the namespace
{namespace k=VendorName\Extname\ViewHelpers}.
Somewhere in the template I call the ViewHelper with
{k:some()}.
The ViewHelper script "SomeViewHelper.php" contains the following code:
class SomeViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
public function initializeArguments() { }
public function render() {
return 7;
}
}
As you can see, the whole thing is quite simple and the expected output on the page should be "7". But calling a page in the frontend produces this error message:
Oops, an error occurred!
Could not analyse class:VendorName\Extname\ViewHelpers\SomeViewHelper maybe not loaded
or no autoloader?"
Any hints on what might be wrong here?
Cheers
Michael
If everything is spelled correct, and even after deleting System/Configuration Cache the ViewHelper doesn't come up (Could not analyse.. / maybe not loaded or no autoloader), try to reinstall the extension in extension manager!
Your path to the viewHelper source file is wrong.
The correct path should be (without vendorname):
EXTDIR/Classes/ViewHelpers/SomeViewHelper.php
You also need to make sure, you use the correct namespace for your viewHelper (if you're on TYPO3 6+, don't use the old Tx_ classes but namespaces).
<?php
namespace VendorName\Extname\ViewHelpers;
class SomeViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
public function initializeArguments() { }
public function render() {
return 7;
}
}
The error message seems to indicate that the class is not found.
Without more info, I would probably suspect a typo somewhere (pun not intended).
The following assumes you are using TYPO3 7 and not composer mode:
First, please check if your viewhelper class is autoloaded. This will help to narrow down the problem. On the command line in the htdocs directory: grep SomeViewHelper typo3temp/autoload/autoload_classmap.php This should give you a hit, if the ViewHelper class is included in the autoload file.
If the classes are not autoloaded, you might manually want to do the autoloading: On the command line in the htdocs directory: php typo3/cli_dispatch.phpsh extbase extension:dumpclassloadinginformation
For more information see: https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Autoloading/Index.html. For more in depth info see this: http://insight.helhum.io/post/130876393595/how-to-configure-class-loading-for-extensions-in You can find this functionality of autoloading in the install tool in TYPO3 8, so in that case you would not need to run the command on the command line.
If this does not work either, check the following:
Are you using namespace correctly in the class: <?php namespace VendorName\Extname\ViewHelpers\SomeViewHelper;
Is the path (including Camelcase class name) correct: /Classes/ViewHelpers/SomeViewHelper.php
After that, clear the system cache and reinitiate the autoloading as described above.
In order for the autoloading to be initiated automatically, you might have to update your ext_emconf.php (if you are not using composer mode) or composer.json (if you are using composer mode).
Just some questions:
Did you add the TypoScript Template of the Extension to the Static Includes?
If you're using a unix-alike system, are you sure that your webserver has the permission to read that files?
If TYPO3 is installed in composer mode and your extension is not installed via composer (e.g. a ProviderExtension of FluidTYPO3), you must provide autoload information for your extension in the main composer.json file, as described within TYPO3-composer-documentation:
In Composer Mode all class loading information must be provided by each of the installed extensions or the root package. If TYPO3 extensions are not installed by composer, e.g. because they are directly committed to the root package or a new package is kickstarted, class loading information needs to be provided, otherwise no classes can be loaded for these extensions/ packages.
E.g. if you have a site extension directly committed to your root package, you must include the class loading information in the root package like that:
Drove me crazy to get my ViewHelpers autoloaded. Providing the autoload-information within a composer.json or the ext_emconf.php of the extension and reinstalling it didn't do the trick.

Using Cocostudio UI Editor with cocos2d-x (load json files)

I am working with cocos2d-x 3.1 and try to use the Cocostudio UI Editor.
This helppage http://upyun.cocimg.com/CocoStudio/helpdoc/v1.0.0.0/en/index.html uses a CCUIHelper to load the json file and create a widget. This method was removed in cocos2d-x 3.0. While searching for a solution I found a directory which is called "WidgetReader" located under "editor-support". Sadly I am unable to include it, because the vs 2013 project can't find it. (and I am unsure if that's the right place where I am searching)
Does anyone know how I can use the exportes json-files from ui editor?
Thanks!
You can try this :
#include "cocostudio/Cocostudio.h"
auto widget = cocostudio::GUIReader::getInstance()->widgetFromJsonFile("abc.json");
Anyway,the include path should add "(yourCocosRoot)/cocos/editor-support".
you can use the following code
Node* node = CSLoader::createNode("SampleUIAnimation.json");
this->addChild(node);

Gdx.files.internal not using android assets path

Whenever I try to use Gdx.files.internal to get a FileHandle, I am getting a FileNotFoundException like follows:
<PATH TO MY GAME>\desktop\xml\screen.xml (The system cannot find the path specified)
I set my project up using the libgdx project setup tool, and it seems that my asset folder within my desktop project is the same as my android project (they're linked). However, when I go to my desktop project there is a bin folder with my assets. If I change the path to "/bin/..." then I can run the project without any exceptions. However, I feel this may be a problem if I export as a JAR.
Code:
final FileHandle screenXML = Gdx.files.internal("xml/screen.xml");
My problem stemmed from the following (credit goes to the awesome and patient IRC community members for Libgdx):
// final Document screenDoc = docBuilder.parse(screenXML.file());
// Note: MUST use .read() here, not .file(), as we link from the android assets!
final Document screenDoc = docBuilder.parse(screenXML.read());

ConfigurationBuilder Twitter4j class not found

Sorry, but it seems i cannot find any ConfigurationBuilder class in Twitter4j.
I'm using twitter4j version 3.0.3. I have already tried 3.0.2 android version too.
I have added the jar to build path like core, async, media, and stream.
I tried to :
- import twitter4j.*;
- import twitter4j.conf.*;
- import twitter4j.conf.ConfigurationBuilder;
But Eclipse says that :
Multiple markers at this line
- ConfigurationBuilder cannot be resolved to a
type
- ConfigurationBuilder cannot be resolved to a
type
What do i need?
I have already checked the source folders and there is a class named ConfigurationBuilder.java.
Thank you!
You have to make sure that Android Dependencies folder. To do that, you copy the twitter4j jar file to the libs folder and then right click to Configure Path and add the library.
After that's done, you will see that the library is also copied to the dependencies folder.
Right click on the project > Properties > Java Build Path > Libraries
Make sure that twitter4j-core-x.y.z.jar is really there
Go also to Order and Export tab in the same dialog
Make sure that the twitter4j-core-x.y.z.jar is selected (to get the jar distributed with the *.apk or else you will get something similar to the following at runtime: could not find class ConfigurationBuilder)
Project > Clean
Project > Build All