on-internet

How to loop through all WooCommerce product images (featured and gallery)?

I want to create a custom product gallery, and I need to loop through all images (the featured image and attachment images). I need to create an array containing both the featured image and the attachment images. The output loop should look like this: foreach ( $images as $image_src_url ) { echo '<img src="' . $image_src_url . '">'; }

Join the discussion →

Pointer as a parameter in C

Let's say a have a pointer as a parameter, why doesn't it's value remain modified after the and of a function, and i have to use this syntax: void function_name (int **p) { // code } and in main(): int *v; function_name (&v); I want to specify that i use a pointer to a struct type as a parameter.

Join the discussion →

Call child method from parent

I have two components: Parent component Child component I was trying to call Child's method from Parent, I tried this way but couldn't get a result: class Parent extends Component { render() { return ( <Child> <button onClick={Child.getAlert()}>Click</button> </Child> ); } } class Child extends Component { getAlert() { alert('clicked'); } render() { return ( <h1 ref="hello">Hello</h1> ); } } Is there a way to call Child's method from Parent? Note: Child and Parent components are in two different files.

Join the discussion →

Passing data to handlebars - node.js

I am new to node.js , so basically I am making a get request in my router(index.js) and then after I get the result (I could see that I obtained the right result by dumping it in console.log) I am parsing it into a json object and passing it to a render function so that I could use it there, however, I am getting errors. I will post the code segments and the JSON fragment below . Is this the right way to use handlebars? Router (index.js) router.get('/getusers', function(req, res) { wrapRequestAsCallback(req.cookies.TOKEN_CACHE_KEY, { onSuccess: function(token) { var all_users = {}; // get all

Join the discussion →

Auto-increment ID with Prefix

I want to achieve an auto increment ID with prefix but resetting the number if it has different prefix. The output I want looks like this: ID PREFIX PROJECTID 1 PID_ PID_1 2 PID_ PID_2 3 RID_ RID_1 4 RID_ RID_2 But the result I got with my script is this: ID PREFIX PROJECTID 1 PID_ PID_1 2 PID_ PID_2 3 RID_ RID_3 4 RID_ RID_4 Here's my script to create the table CREATE TABLE PROJECTS (ID INT IDENTITY(1,1) NOT NULL, PREFIX NVARCHAR(10) NOT NULL, PROJECTID AS ISNULL(PREFIX + CAST(ID AS NVARCHAR(10)), '') PERSISTED) INSERT INTO PROJECTS(PREFIX) VALUES('PID_'),('PID_'),('RID_'),('RID_') I'm using

Join the discussion →

MySQL query to find Products that were sold on both the days [closed]

I have to write a MySQL query: Find products that were sold on both the days (01-JUL-11 and 02-JUL-11) and number of total product sold. The table looks like: Date, Order_id, Product_id, Quantity '01-JUL-11',O1,P1,5 '01-JUL-11',O2,P2,2 '01-JUL-11',O3,P3,10 '01-JUL-11',O4,P1,10 '02-JUL-11',O5,P3,5 '02-JUL-11',O6,P4,6 '02-JUL-11',O7,P1,2 '02-JUL-11',O8,P5,1 '02-JUL-11',O9,P6,2 '02-JUL-11',O10,P2,4 Output: P1 17 P2 6 P3 15 So far I have tried is: SELECT PRODUCT_ID, TOTAL FROM (SELECT PRODUCT_ID, COUNT(PRODUCT_ID) AS COUNTER, SUM(TOTAL) TOTAL FROM (Select ORDER_DAY, PRODUCT_ID, SUM(QUANTITY) AS TO

Join the discussion →

autoreconf failed with exit status 1

I am trying to install a program by cloning it with git. I am running in an Ubuntu 14.04.4 LTS. I get the source code correctly with "git clone" but autoreconf fails giving the following error: xray@silvia-desktop:~/Software/Gitsrc/simput$ autoreconf --install --verbose autoreconf2.50: Entering directory `.' autoreconf2.50: configure.ac: not using Gettext autoreconf2.50: running: aclocal autoreconf2.50: configure.ac: tracing autoreconf2.50: configure.ac: adding subdirectory extlib/cfitsio to autoreconf autoreconf2.50: Entering directory `extlib/cfitsio' autoreconf2.50: configure.in: not using

Join the discussion →

Calling a JavaScript function on Contact Form 7 submission

I'm using Contact Form 7 in Wordpress, with Skin Beauty as the theme. What I want to do is to call a specific JavaScript function when the form I created is submited. In my HTML code I am creating a form like this: <form onsubmit="checkvalue()"> ... </form> And at the end of the body of my HTML code, I am creating a JavaScript function with the validation I want to do on the form: <script language="JavaScript" type="text/javascript"> function checkvalue() { ... } </script> I tried the code in another theme (Twenty Thirteen) - with Contact Form 7 - and the weird thing is that there was no probl

Join the discussion →

Printing a datagridview

I am trying to print a datagridview which will get values from the database, I was able to do that but I don't know why the columns name are not showing up after I print it. Below is the code that I am currently using: This one is for the printdocument: Private Sub PrintDocument1_PrintPage(sender As Object, e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage With DataGridView3 Dim fmt As StringFormat = New StringFormat(StringFormatFlags.LineLimit) Dim text As String = ("TrashCollection - Estatísticas") fmt.LineAlignment = StringAlignment.Center fmt.Trimming = StringTrimming.Elli

Join the discussion →

Bad version of java when running maven exec plugin

My current version of java is 7: java -version java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) Server VM (build 24.80-b11, mixed mode) and I have command mvn8 where is set java_home to 8: mvn8 -version Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0 Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100) Maven home: /home/.../apache-maven-3.0.3 Java version: 1.8.0_66, vendor: Oracle Corporation Java home: /home/.../jdk1.8.0_66/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", vers

Join the discussion →

kotlin logging with lambda parameters

In log4j2 we have a handy feature which is described as // Java-8 style optimization: no need to explicitly check the log level: // the lambda expression is not evaluated if the TRACE level is not enabled logger.trace("Some long-running operation returned {}", () -> expensiveOperation()); my attempt to use this in kotlin log.debug("random {}", { UUID.randomUUID() }) which will print random Function0<java.util.UUID> How do we use lambda argument logging with kotlin? Or how do we explicitly tell kotlin what method to call?

Join the discussion →

Visual C++ 14 redist package prerequisite - configure from visual studio setup proj

I have a Visual Studio setup project which installs an x64 program that needs the VC++ 14 Redist package. I selected the options as per image and created a folder structure inside: C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages I have created vcredist_x64 folder which contains: vcredist_x64.exe product.xml en folder Inside en folder I have: package.xml Contents of product.xml: <?xml version="1.0" encoding="utf-8" ?> <Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.Visual.C++.11.0.x64" > <!-- Defines list of files

Join the discussion →

How to convert JsonNode to Map

using play framework java on the server i'm using graphiql to make requests, when i do final JsonNode variables = request().body().asJson().get("variables"), a JsonNode with a value "{\"id\":\"bar\"}" , now i want to convert this JsonNode to a Map, i tried Json.mapper().convertValue(variables, new TypeReference<HashMap<String, Object>>() { }); but i keep getting this exception Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [map type; class java.util.HashMap, [simple type, class java.lang.String] -> [simple type, class java.lang.Object]] from S

Join the discussion →

Error:Uncaught TypeError: $(...).valid is not a function while using ('#form').valid()

Here is my page where I want to check is form valid or not from jquery function..Code is as follows: <div class="wrapper wrapper-content animated fadeInRight"> <div class="row" style="width:80%;padding-top:20px;margin-left:3%;"> @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "addNominationForm"})) { @Html.AntiForgeryToken() <div class="white-bg" style="padding-left:2%"> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) <div class="form-group" style="padding-top:10px"> @Html.Label("Nomination Category", htmlAttributes: new { @class = "control-label col-md-3 requi

Join the discussion →

CodeIgniter login session

I'm new in CodeIgniter and I tried to create a login system on my website. When I try to enter on page Overview, it sends me on login page but after I put my correct email and password nothing happens. Login.php - controller <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Login extends CI_Controller { function __construct() { parent::__construct(); } function index() { $this->load->helper(array('form')); $this->load->view('login'); } } ?> Overview.php - controller <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Overview extends

Join the discussion →

CloudFront redirect all requests with path prefix

I have a static web site which makes requests to an API server. I'm hosting this static pages with S3 and I'd like to use CloudFront to redirect the api calls to the api server. Api calls can be distinguished by a path prefix of api: domain.com/index.html s3/index.html domain.com/js/index.js s3/js/index.html domain.com/api/request api_server/api/request domain.com/api/other/request api_server/api/other/request I currently have two origins set up - one S3 origin for my S3 bucket (which is working) and another custom origin for my api server (which is not working). The custom origin settings are

Join the discussion →

Cannot connect to RabbitMQ server

I'm trying to run the sample code, provided by the official page: https://www.rabbitmq.com/tutorials/tutorial-one-dotnet.html I'm using this code: using RabbitMQ.Client; using RabbitMQ.Client.Events; using System; class Send { public static void Main() { var factory = new ConnectionFactory() { HostName = "[email protected]" }; var connection = factory.CreateConnection() //this throwing exception var channel = connection.CreateModel() } } The problem is, that I get these exceptions always: 'RabbitMQ.Client.Exceptions.ConnectFailureException' in RabbitMQ.Client.dll 'RabbitMQ.Client.Excepti

Join the discussion →

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:exec (default) on project mavenproject2:

I am beginning the initial attempt to use Vert.x in Java. IDE is Netbeans version 8.1. Vert.x is version 3.0.0. The code for this project is shown below. The pom.xml file is also listed below. This code will run in Netbeans IDE but the Build (for jar file) will not complete without the error shown in the BUILD REPORT below. Thus, the generated jar file will not execute. I have researched every resource I could locate on the internet and cannot find an adequate solution/answer. I would appreciate any help anybody can offer to resolve this problem. The POM file is generated by Netbeans IDE when

Join the discussion →

Excel: Plotting multiple series in a scatter plot

I have several different students and I'd like to plot their test scores changing over time. There are multiple students but only a few tests each. Name Date Score Afaf 10/1/2014 2 Afaf 4/15/2015 3 Ahmed 10/8/2015 1 Ahmed 2/16/2016 1 Ahmed 3/5/2016 1 Arie 11/3/2015 -1 Arie 3/23/2016 1 So far I've found that the scatter graph gives me what I want: However, I have to manually select each individual student when I'm adding new series to the graph. I can't get Excel to recognize the 'Name' column as categorical (i.e. each name is its own series): This is really slow because there's over a hundred

Join the discussion →

datatype of marriage status? (java)

May I know what datatype to use for Marriage Status? as far as I know Marriage status is either married or not married, is it possible to use boolean in this case? true/false else what am I supposed to use? Thanks!! boolean marriageStatus; if(marriageStatus = true) { // }

Join the discussion →

MS Excel: How do I make cell references variable?

I probably didn't word that title correctly, so let me explain what I'm trying to do. I need to find cycles in a series of data. So let’s say I have all of my data in column A of an Excel spreadsheet. If a condition that I’m looking for is true in, say, cell A7, I want to check to check if it’s true in every second cell (A9, A11, A13 and so forth). If it’s not true in every second cell, I want to adjust the model to check every third cell starting with that A7 cell (A10, A13, A16, and so on). If the condition is not true in every third cell, then I want to check every fourth cell (A11, A15, A1

Join the discussion →

How do I control the size of html window?

I would like to control the size (width and height) of an html window page. I would like the page to be small like a popup window. I would like the properties in the same html document to control the size of the browser without having to make a javascript link in another page.. Below is what I did to control the size of the document, but it didn't work... Help! <!DOCTYPE html> <html> <head> <link type="text/css" /> <style type="text/css"> html {height: 500px; width:500px; margin:0; padding:0; } body {height: 500px; width:500px; margin:0; overflow: hidden; padding:0; } .container {height: 500px

Join the discussion →

Asterisk PIAF dimensioning hardware

I am looking for Suggested Hardware to install FIAF(asterisk) AWS EC2 instance. Enterprise grade Hardware to serve medium and large Enterprise IT industry. OS: Centos Codec: G.711 alaw/ulaw Maximum concurrent call: 500 Total SIP Peers: 1000 Only extension to extension calling. Not using to call via trunk like SIP or E1/T1. I am seeking for the reply from the expert comunity!!

Join the discussion →

How to force rsyslog ommysql use utf8?

I'm using ommysql in rsyslog for transfering data into mysql $ModLoad ommysql local6.* :ommysql:localhost,Syslog,rsyslog,1 but cyrilic data goes like "·Ð¾Ð²Ð°Ð½Ð¸Ðµ иÑ�точнÐ" in database. I think It's because ommysql doesn't set utf8 encoding and starts inserting at once it's connected: http://s017.radikal.ru/i441/1606/e0/050cf30c495f.png Is it any way to say «set names utf8;» before inserting?

Join the discussion →

Prevent translation files from being cleaned by Makefile

I am using Qt Creator 4.0.0 along with CMake > 3.4. I am generating translation files thanks to this command: QT5_CREATE_TRANSLATION(${PROJECT_NAME}_TRANSLATIONS_COMPILED ${${PROJECT_NAME}_TRANSLATIONS_SOURCES} ${${PROJECT_NAME}_TRANSLATIONS_FILES}) Each time I build my project, the translation files are either created or updated if they already exist. However, when I clean the project, the ts files are removed. Is there an easy way from CMake or Qt Creator to prevent them from being cleaned?

Join the discussion →

Batch File output based on hostname

Struggling to find the answer/code needed. Currently using the following script. I'd like the text output file to be the Host name. How can i do this? @echo off REM setlocal enabledelayedexpansion ( systeminfo | findstr /c:"Host Name" systeminfo | findstr /c:"Domain" systeminfo | findstr /c:"OS Name" systeminfo | findstr /c:"OS Version" systeminfo | findstr /c:"System Manufacturer" systeminfo | findstr /c:"System Model" systeminfo | findstr /c:"System type" systeminfo | findstr /c:"Total Physical Memory" ipconfig | findstr IPv4 echo. echo Hard Drive Space: wmic diskdrive get size echo. echo. e

Join the discussion →
Older stories