on-internet

Wrap text in seaborn barplot x-axis python

I'm trying to plot a dataframe and I want the x-axis labels to not override each other like here When dealing with one plot, adding .set_xticklabels(rotation=30) does solve the issue: sns.catplot("foo", data=boo, aspect=5, kind="count" ).set_xticklabels(rotation=30) but when I add the ax argument as here: sns.catplot("foo", data=boo, aspect=5, kind="count" , ax=fig.add_subplot(211) ), it doesn't (see the first snapshot). I tried sns.catplot("foo", data=boo, aspect=5, kind="count", ax=ax1).set_xticklabels(rotation=30) I'm looking for some kind of excel's "wrap text". I tried looking in seaborn

Join the discussion →

Redundant keyword arguments

I found that writing a function which is a wrapper around another one can lead to "redundant" keyword arguments. For example look at this few lines: def check_then_execute(foo=1, bar="A"): foo = safe(foo) # will return foo in a safe form bar = safe(bar) execute(foo=foo, bar=bar) # doesn't it feel redundant? In this example execute() is a library function that has keyword arguments. Possibly more than two. Is there a way to pass keyword arguments using the name of the variable as the keyword?

Join the discussion →

Always block executes every time

I've been having problem just figuring out this simple code. module diode (switch, led); output led; input switch; reg led; always @* begin led = 1'b0; end endmodule The logic behind it is as follow = press the button, the LED turns on? The problem I am facing is this always block. The way it's supposed to work is that whenever there's a change in switch (the button that I press), the LED should turn on? But the LED turns on automatically all the time entering this always block even if I don't press anything. The only way to 'solve' this is if I put an if/else statement in always block so that

Join the discussion →

Multiple date select in Angular material 7

Scenario: Need to select multiple date in the date picker in angular material. currently this scenario is not there in the official documentation in DatePicker Examples Question : How can I implement the multiple date select with the material design? I though of modifying the existing implementation of angular material, but have no idea where to start. Any leads would be very helpful.

Join the discussion →

Flutter Firebase/Firestore Document Reference to Future Builder List View

