Posts

Showing posts from June, 2021

How to reuse function attribute?

I want to do something like the following: function StatusBox() { this.connectionStatus = $("#connectionStatus"); } StatusBox.nosupport = function(type) { StatusBox.connectionStatus.html('<span style="color: red;">' + NO_SUPPORT + '</span>'); }; StatusBox.error = function(type) { StatusBox.connectionStatus.html('<span style="color: red;">' + ERROR + '</span>'); }; But I get Uncaught TypeError: Cannot read property 'html' of undefined How do I reuse $("#connectionStatus") in the child functions? from Recent Questions - Stack Overflow https://ift.tt/2UepwHr https://ift.tt/eA8V8J

Autoencoder not learning well when have deeper layers

I am building a deep CNN autoencoder on time series data. When I experiment with different layers, I found something that I can not explain: when I have more layers, i.e. the encoder bottleneck layer will have smaller dimensions of the kernel and more layers for the decoder layers (because it is symmetric), I found the test performance (MSE) is increasing, the training error increasing as well. I was thinking more layers will have better encoding capability and should decrease the error, but the results are opposite. Also, when I decrease the dimension of the bottleneck to a certain level (say adding 5 layers to the encoder), the model seems not to learn at all, the validation loss basically is the same from the very first few epoch (only change slightly at the beginning). No matter how many kernels I use, the results are the same. But if I reduce the encoder layers, and make it shallower, it learns without any problem. My structure of autoencoder is similar to this CNN autoencode...

I have a numerical question related to TD(0) algorithm. I tried to solve it in many different ways but my answers don't match

Image
Q7 here. Link to the original file is https://nptel.ac.in/content/storage2/courses/downloads_new/106106143/noc20_cs51_assigment_7.pdf from Recent Questions - Stack Overflow https://ift.tt/3xj8KG9 https://ift.tt/3h4KIst

How can I use uTLS with resty?

I'm working on an application that makes API requests to a server. Both GET and POST. The API server that I am attempting to communicate with uses TLS 1.3 and my requests are currently getting 403 error due to my lack of TLS implementation. My application currently uses the go-resty library to make requests. I would like to implement TLS 1.3 support with the uTLS library. I'm using resty due to its simplicity and uTLS because it offers parrots of browsers such as utls.HelloChrome_58 which I need to get passed the 403 error. How can I implement uTLS into resty? from Recent Questions - Stack Overflow https://ift.tt/3jsiXvu https://ift.tt/eA8V8J

SQL - Sum of wages group by other columns

Need help with the query I have a table like below (This is trimmed version, this table contains 11-12 Billion rows with 25 years worth of data. Need to sum gw based on pType as category and separated by combination of eid and cid eid cid ID pDate pFreq gw PHrs pType 637 163 2037 1/8/21 1 8.13 NULL S 637 163 2037 1/8/21 1 162.5 NULL V 228 787 2037 1/8/21 1 8.13 NULL S 228 787 2037 1/8/21 1 162.5 NULL V 637 163 2037 1/8/21 1 474.5 NULL R 228 787 2037 1/8/21 1 474.5 NULL R 637 163 2037 1/8/21 1 130 NULL H 228 787 2037 1/8/21 1 130 NULL H 637 163 2037 1/15/21 1 602.88 NULL R 228 787 2037 1/15/21 1 602.88 NULL R 637 163 2037 1/22/21 1 32.5 NULL V 228 787 2037 1/22/21 1 619.13 NULL R 637 163 2037 1/22/21 1 619.13 NULL R 228 787 2037 1/22/21 1 32.5 NULL V 228 787 2037 ...

Best way to iterate through an argument of a userfunction which is representing a data variable

Good evening, I would like to save some time in the future and automate the application of a user function in the future. The data contains different observations (rows) which consist of a grouping and multiple other variables. It looks something like this df : df <- data.frame(obs=c(1,2,3,4,5,6,7,8), group=c("a","a","b","a","b","c","a","b"), var1=c(1,1,2,1,3,1,1,2), var2=c(1,2,3,3,2,1,4,5), var3=c(5,4,3,1,2,3,2,5), var4=c(4,5,4,2,3,4,5,3)) I wrote a user function foo_1 to evaluate the occurrence of attributes in each variable with optional grouping. The function also allows to just return the result or to write it to a file. library(tidyverse) foo_1 <- function(DF,VAR,grouping=FALSE,char=c(1,2,3,4,5),save=FALSE,name=NULL){ tostring<-function (some_variable, name=deparse(substitute(some_variable))) { r...

How can I resolve various warnings during compilation of my React app?

I got these warnings in my react project: (The packages in the node_module folder are up-to-date.) How can I solve these warnings? /src/index.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/index.css) Warning (309:5) start value has mixed support, consider using flex-start instead printWarnings @ webpackHotDevClient.js:138 ./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/index.css) Warning (457:5) Gradient has outdated direction syntax. New syntax is like to left instead of right . ./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/index.css) Warning (477:5) Gradient has outdated direction syntax. New syntax is like to left instead of right . ./src/index.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-4-1!./node_modules/postcss-loader/src??postcss!./src/ind...

