on-internet

Upload a image with fetch

I have a form defined: <form method="POST" onSubmit={this.handleSubmit.bind(this)} enctype="multipart/form-data"> The handler for the submit event is defined as such: handleSubmit(event) { event.preventDefault(); var FormData = require('form-data'); var form = new FormData(); form.append('nome', this.refs.name.value); form.append('phone', this.refs.phone.value); form.append('address', this.refs.address.value); form.append('mail', this.refs.mail.value); form.append('type', 'file'); form.append('photo', this.refs.photo.value); const {dispatch} = this.props; dispatch(fetchByArray(form)); } } fetc

Join the discussion →

PCA (principal component analysis) on multiple datasets

I have a set of climate data (temperature, pressure and moisture for example), X, Y, Z which are matrices with dimensions (n x p) where n is the number of observations, and p is the number of spatial points. Previously, to investigate modes of variability in dataset X, I simply performed a empirical orthogonal function (EOF) analysis OR principal component analysis (PCA) on X. This involved decomposing (via SVD), the matrix X. To investigate the coupling of the modes of variability of X and Y, I used maximum covariance analysis (MCA) which involved decomposing a covariance matrix proportional

Join the discussion →

How to autosize text on a textmesh

How do you auto-size text on a textmesh. I have dice, with six sides, that I want to put words on. The words will constantly be changing, so I need them to auto size based on the size of the cube, which doesn't change. The dice are not UI elements and thus sit outside the canvas. Here is how I am adding the text. LocationSide1.GetComponent<TextMesh>().text = "1"; LocationSide2.GetComponent<TextMesh>().text = "2"; LocationSide3.GetComponent<TextMesh>().text = "3"; LocationSide4.GetComponent<TextMesh>().text = "4"; LocationSide5.GetComponent<TextMesh>().text = "5"; LocationSide6.GetComponent<Tex

Join the discussion →

How to add 'Company Name' in customer register and billing info

I've been trying to add 'company name' on customer register and onepage checkout but unsuccessfully so far. I tried https://magento.stackexchange.com/questions/15847/add-company-name-to-billing-shipping-dropdown-in-magento but it didn't help at all. I can't believe there isn't a simple way of doing that.

Join the discussion →

Spring and Thymeleaf: Template mode "HTML" has not been configured

I'm trying to figure out the spring pet clinic project : https://github.com/spring-projects/spring-petclinic Trying to make my own basic spring project, want to use thymeleaf and I don't know what is going on because I'm constantly getting error "Template mode "HTML" has not been configured". I've been trying to learn this by analysing the pet clinic project, then I started lurking through the tutorial: http://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html and there is this info about Engines and Resolvers which are not present in pet clinic project. My question: what the hell is goi

Join the discussion →

How do i display a string array in recyclerview?

I have json data from the server. I converted it in a string array and passed it to the next activity. There i wanted to display this array in recyclerview. But As soon as i click the button the app stops. Here is my code for the display class. public class Display extends AppCompatActivity { TextView displaytext; String getarray[]; ArrayList<String> mylist; private RecyclerView rview; private RecyclerView.LayoutManager layoutManager; private Adapter madapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dis

Join the discussion →

Asterisk AMI no longer allows connection

I have been connecting to Asterisk AMI and things have been fine but suddenly it just stopped receiving connections I suppose. My manager.conf looks like this [general] enabled = yes port = 5038 bindaddr = 0.0.0.0 displayconnects = yes [myusername] secret = mysecret deny=0.0.0.0/0.0.0.0 permit=111.222.333.444/255.255.255.0 read = all write = all Suddenly it just stopped working. I tried to connect to the address 111.222.333.444 with the port 5038 on Telnet using Putty but the connection was refused. Please what might go wrong suddenly?

Join the discussion →

How do I view the size of npm packages?

When I search for packages on NPM, I would like to see package sizes (in KB or MB, etc). NPM doesn’t seem to show this information. How can I determine how much bloat an NPM package will add to my project? Update 2020 (copied from @styfle answer) The "Unpacked Size" (basically Publish Size) is available on the npmjs.com website along with "Total Files". However, this is not recursive meaning that npm install will likely be much bigger because a single package likely depends on many packages (thus Package Phobia is still relevant). There is also a pending RFC for a feature which prints this inf

Join the discussion →

Unable to authentication a user with spring custom filter

I am trying to authenticate a user on login request with username and password comparing from database using jpa but some how the authentication fails and returns 401 error. The request flow is as follows: Request from client side: login: function(data,success, error){ $http.post('auth', data).success(success).error(error); } application.yml is configured to accept request for "auth" as # config context path to "/" by setting an empty string server: contextPath: # JACKSON spring: jackson: serialization: INDENT_OUTPUT: true jwt: header: Authorization secret: mySecret expiration: 604800 route: a

Join the discussion →

How to Sync Mysql into Bigquery in realtime?

Currently I have some script which first deletes the table and upload the table from MySQL to Bigquery. And many time it had failed. Plus it run only once a day. I am looking for some scalable and realtime solution. Your Help will be much appreciated :)

