Questions Tagged with #Ksort

This is a PHP function to sort arrays by keys. Returns either TRUE or FALSE.

LabelEncoder: TypeError: '>' not supported between instances of 'float' and 'str'

I'm facing this error for multiple variables even treating missing values. For example: le = preprocessing.LabelEncoder() categorical = list(df.select_dtypes(include=['object']).columns.values) for c..

Quicksort with Python

I am totally new to python and I am trying to implement quicksort in it. Could someone please help me complete my code? I do not know how to concatenate the three arrays and printing them. def sort..

Is it possible to embed animated GIFs in PDFs?

Is it possible to embed animated GIFs in PDFs? And how might I go about such a thing? are there any dangers I should be aware of? For some more details on why I think it's a good thing and how it help..

When is each sorting algorithm used?

What are the use cases when a particular sorting algorithm is preferred over others - merge sort vs QuickSort vs heapsort vs 'intro sort', etc? Is there a recommended guide in using them based on the..

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need he..

Efficient way to insert a number into a sorted array of numbers?

I have a sorted JavaScript array, and want to insert one more item into the array such the resulting array remains sorted. I could certainly implement a simple quicksort-style insertion function: va..

Quicksort: Choosing the pivot

When implementing Quicksort, one of the things you have to do is to choose a pivot. But when I look at pseudocode like the one below, it is not clear how I should choose the pivot. First element of li..

VBA array sort function?

I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice. Please note that this is to work ..

Why is quicksort better than mergesort?

I was asked this question during an interview. They're both O(nlogn) and yet most people use Quicksort instead of Mergesort. Why is that?..

Get path to execution directory of Windows Forms application

I would like to get the path to the execution directory of a Windows Forms application. (That is, the directory in which the executable is located.) Does anyone know of a built-in method in .NET to d..

How to run a script file remotely using SSH

I want to run a script remotely. But the system doesn't recognize the path. It complains that "no such file or directory". Am I using it right? ssh kev@server1 `./test/` ..

Java 8 LocalDate Jackson format

For java.util.Date when I do @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy") private Date dateOfBirth; then in JSON request when I send { {"dateOfBirth":"01/01/2000"}..

How do I get list of methods in a Python class?

I want to iterate through the methods in a class, or handle class or instance objects differently based on the methods present. How do I get a list of class methods? Also see: How can I list the me..

How to align the checkbox and label in same line in html?

Within li tags, I am placing a checkbox and label input. If label text is larger than label, the text goes to the next line. I wrapped the label text but it's not aligning the checkbox and label in ..

Bootstrap Dropdown with Hover

OK, so what I need is fairly straightforward. I have set up a navbar with some dropdown menus in it (using class="dropdown-toggle" data-toggle="dropdown"), and it works fine. The thing is it works "..

How to install a Python module via its in Windows?

I downloaded dateutil which comes with a file but it throws an error when I try to open it. What's the proper way to install this module? This is the error: error: no commands supplied ..

Creating custom function in React component

I have a React component export default class Archive extends React.Component { ... } componentDidMount and onClick methods partially use the same code, except for slight change in parameters. ..

ALTER TABLE to add a composite primary key

I have a table called provider. I have three columns called person, place, thing. There can be duplicate persons, duplicate places, and duplicate things, but there can never be a dupicate person-place..

HTML5: Slider with two inputs possible?

Is it possible to make a HTML5 slider with two input values, for example to select a price range? If so, how can it be done?..

What is the JUnit XML format specification that Hudson supports?

I have Hudson as continuous integration server and I want to use option 'Publish JUnit test result report'. But I don't use xUnit tools for testing, instead of that i have shell scripts which run test..

Where is Python language used?

I am a web developer and usually use PHP, JavaScript or MySQL. I have heard lot about Python. But I have no idea where it is used and why it is used. Just like PHP, ASP, ColdFusion, .NET are used to..

How to update TypeScript to latest version with npm?

Currently I have TypeScript version installed on my machine. I want to update it to latest one i.e. 2.0. How to do this with npm?..

Type of expression is ambiguous without more context Swift

I am getting a 'Type of expression is ambiguous without more context ' on this part of code from a project I am trying to upgrade to latest Swift version. I can't seem to figure it out. I tried differ..

Declaring variables inside or outside of a loop

