Questions Tagged with #String

A string is a finite sequence of symbols, commonly used for text, though sometimes for arbitrary data.

What does ${} (dollar sign and curly braces) mean in a string in Javascript?

I haven't seen anything here or on MDN. I'm sure I'm just missing something. There's got to be some documentation on this somewhere? Functionally, it looks like it allows you to nest a variable insid..

Hashing a string with Sha256

I try to hash a string using SHA256, I'm using the following code: using System; using System.Security.Cryptography; using System.Text; public class Hash { public static string getHashSha256..

Groovy String to Date

I am coding this with Groovy I am currently trying to convert a string that I have to a date without having to do anything too tedious. String theDate = "28/09/2010 16:02:43"; def newdate = new Da..

Using quotation marks inside quotation marks

When I want to do a print command in Python and I need to use quotation marks, I don't know how to do it without closing the string. For instance: print " "a word that needs quotation marks" " Bu..

Wrap long lines in Python

How do I wrap long lines in Python without sacrificing indentation? For example: def fun(): print '{0} Here is a really long sentence with {1}'.format(3, 5) Suppose this goes over the 79 cha..

Remove leading comma from a string

I have the following string: ",'first string','more','even more'" I want to transform this into an Array but obviously this is not valid due to the first comma. How can I remove the first comma fro..

Check if String contains only letters

The idea is to have a String read and to verify that it does not contain any numeric characters. So something like "smith23" would not be acceptable. ..

Convert datetime value into string

I am fetching the current date & time using NOW() in mysql. I want to convert the date value into a varchar and concat it with another string. How do I do it?..

How can I split a string with a string delimiter?

I have this string: My name is Marco and I'm from Italy I'd like to split it, with delimiter is Marco and, so I should get an array with My name at [0] and I'm from Italy at [1]. How can I do i..

MySql Query Replace NULL with Empty String in Select

How do you replace a NULL value in the select with an empty string? It doesnt look very professional to output "NULL" values. This is very unusual and based on my syntax I would expect it to work. Ho..

How can I convert a comma-separated string to an array?

I have a comma-separated string that I want to convert into an array, so I can loop through it. Is there anything built-in to do this? For example, I have this string var str = "January,February,..

How to split a comma-separated string?

I have a String with an unknown length that looks something like this "dog, cat, bear, elephant, ..., giraffe" What would be the optimal way to divide this string at the commas so each word could b..

Converting of Uri to String

Is it possible to convert an Uri to String and vice versa? Because I want to get the the Uri converted into String to pass into another activity via intent.putextra() and if it's not possible can anyo..

How to append a char to a std::string?