Refused to set unsafe header "User-Agent"

I want to change the header's User-Agent to something like {"User-Agent":"someCustomValue"} but I get this error: Refused to set unsafe header "User-Agent" How to solve this? The problem only appears in flutter-web, it's ok in android and ios. from Recent Questions - Stack Overflow https://ift.tt/3A8trWW https://ift.tt/eA8V8J

Replace line in file using re

Why is my code not working properly? I'm trying to replace one line in file using the re module: import re file = open("php.ini", "r+") pattern = r'post_max_size = [0-9]' result = re.search(pattern, file.read()) for line in file: re.sub(pattern, "post_max_size = 1G", file.read()) file.close() print(result) I have done this by using the fileimport library, but this is not the way. Why can't it run properly while pattern is printing good result and re.sub() should replace it in this place in file? from Recent Questions - Stack Overflow https://ift.tt/3hh0qja https://ift.tt/eA8V8J

Soap Web service return null value

I want to use a web service for my project and I'm sure web service work properly(I tested in Boomerang - SOAP & REST Client). Web service link is https://api.n11.com/ws/ProductService.wsdl . But when I try get datas from service, service returns null, empty or 0 values. I think VS add web service reference doesn't work correctly, But couldn't find where the problem is. static async Task<String> GetProductAsyncN11() { ServicePointManager.Expect100Continue = true; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var port = new N11ProductServiceReference.ProductServicePortClient(); var requ = new GetProductListRequest(); requ.auth = new N11ProductServiceReference.Authentication(); requ.auth.appKey = "*****"; requ.auth.appSecret = "*****"; requ.pagingData = new N11ProductServiceReference.RequestPagingData(); requ.pagingData.pageSize = 100; ...

I need to make a dictionary from a list of lists

I have this: A = [[0, 3, 6, 11], [0, 5, 7, 11], [0, 1, 2, 4, 8, 9, 10, 11]] I want to make a diccionary from A like this: dic_A = { 0: [0, 3, 6, 11], 1: [0, 5, 7, 11], 2: [0, 1, 2, 4, 8, 9, 10, 11]} I have tried different ways and I can only use a for in range to solve the problem I think this can be reduced to a line somehow but I can't find the way I tried this: dic_A = {} for i in range(3): dict_A[i] = A[i] from Recent Questions - Stack Overflow https://ift.tt/3drMOjT https://ift.tt/eA8V8J

Start Django development server on AWS EC2 Amazon Linux

This tutorial here shows how to start the development server on AWS EC2: ALLOWED_HOSTS=['EC2_DNS_NAME'] ... python manage.py runserver 0.0.0.0:8000 In a browser, navigate to public DNS of the instance, make sure to append port “8000” at the end and if everything was properly configured, it will show the index page of the application. For example: www.ec2dnsname.com:8000 My public IPv4 DNS is of this form: ec2-xx-xxx-xx-xxx.region.compute.amazonaws.com So, in my settings.py ALLOWED_HOSTS=['ec2-xx-xxx-xx-xxx.region.compute.amazonaws.com'] And run this in the EC2 terminal: python manage.py runserver 0.0.0.0:8000 However, when I try to reach this address: www.ec2-xx-xxx-xx-xxx.region.compute.amazonaws.com:8000 nothing is showing up ( The page took too long to respond ). Is this the complete and correct way to just try run a development server on AWS EC2? from Recent Questions - Stack Overflow https://ift.tt/3qBsLos https://ift.tt/eA8V8J

Union vs Inheritance in python implementation

Let's say we have this class. class MyConfig(): config_type : SomeEnum retries: int context: Context This Context depends on the value of type meaning the context is dependent on its value. Which implementation of Context is best? why one is better than the other. class MySpecificContext: value: int name: str class OtherUnrelatedContext: length:int position: int Contex = Union[MySpecificContex,OtherUnrelatedContext] or class Context: pass class MySpecificContext(Context): value: int name: str class OtherUnrelatedContext(Context): length:int position: int To be more specific. Let say you have a configuration class, this configuration will hold data that will be used to configure a process. This process will contain a few things that relate to all configurations, like retries value. However, it is expected that based on config_type there is an additional context that is required. This is highly related to the particular configuratio...

