How to import a page within a page in Ionic 3 - html

This is the app component. It gives an error that it can't find module pages/question/pages/question1/question1
This is the app module where I declared the question1. still the same error.

Your import path is wrong, it should be as,
import {question1} from './pages/questions/pages/question1'

Related

Import vue-i18n and vue-flag-icon in Vite Vue 3 project

I built my Vue 3 project with Vite. I was in need of some plugins for my app. I have tried importing both of them. I have installed both with npm i vue-i18n vue-flag-icon and tried importing both of them independently.
// In main.js
import VueI18n from 'vue-i18n' // error
This gives the following error:
main.js:4 Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/vue-i18n.js?v=4951897a' does not provide an export named 'default' (at main.js:4:8)
// In main.js
import FlagIcon from 'vue-flag-icon' // error
This crashes the app with the following error:
[[ERROR] Could not resolve "./icon/Flag"
node_modules/vue-flag-icon/components/index.js:1:17:
1 │ import Flag from './icon/Flag'
╵ ~~~~~~~~~~~~~
I have tried both of these in a non-Vite project with the standard vue-cli and it works flawlessly. Is there something I need to do for it to work with Vite?
I fixed the first import by using this line:
// In main.js
...
import {createI18n} from 'vue-i18n' // no error
// Whereafter I can use the function I need to set the plugin.
const i18n = createI18n({
locale: 'en', // set locale
fallbackLocale: 'nl', // set fallback locale
messages, // set locale messages
}
createApp(App).use(i18n)
...
I understand that I imported the function to make an instance of I18n instead of importing the whole object. But I do not understand why that works or why I would need to do that.
I also have no idea the second plugin doesn't work, I have heard that Vue 2 plugins don't work on Vue 3 and that plugin is 5 years old, so I assume it's made for Vue 2. Anyways, that doesn't explain why it works with vue-cli.

Avoid using web-only libraries outside Flutter web plugin packages

I'm building a Flutter app that I am trying to make work on the web. Part of it contains some web specific code:
import 'dart:html' as html;
import 'package:flutter/foundation.dart';
class DownloadViewModel extends ChangeNotifier {
static const String url = 'https://example.com/api/v1/app/myapp_1.0.0.apk';
void onAndroidDownloadPressed() {
html.window.open(url, 'AndroidApp');
}
}
However the dart:html import gives the following error:
Avoid using web-only libraries outside Flutter web plugin packages
The longer version of the warning looks like this:
Avoid using web libraries, dart:html, dart:js and dart:js_util in
Flutter packages that are not web plugins. These libraries are not
supported outside a web context; functionality that depends on them
will fail at runtime in Flutter mobile, and their use is generally
discouraged in Flutter web.
Web library access is allowed in:
plugin packages that declare web as a supported context
otherwise, imports of dart:html, dart:js and dart:js_util are disallowed.
And it's not just a warning. This actually prevents building an Android or iOS app (even though this method isn't accessible from non-Web Flutter apps).
The only solution I've figured out is to comment out the import when I am building for Android and iOS and then uncomment it when I am building for the web. Is there a better solution?
Use the universal_html package. It supports the browser, Dart VM, and Flutter and is a stand-in replacement for dart:html and other web related libraries.
dependencies:
universal_html: ^1.2.1
Then instead of using import 'dart:html' as html; you can use the following import:
import 'package:universal_html/html.dart' as html;
For those who came to this page for other related web import problems (like dart:js), this plugin also supports the following imports:
import 'package:universal_html/driver.dart';
import 'package:universal_html/html.dart';
import 'package:universal_html/indexed_db.dart';
import 'package:universal_html/js.dart';
import 'package:universal_html/js_util.dart';
import 'package:universal_html/prefer_sdk/html.dart';
import 'package:universal_html/prefer_sdk/indexed_db.dart';
import 'package:universal_html/prefer_sdk/js.dart';
import 'package:universal_html/prefer_sdk/js_util.dart';
import 'package:universal_html/prefer_sdk/svg.dart';
import 'package:universal_html/prefer_sdk/web_gl.dart';
import 'package:universal_html/prefer_universal/html.dart';
import 'package:universal_html/prefer_universal/indexed_db.dart';
import 'package:universal_html/prefer_universal/js.dart';
import 'package:universal_html/prefer_universal/js_util.dart';
import 'package:universal_html/prefer_universal/svg.dart';
import 'package:universal_html/prefer_universal/web_gl.dart';
import 'package:universal_html/svg.dart';
import 'package:universal_html/web_gl.dart';
Since the merge of Flutter-web into the main Flutter repository, it's no longer possible to directly add imports for web libraries (e.g. dart:html, or dart:js) in a Flutter project on the main channel when targeting Web, Android and iOS.
Use the universal html package which provides extensive support for multiple platforms and web libraries.
From the root level of your project, command
flutter pub add universal_html
import 'package:universal_html/html.dart' as html
This package isn't required to run some web files (e.g. dart:js). In my case, I just had to remove the import 'dart:js' import statement.

Gmaps issues on jupyter notebook

I load gmaps package in python.
However when in Jupyther notebook I type command :
import gmaps
gmaps.configure(api_key="AI")
data = gmaps.datasets.load_dataset("taxi_rides")*
I have this error message:
*AttributeError: 'module' object has no attribute 'datasets'*
Does someone knows what is going on ?
Somewhat late to the party, but you are not importing the correct module:
import gmaps
import gmaps.datasets # You also need to import this!
gmaps.configure(api_key="AI")
data = gmaps.datasets.load_dataset("taxi_rides")

require is not a function

I'm trying to add angular 2 google maps to my existing angular 2 project.
I have almost succeeded. Now the only error I get is
Uncaught TypeError: require is not a function
Apparently the offending line is line 1 in my main google maps third party library file: google-map.ts.
The line is:
import {Component, ElementRef, EventEmitter, OnChanges, OnInit, SimpleChange} from '#angular/core';
Which is weird because it doesn't say require in the line. How do I make sure require is defined as a function?
When I had this error, it was because Angular couldn't find a component. If you check the network tab in the browser development tools of the offending page and look at the response tab for each file. Make sure the response is the actual file you expect (at present angular will not 404 if it can't find a component file)

