Not compile project after migrate from Vaadin 7 to Vaadin 8 - vaadin7

Current version of Vaadin is 7.3.6
Here some my code:
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
private NativeSelect currencySelector;
private void initCurrencySelector(String providerId) {
currencySelector = new NativeSelect();
List<String> selectCurrencyList;
currencySelector.removeAllItems();
}
And this code success compile.
But after I try to upgrade to Vaadin 8.12.0 then this code not compile.
error in this lines:
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
and in this line:
currencySelector.removeAllItems();

the new imports should be
import com.vaadin.data.HasValue.ValueChangeEvent;
import com.vaadin.event.FieldsEvent
TextChangeEvent and TextChangeListener probably were replaced by HasValue.ValueChangeEvent and HasValue.ValueChangeListener
currencySelector.removeAllItems(); should be
currencySelector.setDataProvider(new ListDataProvider(new ArrayList()));
a list of incompatible changes can be found here https://vaadin.com/download/prerelease/8.0/8.0.0/8.0.0.beta1/release-notes.html#incompatible

Related

PyInstaller - AttributeError: 'ApplicationLogin' object has no attribute 'img_location'

I created a Windows .exe file from a python script using PyInstaller but when I launch the executable I get the error: AttributeError: 'ApplicationLogin' object has no attribute 'img_location'. However, running the same script from the terminal it works without issues.
Below is the piece of the code where the error is detected. The python version I used is 3.9.10
import os
from PyQt5.QtWidgets import QWidget, QDialog, QMessageBox
from PyQt5.QtCore import pyqtSignal
from PyQt5.QtGui import QPixmap
from preventivo_config_file import Preventivo_Config
from password_edit import PasswordEdit
from gestione_utenti import UserMng
from menu_preventivo import PreventivoMenu
from preventivo_login_dialogUi import Ui_f_login_dialog
class ApplicationLogin(QDialog, Ui_f_login_dialog):
closed = pyqtSignal()
login = pyqtSignal()
def __init__(self):
super(ApplicationLogin, self).__init__()
self.read_configFile()
self.setup_login()
def read_configFile(self):
prev_config=Preventivo_Config("preventivo_config")
parametri=prev_config.preventivo_config_records()
if not parametri:
return
self.img_location=parametri['images']
self.icons_location=parametri['icons']
def setup_login(self):
self.setupUi(self)
pixmap = self.caricamento_immagini("mx1.png")
I tried to look on the web for similar issue but I didn't find any hint

How to import external library in QT Python?

I have an issue when importing external python library in QT app.
The program is crashing when I'm trying to import the canlib.
However, no import error is caught, only application communicate appear like this:
program finished with code -1
When I comment out the canlib import, program runs fine.
import os
from pathlib import Path
import sys
import random
from Connection import Connection
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine
from PySide6.QtCore import QTimer
from canlib import kvadblib #here is an error source
if __name__ == "__main__":
app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
# Connection QT <---> Python
connection = Connection()
engine.rootContext().setContextProperty("connection", connection)
# End
# Hardware Init
db = kvadblib.Dbc(filename='battery_monitoring_app.dbc')
ch = communication.open_virtual_channel(1)
# End
engine.load(os.fspath(Path(__file__).resolve().parent / "qml/main.qml"))
if not engine.rootObjects():
sys.exit(-1)
### DO WHILE TRUE STUFF
def doStuff():
connection.testSignalVariable.emit(random.uniform(0.00, 2.00))
### END
timer = QTimer()
timer.timeout.connect(doStuff)
timer.start(100)
sys.exit(app.exec_())

I try to use moment.js in vue3(ts),based vite.it can be used,but i can not use 'zh-cn' in my code.thanks

