on-internet

PHP: Null coalescing operator

I am trying to understand how the null coalescing operator really does work. So, I tested many examples after reading the documentation in php.net and some posts on Stack Overflow. However, I can't understand this code: <?php $x = false ?? 'stackoverflow'; var_dump($x); // bool(false) since it's equivalent to (from Null coalescing operator) isset(false) ? false : 'stackoverflow'; and since isset(false) generates a fatal error. What is the explanation?

Join the discussion →

How to automatically check if there is any possible exceptions in Python?

I'm refactoring a non-trivial python project, there could be many exceptions to be thrown. sometimes it's hard to catch all of them if you don't just try...except the whole program. In order to achieve a fine-grained exception handling, I want to systematically get a list(preferably a graph) of all possible exceptions( and their types) that could be thrown in different location of execution flow. Is such a thing even[sic] possible?

Join the discussion →

Flight search engine for weekend flights

I'm looking for a flight search engine that lets me search for a flight from a specific origin to a specific destination. I don't care on which weekend the flights take place, but I want to find the cheapest flight in the next 2 months that leaves one a Friday afternoon evening and returns at Sunday night or Monday morning. I couldn't find such a flight search engine. Is there anything like that?

Join the discussion →

date format issuse in vue2-datepicker

I am using "vue2-datepicker" plugin in my vuejs2 project. "yyyy MM dd" is the default format in that datpicker but I want the change format like "dd MMM yyyy"(16-May-2016). I have changed the format in my script but it's not reflecting in the UI. It shows "16-05-2018" as the output. <template> <b-card> <div> <date-picker v-model="dob" :lang="lang" :format="format"></date-picker> </div> </b-card> </template> <script> import DatePicker from 'vue2-datepicker' eexport default { name: 'addEmpl', components: { DatePicker }, data () { return { dob: '', lang:{ default : 'en' }, format: 'dd-MMM-yyyy' }

Join the discussion →

Controlling Stepper Motor + Raspberry Pi Zero + L293D IC

My friend is trying to program a Raspberry Pi Zero to control a stepper motor using Python 3. She followed these tutorials. Looks like she used the parts and wiring from #1 and the code from #2: https://raspi-tutorials.com/how-to-control-a-stepper-motor-with-raspberry-pi-and-l293d-uln2003a/ https://www.raspberrypi.org/forums/viewtopic.php?f=49&t=55580 This is her actual setup: https://photos.app.goo.gl/WJbCo4UU3wAdo8913 She mentioned she is not using a resistor between the power source and the L293D Driver IC. Parts Used: Raspberry Pi Zero (Pi 2 or 3 was recommended, but the Zero has the same

Join the discussion →

Programming in Python: Controlling Stepper Motor + Raspberry Pi Zero + L293D IC

(Warning! I am not educated on this topic) Hey folks. I'm posting here because I have a friend who desperately needs help with her project. I'm familiar with scripting, but not too much with programming. I do work in IT, so I'll do my best to provide the necessary information. She's trying to program a Raspberry Pi Zero to control a stepper motor using Python 3. Simple as that. She followed these tutorials. Looks like she used the parts and wiring from #1 and the code from #2: https://raspi-tutorials.com/how-to-control-a-stepper-motor-with-raspberry-pi-and-l293d-uln2003a/ https://www.raspberry

Join the discussion →

How does numpy.linalg.eigh compare to numpy.linalg.svd?

Problem description For a square matrix, one can obtain the SVD: X = USV' decomposition, by using simply the numpy.linalg.svd: u,s,vh = numpy.linalg.svd(X) routine or numpy.linalg.eigh, to compute the eigenvalue decomposition on the Hermitian matrix X'X and XX'. Are they using the same algorithm? Are they calling the same Lapack routine? Is there any difference in terms of speed? And stability?

Join the discussion →

how does numpy.linalg.eigh vs numpy.linalg.svd?

problem description For a square matrix, one can obtain the SVD X= USV' decomposition, by using simply numpy.linalg.svd u,s,vh = numpy.linalg.svd(X) routine or numpy.linalg.eigh, to compute the eig decomposition on Hermitian matrix X'X and XX' Are they using the same algorithm? Calling the same Lapack routine? Is there any difference in terms of speed? and stability?

Join the discussion →

Clarification re principal component analysis

I do understand the principal component analysis (PCA). I know how to do it and what it actually does. I have applied PCA and my best result has shown to be two components. I do understand that each of my inputs are now contributing partially in each component. What I do not understand is how to feed the result of PCA (in my case, two components) to a machine learning model? How do we input them? For example, when I want to run a NN on my features, I just can navigate to where they are stored and import them, but my PCA analysis has been run in SPSS and all it shows me is the contribution of m

Join the discussion →

I cannot find a solution for botocore.exceptions.ParamValidationError:

I am stuck trying to find a solution to the following error botocore.exceptions.ParamValidationError: invalid length for parameter Key, value: 0, valid range: 1-inf I am able to list, upload files to a static html page listing my S3 bucket/objects. But cannot download or delete without hitting the ParamValidationError. I am using a text editor (nano) on EC2, Python2.7 Flask, flask-bootstrap. I think I am missing a value in the brackets, but I haven't found a solution so far. Any help would be appreciated. @app.route('/download', methods=['POST']) def download(): key = request.form['key'] my_bu

