All Questions

Filter by
Sorted by
Tagged with
-23 votes
4 answers
399 views

Fast comparing array to the number

I have an array of ints and I want to count how many not 1 numbers is there: int* t = new int[50]; int counter = 1; for(int i = 0; i < 50; i++){ t[i] = i % 10; if((memcmp((void*)t[i], (...
Yoda's user avatar
  • 17.9k
-23 votes
3 answers
505 views

editText.toString=="something" always false [duplicate]

I am trying to check if text in editText is equal to some string. This is my if statement (it comes every time I press a button): if(tx.getText().toString()=="bla") This is tx: tx=(EditText)...
user avatar
-23 votes
1 answer
360 views

java - Which has greater precedence, + or -

Considering this expression: x1 = ++x - x++ + --x if the value of x is entered 5 What will be the output of such expression in java, and why?
Baalateja Kataru's user avatar
-23 votes
2 answers
1k views

Return correct time measurements from a date [closed]

I would like a method that returns a string from date that looks like the ones in the social media websites and forum . Examples Added 2 seconds ago Added 3 mintues ago Added two weeks ago Added a ...
Abdullah Alhutami's user avatar
-23 votes
3 answers
236 views

Java and printf [closed]

The code is having some problem with class 2 line 12. Kindly help . The code is in the image. import java.util.Scanner; public class first{ public static void main(String[] args){ Scanner ...
Priyansh Rajwar's user avatar
-23 votes
1 answer
578 views

Why count outputs wrong chars from char array [closed]

I have a multidimensional char array that I write to, then print out using a nested for loop, yet for some reason it outputs rubbish, what have I done wrong? #include <iostream> #include <...
Gnomorian's user avatar
-23 votes
1 answer
2k views

Can anyone help me make a Polygon Generator in Python?

It should ask for a number between 4 and 8 and then turtle will draw those sides. The interior angle equation: where N is the # of sides (N -2)180= x, then x divided by N = draw sides >>&...
Radionowhere's user avatar
-23 votes
1 answer
706 views

Using function for two div or more

My issue is that some of my div scripts work and others do not ! I've made a function with JavaScript that contains some mistakes. I'm wondering what is my error. It's the same code, I've just copied ...
maxhill901's user avatar
-23 votes
3 answers
317 views

What is the memory location of referenced variables? [closed]

int main() { int i = 10; int &j = i; int k = 20; j=k; cout << i << j << k; return 0; } The output of the above program is 202020. In above snippet what will be the ...
Ricky's user avatar
  • 2,326
-23 votes
1 answer
5k views

Array for 4 dimension initializing

An array of 3 dimensions initializes like this. int[,,] arr = new int[2,3,3] {{{1,2,3},{4,5,6},{7,8,9}}, {{1,2,3},{4,5,6},{7,8,9}}}; How do you initialize this in 4 dimensions array or more? int[,,,...
Kapil's user avatar
  • 61
-23 votes
1 answer
9k views

Calculating a discount java [closed]

import java.util.Scanner; public class Detyra15 { public static void main (String []args) { int percentage = 0; double releasevalue = 0; double discountedcost = 0; ...
MANDYXX's user avatar
-23 votes
1 answer
323 views

Add a number to the array using PHP

I have a quiz, questions from the MySQL DB. Could you please help me solve this? I want to add (+1) to that specific value in the array. <input id="subjectid" name="subjectid[]" value="2" ...
sai's user avatar
  • 43
-23 votes
1 answer
255 views

EKCalendar on my ipad application

I want access to the Native Calendar on my application. It is referred so many links, but it still could not done that process. The events are shown on my calendar. Setting the time and date based ...
Preetha's user avatar
  • 751
-24 votes
1 answer
1k views

How is transforming this iterator block a functional change?

Given the following code snippet: public class Foo { public IEnumerable<string> Sequence { get; set; } public IEnumerable<string> Bar() { foreach (string s in Sequence)...
Servy's user avatar
  • 203k
-24 votes
5 answers
3k views

Determine whether there is a path from vertex u to w passing through v [closed]

Given an undirected graph G = (V, E), such that u, v, w are some edges in G. Describe an algorithm to determine whether "if there is a path from u to w that passes through v" A simple ...
user avatar
-24 votes
3 answers
491 views

Javascript difference between "=" and "===" [duplicate]

I struggle to understand the function below. I didn't know why my script wasn't working until I changed = with === in the if statement, as shown below. Why does === work while = doesn't? var testTest =...
Simon's user avatar
  • 382
-24 votes
1 answer
1k views

How can you put 20 turtles on a circle in Python? [closed]

I have to put 20 turtles on verticles of a polygon with 20 sides, so they will be on a circle with regular spacing. I have class Turtle, where I want to put those 20 turtles. I know how to put more ...
Asanas's user avatar
  • 1
-24 votes
2 answers
2k views

How Do I Add Full-Screen Mode To A Html5?

I want to add fullscreen mode in below html5 code Suggest me how I can make changes in the given code, I am facing problem in adding the fullscreen code in this script <script src="https://cdn....
Hamdan's user avatar
  • 1
-24 votes
2 answers
331 views

Java main function won't compile with a method in it

I am using Netbeans to learn basic Java stuff right now, and I have looked around and I cannot figure out what is wrong with this. I am unable to make any kind of method in the "main" function because ...
Bryant's user avatar
  • 21
-24 votes
1 answer
617 views

Why am I getting the error "is not a function" here? [duplicate]

I have a nodejs issue here, and I really don't know why it happens. Here is my code : isInTimeSlot() { return new Promise((resolve, reject) => { var date = new Date() var hour =...
Alex Trupin's user avatar
-24 votes
1 answer
208 views

Why is the correct ID not being inserting into this table?

I want the following code to insert the car's ID in the customer_payment table, but it only selects 477 as the ID. I don't know why. As it can be seen in image bellow only product_id = 477 is inserted,...
Ayesha Ayesha's user avatar
-24 votes
4 answers
856 views

How to modify this code to print the 3 integers in order?

I have a code that prints the biggest integer between 3 integers and I want to sort these 3 integers (like num < num1 < num2). I want to modify my code to achieve this, how can I do it? import ...
Johny Himmler's user avatar
-24 votes
1 answer
249 views

How can I combine two MySQL rows as one and count results?

Basically, I have a database with 10 exam types. Each type has two parts, and is updated as pass or fail. I need to list the total count of exams that have not been completed (both parts passed). I've ...
gtrhough's user avatar
-24 votes
1 answer
1k views

How to use the variable from the python in rpy2? [closed]

My simple program extracts the database from Python and store in the variable row. cursor = con.cursor() cursor.execute("SELECT * FROM traffic") #Retrieves data from SQL rows = ...
Joyfulgrind's user avatar
  • 2,816
-25 votes
4 answers
3k views

Replace occurrences of NSString with `'` to `\'`

I have a NSString in which I m trying to replace special characters. Part of my string looks like this: I have replace ' to \'
Ronak's user avatar
  • 147
-25 votes
4 answers
425 views

Passing String from one class to another

How can I pass string variable or String object from one class to another? I've 2 days on this problem. One class get data from keyboard and second one should print it in console.
James Parson's user avatar
-25 votes
2 answers
436 views

How can I match values in one file to ranges from another?

There are two input files, as the following lines show. Columns 3 and 4 in input1 hold a range (such as 1 to 78 in the first row) Column 2 in input2 holds a single position value (such 32 in the ...
Borodin's user avatar
  • 127k
-25 votes
1 answer
910 views

Recursive to iterative using a systematic method [closed]

I've started reading the book Systematic Program Design: From Clarity to Efficiency few days ago. Chapter 4 talks about a systematic method to convert any recursive algorithm into its counterpart ...
BPL's user avatar
  • 9,619
-25 votes
1 answer
1k views

Java: Delete a file starting with "." [duplicate]

I have been searching endlessly for this, and can't find anything. The file .minecraft will not delete. I have tried renaming it to just minecraft but that still will not work. import javax.swing....
StealthVice7's user avatar
-25 votes
2 answers
506 views

<a href=""> Action to database

Is there a way to update a database using 1 click? i.e echo "<a href='".$wpdb->query(" UPDATE partners SET active='no' WHERE partner_id='$active_partner->partner_id' ")."'>Disable</a&...
Brad Fletcher's user avatar
-25 votes
2 answers
2k views

Create a nested hash

I have an array like this: [ {:game_id=>546012, :period=>:fg, :stat_name=>:hits, :result=>12, :team_id=>1104}, {:game_id=>546012, :period=>:fg, :stat_name=>:errors, :...
appleLover's user avatar
  • 15.4k
-25 votes
1 answer
725 views

where are the syntax errors am getting?

I am making a program to simulate a game show, randomly. The program picks 1 of three doors for the prize to be hidden behind randomly. The computer picks a door to see if it won or not. This is ...
Byte_Spike's user avatar
-25 votes
8 answers
1k views

Remove duplicates and combine multiple lists into one?

How do I remove duplicates and combine multiple lists into one like so: function([["hello","me.txt"],["good","me.txt"],["good","money.txt"], ["rep", "money.txt"]]) should return exactly: [["good", ["...
user avatar
-26 votes
3 answers
2k views

Can storing wildcard strings in a column (to be used with LIKE operator) cause unexpected query results or security issues?

Could storing wildcard strings in a table's column (to be used as the second operand of the LIKE operator in queries) cause any non-obvious behavior? I'm wondering especially about the possibility of ...
ruohola's user avatar
  • 23.3k
-26 votes
1 answer
658 views

PDO Fetch statement only retrieves first column

As the title states, I am only able to grab the id column, I am getting an Undefined index error for the others. My code: if(isset($_SESSION['id'])) { $presh = $_SESSION['id']; $stmt = $pdo-&...
sunshinekitty's user avatar
-26 votes
1 answer
315 views

Can't compile C++ file: does not name a type

I am getting this error main.cpp:23:5: error: ‘Department’ does not name a type /* * File: main.cpp * Author: anonymous * * Created on May 11, 2015, 9:44 PM */ #include <cstdlib> #...
mungaih pk's user avatar
  • 1,825
-26 votes
3 answers
2k views

What would be the value of variable after executing the following statement

I'm lil bit confused about this question which i found while doing 1 vasic java quiz question is: What would be the value of variable c after executing int c = Integer.parseInt("a"); I think ...
Jigar Patel's user avatar
-26 votes
4 answers
1k views

What is a hamburger menu and what is it used for?

What is the "3 Line Menu" or "Hamburger Menu"? How is it useful? What is its purpose within an application or website?
Harshad Pansuriya's user avatar
-26 votes
1 answer
305 views

How can I split integer inside an array? [closed]

In C++, I have the following input: 12345 How can I achieve this output: 1 2 3 4 5 ? Another example could be: input: 123 output: 1 2 3
Pritesh Jadhav's user avatar
-27 votes
2 answers
2k views

GCC - modify where execution continues after function return [closed]

Is it possible to do something like this in GCC? void foo() { if (something()) returnSomewhereElse; else return; } void bar() { foo(); return; // something failed, no point of ...
IvanB's user avatar
  • 121
-27 votes
2 answers
1k views

How do I scrollIntoView a DOM Range?

The Element interface offers a scrollIntoView method that sets the scroll positions of all ancestor elements so that the given element is visible on the screen. How can I perform an analogous ...
user3840170's user avatar
  • 27.5k
-27 votes
2 answers
2k views

how to define a constructor outside class in java?

C++ uses double colon to define constructor outside class. What to do in java? I have a long program so it would have been better to use the declared constructor outside the class body but i don't ...
ASH's user avatar
  • 13
-27 votes
1 answer
430 views

Python - FileNotFoundError: [Errno 2] No such file or directory: 'y' [closed]

fileRef = open(the_file, "r") # opening file to be read I got the following error : FileNotFoundError: [Errno 2] No such file or directory: 'y'
J.Khelly's user avatar
-28 votes
8 answers
16k views

javascript: hiding contents of key

In the code below I want to hide the contents of the key(speaker) key being viewed by browser console. var App_Version = 1; var App_id = 35; var Speaker = "password";
Visakh B Sujathan's user avatar
-28 votes
2 answers
617 views

How do I find the difference between two values in one column by cross-referencing them against values in another column?

I have a table that looks like this: id | machine | date | status ---------------------------- 1 | 1 | 01-01-2009 | New 1 | 1 | 01-01-2010 | Busted 1 | 2 | 01-01-2010 | New 1 | 1 | 01-01-2012 | ...
user avatar
-28 votes
6 answers
2k views

Parameters of GestureDetectorCompat constructor

Apologize :- due to my mistake, because last time i didn't asked this Question properly and that's why most of the answers posted below are related to "this" keyword and that's the reason i got ...
Arsh Kaushal's user avatar
-29 votes
2 answers
620 views

I am trying to figure out below javascript and what it does

I am trying to figure out below script and what it does. Any help is appropriated $(document).ready(function(){ console.log('Hello World!'); });
Cozel's user avatar
  • 57
-29 votes
4 answers
374 views

How do you write a line of output?

I was assigned a program for class, and I have to make a line of output say "Hello World". I don't know how o do this, please help
Jeff Ray's user avatar
-29 votes
2 answers
982 views

how to convert str to int?

I try to input data in R, but I don't know how to convert str into int in following script. >countsTable <- read.table("targets.txt") >matrixTable <- as.matrix(countsTable) [1,] "hsa-...
froggy5207's user avatar
-29 votes
2 answers
1k views

Error CS0030: Cannot convert type 'void' to 'double'

The compiler gives an error CS0030: Cannot convert type 'void' to 'double'. Help me please. The code here: static public double Decode(string a) { double c=double.Parse(a); return (double)...
Alexei196's user avatar

15 30 50 per page