By x89 on Jul 02, 2021 04:02 am I need to run this code snippet but I get an error that PdfReadError: Could not read malformed PDF file from PyPDF2 import PdfFileWriter, PdfFileReader import requests from io import BytesIO from bs4 import BeautifulSoup from urllib.request import Request, urlopen def getResponse(url): response = requests.get(url) return response def getNumberOfPages(response): with BytesIO(response.content) as open_pdf_file: read_pdf = PdfFileReader(open_pdf_file) #if read_pdf.isEncrypted: #read_pdf.decrypt("") num_pages = read_pdf.getNumPages() return num_pages responsenew = getResponse("http://www.reichelt.de/bilder/downloads//DSGVO/DSGVO_EN_2020.pdf") print(getNumberOfPages(responsenew)) How can I fix this? I saw some other answers that talked about de-cryption but it didnt work for me. Read in browser »  By Revolucion for Monica on Jul 02, 2021 04:02 am For a project I have to install a specific version of mysqlclient==1.3.7 . However I get errors: it seems that mysql_config is missing in MSVC (Microsoft Studio Visual C++) which is required for this library: (venv) [ac@localmachine data-tools]$ python -m pip install mysqlclient==1.3.7 Collecting mysqlclient==1.3.7 Using cached mysqlclient-1.3.7.tar.gz (79 kB) ERROR: Command errored out with exit status 1: command: /home/ac/Documents/Programming/Work/data-tools/venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-dt7pv4kk cwd: /tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/ Complete output (10 lines): /bin/sh: line 1: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup.py", line 17, in <module> metadata, options = get_config() File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r") File "/tmp/pip-install-tso5g_cy/mysqlclient_4957ca0023294aaf907cc37f2312dd8c/setup_posix.py", line 26, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) OSError: mysql_config not found ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/74/ff/4e964e20b559e55d7afa60fbccc6a560f2adf289813bd3d7eb4eb8a87093/mysqlclient-1.3.7.tar.gz#sha256=c74a83b4cb2933d0e43370117eeebdfa03077ae72686d2df43d31879267f1f1b (from https://pypi.org/simple/mysqlclient/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement mysqlclient==1.3.7 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3) ERROR: No matching distribution found for mysqlclient==1.3.7
Read in browser »  By mohamadreza dehghan on Jul 02, 2021 04:02 am I had a problem installing the program ibm doors and I can not find the installation file from the ibm site. All download links are referred to the main ibm site but there is no download link. Please mention if you have a direct download link or other help Read in browser »  By Mike on Jul 02, 2021 04:01 am I cannot hit servlet-controller after I have added it programmatically to Tomcat server. I have this piece of code which works. However, I would like for my Main class to be in separate package and all of my servlets in another package and just instantiate them with new (inside Main) instead of following way: public static void main(String args) throws LifecycleException { Tomcat tomcat = new Tomcat(); tomcat.setBaseDir("temp"); tomcat.setPort(8080); String contextPath = "/"; String docBase = new File(".").getAbsolutePath(); Context context = tomcat.addContext(contextPath, docBase); HttpServlet fetchServlet = new HttpServlet() { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { PrintWriter writer = resp.getWriter(); writer.println("<html><title>Welcome</title><body>"); writer.println("<h1>Have a Great Day!</h1>"); writer.println("</body></html>"); } }; String servletName = "FetchServlet"; String urlPattern = "/fetchData"; tomcat.addServlet(contextPath, servletName, fetchServlet); context.addServletMappingDecoded(urlPattern, servletName); /* * Here we can place more servlets and mappings. */ tomcat.start(); tomcat.getServer().await(); } } I start the Tomcat with mvn exec:java -Dexec.mainClass=path.to.package.Main typing in the browser http://localhost:8080/fetchData I get response. But if I start Tomcat with following code: public static void main(String args) throws LifecycleException { Tomcat tomcat = new Tomcat(); tomcat.setBaseDir("temp"); tomcat.setPort(8080); String contextPath = "/"; String docBase = new File(".").getAbsolutePath(); Context context = tomcat.addContext(contextPath, docBase); HttpServlet fetchServlet = new FetchServlet(); String servletName = "FetchServlet"; String urlPattern = "/fetchData"; tomcat.addServlet(contextPath, servletName, fetchServlet); context.addServletMappingDecoded(urlPattern, servletName); /* * Here we can place more servlets and mappings. */ tomcat.start(); tomcat.getServer().await(); } } in that case starting Tomcat with mvn exec:java -Dexec.mainClass=path.to.package.Main and typing in the browser http://localhost:8080/fetchData or http://localhost:8080/ProjectName/fetchData or http://localhost:8080/FetchServlet/fetchData, gets me 404 or 405. I always do mvn clean install How to make second way to work? Also, every where I looked for (http://home.apache.org/~markt/presentations/2010-11-04-Embedding-Tomcat.pdf [Slide 18]; https://www.programcreek.com/java-api-examples/?class=org.apache.catalina.startup.Tomcat&method=addServlet ; also few other places ), they are instantiating servlet like in the second way. I'm making use of embedded tomcat and this is simple Eclipse project. Here is pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.company</groupId> <artifactId>assignment</artifactId> <version>0.0.1-SNAPSHOT</version> <name>AssignmentApp</name> <description>Assignment app for Internship Company</description> <properties> <tomcat.version>8.0.48</tomcat.version> </properties> <dependencies> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> <version>${tomcat.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-jasper</artifactId> <version>${tomcat.version}</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-logging-juli</artifactId> <version>${tomcat.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>appassembler-maven-plugin</artifactId> <version>2.0.0</version> <configuration> <assembleDirectory>target</assembleDirectory> <programs> <program> <mainClass>path.to.package.Main</mainClass> </program> </programs> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>assemble</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
Read in browser »  By Sam Comber on Jul 02, 2021 04:01 am I'm trying to have a class variable, root_path, persist across my code. I have an InitialiseStep class which accepts root_path, and when it is defined i.e. by InitialiseStep(root_path="/test/path/") I want CampaignData to be able to print the value for "/test/path/" when I trigger it as part of a pipeline. A reproducible example should make this clearer... class InitialiseStep(): def __init__(self, root_path=None): self.root_path = root_path def execute(self): print(self.root_path) class SparkStep(InitialiseStep): def __init__(self, spark=None): super().__init__() self.spark = spark def execute(self): print(self.root_path) class CampaignData(SparkStep): def __init__(self, spark): super().__init__() class Executor: def __init__(self, steps): self.steps = steps def run_step(self, step): step.execute() def run_pipeline(self): for step in self.steps: self.run_step(step) executor = Executor([InitialiseStep(root_path="/test/path/"), CampaignData(spark)]) executor.run_pipeline() This currently outputs /test/path/ None How can I adapt this code to print? /test/path/ /test/path/ Any suggestions would be greatly appreciated! Read in browser »  By Alatau on Jul 02, 2021 04:01 am I probably have two questions, but I think they are interrelated 1. I can't find information on the dependency of hadoop components regarding the need for a restart. For example, when I make changes to the hdfs configs, for example, I migrate namenode to new servers (HA), which components need to be restarted besides namnode/datanode/zkfc services? Zkfc, Yarn-RM/NM, Zookeeper … HBase, etc. And if you have made changes to Zookeeper? Etc. 2. Migrated Namenode/JournalNode/Zookeeper to new servers. Vanilla hadoop 3.1.3 Everything works. But after decommissioning, I noticed that there are corrupted blocks for some of these nodes. I noticed that on all three namenode:50070, the number of nodes different. I tried to make a failover switch from one namenode to another and then I get an error Call From master02.hdp /192.68.110.20 to dn02.hdp:8019 failed on connection exception: java.net.ConnectException: Connection refused; For more details see: http://wiki.apache.org/hadoop/ConnectionRefused But the thing is that dn02. hdp is the old namenode that we moved from. All services are turned off there. All three new namenodes are working and active writes the NameNode Journal Status, the plugin is pending… Why did this situation arise? Why, when I run hdfs haadmin -failover nn2 nn3 do I get such an error? Is something cached somewhere or I nust restarted zookeeper after namenode migration ? I don't know. I ask for your advice. thank you very much! Read in browser »  By cold programmmer on Jul 02, 2021 04:01 am I'm running a react native code using expo, all things work right in expo go on android but when i want to run expo on browser i get this error Uncaught TypeError: react_native_web_dist_index__WEBPACK_IMPORTED_MODULE_13__.DatePickerAndroid is undefined. How to resolve it ? Read in browser »  By TJ1 on Jul 02, 2021 04:01 am I have developed an Android app. Inside the app, I have added URLs of some Amazon associate products. I expected when the user clicks on these links, a web browser like chrome opens up on the Android phone and takes the user to the Amazon page of that product. In fact if I click on that link in a google docs it opens chrome and goes to Amazon. But on my mobile app when I click on the link I get this error: This site can't be reached http's server IP address could not be found. Try: Checking the connection ERR_NAME_NOT_RESOLVED Do I need to do anything special on my Android app? If instead of Amazon associate link I use for example www.wikipedia.org inside my Android app, when I click on the link chrome opens and goes to that page. Read in browser »  By Abdulrehman rehman on Jul 02, 2021 04:01 am I'm making property listing and showing it details on google map, but I want that when I hover on my listing then it should show marker and detail on google map of the respective property Read in browser »  By Harkirat Sran on Jul 02, 2021 04:00 am Following is the test string and we need to replace the '\xa' with '' FF 6 VRV AVENUE SUBRAMANIYAM PALAYAM PinCode:-\xa0641034' i was using the following set of lines in python to do the objective but to no use new_str = str.replace(r'\\xa', '') but the output is samereplace(r'\xa', '') 'FF 6 VRV AVENUE SUBRAMANIYAM PALAYAM PinCode:-\xa0641034' Read in browser »  By Nícolas Iensen on Jul 02, 2021 04:00 am I want to inspect the logs of an AmazonMQ broker containing information about when a message was enqueued and with which parameters. AWS provides two options to log activities from the AmazonMQ brokers to CloudWatch called general and audit, but none include the log entries for enqueued messages. The ActiveMQ official documentation specifies an option called loggingBrokerPlugin, which can be set to log everything, including events when a message gets enqueued and dequeued. Still, AmazonMQ does not support this option in its configuration. I tried to add this option, but AWS sanitizes the configuration file and removes the entry. Is there a way around this problem? Read in browser »  By Chieh YU WU on Jul 02, 2021 03:57 am How to solve the problem that the URL field affects the overall height? Please help thank you body,html { height:100% } When there is a display address bar .bg { min-height:100% background-size: cover; background-image: url(xxx.png); } [![enter image description here][1]][1] When you scroll down, the background will be blank when the address bar is hidden .bg { min-height:100% background-size: cover; background-image: url(xxx.png); } [![enter image description here][2]][2] My solution is to change it to min-height:100vh, but a piece of material will appear when sliding up, and the whole thing is not ``` smooth. .bg { min-height:100vh background-size: cover; background-image: url(xxx.png); } [![enter image description here][3]][3] [1]: https://i.stack.imgur.com/smVTm.jpg [2]: https://i.stack.imgur.com/uylkc.jpg [3]: https://i.stack.imgur.com/7azbh.jpg
Read in browser »  By BJPrim on Jul 02, 2021 03:55 am I am testing the ordinary least squares (OLS) method, however my first toy example results in an error. For example, the following code import numpy as np import statsmodels.api as sm nsample = 50 sig = 0.25 x1 = np.linspace(0, 20, nsample) X = np.column_stack((x1, np.sin(x1), (x1-5)**2)) X = sm.add_constant(X) beta = [5., 0.5, 0.5, -0.02] y_true = np.dot(X, beta) y = y_true + sig * np.random.normal(size=nsample) olsmod = sm.OLS(y, X) olsres = olsmod.fit() print(olsres.summary()) results in Process finished with exit code -1066598274 (0xC06D007E) The error appears in olsres = olsmod.fit() - anyone has an idea how I could fix this? Thanks! Read in browser »  By liam on Jul 02, 2021 03:55 am I have a dictionary in the form of a string and I need to add the string_dictionary to the list as a regular dictionary, because I need to enter the list and then the dictionary, like this: Source[0]["name"] But, the dictionary in the list is in "" and python not consider it like a dictionary. dictionary = "{'name': 'liam', 'last name': 'something'}" Source = [ dictionary, ] print(Source) Output: ["{'name': 'liam', 'last name': 'something'}"]
Read in browser »  By ardaberrun on Jul 02, 2021 03:48 am I have css and html codes as below. <div class="container"> <div class="top-content"></div> <nav> <ul> <li>Lorem</li> <li>Lorem</li> <li>Lorem</li> <li>Lorem</li> <li>Lorem</li> </ul> </nav> <main></main> </div> CSS: * { margin: 0; padding: 0; box-sizing: border-box; } ul { list-style-type: none; } .container { width: 1000px; margin: 0 auto; } .top-content { width: 100%; height: 100px; background-color: gray; } nav ul{ display: flex; justify-content: space-around; } nav ul li:hover { cursor: pointer; color: red; } main { width: 100%; height: 500px; background:green; } nav ul li:hover .top-content { background:red; } nav ul li:hover main { background:red; } What I want is for the .top-content class and main element to be colored red when I hover over the li elements. But as far as I understand, I'm having a problem with the selectors. How can I change the color of these elements using css only? Read in browser »  By iczcezar on Jul 02, 2021 03:40 am In a pre-request script I want to set a variable to use then in my request. Let's say my pre-request script looks like this: var token = "x" variables.set("token", token); And if I want to use the variable {{token}} in the request itself, I am getting error: Request failed to set 'body' — Variable 'token' was not defined Read in browser »  By YSK on Jul 02, 2021 03:30 am I'm working against an HTTP server that sometimes returns a body that is longer than the response's Content-length header. For example, curl shows me this: curl -v -k -H "Cookie: VerySecretCookie" https://fqdn/path [...] < HTTP/1.1 200 200 < Date: Thu, 01 Jul 2021 10:45:32 GMT [...] < X-Frame-Options: SAMEORIGIN < * Excess found in a non pipelined read: excess = 83, size = 2021, maxdownload = 2021, bytecount = 0 I'm trying to issue a similar request via axios and read the entire body, even beyond the Content-length. However, it seems to stop after Content-length bytes have been read. This is the config I'm using: const config: AxiosRequestConfig = { method: 'GET', responseType: 'stream', maxRedirects: 0, decompress: false, timeout: 60000, }; And I then retrieve the response via: private async streamToString(stream: Stream): Promise<string> { return new Promise((res, rej) => { let data = ''; stream.on('end', () => { res(data); }); stream.on('error', (err) => { rej(err); }); stream.on('data', (chunk) => { data += chunk; }); }); } const data = await this.streamToString(response.data); From a quick glance at axios' code, I couldn't find a place where it inspects the Content-length header, so perhaps this is done by Node's http? Is there a way to tell it to ignore Content-length and just read the entire stream until it closes (assuming HTTP keepalive is not used)? Read in browser »  By Akash Pujara on Jul 02, 2021 03:17 am I have visit_date_time column which contains datetime in strings as well unix format together, I want it to convert it into a common datetime format for further feature engineering. How can I do it so in Python? 6587980 2018-05-20 14:19:55.951 6587981 2018-05-24 15:53:26.731 6587982 2018-05-27 07:55:17.768 6587983 2018-05-25 11:28:56.526 6587984 2018-05-10 12:23:21.786 6587985 2018-05-07 10:08:08.978 6587986 2018-05-11 20:50:38.239 6587987 2018-05-21 10:21:37.663 6587988 1526139196864000000 6587989 2018-05-07 14:49:23.292 6587990 2018-05-14 21:18:43.132 6587991 2018-05-07 10:36:55.887 6587992 2018-05-09 05:42:04.907 6587993 2018-05-22 09:05:42.329 6587994 NaN 6587995 2018-05-21 07:14:03.231 6587996 2018-05-25 09:13:04.011 6587997 NaN 6587998 2018-05-20 12:09:35.347 6587999 2018-05-17 03:30:22.330 I have bold type the 3 different types in the same column. Read in browser »  By Alifa Al Farizi on Jul 02, 2021 03:16 am How to convert this arraylist to 2 Dimensional double array ArrayList mypc= new ArrayList<Double>(); mypc.add(new Item_score(887.00, 475.00, 4.00, 128.00, 186.00, 3621000.00)); mypc.add(new Item_score(887.00, 475.00, 8.00, 128.00, 189.00, 4011000.00)); mypc.add(new Item_score(1481.00, 991.00, 4.00, 128.00, 186.00, 4767000.00)); mypc.add(new Item_score(1481.00, 991.00, 8.00, 128.00, 189.00, 5157000.00)); mypc.add(new Item_score(1481.00, 991.00, 8.00, 256.00, 189.00, 5376000.00)); I have tried this but error java.lang.Object cannot be cast to java.lang.Object Object mypc_object = (Object) mypc.toArray(); double mypc_array = Arrays.copyOf(mypc_object , mypc.length,double.class); Anyone know the best practice to convert arraylist to 2 Dimensional double array like this? target output : double mypc_array = { {887, 475, 4, 128, 186, 3621000}, {887, 475, 8, 128, 189, 4011000}, {1481, 991, 4, 128, 186, 4767000}, Actually i got arraylist data from my firebase database and i need to convert it to double because i want to calculate it with my algorithm Read in browser »  By pendela neelesh on Jul 02, 2021 02:49 am I used the below codes to create a HTML page where I kept header and footer tags in body tag. The height of header is 16% and footer is 5%. Now I inserted a div tag in body and gave a height of 79%(100-16-5%) but when I ran the code the height of the div tag is zero, why is it and how to align the div tag between header and footer. Code: body{ margin: 0 0 0 0; background-color: #E6E6FA; } header{ position: absolute; background-color: red; height: 16%; width: 100%; margin-bottom: 5px; top: 0; } .logo{ position:absolute; background-color:#4CD4CB; height:100%; width: 10%; } #head_img{ width: 120px; height: 120px; display: block; margin-left: auto; margin-right: auto; } .hd_div{ position:absolute; height:40px; width: 90%; right:0; overflow: hidden; } #hd_div1{ background-color: red; top: 0; } #hd_div2{ background-color: white; top: 33.3333%; text-align: center; } #hd_div3{ background-color: red; top: 66.6666%; } .body_1{ background-color:blueviolet; height: 79% } footer{ background-color: red; position: absolute; height:5%; width: 100%; bottom: 0; } <header> <div id='hd_div1' class='hd_div'></div> <div id='hd_div2' class='hd_div'>Hello This a test text </div> <div id='hd_div3' class='hd_div'></div> <div class='logo'> <img id='head_img' src='.\search-logos.jpeg' alt='comp_logo' > </div> </header> <div class='body_1'></div> <footer> <div id='foot1'></div> </footer> Image:
Read in browser »  By aaryamann on Jul 02, 2021 01:35 am I currently have this snippet in Python - import base64 import hashlib import hmac def hash_hmac(self, key, data): res = hmac.new(base64.b64decode(key), data.encode(), hashlib.sha512).digest() return res I am trying to replicate it in Node.js, but having difficulty getting the correct hash. const crypto = require('crypto') const hashHmac = (key, message) => { return crypto.createHmac('sha512', Buffer.from(key, 'base64').toString('utf-8')) .update(message) .digest() .toString('base64') } Test case: Key: '7pgj8Dm6' Message: 'Test\0Message' With the python snippet, the hash is 69H45OZkKcmR9LOszbajUUPGkGT8IqasGPAWqW/1stGC2Mex2qhIB6aDbuoy7eGfMsaZiU8Y0lO3mQxlsWNPrw== With the js snippet, the hash is OhaJU9IibhhjIjz3R7FmodgOBUPjwhndXX8gn0r2rRzjQvCJl4T40rHXKw3o6Y2JQ5fVHTeStu8K1DRMWxMGBg== Am I going wrong with the base64 encoding? Read in browser »  By user3602859 on Jul 02, 2021 12:43 am Last week I had nothing wrong on creating a new project and serving it, but today when I use vue/cli to create a new default project, I got a compile error when serving. PS E:\Projects\testing> yarn serve yarn run v1.22.5 $ vue-cli-service serve INFO Starting development server... 98% after emitting CopyPlugin ERROR Failed to compile with 1 error 下午12:22:33 error in ./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js Module parse failed: Unexpected token (763:13) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | } | class RefImpl { > _rawValue; | _shallow; | _value; @ ./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js 1:0-233 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 2:0-216 16:4-17 40:4-17 107:13-18 108:32-37 115:16-21 1958:8-13 1962:13-23 1968:35-45 1970:16-21 1973:21-31 2071:19-25 2094:8-12 2135:8-13 2210:29-34 2557:27-30 2558:26-29 2559:28-31 2905:16-29 2912:16-29 3043:28-36 3362:41-56 3378:28-33 3463:8-15 3500:32-37 3647:27-32 3823:29-34 3951:12-25 3958:12-25 4568:17-22 4592:13-18 5173:26-32 5336:8-21 5340:8-21 5755:16-20 5761:12-16 6296:27-32 6328:12-19 6338:16-23 6356:93-100 6357:15-20 6767:60-75 6768:60-75 6769:60-75 6770:59-74 6847:16-21 6997:16-21 7150:21-28 7160:8-21 7161:134-149 7162:8-21 7210:30-39 7264:8-21 7266:8-21 7314:23-38 7334:46-55 7334:56-63 7389:14-24 7576:21-26 7586:21-31 7593:24-34 7596:21-31 7624:53-58 7630:52-57 7696:48-53 @ ./node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js @ ./node_modules/vue/dist/vue.runtime.esm-bundler.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://192.168.1.102:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js I can serve all my old projects correctly, then I try to reinstall different versions of vue/cli and nodejs, but nothing change. currently my nodejs version: v14.17.0 vue/cli: 4.5.13 What should I do? update I somehow solved this error by editting reactivity.esm-bundler.js in node_modules/@vue/runtime-core/dist/ class RefImpl { _rawValue; _shallow; _value; __v_isRef = true; constructor(_rawValue, _shallow) { this._rawValue = _rawValue; this._shallow = _shallow; this._value = _shallow ? _rawValue : convert(_rawValue); } get value() { track(toRaw(this), "get" /* GET */, 'value'); return this._value; } set value(newVal) { if (hasChanged(toRaw(newVal), this._rawValue)) { this._rawValue = newVal; this._value = this._shallow ? newVal : convert(newVal); trigger(toRaw(this), "set" /* SET */, 'value', newVal); } } } after: class RefImpl { constructor(_rawValue, _shallow = false) { this._rawValue = _rawValue; this._shallow = _shallow; this.__v_isRef = true; this._value = _shallow ? _rawValue : convert(_rawValue); } get value() { track(toRaw(this), "get" /* GET */, 'value'); return this._value; } set value(newVal) { if (hasChanged(toRaw(newVal), this._rawValue)) { this._rawValue = newVal; this._value = this._shallow ? newVal : convert(newVal); trigger(toRaw(this), "set" /* SET */, 'value', newVal); } } } I'm not sure about it, maybe this error is related to ES version? if so, where should I configure to get things right? Read in browser »  By B3CTOR on Jul 01, 2021 02:16 pm I'm developing a little game with Ursina and for some reason it doesn't show all the elements and ignores an update. The game is about clicking the randomly generated points. This is my code: from ursina import * from point import * from game import play, play_2 class Menu(Entity): def __init__(self, **kwargs): super().__init__(parent = camera.ui, ignore_paused = True) self.main_menu = Entity(parent = self, enabled = True) # More menus Text(text = 'Main Menu', parent = self.main_menu, y=0.4, x=0, origin=(0,0)) def starting(): # Game starts self.main_menu.disable() play() def update(): # The program ignores this update, so the following line isn't executed play_2() ButtonList(button_dict = { 'Start':Func(starting), 'Settings':Func(print, 'Settings was clicked') }, y = 0, parent = self.main_menu) app = Ursina(fullscreen = True) menu = Menu() app.run() from ursina import * class Point(Entity): def __init__(self, position = (0,0,0), parent = camera, **kwargs): super().__init__( parent = parent, model = 'sphere', scale = .04, position = position, collider = 'sphere' ) def input(self, key): global generate global score global missed if key == 'left mouse down' and self.hovered: score += 1 self.disable() generate = True if key == 'left mouse down' and self.hovered == False: missed += 1 generate = False score = 0 missed = 0 from ursina import * from point import Point, generate, score, missed from random import uniform score_text = Text(text = 'h') missed_text = Text(text = 'h') points = def play(): # Generates all the needed things and an init point global score_text global missed_text camera.position = (0,0,-4) camera.rotation_x = 10 board = Entity(parent = camera, model = 'quad', scale = 2, color = color.rgb(0,0,0), position = (0,0,3)) score_text.scale = 1 score_text.position = (.66,.43) missed_text.scale = 1 missed_text.position = (.66,.4) point = Point(parent = board) def play_2(): # The actual game starts global generate global score global missed global score_text global missed_text global points if generate == True: point = Point(position = (uniform(-.44,.44), uniform(-.265,.265),-.1)) points.append(point) generate = False score_text.text = f'Score: {score}' missed_text.text = f'Missed: {missed}' The output is this: In the second image you can see one of the points you need to click, however, it is supposed to appear another one in a random location, but it doesn't. Also, the score and missed clicks texts should appear, but they doesn't. All help is appreciated. Read in browser »  By Prince 2 lu on Jul 01, 2021 02:08 pm I'm trying to list all the contents of a folder (including subfolder and its files) Like ls -R with Linux (I am using windows 10) I already have this basic code with "dirent.h" #include <stdio.h> #include <dirent.h> int main() { DIR *rep ; struct dirent *file ; rep = opendir ("c:\test") ; if (rep != NULL) { while (file = readdir(rep)) printf ("%s\n", file->d_name) ; (void) closedir (rep) ; } return 0; } It lists the contents of a folder well but does not browse the sub-folders For example it could browse a whole hard drive like C: / I can't use d_type for detect if the content is a file or a folder Because with windows the struct is: struct dirent { long d_ino; /* Always zero. */ unsigned short d_reclen; /* Always zero. */ unsigned short d_namlen; /* Length of name in d_name. */ char d_name[260]; /* [FILENAME_MAX] */ /* File name. */ }; So I'm stuck on this problem, if anyone has an idea, or even a code COMPILER: MinGW32 1.5.0 Read in browser »  By Tim on Jul 01, 2021 10:58 am I am trying to solve a particular case of comparison of polygons to others. I have five polygons distributed as in the figure below. The black polygon is the one with the largest area. There may be other similar cases, the main rule is to remove the smallest polygons among all those that have one or more side portions in common. The data for this case are in a GeoJson file as follows: {"type":"FeatureCollection","features":[ {"type":"Feature","properties":{"id":1},"geometry":{"type":"Polygon","coordinates":[[3.4545135498046875,45.533288879467456],[3.4960556030273433,45.533288879467456],[3.4960556030273433,45.57055337226086],[3.4545135498046875,45.57055337226086],[3.4545135498046875,45.533288879467456]]]}}, {"type":"Feature","properties":{"id":2},"geometry":{"type":"Polygon","coordinates":[[3.4545135498046875,45.52917023833511],[3.4960556030273433,45.52917023833511],[3.4960556030273433,45.53891018749409],[3.4545135498046875,45.53891018749409],[3.4545135498046875,45.52917023833511]]]}}, {"type":"Feature","properties":{"id":3},"geometry":{"type":"Polygon","coordinates":[[3.4845542907714844,45.5298015824607],[3.5159683227539062,45.5298015824607],[3.5159683227539062,45.543388795387294],[3.4845542907714844,45.543388795387294],[3.4845542907714844,45.5298015824607]]]}}, {"type":"Feature","properties":{"id":4},"geometry":{"type":"Polygon","coordinates":[[3.465328216552734,45.542667432984864],[3.4735679626464844,45.542667432984864],[3.4735679626464844,45.5478369923404],[3.465328216552734,45.5478369923404],[3.465328216552734,45.542667432984864]]]}}, {"type":"Feature","properties":{"id":5},"geometry":{"type":"Polygon","coordinates":[[3.4545138850808144,45.56799974017372],[3.4588050842285156,45.56799974017372],[3.4588050842285156,45.57055290285386],[3.4545138850808144,45.57055290285386],[3.4545138850808144,45.56799974017372]]]}}]} Is there a solution to delete only the two blue polygons(id 2 and 5)? In python. By transforming the Polygons into LineString one could look if a Linestring is a portion of another Linestring ? But I don't see how to do it. Or maybe looking to see if the LineString of the black and blue polygons have more than two points in common ? But we can't convert a LineString into more than two points.
Read in browser »  By Rol on Jul 01, 2021 04:48 am What's the best way to atomically update a sequence in Postgres? Context: I'm bulk inserting objects with SQLAlchemy, and exectutemany can't return defaults, so I'd like to increment the primary key sequence by the amount of objects I need to insert. I know I can do: ALTER SEQUENCE seq INCREMENT BY 1000; But I'm not sure if that's safe to do in concurrent environments. Read in browser »  By Edit Axha on Jul 01, 2021 04:37 am I am using this code to upload an image on server , that i get from this link play upload def upload = Action(parse.multipartFormData) { request => request.body .file("picture") .map { picture => val dataParts = request.body.dataParts; val filename = Paths.get(picture.filename).getFileName val fileSize = picture.fileSize val contentType = picture.contentType val picturePaths = picture.ref.copyTo( Paths.get( s"/opt/docker/images/$filename" ), replace = true ) if (dataParts.get("firstPoint") == None) { val pointlocation = new Point_LocationModel( dataParts.get("step").get(0), dataParts.get("backgroundTargetName").get(0), dataParts.get("x").get(0), dataParts.get("y").get(0), dataParts.get("z").get(0), dataParts.get("rotation").get(0), dataParts.get("note").get(0), dataParts.get("tag").get(0), dataParts.get("work_session_id").get(0), (picturePaths).toString ) point_LocationRepository.create(pointlocation).map { data => Created(Json.toJson(data._2)) } } else { val jValuefirstPoint = Json.parse(dataParts.get("firstPoint").get(0)).as[PointModel] val jValuesecondPoint = Json.parse(dataParts.get("secondPoint").get(0)).as[PointModel] val pointlocation = new Point_LocationModel( dataParts.get("step").get(0), dataParts.get("backgroundTargetName").get(0), Some(jValuefirstPoint), Some(jValuesecondPoint), dataParts.get("rotation").get(0), dataParts.get("note").get(0), dataParts.get("tag").get(0), dataParts.get("work_session_id").get(0), (picturePaths).toString ) point_LocationRepository.create(pointlocation).map { data => logger.info(s"repoResponse: ${data}"); Created(Json.toJson(data._2)) } } Ok(s"picturePaths ${picturePaths}") } .getOrElse(Ok("Invalid Format")) } This code works very well, but on the response I want to get the response from the repository. Can you give me any idea how can i do it? Thanks in advance. Read in browser »  By Toranto mina on Jul 01, 2021 04:11 am I want to remove space between 0 and currency sign when the price is 0 (free product) in all the website. Magento generate this space when product is free. help me please Read in browser »  Recent Articles: |
No comments:
Post a Comment