Join the discussion →

java Mail API using to send email from a java program but showing error of SMTP protocol

public class SendEmail { public static void main(String[] args) { // TODO Auto-generated method stub String to = "[email protected]";//change accordingly String from = "[email protected]";//change accordingly String host = "localhost";//or IP address //Get the session object Properties properties = System.getProperties(); properties.setProperty("mail.smtp.host", host); Session session = Session.getDefaultInstance(properties); //compose the message try{ MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO,new InternetAd

Join the discussion →

Problem in AOP configuration seems to be invalid

When I try to log somme function in my Dao CLASS using Log4j, I have an exception: The error: Exception in thread "main" org.springframework.aop.AopInvocationException: AOP configuration seems to be invalid: tried calling method [public abstract void tp.dao.IDao.addProduit(tp.entity.Produit)] on target [tp.entity.Produit@27e32fe4]; nested exception is java.lang.IllegalArgumentException: object is not an instance of declaring class at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:346) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJ

Join the discussion →

Generators are not supported when it's nested in expressions

I have to do simple remove "." from the strings before doing word count. It is working fine in two statements but giving me below error while writing in single statement. Am I doing something like stupid? Or it is a scope for improvement? Error: org.apache.spark.sql.AnalysisException: Generators are not supported when it's nested in expressions, but got: regexp_replace(explode(split(CAST(value AS STRING), \s+)), [.]*, ); Code: import org.apache.spark.sql.functions._ val testString = " I am X. X Works for Y." val testDF = Seq (testString).toDF val testDF1 = testDF.select(regexp_replace (explode

Join the discussion →

Dynamically change the content in the index.html file when running the ng-build command

I want to change the URL of a script tag when I'm running the ng build command with the --prod option and without the --prod option. Following is an example. ng build --prod <!DOCTYPE html> <html> <head> <title>Home Page</title> </head> <body> <script src="https://my-site.net/prod.js"></script> </body> </html> ng build <!DOCTYPE html> <html> <head> <title>Home Page</title> </head> <body> <script src="https://my-site.net/dev.js"></script> </body> </html> How can I achieve this?

Join the discussion →

angular - How to dynamically change the content in the index.html file when running the ng-build command

I want to change the URL of a script tag when I'm running the ng build command with the --prod option and without the --prod option. Following is an example. ng build --prod <!DOCTYPE html> <html> <head> <title>Home Page</title> </head> <body> <script src="https://my-site.net/prod.js"></script> </body> </html> ng build <!DOCTYPE html> <html> <head> <title>Home Page</title> </head> <body> <script src="https://my-site.net/dev.js"></script> </body> </html> How can I achieve this?

Join the discussion →

Spring Cloud Config - Cannot clone or checkout repository: ssh://[email protected]//repo.git

When I try the URL with https it works but I don't want to have the username and password. I am able to perform a git clone with the above url and its working. But when I try it in the code and hit the localhost:8888/default endpoint I get the error: { "error": "Not Found", "message": "Cannot clone or checkout repository: ssh://[email protected]/<user>/config-repo.git", "path": "/licensingservice/default", "status": 404, "timestamp": "2018-04-30T23:32:54.726+0000" } Here is my application.yml entry server: port: 8888 spring: cloud: config: server: git: uri: ssh://[email protected]/<user>/config-repo

Join the discussion →

how to use angular service inside rxjs retryWhen method

I am making the http service calls 3 times when I get 401 error using the retryWhen method form Rxjs operators. My problem is that when I get a 401 error status, I need to make the other service update the token and then re-try the http service call 3 times. I am unable to use the service inside retryWhen call back method as it is always showing this as undefined. Can you please provide a solution for this? return this.http.get(url, this.getOptions(options)).retryWhen(errors => { return errors.mergeMap((error) => { console.error('error status....', this, error, error.status); if (error.status

Join the discussion →

Why Double not Float

Why inferred type is Double and not Float? final Array1D<Double> doubles = Array1D.factory(Primitive32Array.FACTORY).makeFilled(10, new Uniform()); Or put it differently, what is difference between Primitive32Array.FACTORY and Primitive64Array.FACTORY?

Join the discussion →

How to return a response in callback function with flask

here is a dll, that can compare face distance, and the compareFace.dll, I need use callback to receive it's value now, I want use flask to wrapper it, then can visit by http and json lib= c.CDLL('comparedFace.dll') CALLBACKFUNC = c.CFUNCTYPE(None, c.c_int, c.c_char_p) lib.startComparedFace.restype = c.c_int lib.startComparedFace.argtypes = (c.c_char_p, c.c_char_p, CALLBACKFUNC) @app.route('/compare', methods=['GET', 'POST']) def test(): if request.method == 'POST': request_json = request.get_json() print(request_json) number = request_json.get('number') image01 = request_json.get('image01') im

Join the discussion →

Principal component analysis, with two preprocessing steps, mean normalization and feature scaling

I am studying principal component analysis (PCA), and I have just learnt that before applying PCA to the data samples, we have to apply two preprocessing steps which are mean normalization and feature scaling. However, I don't have any idea about what mean normalization is and how it can be implemented. At first I searched it; however, I could not find a instructive explanation. What is the explanation for mean normalization and how can it be implemented?

Join the discussion →

Connection string for Linked Servers Database

I have created a "Link Server" in my SQL server 2012. Now I want to get data from a table which is under a "Link Server". So for that, what will be the connection string to connect with a database under "Link Server"? In the console application I have tried this. <add key="smartdb" value="Data Source=192.168.1.141; Initial Catalog=mydb;User Id=sa;Password=sa123" /> But it's not working. I don't know where to set the database name, which is under "Linked server".

Join the discussion →

How to use ant design in server side rendering?

I want to use ant design in server side rendering react application project. How to import antd in server side rendering ? import { Icon, Form, Input, Button, Upload, Select, Badge, Avatar, Divider, Checkbox, DatePicker, Row, Col, Carousel } from 'antd';

Join the discussion →

Cookies: Invalid cookie. Value not a token or quoted value

I am implementing a project with angular 5 in front end and springboot in backend. While i'm trying to send a request from client to backend, In the google chrome console the following message is displayed GET http://localhost:4200/customer 404 (Introuvable) And In the tomcat console I'm getting this line avr. 23, 2018 11:26:21 AM org.apache.tomcat.util.http.LegacyCookieProcessor processCookieHeader INFOS: Cookies: Invalid cookie. Value not a token or quoted value Note: further occurrences of Cookie errors will be logged at DEBUG level. What would be the solution for this?

Join the discussion →

Why doesn't $display show any output?

I am trying to monitor the output of a piece of Verilog code using the $display statement. However, I am not getting any display prints. Is it because I am not using $finish? Any help will be appreciated. I am attaching the testbench code here: module t_feedback_mult; reg [1022:0] r; reg clk; reg reset; wire [9:0] lambda1; wire [9:0] lambda2; wire [9:0] lambda3; //wire [1022:0] error_vector; //wire [1022:0] corrected_codeword; integer count=0; top_module TM1 (r, clk, reset, lambda1, lambda2, lambda3); initial begin clk = 1'b0; forever #5 clk=~clk; end initial begin reset = 1'b0; #17 reset = 1'

Join the discussion →

Emulator not working: "CPU with EPT + UG needed"

I'm new to Android Studio, this is my first attempt at running an app. My computer is relatively slow and can't run HAXM so I'm using the ARM instead of the x86 build for the emulator. When I try running it, I get this error: 21:31 Gradle build finished in 15s 887ms 21:31 Emulator: WARNING: init: Missing WGL extension WGL_ARB_create_context 21:31 Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A CPU with EPT + UG features is currently needed. We will address this in a future release. 21:31 Emulator: emulator: WARNING: UpdateCheck: Failure: Error 21:32 Emulator: Process

Join the discussion →

Material Datepicker two way binding with ngModel?

I have a stepper process form and on the first step the user is asked to pick a date using the Angular Material design Datepicker component. When the user goes to the next step I want to bind the value they selected and show it again at the top in an input field (they should be able to change it here as well). I've tried [(ngModel)] but not sure if I'm using it properly. <mat-form-field> <input [(ngModel)]="date" formControlName="dateFormCtrl" matInput [matDatepicker]="picker" [max]="maxDate" [min]="minDate" placeholder="When is your event?" readonly> <mat-datepicker-toggle matSuffix [for]="pi

Join the discussion →

PHP Startup: Unable to load dynamic library 'php_curl.dll'

For a project I need the php_curl.dll module. I activated the module in all php.ini files. But I get a PHP Warning, that the module is unable to load. By checking the error.log file, I see this information: PHP Warning: PHP Startup: Unable to load dynamic library 'php_curl.dll' (tried: …/UwAmp/bin/php/php-7.2.4/ext\php_curl.dll What can I do? Is the path correct loading or generated?

Join the discussion →

How to adjust text field with stretch with overflow

I use iReport 4.5.1 (I know it's so so old but it's at work and I don't have authority to upgrade it). Anyway, I have a text field with following value: $F{field1} + " — " + $F{field2} Both field1 and field 2 are of java.lang.String type. Since neither field1 nor field2 has consistent length, I have checked the stretch with the overflow property as TRUE. But the problem is that when I have a long text for field2 the rest of it comes below field1 while I need it begin right below field2. Actually, it appears like: something for field1 — something very long for field2 While I need it like: somet

Join the discussion →

How to download video from any website

I just wanted to know the general idea to how to download video from any website. Thing I try I Inspect the page saw the blob URL in video attribute tag. Copy-paste the blob URL in browser but it can't get open. I also look around the Developer tool in Network tab. There I saw XHR request continue receiving with extension using .m4s Copy the above XHR request as curl and create the file using command curl 'https://......." > file.mp4. Created file can't be read by player Can anyone tell me the idea to do this. I don't want to use any library or package like pytube, youtube-dl. Just learning to

Join the discussion →
Older stories