in main.ts
import * as moment from 'moment';
import 'moment/locale/pt';
import 'moment/locale/zh-cn';
console.log(1,moment.locale()); // en
moment.locale('fr');
console.log(2,moment.locale()); // en
moment.locale('zh-CN');
console.log(3,moment.locale()); // pt-BR
console.log(moment.locales())
const app = createApp(App)
app.config.globalProperties.$moment = moment
It can not be changed 'zh-cn',moment.locale() run result is also 'en',use 'moment.locale('zh-CN')' or 'moment.locale('zh-cn')' or 'moment.locale('zh-Cn')' is not useful.
I try to using day.js instead of momentjs.It can be use chinese in my code.
In main.ts.
import dayjs from 'dayjs'
import isLeapYear from 'dayjs/plugin/isLeapYear' // 导入插件
import relativeTime from'dayjs/plugin/relativeTime'
import 'dayjs/locale/zh-cn' // 导入本地化语言
dayjs.extend(relativeTime)
dayjs.extend(isLeapYear) // 使用插件
dayjs.locale('zh-cn') // 使用本地化语言
console.log(dayjs().from(dayjs('1990-01-01')))

Amazon AirFlow 1.10.12: No module named 'operators'

I am creating a plugin and dag structure for Amazon AirFlow 1.10.12. I do according to the documentation:
dags:
- aws_from_redshift_to_s3.py
plugins:
- __init__.py
- from_redshift_to_s3_plugin.py
- operators:
-- __init__.py
-- aws_from_redshift_to_s3_operator.py
aws_from_redshift_to_s3_operator.py:
from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from airflow.contrib.hooks.aws_hook import AwsHook
class FromRedshiftToS3TransferOperator(BaseOperator):
pass
from_redshift_to_s3_plugin.py:
from airflow.plugins_manager import AirflowPlugin
from operators.aws_from_redshift_to_s3_operator import FromRedshiftToS3TransferOperator
class FromRedShiftToS3Plugin(AirflowPlugin):
name = 'from_redshift_to_s3_plugin'
operators = [FromRedshiftToS3TransferOperator]
В самом ДАГе подключаю так:
from operators.from_redshift_to_s3_plugin import FromRedshiftToS3TransferOperator
При попытке активировать ДАГ в Amazon AirFlow 1.10.12 получаю ошибку: No module named 'operators'
https://airflow.apache.org/docs/apache-airflow/1.10.12/howto/custom-operator.html
As mentioned in this documentation, you no longer need to import from operators. Instead try importing like this,
from aws_from_redshift_to_s3_operator import FromRedshiftToS3TransferOperator

importing avro data using java api in sqoop

The problem is how to run java program for sqoop import ?
I am using sqoop version 1.4.7 and hadoop version 2.7.2 and I
am trying to run on net beans ide 8.1
here is the code:
package sqoop5;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
import com.cloudera.sqoop.SqoopOptions;
import com.cloudera.sqoop.tool.BaseSqoopTool;
import com.cloudera.sqoop.tool.ImportTool;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Sqoop5 {
public static void main(String[] args) throws Exception {
String driver = "org.postgresql.Driver";
Class.forName(driver).newInstance();
SqoopOptions options = new SqoopOptions();
options.setConnectString(("jdbc:postgresql://
127.0.0.1:5432/postgres"));
options.setTableName(("new"));
options.setUsername(("postgres"));
options.setPassword(("********"));
options.setNumMappers(1);
options.setTargetDir(("hdfs://
127.0.0.1:9000/usr/new11"));
options.setFileLayout(com.cloudera.sqoop.
SqoopOptions.FileLayout.AvroD ataFile);
new ImportTool().run((com.cloudera.sqoop.SqoopOptions)
options);
}
}
The error message is as follows:
cause:org.apache.hadoop.ipc.RemoteException: Server IPC
version 9
cannot communicate with client version 4
Aug 05, 2019 10:46:29 AM org.apache.sqoop.tool.ImportTool run
SEVERE: Encountered IOException running import job:
org.apache.hadoop.ipc.RemoteException: Server IPC version 9
cannot
communicate with client version 4
at org.apache.hadoop.ipc.Client.call(Client.java:1113)
at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:229)
at com.sun.proxy.$Proxy6.getProtocolVersion(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
If you read this post, you will see that it's something similar to your problem.
Probably a version mismatch between the applications. Check the version of hadoop you are including vs the version of hadoop from your cluster.

Resources