Why does the following work fine? String str; while (condition) { str = calculateStr(); ..... } But this one is said to be dangerous/incorrect: while (condition) { String str = calcula..

Filter by process/PID in Wireshark

Is there a way to filter/follow a TCP/SSL stream based on a particular process ID using Wireshark?..

How to select data from 30 days?

I have query: SELECT name FROM ( SELECT name FROM Hist_answer WHERE id_city='34324' AND datetime >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) UNION ALL SELECT name FROM Hist_internet WHERE id_cit..

Run-time error '1004' - Method 'Range' of object'_Global' failed

I have a problem in VBA with a line throwing back an error. What the macro is intended to do is find a particular cell then paste data into it. The code is as following: 'To find Column of Custome..

How to create range in Swift?

In Objective-c we create range by using NSRange NSRange range; So how to create range in Swift?..

SQL Server - Case Statement

I'm almost certain you cannot do this within the context of the case statement, and I haven't been able to find any documentation about it, but is it possible to do the following: SELECT CASE WHEN te..

Facebook share button and custom text

Is there any way to make facebook share button which post custom text on the wall or news feed?..

iframe refuses to display

I am trying to load a simple iframe into one of my web pages but it is not displaying. I am getting this error in Chrome: Refused to display '' in a fr..

Session state can only be used when enableSessionState is set to true either in a configuration

I am working on MVC 2 app with c# by using vs 2010.I am having below mentioned error when I run my app locally under debug mode. Error message image is as below : Error message text is as..

HorizontalScrollView within ScrollView Touch Handling

I have a ScrollView that surrounds my entire layout so that the entire screen is scrollable. The first element I have in this ScrollView is a HorizontalScrollView block that has features that can be ..

ASP.NET Web Site or ASP.NET Web Application?

When I start a new ASP.NET project in Visual Studio, I can create an ASP.NET Web Application or I can create an ASP.NET Web Site. What is the difference between ASP.NET Web Application and ASP.NET We..

How to select the first element of a set with JSTL?

I managed to do it with the next code but there must be an easier way. <%@ taglib prefix="c" uri="" %> <%@ taglib prefix="fn" uri="

C++ compile time error: expected identifier before numeric constant

I have read other similar posts but I just don't understand what I've done wrong. I think my declaration of the vectors is correct. I even tried to declare without size but even that isn't working.Wha..

How do I create a view controller file after creating a new view controller?

I am developing a tabbed application. When I create a new view controller and link it to the tab bar controller, unlike the other two default view controllers, this one has no viewcontroller.swift fi..

href image link download on click

I generate normal links like: <a href="/path/to/image"><img src="/path/to/image" /></a> in a web app. When I click on the link, it displays the picture in a new page. If you want to..

Rolling back local and remote git repository by 1 commit

I've read the similar posts on this topic, and can't for the life of me figure out how to do this properly. I checked in about 1000 files that I don't want, and I'd rather not have to go through 1by1..

base64 encoded images in email signatures

I have to include some images (company logo's etc) in email signatures. I've had all sorts of issues using the embedded images produced by the email system in question (they get sent as attachments ge..

Why do table names in SQL Server start with "dbo"?

At least on my local instance, when I create tables, they are all prefixed with "dbo.". Why is that?..

Converting string to integer

PrinterLabel = Printer + PrinterNumber If Floors = 1 And (PrinterLabel) > 127 Then Wscript.Echo "Invalid Printer11 Selection " Wscript.Quit End If If Floors = 2 And PrinterLabel >..

react router v^4.0.0 Uncaught TypeError: Cannot read property 'location' of undefined

I've been having some trouble with react router (i'm using version^4.0.0). this is my index.js import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './index.c..

The APK file does not exist on disk

When I am trying debug application on Android Studio gives this log output : The APK file /Users/MyApplicationName/app/build/outputs/apk/app-debug.apk does not exist on disk. I restarted An..

How to create new div dynamically, change it, move it, modify it in every way possible, in JavaScript?

I want to create new divs as the page loads. These divs will appear as an ordered group which changes depending upon external data from a JSON file. I will need to do this with a for loop because ther..

How to set up ES cluster?

Assuming I have 5 machines I want to run an elasticsearch cluster on, and they are all connected to a shared drive. I put a single copy of elasticsearch onto that shared drive so all three can see it...

Sort an array in Java

I'm trying to make a program that consists of an array of 10 integers which all has a random value, so far so good. However, now I need to sort them in order from lowest to highest value and then pri..

How different is Scrum practice from Agile Practice?

Mostly people say Scrum and Agile interchangeably but what is the difference between Scrum Practice as compared to Agile Practice ?..

Get css top value as number not as string?

In jQuery you can get the top position relative to the parent as a number, but you can not get the css top value as a number if it was set in px. Say I have the following: #elem{ position:relative..

AngularJS ui-router login authentication

I am new to AngularJS, and I am a little confused of how I can use angular-"ui-router" in the following scenario: I am building a web application which consists of two sections. The first section is ..

Using member variable in lambda capture list inside a member function

The following code compiles with gcc 4.5.1 but not with VS2010 SP1: #include <iostream> #include <vector> #include <map> #include <utility> #include <set> #include <a..

Converting Secret Key into a String and Vice Versa

I am generating a key and need to store it in DB, so I convert it into a String, but to get back the key from the String. What are the possible ways of accomplishing this? My code is, SecretKey key ..

How to test if a double is an integer

Is it possible to do this? double variable; variable = 5; /* the below should return true, since 5 is an int. if variable were to equal 5.7, then it would return false. */ if(variable == int) { ..

Facebook share link without JavaScript

The following link is for sharing a page on Twitter: Is there a similar option for Facebook that doesn't require JavaScript? I know about, bu..

Difference between objectForKey and valueForKey?

What is the difference between objectForKey and valueForKey? I looked both up in the documentation and they seemed the same to me...

Authenticate Jenkins CI for Github private repository

I'd like for Jenkins to automagically fetch data from my private repository hosted on Github. But I have no idea how to accomplish that task.. Tried the documentation, generating ssh-key for jenkins u..

ValueError: object too deep for desired array while using convolution

I'm trying to do this: h = [0.2,0.2,0.2,0.2,0.2] Y = np.convolve(Y, h, "same") Y looks like this: While doing this I get this error: ValueError: object too deep for desired array Why is this..

Comparing two .jar files

How do I compare two .jar files? Both of them have compiled .class files. I want the difference in terms of method changes, etc...

Get Value of a Edit Text field

I am learning how to create UI elements. I have created a few EditText input fields. On the click of a Button I want to capture the content typed into that input field. <EditText android:id="@+id/..

How can I use random numbers in groovy?

I use this method: def getRandomNumber(int num){ Random random = new Random() return random.getRandomDigits(num) } when I call it I write println getRandomNumber(4) but I have an error No sig..

Changing three.js background to transparent or other color

I've been trying to change what seems to be the default background color of my canvas from black to transparent / any other color - but no luck. My HTML: <canvas id="canvasColor"> My CSS: &..

Auto refresh code in HTML using meta tags

I'm trying to refresh the same page but it isn't working. This is my HTML code: <html> <head> <title>HTML in 10 Simple Steps or Less</title> <meta http-..

Object Library Not Registered When Adding Windows Common Controls 6.0

I am trying to install Visual Studio 6 on a Windows 7 32bit machine. The OS intall was from bare metal. I followed the instructions mentioned here (which I have used before) The install went fine w..

Check if an array contains any element of another array in JavaScript

I have a target array ["apple","banana","orange"], and I want to check if other arrays contain any one of the target array elements. For example: ["apple","grape"] //returns true; ["apple","banan..

Export to CSV via PHP

Let's say I have a database.... is there a way I can export what I have from the database to a CSV file (and text file [if possible]) via PHP?..

How do I use a pipe to redirect the output of one command to the input of another?

I have a program which sends text to an LED sign. prismcom.exe To use the program to send "Hello": prismcom.exe usb Hello Now, I wish to, for example use a command program called Temperature. te..

How do I add button on each row in datatable?

I am newbie for DataTables. I want to add button on each row for edit and delete(like below image) I have tried with code: Test.cfm <table id="myDataTable" class="table table-striped table-bo..

MS Access DB Engine (32-bit) with Office 64-bit

We currently have a major issue using Microsoft Access Database Engine 2010. The engine comes in 64-bit and 32-bit forms, which is good. However, apparently you need to always install the 32-bit versi..

If Else in LINQ

Is it possible to use If Else conditional in a LINQ query? Something like from p in db.products if p.price>0 select new { Owner=from q in db.Users select q.Name } else select new { O..

What command means "do nothing" in a conditional in Bash?

Sometimes when making conditionals, I need the code to do nothing, e.g., here, I want Bash to do nothing when $a is greater than "10", print "1" if $a is less than "5", otherwise, print "2": if [ "$a..

Set position / size of UI element as percentage of screen size

I'm trying to work out if it's possible to use percentage positions/sizes when creating a layout. What I want is something like this... ^ | | | 68% | | v Gallery (height equivalent of 16% total scree..

Android: adb: Permission Denied

Whatever I type after adb shell it fails with Permission denied: D:\android-sdk-windows\platform-tools>adb shell find /data -name *.db find: permission denied D:\android-sdk-windows\platform-tools..

if-else statement inside jsx: ReactJS

I need to change render function and run some sub render function when a specific state given, For example: render() { return ( <View style={styles.container}> if (..

What is the difference between YAML and JSON?

What are the differences between YAML and JSON, specifically considering the following things? Performance (encode/decode time) Memory consumption Expression clarity Library availability, ease of use..

How do I inject a controller into another controller in AngularJS

I'm new to Angular and trying to figure out how to do things... Using AngularJS, how can I inject a controller to be used within another controller? I have the following snippet: var app = angular...

How to insert values in two dimensional array programmatically?

I want to do this dynamically in java. I know how to insert values in single dimensional array. I am bit confused in two dimensional array. static final String shades[][] = { // Shades of grey ..

Copy a file in a sane, safe and efficient way

I search for a good way to copy a file (binary or text). I've written several samples, everyone works. But I want hear the opinion of seasoned programmers. I missing good examples and search a way wh..

Using HTML and Local Images Within UIWebView

I have a UIWebView in my app which I want to use to display an image which will link to another url. I'm using <img src="image.jpg" /> to load the image. The problem is that the image doesn'..

Check if a file exists or not in Windows PowerShell?

I have this script which compares files in two areas of the disk and copies the latest file over the one with the older modified date. $filestowatch=get-content C:\H\files-to-watch.txt $adminFiles=..

Is true == 1 and false == 0 in JavaScript?

I was reading a good book on JavaScript. It started with: Boolean type take only two literal values: true and false. These are distinct from numeric values, so true is not equal to 1, and false..

104, 'Connection reset by peer' socket error, or When does closing a socket result in a RST rather than FIN?

We're developing a Python web service and a client web site in parallel. When we make an HTTP request from the client to the service, one call consistently raises a socket.error in, in read..

MySQL parameterized queries

I am having a hard time using the MySQLdb module to insert information into my database. I need to insert 6 variables into the table. cursor.execute (""" INSERT INTO Songs (SongName, SongArtis..

Open a new tab on button click in AngularJS

<button type="button" class="btn btn-primary" ng-click="openTab()">new tab</button> openTab = function () { $''); } What I want is post a require and open the ..

AmazonS3 putObject with InputStream length example

I am uploading a file to S3 using Java - this is what I got so far: AmazonS3 s3 = new AmazonS3Client(new BasicAWSCredentials("XX","YY")); List<Bucket> buckets = s3.listBuckets(); s3.putObject..

Import SQL file by command line in Windows 7

I want to import an SQL file (size > 500MB) into a database. I have wamp on my PC. Phpmyadmin does not work well with this size. I changed all parameters in php.ini (max_upload_size etc.). But it does..

What's NSLocalizedString equivalent in Swift?

Is there an Swift equivalent of NSLocalizedString(...)? In Objective-C, we usually use: NSString *string = NSLocalizedString(@"key", @"comment"); How can I achieve the same in Swift? I found a func..

Convert Promise to Observable

I am trying to wrap my head around observables. I love the way observables solve development and readability issues. As I read, benefits are immense. Observables on HTTP and collections seem to be s..

Reference an Element in a List of Tuples

Sorry in advance, but I'm new to Python. I have a list of tuples, and I was wondering how I can reference, say, the first element of each tuple within the list. I would think it's something like f..

Include another JSP file

I am currently trying to learn JSP. My question is, at present I used to include the header and footer of the page using: <%@include file="includes/header.jsp" %> and <%@include file="in..

Angular2 set value for formGroup

So I have a complex form for creating an entity and I want to use it for editing as well I am using new angular forms API. I structured the form exactly as the data I retrieve from the database so I w..

How to get last month/year in java?

How do I find out the last month and its year in Java? e.g. If today is Oct. 10 2012, the result should be Month = 9 and Year = 2012. If today is Jan. 10 2013, the result should be Month = 12 and Year..

How to select the last record from MySQL table using SQL syntax

I have a table with several records. There is an id field. I would like to select the record with the most recent id (i.e. the highest id). Any ideas?..

mongodb group values by multiple fields

For example, I have these documents: { "addr": "address1", "book": "book1" }, { "addr": "address2", "book": "book1" }, { "addr": "address1", "book": "book5" }, { "addr": "address3", "..

parse html string with jquery

I have an HTML string from a Ajax loaded source. I would like to get some attributes from an object (image) in this string, before I put the HTML into the document. I've got something like: $.ajax(..

How do I set cell value to Date and apply default Excel date format?

I've been using Apache POI for some time to read existing Excel 2003 files programmatically. Now I have a new requirement to create entire .xls files in-memory (still using Apache POI) and then write ..

SELECT list is not in GROUP BY clause and contains nonaggregated column .... incompatible with sql_mode=only_full_group_by

AM using MySQL 5.7.13 on my windows PC with WAMP Server Here my Problem is While executing this query SELECT * FROM `tbl_customer_pod_uploads` WHERE `load_id` = '78' AND `status` = 'Active' GR..


What am I missing? This query is returning duplicate data over and over again. The count is correct for a complete total, but I am expecting one row, and yet I am getting the value repeated about 40..

Fail to create Android virtual Device, "No system image installed for this Target"

Unable to create Android Virtual Device i follwed this link. I installed all ARM images for each Android more than 4.0. I installed intel & MIPs as well. But, still my AVD Manager is saying "NO..

Normalizing images in OpenCV

I wrote the following code to work normalize an image using NORM_L1 in OpenCV. But the output image was just black.How to solve this ? import cv2 import numpy as np import Image img = cv2.imread('im..

Find records from one table which don't exist in another

I've got the following two tables (in MySQL): Phone_book +----+------+--------------+ | id | name | phone_number | +----+------+--------------+ | 1 | John | 111111111111 | +----+------+--------------..

How do you get the current project directory from C# code when creating a custom MSBuild task?

Instead of running an external program with its path hardcoded, I would like to get the current Project Dir. I'm calling an external program using a process in the custom task. How would I do that? A..

How to obtain a Thread id in Python?

I have a multi-threading Python program, and a utility function, writeLog(message), that writes out a timestamp followed by the message. Unfortunately, the resultant log file gives no indication of wh..

How do I reset the setInterval timer?

How do I reset a setInterval timer back to 0? var myTimer = setInterval(function() { console.log('idle'); }, 4000); I tried clearInterval(myTimer) but that completely stops the interval. I want i..

Solving sslv3 alert handshake failure when trying to use a client certificate

I'm trying to connect to a service that requires a certificate for authorization. The process is that I send the service a CSR file. The service signs the CSR and sends me a certificate that I use for..

Check number of arguments passed to a Bash script

I would like my Bash script to print an error message if the required argument count is not met. I tried the following code: #!/bin/bash echo Script name: $0 echo $# arguments if [$# -ne 1]; t..

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

$(form).ajaxSubmit is not a function

I'm trying to use the jquery validate plugin to validate a form and submit the contents with an ajax request. This code is in the head of my document. $(document).ready(function() { $('#contact..

Override and reset CSS style: auto or none don't work

I would like to override following CSS styling defined for all tables: table { font-size: 12px; width: 100%; min-width: 400px; display:inline-table; } I have..

How can I take a screenshot/image of a website using Python?

What I want to achieve is to get a website screenshot from any website in python. Env: Linux..

C++ terminate called without an active exception

I am getting a C++ error with threading: terminate called without an active exception Aborted Here is the code: #include <queue> #include <thread> #include <mutex> #include <c..

Embed YouTube video - Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

I am trying to feed my Django page with some resource I am getting from somewhere else. Inside the feed, I have YouTube videos with URL like: Once I adde..

How to compile .c file with OpenSSL includes?

I am trying to compile a small .c file that has the following includes: #include <openssl/ssl.h> #include <openssl/rsa.h> #include <openssl/x509.h> #include <openssl/evp.h> ..

How to check if an element does NOT have a specific class?

How do I check if there isn't a class. For example, I know how to check to see if it has the class "test", but how do I check to see if it doesn't have the class "test"? if($(this).hasClass("test")){..

pinpointing "conditional jump or move depends on uninitialized value(s)" valgrind message

So I've been getting some mysterious uninitialized values message from valgrind and it's been quite the mystery as of where the bad value originated from. Seems that valgrind shows the place where th..

Struct Constructor in C++?

Can a struct have a constructor in C++? I have been trying to solve this problem but I am not getting the syntax...

C++ Boost: undefined reference to boost::system::generic_category()

I am trying to include Boost libraries in my project and have been facing issues in the same. I am on Ubuntu 12.10 with Codeblocks IDE and tried installing the libraries manually reading instructions ..

What XML parser should I use in C++?

I have XML documents that I need to parse and/or I need to build XML documents and write them to text (either files or memory). Since the C++ standard library does not have a library for this, what sh..

How do I install TensorFlow's tensorboard?

How do I install TensorFlow's tensorboard?..

Convert DataSet to List

Here is my c# code Employee objEmp = new Employee(); List<Employee> empList = new List<Employee>(); foreach (DataRow dr in ds.Tables[0].Rows) { empList.Add(new Employee { Name = Conve..

PHP $_SERVER['HTTP_HOST'] vs. $_SERVER['SERVER_NAME'], am I understanding the man pages correctly?

I did a lot of searching and also read the PHP $_SERVER docs. Do I have this right regarding which to use for my PHP scripts for simple link definitions used throughout my site? $_SERVER['SERVER_NAME..

Upgrading PHP on CentOS 6.5 (Final)

I'm trying to update my PHP (currently v:5.3.3 to the latest stable PHP build) but it's not playing ball and it's saying there is nothing to update. Any help would be useful. Keeps saying: No Pa..

What's the best UI for entering date of birth?

What is the best method for date of birth selector? 3 text inputs (month / day / year) or one mask input. User MUST use keyboard 3 select boxes. User can use keyboard or mouse. One nice datepicker...

Reading a registry key in C#

I have developed an application and installed it on a client computer. In my application I need to get its installation path. My application has a registry entry at: HKEY_LOCAL_MACHINE\SOFTWARE\MyAp..

LEFT JOIN in LINQ to entities?

I'm trying out LINQ to entities. I have a problem with the following: I want it to do this: SELECT T_Benutzer.BE_User ,T_Benutzer_Benutzergruppen.BEBG_BE FROM T_Benutzer LEFT JOIN T_Benut..

Installing Python packages from local file system folder to virtualenv with pip

Is it possible to install packages using pip from the local filesystem? I have run python sdist for my package, which has created the appropriate tar.gz file. This file is stored on my syste..

The breakpoint will not currently be hit. No symbols have been loaded for this document in a Silverlight application

Ok, what I have: Visual Studio 2010 RC, W7 x64, started a new project type of Silverlight application. Hosting the Silverlight application in a ASP.NET Web Application Project. Silverlight Version 3..

What is the proper declaration of main in C++?

Questions What is the proper signature of the main function in C++? What is the correct return type, and what does it mean to return a value from main? What are the allowed parameter types, and wha..

remove borders around html input

I want to create a search function for my web app. here are the looks on FF & IE, it is ok without strange border Firefox IE and here are the look on Chrome & Safari, it has strange bo..

What is the advantage of using REST instead of non-REST HTTP?

Apparently, REST is just a set of conventions about how to use HTTP. I wonder which advantage these conventions provide. Does anyone know? ..

Display Image On Text Link Hover CSS Only

I have a text link. When the user hovers over the text link, I want an image to be displayed elsewhere on the page. I want to do this using css. I thought it could be done simply with a single line of..

On npm install: Unhandled rejection Error: EACCES: permission denied

I have managed to corrupt my npm install, and whenever I try to install packages using npm install, I receive error messages along these lines: Unhandled rejection Error: EACCES: permission denied..

How to create a readonly textbox in ASP.NET MVC3 Razor

How do I create a readonly textbox in ASP.NET MVC3 with the Razor view engine? Is there an HTMLHelper method available to do that? Something like the following? @Html.ReadOnlyTextBoxFor(m => m.u..

Python: Checking if a 'Dictionary' is empty doesn't seem to work

I am trying to check if a dictionary is empty but it doesn't behave properly. It just skips it and displays ONLINE without anything except of display the message. Any ideas why ? def isEmpty(self, dic..

How to get jSON response into variable from a jquery script

I am having trouble with my jquery script below, this is a basic stripped down version and even it will not work, I have the php file that the jquery script makes a call to, I have it set to encode a..

Bubble Sort Homework

In class we are doing sorting algorithms and, although I understand them fine when talking about them and writing pseudocode, I am having problems writing actual code for them. This is my attempt in ..

Fire event on enter key press for a textbox

I have the following textbox control. <asp:TextBox ID="txtAdd" runat="server" /> After the user writes something in this textbox and presses the ENTER key, I want to run some code fro..

How to display Wordpress search results?

I've spent a lot of time figuring out why my search is not working in my custom made template. So far I was able to figure out how to include searchform.php file in my header, created search.php file ..

How do you find out the type of an object (in Swift)?

When trying to understand a program, or in some corner-cases, it's useful to be able to actually find out what type something is. I know the debugger can show you some type information, and you can us..

How to open a page in a new window or tab from code-behind

So I have a webapplication where I select a value from a dropdownlist. When this value is selected, I want to load another page in a new window. I tried this: ScriptManager.RegisterStartupScript(Pag..

How to properly assert that an exception gets raised in pytest?

Code: # coding=utf-8 import pytest def whatever(): return 9/0 def test_whatever(): try: whatever() except ZeroDivisionError as exc:, pytrace=True) Out..

Bootstrap alert in a fixed floating div at the top of page

I have a web application which uses Bootstrap (2.3.2 - corporate policy, we cannot upgrade to 3.0 without lots of testing across several web applications). We have several long pages within this appli..

Remove end of line characters from Java string

I have string like this "hello java book" I want remove \r and \n from String(hello\r\njava\r\nbook). I want the result to be "hellojavabook". How can I do this?..

Truncate Decimal number not Round Off

Possible Duplicate: c# - How do I round a decimal value to 2 decimal places (for output on a page) I want to truncate the decimals like below i.e. 2.22939393 -> 2.229 2.22977777 -> 2.229..

Update my gradle dependencies in eclipse

I have a simple gradle project in my eclipse. I update the build.gradle to include a few apache http jars... dependencies { compile group: 'commons-collections', name: 'commons-collections', vers..

Clear MySQL query cache without restarting server

Is there any way to clear mysql query cache without restarting mySQL server?..

How do I perform the SQL Join equivalent in MongoDB?

How do I perform the SQL Join equivalent in MongoDB? For example say you have two collections (users and comments) and I want to pull all the comments with pid=444 along with the user info for each. ..

PHP Warning: Division by zero

I'm learning php and built an experimental form-based calculator (also using html & POST method) that returns values to a table. The calculator is functional when I enter my values and click submi..

Evaluate a string with a switch in C++

I want to evaluate a string with a switch but when I read the string entered by the user throws me the following error. #include<iostream> using namespace std; int main() { string ..

What is the default database path for MongoDB?

I got an error about dbpath (/data/db/) does not exist, but /etc/mongodb.conf named it dbpath = /var/lib/mongodb. So, which is the default dbpath for MongoDB?..

Maximum length of HTTP GET request

What's the maximum length of an HTTP GET request? Is there a response error defined that the server can/should return if it receives a GET request that exceeds this length? This is in the context of..

Map implementation with duplicate keys

I want to have a map with duplicate keys. I know there are many map implementations (Eclipse shows me about 50), so I bet there must be one that allows this. I know it's easy to write your own map th..

How do you extract classes' source code from a dll file?

Is there any software to do this? I didn't find any useful information on the internet so I am asking here...

How to get the id of the element clicked using jQuery

<div class="main_div"> <div id="inner_div"> <span id="d1" class="get_clicked">click to get id</span> </div> </div> How to get the id of the cl..

Export data from Chrome developer tool

Network analysis by Chrome when page loads I would like to export this data to Microsoft Excel so that I will have a list of similar data when loaded at diffrent times. Loading a page one time do..

Microsoft Advertising SDK doesn't deliverer ads

So I have a Windows Phone solution that has an ad in it. When my Solution References Microsoft.Advertising.SDK Advertising.Mobile Advertising.Mobile.UI Everything works fine and I get ads. Unfortu..

Find the number of columns in a table

It is possible to find the number of rows in a table: select count(*) from tablename Is it possible to find the number of columns in a table?..

jQuery UI Dialog individual CSS styling

I'm looking to style a modal dialog (using UI Dialog) with unique CSS that is separate from the traditional dialog, so in essence to have two jQuery dialogs that each look different. I've styled one,..

Single quotes vs. double quotes in C or C++

When should I use single quotes and double quotes in C or C++ programming?..

Jquery UI Datepicker not displaying

UPDATE I have reverted back to Jquery 1.3.2 and everything is working, not sure what the problem is/was as I have not changed anything else apart of the jquery and ui library versions. UPDATE END I h..

How to create an Array, ArrayList, Stack and Queue in Java?

I was reading a Java article, but found no differences in the declaration and was confused over. Can anyone list me out this? Added the Article

Open Popup window using javascript

I am looking to open one aspx page (test.aspx) in two different popup windows at the same time. what I have till now second replace first one and page recreate in first. I think it require more clar..

How can I create an error 404 in PHP?

My .htaccess redirects all requests to /word_here to /page.php?name=word_here. The PHP script then checks if the requested page is in its array of pages. If not, how can I simulate an error 404? I tr..

How can I use ":" as an AWK field separator?

Given the following command, echo "1: " | awk '/1/ -F ":" {print $1}' why does AWK output: 1: ?..

How can I check a C# variable is an empty string "" or null?

I am looking for the simplest way to do a check. I have a variable that can be equal to "" or null. Is there just one function that can check if it's not "" or null?..

how to draw directed graphs using networkx in python?

I have some nodes coming from a script that I want to map on to a graph. In the below, I want to use Arrow to go from A to D and probably have the edge colored too in (red or something). This is basi..

Where to put the file

I am following the Artifactory 1-min Setup. I have Artifactory up and running on my localhost, and now I am trying to integrate it with Intellij/Gradle. The artifactory webapp gives a gradle.properti..

In CSS what is the difference between "." and "#" when declaring a set of styles?

What is the difference between # and . when declaring a set of styles for an element and what are the semantics that come into play when deciding which one to use?..

Grant Select on a view not base table when base table is in a different database

I have a view which is selecting rows from a table in a different database. I'd like to grant select access to the view, but not direct access to the base table. The view has a where clause restrict..

Path to MSBuild

How can I programatically get the path to MSBuild from a machine where my .exe is running? I can get the .NET version from the Environment but is there a way of getting the correct folder for a .NET ..

PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client

I'm running MySQL version 8 on PHP 7.0. I'm getting the following error when I try to connect to my database from PHP: Connect Error: SQLSTATE[HY000] [2054] The server requested authentication me..

How to select a specific node with LINQ-to-XML

I can select the first customer node and change its company name with the code below. But how do I select customer node where ID=2? XDocument xmldoc = new XDocument( new XDeclaration("1...

CSS disable text selection

Currently, I have put this in the body tag to disable text selections: body { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } However, my inpu..

Android Call an method from another class

I know that this Question is repeated but I can't find the answer in Internet. I want to call a method from another class. I've Class1 and Class2. In Class 2 I've that method: public void UpdateEm..

How to maintain a Unique List in Java?

How to create a list of unique/distinct objects (no duplicates) in Java? Right now I am using HashMap<String, Integer> to do this as the key is overwritten and hence at the end we can get Hash..

Pandas split column of lists into multiple columns

I have a pandas DataFrame with one column: import pandas as pd df = pd.DataFrame( data={ "teams": [ ["SF", "NYG"], ["SF", "NYG"], ["SF", "NYG"], ..

git rm - fatal: pathspec did not match any files

I added over 9000 photos by accident to my project folder. And committed them. Then deleted them from disk. Committed. Now I try to push changes to git server. But it takes too long and tries to se..

Hide the browse button on a input type=file

Is there a way to hide the browse button and only leave the text box that works in all browsers? I have tried setting the margins but they show up different in each browser..

How to delete zero components in a vector in Matlab?

I have a vector for example a = [0 1 0 3] I want to turn a into b which equals b = [1 3]. How do I perform this in general? So I have a vector with some zero components and I want to remove the ze..

Find value in an array

In Ruby, how can I find a value in an array?..

How to make links in a TextView clickable?

I have the following TextView defined: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/txtCredits" android:autoLink="web" android:..

Using Switch Statement to Handle Button Clicks

I'm trying to wrap my head around Views, Listeners etc. I have an Activity with 2 Buttons: buttonplay and buttonstop. My problem is I can't wrap my head around the Views and Listeners completely eno..

How to list all dates between two dates

I would like list dates between two date in a SQL Server stored procedure. For example: Date1: 2015-05-28 Date2: 2015-05-31 Results : 2015-05-29 2015-05-30 How to calculate all dates between t..

Plotting power spectrum in python

I have an array with 301 values, which were gathered from a movie clip with 301 frames. This means 1 value from 1 frame. The movie clip is running at 30 fps, so is in fact 10 sec long Now I would lik..

Check if int is between two numbers

Why can't do you this if you try to find out whether an int is between to numbers: if(10 < x < 20) Instead of it, you'll have to do if(10<x && x<20) which seems like a bit of..

Must declare the scalar variable

I wrote this SQL in a stored procedure but not working, declare @tableName varchar(max) = 'TblTest' declare @col1Name varchar(max) = 'VALUE1' declare @col2Name varchar(max) = 'VALUE2' declare @value1..

Read file line by line in PowerShell

I want to read a file line by line in PowerShell. Specifically, I want to loop through the file, store each line in a variable in the loop, and do some processing on the line. I know the Bash equival..

How to fire a change event on a HTMLSelectElement if the new value is the same as the old?

I have the following markup: <select onchange="jsFunction()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option&..

Pip error: Microsoft Visual C++ 14.0 is required

I just ran the following command: pip install -U steem and the installation worked well until it failed to install pycrypto. Afterwards I did the pip install cryptography command because I thought i..

How does String.Index work in Swift

I've been updating some of my old code and answers with Swift 3 but when I got to Swift Strings and Indexing it has been a pain to understand things. Specifically I was trying the following: let st..

Matplotlib scatter plot legend

I created a 4D scatter plot graph to represent different temperatures in a specific area. When I create the legend, the legend shows the correct symbol and color but adds a line through it. The code I..

What's the difference between OpenID and OAuth?

I'm really trying to understand the difference between OpenID and OAuth? Maybe they're two totally separate things?..

Expression must have class type

I have't coded in c++ for some time and I got stuck when I tried to compile this simple snippet: class A { public: void f() {} }; int main() { { A a; a.f(); // works fine } { ..

Spring @ContextConfiguration how to put the right location for the xml

In our project we are writting a test to check if the controller returns the right modelview @Test public void controllerReturnsModelToOverzichtpage() { ModelAndView modelView = new M..

Build unsigned APK file with Android Studio

I'm developing an Android app with the Android Developer Tool. Now I tried the new Android Studio, everything works fine if connect my smartphone with the PC and directly run the program in the Androi..

Is there a query language for JSON?

Is there a (roughly) SQL or XQuery-like language for querying JSON? I'm thinking of very small datasets that map nicely to JSON where it would be nice to easily answer queries such as "what are all t..

Moment.js get day name from date

I'm using jquery and moment.js for a custom calendar. I have a date object in a variable myDate like : Object { date="2014-12-23 14:00:00", timezone_type=3, timezone="Europe/Paris"} I want, usin..

Change the Blank Cells to "NA"

Here's the link of my data. My target is to assign "NA" to all blank cells irrespective of categorical or numerical values. I am using na.strings="". But it's not assigning NA to all blank cells. #..

Move seaborn plot legend to a different position?

I'm using factorplot(kind="bar") with seaborn. The plot is fine except the legend is misplaced: too much to the right, text goes out of the plot's shaded area. How do I make seaborn place the legend..

What is the use of ObservableCollection in .net?

What is the use of ObservableCollection in .net?..

Subtracting time.Duration from time in Go

I have a time.Time value obtained from time.Now() and I want to get another time which is exactly 1 month ago. I know subtracting is possible with time.Sub() (which wants another time.Time), but tha..

Rails: Check output of path helper from console

Rails defines a bunch of magic with named routes that make helpers for your routes. Sometimes, especially with nested routes, it can get a little confusing to keep track of what URL you'll get for a g..

Regular expression matching a multiline block of text

I'm having a bit of trouble getting a Python regex to work when matching against text that spans multiple lines. The example text is ('\n' is a newline) some Varying TEXT\n \n DSJFKDAFJKDAFJDSAKFJADS..

Check whether a variable is a string in Ruby

Is there anything more idiomatic than the following? foo.class == String ..

Uncaught SoapFault exception: [HTTP] Error Fetching http headers

I'm trying to create a soap connection to Magento's web services, however I'm getting an error when I try and create an instance of the soap client class. I can view the wsdl file in firefox without ..

Android - Pulling SQlite database android device

I've looked everywhere and i can't find a real precise answer or a tutorial on how, if it is possible, to do this. is it possible to pull in any way a database of an Android device without having to ..

How to add multiple columns to pandas dataframe in one assignment?

I'm new to pandas and trying to figure out how to add multiple columns to pandas simultaneously. Any help here is appreciated. Ideally I would like to do this in one step rather than multiple repeat..

Find length of 2D array Python

How do I find how many rows and columns are in a 2d array? For example, Input = ([[1, 2], [3, 4], [5, 6]])` should be displayed as 3 rows and 2 columns...

Resolving IP Address from hostname with PowerShell

I am trying to get the ipaddress from a hostname using Powershell, but I really can't figure out how. Any help?..

Using a dictionary to select function to execute

I am trying to use functional programming to create a dictionary containing a key and a function to execute: myDict={} myItems=("P1","P2","P3",...."Pn") def myMain(key): def ExecP1(): p..