Questions Tagged with #Infinite

An infinite structure or process is one which does not terminate. Infinite loops or structures may be bugs in certain contexts, but also may be desired behavior, particularly in server-processes or lazy languages.

Is it possible to set a number to NaN or infinity?

Is it possible to set an element of an array to NaN in Python? Additionally, is it possible to set a variable to +/- infinity? If so, is there any function to check whether a number is infinity or no..

How can I represent an infinite number in Python?

How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity...

Bash: infinite sleep (infinite blocking)

I use startx to start X which will evaluate my .xinitrc. In my .xinitrc I start my window manager using /usr/bin/mywm. Now, if I kill my WM (in order to f.e. test some other WM), X will terminate too ..

Mac OS X and multiple Java versions

How can I install an additional java on MacOS? I installed jdk8 and that works fine. but now I need a jdk7 installation for development purposes. When trying to install the old version via DMG file, ..

If WorkSheet("wsName") Exists

I'm wondering if there is clean cut functionality that returns True or False if a worksheet inside a workbook exists? It would be good, but not essential, if it's possible to do it without skipping ..

Which version of Python do I have installed?

I have to run a Python script on a Windows server. How can I know which version of Python I have, and does it even really matter? I was thinking of updating to the latest version of Python...

Open files always in a new tab

I am using Visual Studio Code 1.3.1 with the newly introduced tabs. When I click on files, the first file will open in a tab. If I do not make any changes to this file, the second clicked file will o..

7-zip commandline

I'm creating a backup utility that zips all the files listed in a text file. I am using MS ACCESS as my front-end and 7-Zip for compression. These are the commands I am using: 7zG.exe a c:\Backup\bac..

How do I add a auto_increment primary key in SQL Server database?

I have a table set up that currently has no primary key. All I need to do is add a primary key, no null, auto_increment. I'm working with a Microsoft SQL Server database. I understand that it can't b..

Why Anaconda does not recognize conda command?

I installed the latest version of Anaconda. Now I want to install OpenCV within it. When I type: conda install -c opencv I get this message error: "conda is not r..

PHP shell_exec() vs exec()

I'm struggling to understand the difference between shell_exec() and exec()... I've always used exec() to execute server side commands, when would I use shell_exec()? Is shell_exec() just a shorthan..

AngularJS ui router passing data between states without URL

I am facing this problem of passing data between two states without exposing the data in the url, it's like user cannot really directly land on this state. For example. I have two states "A" and "B"...

Current user in Magento?

I'm customizing the product view page and I need to show the user's name. How do I access the account information of the current user (if he's logged in) to get Name etc. ?..

Alter table add multiple columns ms sql

Can anyone tell me where is the mistake in the following query ALTER TABLE Countries ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, HasText bit); ..

Sorting a List<int>

Using C# what is the best way to sort a List numerically? my list has items 5,7,3 and I would like them sorted 3,5,7. I know some longer ways, but I would imagine linq has a quicker way? sorry this ..

How do I remove an array item in TypeScript?

I have an array that I've created in TypeScript and it has a property that I use as a key. If I have that key, how can I remove an item from it?..

When I catch an exception, how do I get the type, file, and line number?

Catching an exception that would print like this: Traceback (most recent call last): File "c:/", line 1, in <module> 4 / 0 ZeroDivisionError: integer division or modulo by zero I ..

How to redirect to Index from another controller?

I have been looking through trying to find some way to redirect to an Index view from another controller. public ActionResult Index() { ApplicationController viewModel = new Appl..

Angular - ui-router get previous state

Is there a way to get the previous state of the current state? For example I would like to know what the previous state was before current state B (where previous state would have been state A). I..

android: how to use getApplication and getApplicationContext from non activity / service class

I'm using extending application class on Android to share my data across the entire app. I can use getApplication() method from all my activities. However, there are certain custom helper classes I ..

How to show PIL Image in ipython notebook

This is my code from PIL import Image pil_im ='data/empire.jpg') I would like to do some image manipulation on it, and then show it on screen. I am having problem with showing PIL Image..

What is the volatile keyword useful for?

At work today, I came across the volatile keyword in Java. Not being very familiar with it, I found this explanation. Given the detail in which that article explains the keyword in question, do you ev..

Select multiple columns from a table, but group by one

The table name is "OrderDetails" and columns are given below: OrderDetailID || ProductID || ProductName || OrderQuantity I'm trying to select multiple columns and Group By ProductID while having SU..

How do you change the width and height of Twitter Bootstrap's tooltips?

I created a tooltip using Twitter Bootstrap. The tooltip is displaying with three lines. However, I would like to display the tooltip with only one line. How do I change the width of the tooltip? Is..

jQuery event is triggered twice

