Id int64 34.6M 60.5M | Title stringlengths 15 150 | Body stringlengths 33 36.7k | Tags stringlengths 3 112 | CreationDate stringdate 2016-01-01 00:21:59 2020-02-29 17:55:56 | Y stringclasses 3 values |
|---|---|---|---|---|---|
55,297,331 | What is difference between application server and backend server | <p>I'm new in IT operations, and I want to ask what is the difference between application server and backend server?</p>
| <server> | 2019-03-22 10:12:31 | LQ_CLOSE |
55,297,985 | What are the scenarios we can use for loop in selenium webdriver? | <p>What is the main use of for loop in Automation testing(Selenium Webdriver?</p>
| <java><selenium-webdriver> | 2019-03-22 10:48:52 | LQ_CLOSE |
55,298,428 | How to Resize Center and Crop an image with ImageSharp | <p>I need to convert some System.Drawing based code to use this .NET Core compatible library:</p>
<p><a href="https://github.com/SixLabors/ImageSharp" rel="noreferrer">https://github.com/SixLabors/ImageSharp</a></p>
<p>The System.Drawing based code below resizes an image and crops of the edges, returning the memory stream to then be saved. Is this possible with the ImageSharp library?</p>
<pre><code>private static Stream Resize(Stream inStream, int newWidth, int newHeight)
{
var img = Image.Load(inStream);
if (newWidth != img.Width || newHeight != img.Height)
{
var ratioX = (double)newWidth / img.Width;
var ratioY = (double)newHeight / img.Height;
var ratio = Math.Max(ratioX, ratioY);
var width = (int)(img.Width * ratio);
var height = (int)(img.Height * ratio);
var newImage = new Bitmap(width, height);
Graphics.FromImage(newImage).DrawImage(img, 0, 0, width, height);
img = newImage;
if (img.Width != newWidth || img.Height != newHeight)
{
var startX = (Math.Max(img.Width, newWidth) - Math.Min(img.Width, newWidth)) / 2;
var startY = (Math.Max(img.Height, newHeight) - Math.Min(img.Height, newHeight)) / 2;
img = Crop(img, newWidth, newHeight, startX, startY);
}
}
var ms = new MemoryStream();
img.Save(ms, ImageFormat.Jpeg);
ms.Position = 0;
return ms;
}
private static Image Crop(Image image, int newWidth, int newHeight, int startX = 0, int startY = 0)
{
if (image.Height < newHeight)
newHeight = image.Height;
if (image.Width < newWidth)
newWidth = image.Width;
using (var bmp = new Bitmap(newWidth, newHeight, PixelFormat.Format24bppRgb))
{
bmp.SetResolution(72, 72);
using (var g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawImage(image, new Rectangle(0, 0, newWidth, newHeight), startX, startY, newWidth, newHeight, GraphicsUnit.Pixel);
var ms = new MemoryStream();
bmp.Save(ms, ImageFormat.Jpeg);
image.Dispose();
var outimage = Image.FromStream(ms);
return outimage;
}
}
}
</code></pre>
| <c#><imagesharp> | 2019-03-22 11:13:59 | HQ |
55,298,743 | Z-Index Placing Text in Front of Image | I have a section with 3 columns, the middle column has an GIF image within it, but the text at either side is behind it rather than in front.
I've tried a few z-index options with no luck, not sure where I'm going wrong on the correct way I should be using this property.
Heres what I have - I've removed z-index from CSS:
<div class="row">
<i class="icon ion-md-exit"></i>
<h2>TEXT</h2>
<p>TEXT</p>
</div>
</div>
<div class="col span-1-of-3">
<img src="resources/css/img/gif.gif">
</div>
<div class="col span-1-of-3">
<div class="row">
<i class="icon ion-md-exit"></i>
<h2>TEXT</h2>
<p>TEXT</p>
</div>
CSS
.section-all-design {
height: 100vh;
background-color: #fbfbfb;
padding: 5%;
}
.section-all-design img {
width: 190%;
margin-left: -50%;
}
Also- Whilst I'm here, I'm looking to vertically align these text boxes along each side of my GIF image, what properties do I need to add to my vertical-align to make this happen? Line-height doesn't help me.
Thanks!
| <html><css><vertical-alignment> | 2019-03-22 11:35:39 | LQ_EDIT |
55,298,843 | Function which have diffrent behavior dependable on amount of input args | I want to create a function which will check if it is correct hour to make an action, but I want it to be flexible and check condition for every pair of args given as an input to fuction. I wrote some code how it should like in theory and now im trying to figure out how to write this in code.
def report_time(greater_than1=0, lower_than1=24, greater_than2=0,
lower_than2=24, greater_than3=0, lower_than3=24 ...
lower_thanN=24, greater_thanN=0):
if greater_than1 < datetime.now().hour < lower_than1:
logger.info('Hour is correct')
return True
if greater_than2 < datetime.now().hour < lower_than2:
logger.info('Hour is correct')
return True
if greater_than3 < datetime.now().hour < lower_than3:
logger.info('Hour is correct')
return True
...
if greater_thanN < datetime.now().hour < lower_thanN:
logger.info('Hour is correct')
return True
Examples of usage:
foo = report_time(16, 18)
foo = report_time(16, 18, 23, 24)
foo = report_time(16, 18, 23, 24, ..., 3-5) | <python><function><if-statement><arguments> | 2019-03-22 11:42:01 | LQ_EDIT |
55,298,954 | C++ Text Based Inventory Pt.2 | <p>I'd first like to start off by thanking everyone who helped me yesterday with another error. My teacher is currently off of work due to an accident and we don't use any reference books in the class (not provided), so please bear with me here if my post isn't formatted correctly or if my problem is quite obvious to everyone else. I'm now getting two errors in my code after adding some more lines (using this <a href="https://stackoverflow.com/questions/31093180/c-text-rpg-inventory-system">post</a> as a reference for my own project.) The two errors I get are:</p>
<pre><code>Error (active) E0349 no operator "=" matches these operands operand types are: Item = std::string line 76
</code></pre>
<p>and </p>
<pre><code>Error C2679 binary '=': no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion) line 76
</code></pre>
<p>Like I stated early in this post, we were assigned this RPG project in class but my teacher got into an accident, and there is no help available (our substitute is a retired lady who is basically a career substitute with no coding experience).</p>
<p>Here is all my code: </p>
<pre><code>// clunkinv.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include "pch.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <ostream>
#include <Windows.h>
#include <string>
#include <cstring>
#include <cctype>
using namespace std;
struct Item {
string name; //Item name.
int slot; //Head, Torso, Hands
int attack;
int knowledge;
int defense;
int hp;
int speed;
int charisma;
};
std::ostream &operator<<(std::ostream &os, const Item& item) {
os << item.name;
return os;
}
int main()
{
//Variables, Strings, etc.
int itemcounter = 0, counter = 0;
string search;
//"Empty" Item
Item Empty{ "<Empty>", 0, 0, 0 };
Item Sword{
"Paper Cutter Sword", //This item name is 'Short Sword'.
3, //Slot
3, //Attack
0,
0,
0,
0,
0,
};
vector<Item> Equipment = { 6, Empty }; //Current Equipment, 6 empty slots.
vector<Item> Inventory = { }; //Inventory
string InventorySlots[] = { "Head" "Torso", "Hands" }; //Player slots where items can be equiped.
cout << "You sit your bag down and take a look inside." << " You have:" << endl;
cout << "Enter 'Equip' to equip an item, or 'inventory' to see full inventory" << endl;
for (int i = 0; i < itemcounter; i++)
{
cout << InventorySlots[i];
if (Equipment[i].name == "Empty ")
{
cout << " " << Equipment[i].name << endl << endl;
}
}
if (search == "inventory") {
cout << "What do you want to equip? ";
cin >> search;
for (unsigned i = 0; i < Inventory.size(); i++) {
//Search for item player want to equip, put it in right slot.
if (search == Inventory[i].name) {
Equipment[Inventory[i].slot] = Inventory[i].name;
cout << "Successfully equiped!" << endl;
}
}
}
if (search == "inventory") {
for (unsigned i = 0; i < Inventory.size(); i++) {
cout << "______________________________________________________________" << endl;
cout << "| " << Inventory[i].name << endl;
cout << "| Carried items " << Inventory.size() << " / " << 20 << endl;
cout << "|_____________________________________________________________" << endl;
}
}
}
</code></pre>
| <c++> | 2019-03-22 11:48:53 | LQ_CLOSE |
55,299,535 | YouTube Data API returns "Access Not Configured" error, although it is enabled | <p>My internally used web solution to retrieve YouTube video statistics that is based on this example (<a href="https://developers.google.com/youtube/v3/quickstart/js" rel="noreferrer">https://developers.google.com/youtube/v3/quickstart/js</a>) now fails to work. Not sure when exactly it happened, but it used to work couple of months ago.</p>
<p>I now tried to run unedited example code (apart from adjusting the CLIENT_ID, of course), and I am getting exactly the same error:</p>
<pre><code>{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. YouTube Data API has not been used in project 123 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=123 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"extendedHelp": "https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=123" } ], "code": 403, "message": "Access Not Configured. YouTube Data API has not been used in project 123 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=123 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
}
</code></pre>
<p>When I check the YouTube API in developer console, it shows enabled status, and the Credentials compatible with this API include the ID used to authenticate the client. I can see the statistics for credential use increment when I retry the API call attempts, and the metrics reflect the number of requests and also show that the error rate is 100%. But there is no extra info on those failed attempts in the console to help on debugging the problem.</p>
<p>I have deleted and recreated API key and OAuth key, but that did not change anything.</p>
<p>Had there been any extra info on those errors on the developer console side, for example client quote exceeded, I could see how to fix this. Now I am completely stuck.</p>
| <youtube-data-api> | 2019-03-22 12:23:31 | HQ |
55,300,319 | How to change all value inside a JSON string php | <p>I want to change the date value from "<strong>15/03/2019 07:18:57</strong>" to this: "<strong>1552634337</strong>". </p>
<p>Here is the code:</p>
<pre><code><?php
$dtime = DateTime::createFromFormat("d/m/Y G:i:s", "15/03/2019 07:18:57");
echo $timestamp = $dtime->getTimestamp();
?>
</code></pre>
<p>but I want to do this to all the values of "date".</p>
<p>json:</p>
<pre><code>[{
"id": "6326",
"type": "0",
"date": "15/03/2019 07:18:57",
"message": "test",
"count": 17
},
{
"id": "6326",
"type": "0",
"date": "15/03/2019 07:18:57",
"message": "test",
"count": 17
}]
</code></pre>
<p>THANKS!</p>
| <php><json> | 2019-03-22 13:07:17 | LQ_CLOSE |
55,300,518 | Batch Script: Why Is the first line failing? | I am trying to understand why the first line is failing from a batch script.
if exist reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion" goto OptionOne
exit
:OptionOne
some code
goto:eof
It never goes to OptionOne and just exits. I do have a solution to this problem written differently (so don't provide examples to make it work) but I want to understand why this one liner fails. Improper syntax? But google says its correct. Poorly designed code? I know the regkey exists so thats not it. Is it something with the return value and its correct syntax but needs to be further written out on the else statements? | <batch-file><syntax> | 2019-03-22 13:19:21 | LQ_EDIT |
55,301,561 | Check linux service status and start it if stopped using python script | I have a fixed list of services in a linux server. I want to check the status of these services and start the service if it's stopped. I'm able to get this done using shell script. But, am looking for a Python script to do this. Any help will be appreciated. | <python><linux> | 2019-03-22 14:15:14 | LQ_EDIT |
55,302,720 | sql exception incorrect syntax near 'G' whats the problem? | I have an SQL query created by inserting values from C#.
in c#:string command = "INSERT INTO Phones(devicename, batterylife, price, antutu, ImageURL) VALUES ( " + model + ", " + batterylife + ", " + price + ", " + antutu + ", " + imgURL + " )";
in SQL after parsing: INSERT INTO Phones(devicename, batterylife, price, antutu, ImageURL) VALUES ( Samsung-Galaxy-S10-5G, 0, 0, 0, cdn2.gsmarena.com/vv/bigpic/samsung-galaxy-s10-5g.jpg )
and when trying to execute it visual studio gives the following exception:
System.Data.SqlClient.SqlException
HResult=0x80131904
Message=Incorrect syntax near 'G'.
Source=.Net SqlClient Data Provider
StackTrace:
Cannot evaluate the exception stack trace
also when I replace the regular model name variable with a word visual studio throws the same exception for little g with no location help to understand.
pls help and thnx in advance, Noam. | <c#><sql><visual-studio-2017> | 2019-03-22 15:14:11 | LQ_EDIT |
55,303,862 | How to change a td without it's id? | Actually i'm trying to make something "strange" i have a row in a table where i have the head of the row and 96 td item.
Each row is clickable by the following function
$("#table tr").click(function(){});
Now by getting a value from 0 to 96 i need to get the td in the place X and do a colspan on it.
As in the form i get value 40 i need to make the colspan on the 40th td in the clicked row.
How can i implement something like that in javascript or jquery?
| <javascript><jquery> | 2019-03-22 16:20:56 | LQ_EDIT |
55,304,501 | Andriod studio missing classes (Constraint Layout) | I don't know what's going on.
I search a lot of information on the website,but it still can't work.
Can someone help me ..?
[enter image description here][1]
[1]: https://i.stack.imgur.com/WemgO.png | <android> | 2019-03-22 17:00:24 | LQ_EDIT |
55,305,110 | Doesn't exit after the "exit" command | <p>I'm programming and I'm having an issue.</p>
<pre><code>if exist savefile.climax (
echo It appears you have one...
echo Checking your data...
(
set /p name=
set /p level=
)<savefile.climax
) else (
echo Oh man, you don't have one.
echo Would you like to create it?
choice /c yn /n /m "[Y]es or [N]o?"
if %errorlevel% == 1 goto creation
if %errorlevel% == 2 exit
)
</code></pre>
<p>And as you can see, if the errorlevel is 2 the program should exit, but it doesn't. It keeps going on to the creation code. How could I fix this issue?</p>
| <batch-file> | 2019-03-22 17:40:01 | LQ_CLOSE |
55,307,865 | What is the wrong with called opject in java code | I'm creating a menu based java code and when I create a new object in the main class show me error.
>variable admin has not been initialized
>incompatible string cannot convert to double.
here is the Admin class
`public class Admin extends User{
private String officNo;
private String positon;`
public Admin(String username, String pass, String officeNo, String postion) {
super(username, pass);
}
public void addProduct(Product p){
Store.products.add(p);
the product class
public class Product {
private String name;
private String ID;
private double price;
private String seller;
public Product(String name, String id, double price, String sell){
}
The main class:
public static void main(String[] args) {
Admin admin;
Scanner inter = new Scanner(System.in);
System.out.println("Welcome to our Online Store\n\n if you are an admin enter 1 if user enter 2");
int sw1 = inter.nextInt();
switch(sw1){
case 1:
System.out.println("choose one of the option below: \n"
+ "(1) add a new product to the store\n" +
"(2) delete one of the products\n" +
"(3) update one of the product attributes\n" +
"(4) search if a certain product exits using its ID\n" +
"(5) show the list of products\n"+
"(6) exit" );
int sw2 = inter.nextInt();
switch(sw2){
case 1:
System.out.println("Enter product name: " );
String name=inter.next();
System.out.println("Enter product ID: " );
String id=inter.next();
System.out.println("Enter product price: " );
String price=inter.next();
System.out.println("Enter product seller: " );
String seller=inter.next();
admin.addProduct(new Product(name,id,price,seller);
break;
the error comes in this line
admin.addProduct(new Product(name,id,price,seller);
please any one helep | <java><oop><netbeans> | 2019-03-22 21:14:55 | LQ_EDIT |
55,309,146 | I am creating a word guess game | I'm creating a word guess game that I want to work like this:
https://youtu.be/W-IJcC4tYFI
I have started to write the code. Unfortunately, I'm stuck (really stuck) and I will admit that I'm new to programming.
Your input is greatly need. Please to assist.
Thanks.
I have already created some bootstrap divs that will hold the info of my code.
I have also declare some of my variables.
<div class="container">
<div class="artist row">
</div>
<div class="gamearea row">
<div class="albumarea col-6">
</div>
<div class="actualgame col-6">
<div class="startarea">
<p id="start-text">Press any key to start playing!</p>
</div>
<div class="winsarea">
<p id="wins-text"></p>
</div>
<div class="current-wordarea">
<p id="currentword-text"></p>
</div>
<div class="remaining-guessesarea">
<p id="guessremaining-text"></p>
</div>
<div class="letters-guessedarea">
<p id="letterguessed-text"></p>
</div>
<div class="starts"></div>
</div>
</div>
</div>
<!DOCTYPE html>
<html>
<head>
<title>Word Guess Game</title>
<link rel="stylesheet" type="text/css" href="reset.css">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<div class="artist row">
</div>
<div class="gamearea row">
<div class="albumarea col-6">
</div>
<div class="actualgame col-6">
<div class="startarea">
<p id="start-text">Press any key to start playing!</p>
</div>
<div class="winsarea">
<p id="wins-text"></p>
</div>
<div class="current-wordarea">
<p id="currentword-text"></p>
</div>
<div class="remaining-guessesarea">
<p id="guessremaining-text"></p>
</div>
<div class="letters-guessedarea">
<p id="letterguessed-text"></p>
</div>
<div class="starts"></div>
</div>
</div>
</div>
<script type="text/javascript">
var wins = 0;
var currentword=0;
var letter = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
var Word =["marley", "babyface", "hamilton"];
var solution = word[Math.floor(Math.random() * word.length)]
var solutionlength = solution.length;
var display = [solutionlength];
var lettersguessed = solution.split("");
var guessesremaining = 12;
var output ="";
var win = solutionlength
var letterplayed = "";
document.onkeyup = function(event) {
var userGuess = event.key;
if () {
}
};
</script>
</body>
</html>
| <javascript> | 2019-03-22 23:44:13 | LQ_EDIT |
55,311,228 | How to remove 'Warning: Async Storage has been extracted from react-native core...'? | <p>I've already tried what's recommended in this screenshot</p>
<p><a href="https://postimg.cc/3WvPFHc5" rel="noreferrer"><img src="https://i.postimg.cc/xjxnYfGC/Screenshot-20190323-081232.png" alt="Screenshot-20190323-081232.png"></a></p>
<p>by using this line of code
<code>import AsyncStorage from '../../../node_modules/@react-native-community/async-storage';</code> in the file where I'm importing <code>async-storage</code> from <code>react-native</code>
but this path is unresolved, i.e. <code>async-storage</code> doesn't exist in this directory. I also tried installing <code>async-storage</code> (even though it's already installed) by running <code>yarn add async-storage</code>, but nothing appeared in the previously mentioned directory</p>
| <react-native> | 2019-03-23 06:29:28 | HQ |
55,311,665 | Why am I getting an unexpected "}" syntax error in php file | <p>I'm making a sign up form for my website, I have created my db and wrote my html and php code but I keep getting this error: "Parse error: syntax error, unexpected '}' in D:\XAMPP\htdocs\example\boosie.php on line 73". If I remove it my file wont run on my browser, will just keep loading. Not sure what else is wrong, anything will help me!</p>
<pre><code><?php
$mysqli = new mysqli("127.0.0.1:3307", "root", "", "boosie");
if (mysqli_connect_error()) { echo mysqli_connect_error(); exit; }
// The (?,?,?) below are parameter markers used for variable binding
if(isset($_POST['submit'])){
$sql = "INSERT INTO Signup (First_Name, Last_Name, Email, Password, Re_Password) VALUES (?,?,?,?,?)";
$stmt = $mysqli->prepare($sql);
$stmt->bind_param("sssss", $First_Name, $Last_Name, $Email, $Password, $Re_Password); // bind variables
$First_Name = $_POST['First_Name'];
$Last_Name = $_POST['Last_Name'];
$Email = $_POST['Email'];
$Password = $_POST['Password'];
$Re_Password = $_POST['Re_Password'];
$result=$stmt->execute(); // execute the prepared statement
echo "New records created successfully ";
$stmt->close(); // close the prepared statement
$mysqli->close(); // close the database connection
}else
?>
{
<html>
<head>
<title> Signup Form Design Tutorial </title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="login-box">
<div class="left-box">
<h1> Sign Up</h1>
<form method="post" action="boosie.php">
<input type="text" name="First_Name" placeholder="First_Name"/>
<input type="text" name="Last_Name" placeholder="Last_Name"/>
<input type="email" name="Email" placeholder="Email"/>
<input type="password" name="Password" placeholder="Password"/>
<input type="password" name="Re_Password" placeholder="Retype Password"/>
<input type="submit" name="signup-button" value="Sign Up"/>
</form>
</div>
<div class="right-box">
<span class="signinwith">Sign in with<br/>Social Network </span>
<button class="social facebook">Log in with Facebook</button>
<button class="social twitter">Log in with Twitter</button>
<button class="social google">Log in with Google+</button>
</div>
<div class="or">OR</div>
</div>
</body>
</html>
<?php
}
?>
</code></pre>
| <php><forms> | 2019-03-23 07:37:45 | LQ_CLOSE |
55,312,198 | Can Python make an OS similar to Windows? | <p>I want to make a OS that could be gaming-friendly (like Windows) yet easy to use. I can already use Python perfectly fine, and I'm looking to see if I could make an OS with it. Is it possible? If not, what are some Python-like coding languages that I could use?</p>
<p>I've looked in to Buildroot but it uses the Makefile language which I am extremely confused about, it's just non-logical (at least to me).</p>
<p>I expect it to be possible because C# is <strong><em>quite</em></strong> the complex language and it works fine.</p>
| <python><operating-system> | 2019-03-23 09:05:56 | LQ_CLOSE |
55,312,789 | How to directly write to CSV using PHP | <p>I'm trying to use 'for loop' and write directly to csv without inserting into database and export as csv file.</p>
<pre><code><?php
require_once('function.php');
for ($i=0; $i < 6000; $i++) {
# code...
$colum1= generatePassword(5);
$colum2 = serial_number(5);
#write directly to csv file
}
</code></pre>
| <php> | 2019-03-23 10:31:53 | LQ_CLOSE |
55,316,173 | is there a way to insert a pause after a scan command? | <p>I am making a project in java and this is my first live Project. I am using the scanner class for the first time. I encountered this problem where the compiler skips my scan commands and goes on to the next output command. When i run the given code, it displays the following</p>
<blockquote>
<p>PS: my project is not even near completion so my code looks very rough and not even complete. so please do not remind me. Thank you :)</p>
</blockquote>
<pre><code>
import java.util.Scanner;
import java.io.*;
public class A{
public static void main(String ... args){
Scanner scan = new Scanner(System.in);
System.out.println("\n");
System.out.println(" Grand Theft Auto Online Profit Calulator");
System.out.println("Choose one of the following option:");
System.out.println("1.Existing User");
System.out.println("2.First time");
int user = scan.nextInt();
if(user == 2)
{
// ask for bunker
System.out.println("Do you own a bunker? Enter y or n");
String bunks = scan.nextLine();
//ask for nightclub
System.out.println("Do you own a Nightclub? Enter y or n");
String nclub = scan.nextLine();
// ask for crates warehouse
System.out.println("Do you own a Crates Warehouse? Enter y or n");
String cratesboi = scan.nextLine();
}
}
}
</code></pre>
<p>RESULT:</p>
<pre><code>Do you own a bunker? Enter y or n
Do you own a Nightclub? Enter y or n
y
Do you own a Crates Warehouse? Enter y or n
n
</code></pre>
<p>it shows the nightclub display straight after the bunker one without asking for an answer. whereas in crates the case is defference. i expected the compiler to ask me if i own a bunker or not but it did not</p>
| <java> | 2019-03-23 16:57:39 | LQ_CLOSE |
55,316,968 | How can I send Data by an form without an inputfield? | I want to send data to another html file by a form, but i don't want to use an inputfield I just want to send an ID to the other file. How can I add the ID to the URL, when I want to get the Data by location.search?
<form method="GET" action="secondHTML.html">
<div class="modal-footer">
<button type="submit" name="ID" class="btn btn-primary">Save</button>
</div>
</form> | <javascript><html> | 2019-03-23 18:19:49 | LQ_EDIT |
55,317,440 | Can someone explain why the program shows me 6 and 4? | <p>In this problem,which is an easy and a simple one, i do the sum and the product. I wanted to do with a "for" instruction to understand how this thing is working.</p>
<pre><code>#include < iostream >
using namespace std;
int main()
{
int n,i,s=0,p=1;
cin>>n;
for (i=1;i<=n;i++)
s=s+i;
p=p*i;
cout<<s<<" "<<p;
}
</code></pre>
<p>I can't explain why the result is "6" for sum and "4" for product...</p>
<p>Can someone explain me why the code is showing this?
If i put the instructions from the "for" structure between of braces,it is showing "6" for sum and "6" for product.</p>
| <c++> | 2019-03-23 19:12:32 | LQ_CLOSE |
55,318,664 | Program that generates a serie of carachtere from 1 to 1000 that includes numbers and letters | <p>I would like to create a program that generates a serie of carachtere from 1 to 1000 that includes numbers and letters .
for example : 0001 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b 000c 000d 000e 000f ... 000z 0010 00011 ...</p>
| <c++><bash> | 2019-03-23 21:40:28 | LQ_CLOSE |
55,318,938 | Jenkins High CPU Usage Khugepageds | <p><a href="https://i.stack.imgur.com/MCvXn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MCvXn.png" alt="enter image description here"></a></p>
<p>So the picture above shows a command <code>khugepageds</code> that is using <code>98</code> to <code>100</code> <code>%</code> of CPU at times.</p>
<p>I tried finding how does <code>jenkins</code> use this command or what to do about it but was not successful. </p>
<p>I did the following </p>
<ul>
<li><code>pkill</code> jenkins </li>
<li>service jenkins stop</li>
<li>service jenkins start</li>
</ul>
<p>When i <code>pkill</code> ofcourse the usage goes down but once restart its back up again.</p>
<p>Anyone had this issue before?</p>
| <jenkins><centos> | 2019-03-23 22:25:06 | HQ |
55,319,570 | How can I raise a number to power in javascript? | <p>Please what is the simplest method to exponentiate a number
Cus I don't see it in the javascript arithematic operators </p>
| <javascript> | 2019-03-24 00:11:45 | LQ_CLOSE |
55,319,631 | Can't load workbook using openpyxl | I have problem to load excel using openpyxl. Can someone help out, thanks.
openpyxl.__version__
'2.5.12'
jupyter version
5.7.4
os.getcwd()
'/Users/barbara/Documents/17_BMO'
path = "Users/barbara/Documents/17_BMO/Region.xlsx"
wb1 = openpyxl.load_workbook(path)
I got error message:FileNotFoundError: [Errno 2] No such file or directory: 'Users/barbara/Documents/17_BMO/Region.xlsx' | <python><jupyter-notebook><openpyxl> | 2019-03-24 00:23:59 | LQ_EDIT |
55,319,840 | How do you shift a signal to reference a virtual ground in an instrumentation amplifier? | <p>I'm working on a circuit that needs to amplify a signal based on a changing resistance. The hardware that I have to work with can only make an offset square wave, but I need an input that is centered around 0V. I have tried using an instrumentation amplifier with one voltage set as the excitation signal and the other is the virtual ground, but it still fails to center the signal.</p>
<p>Any ideas of what to do to shift the signal?<a href="https://i.stack.imgur.com/1XhlI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1XhlI.png" alt="circuit"></a></p>
| <electronics><circuit-diagram> | 2019-03-24 01:04:28 | LQ_CLOSE |
55,320,041 | PHP error: Parse error: syntax error, unexpected '->' | <p>I am new to PHP. I am trying to create a textbox in html, and take the input via php and store it in my Mysql database.</p>
<p>I can't get past this error.</p>
<p><strong>Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)</strong></p>
<p>I understand the <code>-></code> is wrong. But I don't know how to fix it.</p>
<p>Also is there any other errors that you guys see in this code? I appreciate your help.</p>
<pre class="lang-php prettyprint-override"><code> <form action="user-post.php" method="get">
<input type="post-box" name="postbox" required>
<input type="submit" value="Submit">
</form>
<?php
session_start();
$_SESSION['message'] = '';
$mysqli = new mysqli('localhost:3306', 'root', '1234', 'status-box');
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$postbox = mysqli->real_escape_string($_GET['postbox']);
$sql = "INSERT INTO post (postbox)"
. "VALUES ('$postbox')";
if ($mysqli->query($sql) === true) {
header("location: index.html");
} else {
$_SESSION['message'] = "Post could NOT be added to the database!";
}
}
?>
</code></pre>
| <php><html><mysql><forms> | 2019-03-24 01:48:40 | LQ_CLOSE |
55,320,826 | Google Cloud Text-to-speech word timestamps | <p>I'm generating speech through Google Cloud's text-to-speech API and I'd like to highlight words as they are spoken.</p>
<p>Is there a way of getting timestamps for spoken words or sentences?</p>
| <text-to-speech><speech-synthesis><google-text-to-speech> | 2019-03-24 04:50:03 | HQ |
55,321,041 | 'mat-card' is not a known element in Angular 7 | <p>I've seen a lot of questions on this but doesn't seem to be the same issue Im encountering. I have just created my 2nd angular project. I have a new component under <code>src/app/employees</code> where I am trying to use in employees.component.html . The error I am getting is:</p>
<pre><code>Uncaught Error: Template parse errors:
'mat-card' is not a known element:
1. If 'mat-card' is an Angular component, then verify that it is part of this module.
2. If 'mat-card' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<mat-card> </mat-card>
</code></pre>
<p>Now, in app.module.ts I have:</p>
<pre><code>import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { LOCALE_ID, NgModule } from "@angular/core";
import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
import {
MatButtonModule,
MatFormFieldModule,
MatIconModule,
MatInputModule,
MatListModule,
MatSelectModule,
MatSidenavModule,
MatCardModule,
MatTableModule
} from "@angular/material";
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule,
BrowserAnimationsModule,
AppRoutingModule,
HttpClientModule,
MatButtonModule,
MatFormFieldModule,
MatIconModule,
MatListModule,
MatInputModule,
MatSelectModule,
MatSidenavModule,
MatCardModule,
MatTableModule
],....
})
export class AppModule {}
</code></pre>
<p>And there aren't any errors if I use <code>mat-card</code> in <code>app.component.html</code>.
What am I missing here? </p>
| <html><angular><angular-material> | 2019-03-24 05:39:22 | HQ |
55,321,330 | can't edit .bashrc while it is already present in the directory | <p>I'm setting up zsh in my Windows subsystem for Linux in my windows 10 machine by following some tutorial which instructs on opening my bash profile by the following command </p>
<pre><code>vim~/.bashrc
</code></pre>
<p>but it says</p>
<pre><code>bash: vim~/.bashrc: No such file or directory
</code></pre>
<p>I've tried using </p>
<pre><code>ls -la ~/ | more
</code></pre>
<p>which shows the file is present, even tried copying it from the /etc/skel but still no luck</p>
| <linux><bash><ubuntu><windows-subsystem-for-linux> | 2019-03-24 06:38:59 | LQ_CLOSE |
55,323,574 | Why is my code not working (Error: str object is not callable) | <p><strong>You get a Task to solve (math).
- No taks with solutions below zero
- No tasks with solutions that have decimal places</strong></p>
<p>When the loop runs the first time everything works just fine. But after the first task it sends this error:</p>
<p>File ".\Task Generator.py", line 43, in
input = input()
TypeError: 'str' object is not callable</p>
<p>What is the problem with the User Input?</p>
<p>I tried to restructure the whole input part. But then the whole code doesn´t work.</p>
<pre class="lang-py prettyprint-override"><code>import random
score = 0
#Loop
loop = True
while loop == True:
tasksolution = None
#Task generation
badtask = True
while badtask == True:
nums = list(range(1, 101))
ops = ["+", "-", "/", "x"]
num1 = str(random.choice(nums))
num2 = str(random.choice(nums))
operator = random.choice(ops)
task = str(num1 + operator + num2)
#Tasksolution
def add(x, y):
return x + y
def subtract(x, y):
return x - y
def multiply(x, y):
return x * y
def divide(x, y):
return x / y
if operator == "+":
tasksolution = round(add(int(num1), int(num2)), 1)
elif operator == "-":
tasksolution = round(subtract(int(num1), int(num2)), 1)
elif operator == "x":
tasksolution = round(multiply(int(num1), int(num2)), 1)
elif operator == "/":
tasksolution = round(divide(int(num1), int(num2)), 1)
if tasksolution >= 0 and (tasksolution % 2 == 0 or tasksolution % 3 == 0):
badtask = False
#User input
print("Task: " + task)
input = input()
#Input check
if str.isdigit(input):
if int(input) == tasksolution:
print("Correct!")
score + 1
elif not int(input) == tasksolution:
print("Wrong!")
print("The correct solution: " + str(tasksolution))
print("You´ve solved " + str(score) + " tasks!")
break
else:
print("Something went wrong :(")
else:
print("Please enter a number!")
break
</code></pre>
<p>The loop should run without breaking except you enter a wrong solution.</p>
| <python> | 2019-03-24 12:02:09 | LQ_CLOSE |
55,323,638 | How to parse array from string | This is my input
String str = "{\"myKey\":[{\"myHhome\":\"home1\",\"myAddress\":\"add\",\"dateTimeStamp\":\"Wed, 20 Mar 2019 14:38:54 GMT\"}],\"basedata\":{\"mydata\":{\"mytype\":\"m1\",\"mytype2\":\"m2\"}}}";
I chekced the json and it is valid
I want to use GSON to get the value of the myHhome ( in my case hom1)
static class Myclass{
public String generation = null;
}
final Gson GSON1 = new Gson();
String result= GSON1.fromJson(str,Myclass.class);
System.out.println(result);
but i got null
| <java><json><gson> | 2019-03-24 12:08:38 | LQ_EDIT |
55,325,170 | How to upload images to a database with other details using postman | <p>I want to upload a image with other details like employee id, employee name etc using spring boot and spring data jpa, trying to send request using postman.I have searched a lot but I cannot find any examples sending both image and other details in one method, as I am a fresher unable to find exact solution and also I don't want to use ObjectMapper to read values.Can some one help me.
Thanks in advance</p>
| <spring><spring-boot><spring-data-jpa><postman> | 2019-03-24 15:05:08 | LQ_CLOSE |
55,325,485 | 'why i'm getting error when i used my print function print(list(my_iter)) in below code? | **[when im using print(list(my_iter)) in code before printing print(my_iter.__next__()) it is throwing error.bu][1]**
[enter image description here][2]
but if I comment it. it running fine. why it is happening
[1]: https://i.stack.imgur.com/kCoVr.png
[2]: https://i.stack.imgur.com/9a0yQ.pngt | <python-3.x><pycharm> | 2019-03-24 15:38:09 | LQ_EDIT |
55,325,707 | How do I identify the Python version code was written for | <p>how do I identify if Python code was written for 2.7 or 3.x automatically. </p>
<p>Thank you </p>
| <python><python-3.x><python-2.7> | 2019-03-24 16:02:26 | LQ_CLOSE |
55,325,798 | Mysql query - Count the founded rows on joined table | <p>I have two tables</p>
<p>First one: Offers</p>
<p>id
user_id
user_data</p>
<p>The second one: Orders</p>
<p>id
user_id</p>
<h2>order_data</h2>
<p>Now, the goal is, to get the list of the OFFERS including the count of the orders table, where orders.user_id == offers.user_id</p>
<p>the result must be:</p>
<p>id
user_id
orders_count</p>
<hr>
<p>Thank you in advance!</p>
| <php><mysql><codeigniter> | 2019-03-24 16:11:01 | LQ_CLOSE |
55,326,372 | No name was provided for external module | <p>I created a data library, then tried to include the data library into another created library. Built fine, but received - "No name was provided for external module 'my-data' in output.globals – guessing 'myData'". What am I missing?</p>
<p>Complete steps to re-create.</p>
<ul>
<li>ng new test-project --create=application=false</li>
<li>cd test-project</li>
<li>npm audit fix</li>
<li>ng g library my-data</li>
<li>ng g library my-core</li>
<li>ng g application address-book</li>
<li>ng build my-data</li>
<li>Then in my-core.module add import { MyDataModule } from 'my-data';</li>
<li>Then in my-core.module add imports: [MyDataModule]</li>
<li>ng build my-core</li>
</ul>
<p>my-core.module.ts</p>
<pre><code>import { NgModule } from '@angular/core';
import { MyCoreComponent } from './my-core.component';
import { MyDataModule } from 'my-data';
@NgModule({
declarations: [MyCoreComponent],
imports: [MyDataModule],
exports: [MyCoreComponent]
})
export class MyCoreModule { }
</code></pre>
<ul>
<li>After build get "No name was provided for external module 'my-data' in output.globals – guessing 'myData'"</li>
</ul>
| <angular><angular7> | 2019-03-24 17:12:55 | HQ |
55,326,676 | Cant find the image links to images on the website in html I bought. I own it, but where is it? | <p>I can't find the link in the html to 3 images on the front page of my website. The black spy on green background and the two black graphs on green background. The website is here : home.alphaphoner.com it's a template I bought online, but now I want to update it and I can't. Can anyone find the links?</p>
| <html><image><hyperlink><hidden> | 2019-03-24 17:45:22 | LQ_CLOSE |
55,326,942 | Is it still relevant to use Repository Pattern in a laravel application?” | <p>I'm setting up a new laravel project, and want to reduce code in my controllers. Do I need to use repository pattern?”</p>
| <laravel><laravel-5><eloquent><repository-pattern> | 2019-03-24 18:13:40 | LQ_CLOSE |
55,327,633 | Getting Used Undeclared dependencies | <p>While installing project, I have got an error which says "Used undeclared dependencies found"</p>
<p>I tried using maven dependency plugin and used tag. But still, the error is same.</p>
<p>Then I tried explicitly adding the dependency in the main pom, but still the same error was thrown.</p>
<p>Can anyone help me in this situation?</p>
<p>Thanks in advance.</p>
| <java><maven><dependencies> | 2019-03-24 19:24:37 | LQ_CLOSE |
55,328,311 | What is the most recent correct syntax to initialize the Google Mobile Ads SDK in the App Delegate file? | <p>All of a sudden, I get a warning on the code used to initialize the Google Mobile Ads SDK. (It had been working for weeks before with no warning, but now it seems there's a new way to write the code.)</p>
<p>This is the code I have:</p>
<pre><code>GADMobileAds.configure(withApplicationID: "ca-app-pub-################~##########")
</code></pre>
<p>But it gives me this warning: 'configure(withApplicationID:)' is deprecated: Use [GADMobileAds.sharedInstance startWithCompletionHandler:]</p>
<p>I've tried to rewrite it like this (with and without the square brackets):</p>
<pre><code>GADMobileAds.sharedInstance startWithCompletionHandler: "ca-app-pub-################~##########"
</code></pre>
<p>But it just gives me an error that it expected a ;.</p>
<p>How should I write this? Thank you!</p>
<p><img src="https://i.imgur.com/YLTqdPc.png" alt="files from Pods folder in Xcode show a modified status"></p>
| <xcode><swift4> | 2019-03-24 20:35:32 | HQ |
55,328,577 | Web apps without HTML or Javascript using WebAssembly and Dart? | <p>With the introduction of WebAssembly (<a href="https://webassembly.org/" rel="nofollow noreferrer">https://webassembly.org/</a>) it will be possible to run a web app in a web browser by using Dart without using Javascript and HTML at all?</p>
| <dart> | 2019-03-24 21:06:11 | LQ_CLOSE |
55,330,247 | Is there a way to pass a variable after 5 seconds? | <p>I'm creating a desktop app with Swift and I need to pass a <code>stop</code> boolean after 5 seconds. How do I do this?</p>
| <swift><macos><macos-mojave><swift5> | 2019-03-25 01:28:19 | LQ_CLOSE |
55,331,559 | select name,(name,1,3||phone_no,1,3)from users order by (name); | I'm writing a query for the above problem and it is showing error.
Write a to display user name and password. Password should be generate by concatenate first three characters of user name and first three numbers in phone number and give an alias name as password. Sort the result based on user name | <sql><oracle> | 2019-03-25 05:11:07 | LQ_EDIT |
55,332,634 | Making an element in reverse side using css | <p>I want to make an element inside html to be displayed in reverse side or direction including images and text. See the image <img src="https://i.ibb.co/VCZTb4j/Screen-Shot-2019-03-25-at-11-22-37-AM.png" alt="normal"></p>
<p>I expect to have as an example:
<img src="https://i.ibb.co/1qDGNKy/opposite.png" alt="after"></p>
| <html><css> | 2019-03-25 06:59:48 | LQ_CLOSE |
55,332,900 | Copying Double to a void pointer in C++ | <p>I'm copying a double value to a Void*.How can I do it in C++.</p>
<p>Currently I've tried in C++10</p>
<p>strcpy(Trade->MtTr.MPData->MPTrXML.da,dCou);</p>
<p>Trade->MtTr.MPData->MPTrXML.da-->this is a Void*</p>
<p>dCou is double.</p>
<p>strcpy(Trade->MtTr.MPData->MPTrXML.da,dCou);</p>
<p>I expect the void* should contain the double value.
In actual I'm getting error as:</p>
<p>error C2665: 'strcpy' : none of the 2 overloads could convert all the argument types</p>
<p>while trying to match the argument list '(void *, double)'</p>
| <c++><visual-c++> | 2019-03-25 07:21:27 | LQ_CLOSE |
55,333,587 | saparate object to array of object | <p>i dont know how to make for loop to create new array of object with javascript coding</p>
<p>here i have some object like this</p>
<pre><code>item :[
{
res_name: 'a',
id: 1,
name: name1
},
{
res_name: 'b',
id: 2,
name: name2
},
{
res_name: 'b',
id: 3,
name: name3
}
]
</code></pre>
<p>i want to change to array of object like this</p>
<pre><code>product:[
{
res_name: 'a',
product:[
{
id: 1,
name: name1
}
]
},
{
res_name: 'b',
product:[
{
id: 2,
name: name2
},
{
id: 3,
name: name3
}
]
}
]
</code></pre>
<p>can someone help me</p>
| <javascript><angularjs> | 2019-03-25 08:13:33 | LQ_CLOSE |
55,334,879 | Why does the compiler allow throws when the method will never throw the Exception | <p>I am wondering why the java compiler allows throws in the method declaration when the method will never throw the Exception. Because "throws" is a way of handling the exception (telling the caller to handle it).</p>
<p>Since there are two ways of handling exception (throws & try/catch). In a try/catch, it doesn't allow the catch of an exception not thrown in the try block but it allows a throws in a method that does may not throw the exception.</p>
<pre><code>private static void methodA() {
try {
// Do something
// No IO operation here
} catch (IOException ex) { //This line does not compile because
//exception is never thrown from try
// Handle
}
}
private static void methodB() throws IOException { //Why does this //compile when excetion is never thrown in function body
//Do Something
//No IO operation
}
</code></pre>
| <java><checked-exceptions> | 2019-03-25 09:38:08 | HQ |
55,335,808 | Command CodeSign failed with non zero when deploying to device | I received this error when trying to deploy application to device. I am using XCode 10.1 with free developer account. In signing section I set personal team with signing certificate iPhone Developer. I can ran the app in iOS simulator but not run in real device.
| <ios><xcode><xcode10><codesign> | 2019-03-25 10:32:24 | LQ_EDIT |
55,336,731 | how to get vaule of function if return type is class | I am new in c# dot net and i am using trying to calling soap web service.
one of function in webservice returning class type. I am not able to get how I will return the value to type class.
Below is my function
AuthenticateUser(string user_name, string password);
this function is returning class EQUser.
class consist of varialbles
user_id int
user_name string
level int
user_group_id int
password string
extended_permissions int
email_id string
email_username string
guid string
how i typecast AuthenticateUser function to get these above value
I have tried
ServiceReference1.EqClient user = new ServiceReference1.EqClient();
ServiceReference1.EQUsers equsr = new ServiceReference1.EQUsers();
user.EQAuthenticateUser("admin", "");
how i will typecast user.EQAuthenticateUser("admin", "");
to ServiceReference1.EQUsers class | <c#><asp.net> | 2019-03-25 11:24:34 | LQ_EDIT |
55,338,032 | How to fix Syntax error insert '}' to complete block | I'm keep getting an error with my code. I'm creating a simple user-defined function for Neo4j. Can anyone help me with this? No matter what I try I get "Syntax Error: Insert "}" to complete block." When I insert "}" it gives me an error saying that my code is "unreachable" and when I add a bracket to make it reachable it takes me back to the first error and it just loops.
Here is my code:
public class Join {
static Cipher cipher;
@UserFunction
@Description("example.DES ,, Decryption of any input values.")
public byte[] DES( @Name("set1") List<String> strings1) {
for (int i = 0; i < strings1.size(); i++) {
String dot;
dot = strings1.get(i);
KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
keyGenerator.init(128);
SecretKey secretKey = keyGenerator.generateKey();
cipher = Cipher.getInstance("AES");
String encryptedText = encrypt(dot, secretKey);
System.out.println("Encrypted Text After Encryption: " + encryptedText);
}
public static String encrypt(String dot, SecretKey secretKey)
throws Exception {
byte[] plainTextByte = dot.getBytes();
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] encryptedByte = cipher.doFinal(plainTextByte);
Base64.Encoder encoder = Base64.getEncoder();
String encryptedText = encoder.encodeToString(encryptedByte);
return encryptedText;
}
}
| <java><neo4j><user-defined-functions> | 2019-03-25 12:40:24 | LQ_EDIT |
55,340,143 | Need some help porting Java code Android Studio to C# Visual Studio | <p>I need some help porting a piece of Java code to C#. The code is about a post request to a web api, to make the connection I used Volley in Java and I've already installed the NuGet in Visual Studio. I have trouble converting a StringRequest function to C#.</p>
<p>This is the piece of code that I'm currently trying to port in C# but I get errors when declaring the params in C#. For example it doesn't recognize the Request.Method and the new Response.Listener.</p>
<pre><code>StringRequest stringRequest = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>()
{
@Override
public void onResponse(String response)
{
Log.i("Volley Response", response);
}
}, new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error)
{
Log.e("Volley Error", error.toString());
}
})
{
@Override
public String getBodyContentType()
{
return "application/json; charset=utf-8";
}
@Override
public byte[] getBody()
{
try
{
return requestBody.getBytes("utf-8");
}
catch (UnsupportedEncodingException uee)
{
return null;
}
}
};
requestQueue.add(stringRequest);
return stringRequest;
</code></pre>
<p>If someone could be so nice to help me porting it to C# I would be very happy.</p>
| <java><c#><porting> | 2019-03-25 14:30:43 | LQ_CLOSE |
55,340,308 | Need help please on powershell | hello Everyone,
I Need your help please, actually i just started a new job and i have to create a script to :
-1 list all certificate on Azure plateforme,
-2 including expiration date
-3 including sending an alert before expiration in order to anticipate the update.
all SSL certificate and VM and Webapp and websites must be included.
actually i have started by loocking on the internet and i have found some script but actually i would like to learn so if you can help me please i'll offer the Coffee :-)
i have made some changes on my script so i can adapt it to the environment but i still need your help
Best Regards
list all certificate on vault (NOK)
List certificate on a subscription (ok)
include alert on expire date (NOK)
# Connect to Azure
Write-Host "Login to Azure"
Login-AzureRmAccount
# Select $subscription
Write-Host "Select subscription $subscription"
Get-AzureRmSubscription -SubscriptionName $subscription | Select-AzureRmSubscription | <azure><powershell><ssl> | 2019-03-25 14:39:29 | LQ_EDIT |
55,340,953 | i want to Get Single Value From SQLite Database [C#] | <p>i am trying to get single value from sqlite database but i am facing error</p>
<p>so i can do some action to this value or check it </p>
<p><img src="https://www11.0zz0.com/2019/03/25/18/254767394.jpg" alt="a busy cat"></p>
<pre><code>dbConnection StartConn = new dbConnection();
SQLiteConnection MyConnetion = StartConn.GetConnection();
SQLiteCommand Cm = new SQLiteCommand(" select * from Users where user_username = '" + txtBxUserName.Text + "' and user_password = '" + txtBxPassword.Text + "'", MyConnetion);
MyConnetion.Open();
SQLiteDataReader dr = Cm.ExecuteReader();
dr.Read();
int count = Convert.ToInt32(Cm.ExecuteScalar());
if (count != 0)
{
globalVariables.userFullName = dr["user_name"].ToString();
globalVariables.appLoginUser = dr["user_username"].ToString();
globalVariables.appPasswordUser = dr["user_password"].ToString();
globalVariables.userPermissions = dr["user_permissions"].ToString();
mainForm newMainForm = new mainForm();
newMainForm.Show();
this.Hide();
MyConnetion.Close();
</code></pre>
| <c#><sqlite> | 2019-03-25 15:13:02 | LQ_CLOSE |
55,341,391 | Best data structor for a dynamic array | I look for a best data structure that alows me to:
- create a dynamic array.
- complexity of inserting is O(1).
- complexity of check if an element exists or not is O(1). | <java><design-patterns><strategy-pattern> | 2019-03-25 15:37:06 | LQ_EDIT |
55,341,605 | I get local ip address from request | <p>I am using Spring boot and when i try to get user ip from request like this :</p>
<pre><code>request.getRemoteAddr();
</code></pre>
<p>I get 127.0.0.1 for every user.</p>
| <java> | 2019-03-25 15:48:04 | LQ_CLOSE |
55,343,221 | Why the function String.Equals(Object obj) compares the string with an object and not necessarily with a string | <p>I don't understand why would you want to compare a string with anything but another string, why <code>String.Equals(Object obj)</code> and not <code>String.Equals(String str)</code></p>
<p>Is there a specific reason for that?</p>
| <java><string><object> | 2019-03-25 17:16:05 | LQ_CLOSE |
55,343,576 | Powershell -lt and -gt giving opposite of expected results | <p>In the below code, if I add a where-object, -lt & -gt are giving opposite of expected results. </p>
<p>I'm sure the reason is I'm stupid, but in what specific way am I messing up? </p>
<p>This part gives the expected results, where in my case, the single drive has %Free of 39.8</p>
<pre><code>Get-WmiObject -Namespace root\cimv2 -Class win32_logicaldisk | where-object -Property drivetype -eq 3 |
format-table deviceid,
@{n='GB Capacity';e={$_.size/1gb}},
@{n='GB Free';e={$_.freespace/1gb}},
@{n='%Free';e={($_.freespace/$_.size)*100}}
</code></pre>
<p>But adding this</p>
<pre><code>| where {$_.'%Free' -gt 10}
</code></pre>
<p>Results in no output. In fact </p>
<pre><code>| where {$_.'%Free' -gt 0}
</code></pre>
<p>Produces no results. Instead I have to use</p>
<pre><code>| where {$_.'%Free' -lt 0}
</code></pre>
<p>Powershell thinks %Free is a negative number, I guess? </p>
| <powershell><get-wmiobject> | 2019-03-25 17:37:16 | LQ_CLOSE |
55,343,803 | Error - int 'counter' was not declared in this scope | <pre><code>\main112.cpp In function 'int main()':
63 36 \main112.cpp [Error] 'counter' was not declared in this scope
28 \Makefile.win recipe for target 'main112.o' failed
</code></pre>
<pre><code>#include <string>
#include <iostream>
#include <windows.h>
#include <stdlib.h>
using namespace std;
struct Person
{
string name;
string race;
int weight;
void write();
void show();
void check();
};
void Person::show()
{
cout<<"ÔÈÎ: "<<name<<endl;
cout<<"Íîìåð ðåéñà: "<<race<<endl;
cout<<"Âåñ áàãàæà: "<<weight<<endl;
}
void Person::write()
{
cout<<"Ââåäèòå ÔÈÎ: ";
getline(cin,name);
cout<<"Ââåäèòå íîìåð ðåéñà: ";
getline(cin,race);
cout<<"Ââåäèòå âåñ áàãàæà: ";
cin>>weight;
cin.ignore();
}
void Person::check()
{
int counter = 0;
if(weight>10)
{
counter++;
}
}
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
setlocale(0, "Russian");
Person* persons=new Person[4];
for (int i = 0; i < 4; i++)
{
persons[i].write();
}
for (int i = 0; i < 4; i++)
{
persons[i].show();
persons[i].check();
}
cout<<"Ñ áàãàæîì áîëüøå 10 êã: "<<counter<<" ÷åëîâåê"<<endl;
delete[] persons;
return 0;
}
</code></pre>
<p>Program that works the way its coded and should work, without this problem</p>
<p>Homework:</p>
<p>Write a program for processing passenger information. Information includes:
1) Full name of the passenger.
2) Flight number.
3) Luggage weight
The program should allow the user to:
1) Read data from the keyboard and display it.
2) Calculate the number of passengers with the weight of baggage which is more than 10 kg</p>
| <c++> | 2019-03-25 17:50:36 | LQ_CLOSE |
55,343,858 | static inline void function has warning "control reaches end of non-void function" | <p>I currently have the following function in C:</p>
<pre><code>static inline void *cmyk_to_rgb(int *dest, int *cmyk)
{
double c = cmyk[0] / 100.0;
double m = cmyk[1] / 100.0;
double y = cmyk[2] / 100.0;
double k = cmyk[3] / 100.0;
c = c * (1 - k) + k;
m = m * (1 - k) + k;
y = y * (1 - k) + k;
dest[0] = ROUND((1 - c) * 255);
dest[1] = ROUND((1 - m) * 255);
dest[2] = ROUND((1 - y) * 255);
}
</code></pre>
<p>When compiling, I am warned that</p>
<pre><code>warning: control reaches end of non-void function [-Wreturn-type]
</code></pre>
<p>I've tried adding an explicit <code>return</code> at the end of the function body and that results in an outright error. What is the proper way to resolve this warning? Any solutions I've found online involve adding a return statement where the function is supposed to return some value (<code>int</code> etc.), but that is not the case here.</p>
| <c><warnings><void><gcc-warning> | 2019-03-25 17:55:05 | LQ_CLOSE |
55,343,939 | i'm trying to apply ajax to my tbody only not all table | 1- i`m trying to apply Ajax to my tbody only not all my table but i can`t do
this the ajax working good if i put my complete table in page. i want to split my table header & tbady to be in separated page. the following code is ajax :
`function jsQueryData(){
var objData = {
action : actionSplit0 +'/QueryData',
};
$.post(
index_File,
objData,
function(data, status){
$('#table-container').html(data)
},
'html'
)}`
2- this is the code of my table "if i put the table code completely in one page the ajax working good":
<table class="table table-striped table-bordered table-hover
main-table-h">
<thead>
<tr>
<td scope="col" class="search-th">
<input type="text" name="" value=""> <!-- for search -->
</td>
</tr>
<tr>
<th scope="col" class="align-top">item no</th>
</tr>
</thead>
<tbody>
<?php foreach ($allData1 as $data): ?>
<tr>
<td><?=$data->{2}; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
3- i tried to split the above code to be tbody in separate page but the data didn't come as a table but all td come together | <php><ajax> | 2019-03-25 18:00:55 | LQ_EDIT |
55,344,290 | unhashable type: 'list' while in function, but works well outside the function | <p>I am going to write a function instead of my old line by line code but looks like it doesn't work.</p>
<p>This piece of code works well:</p>
<pre><code> def gdp_fdi(odf, colname):
tempo = odf[odf['id'].str.contains(temp, na=False)]
df = tempo[['id',colname]]
return df
def sortdf(df):
df['id'] = pd.Categorical(df.id, categories = top20code, ordered = True)
df.sort_values(by='id')
return df
<THIS PART>
top20 =fdi.sort_values('fdi_1987',ascending = False).groupby('fdi_1987').head(2)
top20 = top20[['fdi_1987','id']].head(21)
top20code = top20['id']
top20code = top20code.to_string(index=False)
top20code = top20code.split()
temp = '|'.join(top20code)
top20_name=gdp_fdi(wb,'name')
top20_region=gdp_fdi(wb,'region')
top20_gdp=gdp_fdi(gdp,'gdp_1987')
sort20gdp=sortdf(top20_gdp)
sort20region=sortdf(top20_region)
sort20name=sortdf(top20_name)
from functools import reduce
lists=[sort20gdp,sort20region,sort20name]
df = reduce(lambda df1, df2: pd.merge(left=df1, right=df2, on=["id"], how="inner"), lists)
df['id'] = pd.Categorical(df.id, categories = top20code, ordered = True)
df.sort_values(by='id')
raw=df.sort_values(by='id')
raw
</THIS PART>
</code></pre>
<p>but when I write it as a function, I use <code>'fdi_'+str(year)</code> instead of <code>'fdi_1987'</code> and write <code><THIS PART></code> as a function named <code>top20(year)</code>.</p>
<p>But when I run the fuction by <code>top20(1987)</code>, it sais I have </p>
<blockquote>
<p>unhashable type: 'list'</p>
</blockquote>
<p>May I ask why? any tips for redesign the function?</p>
| <python><python-3.x> | 2019-03-25 18:25:06 | LQ_CLOSE |
55,344,366 | Remove character from a string until a special character python | I have a string like this.
config =\
{"status":"None",
"numbers":["123", "123", "123"],
"schedule":None,
"data":{
"x": "y"
}
}
I would like to remove the config=\ from the string and get a result like this.
{"status":"None",
"numbers":["123", "123", "123"],
"schedule":None,
"data":{
"x": "y"
}
}
How can I get this using python regex? Would like to consider the multiline factor as well!! | <python><json><regex><python-3.x> | 2019-03-25 18:31:10 | LQ_EDIT |
55,344,725 | i can not identify the mistake in my code | <p>// i dont know where is the problem here </p>
<p>package javaapplication3;
import java.util.Scanner;</p>
<p>public class JavaApplication3
{</p>
<pre><code>public static void main(String[] args)
{
Scanner keyboard=new Scanner(System.in);
int num1,num2;
String input;
input= new String();
char again;
while (again =='y' || again =='Y')
{
System.out.print("enter a number:");
num1=keyboard.nextInt();
System.out.print("enter another number:");
num2=keyboard.nextInt();
System.out.println("their sum is "+ (num1 + num2));
System.out.println("do you want to do this again?");
}
}
</code></pre>
| <java><loops><while-loop><char> | 2019-03-25 18:55:49 | LQ_CLOSE |
55,344,925 | How to make sure a React state using useState() hook has been updated? | <p>I had a class component named <code><BasicForm></code> that I used to build forms with. It handles validation and all the form <code>state</code>. It provides all the necessary functions (<code>onChange</code>, <code>onSubmit</code>, etc) to the inputs (rendered as <code>children</code> of <code>BasicForm</code>) via React context.</p>
<p>It works just as intended. The problem is that now that I'm converting it to use React Hooks, I'm having doubts when trying to replicate the following behavior that I did when it was a class:</p>
<pre><code>class BasicForm extends React.Component {
...other code...
touchAllInputsValidateAndSubmit() {
// CREATE DEEP COPY OF THE STATE'S INPUTS OBJECT
let inputs = {};
for (let inputName in this.state.inputs) {
inputs = Object.assign(inputs, {[inputName]:{...this.state.inputs[inputName]}});
}
// TOUCH ALL INPUTS
for (let inputName in inputs) {
inputs[inputName].touched = true;
}
// UPDATE STATE AND CALL VALIDATION
this.setState({
inputs
}, () => this.validateAllFields()); // <---- SECOND CALLBACK ARGUMENT
}
... more code ...
}
</code></pre>
<p>When the user clicks the submit button, <code>BasicForm</code> should 'touch' all inputs and only then call <code>validateAllFields()</code>, because validation errors will only show if an input has been touched. So if the user hasn't touched any, <code>BasicForm</code> needs to make sure to 'touch' every input before calling the <code>validateAllFields()</code> function.</p>
<p>And when I was using classes, the way I did this, was by using the second callback argument on the <code>setState()</code> function as you can see from the code above. And that made sure that <code>validateAllField()</code> only got called after the state update (the one that touches all fields).</p>
<p>But when I try to use that second callback parameter with state hooks <code>useState()</code>, I get this error:</p>
<pre><code>const [inputs, setInputs] = useState({});
... some other code ...
setInputs(auxInputs, () => console.log('Inputs updated!'));
</code></pre>
<blockquote>
<p>Warning: State updates from the useState() and useReducer() Hooks
don't support the second callback argument. To execute a side effect
after rendering, declare it in the component body with useEffect().</p>
</blockquote>
<p>So, according to the error message above, I'm trying to do this with the <code>useEffect()</code> hook. But this makes me a little bit confused, because as far as I know, <code>useEffect()</code> is not based on state updates, but in render execution. It executes after every render. And I know React can queue some state updates before re-rendering, so I feel like I don't have full control of exactly when my <code>useEffect()</code> hook will be executed as I did have when I was using classes and the <code>setState()</code> second callback argument.</p>
<p>What I got so far is (it seems to be working):</p>
<pre><code>function BasicForm(props) {
const [inputs, setInputs] = useState({});
const [submitted, setSubmitted] = useState(false);
... other code ...
function touchAllInputsValidateAndSubmit() {
const shouldSubmit = true;
// CREATE DEEP COPY OF THE STATE'S INPUTS OBJECT
let auxInputs = {};
for (let inputName in inputs) {
auxInputs = Object.assign(auxInputs, {[inputName]:{...inputs[inputName]}});
}
// TOUCH ALL INPUTS
for (let inputName in auxInputs) {
auxInputs[inputName].touched = true;
}
// UPDATE STATE
setInputs(auxInputs);
setSubmitted(true);
}
// EFFECT HOOK TO CALL VALIDATE ALL WHEN SUBMITTED = 'TRUE'
useEffect(() => {
if (submitted) {
validateAllFields();
}
setSubmitted(false);
});
... some more code ...
}
</code></pre>
<p>I'm using the <code>useEffect()</code> hook to call the <code>validateAllFields()</code> function. And since <code>useEffect()</code> is executed on <strong>every render</strong> I needed a way to know when to call <code>validateAllFields()</code> since I don't want it on every render. Thus, I created the <code>submitted</code> state variable so I can know when I need that effect.</p>
<p>Is this a good solution? What other possible solutions you might think of? It just feels really weird.</p>
<p>Imagine that <code>validateAllFields()</code> is a function that CANNOT be called twice under no circunstances. How do I know that on the next render my <code>submitted</code> state will be already 'false' 100% sure?</p>
<p>Can I rely on React performing every queued state update before the next render? Is this guaranteed?</p>
| <javascript><reactjs><react-hooks> | 2019-03-25 19:12:14 | HQ |
55,345,072 | How can i return two integer from function | <p>I want create a function and return two integers: i and c. How can i do this?
Thanks in advance</p>
<pre><code>a++ ;
if(i == 288){
a = 0 ;
i-- ;
b++ ;
c++ ;
}
if(c == 5000) {
i = 0 ;
c = 0 ;
}
if(a == 1 ){
P2OUT = 0xFF ;
a = 0 ;
}
if (b == 1){
P2OUT= 0x00 ;
b = 0 ;
}
</code></pre>
| <c><msp430> | 2019-03-25 19:23:59 | LQ_CLOSE |
55,346,775 | how to prioritize a variable (Python) | Okay so I have been having a problem making a variable prioritized without anything to do with length. I want D to be prioritized because it his the highest variable then after I want it to prioritize C so on and so on, until it reaches 80
I've only seen example so far about using max() which is not what I need
a = 60
b = 30
c = 50
d = 20
so i want it to select the 20 D then the 50 C then 10 B | <python> | 2019-03-25 21:36:35 | LQ_EDIT |
55,347,824 | C++ Compiled Headers receiving tons of errors | <p>I am receiving errors like cout is undeclared identifier</p>
<p>I have gone through MULTIPLE times and there is nothing I can see that I have done wrong! I am knew so please be patient.</p>
<p>I have checked everything multiple times and this just does not make since to me.</p>
<p>Main.cpp</p>
<pre><code>#include <iostream>
#include <limits>
#include "add.h"
int main()
{
std::cout << "this will call function which will have you type in numbers which when done will call the second function as well as giving the second function answers to what it needs. " << '\n';
int numOne{ function() };
int numTwo{ function() };
std::cout << "With those two numbers we can add them! and our answer is!" << functionTwo(numOne, numTwo) << '\n';
std::cout << "we now sent functionTwo the numbers we made using function for simplness. Now functionTwo can have the numbers it needs to do what it needs to do." << '\n';
// This code will make it not close automatically.
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::cin.get();
return 0;
}
</code></pre>
<p>add.cpp</p>
<pre><code>#include <iostream>
#include "add.h"
int functionTwo(int a, int b)
{
std::cout << " fdsaf dasf dsa" << '\n';
std::cout << 2 * a << '\n';
std::cout << 2 + b << '\n';
int c{ 2 + b };
int d{ 2 * a };
return c + d;
}
</code></pre>
<p>add2.cpp</p>
<pre><code>
#include <iostream>
#include "add.h"
int function()
{
int a{ 0 };
std::cin >> a;
return a;
}
</code></pre>
<p>add.h</p>
<pre><code>#ifndef _IOSTREAM_
#define _IOSTREAM_
int function();
int functionTwo(int a, int b);
#endif
</code></pre>
<p>I am using Microsoft Visual studio and I am trying to compile this. I made sure to make new items / the .cpp files and the .h file. I have tried deleteing the pch.h and the pch.cpp files but I just don't understand what I am doing wrong. Please help me. I am knew so I am sorry for that.</p>
| <c++> | 2019-03-25 23:27:37 | LQ_CLOSE |
55,350,763 | Questions about hyperparameter tuning in Keras/Tensorflow | <p>I am studying deep learning recently, mainly rely on Andrew Ng's Deep Learning Specialization on Coursera. </p>
<p>And I want to build my own model to classify <code>MNIST</code> with 99% accuracy (simple MLP model, not CNN). So I use <code>KerasClassifier</code> to wrap my model and use <code>GridsearchCV</code> to fine tune the hyperparameters (including hidden layer number, units number, dropout rate, etc.)</p>
<p>However, when I google "fine tuning", the majority of the results are mainly on "transfer learning", which are just tuning the learning rate, output layer number or freeze layer number.</p>
<p>I know these famous models are capable to deal with many problems with just a little changes. But what if I want to build a tiny model from scratch to handle a special question, what are the common/best practice?</p>
<p>So my questions are mainly about the common/best practice of fine tuning model:</p>
<ol>
<li>What is the common/best way to fine tuning? (I have seen people tune hyperparameters manually, or using scikit-learn's <code>RandomizedSearchCV</code>/<code>GridSearchCV</code>, or <code>hyperas</code>)</li>
<li>Should I use k-fold cross validation? (Because it's the default set of <code>GridSearchCV</code>, and it extremely increases the training time but helps little)</li>
<li>Is it enough to solve most problems by slightly modifying the off-the-shelf models? If not, to what direction should I move on?</li>
</ol>
<p>Thanks!</p>
| <python><tensorflow><machine-learning><keras><deep-learning> | 2019-03-26 06:05:30 | LQ_CLOSE |
55,350,889 | Suggest me best validation package for API in NodeJs | <p>I previously works in laravel and inbuilt library of laravel is very efficient for handle all kind of errors. is ther any library in node also which handle most of errors with proper code structure -
I don't like code structure like below -</p>
<pre><code>check('price').not().isEmpty().withMessage('must not empty').isInt().withMessage("Must be a Integer")
</code></pre>
| <node.js><laravel><mongodb><validation><express> | 2019-03-26 06:18:40 | LQ_CLOSE |
55,351,424 | in java constructor and main which one will execute first | package com.Interview.Constructor;
public class ConstructorExp {
public ConstructorExp() {
System.out.println("Ctt");
}
public static void main(String[] args) {
System.out.println("Inside Main Methos");
System.out.println("Main");
}
}
| <java> | 2019-03-26 07:00:44 | LQ_EDIT |
55,352,591 | How to design nested 3 level json | <p>I have an object like below:</p>
<pre><code>Parent: { Child1: [ {name:'grandchild1', value:'abc', checked:true}, {name:'grandchild2', value:'pqr', checked:false} ], Child2: [ {name:'grandchild3', value:'abcd', checked:false}, {name:'grandchild4', value:'pqrs', checked:true} ], parent2{...........}.... };
</code></pre>
<p>How can I make it nested JSON.</p>
<p>Just like in root: parent1, parent2...
Child: children1, ....( Corresponding to parent)
Grandchildren: based on children</p>
<p>Please guide me how can I make it?</p>
| <javascript><arrays><json> | 2019-03-26 08:19:44 | LQ_CLOSE |
55,352,800 | why regex work well in java but not working in c++? | use c++
```
std::regex reg("[\\s\\S]*abc[\\s\\S]*:(\\S+)");
std::string src = " abc-def gg, :OK";
std::smatch match;
bool flag = std::regex_search(src, match, reg);
// flag is false
```
use java
```
Pattern p = Pattern.compile("[\\s\\S]*abc[\\s\\S]*:(\\S+)");
String src = " abc-def gg, :OK";
Matcher m = p.matcher(src);
int num = 0;
while (m.find()) {
for (int i = 1; i <= m.groupCount(); i++) {
num++;
}
}
System.out.println(num); num is 1 ,work well
```
The above two parts of the code, C + + operation does not output the correct result, but the java run can get the correct result, why is this happening, where is the problem? | <java><c++><regex> | 2019-03-26 08:33:33 | LQ_EDIT |
55,353,892 | Variable name : "objectId" or "idObject"? | <p>In my company both are used equally, this triggers my OCD, what's your thought on this ? </p>
<p>I think I'd rather go for "objectId"</p>
| <variables><conventions><id> | 2019-03-26 09:39:37 | LQ_CLOSE |
55,356,075 | displaying the maximum price and quantity of items stored in nested list. The first number is price and the second is quantity | I am trying to figure out a way to get the maximum price and lowest quantity from the nested list
items=[["mouse,10,50"],["pen,20,50"],["pencil,30,30"],["sharpner,40,40"],["ruler,50,10"]]
max_price=max(items) | <python> | 2019-03-26 11:30:25 | LQ_EDIT |
55,356,220 | Get string md5 in Swift 5 | <p>In Swift 4 we could use</p>
<pre><code>var md5: String? {
guard let data = self.data(using: .utf8) else { return nil }
let hash = data.withUnsafeBytes { (bytes: UnsafePointer<Data>) -> [UInt8] in
var hash: [UInt8] = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
CC_MD5(bytes, CC_LONG(data.count), &hash)
return hash
}
return hash.map { String(format: "%02x", $0) }.joined()
}
</code></pre>
<p>But in Swift 5 <code>withUnsafeBytes</code> uses <code>UnsafeRawBufferPointer</code> instead of <code>UnsafePointer</code>. How to change md5 function?</p>
| <ios><swift><md5><swift5> | 2019-03-26 11:37:29 | HQ |
55,356,270 | How many subsisiaries can i have in netsuite? I have Oneworld Netsuite solution | I need to create 500 subsisdiaries. But This subsidiaries only stayed actives 1 year.
can be possible in netsuite? | <netsuite> | 2019-03-26 11:39:49 | LQ_EDIT |
55,356,559 | How to output the highest and lowest values selected after entering 10 numbers between 1 to 100 in C | I am trying to write a C program that can accept 10 numbers between 1 and 100. If values outside the range are entered an error message should be displayed.
I have managed to write the following code to check for the to check if the numbers are between 1 to 100
```
#include <stdio.h>
int main() {
int num1, num2, num3, num4, num5, num6, num7, num8, num9, num10;
printf("\nEnter the first number : ");
scanf("%d", &num1);
printf("\nEnter the second number : ");
scanf("%d", &num2);
printf("\nEnter the third number : ");
scanf("%d", &num3);
printf("\nEnter the fourth number : ");
scanf("%d", &num4);
printf("\nEnter the fifth number : ");
scanf("%d", &num5);
printf("\nEnter the sixth number : ");
scanf("%d", &num6);
printf("\nEnter the seventh number : ");
scanf("%d", &num7);
printf("\nEnter the eighth number : ");
scanf("%d", &num8);
printf("\nEnter the nineth number : ");
scanf("%d", &num9);
printf("\nEnter the tenth number : ");
scanf("%d", &num10);
if ((num1 <= 1 && num2 <= 1 && num3 <= 1 && num4 <= 1 && num5 <= 1 && num6 <= 1 && num7 <= 1 && num8 <= 1 && num9 <= 1 && num10 <= 1) &&
(num1 >= 100 && num2 >= 100 && num3 >= 100 && num4 >= 100 && num5 >= 100 && num6 >= 100 && num7 >= 100 && num8 >= 100 && num9 >= 100 && num10 >= 100)){
printf("good");
printf("Numbers are good");
}else{
printf("All numbers must be between 1 to 100");
}
return (0);
}
```
When i run the code i get this output "All numbers must be between 1 to 100" Even if the numbers i enter are between the range of 1-100. i expect the output to be "Numbers are good". Please help. | <c> | 2019-03-26 11:55:36 | LQ_EDIT |
55,356,803 | generate ms excle with insert table having merge cells and formulas | **by using Apache poi i can insert table but i have to apply formulas, merge cells on table columns.
[enter image description here][1]
this the requirement of to generate excel file
[1]: https://i.stack.imgur.com/JgOlj.jpg | <apache-poi> | 2019-03-26 12:09:01 | LQ_EDIT |
55,359,772 | How to bulk insert in SQL using Dapper in C# | <p>I am using C# Dapper with MYSQL. </p>
<p>I have a list of classes that i want to insert into MySQL table. </p>
<p>I used to do it using TVP in MS SQL, how do we do it in MySQL.</p>
| <mysql><dapper><bulkinsert> | 2019-03-26 14:35:47 | LQ_CLOSE |
55,360,736 | How do I window removeEventListener using React useEffect | <p>In React Hooks documents it is shown how to removeEventListener during the component's cleanup phase. <a href="https://reactjs.org/docs/hooks-reference.html#conditionally-firing-an-effect" rel="noreferrer">https://reactjs.org/docs/hooks-reference.html#conditionally-firing-an-effect</a></p>
<p>In my use case, I am trying to removeEventListener conditional to a state property of the functional component.</p>
<p>Here's an example where the component is never unmounted but the event listener should be removed:</p>
<pre><code>function App () {
const [collapsed, setCollapsed] = React.useState(true);
React.useEffect(
() => {
if (collapsed) {
window.removeEventListener('keyup', handleKeyUp); // Not the same "handleKeyUp" :(
} else {
window.addEventListener('keyup', handleKeyUp);
}
},
[collapsed]
);
function handleKeyUp(event) {
console.log(event.key);
switch (event.key) {
case 'Escape':
setCollapsed(true);
break;
}
}
return collapsed ? (
<a href="javascript:;" onClick={()=>setCollapsed(false)}>Search</a>
) : (
<span>
<input placeholder="Search" autoFocus />&nbsp;
<a href="javascript:;">This</a>&nbsp;
<a href="javascript:;">That</a>&nbsp;
<input placeholder="Refinement" />
</span>
);
}
ReactDOM.render(<App />, document.body.appendChild(document.createElement('div')));
</code></pre>
<p>(Live sample at <a href="https://codepen.io/caqu/pen/xBeBMN" rel="noreferrer">https://codepen.io/caqu/pen/xBeBMN</a>)</p>
<p>The problem I see is that the <code>handleKeyUp</code> reference inside <code>removeEventListener</code> is changing every time the component renders. The function <code>handleKeyUp</code> needs a reference to <code>setCollapsed</code> so it must be enclosed by <code>App</code>. Moving <code>handleKeyUp</code> inside <code>useEffect</code> also seems to fire multiple times and lose the reference to the original <code>handleKeyUp</code>.</p>
<p>How can I conditionally window.removeEventListener using React Hooks without unmounting the component?</p>
| <reactjs><react-hooks><removeeventlistener> | 2019-03-26 15:23:28 | HQ |
55,361,057 | This copy of libswiftCore.dylib requires an OS version prior to 12.2.0 | <p>The app crashes on launch when running from XCode 10.2 (before and after Swift 5.0 migration) with this on console</p>
<blockquote>
<p>This copy of libswiftCore.dylib requires an OS version prior to
12.2.0.</p>
</blockquote>
<p>I understand the error, but not sure what is required to fix this.</p>
| <ios><swift5><xcode10.2> | 2019-03-26 15:39:14 | HQ |
55,361,084 | Does python all() function iterate over all elements? | <p>I'm wondering if the all() Python function iterates over all elements of the iterable passed by param. </p>
| <python><performance><built-in> | 2019-03-26 15:40:18 | LQ_CLOSE |
55,361,186 | Type hinting sqlalchemy query result | <p>I can't figure out what kind of object a sqlalchemy query returns.</p>
<pre><code>entries = session.query(Foo.id, Foo.date).all()
</code></pre>
<p>The type of each object in entries seems to be <code>sqlalchemy.util._collections.result</code>, but a quick <code>from sqlalchemy.util._collections import result</code> in a python interpreter raises an ImportError.</p>
<p>What I'm ultimately trying to do is to type hint this function:</p>
<pre><code>def my_super_function(session: Session) -> ???:
entries = session.query(Foo.id, Foo.date).all()
return entries
</code></pre>
<p>What should I put in place of <code>???</code>? mypy (in this case) seems to be fine with <code>List[Tuple[int, str]]</code> because yes indeed I can access my entries like if they were tuples, but i can also access them with <code>entry.date</code>, for example.</p>
| <python><sqlalchemy><mypy> | 2019-03-26 15:45:17 | HQ |
55,361,762 | apt-get update fails with 404 in a previously working build | <p>I am running a Travis build and it fails when building the mysql:5.7.27 docker image. The Dockerfile runs <code>apt-get update</code> and then I get an error <code>W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages 404 Not Found</code>.</p>
<p>Using curl I can see it is redirecting, but the redirect-to URL results in a 404. Has anyone seen this sort of behaviour and have a remedy? Is it basically unfixable until debian makes changes?</p>
<pre><code>➜ ms git:(develop) curl --head http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
HTTP/1.1 302 Found
Date: Tue, 26 Mar 2019 16:03:04 GMT
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Location: http://cdn-fastly.deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
Content-Type: text/html; charset=iso-8859-1
➜ ms git:(develop) curl --head http://cdn-fastly.deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
HTTP/1.1 404 Not Found
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Content-Type: text/html; charset=iso-8859-1
Via: 1.1 varnish
Content-Length: 316
Accept-Ranges: bytes
Date: Tue, 26 Mar 2019 16:03:17 GMT
Via: 1.1 varnish
Age: 45
Connection: keep-alive
X-Served-By: cache-ams21028-AMS, cache-cdg20741-CDG
X-Cache: HIT, HIT
X-Cache-Hits: 6, 2
X-Timer: S1553616198.734091,VS0,VE0
</code></pre>
| <docker><travis-ci><debian-jessie> | 2019-03-26 16:17:29 | HQ |
55,361,839 | CONVERT (3 Days 18 Hours 39 Minutes) into seconds in SQL | CONVERT (3 Days 18 Hours 39 Minutes) into seconds in SQL | <sql><sql-server><tsql> | 2019-03-26 16:21:18 | LQ_EDIT |
55,362,593 | I would like to know if there is any way to get a square root to a list in python help me please | I want to make a condition in python that contains square root of lists so I can not find a specific command to do it. It should be mentioned that in MathLab if it can be done, the following code is from mathlab and I want to do the same in python
secuencia=lenght(list)
secuencia_2=[1,2,3,4,5,6,7,8]
mathlab
for j lengt (secuencia)
if prod((sqrt(secuencia_1*secuencia_1))~= (sqrt(secuencia_2(j)*secuencia_2(j))))==1: | <python-3.x> | 2019-03-26 17:02:22 | LQ_EDIT |
55,362,770 | i keep getting an expected ; error and i'm not sure as to why | <p>i finish writing my code and i am unable to figure out why i am getting an expected ; error </p>
<p>i tried adding the ; where it expects me too but it kicks back other errors instead</p>
<p>here is my code </p>
<pre><code>int main() {
int* expandArray(int *arr, int SIZE) { //this is the error line
//dynamically allocate an array twice the size
int *expPtr = new int[2 * SIZE];
//initialize elements of new array
for (int i = 0; i < 2 * SIZE; i++) {
//first add elements of old array
if (i < SIZE) {
*(expPtr + i) = *(arr + i);
}
//all next elements should be 0
else {
*(expPtr + i) = 0;
}
}
return expPtr;
}
</code></pre>
<p>}</p>
| <c++><visual-c++> | 2019-03-26 17:14:45 | LQ_CLOSE |
55,364,173 | Why is Chrome coloring my cookie red when I set it from the inspector? | <p>If I open the inspector for a page, go to the Application tab, scroll down to Cookies in the left-hand list, expand it, and click my domain, I get a list of cookies set on the domain. I can add new entries to the list and edit existing ones, setting and updating cookies stored for that domain.</p>
<p>After upgrading to Chrome 73 if I try and set a cookie the browser colors the text red and does not set or save the cookie. How do I continue setting cookies in Chrome 73?</p>
| <google-chrome><cookies><google-chrome-devtools> | 2019-03-26 18:40:33 | HQ |
55,364,212 | Overriding non-@objc declarations from extensions is not supported | <p>Seemingly out of nowhere I started getting hundreds of errors associated with two extension functions that I use frequently.</p>
<p>I tried commenting out all the new code that preceding this error showing up. I also tried cleaning my build folder. How do I get ride of the error found in the title of this post? Why did it randomly appear when I've been using these extensions successfully for months?</p>
<pre><code>extension UITableViewCell {
public func getSize(large: CGFloat, medium: CGFloat, small: CGFloat) -> CGFloat {
var size = CGFloat()
let screenHeight = Int(UIScreen.main.bounds.height)
if screenHeight >= 800 {
size = large
} else if screenHeight >= 600 {
size = medium
} else {
size = small
}
return size
}
public func formatPrice(_ price: Int) -> String {
let lastDigit = price % 10
var stringPrice = ""
if lastDigit == 0 {
stringPrice = "$\(Double(price) / 100)0"
} else {
stringPrice = "$\(Double(price) / 100)"
}
return stringPrice
}
}
</code></pre>
| <ios><swift> | 2019-03-26 18:43:07 | HQ |
55,364,642 | I ask about UICollectionView | Hi everyone I asking about, I have UICollectionView I load photo library videos every video in cell videos as array, I want to select video from this UICollectionView how to achieve this ? .Thanks | <ios><swift><uicollectionview> | 2019-03-26 19:10:07 | LQ_EDIT |
55,365,321 | How to join a table by a column with tilde separated values in sql server | I'm trying to match the codes/descriptions from table_2 to each company in table_1. The company_type_string column contains multiple codes separated by '~' that are supposed to match with the codes in table_2.
Table 1:
company company_type_string
A 1A~2B~3C
B 1A~2B
C 1A
D 1A~2B~3C~4D
Table 2:
code description
1A Finance
2B Law
3C Security
4D Marketing
Desired Outcome:
company description
A Finance
A Law
A Security
B Finance
B Law
C Finance
D Finance
D Law
D Security
D Marketing
I've tried using split_string with no success. Is there a way to make this join without altering the DB schema?
| <sql-server><join><split> | 2019-03-26 19:58:24 | LQ_EDIT |
55,365,550 | How create differents objects with a constructor list | I have a list which has differents constructors of differents classes.But the constructors always return me the same object because they have the same memory direction.
I have something like this:
l=[class1(),class2(),class3()]
l2 = []
if I try to create differents objects with it, it returns the same object with the same memory direction. I mean, I'm doing this:
for i in range(50):
obj = l[random]
l2.append(obj)
l2 has 50 objects but all the objects of the first class are the same and they have the same memory direction. Same happens with the other classes.
I would like to have 50 differents objects. | <python><list><class><constructor> | 2019-03-26 20:13:27 | LQ_EDIT |
55,366,201 | why the loop show 20 as result instead of 120 | ORG 100H
facto dw ?
START:
MOV CX, 5
MOV AX, 5
DEC CX
repeat :
MUL CX
MOV facto , AX
LOOP repeat
ENDS
END START : | <assembly><x86-16><machine-language> | 2019-03-26 21:07:24 | LQ_EDIT |
55,367,062 | Why is `const int& k = i; ++i; ` possible? | <p>I am supposed to determine whether this function is syntactically correct:</p>
<p><code>int f3(int i, int j) { const int& k=i; ++i; return k; }</code></p>
<p>I have tested it out and it compiles with my main function. </p>
<p>I do not understand why this is so. </p>
<p>Surely by calling the function <code>f3</code> I create copies of the variables <code>i</code>and <code>j</code> in a new memory space and setting <code>const int& k=i</code> I am setting the memory space of the newly created <code>k</code> to the exact the same space of the memory space of the copied <code>i</code>, therefore any change, i.e. the increment <code>++i</code>will result in <code>++k</code> which is not possible given that it was set <code>const</code></p>
<p>Any help is greatly appreciated</p>
| <c++><syntax><reference><constants> | 2019-03-26 22:27:51 | HQ |
55,367,095 | not subscriptable error when not trying to subscript | We begin with a user inputted string containing only lower-case letters
```
for letter in encoded_input:
if letter == ' ':
decoded_output.append(' ')
continue
decoded_output.append(map_input(letter,tpos1,tpos2,tpos3))
```
and then pass to this function
```
def map_input(value,r1,r2,r3,wr=wiring,rf=reflector):#Use reflector as well
pass1 = rf[r3[r2[r1[wr[ALPH.index(value)]]]]]
r1,r2,r3 = reverse_rotors(r1,r2,r3)
return ALPH[wr[r1[r2[r3[pass1]]]]]
```
where all of the variables passed are lists containing numbers 0-25 in a unique arrangement.
#Problem
When I do this, however, I get an error telling me
```
pass1 = rf[r3[r2[r1[wr[ALPH.index(value)]]]]]
TypeError: 'int' object is not subscriptable
```
Am I missing the obvious or is something subtle going on? Value is indeed a lower case letter in ALPH (which is just a list containing the alphabet). | <python><python-3.x><typeerror> | 2019-03-26 22:30:24 | LQ_EDIT |
55,368,321 | How to add Pie Chart in my Android project | I want to add a Pie Chart in my Android project. If I have 95 car, 60 bus, 106 bicycle and so on. Please let me know if anyone have any suggestions... | <android><android-volley><pie-chart> | 2019-03-27 01:03:32 | LQ_EDIT |
55,368,532 | Create TypeFaceSpan from TypeFace below SDK version 28 | <p>I found a way to <code>create</code> <code>TypeFaceSpan</code> from <code>TypeFace</code> like this :</p>
<pre><code>fun getTypeFaceSpan(typeFace:TypeFace) = TypeFaceSpan(typeFace)
</code></pre>
<p><strong>But</strong> this API is <strong>allowed</strong> only in <strong>API level >= 28</strong> . Any <strong>Compat</strong> libray to achieve this <strong>below 28</strong>? </p>
| <android><textview><android-typeface><android-spannable> | 2019-03-27 01:37:06 | HQ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.