Join the discussion →

Inno Setup - Post Processing

I would like to build an MD5 checksum file of the setup file generated by Inno Setup. I've found the pre-processor and was wondering if there is a way to do some processing once the 'setup' output file has been created. It needs to run at the compile time not during installation.

Join the discussion →

Select 2 empty value in dropdown

I want to display option in my dropdown without value, but select 2 prohibits it. <select name="searchcategory[]" multiple="multiple" class="js-example-basic-multiple"> <option value=''>All Category</option> </select> my select2 js $(".js-example-basic-multiple").select2({ placeholder: "Choose category", });

Join the discussion →

subprocess.Popen and relative directories

I am writing a script to open notepad.exe using subprocess.Popen(): import subprocess command = '%windir%\system32\\notepad.exe' process = subprocess.Popen(command) output = process.communicate() print(output[0]) This throws a FileNotFoundError. Is it possible to change/add to the above code to make it work with relative paths? I did try to run the script from C:\Windows> after moving it there, which again failed. Also set the shell=True, but failed as well. Writing a similar script using os.popen() works ok with relative paths, regardless which directory the script is run from, but as far as

Join the discussion →

Error in curl::curl_fetch_memory(url, handle = handle) : URL using bad/illegal format or missing URL

I have this function that won't run. The command inside of the code works when it is applied on it's own but when I run it in this lapply function it errors out. I have tried updating my Curl libraries etc... No idea why it's happening. library(curl) ##dataframe looks like this as factor list: x = "http://google.com" funk <- function(x) { read_html(x) %>% html_node("title") %>% html_text } df$titles<-lapply(df$urls,funk) Error: 'Error in curl::curl_fetch_memory(url, handle = handle) : URL using bad/illegal format or missing URL ' does not exist in current working directory ('/Users/Home/'). An

Join the discussion →

How add a a number to a variable in batch

Hey I'm working on a project of mine in batch. yes I know its bad but I'm using it anyways. I was trying to make an updating inventory system when I ran into this problem. I was trying to add a set number E.X 1 to a variable like this: @echo off set var=0 echo I will add these numbers from var+1 set /a var=%var%+1 pause echo var pause what is the problem?

Join the discussion →

Displaying single row of sql query result in view