I have the following problem with this code: <button id="delete">Remove items</button> $("#delete").button({ icons: { primary: 'ui-icon-trash' } }).click(function(..

Cannot import keras after installation

I'm trying to setup keras deep learning library for Python3.5 on Ubuntu 16.04 LTS and use Tensorflow as a backend. I have Python2.7 and Python3.5 installed. I have installed Anaconda and with help of ..

How to append in a json file in Python?

I have the a json file whose contents is {"67790": {"1": {"kwh": 319.4}}}. Now I create a dictionary a_dict which I need to append it into the json file. I tried the following but was not able to do i..

Bootstrap datepicker hide after selection

How do I hide the calendar after a date is selected? Is there a specific function that I can use? My code below: $('#dp1').datepicker({ format: 'mm-dd-yyyy', startDate: '-15d', autoclose..

What is the difference between .text, .value, and .value2?

What is the difference between .text, .value, and .value2? Such as when should target.text, target.value, and target.value2 be used?..

When a 'blur' event occurs, how can I find out which element focus went *to*?

Suppose I attach an blur function to an HTML input box like this: <input id="myInput" onblur="function() { ... }"></input> Is there a way to get the ID of the element which caused the b..

DateTime and CultureInfo

I have this in my code: var date1 = DateTime.ParseExact(date, "dd.MM.yyyy HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture); And when my current cultur is dutch (nl-NL) instead of May 1..

How to customize the background color of a UITableViewCell?

I would like to customize the background (and maybe the border too) of all of the UITableViewCells within my UITableView. So far I have not been able to customize this stuff, so I have a bunch of whit..

How to set editor theme in IntelliJ Idea

I'm trying to change the editor color schemes in IntelliJ Idea 13.1.3 community edition to a darker theme. I downloaded a theme from a website [Editor's note: the website has since been replaced with ..

AND/OR in Python?

I know that the and and or expressions exist in python, but is there any and/or expression? Or some way to combine them in order to produce the same effect as a and/or expression? my code looks somet..

How to find when a web page was last updated

Is there a way to find out how much time has passed since a web page was changed? For example, I have a page hosted at: Is there a way to find out when this HTML page w..

How do you scroll up/down on the console of a Linux VM

I recognize that Up/Down will give you the command history. But, how do you look at past output by scrolling up and down? I have used Shift+Page Up/Page Down, Alt+Shift+Up/Down and Page Up/Page Down ..

Converting a Uniform Distribution to a Normal Distribution

How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?..

jQuery function to get all unique elements from an array?

jQuery.unique lets you get unique elements of an array, but the docs say the function is mostly for internal use and only operates on DOM elements. Another SO response said the unique() function worke..

Right HTTP status code to wrong input

What is optimal HTTP response Code when not reporting 200 (everything OK) but error in input? Like, you submit some data to server, and it will response that your data is wrong using 500 looks m..

Equivalent of varchar(max) in MySQL?

What is the equivalent of varchar(max) in MySQL?..

How to write and save html file in python?

This is what I know about writing to an HTML file and saving it: html_file = open("filename","w") html_file.write() html_file.close() But how do I save to the file if I want to wr..

Reset push notification settings for app

I am developing an app with push notifications. To check all possible ways of user interaction, I'd like to test my app when a user declines to have push notifications enabled for my app during the fi..

Oracle: How to find out if there is a transaction pending?

I'm looking for a way to find out if there are uncommited INSERT, UPDATE or DELETE statements in the current session. One way would be to check v$lock with the current sid, but that requires read acce..

Python - Locating the position of a regex match in a string?

I'm currently using regular expressions to search through RSS feeds to find if certain words and phrases are mentioned, and would then like to extract the text on either side of the match as well. For..

Rendering HTML inside textarea

I need to be able to render some HTML tags inside a textarea (namely <strong>, <i>, <u>, <a>) but textareas only interpret their content as text. Is there an easy way of doing ..

Can I try/catch a warning?

I need to catch some warnings being thrown from some php native functions and then handle them. Specifically: array dns_get_record ( string $hostname [, int $type= DNS_ANY [, array &$authns ..

Shift elements in a numpy array

Following-up from this question years ago, is there a canonical "shift" function in numpy? I don't see anything from the documentation. Here's a simple version of what I'm looking for: def shift(xs,..

Ruby class instance variable vs. class variable

I read "" but I'm of two minds when to use class instance variables. Class variables are shared by all objec..

How can I determine if a date is between two dates in Java?

How can I check if a date is between two other dates, in the case where all three dates are represented by instances of java.util.Date?..

AngularJS - Access to child scope

If I have the following controllers: function parent($scope, service) { $scope.a = 'foo'; $ = function() {{ a: $scope.a, b: $scope.b..

Does my application "contain encryption"?

I'm uploading a binary for the first time. iTunes Connect has asked me: Export laws require that products containing encryption be properly authorized for export. Failure to comply could result ..

Swift: How to get substring from start to last index of character

I want to learn the best/simplest way to turn a string into another string but with only a subset, starting at the beginning and going to the last index of a character. For example, convert "www.stac..

Replace whitespaces with tabs in linux

How do I replace whitespaces with tabs in linux in a given text file?..

Truncate a string straight JavaScript

I'd like to truncate a dynamically loaded string using straight JavaScript. It's a url, so there are no spaces, and I obviously don't care about word boundaries, just characters. Here's what I got..

Return rows in random order

Is it possible to write SQL query that returns table rows in random order every time the query run?..

Difference between signed / unsigned char

So I know that the difference between a signed int and unsigned int is that a bit is used to signify if the number if positive or negative, but how does this apply to a char? How can a character be po..

How to configure multi-module Maven + Sonar + JaCoCo to give merged coverage report?

I've searched up and down the internet for this one. There's lots of half-answers out there, to do with Maven properties such as ${sonar.jacoco.reportPath}, or org.jacoco:jacoco-maven-plugin:prepare-a..

How can I roll back my last delete command in MySQL?

I accidentally deleted some huge number of rows from a table... How can I roll it back? I executed the query using PuTTY. I'll be grateful if any of you can guide me safely out of this.....

Convert pandas timezone-aware DateTimeIndex to naive timestamp, but in certain timezone

You can use the function tz_localize to make a Timestamp or DateTimeIndex timezone aware, but how can you do the opposite: how can you convert a timezone aware Timestamp to a naive one, while preservi..

What's a good, free serial port monitor for reverse-engineering?

I'm reverse-engineering a serial protocol and getting frustrated by bad tools. Does anyone know of a good, free tool for logging data to/from serial ports on Windows? Requirements: Must be free Mu..

install cx_oracle for python

Am on Debian 5, I've been trying to install cx_oracle module for python without any success. First, I installed oracle-xe-client and its dependency (followed tutorial in the following link here). Th..

How to add Headers on RESTful call using Jersey Client API

Here is the Format for RESTful call: HEADERS: Content-Type: application/json;charset=UTF-8 Authorization: Bearer Rc7JE8P7XUgSCPogjhdsVLMfITqQQrjg REQUEST: GET

An "and" operator for an "if" statement in Bash

I'm trying to create a simple Bash script to check if the website is down and for some reason the "and" operator doesn't work: #!/usr/bin/env bash SUBJECT="$WEBSITE DOWN!" EMAILID..

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"); } } ..

Java getting the Enum name given the Enum Value

How can I get the name of a Java Enum type given its value? I have the following code which works for a particular Enum type, can I make it more generic? public enum Category { APPLE("3"), ..

How can I list all commits that changed a specific file?

Is there a way to list all commits that changed a specific file?..

Disallow Twitter Bootstrap modal window from closing

I am creating a modal window using Twitter Bootstrap. The default behavior is if you click outside the modal area, the modal will automatically close. I would like to disable that -- i.e. not close th..

Turning off auto indent when pasting text into vim

I am making the effort to learn Vim. When I paste code into my document from the clipboard, I get extra spaces at the start of each new line: line line line I know you can turn off auto inde..

How to redirect to another page using PHP

I'm building a website which includes a login page. I need to redirect the user to their profile page once they've logged in successfully, but I don't know how to do that in PHP (It's my first site). ..

Why am I seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors after upgrading to Cordova Android 8?

After upgrading to Cordova Android 8.0, I am seeing net::ERR_CLEARTEXT_NOT_PERMITTED errors when trying to connect to http:// targets. Why is that and how can I resolve this?..

Exception in thread "main" java.util.NoSuchElementException

Whenever I run this, the chooseCave() function works fine with the in.nextInt(). When I choose the cave, the messages pop up at 2-second intervals, and then as soon as it gets past that part, it gives..

A simple scenario using wait() and notify() in java

Can I get a complete simple scenario i.e. tutorial that suggest how this should be used, specifically with a Queue?..

Printing Python version in output

How can I print the version number of the current Python installation from my script?..

Alter a SQL server function to accept new optional parameter

I already have a function in SQL Server 2005 as: ALTER function [dbo].[fCalculateEstimateDate] (@vWorkOrderID numeric) Returns varchar(100) AS Begin <Function Body> End I want to modify th..

C++ printing boolean, what is displayed?

I print a bool to an output stream like this: #include <iostream> int main() { std::cout << false << std::endl; } Does the standard require a specific result on the stream (e..

Using GitLab token to clone without authentication

I want to clone GitLab repository without prompt for my automation script, by using my private token from my GitLab account. Can someone provide me a sample? I know I can do so with user and password:..

Confirm button before running deleting routine from website

I have a page on my website that is dynamically created with information from an SQL database. As well as the data being displayed a delete link is also created for each record which links to a php fi..

Find the PID of a process that uses a port on Windows

My service crash on startup with the classic: java.rmi.server.ExportException: Listen failed on port: 9999 How can I find the process for killing it?..

fatal error: mpi.h: No such file or directory #include <mpi.h>

when I compile my script with only #include <mpi.h> it tells me that there is no such file or directory. But when i include the path to mpi.h as #include "/usr/include/mpi/mpi.h" (the path..

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: YES)

Warning: mysqli_connect(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: YES) in C:\Users\xampp\htdocs\PHP_Login_Script\config.php on line 6 Warning: mysqli_real..

How to disable Django's CSRF validation?

I have commented out csrf processor and middleware lines in 122 123 TEMPLATE_CONTEXT_PROCESSORS = ( 124 'django.contrib.auth.context_processors.auth', 125 # 'django.core.context_..

How do I control how Emacs makes backup files?

Emacs puts backup files named foo~ everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points t..

right align an image using CSS HTML

How can I right-align an image using CSS. I do not want the text to wrap-around the image. I want the right aligned image to be on a line by itself...

Running multiple AsyncTasks at the same time -- not possible?

I'm trying to run two AsyncTasks at the same time. (Platform is Android 1.5, HTC Hero.) However, only the first gets executed. Here's a simple snippet to describe my problem: public class AndroidJunk..

Using both Python 2.x and Python 3.x in IPython Notebook

I use IPython notebooks and would like to be able to select to create a 2.x or 3.x python notebook in IPython. I initially had Anaconda. With Anaconda a global environment variable had to be changed..

Android - how to make a scrollable constraintlayout?

I want to make a layout that lets me scroll down using constraint layout, but I don't know how to go about it. Should the ScrollView be the parent of the ConstraintLayout like this? <?xml version=..

What is difference between png8 and png24

I want to know about uses of png files. There are two formats available for png images; one is png8 and the another one is png24. I would like to know that if I use either type in my html page, will..

Modifying location.hash without page scrolling

We've got a few pages using ajax to load in content and there's a few occasions where we need to deep link into a page. Instead of having a link to "Users" and telling people to click "settings" it's ..

Padding a table row

<html> <head> <title>Table Row Padding Issue</title> <style type="text/css"> tr { padding: 20px; } <..

What is the Java equivalent of PHP var_dump?

PHP has a var_dump() function which outputs the internal contents of an object, showing an object's type and content. For example: class Person { private $firstName; private $lastName; public..

How do you decrease navbar height in Bootstrap 3?

I want to make my navbar in BS3 to be of height 20px. How do I do this? I've tried the following: .tnav .navbar .container { height: 28px; } Did nothing. .navbar-fixed-top { height: 25px; /* ..

How can I build for release/distribution on the Xcode 4?

Build for debug is just press on the PLAY symbol, but I don't know how to Build for distribution/release? ..

What are the uses of the exec command in shell scripts?

Can anyone explain what are the uses of the exec command in shell scripting with simple examples?..

C++: variable 'std::ifstream ifs' has initializer but incomplete type

Sorry if this is pretty noobish, but I'm pretty new to C++. I'm trying to open a file and read it using ifstream: vector<string> load_f(string file) { vector<string> text; ifstream i..

What is the difference between <html lang="en"> and <html lang="en-US">?

What is the difference between <html lang="en"> and <html lang="en-US">? What other values can follow the dash? According to "Any two-letter subcode is understood to be a [ISO3166]..

How to use Bootstrap in an Angular project?

I am starting my first Angular application and my basic setup is done. How can I add Bootstrap to my application? If you can provide an example then it would be a great help...

Removing nan values from an array

I want to figure out how to remove nan values from my array. My array looks something like this: x = [1400, 1500, 1600, nan, nan, nan ,1700] #Not in this exact configuration How can I remove the n..

When to use Common Table Expression (CTE)

I have begun reading about Common Table Expression and cannot think of a use case where I would need to use them. They would seem to be redundant as the same can be done with derived tables. Is there ..

Writing outputs to log file and console

In Unix shell, I have a env file (env file defines the parameters required for running the user script like log file name and path, redirect outputs and errors to log file, database connection details..

How to create a QR code reader in a HTML5 website?

I was looking for possibility to create QR code reader in my HTML5 based web page. I've done some googling and all the links point me to the mobile applications. Please help me with some pointers as..

Submit form on pressing Enter with AngularJS

In this particular case, what options do I have to make these inputs call a function when I press Enter? // HTML view // <form> <input type="text" ng-model="name" <!-- Press ENTER and..

How to set a CMake option() at command line

I created a CMakeLists.txt that contains the following project(P4V) cmake_minimum_required(VERSION 2.6) option(BUILD_STATIC_LIBS "Build the static library" ON) option(BUILD_SHARED_LIBS "Build the sh..

#1214 - The used table type doesn't support FULLTEXT indexes

I'm getting an error saying that the table type doesn't support FULLTEXT indices. How can I achieve this? Here's my table: CREATE TABLE gamemech_chat ( id bigint(20) unsigned NOT NULL auto_increme..

How to create an empty DataFrame with a specified schema?

I want to create on DataFrame with a specified schema in Scala. I have tried to use JSON read (I mean reading empty file) but I don't think that's the best practice...

How to use a decimal range() step value?

Is there a way to step between 0 and 1 by 0.1? I thought I could do it like the following, but it failed: for i in range(0, 1, 0.1): print i Instead, it says that the step argument cannot be ..

How can I create a marquee effect?

I'm creating a marquee effect with CSS3 animation. _x000D_ _x000D_ #caption {_x000D_ position: fixed;_x000D_ bottom: 0;_x000D_ left: 0;_x000D_ font-size: 20px;_x000D_ line-height:..

avrdude: stk500v2_ReceiveMessage(): timeout

This is the main error that I get when I try to run my ARDUINO program. The full list of errors is as follows: avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout ..

How can I render Partial views in mvc 3?

I have some data in ViewData.Model, and in my views I want to write a partial view and to pass their current model I have in my page. How I can pass their current ViewData.Model and render them throu..

C++ error: "Array must be initialized with a brace enclosed initializer"

I am getting the following C++ error: array must be initialized with a brace enclosed initializer From this line of C++ int cipher[Array_size][Array_size] = 0; What is the problem here? What do..

ssl.SSLError: tlsv1 alert protocol version

I'm using the REST API for a Cisco CMX device, and trying to write Python code which makes a GET request to the API for information. The code is as follows and is the same as that in the file except w..

How do you attach and detach from Docker's process?

I can attach to a docker process but Ctrl+c doesn't work to detach from it. exit basically halts the process. What's the recommended workflow to have the process running, occasionally attaching to i..

Replace single quotes in SQL Server

I have this function in SQL Server to replace single quotes. But when I insert a single quote it throws an error on Replace(@strip,''','')): Create Function [dbo].[fn_stripsingleQuote] (@strStri..

Why is my CSS bundling not working with a bin deployed MVC4 app?

I have bin deployed an MVC4 application to my hosting provider, based on advice given here and one or two on-the-fly fixes, but the most immediately apparent problem is that the bundling for css doesn..

Nginx upstream prematurely closed connection while reading response header from upstream, for large requests

I am using nginx and node server to serve update requests. I get a gateway timeout when I request an update on large data. I saw this error from the nginx error logs : 2016/04/07 00:46:04 [error] 285..

How to generate a simple popup using jQuery

I am designing a web page. When we click the content of div named mail, how can I show a popup window containing a label email and text box?..

How do I set the proxy to be used by the JVM

Many times, a Java app needs to connect to the Internet. The most common example happens when it is reading an XML file and needs to download its schema. I am behind a proxy server. How can I set my ..

ES6 Class Multiple inheritance

I've done most of my research on this on BabelJS and on MDN (which has no information at all), but please feel free to tell me if I have not been careful enough in looking around for more information ..

What is the best way to measure execution time of a function?

Obviously I can do and DateTime.Now.After - DateTime.Now.Before but there must be something more sophisticated. Any tips appreciated...

How can I undo a `git commit` locally and on a remote after `git push`

I have performed git commit followed by a git push. How can I revert that change on both local and remote repositories? $ git log commit 364705c23011b0fc6a7ca2d80c86cef4a7c4db7ac8 Author: Michael Si..

Is there a better way to do optional function parameters in JavaScript?

I've always handled optional parameters in JavaScript like this: function myFunc(requiredArg, optionalArg){ optionalArg = optionalArg || 'defaultValue'; // Do stuff } Is there a better way to ..

How to fix request failed on channel 0

When I want to connect to my server like this ssh -a [email protected] -p 22 it gives me two error messages: PTY allocation request failed on channel 0 shell request failed on channel 0 When..

Save a file in json format using Notepad++

I have a json format (let's say text) in Notepad++. I want to save it as a json file using filename.json format. How can I make it in Notepad++ (because I can't find the extension when I go to save ..

ASP.NET MVC Page Won't Load and says "The resource cannot be found"

I am having a problem where I try to open my ASP.NET MVC application but I get the ASP.NET error page which says this: Server Error in '/' Application. The resource cannot be found. Descri..

What is the significance of 1/1/1753 in SQL Server?

Why 1753? What do they have against 1752? My great great great great great great great grandfather would be very offended...

how does Request.QueryString work?

I have a code example like this : location.href = location.href + "/Edit?pID=" + hTable.getObj().ID; ; //aspx parID = Request.QueryString["pID"]; //c# it works, my question is - how ? what i..

Where does forever store console.log output?

I installed forever and am using it, finding it quite funny. But I realized that the logs are placed to somewhere else. Is there any tips?..

How can I make a HTML a href hyperlink open a new window?

This is my code: <a href="" onClick="window.location.href='';return false;" target="_blank">test</a> When you click it, it takes you to Yahoo bu..

Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0

I have developed a simple project. where i have to print some crystal report. the project runs very well in local machine, but when i up this on a web hosting server, it shows me an error when crystal..

Installing mysql-python on Centos

I'm trying to get the MySQL-python lib installed on centos 5.5. I ran sudo yum install MySQL-python but then when I tried: import MySQLdb I get this error: Traceback (most recent call last): ..

Spring RestTemplate GET with parameters

I have to make a REST call that includes custom headers and query parameters. I set my HttpEntity with just the headers (no body), and I use the method as follows: HttpHeaders..

Convert negative data into positive data in SQL Server

The current data of the table is: a b --------- -1 5 -11 2 -5 32 My request is to convert every data into a positive value. Unfortunately, I forgot the name of the built-in function of SQL..

How to convert a JSON string to a Map<String, String> with Jackson JSON

I'm trying to do something like this but it doesn't work: Map<String, String> propertyMap = new HashMap<String, String>(); propertyMap = JacksonUtils.fromJSON(properties, Map.class); B..

What's the Kotlin equivalent of Java's String[]?

I see that Kotlin has ByteArray, ShortArray, IntArray, CharArray, DoubleArray, FloatArray, which are equivalent to byte[], short[], int[],char[], double[], float[] in Java. Now I'm wondering, is ther..

SQL query for getting data for last 3 months

How can you get today's date and convert it to 01/mm /yyyy format and get data from the table with delivery month 3 months ago? Table already contains delivery month as 01/mm/yyyy...

How to install JSON.NET using NuGet?

I am trying to download JSON.NET from NuGet. Is it available? What's the correct command?..

When would you use the different git merge strategies?

From the man page on git-merge, there are a number of merge strategies you can use. resolve - This can only resolve two heads (i.e. the current branch and another branch you pulled from) using 3-..

remote: repository not found fatal: not found

Why won't my git push? I created the repository and I keep getting this message: C:\Users\petey_000\rails_projects\first_app>git push -u github master Username for '': ***@gmail..

Read/write files within a Linux kernel module

I know all the discussions about why one should not read/write files from kernel, instead how to use /proc or netlink to do that. I want to read/write anyway. I have also read Driving Me Nuts - Thing..

Enabling the OpenSSL in XAMPP

I spent three hours but I did not find anything; I'm unable to connect to a SSL enabled server. I want to list what i did: First checked my PHP extensions directory was in order; extension wasn't the..

How to download fetch response in react as file

Here is the code in actions.js export function exportRecordToExcel(record) { return ({fetch}) => ({ type: EXPORT_RECORD_TO_EXCEL, payload: { promise: fetch('/record..

HTML5 Local storage vs. Session storage

Apart from being non persistent and scoped only to the current window, are there any benefits (performance, data access, etc) to Session Storage over Local Storage?..

Set NA to 0 in R

After merging a dataframe with another im left with random NA's for the occasional row. I'd like to set these NA's to 0 so I can perform calculations with them. Im trying to do this with: bothb..

switch case statement error: case expressions must be constant expression

My switch-case statement works perfectly fine yesterday. But when I run the code earlier this morning eclipse gave me an error underlining the case statements in color red and says: case expressions m..

How to extract text from a PDF?

Can anyone recommend a library/API for extracting the text and images from a PDF? We need to be able to get at text that is contained in pre-known regions of the document, so the API will need to give..

Send private messages to friends

I need to get via Facebook connect user's info and send a private message to all of his friends. Is it possible?..

How can I display a modal dialog in Redux that performs asynchronous actions?

I'm building an app that needs to show a confirm dialog in some situations. Let's say I want to remove something, then I'll dispatch an action like deleteSomething(id) so some reducer will catch that..

Explain why constructor inject is better than other options

In a Pro Spring 3 Book, Chapter 4 - Introduction IOC and DI in Spring - Page 59, In "Setter Injection vs. Constructor Injection" section, a paragraph says Spring included, provide a mechanism for ..

What's wrong with foreign keys?

I remember hearing Joel Spolsky mention in podcast 014 that he'd barely ever used a foreign key (if I remember correctly). However, to me they seem pretty vital to avoid duplication and subsequent dat..

SQL Server: What is the difference between CROSS JOIN and FULL OUTER JOIN?

What is the difference between CROSS JOIN and FULL OUTER JOIN in SQL Server? Are they the same, or not? Please explain. When would one use either of these?..

How to know installed Oracle Client is 32 bit or 64 bit?

OS: Windows 2008 Server R2 Oracle Client: 11.2 Many Thanks..

HighCharts Hide Series Name from the Legend

I try to solve this problem several times and give up. Now, when I have met him again, I decided to ask for some help. I have this code for my Legend: legend: { layout: 'vertical', align: 'rig..

How can I find the current OS in Python?

Possible Duplicate: Python: What OS am I running on? As the title says, how can I find the current operating system in python?..

How to pass multiple arguments in processStartInfo?

I want to run some cmd command from c#code. I followed some blogs and tutorial and got the answer, but I am in little bit confused i.e how should I pass multiple arguments? I use follow code: System..

How to take the nth digit of a number in python

I want to take the nth digit from an N digit number in python. For example: number = 9876543210 i = 4 number[i] # should return 6 How can I do something like that in python? Should I change it to ..

how to hide keyboard after typing in EditText in android?

I have a EditText and button aligned to parent's bottom. When I enter text in it and press the button to save data, the virtual keyboard does not disappear. Can any one guide me how to hide the keyb..

how to apply click event listener to image in android

i want to apply an onClickListener event to an imageView, how do I accomplish this? Can anyone provide me with some source code examples..

How to write inside a DIV box with javascript

I'm making a mini-game where a player attacks a npc and in the center is a white box (div) that I call (log), because when the player damages/attacks the npc, I want to be able for that open white spa..

How to put two divs on the same line with CSS in simple_form in rails?

Putting two divs on the same line is an old question. But I can't find a solution when working with simple_form in rails. What I want to do is to display content and its label on the same line. The wi..

read file in classpath

Here is what I want to do and I am wondering if there is any Spring classes that will help with implementing. I don't have to use spring for this particular problem, I'm just implementing it with eve..

Google Chromecast sender error if Chromecast extension is not installed or using incognito

I'm having an error running Chromecast sender in Chrome Incognito or if Chromecast extension is not installed: Failed to load resource: net::ERR_ADDRESS_UNREACHABLE chrome-extension://boadgeojelhgnda..

How to handle onchange event on input type=file in jQuery?

The code is: <input ID="fileUpload1" runat="server" type="file" The following works fine: <input onchange="javascript:alert('hola');" ID="fileUpload1" runat="server" type="file" I'd like ..

Installing mcrypt extension for PHP on OSX Mountain Lion

Apologies in advance for the potential n00b questions, I am trying to install the mcrypt extension for PHP on my OSX Mountain Lion machine. The following steps in terminal is what I have done so far ..

Java: Reading integers from a file into an array

File fil = new File("Tall.txt"); FileReader inputFil = new FileReader(fil); BufferedReader in = new BufferedReader(inputFil); int [] tall = new int [100]; String s =in.readLine(); while(s!=null) { ..

async await return Task

Can somebody explain what does this means into a synchronous method? If I try to change the method to async then VS complain about it. This works: public Task MethodName() { return Task.FromRes..

System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll?

I'm using WPF on C# as code bellow <Window xmlns="" xmlns:x="" xmlns:d="http..

How to prevent line-break in a column of a table cell (not a single cell)?

How can I prevent automatic line breaks in a column of table (not a single cell)?..

How to change the background color on a input checkbox with css?

Hello Friends all I'm trying to do is change the background color of a checkbox. I tired many things but nothing works. Can some one help? input[type="checkbox"] { background: #3d404e; ..

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

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

Python: Convert timedelta to int in a dataframe

I would like to create a column in a pandas data frame that is an integer representation of the number of days in a timedelta column. Is it possible to use 'datetime.days' or do I need to do somethin..

Optimal number of threads per core

Let's say I have a 4-core CPU, and I want to run some process in the minimum amount of time. The process is ideally parallelizable, so I can run chunks of it on an infinite number of threads and each ..

How to convert JSON to string?

Possible Duplicate: Convert JS object to JSON string I have a JSON object in JS, and I would like to convert it to string. Is it a function for this? Thanks in advance,..

How to align input forms in HTML

I'm new to HTML and I'm trying to learn how to use forms. The biggest issue I am having so far is aligning the forms. Here is an example of my current HTML file: <form> First Name:<input t..

HTML input file selection event not firing upon selecting the same file

Is there any chance to detect every file selection the user made for an HTML input of type file element? This was asked many times before, but the usually proposed onchange event doesn't fire if the..

current/duration time of html5 video?

I need a way of getting the total time length of the video and the current time with jquery and displaying it in a couple of <div> tags. <div id="current">0:00</div> <div id="dur..

Java FileOutputStream Create File if not exists

Is there a way to use FileOutputStream in a way that if a file (String filename) does not exist, then it will create it? FileOutputStream oFile = new FileOutputStream("score.txt", false); ..

How to convert char to int?

What is the proper way to convert a char to int? This gives 49: int val = Convert.ToInt32('1'); //int val = Int32.Parse("1"); // Works I don't want to convert to string and then parse it...

Adding an onclick event to a div element

I saw a few similar topics which did help but I have specific problem and didn't manage to solve it alone so if anyone can help out I would appreciate it I want to add onclick event to a div element...

Uncaught TypeError: Object #<Object> has no method 'movingBoxes'

Im trying to use the movingBoxes plugin with my mvc site and it is not working (obviously). I have the movingboxes.js imported in my head tag in the site.master like so <script src="&..

Does Python support short-circuiting?

Does Python support short-circuiting in boolean expressions?..

Integer value comparison

I'm a newbie Java coder and I just read a variable of an integer class can be described three different ways in the API. I have the following code: if (count.compareTo(0)) { System.out..

Angular.js and HTML5 date input value -- how to get Firefox to show a readable date value in a date input?

I have an HTML5 date input and I would like its value to be set to the value of the date property in my model by default. I'm not too fussy about formatting since Chrome seems to decide that for me an..

How to use execvp()

The user will read a line and i will retain the first word as a command for execvp. Lets say he will type "cat file.txt" ... command will be cat . But i am not sure how to use this execvp(), i read ..

Docker how to change repository name or rename image?

I'm trying to change repository name of the image: REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE server latest d583c3ac45fd ..

jQuery Set Cursor Position in Text Area

How do you set the cursor position in a text field using jQuery? I've got a text field with content, and I want the users cursor to be positioned at a certain offset when they focus on the field. Th..

Ignore duplicates when producing map using streams

Map<String, String> phoneBook = .collect(toMap(Person::getName, Person::getAddress)); ..

Set Focus After Last Character in Text Box

I have 3 text boxes for a phone number. As the user types, it automatically moves from one textbox to the next. When the user presses backspace, I can move focus to the previous text box. The probl..

How can I convert a string to a number in Perl?

I have a string which holds a decimal value in it and I need to convert that string into a floating point variable. So an example of the string I have is "5.45" and I want a floating point equivalent ..

Looping each row in datagridview

How to loop each row that readed? in my code, the row won't bind to next row because of the same productID, so the datagridview won't move to new row, it still in the same row and overwrite the price ..

Formula to convert date to number

I would like to know the formula to convert a date in 10/26/2013 to 41573 number as done in Excel. Like how 10/26/2013 is converted to 41573...

Bootstrap 3 hidden-xs makes row narrower

I'm experimenting with Bootstrap 3 responsive grids and am trying to make a column disappear from a row when the screen size is small. I can get the column to disappear but the whole row seems to get ..

How do I include a path to libraries in g++

I am trying to include the path to extra libraries in my makefile, but I can't figure out how to get the compiler to use that path. so far I have: g++ -g -Wall testing.cpp fileparameters.cpp main.cp..

Linear Layout and weight in Android

I always read about this funny weight value in the Android documentations. Now I want to try it for the first time but it isn't working at all. As I understand it from the documentations this layou..

Laravel is there a way to add values to a request array

I come across a situation in Laravel while calling a store() or update() method with Request parameter to add some additional value to the request before calling Eloquent functions is there any way fo..

Oracle error : ORA-00905: Missing keyword

Excuting the line of SQL: SELECT * INTO assignment_20081120 FROM assignment ; against a database in oracle to back up a table called assignment gives me the following ORACLE error: ORA-00905..

How do I set default values for functions parameters in Matlab?

Is it possible to have default arguments in Matlab? For instance, here: function wave(a, b, n, k, T, f, flag, fTrue=inline('0')) I would like to have the true solution be an optional argument to t..

The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly

Could someone please clarify something for me. In my ASP.NET MVC 2 app, I've got a BaseViewModel class which includes the following method: public virtual IDictionary<string, object> GetHtmlAt..

What is the difference between H.264 video and MPEG-4 video?

Are these both the same? Is H.264 codec of MPEG-4? What if I need to convert flv to high definition H.264 video format? I want make online tv streaming and want to use PHP or Python...

How to get a Fragment to remove itself, i.e. its equivalent of finish()?

I'm converting an app to use fragments using the compatibility library. Now currently I have a number of activities (A B C D) which chain onto one another, D has a button 'OK' which when pressed calls..

How to form tuple column from two columns in Pandas

I've got a Pandas DataFrame and I want to combine the 'lat' and 'long' columns to form a tuple. <class 'pandas.core.frame.DataFrame'> Int64Index: 205482 entries, 0 to 209018 Data columns: Month..

How do I remove a specific element from a JSONArray?

I am building one app in which I request a PHP file from server. This PHP file returns a JSONArray having JSONObjects as its elements e.g., [ { "uniqid":"h5Wtd", "name":"Test_1", ..

Jquery Smooth Scroll To DIV - Using ID value from Link

So i'm having some issues with my JQuery which is suppose to scroll to particular divs. HTML <div id="searchbycharacter"> <a class="searchbychar" href="#" id="#0-9" onclick="return fals..

Razor View throwing "The name 'model' does not exist in the current context"

After significant refactoring in my MVC 4 application, and Razor shows this error while debugging Views: The name 'model' does not exist in the current context. This is the offending line of cod..

How to extract numbers from a string in Python?

I would extract all the numbers contained in a string. Which is the better suited for the purpose, regular expressions or the isdigit() method? Example: line = "hello 12 hi 89" Result: [12, 89] ..