angular-csv-import not working on ionic - angularjs

I am trying to use angular-csv-import on ionic. all works greate on chrome but when I am trying to run it on android nothing is happens...file manager to upload the file isnt working....what can be done?
my code is:
template:
<ng-csv-import content="csv.content"
header="csv.header"
separator="csv.separator"
result="csv.result"
accept="csv.accept">
</ng-csv-import>
controller:
$scope.csv = {
content: null,
header: true,
headerVisible: true,
separator: ',',
separatorVisible: true,
result: null,
encoding: 'ISO-8859-1',
encodingVisible: true,
accept: ".csv"
};

I find 2 ways to do it.
One way to save the document from google shits and get plugin to parse it to json, then use ng to download parsed json. Or the other way to use xlsx parser

Related

Jitsi: Unable to change default user avatar

I have integrated Jetsi directly in my React app using the API (Without a self-hosted server).
I have been trying to find a way to change the default avatar when the user camera is off.
According to the documentation, I can override this parameter:
gravatar: {
baseUrl: 'https://www.gravatar.com/avatar/',
disabled: false
}
baseUrl 🚫 - Base URL for a Gravatar-compatible service. Defaults to
Gravatar. disabled - True if Gravatar should be disabled.
I tried overriding it in both configOverwrite and interfaceConfigOverwrite:
<Jutsu
roomName={room_name}
configOverwrite={{
gravatar: {
baseUrl:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/1200px-Cat_November_2010-1a.jpg",
disabled: false,
},
}}
interfaceConfigOverwrite={{
gravatar: {
baseUrl:
"https://upload.wikimedia.org/wikipedia/commons/thumb/4/4d/Cat_November_2010-1a.jpg/1200px-Cat_November_2010-1a.jpg",
disabled: false,
},
}}
/>
But, it had no effect.
I don't even understand what they mean by
Gravatar-compatible service
Can't I just use an image url?
According to a note at the beginning of the docs, the gravatar.baseUrl option can't be overwritten
NOTE
Options marked with 🚫 are not overwritable through configOverwrite
You'll need to set it in the config.js file of your jitsi installation.
And the baseUrl should be a service that works the same as gravatar: receiving a hashed email and returning an image; no other option is supported. You can check how the URL is built here https://github.com/jitsi/js-utils/blob/master/avatar/index.js#L10
You could use an out of the box alternative as https://wiki.libravatar.org/ or build your own https://cloudinary.com/blog/how_to_build_an_enhanced_gravatar_service_part_1

After setup RUM application of datadog page load blank on server in react

RUM application intilize code.
Added this code in main.js file. But after deployed my build on non-ssl site i getting a blank page. Nothing any console error displaying and network tab also clear
import { datadogRum } from '#datadog/browser-rum';
const env = window.location.hostname;
datadogRum.init({
applicationId: 'xyz',
clientToken: 'xyz',
site: 'datadoghq.com',
service: 'foundation---vdeck',
version: '5.35.2',
sampleRate: 100,
env,
premiumSampleRate: 100,
trackInteractions: true,
defaultPrivacyLevel: 'mask-user-input',
useCrossSiteSessionCookie: true,
trackSessionAcrossSubdomains: true,
silentMultipleInit: true,
});
datadogRum.startSessionReplayRecording();

lazy loading on i18n react questions