The following fails with the error prog.cpp:5:13: error: invalid conversion from ‘char’ to ‘const char*’ int main() { char d = 'd'; std::string y("Hello worl"); y.append(d); // Line 5 -..

Convert Char to String in C

How do I convert a character to a string in C. I'm currently using c = fgetc(fp) which returns a character. But I need a string to be used in strcpy..

Ruby on Rails: how to render a string as HTML?

I have @str = "<b>Hi</b>" and in my erb view: <%= @str %> What will display on the page is: <b>Hi</b> when what I really want is Hi. What's the ruby way to "interpr..

How do I delete specific characters from a particular String in Java?

For example I'm extracting a text String from a text file and I need those words to form an array. However, when I do all that some words end with comma (,) or a full stop (.) or even have brackets at..

Are string.Equals() and == operator really same?

Are they really same? Today, I ran into this problem. Here is the dump from the Immediate Window: ?s "Category" ?tvi.Header "Category" ?s == tvi.Header false ?s.Equals(tvi.Header) true ?s == ..

Split and join C# string

Possible Duplicate: First split then join a subset of a string I'm trying to split a string into an array, take first element out (use it) and then join the rest of the array into a seperat..

Java get String CompareTo as a comparator object

I would like to sort and binary search a static array of strings via the String.CompareTo comparator. The problem is that both sorting, and binary searching requires that a Comparator object be passe..

Java: How to split a string by a number of characters?

I tried to search online to solve this question but I didn't found anything. I wrote the following abstract code to explain what I'm asking: String text = "how are you?"; String[] textArray= text.s..

How do I verify that a string only contains letters, numbers, underscores and dashes?

I know how to do this if I iterate through all of the characters in the string but I am looking for a more elegant method...

How to check if matching text is found in a string in Lua?

I need to make a conditional that is true if a particular matching text is found at least once in a string of text, e.g.: str = "This is some text containing the word tiger." if string.match(str, "ti..

Get nth character of a string in Swift programming language

How can I get the nth character of a string? I tried bracket([]) accessor with no luck. var string = "Hello, world!" var firstChar = string[0] // Throws error ERROR: 'subscript' is unavailable..

How to get char from string by index?

Lets say I have a string that consists of x unknown chars. How could I get char nr. 13 or char nr. x-14?..

Difference between text and varchar (character varying)

What's the difference between the text data type and the character varying (varchar) data types? According to the documentation If character varying is used without length specifier, the type acc..

Find and replace string values in list

I got this list: words = ['how', 'much', 'is[br]', 'the', 'fish[br]', 'no', 'really'] What I would like is to replace [br] with some fantastic value similar to &lt;br /&gt; and thus getting..

How to remove leading and trailing spaces from a string

I have the following input: string txt = " i am a string " I want to remove space from start of starting and end from a string. The result shou..

How can I trim beginning and ending double quotes from a string?

I would like to trim a beginning and ending double quote (") from a string. How can I achieve that in Java? Thanks!..

How to convert current date into string in java?

How do I convert the current date into string in Java?..

is the + operator less performant than StringBuffer.append()

On my team, we usually do string concatentation like this: var url = // some dynamically generated URL var sb = new StringBuffer(); sb.append("<a href='").append(url).append("'>click here</a..

How do I concatenate strings?

How do I concatenate the following combinations of types: str and str String and str String and String ..

How to check if character is a letter in Javascript?

I am extracting a character in a Javascript string with: var first = str.charAt(0); and I would like to check whether it is a letter. Strangely, it does not seem like such functionality exists in J..

Split a string by another string in C#

I've been using the Split() method to split strings, but this only appears to work if you are splitting a string by a character. Is there a way to split a string, with another string being the split b..

How to write character & in android strings.xml

I wrote the following in the strings.xml file: <string name="game_settings_dragNDropMove_checkBox">Move by Drag&Drop</string> I got the following error: The reference to entity "Dr..

Removing the first 3 characters from a string

What is the most efficient way to remove the first 3 characters of a string? For example: 'apple' change to 'le' 'a cat' change to 'at' ' a b c'change to 'b c' ..

How to convert a string to an integer in JavaScript?

How do I convert a string to an integer in JavaScript?..

Ruby, remove last N characters from a string?

What is the preferred way of removing the last n characters from a string?..

how to write value into cell with vba code without auto type conversion?

This problem seems very simple, yet I just can not find the solution (I am already loosing my mind about it :) ) OK, so I just want to put a certain value into an excel cell, using vba code, just as ..

Remove last character from C++ string

How can I remove last character from a C++ string? I tried st = substr(st.length()-1); But it didn't work...

Regular expression - starting and ending with a character string

I would like to write a regular expression that starts with the string "wp" and ends with the string "php" to locate a file in a directory. How do I do it? Example file: wp-comments-post.php..

Python string to unicode

Possible Duplicate: How do I treat an ASCII string as unicode and unescape the escaped characters in it in python? How do convert unicode escape sequences to unicode characters in a python stri..

javascript regular expression to not match a word

How do I use a javascript regular expression to check a string that does not match certain words? For example, I want a function that, when passed a string that contains either abc or def, returns fa..

How to convert a string to lower or upper case in Ruby

How do I take a string and convert it to lower or upper case in Ruby?..

How to replace a string in multiple files in linux command line

I need to replace a string in a lot of files in a folder, with only ssh access to the server. How can I do this?..

Find text in string with C#

How can I find given text within a string? After that, I'd like to create a new string between that and something else. For instance, if the string was: This is an example string and my data is here ..

How can I put strings in an array, split by new line?

I have a string with line breaks in my database. I want to convert that string into an array, and for every new line, jump one index place in the array. If the string is: My text1 My text2 My text3 ..

Python string class like StringBuilder in C#?

Is there some string class in Python like StringBuilder in C#?..

How to convert text to binary code in JavaScript?

Text to Binary Code I want JavaScript to translate text in a textarea into binary code. For example, if a user types in "TEST" into the textarea, the value "01010100 01000101 01010011 0..

Difference between "char" and "String" in Java

I am reading a book for Java that I am trying to learn, and I have a question. I can't understand what is the difference between the variable type char and String. For example, there is a difference b..

How to print like printf in Python3?

In Python 2 I used: print "a=%d,b=%d" % (f(x,n),g(x,n)) I've tried: print("a=%d,b=%d") % (f(x,n),g(x,n)) ..

Difference between null and empty ("") Java String

What is the difference between null and the "" (empty string)? I have written some simple code: String a = ""; String b = null; System.out.println(a == b); // false System.out.println(a.equals(b));..

javascript date to string

Here is what I need to do. Get Date, convert to string and pass it over to a third party utility. The response from the library will have date in string format as I passed it. So, I need to convert..

Converting string to byte array in C#

I'm converting something from VB into C#. Having a problem with the syntax of this statement: if ((searchResult.Properties["user"].Count > 0)) { profile.User = System.Text.Encoding.UTF8.GetStr..

How to check if a string contains text from an array of substrings in JavaScript?

Pretty straight forward. In javascript, I need to check if a string contains any substrings held in an array...

Test if string is a number in Ruby on Rails

I have the following in my application controller: def is_number?(object) true if Float(object) rescue false end and the following condition in my controller: if mystring.is_number? end The c..

How to remove illegal characters from path and filenames?

I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using Sys..

how to get the last part of a string before a certain character?

I am trying to print the last part of a string before a certain character. I'm not quite sure whether to use the string .split() method or string slicing or maybe something else. Here is some ..

PHP to write Tab Characters inside a file?

How do i simply write out a file including real tabs inside? tab means real tab which is not the spaces. How to write the tab or what is the character for real tab? For example here: $chunk = "a,b,c..

Extract a substring using PowerShell

How can I extract a substring using PowerShell? I have this string ... "-----start-------Hello World------end-------" I have to extract ... Hello World What is the best way to do that?..

Left padding a String with Zeros

I've seen similar questions here and here. But am not getting how to left pad a String with Zero. input: "129018" output: "0000129018" The total output length should be TEN...

Finding multiple occurrences of a string within a string in Python

How do I find multiple occurrences of a string within a string in Python? Consider this: >>> text = "Allowed Hello Hollow" >>> text.find("ll") 1 >>> So the first occurre..

Split string in JavaScript and detect line break

I have a small function I found that takes a string from a textarea and then puts it into a canvas element and wraps the text when the line gets too long. But it doesn't detect line breaks. This is wh..

.NET Format a string with fixed spaces

Does the .NET String.Format method allow placement of a string at a fixed position within a fixed length string. " String Goes Here" " String Goes Here " "String Goes Here ..

Base64 String throwing invalid character error

I keep getting a Base64 invalid character error even though I shouldn't. The program takes an XML file and exports it to a document. If the user wants, it will compress the file as well. The compress..

How do I check if string contains substring?

I have a shopping cart that displays product options in a dropdown menu and if they select "yes", I want to make some other fields on the page visible. The problem is that the shopping cart also inc..

How to check if a String is numeric in Java

How would you check if a String was a number before parsing it?..

How do you pull first 100 characters of a string in PHP

I am looking for a way to pull the first 100 characters from a string variable to put in another variable for printing. Is there a function that can do this easily? For example: $string1 = "I am ..

Where does Java's String constant pool live, the heap or the stack?

I know the concept of a constants pool and the String constant pool used by JVMs to handle String literals. But I don't know which type of memory is used by the JVM to store String constant literals. ..

Split string with delimiters in C

How do I write a function to split and return an array for a string with delimiters in the C programming language? char* str = "JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC"; str_split(str,','); ..

Using multiple arguments for string formatting in Python (e.g., '%s ... %s')

I have a string that looks like '%s in %s' and I want to know how to seperate the arguments so that they are two different %s. My mind coming from Java came up with this: '%s in %s' % unicode(self.a..

How to count frequency of characters in a string?

I need to write some kind of loop that can count the frequency of each letter in a string. For example: "aasjjikkk" would count 2 'a', 1 's', 2 'j', 1 'i', 3 'k'. Ultimately id like these to end up i..

How to strip a specific word from a string?

I need to strip a specific word from a string. But I find python strip method seems can't recognize an ordered word. The just strip off any characters passed to the parameter. For example: >>..

Test whether string is a valid integer

I'm trying to do something common enough: Parse user input in a shell script. If the user provided a valid integer, the script does one thing, and if not valid, it does something else. Trouble is, I h..

Set the maximum character length of a UITextField in Swift

I know there are other topics on this but I can't seem to find out how to implement it. I'm trying to limit a UITextField to only 5 Characters Preferably Alphanumeric and - and . and _ I've see..

Convert time fields to strings in Excel

I have an excel sheet full of times. They are formatted so that they look like: 1:00:15 However if I change the format on the cells to text, they change to the underlying numeric representation of t..

String.Format not work in TypeScript

String.Format does not work in TypeScript. Error: The property 'format' does not exist on value of type '{ prototype: String; fromCharCode( number[]): string; (value?: any): string; new..

Count the number occurrences of a character in a string

What's the simplest way to count the number of occurrences of a character in a string? e.g. count the number of times 'a' appears in 'Mary had a little lamb'..

Java string to date conversion

What is the best way to convert a String in the format 'January 2, 2010' to a Date in Java? Ultimately, I want to break out the month, the day, and the year as integers so that I can use Date date =..

Serialize an object to string

I have the following method to save an Object to a file: // Save an object out to the disk public static void SerializeObject<T>(this T toSerialize, String filename) { XmlSerializer xmlSeri..

Aren't Python strings immutable? Then why does a + " " + b work?

My understanding was that Python strings are immutable. I tried the following code: a = "Dog" b = "eats" c = "treats" print a, b, c # Dog eats treats print a + " " + b + " " + c # Dog eats treats ..

String contains another two strings

Is it possible to have the contain function find if the string contains 2 words or more? This is what I'm trying to do: string d = "You hit someone for 50 damage"; string a = "damage"; string b = "so..

What is the canonical way to trim a string in Ruby without creating a new string?

This is what I have now - which looks too verbose for the work it is doing. @title = tokens[Title].strip! || tokens[Title] if !tokens[Title].nil? Assume tokens is a array obtained by splitti..

Random element from string array

I have a string array: String[] fruits = {"Apple","Mango","Peach","Banana","Orange","Grapes","Watermelon","Tomato"}; and i am getting random element from this by: String random = (fruits[new Rando..

Split text with '\r\n'

I was following this article And I came up with this code: string FileName = "C:\\test.txt"; using (StreamReader sr = new StreamReader(FileName, Encoding.Default)) { string[] stringSeparators..

How to search for a string in cell array in MATLAB?

Let's say I have the cell array strs = {'HA' 'KU' 'LA' 'MA' 'TATA'} What should I do if I want to find the index of 'KU'?..

Contains case insensitive

I have the following: if (referrer.indexOf("Ral") == -1) { ... } What I like to do is to make Ral case insensitive, so that it can be RAl, rAl, etc. and still match. Is there a way to say that Ral..

How to parse JSON string in Typescript

Is there a way to parse strings as JSON in Typescript. Example: In JS, we can use JSON.parse(). Is there a similar function in Typescript? I have a JSON object string as follows: {"name": "Bob", "er..

reading a line from ifstream into a string variable

In the following code : #include <iostream> #include <fstream> #include <string> using namespace std; int main() { string x = "This is C++."; ofstream of("d:/tester.txt");..

Converting a column within pandas dataframe from int to string

I have a dataframe in pandas with mixed int and str data columns. I want to concatenate first the columns within the dataframe. To do that I have to convert an int column to str. I've tried to do as ..

Convert string to a variable name

I am using R to parse a list of strings in the form: original_string <- "variable_name=variable_value" First, I extract the variable name and value from the original string and convert the value..

Repeat a string in JavaScript a number of times

In Perl I can repeat a character multiple times using the syntax: $a = "a" x 10; // results in "aaaaaaaaaa" Is there a simple way to accomplish this in Javascript? I can obviously use a function, b..

Convert Variable Name to String?

I would like to convert a python variable name into the string equivalent as shown. Any ideas how? var = {} print ??? # Would like to see 'var' something_else = 3 print ??? # Would print 'something..

Split Strings into words with multiple word boundary delimiters

I think what I want to do is a fairly common task but I've found no reference on the web. I have text with punctuation, and I want a list of the words. "Hey, you - what are you doing here!?" shoul..

Format a Go string without printing?

Is there a simple way to format a string in Go without printing the string? I can do: bar := "bar" fmt.Printf("foo: %s", bar) But I want the formatted string returned rather than printed so I can ..

What does the 'b' character do in front of a string literal?

Apparently, the following is the valid syntax: my_string = b'The string' I would like to know: What does this b character in front of the string mean? What are the effects of using it? What are a..

How do I convert from int to String?

I'm working on a project where all conversions from int to String are done like this: int i = 5; String strI = "" + i; I'm not familiar with Java. Is this usual practice or is something wrong, as..

Convert float to string with precision & number of decimal digits specified?

How do you convert a float to a string in C++ while specifying the precision & number of decimal digits? For example: 3.14159265359 -> "3.14"..

How to initialize a list of strings (List<string>) with many string values

How is it possible to initialize (with a C# initializer) a list of strings? I have tried with the example below but it's not working. List<string> optionList = new List<string> { "Add..

Substring in VBA

I have multiple strings in different cells like CO20: 20 YR CONVENTIONAL FH30: 30 YR FHLMC FHA31 I need to get the substring from 1 to till index of ':' or if that is not available till ending..

How to convert a string to an integer in JavaScript?

How do I convert a string to an integer in JavaScript?..

Query-string encoding of a Javascript Object

Do you know a fast and simple way to encode a Javascript Object into a string that I can pass via a GET Request? No jQuery, no other frameworks - just plain Javascript :)..

Typescript import/as vs import/require?

I am using TypeScript with Express/Node.js. For consuming modules, the TypeScript Handbook shows the following syntax: import express = require('express'); But also the typescript.d.ts file shows: ..

How to format LocalDate to string?

I have a LocalDate variable called date,when I print it displays 1988-05-05 I need to convert this to be printed as 05.May 1988.How to do this?..

500.21 Bad module "ManagedPipelineHandler" in its module list

I am getting the error: HTTP Error 500.21 - Internal Server Error Handler "CloudConnectHandler" has a bad module "ManagedPipelineHandler" in its module list my web.config file looks like this: <..

Regex: matching up to the first occurrence of a character

I am looking for a pattern that matches everything until the first occurrence of a specific character, say a ";" - a semicolon. I wrote this: /^(.*);/ But it actually matches everything (including..

Get a list of resources from classpath directory

I am looking for a way to get a list of all resource names from a given classpath directory, something like a method List<String> getResourceNames (String directoryName). For example, given a c..

List attributes of an object

Is there a way to grab a list of attributes that exist on instances of a class? class new_class(): def __init__(self, number): self.multi = int(number) * 2 self.str = str(number) ..

Condition within JOIN or WHERE

Is there any difference (performance, best-practice, etc...) between putting a condition in the JOIN clause vs. the WHERE clause? For example... -- Condition in JOIN SELECT * FROM dbo.Customers AS C..

Insert a row to pandas dataframe

I have a dataframe: s1 = pd.Series([5, 6, 7]) s2 = pd.Series([7, 8, 9]) df = pd.DataFrame([list(s1), list(s2)], columns = ["A", "B", "C"]) A B C 0 5 6 7 1 7 8 9 [2 rows x 3 columns] ..

Select first row in each GROUP BY group?

As the title suggests, I'd like to select the first row of each set of rows grouped with a GROUP BY. Specifically, if I've got a purchases table that looks like this: SELECT * FROM purchases; My O..

Export DataBase with MySQL Workbench with INSERT statements

I am trying to export the DataBase i have at MySQL Workbench but I am having troubles to generate the INSERT statements on the .sql file. I order to export the data, I do the reverse engineering for ..

Undefined symbols for architecture i386

Possible Duplicate: symbol(s) not found for architecture i386 I have an app to complete, and when I start trying to understand what the previous developer did (it was done with Xcode 3 I th..

How to get row count in an Excel file using POI library?

Guys I'm currently using the POI 3.9 library to work with excel files. I know of the getLastRowNum() function, which returns a number of rows in an Excel file. The only problem is getLastRowNum() ret..

css - position div to bottom of containing div

How can i position a div to the bottom of the containing div? <style> .outside { width: 200px; height: 200px; background-color: #EEE; /*to make it visible*/ } .inside { position..

Kill python interpeter in linux from the terminal

I want to kill python interpeter - The intention is that all the python files that are running in this moment will stop (without any informantion about this files). obviously the processes should be c..

Injection of autowired dependencies failed;

I am developing a small Java EE Hibernate Spring application and an error appeared: Error creating bean with name 'articleControleur': Injection of autowired dependencies failed; oct. 26, 2011 3:51:4..

How to trigger a phone call when clicking a link in a web page on mobile phone

I need to build a web page for mobile devices. There's only one thing I still haven't figured out: how can I trigger a phone call through the click of text? Is there a special URL I could enter like ..

rebase in progress. Cannot commit. How to proceed or stop (abort)?

When I run: git status I see this: rebase in progress; onto 9c168a5 You are currently rebasing branch 'master' on '9c168a5'. (all conflicts fixed: run "git rebase --continue") nothing to commit,..

Angular 5 Button Submit On Enter Key Press

I have an Angular 5 form application using all the usual models but on the forms I want the form to submit without having to physically click on the 'Submit' button. I know it's normally as easy as a..

Base64 Java encode and decode a string

I want to encode a string into base64 and transfer it through a socket and decode it back. But after decoding it gives different answer. Following is my code and result is "77+9x6s=" import javax..

ImportError: No module named psycopg2

When installing process of OpenERP 6, I want to generate a config file with this command, cd /home/openerp/openerp-server/bin/ ./ -s --stop-after-init -c /home/openerp/openerp-serve..

How do I scroll to an element using JavaScript?

I am trying to move the page to a <div> element. I have tried the next code to no avail: document.getElementById("divFirst").style.visibility = 'visible'; document.getElementById("divFirst").s..

How to fix a header on scroll

I am creating a header that once scrolled to a certain amount of pixels it fixes and stays in place. Can I do this using just css and html or do i need jquery too? I have created a demo so you can..

How do I make a placeholder for a 'select' box?

I'm using placeholders for text inputs which is working out just fine. But I'd like to use a placeholder for my selectboxes as well. Of course I can just use this code: <select> <option ..

TypeError: unhashable type: 'dict', when dict used as a key for another dict

I have this piece of code: for element in json[referenceElement].keys(): When I run that code, I get this error: TypeError: unhashable type: 'dict' What is the cause of that error and what ca..

How can I stop the browser back button using JavaScript?

I am doing an online quiz application in PHP. I want to restrict the user from going back in an exam. I have tried the following script, but it stops my timer. What should I do? The timer is stored in..

Print line numbers starting at zero using awk

Can anyone tell me how to print line numbers including zero using awk? Here is my input file stackfile2.txt when I run the below awk command I get actual_output.txt awk '{print NR,$0}' stackfil..

When to use which design pattern?

I like design patterns very much, but I find it difficult to see when I can apply one. I have read a lot of websites where design patterns are explained. I do understand the most of them, but I find i..

How can I reset or revert a file to a specific revision?

I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous version. I have done a git log ..

Should you commit .gitignore into the Git repos?

Do you think it is a good practice to commit .gitignore into a Git repo? Some people don't like it, but I think it is good as you can track the file's history. Isn't it?..

How can I get a list of all values in select box?

I am stumped. I have a form with a dropdown list, and I would like to grab a list of all the values in the list. I pulled the below example from w3 schools (yes, I know it's unreliable, but other solu..

How to extract epoch from LocalDate and LocalDateTime?

How do I extract the epoch value to Long from instances of LocalDateTime or LocalDate? I've tried the following, but it gives me other results: LocalDateTime time = LocalDateTime.parse("04.02.2014 ..

How to use OR condition in a JavaScript IF statement?

I understand that in JavaScript you can write: if (A && B) { do something } But how do I implement an OR such as: if (A OR B) { do something } ..

Fatal error: Call to undefined function mysql_connect()

I have set up PHP, MySQL, and Apache. localhost() for PHP and it is working well. But after I downloaded MySQL, it reports: Fatal error: Call to undefined function mysql_connect() How can I fix ..

ReferenceError: event is not defined error in Firefox

I've made a page for a client and I initially was working in Chrome and forgot to check if it was working in Firefox. Now, I have a big problem because the whole page is based upon a script that doesn..

Converting to upper and lower case in Java

I want to convert the first character of a string to Uppercase and the rest of the characters to lowercase. How can I do it? Example: String inputval="ABCb" OR "a123BC_DET" or "aBcd" String output..

Is there a way to get the git root directory in one command?

Mercurial has a way of printing the root directory (that contains .hg) via hg root Is there something equivalent in git to get the directory that contains the .git directory?..

Creating a daemon in Linux

In Linux I want to add a daemon that cannot be stopped and which monitors filesystem changes. If any changes are detected, it should write the path to the console where it was started plus a newline. ..

Make an Installation program for C# applications and include .NET Framework installer into the setup

I've finished my C# application, but I have a little problem: When I try to run my application in another PC, I need always to Install .NET Framework 4.0. Is there something to do to make it work wi..

Can't pickle <type 'instancemethod'> when using multiprocessing

I'm trying to use multiprocessing's function to divide out work simultaneously. When I use the following code, it works fine: import multiprocessing def f(x): return x*x def go(): ..

Angular - POST uploaded file

I'm using Angular, TypeScript to send a file, along with JSON Data to a server. Below is my code: import {Component, View, NgFor, FORM_DIRECTIVES, FormBuilder, ControlGroup} from 'angular2/angular2'..

E: Unable to locate package mongodb-org

I am trying to download mongodb and I am following the steps on this link. But when I get to the step: sudo apt-get install -y mongodb-org I get the following error: Reading package lists... Done..

Offline Speech Recognition In Android (JellyBean)

It looks as though Google has made offline speech recognition available from Google Now for third-party apps. It is being used by the app named Utter. Has anyone seen any implementations of how to d..

Why does the 'int' object is not callable error occur when using the sum() function?

I'm trying to figure out why I'm getting an error when using the sum function on a range. Here is the code: data1 = range(0, 1000, 3) data2 = range(0, 1000, 5) data3 = list(set(data1 + data2)) # mak..

Maven2: Best practice for Enterprise Project (EAR file)

I am just switching from Ant to Maven and am trying to figure out the best practice to set up a EAR file based Enterprise project? Let's say I want to create a pretty standard project with a jar file..

HAX kernel module is not installed

I have just downloaded latest android studio from official android site and installed it. But I am getting this error instead of having Intel X 86 Emulator accelerator. What can cause this error emul..

brew install mysql on macOS

I'm trying to setup up MySQL on mac os 10.6 using Homebrew by brew install mysql 5.1.52. Everything goes well and I am also successful with the mysql_install_db. However when I try to connect to the ..

How do you calculate log base 2 in Java for integers?

I use the following function to calculate log base 2 for integers: public static int log2(int n){ if(n <= 0) throw new IllegalArgumentException(); return 31 - Integer.numberOfLeadingZeros(..

CodeIgniter Active Record - Get number of returned rows

I'm very new to CodeIgniter and Active Record in particular, I know how to do this well in normal SQL but I'm trying to learn. How can I select some data from one of my tables, and then count how man..

How to show matplotlib plots in python

I am sure the configuration of matplotlib for python is correct since I have used it to plot some figures. But today it just stop working for some reason. I tested it with really simple code like: i..

Catching errors in Angular HttpClient

I have a data service that looks like this: @Injectable() export class DataService { baseUrl = 'http://localhost' constructor( private httpClient: HttpClient) { } get(url,..

Get Selected Item Using Checkbox in Listview

I am creating an Android application where I have a ListView that displays all of the applications that were installed in my mobile phone. My ListView is customized, it is contains a Icon, TextView a..

Java replace all square brackets in a string

I want to remove square brackets from a string, but I don't know how. String str = "[Chrissman-@1]"; str = replaceAll("\\[\\]", ""); String[] temp = str.split("-@"); System.out.println("Nickname: " ..

PHP Redirect with POST data

I did some research on this topic, and there are some experts who have said that it is not possible, so I would like to ask for an alternative solution. My situation: Page A: [checkout.php] Customer..

gcc warning" 'will be initialized after'

I am getting a lot of these warnings from 3rd party code that I cannot modify. Is there a way to disable this warning or at least disable it for certain areas (like #pragma push/pop in VC++)? Example..

Does C# have a String Tokenizer like Java's?

I'm doing simple string input parsing and I am in need of a string tokenizer. I am new to C# but have programmed Java, and it seems natural that C# should have a string tokenizer. Does it? Where is it..

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

I'm hoping someone can enlighten me as to what could possibly be causing this error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. I cann..

The Use of Multiple JFrames: Good or Bad Practice?

I'm developing an application which displays images, and plays sounds from a database. I'm trying to decide whether or not to use a separate JFrame to add images to the database from the GUI. I'm ju..

How can I add a class attribute to an HTML element generated by MVC's HTML Helpers?

ASP.NET MVC can generate HTML elements using HTML Helpers, for example @Html.ActionLink(), @Html.BeginForm() and so on. I know I can specify form attributes by creating an anonymous object and pass t..

How to append rows to an R data frame

I have looked around StackOverflow, but I cannot find a solution specific to my problem, which involves appending rows to an R data frame. I am initializing an empty 2-column data frame, as follows. ..

Sort CSV file by column priority using the "sort" command

I have a csv file, and I would like to sort it by column priority, like "order by". For example: 3;1;2 1;3;2 1;2;3 2;3;1 2;1;3 3;2;1 If this situation was the result of a "select", the "order by" w..

How do I increase the RAM and set up host-only networking in Vagrant?

I would like to increase the RAM to at least 1 GB and I would like to configure “Host-Only” networking to use "". This is my Vagrantfile: # -*- mode: ruby -*- # vi: set ft=ruby : V..

How do I wait until Task is finished in C#?

I want to send a request to a server and process the returned value: private static string Send(int id) { Task<HttpResponseMessage> responseTask = client.GetAsync("aaaaa"); string resul..

The multi-part identifier could not be bound

I've seen similar errors on SO, but I don't find a solution for my problem. I have a SQL query like: SELECT DISTINCT a.maxa , b.mahuyen , a.tenxa , b.tenhuyen , ..

How to convert JSON to XML or XML to JSON?

I started to use Json.NET to convert a string in JSON format to object or viceversa. I am not sure in the Json.NET framework, is it possible to convert a string in JSON to XML format and viceversa?..

git - Your branch is ahead of 'origin/master' by 1 commit

I am newbie in git and I am working on git. I added some files in git : git add <file1> git add <file2> then I wanted to push that for review, but mistakenly I did git commit so..

reading external sql script in python

I am working on a learning how to execute SQL in python (I know SQL, not Python). I have an external sql file. It creates and inserts data into three tables 'Zookeeper', 'Handles', 'Animal'. Then I..

Get the list of stored procedures created and / or modified on a particular date?

I want to find which stored procedure I've created and also I want to find which stored procedure I've modified in my SQL Server on a particular date like 27 september 2012 (27/09/2012). Is there any..

How to detect page zoom level in all modern browsers?

How can I detect the page zoom level in all modern browsers? While this thread tells how to do it in IE7 and IE8, I can't find a good cross-browser solution. Firefox stores the page zoom level for fu..

How to cin to a vector

I'm trying to ask the user to enter numbers that are put into a vector, then using a function call to count the numbers, why is this not working? I am only able to count the first number. template &..

Stretch Image to Fit 100% of Div Height and Width

I have a div with the following CSS #mydiv{ top: 50px; left: 50px; width: 200px; height: 200px; } and my HTML looks like this <div id = "mydiv"> <img src = "folder/fil..

How to return value from an asynchronous callback function?

This question is asked many times in SO. But still I can't get stuff. I want to get some value from callback. Look at the script below for clarification. function foo(address){ // google map..

How to check 'undefined' value in jQuery

Possible Duplicate: Detecting an undefined object property in JavaScript javascript undefined compare How we can add a check for an undefined variable, like: function A(val) { if (val ..

Writing data into CSV file in C#

I am trying to write into a csv file row by row using C# language. Here is my function string first = reader[0].ToString(); string second=image.ToString(); string csv = string.Format("{0},{1}\n", fir..

How to Set Variables in a Laravel Blade Template

I'm reading the Laravel Blade documentation and I can't figure out how to assign variables inside a template for use later. I can't do {{ $old_section = "whatever" }} because that will echo "whatever"..

Could not load file or assembly 'xxx' or one of its dependencies. An attempt was made to load a program with an incorrect format

I just checked out a revision from Subversion to a new folder. Opened the solution and I get this when run: Could not load file or assembly 'xxxx' or one of its dependencies. An attempt was made to ..

Git submodule push

If I modify a submodule, can I push the commit back to the submodule origin, or would that require a clone? If clone, can I store a clone inside another repository?..

python replace single backslash with double backslash

In python, I am trying to replace a single backslash ("\") with a double backslash("\"). I have the following code: directory = string.replace("C:\Users\Josh\Desktop\20130216", "\", "\\") However, ..

How to display a Windows Form in full screen on top of the taskbar?

I have a .net windows application that needs to run in full screen. When the application starts however the taskbar is shown on top of the main form and it only disappears when activating the form by ..

Is there any sed like utility for cmd.exe?

I want to programmatically edit file content using windows command line (cmd.exe). In *nix there is sed for this tasks. Is there any useful native equivalent in windows?..

Ignoring new fields on JSON objects using Jackson

I'm using Jackson JSON library to convert some JSON objects to POJO classes on an android application. The problem is, the JSON objects might change and have new fields added while the application is ..

Convert double to string C++?

Possible Duplicate: How do I convert a double into a string in C++? I want to combine a string and a double and g++ is throwing this error: main.cpp: In function ‘int main()’: main.cpp..

Node.js: Difference between req.query[] and req.params

Is there a difference between obtaining QUERY_STRING arguments via req.query[myParam] and req.params.myParam? If so, when should I use which?..

How to convert current date to epoch timestamp?

How to convert current date to epoch timestamp ? Format current date: 29.08.2011 11:05:02 ..

What is the difference between tree depth and height?

This is a simple question from algorithms theory. The difference between them is that in one case you count number of nodes and in other number of edges on the shortest path between root and concrete ..

Position Relative vs Absolute?

What is the difference between position: relative and position: absolute in CSS? And when should you use them?..

<strong> vs. font-weight:bold & <em> vs. font-style:italic

Is there any real difference between using <strong> and <em> instead of the CSS properties: font-weight: bold; font-style: italic; Also, what is really the reason that both options exis..

How to get String Array from arrays.xml file

I am just trying to display a list from an array that I have in my arrays.xml. When I try to run it in the emulator, I get a force close message. If I define the array in the java file String[] te..

matplotlib set yaxis label size

How can I change the size of only the yaxis label? Right now, I change the size of all labels using pylab.rc('font', family='serif', size=40) but in my case, I would like to make the y-axis label l..

Returning null in a method whose signature says return int?

public int pollDecrementHigherKey(int x) { int savedKey, savedValue; if (this.higherKey(x) == null) { return null; // COMPILE-TIME ERROR } ..

How do I start/stop IIS Express Server?

I have installed MS Visual Web Developer 2010 which includes IIS Express. Before this, I had installed XAMPP server for my php applications. I would like to know how can I stop IIS in order to be ab..

Throw HttpResponseException or return Request.CreateErrorResponse?

After reviewing an article Exception Handling in ASP.NET Web API I am a bit confused as to when to throw an exception vs return an error response. I am also left wondering whether it is possible to mo..

MySql: Tinyint (2) vs tinyint(1) - what is the difference?

I knew boolean in mysql as tinyint (1). Today I see a table with defined an integer like tinyint(2), and also others like int(4), int(6) ... What does the size means in field of type integer and ti..

How to get just one file from another branch

I am using git and working on master branch. This branch has a file called app.js. I have an experiment branch in which I made a bunch of changes and tons of commits. Now I want to bring all the chan..

How to change background and text colors in Sublime Text 3

My questions are: How do I change the overall colors (background and font)? How do I change the colors based on the file type that is open? Do I need to learn how to create a whole theme? I read ..

Converting a list to a set changes element order

Recently I noticed that when I am converting a list to set the order of elements is changed and is sorted by character. Consider this example: x=[1,2,20,6,210] print x # [1, 2, 20, 6, 210] # the or..

Parser Error: '_Default' is not allowed here because it does not extend class 'System.Web.UI.Page' & MasterType declaration

I recently converted a website project to a web application project in Visual Studio 2008. I finally got it to compile, and the first page (the login screen) displayed as normal, but then when it red..

Populate data table from data reader

I'm doing a basic thing in C# (MS VS2008) and have a question more about proper design than specific code. I am creating a datatable and then trying to load the datatable from a datareader (which is ..

How do I invoke a text editor from the terminal?

In the Windows command prompt, I can type notepad helloworld.cpp which will then create a .cpp file with the name helloworld and open up Notepad for me. Is there a similar function for Mac Terminal, ..

How do I reformat HTML code using Sublime Text 2?

I've got some poorly-formatted HTML code that I'd like to reformat. Is there a command that will automatically reformat HTML code in Sublime Text 2 so it looks better and is easier to read?..

How do you get a list of the names of all files present in a directory in Node.js?

I'm trying to get a list of the names of all the files present in a directory using Node.js. I want output that is an array of filenames. How can I do this?..

Hibernate Union alternatives

What alternatives do I have to implement a union query using hibernate? I know hibernate does not support union queries at the moment, right now the only way I see to make a union is to use a view tab..

How do I create a table based on another table

I want to create a table based on the definition of another table. I'm coming from oracle and I'd normally do this: CREATE TABLE schema.newtable AS SELECT * FROM schema.oldtable; I can't seem to ..

Dictionary returning a default value if the key does not exist

I find myself using the current pattern quite often in my code nowadays var dictionary = new Dictionary<type, IList<othertype>>(); // Add stuff to dictionary var somethingElse = dictiona..

How to set a border for an HTML div tag

I am trying to define a border around a div tag in HTML. In some browsers the border does not appear. Here is my HTML code: _x000D_ _x000D_ <div id="divActivites" name="divActivites" style="bord..

Javascript - Replace html using innerHTML

I'm trying to replace html using innerHTML javascript. From: aaaaaa/cat/bbbbbb To: <a href="">Helloworld</a> This's my code <html> <head>..

Adding an arbitrary line to a matplotlib plot in ipython notebook

I'm rather new to both python/matplotlib and using it through the ipython notebook. I'm trying to add some annotation lines to an existing graph and I can't figure out how to render the lines on a gra..

Add custom headers to WebView resource requests - android

I need to add custom headers to EVERY request coming from the WebView. I know loadURL has the parameter for extraHeaders, but those are only applied to the initial request. All subsequent requests d..

Scanner vs. StringTokenizer vs. String.Split

I just learned about Java's Scanner class and now I'm wondering how it compares/competes with the StringTokenizer and String.Split. I know that the StringTokenizer and String.Split only work on String..

Custom Listview Adapter with filter Android

Please am trying to implement a filter on my listview. But whenever the text change, the list disappears.Please Help Here are my codes. The adapter class. package com.talagbe.schymn; import java.ut..

Android: How to change the ActionBar "Home" Icon to be something other than the app icon?

My application's main icon consists of two parts in one image: a logo and a few letters below it. This works well for the launcher icon for the app, but when the icon appears on the left edge of the A..

Angular2 - Radio Button Binding

I want to use radio button in a form using Angular 2 Options : <br/> 1 : <input name="options" ng-control="options" type="radio" value="1" [(ng-model)]="model.options" ><br/> 2 ..

How to remove a virtualenv created by "pipenv run"

I am learning Python virtual environment. In one of my small projects I ran pipenv run python and it created a virtualenv for me in C:\Users\USERNAME\.virtualenvs I found it also created..

Proper usage of Java -D command-line parameters

When passing a -D parameter in Java, what is the proper way of writing the command-line and then accessing it from code? For example, I have tried writing something like this... if (System.getPrope..

What is for?

What is for in a Python source directory?..

Math.random() versus Random.nextInt(int)

What is the difference between Math.random() * n and Random.nextInt(n) where n is an integer?..

insert datetime value in sql database with c#

How do I insert a datetime value into a SQL database table where the type of the column is datetime?..


What is the difference between CROSS JOIN and INNER JOIN? CROSS JOIN: SELECT Movies.CustomerID, Movies.Movie, Customers.Age, Customers.Gender, Customers.[Education Level], Customers.[..

How to add a tooltip to an svg graphic?

I have a series of svg rectangles (using D3.js) and I want to display a message on mouseover, the message should be surrounded by a box that acts as background. They should both be perfectly aligned t..

how to get vlc logs?

I am trying to run rtsp url from the VLC player. But an error appears, and "see logs for details" comes up in a dialog box. How can I enable logs in VLC?..

Why is not Element in Typescript?

I simply want to do this with my KeyboardEvent var tag =; While is of type EventTarget it does not inherit from Element. So I have to cast it like this..

Array of PHP Objects

So I have been searching for a while and cannot find the answer to a simple question. Is it possible to have an array of objects in PHP? Such as: $ar=array(); $ar[]=$Obj1 $ar[]=$obj2 For so..

How to select last two characters of a string

I need to select last two characters from the variable, whether it is digit or letters. For example: var member = "my name is Mate"; I would like to show last two letters from the string in..

C pass int array pointer as parameter into a function

I want to pass the B int array pointer into func function and be able to change it from there and then view the changes in main function #include <stdio.h> int func(int *B[10]){ } int main(v..

byte[] to hex string

How do I convert a byte[] to a string? Every time I attempt it, I get System.Byte[] instead of the value. Also, how do I get the value in Hex instead of a decimal?..

multiple conditions for filter in spark data frames

I have a data frame with four fields. one of the field name is Status and i am trying to use a OR condition in .filter for a dataframe . I tried below queries but no luck. df2 = df1.filter(("Status=2..

How can I display an image from a file in Jupyter Notebook?

I would like to use an IPython notebook as a way to interactively analyze some genome charts I am making with Biopython's GenomeDiagram module. While there is extensive documentation on how to use mat..

How to truncate the time on a DateTime object in Python?

What is a classy way to way truncate a python datetime object? In this particular case, to the day. So basically setting hour, minute, seconds, and microseconds to 0. I would like the output to als..

Virtual Memory Usage from Java under Linux, too much memory used

I have a problem with a Java application running under Linux. When I launch the application, using the default maximum heap size (64 MB), I see using the tops application that 240 MB of virtual Memor..

BehaviorSubject vs Observable?

I'm looking into Angular RxJs patterns and I don't understand the difference between a BehaviorSubject and an Observable. From my understanding, a BehaviorSubject is a value that can change over time..

How to make a back-to-top button using CSS and HTML only?

I'm trying to do a back to top button but to scroll down and up to a certain point on the page. For instance you have a long text and you want to bring the user to the next paragraph by simply having ..

Naming Classes - How to avoid calling everything a "<WhatEver>Manager"?

A long time ago I have read an article (I believe a blog entry) which put me on the "right" track on naming objects: Be very very scrupulous about naming things in your program. For example if my app..

How to disable the back button in the browser using JavaScript

I want to disable the back button for a website. Whenever the person clicks on the browser back button it should not be able to go on the page the user visited before...

Replace a string in shell script using a variable

I am using the below code for replacing a string inside a shell script. echo $LINE | sed -e 's/12345678/"$replace"/g' but it's getting replaced with $replace instead of the value of that variable. ..

How to determine the screen width in terms of dp or dip at runtime in Android?

I need to code the layout of the android widgets using dip/dp (in java files). At runtime if I code, int pixel=this.getWindowManager().getDefaultDisplay().getWidth(); this return the screen width..

Force HTML5 youtube video

Regarding the Youtube API Blog they are experimenting with their new HTML5 Video Player. Apparently to play a video in html5, you have to use the iframe embedding code : <iframe class="youtube-pl..

Filter an array using a formula (without VBA)

Is it possible to filter an array using a single formula (without autofilter, VBA, or additional columns)? For example, I have the following spreadsheet: A | B | C -------------------- 1| I..

How to write :hover using inline style?

<a href="#">Alink</a> All i need is while i hover the color should change for the link, But it should be completely using only inline CSS *No Scripting or external CSS Please he..

Closing database connections in Java

I am getting a little confused. I was reading the below from Java Database Connectivity: Connection conn = DriverManager.getConnection( "jdbc:somejdbcvendor:other data needed by some jdbc ve..

jquery stop child triggering parent event

I have a div which I have attached an onclick event to. in this div there is a tag with a link. When I click the link the onclick event from the div is also triggered. How can i disable this so that ..

jquery change class name

I want to change the class of a td tag given the td tag's id: <td id="td_id" class="change_me"> ... I want to be able to do this while inside the click event of some other dom object. How do..

Is it possible to open developer tools console in Chrome on Android phone?

An AngularJS application works fine on desktop, but is not rendering properly on mobile (actual code is showing). This is on an Android phone. I would like to see what errors are showing in the conso..

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I am trying to import a file which was saved using json.dumps and contains tweet coordinates: { "type": "Point", "coordinates": [ -4.62352292, 55.44787441 ] } My code ..

T-SQL: Export to new Excel file

I have a script that does various things and the end result is one large table. I was wondering how I could export this final table to a new Excel file (with column headers as well). I would need to ..

Is Eclipse the best IDE for Java?

Is Eclipse the best IDE for Java? If not, is there something better? I want to know and possibly try it out. Thanks...

C++, how to declare a struct in a header file

I've been trying to include a structure called "student" in a student.h file, but I'm not quite sure how to do it. My student.h file code consists of entirely: #include<string> using namespace..

Convert PDF to PNG using ImageMagick

using ImageMagick, what command should i use to convert a PDF to PNG? I need highest quality, smallest file size. this is what I have so far (very slow by the way): convert -density 300 -depth 8 -qua..

"Register" an .exe so you can run it from any command line in Windows

How can you make a .exe file accessible from any location in the Windows command window? Is there some registry entry that has to be entered?..

You have to be inside an angular-cli project in order to use the build command after reinstall of angular-cli

I had the latest angular-cli installed globally and my project was building successfully. While reading a suggested solution for another issue, ( I..

How to generate javadoc comments in Android Studio

Can I use shortcut keys in Android studio to generate javadoc comments? If not, what is the easiest way to generate javadoc comments?..

C# - using List<T>.Find() with custom objects

I'm trying to use a List<T> with a custom class of mine, and being able to use methods like Contains(), Find(), etc., on the list. I thought I'd just have to overload the operator == but apparen..

How to put a tooltip on a user-defined function

In Excel 2007, how do I add a description and parameter hints to a user-defined function? When I start typing a function invocation for a built-in function, Excel shows a description and parameter lis..

Write to Windows Application Event Log

Is there a way to write to this event log: Or at least, some other Windows default log, where I don't have to register an event source?..

making matplotlib scatter plots from dataframes in Python's pandas

What is the best way to make a series of scatter plots using matplotlib from a pandas dataframe in Python? For example, if I have a dataframe df that has some columns of interest, I find myself typi..

Switch statement multiple cases in JavaScript

I need multiple cases in switch statement in JavaScript, Something like: switch (varName) { case "afshin", "saeed", "larry": alert('Hey'); break; def..

Avoid browser popup blockers

I'm developing an OAuth authentication flow purely in JavaScript and I want to show the user the "grant access" window in a popup, but it gets blocked. How can I prevent pop up windows created by eit..

How to find column names for all tables in all databases in SQL Server

I want to find all column names in all tables in all databases. Is there a query that can do that for me? The database is Microsoft SQL Server 2000...

How to delete columns that contain ONLY NAs?

I have a data.frame containing some columns with all NA values, how can I delete them from the data.frame. Can I use the function na.omit(...) specifying some additional arguments?..

How to hide a div after some time period?

I need to hide a div (like "mail sent successful" in Gmail) after a certain time period when I reload the page. How can I do that?..

Get absolute path to workspace directory in Jenkins Pipeline plugin

I'm currently doing some evaluation on the Jenkins Pipeline plugin (formerly know as Workflow plugin). Reading the documentation I found out that I currently cannot retriev the workspace path using en..

How to use Morgan logger?

I cannot log with Morgan. It doesn't log info to console. The documentation doesn't tell how to use it. I want to see what a variable is. This is a code from response.js file of expressjs framework: ..

How to solve ADB device unauthorized in Android ADB host device?

When I'm using a rooted Android device as ADB host to send adb command "adb devices" to Samsung S4, I received device unauthorized error message. However when I tried adb to Samsung Galaxy Nexus, it i..

Capturing image from webcam in java?

How can I continuously capture images from a webcam? I want to experiment with object recognition (by maybe using java media framework). I was thinking of creating two threads one thread: Node 1..

iOS Safari – How to disable overscroll but allow scrollable divs to scroll normally?

I'm working on an iPad-based web app, and need to prevent overscrolling so that it seems less like a web page. I'm currently using this to freeze the viewport and disable overscroll:

Can anybody tell me details about hs_err_pid.log file generated when Tomcat crashes?

Can anybody tell me details about the hs_err_pid.log file generated when Tomcat crashes? Are any specific settings required on the Java tab of Tomcat configuration tool in order to generate a hs_err_..

How to set time to 24 hour format in Calendar

I need to set the time on the current date. The time string is always in 24 hour format but the result I get is wrong: SimpleDateFormat df = new SimpleDateFormat("kk:mm"); Date d1 = df.parse("10:..

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0

I am getting the following error ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0 when trying to connect to my MySQL server. What I am doing..

Is it possible to display my iPhone on my computer monitor?

As the title says, is this possible? I want to "mirror" my actions on the iPhone so it shows on the computer monitor. We've seen this on the Apple key notes, but I am not sure if this feature is publ..

call a function in success of datatable ajax call

Is that possible to invoke a javascript function in success of datatable ajax call. Here is the code am trying to use, var oTable = $('#app-config').dataTable( { "bAutoWid..

Properties order in Margin

If I have such string in XAML: Storyboard.TargetProperty="Margin" From="1,2,3,4" To="0,0,0,0" What is Top Bottom Right and Left? 1- right 2- top 3- left 4 - bottom Is that right?..

Download Returned Zip file from URL

If I have a URL that, when submitted in a web browser, pops up a dialog box to save a zip file, how would I go about catching and downloading this zip file in Python?..

How to put a UserControl into Visual Studio toolBox

I made a usercontrol in my project, and after building project, I need to put it in my toolbox, and use it as a common control. but i can't. the UserControl is in my project namespace, and I tried Cho..

Visual Studio 2017 does not have Business Intelligence Integration Services/Projects

I do not see an option to create an SSIS project using Visual Studio 2017. ..

How do I check if a Key is pressed on C++

How could I possibly check if a Key is pressed on Windows?..

Create SQL identity as primary key?

create table ImagenesUsuario { idImagen int primary key not null IDENTITY } This doesn't work. How can I do this?..

Magento addFieldToFilter: Two fields, match as OR, not AND

I've been stuck on this for the last few hours. I got it working by hacking a few lines in /lib/Varien/Data/Collection/Db.php, but I'd rather use the proper solution and leave my core untouched. All ..

HTML 5 video or audio playlist

Can I use a <video> or <audio> tag to play a playlist, and to control them? My goal is to know when a video/song has finished to play and take the next and change its volume...

Python: Differentiating between row and column vectors

Is there a good way of differentiating between row and column vectors in python? So far I'm using numpy and scipy and what I see so far is that If I was to give one a vector, say from numpy import * ..

Can curl make a connection to any TCP ports, not just HTTP/HTTPS?

Can curl make a connection to any TCP ports not just HTTP/HTTPS I need to check for an open port, for example: 11740. Is this possible?..

How can I declare optional function parameters in JavaScript?

Can I declare default parameter like function myFunc( a, b=0) { // b is my optional parameter } in JavaScript?..

Pinging an IP address using PHP and echoing the result

I have the following function that I doesn't work so far. I would like to ping an IP address and then to echo whether the IP is alive or not. function pingAddress($ip){ $pingresult = shell_exec("..

How to send FormData objects with Ajax-requests in jQuery?

The XMLHttpRequest Level 2 standard (still a working draft) defines the FormData interface. This interface enables appending File objects to XHR-requests (Ajax-requests). Btw, this is a new feature -..

Adding a month to a date in T SQL

How can I add one month to a date that I am checking under the where clause? e.g.: select * from Reference where reference_dt + 1 month ..

Javascript (+) sign concatenates instead of giving sum of variables

Why when I use this: (assuming i = 1) divID = "question-" + i+1; I get question-11 and not question-2?..

Access multiple elements of list knowing their index

I need to choose some elements from the given list, knowing their index. Let say I would like to create a new list, which contains element with index 1, 2, 5, from given list [-2, 1, 5, 3, 8, 5, 6]. W..

Check element exists in array

In PHP there a function called isset() to check if something (like an array index) exists and has a value. How about Python? I need to use this on arrays because I get "IndexError: list index out of ..

Python unicode equal comparison failed

This question is linked to Searching for Unicode characters in Python I read unicode text file using python codecs'story.txt', 'rb', 'utf-8-sig') And was trying to search strings in ..

PDF to image using Java

I to want convert PDF pages into an image (PNG,JPEG/JPG or GIF). I want them in full-page sizes. How can this be done using Java? What libraries are available for achieving this? ..

Reading file using relative path in python project

Say I have a python project that is structured as follows: project /data test.csv /package from .module import test ..

Using prepared statements with JDBCTemplate

I'm using the JDBC template and want to read from a database using prepared statements. I iterate over many lines in a .csv file, and on every line I execute some SQL select queries with corresponding..

UICollectionView Self Sizing Cells with Auto Layout

I'm trying to get self sizing UICollectionViewCells working with Auto Layout, but I can't seem to get the cells to size themselves to the content. I'm having trouble understanding how the cell's size ..

How to write html code inside <?php ?>, I want write html code within the PHP script so that it can be echoed from Backend

I want to create table inside php script .. Is there any way that i could create table inside php script.? <?php html code to create table ?> ..

Enable binary mode while restoring a Database from an SQL dump

I am extremely new to MySQL and am running it on Windows. I am trying to restore a Database from a dumpfile in MySQL, but I get the following error: $ >mysql -u root -p -h localhost -D database -..

Error:attempt to apply non-function

I'm trying to run the following code in R, but I'm getting an error. I'm not sure what part of the formula is incorrect. Any help would be greatly appreciated. > censusdata_20$AGB93 = WD * exp(-1..

powerpoint loop a series of animation

I am currently working on a slide with an animation of sunrise to sunset as a background. Then there are some pictures fade in and fade out. Now, I am having difficult to loop the series of animation..

html select only one checkbox in a group

So how can I only allow a user to select only one checkbox? I know radio buttons are "ideal", but for my's not. I have a field where users need to select either or of the two options, b..

Where is the file in a Spring Boot project?

I started a new Spring boot project, I want to change the port number and I read that I have to modify the /resource/ to do so. I cannot locate this file however, did I miss so..

What does LINQ return when the results are empty

I have a question about LINQ query. Normally a query returns a IEnumerable<T> type. If the return is empty, not sure if it is null or not. I am not sure if the following ToList() will throw an e..

How to create an integer-for-loop in Ruby?

I have a variable "x" in my view. I need to display some code "x" number of times. I basically want to set up a loop like this: for i = 1 to x do something on (i) end Is there a way to do this?..