Geronimo FTP Server on Fedora 19

I am trying to use the FTP server (factory) in Geronimo 3.0.1 on Fedora 19, in eclipse kepler. I have the following import which produces no error:
import org.apache.mina.*;
However, when I declare
FTPServerFactory ftpFactory;
FTPServer ftpServer;
neither of FTPServer and FTPServerFactory is resolvable. The usual eclipse hints in the editor, which are very cool, offer no help in this case. My build path has the mina-core.jar (This is the only MINA jar that I find in /usr/share/java/apache-mina). The build path dialog flags errors, not explicitly for mina, stating the the following are missing:
org.eclipse.JRE_CONTAINER/
org.eclipse.jdt.internal.debug.uio.launcher.StandardVMType/
java-1.7.0-openjdk-1.7.0.25.x86-64
I suspect that my installation is missing other mina jars and am at a loss for the three errors above except that the last one is strange given that the that the build path has
java-1.7.0-openjdk-1.7.0
My environment is all relatively new, so there could be problems in a number of places. Any advice on where to start?
Thanks in advance.
I am not sure what happened when I logged in. Please disregard the empty question.
I have the following, which does not produce errors.
import org.apache.ftpserver.ftplet.FtpException;
import org.apache.ftpserver.ftplet.FtpReply;
import org.apache.ftpserver.ftplet.FtpRequest;
import org.apache.ftpserver.ftplet.FtpSession;
import org.apache.ftpserver.ftplet.Ftplet;
import org.apache.ftpserver.ftplet.FtpletContext;
import org.apache.ftpserver.ftplet.FtpletResult;
import org.apache.ftpserver.listener.ListenerFactory;
import org.apache.ftpserver.ssl.SslConfigurationFactory;
import org.apache.ftpserver.usermanager.*;
import org.apache.ftpserver.usermanager.impl.BaseUser;
My build path includes
ftpserver-core-1.06.jar - /usr/share/java/apache-ftpserver/common/lib
A code fragment follows
//Add the user to the FTP server as well.
PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory();
userManagerFactory.setFile(new File("myusers.properties"));
userManagerFactory.setPasswordEncryptor(new SaltedPasswordEncryptor());
org.apache.ftpserver.ftplet.UserManager um = userManagerFactory.createUserManager();
BaseUser user = new BaseUser();
user.setName(newCredentials.getUserID());
user.setPassword(ConfigurationValues.get("ftpGenericPassword"));
new File(ConfigurationValues.get("ftpFilesRoot")+newCredentials.getUserID());
user.setHomeDirectory("ftproot");
um.save(user);
I hope this is of use. Takes a little burrowing to sort it out.