Questions Tagged with #Vtune

This is a tag for Intel VTune Amplifier XE profiling tool questions.

What's the best free C++ profiler for Windows?

I'm looking for a profiler in order to find the bottleneck in my C++ code. I'd like to find a free, non-intrusive, and good profiling tool. I'm a game developer, and I use PIX for Xbox 360 and fo..

Why are iframes considered dangerous and a security risk?

Why are iframes considered dangerous and a security risk? Can someone describe an example of a case where it can be used maliciously?..

I am getting an "Invalid Host header" message when connecting to webpack-dev-server remotely

I am using as an environment, a Cloud9.io ubuntu VM Online IDE and I have reduced by troubleshooting this error to just running the app with Webpack dev server. I launch it with: webpack-dev-server..

How do I find the absolute position of an element using jQuery?

Is there a way of finding the absolute position of an element, i.e. relative to the start of the window, using jQuery?..

How to use moment.js library in angular 2 typescript app?

I tried to use it with typescript bindings: npm install moment --save typings install moment --ambient -- save test.ts: import {moment} from 'moment/moment'; And without: npm install moment --s..

How to format date with hours, minutes and seconds when using jQuery UI Datepicker?

Is it possible to format a date with jQuery UI Datepicker as to show hours, minutes and seconds? This is my current mockup: _x000D_ _x000D_ $(function() {_x000D_ $('#datepicker').datepicker({ da..

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..

Horizontal Scroll Table in Bootstrap/CSS

How could I make it so that a table inside a container with its own width does not follow the width of the container and instead, retain the table's width when it's not inside the container. I have a ..

Type Checking: typeof, GetType, or is?

I've seen many people use the following code: Type t = typeof(obj1); if (t == typeof(int)) // Some code here But I know you could also do this: if (obj1.GetType() == typeof(int)) // Some c..

WITH (NOLOCK) vs SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

Could someone give me some guidance on when I should use WITH (NOLOCK) as opposed to SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED What are the pros/cons of each? Are there any unintended consequ..

How do you set a JavaScript onclick event to a class with css

Let's say I want that every time the user click any link an alert pops up that says "hohoho". Do I need to add onclick="alert('hohoho')" to every link or can I set this with CSS so that it works with..

Why doesn't Python have multiline comments?

OK, I'm aware that triple-quotes strings can serve as multiline comments. For example, """Hello, I am a multiline comment""" and '''Hello, I am a multiline comment''' But technically sp..

python multithreading wait till all threads finished

This may have been asked in a similar context but I was unable to find an answer after about 20 minutes of searching, so I will ask. I have written a Python script (lets say: scriptA.py) and a script..

javascript - Create Simple Dynamic Array

What's the most efficient way to create this simple array dynamically. var arr = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]; Let's say we can get the number 10 from a variable var mynumb..

How can I use a C++ library from node.js?

How can I use a C++ library from node.js?..

Formatting Phone Numbers in PHP

I am working on an SMS app and need to be able to convert the sender's phone number from +11234567890 to 123-456-7890 so it can be compared to records in a MySQL database. The numbers are stored in ..

How to achieve function overloading in C?

Is there any way to achieve function overloading in C? I am looking at simple functions to be overloaded like foo (int a) foo (char b) foo (float c , int d) I think there is no straight forwa..

Using jQuery to center a DIV on the screen

How do I go about setting a <div> in the center of the screen using jQuery?..

Display curl output in readable JSON format in Unix shell script

In my Unix shell script, when I execute a curl command, the result will be displayed as below which I am redirecting to file: {"type":"Show","id":"123","title":"name","description":"Funny","channelTi..

Where is PATH_MAX defined in Linux?

Which header file should I invoke with #include to be able to use PATH_MAX as an int for sizing a string? I want to be able to declare: char *current_path[PATH_MAX]; But when I do so my compiler (..

How to run a command as a specific user in an init script?

I'm writing an init script which is supposed to execute a single command as a user different than root. This is how I'm doing it currently: sudo -u username command This generally works as expected ..

Java - get the current class name?

All I am trying to do is to get the current class name, and java appends a useless non-sense $1 to the end of my class name. How can I get rid of it and only return the actual class name? String clas..

Convert HTML to NSAttributedString in iOS

I am using a instance of UIWebView to process some text and color it correctly, it gives the result as HTML but rather than displaying it in the UIWebView I want to display it using Core Text with a N..

Why does corrcoef return a matrix?

It seems strange to me that np.corrcoef returns a matrix. correlation1 = corrcoef(Strategy1Returns,Strategy2Returns) [[ 1. -0.99598935] [-0.99598935 1. ]] Does anyone know why th..

Java, How to specify absolute value and square roots

How do you specify in java how to make a square root and absolute value? Here is what I have: if(variable < 0){ variable = variable + variable2; } But is there an easier way to get the abso..

How to copy directories with spaces in the name

I am trying to use robocopy but am unable to make it work because of spaces in the directory names. I am trying to copy 3 directories: My Documents, My Music and My Pictures to 'C:\test-backup' but wa..

Get random boolean in Java

Okay, I implemented this SO question to my code: Return True or False Randomly But, I have strange behavior: I need to run ten instances simultaneously, where every instance returns true or false jus..

Where can I download an offline installer of Cygwin?

I need an offline installer with most of the utilities commonly needed. Somehow the default installer confuses me with all its package selection. I installed Cygwin but I can't find the diff utility a..

pop/remove items out of a python tuple

I am not sure if I can make myself clear but will try. I have a tuple in python which I go through as follows (see code below). While going through it, I maintain a counter (let's call it 'n') and 'p..

Git - deleted some files locally, how do I get them from a remote repository

I've deleted some files on my PC, how do I download them again? Pull says: "Already up-to-date"...

Why ModelState.IsValid always return false in mvc

In my controller this code: [HttpPost] public ActionResult Edit(Company company, FormCollection IsCostCenters) { if (ModelState.IsValid) { Comp..

How to extract a single value from JSON response?

First off, I will freely concede to being little more than a clumsy liberal arts guy who is completely self taught in this scripting thing. That said, I am attempting to get values from a the USGS Wat..

MySQL: Insert record if not exists in table

I am trying to execute the following query: INSERT INTO table_listnames (name, address, tele) VALUES ('Rupert', 'Somewhere', '022') WHERE NOT EXISTS ( SELECT name FROM table_listnames WHERE name=..

Convert seconds value to hours minutes seconds?

I've been trying to convert a value of seconds (in a BigDecimal variable) to a string in an editText like "1 hour 22 minutes 33 seconds" or something of the kind. I've tried this: String sequenceCa..

How to change font size on part of the page in LaTeX?

I'd like to change text size for some page part, e.g. for verbatim block: \begin{verbatim} <how to set font size here to 10 px ? /> \end{verbatim} Regards..

Overloading and overriding

What is the difference between overloading and overriding...

How to submit a form with JavaScript by clicking a link?

Instead of a submit button I have a link: <form> <a href="#"> submit </a> </form> Can I make it submit the form when it is clicked?..

How to develop Desktop Apps using HTML/CSS/JavaScript?

First, I'm not interested in doing this professionally. I am a web developer, a coworker of mine recently left for Spotify and said he will be working mostly in JavaScript for the Spotify Desktop app...

CSS word-wrapping in div

I have a div with a width of 250px. When the innertext is wider than that i want it to break down. The div is float: left and now has an overflow. I want the scrollbar to go away by using word-wrappin..

How does HttpContext.Current.User.Identity.Name know which usernames exist?

This is not necessarily an issue, I am just curious as to how it works. I have a method: public static bool UserIsAuthenticated() { bool isAuthed = false; try { if (HttpContext.Cu..

Conversion of a varchar data type to a datetime data type resulted in an out-of-range value in SQL query

I have a table with a column that stores the date and time. I need to write a query to get only the date from that column, SELECT CAST(CONVERT(VARCHAR, LoginTime, 101) AS datetime) FROM AuditTrail ..

Warning: #1265 Data truncated for column 'pdd' at row 1

I am having trouble trying to set the PDD(patient death date) to null on PHPMYADMIN until such death date comes; also on the client end then I can check for NULL data to use it. Could anyone suggest ..

Best way to test for a variable's existence in PHP; isset() is clearly broken

From the isset() docs: isset() will return FALSE if testing a variable that has been set to NULL. Basically, isset() doesn't check for whether the variable is set at all, but whether it's set to an..

jQuery Cross Domain Ajax

My ajax code is $.ajax({ type: 'GET', dataType: "jsonp", processData: false, crossDomain: true, jsonp: false, url: "http://someotherdomain.com/service.svc", success: funct..

Using GroupBy, Count and Sum in LINQ Lambda Expressions

I have a collection of boxes with the properties weight, volume and owner. I want to use LINQ to get a summarized list (by owner) of the box information e.g. **Owner, Boxes, Total Weight, Total Vol..

How can I get terminal output in python?

I can execute a terminal command using os.system() but I want to capture the output of this command. How can I do this?..

Getting Unexpected Token Export

I am trying to run some ES6 code in my project but I am getting an unexpected token export error. export class MyClass { constructor() { console.log("es6"); } } ..

How to create id with AUTO_INCREMENT on Oracle?

It appears that there is no concept of AUTO_INCREMENT in Oracle, up until and including version 11g. How can I create a column that behaves like auto increment in Oracle 11g?..

The transaction log for database is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

I am getting following error while I am trying to delete 355447 records in single delete query. The transaction log for database is full. To find out why space in the log cannot be reused, see the lo..

JSON find in JavaScript

Is there a better way other than looping to find data in JSON? It's for edit and delete. for(var k in objJsonResp) { if (objJsonResp[k].txtId == id) { if (action == 'delete') { objJsonRes..

What is the correct syntax for 'else if'?

I'm a new Python programmer who is making the leap from 2.6.4 to 3.1.1. Everything has gone fine until I tried to use the 'else if' statement. The interpreter gives me a syntax error after the 'if' in..

Setting the default Java character encoding

How do I properly set the default character encoding used by the JVM (1.5.x) programmatically? I have read that -Dfile.encoding=whatever used to be the way to go for older JVMs. I don't have that lux..

Unable to cast object of type 'System.DBNull' to type 'System.String`

I got the above error in my app. Here is the original code public string GetCustomerNumber(Guid id) { string accountNumber = (string)DBSqlHelperFactory.ExecuteScalar(connectionStringS..

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

To be honest, I've tried to turn a dirty trick on IIS and just when I thought that I was going to get away with it, I realized my workaround doesn't work. Here's what I've tried to do: 1) I have ASP...

Fastest way to check if string contains only digits

I know a few ways how to check this. regex,int.parse,tryparse,looping. can anyone tell me what is the fastest way to check? the need is to only CHECK no need to actually parse. this is not the same..

How to get an input text value in JavaScript

How go get an input text value in JavaScript? <script language="javascript" type="text/javascript"> lol = document.getElementById('lolz').value; function kk(){ alert(lol); } <..

How to export a Hive table into a CSV file?

I used this Hive query to export a table into a CSV file. INSERT OVERWRITE DIRECTORY '/user/data/output/test' select column1, column2 from table1; The file generated '000000_0' does not have comma ..

Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`

I built an app with ReactNative both for iOS and android with a ListView. When populating the listview with a valid datasource, the following warning is printed at the bottom of the screen: Warnin..

How to register multiple implementations of the same interface in Asp.Net Core?

I have services that are derived from the same interface. public interface IService { } public class ServiceA : IService { } public class ServiceB : IService { } public class ServiceC : IService { }..

Converting ArrayList to HashMap

Possible Duplicate: Java: How to convert List to Map I have arrayList ArrayList<Product> productList = new ArrayList<Product>(); productList = getProducts(); //Fetch the re..

Ruby/Rails: converting a Date to a UNIX timestamp

How would I get a UNIX timestamp (number of seconds since 1970 GMT) from a Date object in a Rails app? I know Time#to_i returns a timestamp, but doing Date#to_time and then getting the timestamp resu..

Scala: what is the best way to append an element to an Array?

Say I have an Array[Int] like val array = Array( 1, 2, 3 ) Now I would like to append an element to the array, say the value 4, as in the following example: val array2 = array + 4 // will not..

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..

Tomcat 8 Maven Plugin for Java 8

Is the tomcat7-maven-plugin working with a tomcat 8 server and java 8? I can't find any tomcat8-maven-plugin. ..

Auto-increment on partial primary key with Entity Framework Core

I have declared the following model using the EF Core fluent API: modelBuilder.Entity<Foo>() .HasKey(p => new { p.Name, p.Id }); Both fields are marked as the primary key when I create..

Is it possible to simulate key press events programmatically?

Is it possible to simulate key press events programmatically in JavaScript?..

how to get 2 digits after decimal point in tsql?

I am having problem to format digits in my select column.I used FORMAT but it doesn't work. Here is my column: sum(cast(datediff(second, IEC.CREATE_DATE, IEC.STATUS_DATE) as float) / 60) TotalSentMin..

PHP save image file

Possible Duplicate: Saving image from PHP URL I have an image as a url link from the 3rd party web thumb site (IE http://images.websnapr.com/?size=size&key=Y64Q44QLt12u&url=http://g..

Disable vertical scroll bar on div overflow: auto

Is it possible to allow only a horizontal scroll bar when using overflow:auto (or scroll)?..

How I can check whether a page is loaded completely or not in web driver?

I am writing some Java Webdriver code to automate my application. How can I correctly check whether the page has been loaded or not? The application has some Ajax calls, too. I have declared an impli..

How to access array elements in a Django template?

I am getting an array arr passed to my Django template. I want to access individual elements of the array in the array (e.g. arr[0], arr[1]) etc. instead of looping through the whole array. Is there ..

View the change history of a file using Git versioning

How can I view the change history of an individual file in Git, complete details with what has changed? I have got as far as: git log -- [filename] which shows me the commit history of the file, ..

How to get the current working directory in Java?

I want to access my current working directory using java. My code : String current = new java.io.File( "." ).getCanonicalPath(); System.out.println("Current dir:"+current); String currentD..

The property 'value' does not exist on value of type 'HTMLElement'

I am playing around with typescript and am trying to create a script that will update a p-element as text is inputted in a input box. The html looks as following: <html> <head> &..

Spring MVC: how to create a default controller for index page?

I'm trying to do one of those standard spring mvc hello world applications but with the twist that I'd like to map the controller to the root. (for example: http://numberformat.wordpress.com/2009/09/0..

What is “the inverse side of the association” in a bidirectional JPA OneToMany/ManyToOne association?

In the example section of the @OneToMany JPA annotation reference: Example 1-59 @OneToMany - Customer Class With Generics @Entity public class Customer implements Serializable { ... @OneToMa..

Converting Stream to String and back...what are we missing?

I want to serialize objects to strings, and back. We use protobuf-net to turn an object into a Stream and back, successfully. However, Stream to string and back... not so successful. After going thr..

Dynamic function name in javascript?

I have this: this.f = function instance(){}; I would like to have this: this.f = function ["instance:" + a](){}; ..

How to import a bak file into SQL Server Express

I have a .bak file, and I want to use this file to recreate the database in a fresh install of SQL Server 2008 Management Studio. Can someone point me in the right direction on how this can be done? ..

Regex AND operator

Based on this answer Regular Expressions: Is there an AND operator? I tried the following on http://regexpal.com/ but was unable to get it to work. What am missing? Does javascript not support it? ..

How to fix error with xml2-config not found when installing PHP from sources?

When I try to install php 5.3 stable from source on Ubuntu (downloading compressed installation file from http://www.php.net/downloads.php) and I run ./configure I get this error: configure: error: x..

How to use a different version of python during NPM install?

I have terminal access to a VPS running centos 5.9 and default python 2.4.3 installed. I also installed python 2.7.3 via these commands: (I used make altinstall instead of make install) wget http://w..

Compress files while reading data from STDIN

Is it possible to compress (create a compressed archive) data while reading from stdin on Linux?..

convert string to char*

Possible Duplicate: Convert std::string to const char* or char* Probably a & or something similar missing (I am noob at cpp). I have string R = "somthing"; char* S; How would I co..

Align Bootstrap Navigation to Center

I'm having a problem with bootstrap 3 navigation, i have some content on the left, center and right. it seems there is no option for centering the navigation. http://jsfiddle.net/29tQt/embedded/resul..

HTML5 input type range show range value

I am making a website where I want to use range slider(I know it only supports webkit browsers). I have integrated it fully and works fine. But I would like to use a textbox to show the current slide..

How to save a base64 image to user's disk using JavaScript?

I have converted the source content from the <img> html tag to a base64String using JavaScript. The image was displayed clearly. Now I want to save that image to user's disk using javascript. &..

Is there a "do ... while" loop in Ruby?

I'm using this code to let the user enter in names while the program stores them in an array until they enter an empty string (they must press enter after each name): people = [] info = 'a' # must fi..

How to exit when back button is pressed?

When a user presses the back button on an intent, the application should quit. How can I ensure the application quits when the back button is pressed?..

html5: display video inside canvas

is it possible to display a html5-video as part of the canvas? basically the same way as you draw an Image in the canvas. context.drawVideo(vid, 0, 0); thanks!..

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 ..

How to append one file to another in Linux from the shell?

I have two files: file1 and file2. How do I append the contents of file2 to file1 so that contents of file1 persist the process?..

How to minify php page html output?

I am looking for a php script or class that can minify my php page html output like google page speed does. How can I do this?..

Convert SVG image to PNG with PHP

I'm working on a web project that involves a dynamically generated map of the US coloring different states based on a set of data. This SVG file gives me a good blank map of the US and is very easy..

Converting data frame column from character to numeric

I have a data frame that I construct as such: > yyz <- data.frame(a = c("1","2","n/a"), b = c(1,2,"n/a")) > apply(yyz, 2, class) a b "character" "character" I am attempti..

How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved

I don't know what I've done incorrectly, but I can't include JSTL. I have jstl-1.2.jar, but unfortunately I get exception: org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/js..

How to change default Anaconda python environment

I've installed Anaconda and created two extra environments: py3k (which holds Python 3.3) and py34 (which holds Python 3.4). Besides those, I have a default environment named 'root' which the Anaconda..

What is the command to exit a Console application in C#?

What is the command in C# for exit a Console Application?..

What character represents a new line in a text area

Just quick one, but want to make sure I'm catching cross platform variations. I like to convert new lines entered into a text area into a [comma], so that the output can be represented on a single li..

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..

Change primary key column in SQL Server

UPDATE Here are the constraints as a result of the query SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = 'history' CONSTRAINT_NAME COLUMN_NAME ORDINAL_POSITION PK_history ..

Trusting all certificates using HttpClient over HTTPS

Recently posted a question regarding the HttpClient over Https (found here). I've made some headway, but I've run into new issues. As with my last problem, I can't seem to find an example anywhere th..

postgresql - replace all instances of a string within text field

In postgresql, how do I replace all instances of a string within a database column? Say I want to replace all instances of cat with dog, for example. What's the best way to do this?..

How to reload / refresh model data from the server programmatically?

Background I have the most basic "newbie" AngularJS question, forgive my ignorance: how do I refresh the model via code? I'm sure it's answered multiple times somewhere, but I simply couldn't find i..

Default username password for Tomcat Application Manager

Starting web services in Netbeans just Hello World Program , but this Application Manager makes hectic on this to start , Facing this alert message in NetBeans also Tomcat Application Manager Messa..

In Python, how to check if a string only contains certain characters?

In Python, how to check if a string only contains certain characters? I need to check a string containing only a..z, 0..9, and . (period) and no other character. I could iterate over each character ..

Is there a Python Library that contains a list of all the ascii characters?

Something like below: import ascii print ascii.charlist() Which would return something like [A, B, C, D...]..

Regular Expression with wildcards to match any character

I am new to regex and I am trying to come up with something that will match a text like below: ABC: (z) jan 02 1999 \n Notes: text will always begin with "ABC:" there may be zero, one or more spac..

Python: converting a list of dictionaries to json

I have a list of dictionaries, looking some thing like this: list = [{'id': 123, 'data': 'qwerty', 'indices': [1,10]}, {'id': 345, 'data': 'mnbvc', 'indices': [2,11]}] and so on. There may be more ..

Installing PHP Zip Extension

I'm attempting to install the PHP Zip extension. My server does not have external internet access, so I downloaded it myself from PECL: http://pecl.php.net/package/zip. I chose 1.10.2, the latest ..

Eclipse Workspaces: What for and why?

I have seen, read and thought of different ways of using workspaces (per project, per application (multi-asseted or not), per program language, per target (web-development, plugins,..), and so on) and..

What is the best way to know if all the variables in a Class are null?

This would mean that the class was initialized, but the variables were not set. A sample Class: public class User { String id = null; String name = null; public String getId() { ..

sql primary key and index

Say I have an ID row (int) in a database set as the primary key. If I query off the ID often do I also need to index it? Or does it being a primary key mean it's already indexed? Reason I ask is beca..

CSV in Python adding an extra carriage return, on Windows

import csv outfile = file('test.csv', 'w') writer = csv.writer(outfile, delimiter=',', quoting=csv.QUOTE_MINIMAL) writer.writerow(['hi','dude']) writer.writerow(['hi2','dude2']) outfile.close() It g..

How should I read a file line-by-line in Python?

In pre-historic times (Python 1.4) we did: fp = open('filename.txt') while 1: line = fp.readline() if not line: break print line after Python 2.1, we did: for line in open('fil..

Persist javascript variables across pages?

Is there a way we can persist javascript variables across various pages? Suppose in Page A I am setting window.someVar = 5. Then I move to Page B, via clicking a hyperlink in A, and do something like ..

How to create a JSON object

I am trying to create an JSON object out of a PHP array. The array looks like this: $post_data = array('item_type_id' => $item_type, 'string_key' => $string_key, 'string_value' => $s..

How does functools partial do what it does?

I am not able to get my head on how the partial works in functools. I have the following code from here: >>> sum = lambda x, y : x + y >>> sum(1, 2) 3 >>> incr = lambda y :..

Where to download Microsoft Visual c++ 2003 redistributable

I have an old dll that uses the Microsoft Visual C++ 2003 (7.1) run time package. Unfortunately I don't have that DLL around anymore. Short of reinstalling VS2003, is there another way to get the ru..

jQuery AJAX cross domain

Here are two pages, test.php and testserver.php. test.php <script src="scripts/jq.js" type="text/javascript"></script> <script> $(function() { $.ajax({url:"testserver.p..

Google Play Services Library update and missing symbol @integer/google_play_services_version

When upgrading my project to the latest version of Google Play Services (v4.0, released on Halloween 2013), you are now supposed to add a new tag into the AndroidManifest.xml file. <meta-data ..

Scala: write string to file in one statement

For reading files in Scala, there is Source.fromFile("file.txt").mkString Is there an equivalent and concise way to write a string to file? Most languages support something like that. My favorite..

Listen to port via a Java socket

A server software my client communicates with regularly sends transaction messages on port 4000. I need to print those messages to the console line by line. (Eventually I will have to write those valu..

Spring Boot how to hide passwords in properties file

Spring Boot uses the properties file, and at least by default, the passwords are in plain text. Is it possible to somehow hide/decrypt these?..

Unit testing void methods?

What is the best way to unit test a method that doesn't return anything? Specifically in c#. What I am really trying to test is a method that takes a log file and parses it for specific strings. The ..

How can I stop Chrome from going into debug mode?

If the debugging window is open, the debugger starts hitting lines by itself even though there are no set breakpoints. I have tried using the "Deactivate breakpoints" button and it doesn't m..

Get everything after and before certain character in SQL Server

I got the following entry in my database: images/test.jpg I want to trim the entry so I get: test So basically, I want everything after / and before . How can I solve it?..

NSDictionary - Need to check whether dictionary contains key-value pair or not

I just need to ask something as follow. Suppose I am having a dictionary. NSMutableDictionary *xyz=[[NSMutableDictionary alloc] init]; [xyz setValue:@"sagar" forKey:@"s"]; [xyz setValue:@"amit" forKe..

Round button with text and icon in flutter

how to have a button with text and icon for the flutter? I wanted to have a button which looks like icon with a text that is able to put at the bottom of the screen For example, the icon is like at ..

Which MySQL data type to use for storing boolean values

Since MySQL doesn't seem to have any 'boolean' data type, which data type do you 'abuse' for storing true/false information in MySQL? Especially in the context of writing and reading from/to a PHP sc..

Already defined in .obj - no double inclusions

I happened to get that already defined in .obj error. This is structure of my project: main.cpp #include "main.h"; main.h #include <iostream> #include <string> #include <sstr..

How to get scrollbar position with Javascript?

I'm trying to detect the position of the browser's scrollbar with JavaScript to decide where in the page the current view is. My guess is that I have to detect where the thumb on the track is, and the..

How to check if text fields are empty on form submit using jQuery?

How could I use jQuery to check if text-fields are empty when submitting without loading login.php? <form action="login.php" method="post"> <label>Login Name:</label> <in..

What are the differences between the BLOB and TEXT datatypes in MySQL?

What is blob and what is text? What are the differences? When do I need to use blob and when do I need text as data type? Because for blob and text, there are mediumblob == mediumtext, smallblob == ..

"NoClassDefFoundError: Could not initialize class" error

When I run my project, I get numerous outputs of this error: Sep 9, 2009 8:22:23 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet Jersey threw exception ..

How to convert a hex string to hex number

I want to convert a hex string (ex: 0xAD4) to hex number, then to add 0x200 to that number and again want to print that number in form of 0x as a string. i tried for the first step: str(int(str(item..

How can I easily add storage to a VirtualBox machine with XP installed?

When I installed Windows XP on a VirtualBox machine, I made the hard drive only 10 GB since and assumed it would expand in size (as do hard drives in VMWare as far as I can remember, isn't this true?)..

jQuery same click event for multiple elements

Is there any way to execute same code for different elements on the page? $('.class1').click(function() { some_function(); }); $('.class2').click(function() { some_function(); }); instead to..

Early exit from function?

I have a function: function myfunction() { if (a == 'stop') // How can I stop the function here? } Is there something like exit() in JavaScript?..

Adding author name in Eclipse automatically to existing files

Is there a real easy to use tool (no monster tool) that I can plug into Eclipse, and press a "generate header" button and then the authors name appears in every file in that project?..

jQuery animate backgroundColor

I am trying to animate a change in backgroundColor using jQuery on mouseover. I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroun..

Disable Transaction Log

Oracle has SQL commands that one can issue so that a transaction does not get logged. Is there something similar for SQL Server 2008? My scenario: We need Tx logs on servers (Dev, QA, Prod), but mayb..

Get TimeZone offset value from TimeZone without TimeZone name

I need to save the phone's timezone in the format [+/-]hh:mm I am using TimeZone class to deal with this, but the only format I can get is the following: PST -05:00 GMT +02:00 I would rather not s..

How to make the python interpreter correctly handle non-ASCII characters in string operations?

I have a string that looks like so: 6 918 417 712 The clear cut way to trim this string (as I understand Python) is simply to say the string is in a variable called s, we get: s.replace('..

Controller not a function, got undefined, while defining controllers globally

I am writing a sample application using angularjs. i got an error mentioned below on chrome browser. Error is Error: [ng:areq] http://errors.angularjs.org/1.3.0-beta.17/ng/areq?p0=ContactControl..

How do you run a single query through mysql from the command line?

I'm looking to be able to run a single query on a remote server in a scripted task. For example, intuitively, I would imagine it would go something like: mysql -uroot -p -hslavedb.mydomain.com mydb_..

how to create 100% vertical line in css

I want to create a vertical line that cover whole page like this here is my code #menu { border-left: 1px solid black; height: 100%; } result show like this ..

Explain ExtJS 4 event handling

I've recently started learning ExtJS, and have trouble understanding how to handle Events. I have no experience of any previous versions of ExtJS. From reading various manuals, guides and documentat..

How to set selected index JComboBox by value

I want to set the selected index in a JComboBox by the value not the index. How to do that? Example public class ComboItem { private String value; private String label; public ComboItem..

Using Laravel Homestead: 'no input file specified'

I am new to using Laravel, and Homestead, and would appreciate any help or a point in the right direction. I have successfully been able to get to the "You have arrived" screen when I run "php artisa..

link_to method and click event in Rails

How do I create a link of this type: <a href="#" onclick="document.getElementById('search').value=this.value"> using method link_to in Rails? I couldn't figure it out from Rails docs...

UnhandledPromiseRejectionWarning: This error originated either by throwing inside of an async function without a catch block

I am getting following error in my Node-Express App UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without..

In Laravel, the best way to pass different types of flash messages in the session

I'm making my first app in Laravel and am trying to get my head around the session flash messages. As far as I'm aware in my controller action I can set a flash message either by going Redirect::to('..

Bootstrap Datepicker - Months and Years Only

I am using bootstrap datepicker and my code is like following, Demo of the code on jsfiddle <div class="input-append date" id="datepicker" data-date="02-2012" data-date-format="mm-yyyy"> ..

malloc for struct and pointer in C

Suppose I want to define a structure representing length of the vector and its values as: struct Vector{ double* x; int n; }; Now, suppose I want to define a vector y and allocate memory fo..

How can I remove an element from a list, with lodash?

I have an object that looks like this: var obj = { "objectiveDetailId": 285, "objectiveId": 29, "number": 1, "text": "x", "subTopics": [{ "subTopicId": 1, "number"..

How to horizontally align ul to center of div?

I am trying to center a <ul> inside a <div>. I tried the following text-align: center; and left: 50%; This is not working. CSS: .container { clear: both; width: 800px; ..

Calling a function within a Class method?

I have been trying to figure out how to go about doing this but I am not quite sure how. Here is an example of what I am trying to do: class test { public newTest(){ function bigTest(..

How to replace NaNs by preceding values in pandas DataFrame?

Suppose I have a DataFrame with some NaNs: >>> import pandas as pd >>> df = pd.DataFrame([[1, 2, 3], [4, None, None], [None, None, 9]]) >>> df 0 1 2 0 1 2 3 1..

Newline in JLabel

How can I display a newline in JLabel? For example, if I wanted: Hello World! blahblahblah This is what I have right now: JLabel l = new JLabel("Hello World!\nblahblahblah", SwingConstants..

ExecuteNonQuery: Connection property has not been initialized.

Afternoon, So I have been at this one issue for hours and can't really get past this last hump. Below is the code for this program that I am writing: using System; using System.Collecti..

How do I write data to csv file in columns and rows from a list in python?

everyone.I have a list of lists and I want to write them in a csv file with columns and rows.I have tried the writerows but it isn't what I want.An example of my list is the following: [[1, 2], [2, 3..

Multiple radio button groups in one form

Is it possible to have multiple radio button groups in a single form? Usually selecting one button deselects the previous, I just need to have one of a group deselected. <form> <fieldset..

Use of "global" keyword in Python

What I understand from reading the documentation is that Python has a separate namespace for functions, and if I want to use a global variable in that function, I need to use global. I'm using Python..

Need to ZIP an entire directory using Node.js

I need to zip an entire directory using Node.js. I'm currently using node-zip and each time the process runs it generates an invalid ZIP file (as you can see from this Github issue). Is there another..

http://localhost:8080/ Access Error: 404 -- Not Found Cannot locate document: /

I'm really very new to this Tomcat stuff. I downloaded Tomcat 7.0 windows installer and installed it using the default configuration. After installing, I typed localhost:8080 in my browser to see if T..

Python copy files to a new directory and rename if file name already exists

I've already read this thread but when I implement it into my code it only works for a few iterations. I'm using python to iterate through a directory (lets call it move directory) to copy mainly pd..

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..

Rotating videos with FFmpeg

I have been trying to figure out how to rotate videos with FFmpeg. I am working with iPhone videos taken in portrait mode. I know how to determine the current degrees of rotation using MediaInfo (exce..

Read a local text file using Javascript

I have read some of the previous questions on this topic but I really need to be 100% sure! Is it possible to read from a .txt file on my local system and present it in my HTML-BODY? I have tried se..

Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

I am on a server that has afresh install on RHEL 5. I was able to install Apache and PHP just fine., but I am having serious trouble with my MySQL installation. I tried the following: yum install ..

multiple axis in matplotlib with different scales

How can multiple scales can be implemented in Matplotlib? I am not talking about the primary and secondary axis plotted against the same x-axis, but something like many trends which have different sca..

jQuery send HTML data through POST

I am using jQuery to make a POST to a PHP file with the HTML content of a div. The HTML content contain tables, inputs, smaller divs and I would like to grab the content of the main DIV and send it to..

Websocket connections with Postman

I'm using Postman to test an existing REST API. This API calls async functions on the server which return a response over a websocket using StompJS. Is it possible to connect to the websocket using P..

Openstreetmap: embedding map in webpage (like Google Maps)

Is there a way to embed/mashup the OpenStreetMap in your page (like the way Google Maps API works)? I need to show a map inside my page with some markers and allow dragging/zooming around, maybe rout..

Update records in table from CTE

I have the following CTE that will give me the DocTotal for the entire invoice. ;WITH CTE_DocTotal AS ( SELECT SUM(Sale + VAT) AS DocTotal FROM PEDI_InvoiceDetail GROUP BY InvoiceNumber ..

TypeError: $.browser is undefined

I am using msdropdown image combo box to create dropdown select options. when i run this code locally on my PC, everything works great. But when i run it on go daddy servers, the msdropdown becomes d..

Declare an empty two-dimensional array in Javascript?

I want to create a two dimensional array in Javascript where I'm going to store coordinates (x,y). I don't know yet how many pairs of coordinates I will have because they will be dynamically generated..

How should I call 3 functions in order to execute them one after the other?

If I need call this functions one after other, $('#art1').animate({'width':'1000px'},1000); $('#art2').animate({'width':'1000px'},1000); $('#art3').animate({'width':'1000px'},1000); ..

Can you split a stream into two streams?

I have a data set represented by a Java 8 stream: Stream<T> stream = ...; I can see how to filter it to get a random subset - for example Random r = new Random(); PrimitiveIterator.OfInt coi..

Python multiprocessing PicklingError: Can't pickle <type 'function'>

I am sorry that I can't reproduce the error with a simpler example, and my code is too complicated to post. If I run the program in IPython shell instead of the regular Python, things work out well. ..

How to update nested state properties in React

I'm trying to organize my state by using nested property like this: this.state = { someProperty: { flag:true } } But updating state like this, this.setState({ someProperty.flag: false ..

How I can print to stderr in C?

In C, Printing to stdout is easy, with printf from stdio.h. However, how can print to stderr? We can use fprintf to achieve it apparently, but its syntax seems strange. Maybe we can use printf to pri..

How to insert a file in MySQL database?

I want to insert a file in MYSQL database residing on a remote webserver using a webservice. My question is: What type of table column (e.g. varchar, etc.) will store a file? And will the insert stat..

Get ID from URL with jQuery

I've got a url like this: http://www.site.com/234234234 I need to grab the Id after /, so in this case 234234234 How can i do this easily?..

Creating an empty bitmap and drawing though canvas in Android

I'd like to create an empty bitmap and set a canvas to that bitmap and then draw any shape on the bitmap...

Pandas - replacing column values

I know there are a number of topics on this question, but none of the methods worked for me so I'm posting about my specific situation I have a dataframe that looks like this: data = pd.DataFrame([[..

Docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

I am new to docker. I just tried to use docker in my local machine(Ubuntu 16.04) with Jenkins. I configured a new job with below pipeline script. node { stage('Build') { docker.image('mav..

customize Android Facebook Login button

I want to customize the look of the Facebook login button which we get along with the Facebook sdk for android (facebook-android-sdk-3.0.1). I want a simple android button which has title "Login via F..

SELECT COUNT in LINQ to SQL C#

How can I write LINQ to SQL with COUNT? Example: var purch = from purchase in myBlaContext.purchases select purchase; How can I get the count here?..

Why is setTimeout(fn, 0) sometimes useful?

I've recently run into a rather nasty bug, wherein the code was loading a <select> dynamically via JavaScript. This dynamically loaded <select> had a pre-selected value. In IE6, we alrea..

excel VBA run macro automatically whenever a cell is changed

Is there a simple way to get Excel to automatically execute a macro whenever a cell is changed? The cell in question would be in Worksheet("BigBoard").Range("D2") What I thought would be a simple Go..

jQuery - Check if DOM element already exists

I am trying to add some form elements dynamically via Ajax with jQuery. I want to make sure that I don't create the same element twice, so I only want to add it if it hasn't already been added to the ..

Deny direct access to all .php files except index.php

I want to deny direct access to all .php files except one: index.php The only access to the other .php files should be through php include. If possible I want all files in the same folder. UPDATE: ..

Convert list to dictionary using linq and not worrying about duplicates

I have a list of Person objects. I want to convert to a Dictionary where the key is the first and last name (concatenated) and the value is the Person object. The issue is that I have some duplicated..

Appending to an existing string

To append to an existing string this is what I am doing. s = 'hello' s.gsub!(/$/, ' world'); Is there a better way to append to an existing string. Before someone suggests following answer lemme s..

How to stop VMware port error of 443 on XAMPP Control Panel v3.2.1

When I run XAMPP Control Panel v3.2.1 I get this error: 07:37:24 [Apache] Problem detected! 07:37:24 [Apache] Port 443 in use by ""C:\Program Files (x86)\VMware\VMware Workstation\vmware-hostd.ex..

Javascript : natural sort of alphanumerical strings

I'm looking for the easiest way to sort an array that consists of numbers and text, and a combination of these. E.g. '123asd' '19asd' '12345asd' 'asd123' 'asd12' turns into '19asd' '123asd' '12345asd..

Could not determine the dependencies of task ':app:crashlyticsStoreDeobsDebug' if I enable the proguard

I get following error when I was running an app within Android Studio 2. Gradle tasks [:app:assembleDebug] Could not determine the dependencies of task ':app:crashlyticsStoreDeobsDebug'. > Task wi..

Why does viewWillAppear not get called when an app comes back from the background?

I'm writing an app and I need to change the view if the user is looking at the app while talking on the phone. I've implemented the following method: - (void)viewWillAppear:(BOOL)animated { [sup..

ssh: The authenticity of host 'hostname' can't be established

When i ssh to a machine, sometime i get this error warning and it prompts to say "yes" or "no". This cause some trouble when running from scripts that automatically ssh to other machines. Warning Mes..