I am working in a project where we are using modules with lazy loading to separate it, now we would like to separate also the translations into the different modules, so only the translations that belogn to that module get loaded.
currently we have the translations as it follows:
translations
--en
--de
--it
--sp
we would like to have sth like this now:
translations
--en
|--moduleA
|--moduleB
|--moduleC
--it
|--moduleA
|--moduleB
|--moduleC
etc,
I have been throug the documentation and tried the 'useTranslation (hook)' and 'withTranslation', both dont seem to work since they load all the translations in the specified ns anyway and after take what is received when calling i18n, I also hada look at the i18next-http-backend but the documentation do not specify how to use it very clearly.
basically I am missing some information about how to use it, but as per my findings seems the only posible solution, am I wrong?.
after installing the dependancy I have my i18n as followns:
import i18n from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import moment from 'moment'
import HttpApi from 'i18next-http-backend'
import request from 'superagent'
import {EN} from './translations/eng'
import {test} from './translations/test'
i18n
.use(LanguageDetector)
.use(HttpApi)
.init({
backend: options,
resources: {
en: {
translations: EN,
translations2: test,
},
},
fallbackLng: 'en',
ns: ['translations', 'translations2'],
defaultNS: 'translations',
keySeparator: false,
interpolation: {
escapeValue: false,
formatSeparator: ',',
format: function(value, formatting) {
if (value instanceof Date) return moment(value).format(formatting)
return value.toString()
},
},
react: {
wait: true,
},
})
the backend key is expecting some options information:
const options = {
loadPath: 'path to file',
addPath: 'path to file',
allowMultiLoading: false,
parse: function(data) {
return data.replace(/a/g, '')
},
parsePayload: function(namespace, key, fallbackValue) {
return {key}
},
request: function(options, url, payload, callback) {},
}
But I am not really sure about the way how to use it,I wanted to know if someone has experience with this and if someone can recomend any guide or documentation that might help me.
thanks
I think you may be looking for Namespaces:
Namespaces are a feature in i18next internationalization framework which allows you to separate translations that get loaded into multiple files.
While in a smaller project it might be reasonable to just put everything in one file you might get at a point where you want to break translations into multiple files. Reasons might be:
You start losing the overview having more than 300 segments in a file
Not every translation needs to be loaded on the first page, speed up load time

Monorepos, images are not being loaded at differnt base path

Environment
I'm working with two frontend projects under the same GitHub repository. Following the guide provided by Vercel about monorepos and taking as an example Vercel's with-zone example, I've structured my project in the same way as in the example.
with-zones/
--platform //This is the main project (know as home in Vercel's guide)
--tools
Both deploys work fine, this means that I can access platform.vercel.com and platform.vercel.com/tools (these URLs are only examples)
The problem
Images are not loading when the URL is different from platform.vercel.app/tools (/tools is the basePath of the second project. No errors are logged in the terminal/browser so I'm stuck at this point. I just see the alt tag in the window.
In short, for the following urls:
platform.vercel.app/tools -> Images are loaded successfully
platform.vercel.app/tools/page1 -> Images are not loaded
Note.
I'm not having this issue with the main project, platform. I'm using .jpg images
Code
tools/next.config.js
module.exports = {
basePath: '/tools',
webpack: (config, options) => {
config.module.rules.push({
test: /\.csv$/,
loader: 'csv-loader',
options: {
dynamicTyping: true,
header: true,
skipEmptyLines: true,
}
})
return config
},
}
Img tag at any page
<img
src='categories/fluids.svg' // categories is in public folder
className={sizes.imgSmall}
/>
tools/package.json
{
...
"dependencies": {
"next": "10.1.3",
"react": "17.0.2",
..
Thank you in advance for your time and answers!
I don't know if this is the best way to solve this problem (probably not), but including the basePath ( /tools in this case) in the src of any image tag solves the problem.
<img
src='/tools/categories/fluids.svg'
className={sizes.imgSmall}
alt='Fluid mechanics icono' />
It works for any page in the tools project's page folder.

Phonegap 3.4 - getFile fails

Upgraded my app to phonegap 3.4 and reading a text file (db.txt) in the root of the www folder now fails.
The following snippet used to work:
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, this.gotFS, this.fail);
this.gotFS = function(fileSystem) {
console.log(fileSystem.name);
fileSystem.root.getFile("../MyappName.app/www/db.txt", {create: false, exclusive: true}, file_reader.gotFileEntry, file_reader.fail);
};
I've read here some changes occured in the file api but even if I use
fileSystem.root.getFile("db.txt", {create: false, exclusive: true}, file_reader.gotFileEntry, file_reader.fail);
};
or
fileSystem.root.getFile(fileSystem.root.toURL()+"db.txt", {create: false, exclusive: true}, file_reader.gotFileEntry, file_reader.fail);
};
file_reader.fail is always called with the error code of 5 which is ENCODING_ERR.
So basically how do you read a file in the root of the www folder with the new file api?

Resources