Android keystore2.AndroidKeyStoreProvider throws NPE on Samsung devices with API 31 Posted: 06 Feb 2022 12:46 AM PST I'm getting lots of crash reported on samsung devices running android 12 from yesterday. AndroidKeyStoreProvider throws NPE when calling X509Certificate.getPublicKey(). it's working fine on other brands devices. Key pair generation method : public void generateKeys(Context context) throws GeneratePairKeyException { KeyPairGenerator keyPairGenerator; try { if(KeyStoreUtil.getPrivateKey() == null){ Calendar start = GregorianCalendar.getInstance(); Calendar end = GregorianCalendar.getInstance(); end.add(Calendar.YEAR, 10); keyPairGenerator = KeyPairGenerator.getInstance("RSA", ANDROID_KEY_STORE); keyPairGenerator.initialize(new KeyPairGeneratorSpec.Builder(context) .setAlias(ALIAS) .setSerialNumber(BigInteger.valueOf(1)) .setStartDate(start.getTime()) .setEndDate(end.getTime()) .setSubject(new X500Principal("CN=Pushe_CA")) .build()); keyPairGenerator.generateKeyPair(); } } catch (NoSuchAlgorithmException | NoSuchProviderException | InvalidAlgorithmParameterException e) { Logger.e(e); throw new GeneratePairKeyException("pair key not created"); } catch (IllegalStateException e) { throw e; } catch (Exception e) { throw new GeneratePairKeyException("pair key not created"); } } App crashes when i'm trying to get private key like this : KeyStore keyStore = KeyStore.getInstance(ANDROID_KEY_STORE); keyStore.load(null); (PrivateKey) keyStore.getKey(ALIAS, null); here's the crash log : Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.security.PublicKey java.security.cert.X509Certificate.getPublicKey()' on a null object reference at android.security.keystore2.AndroidKeyStoreProvider.makeAndroidKeyStorePublicKeyFromKeyEntryResponse(AndroidKeyStoreProvider.java:220) at android.security.keystore2.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(AndroidKeyStoreProvider.java:401) at android.security.keystore2.AndroidKeyStoreProvider.loadAndroidKeyStoreKeyFromKeystore(AndroidKeyStoreProvider.java:343) at android.security.keystore2.AndroidKeyStoreSpi.engineGetKey(AndroidKeyStoreSpi.java:110) at java.security.KeyStore.getKey(KeyStore.java:1062) Any solutions? |
Is there a way to add clickable icons on weebly nav bars? Posted: 06 Feb 2022 12:45 AM PST Using weebly to create a website and I have come across this webpage(https://editortricks.weebly.com/how-to-add-icons-to-your-weebly-navigation.html) to add icons to the navigation bar. Here`s the code, /* External Fonts */ @font-face { font-family: 'dashicons'; src: url('fonts/dashicons.eot'); src: url('fonts/dashicons.eot?#iefix'); src: url('fonts/dashicons.woff'); src:url('fonts/dashicons.svg#svgdashicons'); src: url('fonts/dashicons.ttf'); } .wsite-nav-1:before, .wsite-nav-2:before, .wsite-nav-3:before, .wsite-nav-4:before, .wsite-nav-5:before { font-family: 'dashicons'; position: relative; top: 1px; /* Changes the icons' vertical position */ margin-right: 0px; /* Changes the icons' horizontal position */ color: #000000; /* Changes the icons' color */ font-size: 1em; /* Changes the icons' size */ } This allows the page to have icons in the navigation bar but they cannot be hyperlinked to another page. I have done a bit of HTML/CSS but I have no clue what I`m doing on Weebly's .less format. Please help, would really appreciate it. |
Print and save button in laravel Posted: 06 Feb 2022 12:45 AM PST How can I add two function which is the print and move the data to another table in a one button? Here when I click the borrow button the print preview will display only the row data and move the row data to borroweditem table. |
bash date -d different between script and terminal Posted: 06 Feb 2022 12:44 AM PST I have a very simple script that downloads some data. The date component is in ISO format (I think). I need to convert it to epoch. This is trivial with date -d and works fine in the terminal date -d "2022-01-29T13:10:10Z" +%s when I try to do it in a bash script echo $time timestamp=$(date -d ${time} +"%s") echo $timestamp I get date: invalid date '"2022-01-29T13:10:10Z"' I know I'm doing something stupid, I'm just not sure what and I can't find the answer - can someone please help |
GADT with Type level Bool - making (&&) type operator imply constraints for its arguments Posted: 06 Feb 2022 12:44 AM PST In summary I am trying to understand how I can tell ghc that a && b ~ True should imply that a ~ True and b ~ True within the context of a GADT. Given a data constructor: data Foo :: Bool -> * where ... Bar :: Foo j -> Foo k -> Foo (j && k) ... and, as an example, an instance for Eq (Foo True) : instance Eq (Foo True) where (Bar foo11 foo12) == (Bar foo21 foo22) = foo11 == ff21 && foo12 == foo22 .... the compiler gives the following error: Could not deduce: k1 ~ k from the context: 'True ~ (j && k) bound by a pattern with constructor: Bar :: forall (j :: Bool) (k :: Bool). Foo j -> Foo k -> Foo (j && k), in an equation for `==' at Main.hs:12:4-14 or from: 'True ~ (j1 && k1) bound by a pattern with constructor: Bar :: forall (j :: Bool) (k :: Bool). Foo j -> Foo k -> Foo (j && k), in an equation for `==' at Main.hs:12:21-31 `k1' is a rigid type variable bound by a pattern with constructor: Bar :: forall (j :: Bool) (k :: Bool). Foo j -> Foo k -> Foo (j && k), in an equation for `==' at Main.hs:12:21-31 `k' is a rigid type variable bound by a pattern with constructor: Bar :: forall (j :: Bool) (k :: Bool). Foo j -> Foo k -> Foo (j && k), in an equation for `==' at Main.hs:12:4-14 Expected type: Foo k Actual type: Foo k1 * In the second argument of `(==)', namely `f22' In the second argument of `(&&)', namely `f12 == f22' In the expression: f11 == f21 && f12 == f22 * Relevant bindings include f22 :: Foo k1 (bound at Main.hs:12:29) f12 :: Foo k (bound at Main.hs:12:12) (and an equivalent error for j and j1) This is obviously complaining that it doesn't know that f12 :: Foo k and f22 :: Foo k1 have the same type. Recently I have been using typelit-nat-normalise to solve what felt like a similar issue (with typenat addition), and I have searched for a similar library that may resolve these issues for bools - but to no avail. I have found typelevel-rewrite-rules, which I think might enable me to write some kind of rewrite rule for this but I can't work out the syntax for telling the compiler that: (a && b ~ True) implies (a ~ True) AND (b ~ True) . Which I believe would solve this issue. |
Ubuntu Startorder of service Posted: 06 Feb 2022 12:44 AM PST Running ubuntu 18.04 I'm running a host with docker and supervisord. Inside docker i have only the databases. My apps are running on the host (simple go apps and website, thus no container). My problem is, that the supervisor apps are started before the docker images are started, thus there is no database connection possible. Any hints on how to change the startup-order on the host, so supervisord is started after all docker containers are up? |
Multiple worker to same queue messages Posted: 06 Feb 2022 12:44 AM PST I have a task to migrate keys (S3 objects) from one S3 account to another S3 account as soon as possible. I would like to publish keys in a single queue but want multiple workers to consume keys from the same queue in parallel manner. Let's say I am publishing 1000 keys continuously in the queue and there are 5 workers consuming keys from queue. I want each 1000 to be picked by each different worker and all process keys parallely. I am not sure how to do it and distinguish which worker has already picked keys and which one yet to pick. |
radio and radiolist flutter andriod studio Posted: 06 Feb 2022 12:43 AM PST |
difference between interface and abstract contract in solidity Posted: 06 Feb 2022 12:43 AM PST I am learning solidity and got to know that interface and abstract are both classes that may contain unused functions. My doubt is: What is the difference between interface and abstract contract in a solidity smart contract. |
How to implement responsive width for Drawer MUI v5 component? Posted: 06 Feb 2022 12:43 AM PST I am using Material UI v5, and am trying to make a responsive drawer where for smaller devices it will take up 100% of screen width while for larger devices it should only take 1/3 of screen width. But I have no idea how to access Paper property to modify the actual width and make it responsive. My code: import { Drawer, styled } from "@mui/material"; const ResponsiveDrawer = styled(Drawer)(({ theme }) => ({ [theme.breakpoints.up("md")]: { width: "33%", // THIS ONLY CHANGES DRAWER WIDTH NOT PAPER WIDTH INSIDE THE DRAWER }, [theme.breakpoints.down("md")]: { width: "100%", }, })); export { ResponsiveDrawer }; How I use it: import { ResponsiveDrawer } from "./Style"; <ResponsiveDrawer anchor="right" open={drawer.state} onClose={() => drawer.onClick(false)} > ... </ResponsiveDrawer> |
Django upload multiple files to dynamic subfolder Posted: 06 Feb 2022 12:43 AM PST Is there any way to upload multiple files to a dynamic subfollder? I need to create the file system like this: _uploads _incident _folder1 _file1.docx _file2.xlsx _folder2 _file1.docx _file2.xlsx _file3.xlsx Where the name of the folder is defined in when upload files. I manage to upload multiple files but each time they are saved in incident folder and only 1 file is saved in subfolder folder1/folder2. These are some of my code. Models.py from django.db import models #Create your models here. def form_directory_path(instance,filename): # file will be uploaded to MEDIA_ROOT/<folder_name>/<filename> return 'incidents/{0}/{1}'.format(instance.folder_name, filename) class UploadFiles(models.Model): folder_name = models.CharField(max_length=40,unique=True) files = models.FileField(upload_to=form_directory_path) date = models.DateField(auto_now_add=True, blank=True, null=True) def __str__(self): return f'{self.folder_name} ({self.date})' Forms.py from django import forms from .models import UploadFiles # class FileFieldForm(forms.Form): # file_field = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True})) class FileFieldForm(forms.ModelForm): class Meta: model = UploadFiles fields = '__all__' widgets = { 'files': forms.ClearableFileInput(attrs={'multiple': True}), } Views from django.shortcuts import render from django.views.generic.edit import FormView from .forms import FileFieldForm from .models import UploadFiles class FileFieldFormView(FormView): form_class = FileFieldForm template_name = 'upload_files_app/upload.html' # Replace with your template. success_url = 'thankYou/' # Replace with your URL or reverse(). def post(self, request, *args, **kwargs): form_class = self.get_form_class() form = self.get_form(form_class) files = request.FILES.getlist('files') if form.is_valid(): form.save() for f in files: file_instance = UploadFiles(files=f) # Do something with each file. file_instance.save() return self.form_valid(form) else: return self.form_invalid(form) HTML file <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Incident declaration</title> </head> <body> <form action="" method="POST" enctype="multipart/form-data"> {% csrf_token %} {{ form.as_p }} <button type="submit">Upload</button> </form> </body> |
Dart: NoSuchMethodError - method not found "h" on null Posted: 06 Feb 2022 12:43 AM PST I am using Flutter Web and when accessing a FutureBuilder I get the NoSuchMethodError - method not found "h" on null When inspecting the page, i see the following error: core_patch.dart:195 Uncaught TypeError: Cannot read properties of undefined (reading 'h') at Object.bax (VM5 main.dart.js:25360:16) at VM5 main.dart.js:45250:25 at aWT.a (VM5 main.dart.js:3607:62) at aWT.$2 (VM5 main.dart.js:39703:14) at aVB.$1 (VM5 main.dart.js:39697:21) at a8Y.nJ (VM5 main.dart.js:40765:32) at aN8.$0 (VM5 main.dart.js:40122:11) at Object.Ds (VM5 main.dart.js:3740:40) at ax.tk (VM5 main.dart.js:40054:3) at a3F.dm (VM5 main.dart.js:39692:8) It looks like an error from Dart js. I have update my flutter version to 2.10, but previously I had the same error, except that instead of "h" I got "i" (NoSuchMethodError - method not found "i") P.S. I get this error ONLY in production(release) build, using debug build everything works just fine. |
Using ++ operator in react component Posted: 06 Feb 2022 12:45 AM PST I'm really confused about ++ operator in react component. I have 7 comment block but when I use index ++ in my component. I expect that index increases just one time. but index value increased for two times. I want to know how solve this problem ? |
Python List, Changing 2D element of a list to 1D element Posted: 06 Feb 2022 12:44 AM PST I wanted to change 2D element of a list to 1D in the following code. from itertools import chain a = ['one', 'two'] b = [[1, 2], [3, 3]] c = [ [[x] * y for x, y in zip(a, row)] for row in b ] c = list(chain.from_iterable(c)) print(c) The out put was [['one'], ['two', 'two'], ['one', 'one', 'one'], ['two', 'two', 'two']] if c = [ [x * y for x, y in zip(a, row)] for row in b ] the result would be [['Amh', 'EngEng'], ['AmhAmhAmh', 'EngEngEng']] But I wanted the result to be [['one', 'two', 'two'], ['one', 'one', 'one','two', 'two', 'two']] |
how to create non-spa website only using react js? Posted: 06 Feb 2022 12:43 AM PST I have a simple test project using react that shows users of fake API. The parent component is named App and it's my home page. There is a button named panel in the App component. I want it to go to Panel Component when I click it. function App() { const users = useSelector(state => state.users) const dispatch = useDispatch(); const getUsers=()=>{ // async action using redux-thunk return async function(dispatch){ try{ dispatch(GetUserRequest()) const response= await axios.get("https://reqres.in/api/users?page=2") dispatch(GetUserSuccess(response.data.data)) } catch(er){ dispatch(GetUserFail(er)) } } } useEffect(()=>{ dispatch(getUsers()) } ,[]) return (<> <Provider store={store}> <Routes> <Route path="users" element={<Users Items={users}/>}/> <Route path="/Panel" element={<Panel/>}/> </Routes> <button className='btn btn-primary' onClick={()=>{ navigate("/Panel") }}>Panel</button> <Users/> </> It's simple, But I want the Panel component to be a separate page instead of being part of the home page! And I don't want to show other components (in my project User component) So I tried a trick: using showPages state to determine which page should be shown: function App() { const users = useSelector(state => state.users) const[showPages,setShowPages]=useState("users") useEffect(()=>{ setShowPages("users") dispatch(getUsers()) } ,[]) return (<> <button className='btn btn-primary' onClick={()=>{ setShowPages("panel") }}>Panel</button> {showPages=="users" && ( <Users/> Items={users})} {showPages=="Panel" && <Panel/>} </> Now when I click the Panel button, I can see Panel page as a separate page, But guess what: I missed back button of the browser! I also don't want to use html-based project and use react in it. Is it possible to create non spa website using pure react? or I should create project without react and use react in it. |
Typescript doesn't check keys in array object Posted: 06 Feb 2022 12:43 AM PST I have an array that should content an explicit object. By some reason typescript doesn't show me errors if I break this object. type Test = { id: string; startDate: string; endDate: string; } const allCashBackByType:any=[{ id: "bla", startDate: "bla", endDate: "bla", someKey:"bla", someKey1:"bla", someKey2:"bla", someKey3:"bla" }] const test:Test[]=allCashBackByType.map((item: any) => ({ id: item.id, startDate: item.startDate, extraKey: '2222' })); Why is this happening and how can it be fixed? But if I remove method map that make iterations it shows errors const test:Test[]=[{ id: '11', startDate: "22", extraKey:"33" }]; But I need map. |
How to use like function in MongoDB when there is a "/" in my data? Posted: 06 Feb 2022 12:43 AM PST I know for MongoDB, for wildcard we can use / but I have a "/" in my field too, so that leads to error. Someone pls help me!! My data consists of both MMM YYYY (eg Dec 2021) and DD/MM/YYY. I only want to find users whose Plan Next Call column is Dec 2021 or ##/12/21... Thanks so much for your help.. My current script looks like this but it will also output those with date =12, when I only want the month to be Dec/12. db.test.find( {$or:[ {"Plan Next Call":"Dec-21"}, {"Plan Next Call": /12/} ]}, {"Name":1}) Attached the data: |
User is loged/signed in but the screen does not change Posted: 06 Feb 2022 12:44 AM PST I am working with Firebase authentication and lately was not able to do anything because of the following error. When I enter the user's credentials, it gets authenticated on the Firebase console, but my app's screen does not change. What's more, the following error appears in debug console. 2 I/System.out(26261): (HTTPLog)-Static: isSBSettingEnabled false I/SurfaceControl(26261): nativeRelease nativeObject s[-5476376676702711408] I/SurfaceControl(26261): nativeRelease nativeObject e[-5476376676702711408] W/System (26261): Ignoring header X-Firebase-Locale because its value was null. 2 I/System.out(26261): (HTTPLog)-Static: isSBSettingEnabled false void authUser( String email, String password, String conPassword, bool isLogin) async { UserCredential authResult; setState(() { isLoading = true; }); FocusScope.of(context).unfocus(); try { if (password != conPassword && isLogin == false) { showDialog( context: context, builder: (_) => const AlertDialog( title: Text('Passwords don\'t match'), content: Text('Please check if your passwords match'), ), ); } if (isLogin == false) { authResult = await firebaseAuth.createUserWithEmailAndPassword( email: email, password: password, ); } else { authResult = await firebaseAuth.signInWithEmailAndPassword( email: email, password: password, ); } setState(() { isLoading = false; }); } catch (e) { rethrow; } } ... TextFormField( key: const ValueKey('email'), keyboardType: TextInputType.emailAddress, decoration: const InputDecoration( label: Text('Email adress'), ), onSaved: (newValue) { email = newValue!; FocusScope.of(context).requestFocus(_passwordNode); }, ), TextFormField( key: const ValueKey('password'), focusNode: _passwordNode, obscureText: true, onSaved: (newValue) { password = newValue!; FocusScope.of(context).requestFocus(_conPasswordNode); }, decoration: const InputDecoration( label: Text('Password'), ), ), if (isLogin == false) TextFormField( key: const ValueKey('conPassword'), focusNode: _conPasswordNode, obscureText: true, decoration: const InputDecoration( label: Text('Confirm password'), ), onSaved: (newValue) { conPassword = newValue!; }, ), Expanded( child: Container(), ), widget.isLoading == true ? const Center( child: CircularProgressIndicator(), ) : ButtonBar( alignment: MainAxisAlignment.center, children: [ ElevatedButton( onPressed: () { setState(() { isLogin = !isLogin; }); }, child: Text(isLogin == true ? 'SignUp' : 'Login'), ), ElevatedButton( onPressed: _trySubmit, child: const Text('Done'), ), ], ), ... void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return FutureBuilder( future: Firebase.initializeApp(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const CircularProgressIndicator(); } return MultiProvider( providers: [ ChangeNotifierProvider( create: (ctx) => RecipeProvider(), ), ], child: MaterialApp ... home: StreamBuilder<User?>( stream: FirebaseAuth.instance.authStateChanges(), builder: (context, snapshot) { if (snapshot.connectionState == ConnectionState.waiting) { return const CircularProgressIndicator(); } if (snapshot.hasData) { return AllRecipesScreen(); } return AuthScreen(); }), routes: { AllRecipesScreen.routeName: (ctx) => AllRecipesScreen(), RecipeDetailScreen.routeName: (ctx) => RecipeDetailScreen(), AddRecipeScreen.routeName: (ctx) => AddRecipeScreen(), AuthScreen.routeName: (ctx) => AuthScreen(), }, ), ); }); } } |
Subsetting a dataframe in R by retaining first occurrences of unique elements from all columns Posted: 06 Feb 2022 12:45 AM PST df is a test dataframe which has 5 rows and 6 columns and it is a subset of a much larger dataframe (dimensions: 1000000 X 30). df <- data.frame( Hits = c("Hit1", "Hit2", "Hit3", "Hit4", "Hit5"), category1 = c("a", "", "b", "a", ""), category2 = c("c", "", "", "d", "c"), category3 = c("", "", "e", "f", "f"), category4 = c("", "", "", "", ""), category5 = c("i", "", "i", "j", "")) df looks like this For each column from category1 to category5 I need to retain only the first occurrences of all the unique elements. e.g. For category1 , the unique elements are a and b and their first occurrences are in rows 1 and 3 respectively. So rows 1 and 3 should be retained, and so on. The output should look something like this |
How does a smart contract being expended over the block chain? Posted: 06 Feb 2022 12:45 AM PST Alert: Beginners question. I am searching about solving this question. Once we deploy a smart contract, how on the block chain does other nodes know about my smart contract? If any one have some suggestions on how to understand this part. I can understand that my question may require a lot of explanations. I appreciate any links to resources that would help me the prerequisites. |
jQuery: How to change the font if the assigned one doesn't load? Posted: 06 Feb 2022 12:44 AM PST I know it would be possible to fix that with CSS only, but I need a jQuery solution: How is it possible to change the font if the assigned one doesn't load? This would be the general idea, I just have issues to code it correctly: $(window).load(function() { if ($(myfont).doesntload; }) { $("*").css("font-family", "otherfont"); } }); @font-face { src: url("fonts/myfont.ttf") format("truetype"); font-family: "myfont"; } @font-face { src: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/133207/moderna_-webfont.ttf") format("truetype"); font-family: "otherfont"; } * { font-family: "myfont"; } .other-font { font-family: "otherfont"; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div>This is a text lol</div> Would be very thankful for help! <3 |
When a file is "opened with" a winforms application how do I get the application to load that file? Posted: 06 Feb 2022 12:44 AM PST I am able to set my .mdb files to "open with" my winforms application, but that only opens the winforms application without loading the file. Is there any event that is triggered upon opening the application through a file for me to add how my application will react to the file/file-directory? Update: apparently this can be done for "Windows Store Apps": File "Open with" my Windows Store App But it seems as though my winforms project lacks a package.appxmanifest to edit these settings from. |
How to display version update once user update the app from playstore Posted: 06 Feb 2022 12:43 AM PST Sorry if this is a stupid question since I don't find any solution. So I know that I can get the version number and update-notifier when the update is available on the play store or app store using some flutter package. But I think that I cant show users what the update is about and there is no package like that exists. So I think I need to implement something like an alert dialog manually to show the updated information before I want to publish the update. So, how can I do it with flutter to show that alert dialog just once after the user update the app? Can shared preferences do that? If so how? And is there really a package or ways that I can show the updated information that I don't know of? |
Shell how to make some of the script arguments mandatory Posted: 06 Feb 2022 12:45 AM PST I want to run a script which accepts 3 command line options -o|q|i . I want to make the q and o but not i so run command has to look like: script.sh -q <some-text> -o <some-other-text> The below code makes none of them mandatory. How can I achieve this? for arg in "$@" do case $arg in -q) req="$2" shift shift ;; -o) out="$2" shift shift ;; -i|) ind="$2" shift shift ;; esac done |
Is it allowed to associate specific file types to installed UWP app? Posted: 06 Feb 2022 12:46 AM PST I have a PDF viewer which is an UWP app, is it possible to register to Windows platform so that this app can be launched by Windows when Desktop App calls shell API (ShellExecute with open verb) to open the PDF document? |
Selenium Python After pressing the button,a new window opens,I can't press the keys there Posted: 06 Feb 2022 12:43 AM PST I am new to python https://prnt.sc/26nlk3q I press the button on the site, then this window appears in which you need to click to confirm I tried this driver.switch_to.window(driver.window_handles[-1]) And This alert = browser.switch_to.alert alert.accept() but its not working for me I can show you how it looks in the browser, if necessary This window has a separate html code, I do not understand how to access it |
pyqtgraph: fixing the number of strings displayed on the x-axis when using TimeAxisItem and tickStrings Posted: 06 Feb 2022 12:45 AM PST I am making a scrolling graph which will plot real-time sensor data, with time on the x axis. I am a bit confused by the behavior of tickStrings . My code is based on the example below (from here). As the number of points plotted increases, the number of x axis strings varies - sometimes it increases and sometimes it decreases . It stabilizes once the deque is full length and the 'scrolling' begins. Is it possible to keep the spacing between tick strings the same as the number of plotted points increases? I guess that it might be possible use an approach where blank tick strings are replaced as new data is added, but don't know how to do that. Edit: An example of what I wish to achieve is here. import sys import numpy as np import datetime from PyQt5.QtCore import QTime, QTimer from pyqtgraph.Qt import QtGui import pyqtgraph as pg from collections import deque import time class TimeAxisItem(pg.AxisItem): def __init__(self, *args, **kwargs): super(TimeAxisItem, self).__init__(*args, **kwargs) def tickStrings(self, values, scale, spacing): return [int2dt(value).strftime("%H:%M:%S") for value in values] def int2dt(ts): return(datetime.datetime.fromtimestamp(ts)) class MyApplication(QtGui.QApplication): def __init__(self, *args, **kwargs): super(MyApplication, self).__init__(*args, **kwargs) self.t = QTime() self.t.start() maxlen = 100 self.data_x = deque(maxlen=maxlen) self.data_y = deque(maxlen=maxlen) self.win = pg.GraphicsLayoutWidget() self.win.resize(1000,600) self.plot = self.win.addPlot(title='Scrolling real-time plot', axisItems={'bottom': TimeAxisItem( orientation='bottom')}) self.curve = self.plot.plot() self.tmr = QTimer() self.tmr.timeout.connect(self.update) self.tmr.start(1000) self.y = 100 self.win.show() def update(self): x = int(time.time()) self.y = self.y + np.random.uniform(-1, 1) self.data_x.append(x) self.data_y.append(self.y) time.sleep(2) print(self.data_x) print(self.data_y) self.curve.setData(x=list(self.data_x), y=list(self.data_y)) def main(): app = MyApplication(sys.argv) sys.exit(app.exec_()) if __name__ == '__main__': main() |
NoSuchMethodError: org.springframework.boot.web.servlet.error.ErrorController.getErrorPath() in latest spring-cloud-starter-netflix-zuul Posted: 06 Feb 2022 12:45 AM PST My application use spring-boot version 2.5.0 and spring-cloud-starter-netflix-zuul 2.2.8.RELEASE With latest spring-boot version 2.5.0, getErrorPath() API is removed from ErrorController, but latest spring-cloud-starter-netflix-zuul 2.2.8.RELEASE still calls this API and causes this error Has anyone got the same issue and resolved already 2021-06-23 19:36:31 o.a.c.c.C.[.[localhost] [ERROR] Exception Processing ErrorPage[errorCode=0, location=/error] org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'java.lang.String org.springframework.boot.web.servlet.error.ErrorController.getErrorPath()' at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1078) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:327) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:81) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:121) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:87) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:81) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:149) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:103) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:89) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:110) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:211) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:183) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:358) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:271) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:103) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:710) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:398) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:257) at org.apache.catalina.core.StandardHostValve.throwable(StandardHostValve.java:352) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:177) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:374) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.NoSuchMethodError: 'java.lang.String org.springframework.boot.web.servlet.error.ErrorController.getErrorPath()' at org.springframework.cloud.netflix.zuul.web.ZuulHandlerMapping.lookupHandler(ZuulHandlerMapping.java:87) at org.springframework.web.servlet.handler.AbstractUrlHandlerMapping.getHandlerInternal(AbstractUrlHandlerMapping.java:152) at org.springframework.web.servlet.handler.AbstractHandlerMapping.getHandler(AbstractHandlerMapping.java:498) at org.springframework.web.servlet.DispatcherServlet.getHandler(DispatcherServlet.java:1257) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) ... 72 common frames omitted |
flutter richtext separated align Posted: 06 Feb 2022 12:43 AM PST i see this code for rich text in flutter: return Row( children: <Widget>[ ? Container( child: RichText( text: TextSpan( text: "Hello", style: TextStyle(fontSize: 20.0,color: Colors.black), children: <TextSpan>[ TextSpan(text:"Bold"), style: TextStyle( fontSize: 10.0, color: Colors.grey), ), ], ), ), ) this print Hellobold but i need to separe both text one aling to left other to right, like this Hello bold how i do this? thanks |
Semi continuous section in LP format file provided to cbc crashes Posted: 06 Feb 2022 12:44 AM PST I am using version 2.9.9 of cbc in ubuntu 17.10 docker image. My test.lp file has following content: Maximize obj: x1 + 2 x2 + 3 x3 + x4 Subject To c1: - x1 + x2 + x3 + 10 x4 <= 20 c2: x1 - 3 x2 + x3 <= 30 c3: x2 - 3.5 x4 = 0 Bounds 0 <= x1 <= 40 2 <= x4 <= 3 General x4 Semis x1 x2 x3 When trying with semis section i get error "terminate called after throwing an instance of 'CoinError?' Aborted" on mac i get: libc++abi.dylib: terminating with uncaught exception of type CoinError? Abort trap: 6 However if I comment out Semis it works fine. I was hoping that Semis are supported. Am I doing something wrong? My command is : cbc -presolve on -import test.lp solve solu out.txt On further analysis i found out when in cbc prompt i type "import test.lp" it fails and shows same error is |
No comments:
Post a Comment