Selecting the ID from the 3th table

I will explain what I have in the first section and then what I want to get. I have those 3 tables: first: users protected $fillable = [ 'name', 'email', 'password', ]; the pivot table: user_to_role protected $fillable = [ 'id', 'user_id', 'role_id' ]; and the third one: roles protected $fillable = [ 'id', 'role_name', ]; role_name is admin and client When I login/register I want to show the view for the specific role of the user but I don't really know how to do that in the controller, I have something like this but I know it's not good public function index() { if (Auth::user()->role_id==1) { // and something here which I don't know return view('homeadmin'); } } I know I have to take the role id from the 3th table, make the connection with the pivot and then with the user but I don't really know how. from Recent Questions - Stack Overflow https...

mmap virtual memory (HDD) and main memory (RAM) allocation

I'm working with mmap() function. I Confiused about something in mmap flags. MAP_SHARED with fd → Usage To allocated virtual memory which uses Hard Drive (HDD) and physical memory (RAM) will not be used. I allocated 2 GB using this flag with fd and my RAM remained unused (what I expected). MAP_PRIVATE|MAP_ANONYMOUS with (fd = -1) → Usage To allocated main memory, which is RAM. I allocated 2 GB using this flag and I filled it with something then I checked my RAM usage and yes, 2 GB in use ... Now my point, first method ( MAP_SHARED ) uses virtual memory (HDD) and second method ( MAP_PRIVATE|MAP_ANONYMOUS ) uses main memory (RAM) so 100% the second method MUST be different in performance since RAM is too much faster than HDD ... am I right ? If I'm right, so why mmap function is called as a ' virtual memory allocation ' function !!!??? By flag MAP_PRIVATE|MAP_ANONYMOUS allocates main memory (RAM) too !!!!!!! If MAP_PRIVATE|MAP_ANONYMOUS does not guarantee to...

What's the proper syntax for calling a function with a string parameter in an HTML attribute?

I have a few buttons generated in this Javascript method, and one of them has onclick() handler where I need to pass a string as an input parameter. function ShowButtons() { let $previewDiv = $("#ServicesPreview"); $previewDiv.html("<button id='myBtn' onclick='CheckID('MYID')'></button>") } I can't enclose the string in single quotes because it produces this on the website, and I get the error "Unexpected end of input": <button id="myBtn" onclick="CheckID(" MYID')'></button> I've also tried no quotes, and I can't use double-quotes because that terminates the string being passed into the jQuery.html method. What's the proper syntax here? from Recent Questions - Stack Overflow https://ift.tt/3A9jCbl https://ift.tt/eA8V8J

Programming a feature on YouTube for class project

Image
I'm currently enrolled at Flatiron School in New York in the data science bootcamp, which goes from June to September. Bootcamp culminates in a large capstone project of our choosing. I am an avid YouTube user and I like to think the AI that chooses songs based on past choices 'gets me'. I noticed a feature I wish existed and thought it might make a good final project for class. I'm deep into a My Mix on my phone and I'm jamming out big time, when I suddenly think of a song I've gotta hear. I go to search for A Whole New World from Aladdin, find the perfect version, and select the video. Now My Mix that I was so far into, working and refining has been abandoned after listening to the hit classic from Aladdin. I have to start again at the beginning. My proposed feature is: While listening to a My Mix a person can swipe down and search for a song they'd love to hear. They tap and hold on the version they want and the option screen appears with a new prompt a...

Minimum time to reach from city 1 to city N

There are a lot of graph problems that require some modification of the BFS algorithm. I just come across this problem. I thought of this question with just an extension of the standard BFS algorithm. The question states that: We are given a country, having N cities and M bidirectional roads. Each city has a traffic light, showing only 2 colors i.e Green and Red. All the traffic lights switch their color from Green to Red or vice versa after every T seconds. We can cross a city only when the traffic light is green. Initially, all traffic light is green. In any city, if the traffic light is Red then we have to wait for its light to turn green. Time taken to travel any road is C. We have to find minimum time to reach City N from 1. Note: graph doesn't contain a self-loop or multiple edges. For example: N=5,M=5,T=3,C=5 Edges are: 1 2, 1 3, 2 4, 1 4, 2 5. Here minimum time to go from 1 to 5 is 11 through path 1 2 5.WE can reach city 2 in 5 secs. then wait for 1 second for th...

Add/remove users to/from AAD group in batches

What is the code to add users to AAD group or remove users from AAD group in batches in C#? (first find batch size and then add or remove users). Any sample code would be great. UPDATE: I added the following code: private HttpRequestMessage MakeRequest(AzureADUser user, Guid targetGroup) { return new HttpRequestMessage(HttpMethod.Patch, $"https://graph.microsoft.com/v1.0/groups/{targetGroup}") { Content = new StringContent(MakeAddRequestBody(user), System.Text.Encoding.UTF8, "application/json"), }; } private static string MakeAddRequestBody(AzureADUser user) { JObject body = new JObject { ["members@odata.bind"] = JArray.FromObject($"https://graph.microsoft.com/v1.0/users/{user.ObjectId}") }; return body.ToString(Newtonsoft.Json.Formatting.None); } public async Task AddUser...

Is it Possible in python, to Pass Variables Within a List, by Reference, in an Argument? [duplicate]

I am trying to create a Neural Network class made up of Neuron objects wired together. My Neuron class has Dendrites The number of dendrites is specified in the parameters when the class is initialised. The Dendrites are stored in a list whose index stores the voltages of each Dendrite. eg: neuron1.dendrites[2]=0.12 volts. Activation (Threshold) Potential The sum of all the dendrite potentials provides the neuron potential. If this potential exceeds the Threshold Potential, my Neuron will fire. There are other neurons connected to the axon of my neuron. The Axon of my Neuron connects to the Dendrites of other Neuron objects. Several Dendrites from other Neurons may connect to the Axon of my Neuron. They will all receive a fixed voltage (outputVoltage) when my Neuron fires. It fires in an All-or-Nothing manner. Firing state When the the Activation Potential is reached, the firing state = on (True) My Neuron class also has a setConnections() method. This method receives a pyth...

Writing single SQL query satisfying two cases

After the comments received, I am rephrasing this question with required data. Reference: SQL query to exclude some records from the output Vertica analytical functions: https://www.vertica.com/blog/analytic-queries-vertica/ Table 1: create table etl_group_membership ( group_item_id int not null, member_item_id int not null ); INSERT INTO etl_group_membership (group_item_id, member_item_id) VALUES (335640, 117722); INSERT INTO etl_group_membership (group_item_id, member_item_id) VALUES (335640, 104151); INSERT INTO etl_group_membership (group_item_id, member_item_id) VALUES (335640, 5316); Table 2: create table v_poll_item ( device_item_id int not null, item_id int not null ); INSERT INTO v_poll_item (device_item_id, item_id) VALUES (117722, 273215); INSERT INTO v_poll_item (device_item_id, item_id) VALUES (117722, 117936); INSERT INTO v_poll_item (device_item_id, item_id) VALUES (117722, 117873); INSERT INTO v_poll_item (device_item_id, item_id) VALUES (11...

Typescript index error: looping through keys of typed object

I have an interface that's created as an extension of a couple of other interfaces from an external library: interface LabeledProps extends TextProps, ComponentProps { id: string; count: number; ... } In another place in the code, I have an object of type LabeledProps and I would like to loop through all its properties: function myFunc(props: LabeledProps):void { for (let key in props) { const val = props[key]; // <-- ERROR IS HERE // do other stuff } } The line const val = props[key] throws a typescript error (though the compiled code actually runs just fine): Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'LabeledProps'. What is the right way (or ways) to accomplish this? Thanks! ( Note : I know I could add [key: string]: any to the interface definition and that will remove the error message, but I would like an actual fix, not just a hiding-the-erro...

Xamarin.iOS app crashing with error DYLD Library not loaded, mapped file has no cdhash, Code has to be at least ad-hoc signed

I am using Windows VS 2019 paired to my Mac. My Xamarin.iOS app has started crashing with this error in the Xcode device logs: DYLD Library not loaded mapped file has no cdhash, Code has to be at least ad-hoc signed. Visual Studio reports that the app deployed successfully on the iPhone and it starts to open then crashes. This only happens when deploying the app in debug mode. I can deploy in release mode to my iPhone and app store connect and the app runs fine. But I need to be able to debug. Also, after the app crashes on the phone Visual Studio is still running in debug. But when I stop it a dialog box error pops up that says "The debugger was unable to terminate one or more processes: Mono: The debugger is still attaching to the process or the process is not currently executing the type of code selected for debugging." I contacted Apple developer technical support but they say they can't help because I'm using 3rd party tools (Visual Studio). This is all they w...

Combining multiple rows into one based on timestamps with varying number of rows

I am using a barcode scanner to input data for production runs and downtime. The idea is to scan the job number in, start the job, and scan the job number out when finished. Within some of the jobs there may be downtime such as equipment malfunction or a scheduled break. These will also have barcodes for the operator to scan. I want there to be a single row where the part number is scanned in, any downtime codes scanned before the end of the current job are captured in the row as well, and the scan out completes the entire process and drops to the next row to await the start of the next job. So far I am able to scan the barcode to show the job number or downtime code and the time it is scanned. Scan code is shown in column A, Time is shown in Column B. from Recent Questions - Stack Overflow https://ift.tt/3xXmlm4 https://ift.tt/eA8V8J

SQL Server Alert System: 'Severity 023' and 'Severity 020' with Transactional Replication

This is not so much a question just a post about the resolution I came to since and I was unable to find anything online about it. I had a SQL Server host failure, had to migrate to a new host and bring over the SQL Server VM from backups. Once the SQL Server was back online, I restored each database from a backup drive that was still working properly. Shortly after it was all brought back online, I started receiving the errors below: SQL Server Alert System: 'Severity 023' DESCRIPTION: "An error occurred while processing the log for database 'DBName'. If possible, restore from backup. If a backup is not available, it might be necessary to rebuild the log." SQL Server Alert System: 'Severity 020' DESCRIPTION: A system assertion check has failed. Check the SQL Server error log for details. Typically, an assertion failure is caused by a software bug or data corruption. To check for database corruption, consider running DBCC CHECKDB. If you agreed to s...

Connection refused by iOS when using UnityWebRequest

It works fine in the Unity Editor but in iOS the app gives errors in the logs by saying what I post below. It can't find the file. I have a Json file in StreamingAssets in Unity and then it is copied to persistentDataPath . In Xcode for the info.plist I added "App Transport Security Settings" & "Allows Arbitrary Loads" and "Allow Local Networking". If not it blocks the connection. This is the error I get in Xcode. 2021-06-28 11:50:47.655068-0400 Jumper[39664:10886549] [connection] nw_socket_handle_socket_event [C2.1:2] Socket SO_ERROR [61: Connection refused] 2021-06-28 11:50:47.664973-0400 Jumper[39664:10886549] [connection] nw_socket_handle_socket_event [C2.2:2] Socket SO_ERROR [61: Connection refused] 2021-06-28 11:50:47.665697-0400 Jumper[39664:10886549] Connection 2: received failure notification 2021-06-28 11:50:47.665793-0400 Jumper[39664:10886549] Connection 2: failed to connect 1:61, reason -1 2021-06-28 11:50:47.666259-0400 Jumper[3...

change opacity and animated that with react js

i started a simple project with react.in my project i have a paragraph and when mouse hover on paragraph (mouse enter event) a square appears under the paragraph and when hover out from paragraph(mouse leave event) that square disapear.but this occure so fast so i want changing this smoothly and i want use opacity and change that from 0 to 1 and reverse when my events occure.but I do not know what to do to change the opacity with animation in react. this is my appjs import './index.css'; import React, {useState} from "react"; function App() { const [isShowSquare, setIsShowSquare] = useState(false); const showSquare = () => { setIsShowSquare(true); } const hideSquare = () => { setIsShowSquare(false); } return ( <div> <p onMouseEnter={showSquare} onMouseLeave={hideSquare} style=>Hover Me</p> {isShowSquare ? <div className='square'> ...

Typescript union types working like intersection types

I am having trouble distinguishing the difference between union and intersection types in TS even tho the difference should be very clear. Take this example: type CustomType1 = { customProp1: number; }; type CustomType2 = { customProp2: number; }; type UnionType = CustomType1 | CustomType2; const e1: UnionType = { customProp1: 4, customProp2: 5, }; Note on how I created a union type which in theory should make a object that can only have one or the other type. This is not the case because the compiler nor my ide display any errors even tho the object I define has both of the properties from the two types which should be possible only after you merge the two types with the intersection & symbol. Is this the case? from Recent Questions - Stack Overflow https://ift.tt/3A5qMgB https://ift.tt/eA8V8J

pip broken, can't use most of pip commands (on windows)

So I was working with python, coding and installing packages, everything was going ok, but then everything with pip stoped working, and every times the cmd prompt me : Traceback (most recent call last): File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Python39\Scripts\pip.exe\__main__.py", line 7, in <module> File "c:\python39\lib\site-packages\pip\_internal\cli\main.py", line 69, in main command = create_command(cmd_name, isolated=("--isolated" in cmd_args)) File "c:\python39\lib\site-packages\pip\_internal\commands\__init__.py", line 91, in create_command module = importlib.import_module(module_path) File "c:\python39\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ...

React Rollup build with styled-components namespace issue

I created an "UI Lib" to use in other projects with ReactJS + TS + styled-components and Rollup and I'm facing some problems with conflicted classNames. I know that styled-components provides a plugin to create namespace to classNames hashes, but its not working as they should. If I run Storybook in my project, the namespace works, but when I build this UI and use in other projects, don't. Its the first time I use Rollup, so I don't know if I'm missing something here. My files: Package.json "name": "@team/ds-react-ui-lib", "version": "0.1.11", "description": "React UI library of B2W Design System", "repository": "git@gitlab.internal.b2w.io:team/fluxo/websupply/ds-react-ui-lib.git", "author": "Lucas Cardoso<lucas.casantos@b2wdigital.com>, Felipe Jardim<felipe.evangelista@b2wdigital.com>", "license": "MIT", "mai...

How can I have check constraint in django which check two fields of related models?

from django.db import models from djago.db.models import F, Q class(models.Model): order_date = models.DateField() class OrderLine(models.Model): order = models.ForeignKeyField(Order) loading_date = models.DateField() class Meta: constraints = [ models.CheckConstraint(check=Q(loading_date__gte=F("order__order_date")), name="disallow_backdated_loading") I want to make sure always orderline loading_date is higher than orderdate from Recent Questions - Stack Overflow https://ift.tt/3A72VNv https://ift.tt/eA8V8J

Selenium Colab of Google

I got this in Colab. I did the installation: # !pip install selenium # !apt-get update # to update ubuntu to correctly run apt install # !apt install chromium-chromedriver # !cp /usr/lib/chromium-browser/chromedriver /usr/bin import sys sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') from selenium import webdriver chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--headless') chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') wd = webdriver.Chrome('chromedriver',chrome_options=chrome_options) wd.get("https://ca.yahoo.com") And I got the error below : /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:12: DeprecationWarning: use options instead of chrome_options if sys.path[0] == '': So I changed the code by removing the chrome from chrome_options : # !pip install selenium # !apt-get update # to update ubuntu to correctly run apt i...

Android build RP1A.200720.012 T500XXU3BUF2 has wedged @UIThreadTest

Our Samsung Galaxy Tab7 worked for many months. It ran tests from the Android-Studio editor, and from the adb command line. Then right around June 2 it requested a software update, and I absentmindedly acknowledged the button. After it updated, Espresso tests worked, but tests using @UIThreadTest end prematurely with 'Tests Cancelled\n0 passed.' So we got a new Samsung Galaxy Tab7, and I configured it for development, and it mostly worked correctly. This time, the adb fails on random assertions, while when the editor invokes the same tests, they pass. Then I allowed the tablet to update to the latest build, and the @UIThreadTest problem came back. I will now introduce a third tablet, this time NOT allow it to update, and get back to work. I am aware that real programmers don't write automated tests, but how do I appeal to Android? The AndroidStudio button "Submit Feedback" is apparently for bugs in AndroidStudio, not Android. from Recent Questions - Stack...

Oracle APEX: IG error: Uncaught TypeError: Cannot read property 'outerHeight' of null

I have an interactive grid on my page and I need to programmatically change the report from default to a named report. I am using the following javascript code to get report ID by report name and then change the report on my grid: try { v_array.forEach(function(element) { if (element.name == v_report_name) { v_value = element.id; throw BreakException; } }); } catch (e) { if (e !== BreakException) throw e; } apex.region("MY_IG").call("getActions").set("change-report", v_value); The report gets changed yet there is an error on the page: Uncaught TypeError: Cannot read property 'outerHeight' of null If I comment out this line, error disappears: apex.region("MY_IG").call("getActions").set("change-report", v_value); Can't figure out what is going on. This started happening right after the upgrade from Recent Questions - Stack Overflow https://ift.tt...

Python & Time Series Cleaning - Removing regions/chunks of huge timeseries that contain no useful data

Data: 20 hrs of triaxial accelerometer data. Sampled at 10khz. 3 Billion Points. 40 Gb of CSV spread across 20 files to reduce memory needed to inspect a given chunk of data. Accelerometer Example Problem: There are large regions of low/no-activity that I don't care about which make up the greater majority of the data points. There is no reason these regions need to be preserved. This slows down all the processing. Plotting is just the beginning, I need to do signals processing and complex transformations on the data which is very computationally intensive. Also these files are unreasonably large and I will be doing this sort of testing many times. Data is being stored in a four-column Dask dataframe to be plotted using holoviews with a matplotlib extension (and perhaps an interactive Bokeh dashboard once data size can be reduced). I want to reduce the amount of data without destroying regions of interest. The easiest way to do this is to remove extended periods of random noise ...

Why do the inline-blocks jump to a new line? Is it to do with previous margins?

Image
div { width: calc(100vh/6); height: calc(100vh/6); background: #fdc57b; display: inline-block; } body { background: #62374e; } #a { margin-left: calc(14vh); margin-top: calc(100vh/7.2); } #b { margin-left: calc(49vw); } #c { margin-left: calc(14vh); margin-top: calc(161vh/5); } #d { background: #00FF22; margin-left: 79.3vh; /*This value*/ } <div id="a"></div> <div id="b"></div> <div id="c"></div> <div id="d"></div> I have just started learning CSS and was playing around. On CSS battle challenge 1, part 2: Carrom, I noticed something odd: when I change 'This Value' to 79.3 the <div> moves unexpectedly from to Why is this? Why doesn't it move off the right edge of the body: there are no div blocks after that define its position? from Recent Questions - Stack Overflow https://ift.tt/3juOyg2 https://ift.tt/3y5y4iu

Snowflake SQL How to get only values from the last full week

I'm trying to build a query that would get me only the results with a created date from the last full week. So, for example, if today is Monday 2021-06-28, I only want the results from Monday 2021-06-21 to Sunday 2021-06-27. I tried with this, but this is the last 7 days, without considering week end or start. WHERE (CREATED_AT::DATE BETWEEN (CURRENT_DATE::DATE - INTERVAL '1 WEEK') AND CURRENT_DATE::DATE) I also tried working with this function: last_day(CREATED_AT::DATE, 'week') as "LAST_DAY_OF_WEEK" and then trying to substract 7 days, but I think my use of these functions is incorrect. from Recent Questions - Stack Overflow https://ift.tt/3x2dnEk https://ift.tt/eA8V8J

'service' is not recognized as an internal or external command, operable program or batch file

I have installed XAMPP 7.4 and defined mysql as Environment Variable on my system, and then tried to run service mysqld restart on CMD but I got this: F:\xampp\mysql\bin>service mysqld restart 'service' is not recognized as an internal or external command, operable program or batch file. So what is going wrong here? How can I run this command properly? I would really appreciate any idea or suggestion from you guys... Thanks in advance. from Recent Questions - Stack Overflow https://ift.tt/3A5qPZP https://ift.tt/eA8V8J

Keyboard input with timeout in while-loop [duplicate]

Code: answer = None def check(): time.sleep(2) if answer != None: return print("Too Slow") while True: current_kw = 0 money = 100000 #100.000 profit= current_kw * 300 money += profit Thread(target = check).start() x = input('x: \n') ... What I would like to achieve and what doesn't work: Skip only works once instead of always What I've tried: See Code and Python 3 Timed Input from Recent Questions - Stack Overflow https://ift.tt/3jo4voC https://ift.tt/eA8V8J

assembly language program to enter and sort numbers [closed]

i'm writing assembly language program that allows a user to enter 6 numbers in any order then display the largest and smallest entered number, and the order from small to large and then large to small. I've included the initial code I wrote START: mov ax,data mov ds,ax mov BX,LEN-1 MOV CX,BX UP1: MOV BX,CX LEA SI,X UP: MOV AX,[SI] MOV DX,[SI+2] CMP AX,DX JB DOWN/JA DOWN MOV [SI],DX MOV [SI+2],AX DOWN: INC SI INC SI DEC BX JNZ UP DEC CX JNZ UP1 MOV AH,4CH INT 21H CODE ENDS END START from Recent Questions - Stack Overflow https://ift.tt/3hd4P6I https://ift.tt/eA8V8J

How can I make a LEFT JOIN, but with rows separed from its relations in MySQL?

I need to get all rows that are in the table A , but joining with the table B (basically a LEFT JOIN ), but also, I need to get the A table row itself, for example, with these tables: Table A: id name 1 Random name 2 Random name #2 Table B: id parent_id location 1 2 Location #1 2 2 Location #2 With this query: SELECT * FROM A LEFT JOIN B ON A.id = B.parent_id; I get something like this: id name id parent_id location 1 Random name NULL NULL NULL 2 Random name #2 1 2 Location #1 2 Random name #2 2 2 Location #2 But I want to get something like this: id name id parent_id location 1 Random name NULL NULL NULL 2 Random name #2 NULL NULL NULL 2 Random name #2 1 2 Location #1 2 Random name #2 2 2 Location #2 As you can see, there is a row by itself of "Random name #2" separated from its joins, how can I do that? The main idea is that there are an ads t...

How can we store every Object passed through a on-click event in an array after each time the button is clicked?

I am trying to Pass a button in a map function, And then trying to Obtain all the values in an array which I get after every on-click event function. The map function looks like this {Data.map((d, i) => { return ( <div key={i} > <table> <tr> <td className="date">{d.Date}</td> <td className="time">{d.Time}</td> <td className="availability" >{d.Availabilty}</td> <td><button value={JSON.stringify(d)} onClick={(e)=>{ decNum(e); }}>Book Now</button></td> </tr> </table> </div> ) })} The onclick function goes like this const decNum=(e)=>{ var i =0 cartData[i] = e.target.value i = i+1 console.log(cartData) console.log( e.target.value) } I am getting the value for the particular button that i am clicking on and nothing else. And I want to get all the previous data That I have clicked...

Terraform Azure App Service Plan Error - The parameter SKU.Name has an invalid value

Module declaration resource "azurerm_app_service_plan" "appserviceplan" { name = var.name location = var.location resource_group_name = var.resource_group_name kind = var.kind reserved = var.reserved is_xenon = var.is_xenon sku { # name = var.sku_name tier = var.sku_tier size = var.sku_tier } } Calling the above module like so (in main.tf ) ... module "appserviceplan1" { source = "../modules/app_service_plan" name = "${var.project_name}-${var.environment}-appserviceplan" location = var.location resource_group_name = var.resource_group_name kind = var.asp_kind reserved = var.asp_reserved is_xenon = var.asp_is_xenon # sku_name = var.asp_sku_name sku_tier = var.asp_sku_tier sku_size = var.asp_sku_tier } Input variable assignment (in main.auto.tfvars ):...

How do I create a closure that takes either u32 or &str and returns u32 or usize respectively?

This is from chapter 13.1 of the Rust book, where we use closures, memoization and generic types. In this example I can already pass two different closures to the struct ( Cacher ) and get the values accordingly, but they have two be two different instances of the struct in order to handle the types correctly. Can I build a generic type so the same instance of the struct can handle receiving either type and give me the value accordingly? Either the same u32 I passed, or the length of the &str I passed. use std::collections::HashMap; use std::thread; use std::time::Duration; fn main() { let simulated_user_specified_value = 10; let simulated_random_number = 7; generate_workout(simulated_user_specified_value, simulated_random_number); } fn generate_workout(intensity: u32, random_number: u32) { let mut expensive_result = Cacher::new(|num| { println!("calculating slowly..."); thread::sleep(Duration::from_secs(2)); num }); ...

Generating multilevel associative array using php loop

Trying to generate array for json output from a nested php loop, any suggestions on how to accomplish this? Here is the current code am I using $v_id=0; $x=0; $item[] = array(); foreach ($abc as $vm) { foreach ($vm->activity as $record) { $item['instruction'] = $record->step; $item['id'] = $x; $id++; } $v_id++; } However each loop of the main loop statement is overrating the previous entries This is the desired output steps": [ { "v_id": 0, "instruction_steps": [ { "id": 0, "instruction": "<p>Select something </p>", { "id": 1, "instruction": "<p>Do something</p>", } ...

Why won't my template update with it being bound to a computed property?

I am facing an issue where I have some template HTML in a component that relies on the computed getter of a Vuex method. As you can see in the template, I am simply trying to show the output of the computed property in a <p> tag with . As I update the state with the UPDATE_EXERCISE_SETS mutation, I can see in the Vue devtools that the state is updated correctly, but the change is not reflected in the <p> </p> portion. Template HTML: <template> ... <v-text-field v-model="getNumSets" placeholder="S" type="number" outlined dense ></v-text-field> <p></p> ... </template> Component Logic: <script> ... computed: { getNumSets: { get() { var numSets = this.$store.getters['designer/getNumSetsForExercise']({id: this.id, parent: this.parent}) return numSets }, set(value) { // This correctly updates the state as seen in the Vue DevTools ...

org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node: main ()V:

i am learning kotlin. in the following code if give double value to ANOTHER_CONSTANT then i get this error. for other types it works just fine. what could be the reason. const val ANOTHER_CONSTANT = 833.1 // not compiling // const val ANOTHER_CONSTANT = 833.1f // float works, and other types also work fun main() { println("ANOTHER_CONSTANT ${ANOTHER_CONSTANT} :: ${ANOTHER_CONSTANT::class}") } error: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't transform method node: main ()V: L0 LINENUMBER 7 L0 NOP GETSTATIC java/lang/Double.TYPE : Ljava/lang/Class; INVOKESTATIC kotlin/jvm/internal/Reflection.getOrCreateKotlinClass (Ljava/lang/Class;)Lkotlin/reflect/KClass; INVOKESTATIC kotlin/jvm/internal/Intrinsics.stringPlus (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String; ASTORE 0 NOP L1 ICONST_0 ISTORE 1 L2 GETSTATIC java/lang/System.out : Ljava/io/PrintStream; ALOAD ...