In my view I'm trying to display just once the user_username at the top of the page,and then all the messages and the message times below. I don't have a problem with the foreach($message as $row) part and that is displaying correctly. However I cannot get the Messages by <?php echo $message['user_username']; ?> to display the name of the message poster. Any help on how I can do this will be greatly appreciated. View <html> <head> <title> View Messages </title> </head> <body> Messages by <?php echo $message['user_username']; ?>: <?php foreach($message as $row){?> <?php echo $row->text;?> <br>

Join the discussion →

PHP | Access to undeclared static property

After trying several attempts at this for some reason i get the error Access to undeclared static property when i try to make an object out my class. My class: final class repo { var $b; /** * @var \Guzzle\Http\Client */ protected $client; function repo($myvar) { static::$b = $myvar; $this->client = $b; } } Me making an object: $myobj = new repo("test");

Join the discussion →

Pass arguments from the command line

I want to pass arguments from the command line, so I had tried the following code, but it throws an error: use strict; use warnings; use Getopt::Long qw(GetOptions); use Getopt::Std; print "raw data:@ARGV\n"; my $site = getopts('bangalore', 'norwood', 'limerick'); if ($site) { print "success"; } else { die "error"; } print "final data:@ARGV \n";

Join the discussion →

Drupal 8 preprocess page

I'm new in Drupal 8 & I have an issue. I need to display a CCK field (custom field) in my theme page page-front.html.twig. As I understand it's impossible to display node variables in a non-node page, so I start to do a preprocess hook. My preprocess looks like this: mythemename.theme <?php function THEME_NAME_preprocess_page(&$vars) { if (isset($vars['node'])) { $node = $vars['node']; if ($node->isset('field_numero_cin') { $field_cin = $node->get('field_numero_cin'); $vars['field_cin'] = $field_image->value(); } } } Unfortunately, when I'm debugging (kint) my variable in page-front.html.twig

Join the discussion →

Failed to read artifact descriptor for org.seleniumhq.selenium:selenium-java:jar:3.0.1

Here is my POM.xml <?xml version="1.0" encoding="UTF-8"?> http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 <groupId>test3</groupId> <artifactId>test3</artifactId> <version>1.0-SNAPSHOT</version> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.15</version> </dependency> <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.0.1</version> </dependency> </dependencies> The depende

Join the discussion →

How can download file in service in android

I want download file from server and i want download this in background such as service. My codes is : public class MainActivity extends AppCompatActivity { Button download; TextView downloadCount; ProgressBar progressBar; Future<File> downloading; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Enable global Ion logging Ion.getDefault(this).configure().setLogging("ion-sample", Log.DEBUG); setContentView(R.layout.activity_main); download = (Button) findViewById(R.id.download); downloadCount = (TextView) findViewById(R.id.download_count); pr

Join the discussion →

Flexible-date flight search engine with specified weekdays

I would like to search for cheap flights for a week-end out, without specific restrictions on dates or destinations. Is there a flight search engine that allows one to search for all flights leaving from city X to an unspecified/flexible location on an (also unspecified/flexible) Friday evening and returning on the next Sunday?

Join the discussion →

ESP8266: How to send TCP messages using AT+CIPSEND command

I am experimenting with Arduino and ESP8266 module, and now I am trying to send some sensor data to a TCP server. For this purposes I am using AT+CIPSTART command (to establish a TCP connection) and AT+CIPSEND to send the data. If I am testing it using Serial Monitor, it works fine. After entering CIPSEND command I can write some text in a terminal and this message/text will be sent to the TCP server. When I am trying to make it inside Arduino sketch, then it sends an empty message. The connection works, but I do not see any data. How can I send a message text (msg) with my TCP packet? Here is

Join the discussion →

How to specify sql dialect when creating spark dataframe from JDBC?

I'm having an issue reading data via custom JDBC with Spark. How would I go about overriding the SQL dialect inferred via JDBC URL? The database in question is Vitess (https://github.com/youtube/vitess) which runs a MySql variant, so I want to specify a mysql dialect. The JDBC URL begins with jdbc:vitess// Otherwise, the DataFrameReader is inferring a default dialect which uses """ as a quote identifier. As a result, queries via spark.read.jdbc get sent as select 'id', 'col2', col3', 'etc' from table instead of select id, col2, col3, etc from table ...which returns the string constants instead

Join the discussion →

double vs. double* in C++

I'm developing a piece of code which makes scientific calculation, and as a result I use extensive use of double variables. These variables travel from function to function, but most of them are never modified and hence defined as const in function signatures. I have used double* in function signatures, but then I started to wonder that whether it's better to use double instead because: double* and double are same size, 8 bytes in C++. When I send in double*, I need another fetch operation in the function. When using the variables in const fashion, are there any valid reasons to use double* in

Join the discussion →

Execute function with multiple values in single parameter

I have SQL function which takes parameter as BIGINT like below: FUNCTION [dbo].[fn_doc] ( @DocID bigint ) I want to pass multiple doc ID and want to get results. For which I'm doing like this: declare @DocID bigint SET @DocID = (2949146,2949148,2949149,14016926,14025278,14016928,14016928,14025280,14025280) select * from [fn_doc] (@DocID) My question is, how to execute a function with multiple values to single parameter in this case?

Join the discussion →

scikit-learn pipeline model predicting same results for all input

In the program, I am scanning a number of brain samples taken in a time series of 40 x 64 x 64 images every 2.5 seconds. The number of 'voxels' (3D pixels) in each image is thus ~ 168,000 ish (40 * 64 * 64), each of which is a 'feature' for an image sample. I thought of using Recursive Feature Elimination (RFE). Then follow this up with principal component analysis (PCA) because of the ridiculously high n to perform dimensionality reduction. There are nine classes to predict. Thus a multi-class classification problem. Starting with RFE: estimator = SVC(kernel='linear') rfe = RFE(estimator,n_fe

Join the discussion →

Why does following program shows error Q and D are not declared?

I wrote this program for an FIR filter and used D flip flop for delay. I needed to implement filter with Impulse response h(n) = {1, -1} Despite various efforts, it shows the same error that D and Q aren't defined/declared properly. There was another error saying Q has been illegally redeclared; for that, I deleted the line where I defined Q output register in the second module. Please point out the error and tell me how to fix it. module firfilter (dout, din, clock); input din, clock; output dout; parameter b0 = 1'd1; parameter b1 = 1'd1; assign dout = b0 - b1 * Q; always @(posedge clock) D <

Join the discussion →
Older stories