Just started using Firestore and Flutter and trying to get my document items from Firestore into a ListView and running into errors. Here is my data structure: and here is my code for the page so far. import 'package:flutter/material.dart'; import 'package:async/async.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter_firestore_test/ui/restaurantDetail.dart'; class RestaurantList extends StatefulWidget { final String title; final String director; RestaurantList({Key key, this.title, this.director}) : super(key: key); @override _RestaurantListState createState

Join the discussion →

Iterating value of multi-bit signal

I have a 100-bit signal in Verilog: array <= 100'b1000000000000000001111111100000000000000111111100001000000000000000001111110000000000000000001110000; I want to iterate each bit one by one and display each bit individually in the console using a loop or any other logic. Is it possible to do so?

Join the discussion →

sqlite if exist update else insert in python

I am trying to update Count=Count+1 if src_ip already exists, else insert into table. I was able to do it with UPSERT successfully: INSERT INTO result('min(_time)', src_ip) VALUES(?,?)ON CONFLICT(src_ip) DO UPDATE SET Count=Count+1; I am looking for another way to do this without using UPSERT. I tried this : # Import csv to SQLite with open('result5.csv', 'r') as f: dr = csv.DictReader(f) for i in dr: c.execute("UPDATE result SET Count = Count + 1 WHERE src_ip = ?", (i['src_ip'],)) if c.rowcount == 0: c.execute("INSERT INTO result ('min(_time)', src_ip, Count) VALUES (?,?,1)", (i['min(_time)']

Join the discussion →

Are Agra main attractions closed on 31st of December?

I'm planing a trip to India for the end of this year, and I want to know if Agra main attractions are closed on the 31st of December (like the Taj Mahal and Agra fort). I didn't find anything in the internet with respect to this. I only see that the Taj is closed on all Fridays.

Join the discussion →

Spring Boot Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test

I am using Eclipse Version: 2018-09 (4.9.0) and I have installed the Spring Tool Suit(STS) in eclipse for building Spring Boot Applications. Question-> Whenever I create a new Spring Starter Project and try to maven build my project without any code addition, the build fails with the below error: [WARNING] The requested profile "pom.xml" could not be activated because it does not exist. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project DemoSpringProject: There are test failures. [ERROR] [ERROR] Please refer to C:\Users\SP064774\

Join the discussion →

Error message: A fatal error occurred while creating a TLS client credential. The internal error state is 10013

After the server has been rebooted, my iis hosted website on login fails. I have started seeing the error "A fatal error occurred while creating a TLS client credential. The internal error state is 10013." in the System Logs. Please let me know if something can be done to fix this issue. Thanks Click here to view the error message image

Join the discussion →

how to Serialize .Net Class to Avro.Generic.GenericRecord for publishing into kafka topic?

I am trying to find a way/helper to convert.Net Class to Avro.Generic.GenericRecord . Currently, I am manually adding field-name and field-value to Generic record. Is there a serializer/converter which I can use to convert the object to generic record and publish on to a kafka topic. class Plant { public long Id { get; set; } public string Name { get; set; } public List<PlantProperties> PlantProperties{ get; set; } } class PlantProperties { public long Leaves{ get; set; } public string Color{ get; set; } } Please suggest.

Join the discussion →

whats does assert _sre.MAGIC == MAGIC, SRE module mismatch AssertionError: SRE module mismatch error mean?

Hello I´m trying to run a python manage.py runserver command but getting this error message File "C:\Users\adrie\Anaconda3\lib\sre_compile.py", line 17, in assert _sre.MAGIC == MAGIC, "SRE module mismatch" AssertionError: SRE module mismatch Does anyone have idea of what´s happening here? I had anaconda installed previously and was running fine. But then I´ve deinstalled and reinstalled anaconda, and I´m getting this error now.

Join the discussion →

couchdb.service: Failed with result 'start-limit-hit'

After I installed couchdb, I could get the welcome information $ curl localhost:5984 {"couchdb":"Welcome","version":"2.1.2","features":["scheduler"],"vendor":{"name":"The Apache Software Foundation"}} But I can't check the status by systemctl $ systemctl status couchdb.service ● couchdb.service Loaded: not-found (Reason: No such file or directory) Active: failed (Result: start-limit-hit) since 一 2018-12-03 14:52:14 CST; 6min ago Main PID: 30946 (code=killed, signal=USR2) 12月 03 14:52:14 gpuhuawei systemd[1]: couchdb.service: Unit entered failed state. 12月 03 14:52:14 gpuhuawei systemd[1]: couc

Join the discussion →

Reading binary values stored in text file

I am working on project in which I have to read 5-bit binary values from a text file. I have to read each 5-bit binary number and then assign them to 5 different 1-bit registers one by one. Moreover, I can't use $readmemb because my text file is so huge (almost 2MB), and I think $readmemb can't deal with such a huge file because its not working in my case. How can I use $fopen and $fread` functions to solve my problem because I have not worked on file handling in Verilog until now? Can anyone provide an example similar to my problem?

Join the discussion →

Displaying an iframe in Dart

Is it possible to display an iframe in Dart? Below is the code that I am using void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { final wordPair = WordPair.random(); return MaterialApp( title: 'Welcome to Flutter', home: Scaffold( appBar: AppBar( title: Text('Welcome to Flutter'), ), body: Center( child: Text(wordPair.asPascalCase), // With this highlighted text. ), ), ); } } I am not sure how to add an iframe into this. Below is the snippet that is given in the documentation factory IFrameElement() => JS( 'returns:IFrameElement

Join the discussion →

Python-opencv Movement detection

Hi I have followed this tutorial with the code found here https://github.com/HackerShackOfficial/Smart-Security-Camera How do I use this on a usb camera on a windows 10 laptop? I have tried to convert this with videocapture(0) but I cant get it right someone please have a look for me! The software runs through a raspberry pi camera board and when movement is detected it screen shots she camera and emails me and the camera feed is hosted on an ip server with flask on my router.

Join the discussion →

typescript error - cannot find name 'process'

I am setting up a new project with express+ typescript and facing typescript error - cann't find name 'processs' package.json "dependencies": { "express": "^4.16.4", "nodemon": "^1.18.7", "tsc": "^1.20150623.0", "typescript": "^3.1.6" }, "devDependencies": { "@types/express": "^4.16.0", "@types/mocha": "^5.2.5", "@types/node": "^10.12.10", "eslint": "^5.9.0", "eslint-config-airbnb-base": "^13.1.0", "eslint-plugin-import": "^2.14.0", "eslint-plugin-promise": "^4.0.1", "mocha": "^5.2.0", "supertest": "^3.3.0", "typescript-eslint-parser": "^21.0.1" } I tried to follow the solution and added types

Join the discussion →

What's the "right way" to use HttpClient synchronously?

I used quote marks around "right way" because I'm already well aware that the right way to use an asynchronous API is to simply let the asynchronous behavior propagate throughout the entire call chain. That's not an option here. I'm dealing with a very large and complicated system designed specifically to do batch processing synchronously in a loop. The reason why suddenly I'm using HttpClient is because prior to now all data for the batch processing was gathered from a SQL database, and now we're adding a Web API call to the mix. Yes, we're calling a Web API in a synchronously executing loop.

Join the discussion →

How can I place slotted elements into css grid?

My HTML is like this: <div id="grid-container"> <slot name="items-to-be-filled"></slot> </div> I have formatted the above with CSS like this: #grid-container { display: grid; } However, the items that I filled into the slot seem to be out of order. I examined using developer's tool and found out that the slotted items are not being treated as grid items. Is it possible to treat slotted items just as normal children nodes? Thanks.

Join the discussion →

How to change default download folder in Chrome using PowerShell?

I am following this post - Change Chrome Settings via Powershell So far I can get the download settings using $settings.download.default_directory but not sure how to set a different value. I have tried using Set-Content and Set-ItemProperty but no luck (former is giving access denied error when trying to execute this command: Set-Content -Path $Settings.download.default_directory -Value 'C:\Users' -Force) FYI I don't want to use Windows Registry to change the settings.

Join the discussion →

Submitting Data, Error: Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message

<form action="upload_creation" method="post"> <div class="modal-footer"> <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button> <button type="submit" class="btn btn-primary">Send</button> </div> </form> this is my code for form, i want to submit a file with button public function upload_creation(Request $request){ $input = $request->all(); $creation = $this->creationRepository->create($input); foreach($request->file('direktori_gambar') as $image) { $name=time().$image->getClientOriginalName(); $image->move(public_path().'/public/img', $name); $input['pictureName']=$ima

Join the discussion →

Scroll height and document height units

When the window slides, it can detect the current height, but I don't know the unit of this height. I hope to get the total height (bottom height) using Angular. The height of the document is different from the height unit of the scroll. How do you convert between the two? Or in what way do you get the common unit? For example: import {HostListener,Inject} from "@angular/core"; import { DOCUMENT } from "@angular/platform-browser"; constructor(@Inject(DOCUMENT) private document: Document {} ngOnInit() { } @HostListener("window:scroll", [])onWindowScroll() { //.scrollTop console.log(this.documen

Join the discussion →

Getting id from element with forEach loop

I am using a foreach loop to loop through an array of a grid datasource view and don't know how to get the Id of an element from a column. The element is a div and an input and I don't know how to get the id from the input. The element.Option being returned is <div class="checkbox" style="margin:0"> <input id="428" checked="" type="checkbox" data-size="mini" data-on="Yes" data-off="No"> </div> and I am looping through the ds ds.forEach(function (element) { // How can I get the id of the input let me = document.getElementById(element.Option.id).checked; ... }); EDIT Here is exactly what each el

Join the discussion →

Using PHP's null coalescing operator on an array

I am using PHP's null coalescing operator; Null coalescing operator The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand. <?php // Fetches the value of $_GET['user'] and returns 'nobody' // if it does not exist. $username = $_GET['user'] ?? 'nobody'; // This is equivalent to: $username = isset($_GET['user']) ? $_GET['user'] : 'nobody'; // Coalescing can be chained: this will return the first // defined val

Join the discussion →

How to properly access mapped memory without undefined behavior in C++

I've been trying to figure out how to access a mapped buffer from C++17 without invoking undefined behavior. For this example, I'll use a buffer returned by Vulkan's vkMapMemory. So, according to N4659 (the final C++17 working draft), section [intro.object] (emphasis added): The constructs in a C++ program create, destroy, refer to, access, and manipulate objects. An object is created by a definition (6.1), by a new-expression (8.3.4), when implicitly changing the active member of a union (12.3), or when a temporary object is created (7.4, 15.2). These are, apparently, the only valid ways to c

Join the discussion →

Where can I find the ports of all running pm2 apps?

I have a server with PM2 installed and 10 running node apps. Every App should run with a different port number. When I install a new App on the server I need the information about the used ports. With 'pm2 list' I get much info about the apps but not the port. pm2 list App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching example_name │ 1 │ 0.0.0 │ fork │ 25651 │ online │ 0 │ 37D │ 0% │ 386.3 MB │ root │ disabled I can not find a overview of all used ports and I can't believe that this important information is not given by PM2. Does anyone have any idea

Join the discussion →

Spring nullable annotation generates unknown enum constant warning

In my app, whenever I add @Nullable (which imports from org.springframework.lang.Nullable) to any of the fields, I get a build warning: Warning:java: unknown enum constant javax.annotation.meta.When.MAYBE reason: class file for javax.annotation.meta.When not found @NonNull and other null safety annoations from spring compile without any warnings as its implementation doesn't import import javax.annotation.meta.When. The application runs just fine but the warning is just annoying. I am using spring boot 2.1.0 and java version 1.8.0_191

Join the discussion →

DAX Index and Match?

I am looking to bring a value dependant on two other columns within the same table in Power Pivot. What I did first: got the latest date for a name entered in the table. I now need to match an ID number based on the name and the date. For example: ID | Name | Date | Latest Date | ID Number 1 | John | 1/1/2018 | 1/5/2018 | 2 | Kyle | 1/15/2018 | 1/30/2018 | 3 | John | 1/5/2018 | 1/5/2018 | 4 | Kyle | 1/30/2018 | 1/30/2018 | What I need is: ID | Name | Date | Latest Date | ID Number 1 | John | 1/1/2018 | 1/5/2018 | 3 2 | Kyle | 1/15/2018 | 1/30/2018 | 4 3 | John | 1/5/2018 | 1/5/2018 | 3 4 | Kyl

Join the discussion →
Older stories