Phonegap 3 - LocalFileSystem not defined - xcode

I used this code in phonegap 2.6.0 and it worked, now I upgraded to phonegap 3.0.0 and xcode 5 and I get this error:
onDeviceReady: =>
try
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, failFS)
catch e
alert(e)
**ReferenceError: LocalFileSystem is not defined**
I get the same error in Chrome, and that I guess is normal?
The documentation is still the same from 2.6 to 3, so Im not sure what happend!

I solved the problem adding cordova.js file to platforms/ios/www/

You should add File plugin to your app using:
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git
You may want to check this:
http://docs.phonegap.com/en/edge/cordova_file_file.md.html#File

window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
function gotFS(fileSystem) {
console.log("got filesystem");
console.log(fileSystem.root.fullPath);
}
function fail() {
console.log("failed to get filesystem");
}

Related

Error thrown when running existing Laravel project on local server

UPDATE: I think updating to a newer php version (by updating homebrew) causes this problem... Could/should I update the Laravel version of the project I'm working on? Or install a lower php version? I have no experience with that...
I'm working on a Laravel project for quite some time no. All of a sudden an exception is thrown when starting the local server.
The ErrorException is: trim(): Passing null to parameter #1 ($string) of type string is deprecated
It points to a few lines in the routes/web.php file.
ErrorException
trim(): Passing null to parameter #1 ($string) of type string is deprecated
at vendor/laravel/framework/src/Illuminate/Routing/RouteGroup.php:65
61▕ {
62▕ $old = $old['prefix'] ?? null;
63▕
64▕ if ($prependExistingPrefix) {
➜ 65▕ return isset($new['prefix']) ? trim($old, '/').'/'.trim($new['prefix'], '/') : $old;
66▕ } else {
67▕ return isset($new['prefix']) ? trim($new['prefix'], '/').'/'.trim($old, '/') : $old;
68▕ }
69▕ }
+6 vendor frames
7 routes/web.php:90
Illuminate\Routing\RouteRegistrar::group(Object(Closure))
+3 vendor frames
11 routes/web.php:91
Illuminate\Routing\RouteRegistrar::group(Object(Closure))
This are the lines in the web.php file
Route::middleware(['auth.isAdminPers'])->group(function () {
Route::get('/admin/admin',function () {
return view('admin.admin');
});
Route::get('admin/dienstverplaatsingen',[AdminDienstverplaatsingController::class,'index'])->name('admin.dienstverplaatsingen');
Route::get('/admin/experiment',[gebruikerController::class, 'experiment']);
Route::get('/admin/export',[AdminDienstverplaatsingController::class,'export']);
Route::get('/admin/fietsritten', [AdminFietsritten::class,'index'])->name('admin.fietsritten');
Route::get('/admin/fietsrittengrouped', [fietsrittengrouped::class, 'index'])->name('admin.fietsrittengrouped');
Route::get('/admin/maaltijden',[AdminMaaltijden::class,'index'])->name('admin.maaltijden');
Route::get('/admin/maaltijdengrouped',[maaltijdengrouped::class,'index'])->name('admin.maaltijdengrouped');
Route::prefix('admin')->name('admin.')->group(function(){
Route::get('/users/export', [UserController::class,'export'])->name('users.export');
Route::resource('/users', UserController::class);
Route::get('/appsettings', function(){
return view('admin.settings');
})->name('appsettings');
});
});
I just had this problem earlier. The way I have solved it was by running php artisan route:cache before composer install. Keep in mind that I am using PHP 7.4 with Laravel 8.

i get error 'FileProvider' of undefined using record function with nativescript-videorecorder

i need help.
TypeError: Cannot read property 'FileProvider' of undefined
I get that error when i try to record.
Code:
const options: VideoRecorderOptions = {
hd: true,
saveToGallery: true
}
const videorecorder = new VideoRecorder(options)
videorecorder.record().then((data) => {
console.log(data.file)
}).catch((err) => {
console.log(err)
})
It seems to be Android X compatibility issue, the plugin author will have to update the plugin to support {N} 6.x and later.
android.support.v4.content.FileProvider is now androidx.core.content.FileProvider. You may update the code and compile it locally as a workaround.

Reducing AmChart build size

im using AmChart V4 (Maps) with Angular and TypeScript.
Currently when im building the application for production I get a "pdfmake" file which costs about 2 MB.
Is it possible to remove the dependency because I don't need the feature to build pdfs.
And if it is possible to disable / remove the dependency, how is it done?
Is there a guide for deployment (for AmChart)?
In webpack config write this:
externals: function (context, request, callback) {
if (/xlsx|canvg|pdfmake|moment/.test(request)) {
return callback(null, "commonjs " + request);
}
callback();
}
Source: https://github.com/amcharts/amcharts4/issues/82#issuecomment-607546562

undefined d3.scale in Typescript

I'm new with Typescript (2 weeks), and I work on project to wrap the d3.js framework.
I'm encountered a problem with the usage of "d3.d.ts", namespace, export module, import.
My problem : When I try to use the d3.scale.linear(), I have the error in my browser console :
TypeError: d3.scale is undefined
The code :
/// <reference path="../typings/d3.d.ts">;
"use strict";
var linear = d3.scale.linear();
console.log("linear resolv !")
My compiler option (I've no error on the compilation process, but perhaps it's interesting) :
{
"files": [
"src/twod3/workspace.ts",
"src/twod3/component/basic.ts",
"src/twod3/component/data.ts",
"src/twod3/component/operation.ts",
"src/main.ts"
],
"compilerOptions": {
"noImplicitAny": true,
"target": "es2015",
"module":"commonjs",
"sourceMap":true
}
}
I try different import strategy without success.
The d3.d.ts
declare namespace d3 {
...
export module scale {
...
export function linear(): Linear<number, number>;
...
}
}
I don't understand the problem, thank you for your help.
Be careful of the version for d3.js
In version 4.2.1 d3.scale.linear(); gives the following error.
TypeError: d3.scale.linear() scale is undefined
I fixed this error in version 4.2.1 by using d3.scaleLinear();
I had a similar kind of issue. I had to match the D3 version, that supported the in built methods for d3.
Either match the version of the D3.js, make sure you update your browser or match the in built methods for your current version.
My supported version for d3.scale.ordinal is '3.5.17', previously I was at the latest version.

Local file reader for cordova windows project

Is it possible to read files (pdf,...) from my cordova windows app folder ?
I already use FileOpener to read local files in Android Tablets but this plugin is developed for Android use.
Can someone help me please ?
Use cordova-plugin-file-opener2. It supports for windows phone too.
Add this from Command line:
cordova plugin add https://github.com/pwlin/cordova-plugin-file-opener2
Then use this JS lines for opening a pdf file with default app
cordova.plugins.fileOpener2.open(
'/sdcard/Download/starwars.pdf', // You can also use a Cordova-style file uri: cdvfile://localhost/persistent/Download/starwars.pdf
'application/pdf',
{
error : function(e) {
console.log('Error status: ' + e.status + ' - Error message: ' + e.message);
},
success : function () {
console.log('file opened successfully');
}
}
);
This plug in is working fine in windows phone 8.

Resources