how to fix error when load file with filename include charactor '%' - actionscript-3

I am using URLRequest and URLLoader to load one text file with file name: "demo%.txt". This is my code
var urlFile:URLRequest = new URLRequest(testFileOnLocal.nativePath);
var loaderFile:URLLoader = new URLLoader(new URLRequest(testFileOnLocal.nativePath));
loaderFile.addEventListener(Event.COMPLETE, loadEditedTestComplete);
loaderFile.load(urlFile);
And it not work.
If I change file name to "demo.txt", it work. But '%' is allowed charactor of file name.
Can some one help me.
This is my error message:
Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C:/Users/longpn4/Desktop/demo%.tmt

Related

Error: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)

I am working on SQfLite database. I am trying to save data but getting an error during saving data. I am using Chrome to check my output. The error is No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider). Here is a code which i think having a problem.
Directory documentsDirectory = await getApplicationDocumentsDirectory();
String path = join(documentsDirectory.path, "student.db");
return await openDatabase(path, version: 1, onCreate: _onCreate);
Here is a code for inserting data:
Database? db = await instance.database;
var id = await db!.insert('student', data);
I am using Chrome for checking output, may be this is a reason for error or whatever reason please guide me.
Plugins added
sqflite: ^2.0.2+1
get: ^4.6.5
path_provider: ^2.0.11
the error is:
Error: MissingPluginException(No implementation found for method getApplicationDocumentsDirectory on channel plugins.flutter.io/path_provider)
at Object.throw_ [as throw] (http://localhost:65116/dart_sdk.js:5067:11)
at MethodChannel._invokeMethod (http://localhost:65116/packages/flutter/src/services/restoration.dart.lib.js:1560:21)
at _invokeMethod.next ()
at http://localhost:65116/dart_sdk.js:40571:33
at _RootZone.runUnary (http://localhost:65116/dart_sdk.js:40441:59)
at _FutureListener.thenAwait.handleValue (http://localhost:65116/dart_sdk.js:35363:29)
at handleValueCallback (http://localhost:65116/dart_sdk.js:35931:49)
at _Future._propagateToListeners (http://localhost:65116/dart_sdk.js:35969:17)
at [_completeWithValue] (http://localhost:65116/dart_sdk.js:35817:23)
at async._AsyncCallbackEntry.new.callback (http://localhost:65116/dart_sdk.js:35838:35)
at Object._microtaskLoop (http://localhost:65116/dart_sdk.js:40708:13)
at _startMicrotaskLoop (http://localhost:65116/dart_sdk.js:40714:13)
at http://localhost:65116/dart_sdk.js:36191:9

Openlayers & NPM: can't load local .json file

I try to load a .json file in Openlayers from a local URI. As recommended, I'm using npm. However, the file doesn't seem to load. The file example.json is stored in the directory data, which is a subdirectory of where the main.js is located. The json file I'm using is valid according to jsonLINT.
var vectorLayer = new VectorLayer({
source: new VectorSource({
url: 'data/example.json',
format: new GeoJSON()
}),
style: function(feature) {
style.getText().setText(feature.get('name'));
return style;
}
});
var map = new Map({
target: 'map',
layers: [ vectorLayer],
// ...
});
Messages in the console:
XHR GEThttp://localhost:1234/data/example.json [HTTP/1.1 200 OK 4ms]
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
XHR GEThttp://localhost:1234/data/example.json [HTTP/1.1 304 Not Modified 14ms]
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
I guess, the file doesn't load at all. If I change the adress to some file that isn't in the directory, I'll get the same messages. On reload, I'd get the 304 error code twice. If I type in 'localhost:1234/data/example.json' as URL, it'll retrieve my main page (as with localhost:1234), not the json file I'd expect to see.
I'm a beginner with npm so I assume the problem is how files are handled with npm.

How to catch an elusive loader error in AS3

I'm trying to get some data from a php script using a loader and VARIABLES data format. Here's the code I have:
myUrlResults = new URLRequest("http://[...]/getData.php");
myUrlResults.method = URLRequestMethod.GET;
myResultsLoader = new URLLoader();
myResultsLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
myResultsLoader.addEventListener(Event.COMPLETE, sendEventCompleteHandler);
myResultsLoader.addEventListener(IOErrorEvent.IO_ERROR, sendEventErrorHandler);
myResultsLoader.load(myUrlResults);
And
function sendEventCompleteHandler(e:Event) {
trace('Ok.');
}
function sendEventErrorHandler(e:IOErrorEvent) {
trace('Error occured:' + e);
}
As you know, Flash gives you a nasty error if the php file is not formatted properly.
But my .php file returns something like this var1=5&var2=10 and everything works great. However, sometimes, the server has issues and returns "Too many connections." which is something Flash doesn't like, because it's not a variable - value pair and I get an error like this:
Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables$iinit()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
How to catch this error??
try set
myResultsLoader.dataFormat = URLLoaderDataFormat.TEXT;
and in your complete handler get the variables yourself after verify the result.
You can use a URLVariable.decode() and try/catch it there.

Convert CSV to ARFF using IKVM and WEKA

CSVLoader loader = new CSVLoader();
loader.setSource(new File("));
Instances data = loader.getDataSet();
When i run above code in java , it's working fine.
But when i do the same thing in c# using the following code, it throws exception in line
weka.core.Instances instsOrg = csvLoader.getDataSet();
The exception message is" The type initializer for 'weka.core.converters.ConverterUtils' threw an exception"
string filename = "myCSVfile.csv"";
weka.core.converters.CSVLoader csvLoader = new weka.core.converters.CSVLoader();
csvLoader.setSource(new java.io.File(filename));
weka.core.Instances instsOrg = csvLoader.getDataSet();
weka.core.converters.ArffSaver saver = new weka.core.converters.ArffSaver();
saver.setInstances(data);
saver.setFile(new File("myCSVfile.arff"));
saver.writeBatch();
I have added weka.dll , IKVM.OpenJDK.Core.dll and IKVM.Runtime as references files.
Can anyone help me to get rid of this exception please???
Please reply as soon as possible :(

Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)

I spent 2 days trying to figure out this error and would like to share the resolution
Problem:
I am trying to reconfigure extjs grid panel at runtime with different datastore
Code with Error:
var el = Ext.getCmp('DummyGrid');
el.reconfigure(SLADataStore, SLAColumnModel);
el.load();
Error:
uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXMLHttpRequest.open]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: http://extjs.cachefly.net/ext-3.2.1/adapter/ext/ext-base.js
code without Error:
var el = Ext.getCmp('DummyGrid');
el.reconfigure(SLADataStore, SLAColumnModel);
SLADataStore.load({
params: { start: 0,
limit: 25,
sort: 'LevelID',
dir: 'ASC'}
});
Reason for the error: when I try to load it should have been datastore.load() not the component.load()
Hope this post might help 2 days of their time which might be well spent on beers ;)
-Sat
Try
el.getStore().load();