Questions Tagged with #Radians

Questions regarding angular sizes, arguments for trigonometric functions geometry etc.

Creating lowpass filter in SciPy - understanding methods and units

I am trying to filter a noisy heart rate signal with python. Because heart rates should never be above about 220 beats per minute, I want to filter out all noise above 220 bpm. I converted 220/minute ..

Using PI in python 2.7

I am trying to access the value of pi in Python 2.7, but it seems as if Python doesn't recognize math.pi. I am using IDLE, and when I try to print the value of math.pi, it says that "Math is not defin..

How can I convert radians to degrees with Python?

In the math module, I could only find math.cos(x), with cos/sin/tan/acos/asin/atan. This returns the answer in radians. How can I get the answer in degrees? Here's my code: import math x = math.cos..

How can I get sin, cos, and tan to use degrees instead of radians?

When I'm working with math in JS I would like its trig functions to use degree values instead of radian values. How would I do that?..

How to calculate distance between two locations using their longitude and latitude value

Here my code I used below code to calculate the distance between two location using their latitude and longitude. It is giving wrong distance. sometimes getting right and sometimes getting irrelevant ..

Calculate the center point of multiple latitude/longitude coordinate pairs

Given a set of latitude and longitude points, how can I calculate the latitude and longitude of the center point of that set (aka a point that would center a view on all points)? EDIT: Python soluti..

Calculating Distance between two Latitude and Longitude GeoCoordinates

I'm calculating the distance between two GeoCoordinates. I'm testing my app against 3-4 other apps. When I'm calculating distance, I tend to get an average of 3.3 miles for my calculation whereas othe..

Haversine Formula in Python (Bearing and Distance between two GPS points)

Problem I would like to know how to get the distance and bearing between 2 GPS points. I have researched on the haversine formula. Someone told me that I could also find the bearing using the same da..

Calculating distance between two points, using latitude longitude?

Here's my try, it's just a snippet of my code: final double RADIUS = 6371.01; double temp = Math.cos(Math.toRadians(latA)) * Math.cos(Math.toRadians(latB)) * Math.cos(Math.toR..

SQL Server AS statement aliased column within WHERE statement

I want to execute a query in which I rename one of the columns using the 'AS' statement and reuse that aliased column name within the 'WHERE' statement. Below is an example: SELECT lat AS latitude F..

Rotating a point about another point (2D)

I'm trying to make a card game where the cards fan out. Right now to display it Im using the Allegro API which has a function: al_draw_rotated_bitmap(OBJECT_TO_ROTATE,CENTER_X,CENTER_Y,X ,Y,D..

How to Rotate a UIImage 90 degrees?

I have a UIImage that is UIImageOrientationUp (portrait) that I would like to rotate counter-clockwise by 90 degrees (to landscape). I don't want to use a CGAffineTransform. I want the pixels of the U..

Fastest Way to Find Distance Between Two Lat/Long Points

I currently have just under a million locations in a mysql database all with longitude and latitude information. I am trying to find the distance between one point and many other points via a query. ..

What is the method for converting radians to degrees?

I run into this occasionally and always forget how to do it. One of those things that pop up ever so often. Also, what's the formula to convert angles expressed in radians to degrees and back again?..

Multiple left-hand assignment with JavaScript

var var1 = 1, var2 = 1, var3 = 1; This is equivalent to this: var var1 = var2 = var3 = 1; I'm fairly certain this is the order the variables are defined: var3, var2, var1, which would be ..

Maximum and Minimum values for ints

I am looking for minimum and maximum values for integers in python. For eg., in Java, we have Integer.MIN_VALUE and Integer.MAX_VALUE. Is there something like this in python?..

Is it possible to run a .NET 4.5 app on XP?

First, I have read the following: Connect case VS case and especially this channel9 post So, from the last bullet, I really think there is no way around this, but I had to see if I could get a def..

Visual Studio: LINK : fatal error LNK1181: cannot open input file

I've been encountering a strange bug in Visual Studio 2010 for some time now. I have a solution consisting of a project which compiles to a static library, and another project which is really simple ..

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

String length in bytes in JavaScript

In my JavaScript code I need to compose a message to server in this format: <size in bytes>CRLF <data>CRLF Example: 3 foo The data may contain unicode characters. I need to send them..

How to vertically center an image inside of a div element in HTML using CSS?

I have a markup like this: <div> <img /> </div> The div is higher than img: div { height: 100px; } img { height: dynamic-value-smaller-than-100px; } I need the image to ..

How to assign more memory to docker container

As the title reads, I'm trying to assign more memory to my container. I'm using an image from docker hub called "aallam/tomcat-mysql" in case that's relevant. When I start it normally without any spe..

Reading a text file with SQL Server

I am trying to read in a text file from an SQL query (SQL Server 2005) but am not having any luck at all. I've tried various things with EXEC and xp_cmdshell, but all aren't working. This is the gene..

How do I replace text in a selection?

I've just started using Sublime Text 2, coming from emacs. I have a region of text selected. Within that region, I'd like to replace all text instances of '0' with '255'. How do I do this kind of te..

What is the difference between java and core java?

When looking at job openings on-line, I noticed that some openings required knowledge of "core Java". What is core java and how is different from java?..

Function to calculate distance between two coordinates

I'm currently using the function below and it doesn't work properly. According to Google Maps, the distance between these coordinates (from 59.3293371,13.4877472 to 59.3225525,13.4619422) are 2.2 kilo..

What command shows all of the topics and offsets of partitions in Kafka?

I'm looking for a Kafka command that shows all of the topics and offsets of partitions. If it's dynamically would be perfect. Right now I'm using java code to see these information, but it's very inco..

Testing whether a value is odd or even

I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 || !!(n && !(n%2)); } function isOdd(n) { return i..

Multi-character constant warnings

Why is this a warning? I think there are many cases when is more clear to use multi-char int constants instead of "no meaning" numbers or instead of defining const variables with same value. When pars..

How do I run git log to see changes only for a specific branch?

I have a local branch tracking the remote/master branch. After running git-pull and git-log, the log will show all commits in the remote tracking branch as well as the current branch. However, because..

How to get named excel sheets while exporting from SSRS

Whenever a single page report is exported to excel, sheet in excel is named by the report name. If a report has multiple pages, the sheets are named as sheet1, sheet2,.... Is there any way to specify ..

Alternative to google finance api

I wanted to use Google Finance API to get stock data about the company but this API is deprecated since 2011/26/05. What do you use as free API to get stock data in real time?..

Barcode scanner for mobile phone for Website in form

I have inventory maintenance website up and running. currently the back end users are manually typing the item id on the system and using to search and do their work. I would like to automate the typi..

make div's height expand with its content

I have these nested divs and I need the main container to expand (in height) to accommodate the DIVs inside <!-- head --> ... <!-- /head --> <body class="main"> ..

Close Bootstrap modal on form submit

I have a Bootstrap modal dialog which contains a form. The modal dialog contains a submit and a cancel button. Now on submit button click the form is submitted successfully but the modal dialog isn't ..

Access 2010 VBA query a table and iterate through results

I have a query that I want to execute against a table. With the results I want to do something. In my head the pseudo code is: var q = "select * from table where some condition"; var results = db.get..

How can I use a JavaScript variable as a PHP variable?

I'm trying to include JavaScript variables into PHP code as PHP variables, but I'm having problems doing so. When a button is clicked, the following function is called: <script type="text/javascri..

Failed to load resource under Chrome

There is a bunch of images in a web page. Other browsers are downloading them correctly, but Chrome doesn't loads them. In the developer's console, it shows the following message for each image: ..

how to generate web service out of wsdl

Client provided me the wsdl to generate the web service.But when I used the wsdl.exe command it generated the .cs class out of it. I consumed that class in my web service and when I provided the wsdl ..

How to check if an option is selected?

$('#mySelectBox option').each(function() { if ($(this).isChecked()) alert('this option is selected'); else alert('this is not'); }); Apparently, the isChecked doesn't work. SO..

Adding rows dynamically with jQuery

I'm building a form where I need multiple optional inputs, what I have is basically this: Every time a user presses the plus button a new row of form inputs should be added to the form, how can I do..

Angular.js ng-repeat filter by property having one of multiple values (OR of values)

Is it possible to filter an array of objects, such that the value of property can be either of a few values (OR condition) without writing a custom filter This is similar to this problem - Angular.js..

Why plt.imshow() doesn't display the image?

I am a newbie to keras, and when I tried to run my first keras program on my linux, something just didn't go as I wish. Here is my python code: import numpy as np np.random.seed(123) from keras.model..

How do I check that a number is float or integer?

How to find that a number is float or integer? 1.25 --> float 1 --> integer 0 --> integer 0.25 --> float ..

Oracle SqlDeveloper JDK path

I have recently installed sqldeveloper but i'm getting the below warning window when I try to launch it. This is causing the sqldeveloper to run very very slow and it hangs frequently I have tried ..

How to get the containing form of an input?

I need to get a reference to the FORM parent of an INPUT when I only have a reference to that INPUT. Is this possible with JavaScript? Use jQuery if you like. function doSomething(element) { //el..

How to write asynchronous functions for Node.js

I've tried to research on how exactly asynchronous functions should be written. After a lot of plowing through a lot of documentation, it's still unclear to me. How do I write asynchronous functions ..

Anybody knows any knowledge base open source?

I want to build a web-based knowledge base system for our call center. To save some development time, I am looking for a open source. Does anybody know any good one out there?..

How to get data passed from a form in Express (Node.js)

I would like to get data that are passed from a page using a form and use that data in the page that is redirected. I have this form in my client side: <form action="game" method="ge..

nodejs mysql Error: Connection lost The server closed the connection

when I use node mysql, an error is appear between 12:00 to 2:00 that the TCP connection is shutdown by the server. This is the full message: Error: Connection lost: The server closed the connection. ..

Configuring Git over SSH to login once

I have cloned my git repository over ssh. So, each time I communicate with the origin master by pushing or pulling, I have to reenter my password. How can I configure git so that I do not need to ente..

npm install doesn't create node_modules directory

I am trying to do a homework for a mongodb uni course. They gave us some files, instructions are: run npm install mongodb then node app.js for some reason npm install does not create a node_modules ..

Unable to copy ~/.ssh/

I’m following in Generating SSH Keys, it says sudo apt-get install xclip Downloads and installs xclip. If you don't have apt-get, you might need to use another installer (like yum) xclip -sel cli..

How to remove only 0 (Zero) values from column in excel 2010

I want to remove the values from entire column where cells value is 0. The resultant Cells should be blank. How can I write a formula for this? Any suggestions? TELEPHONE NUMBERS ---------- 49 52..

How can I check whether a numpy array is empty or not?

How can I check whether a numpy array is empty or not? I used the following code, but this fails if the array contains a zero. if not self.Definition.all(): Is this the solution? if self.Definiti..

How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?

I have imported maven project in STS, when I run update update project I receive: "Updating Maven Project". Unsupported IClasspathEntry kind=4 Is there a workaround for this?..

MySQL wait_timeout Variable - GLOBAL vs SESSION

SHOW VARIABLES LIKE "%wait%" Result: 28800 SET @@GLOBAL.wait_timeout=300 SHOW GLOBAL VARIABLES LIKE "%wait%" Result: 300 SHOW SESSION VARIABLES LIKE "%wait%" Result:28800 I am confused by the ..

Java Date cut off time information

I have a Java Date object containing date and time information. I want to write a method that cuts off the time information, truncates the hours-minutes-seconds, so I only have the date left. Example..

python: how to identify if a variable is an array or a scalar

I have a function that takes the argument NBins. I want to make a call to this function with a scalar 50 or an array [0, 10, 20, 30]. How can I identify within the function, what the length of NBins i..

How do I make flex box work in safari?

How do I make flex boxes work in Safari? I have a responsive nav that uses a CSS flex box to be responsive and for some reason it won't work in Safari. Here is my code: _x000D_ _x000D_ #menu {_x000D..

Generate fixed length Strings filled with whitespaces

I need to produce fixed length string to generate a character position based file. The missing characters must be filled with space character. As an example, the field CITY has a fixed length of 15 ..

Using a list as a data source for DataGridView

I've extracted the setting names and their respective values out of a configuration file into an ordered dictionary. The dictionary contains keys and values which are of the ICollection class. I want ..

Http 415 Unsupported Media type error with JSON

I am calling a REST service with a JSON request and it responds with a HTTP 415 "Unsupported Media Type" error. The request content type is set to ("Content-Type", "application/json; charset=utf8")...

How to clear react-native cache?

In react-native development, there are multiple caches used when the app is built: React-native packager cache Emulator cache Java side cache (.gradle) folder (only in android) npm cache (if relevant..

MAX() and MAX() OVER PARTITION BY produces error 3504 in Teradata Query

I am trying to produce a results table with the last completed course date for each course code, as well as the last completed course code overall for each employee. Below is my query: SELECT employe..

Sound effects in JavaScript / HTML5

I'm using HTML5 to program games; the obstacle I've run into now is how to play sound effects. The specific requirements are few in number: Play and mix multiple sounds, Play the same sample multip..

Location of the android sdk has not been setup in the preferences in mac os?

I am installing the Android SDK along with Eclipse in mac os. Whenever I try to start a new project development I get an error location of the android sdk has not been setup in the preferences How d..

How do I get the find command to print out the file size with the file name?

If I issue the find command as follows: $ find . -name *.ear It prints out: ./dir1/dir2/earFile1.ear ./dir1/dir2/earFile2.ear ./dir1/dir3/earFile1.ear What I want to 'print' to the command line..

How do I auto size columns through the Excel interop objects?

Below is the code I'm using to load the data into an Excel worksheet, but I'm look to auto size the column after the data is loaded. Does anyone know the best way to auto size the columns? using Mic..

PHP Session Destroy on Log Out Button

I'm currently working on a site that has a log-in (username and password) - The password protection is done by the operating system within the web server at folder level called a Realm within the OS. ..

Is there any JSON Web Token (JWT) example in C#?

I feel like I'm taking crazy pills here. Usually there's always a million library and samples floating around the web for any given task. I'm trying to implement authentication with a Google "Service ..

Streaming Audio from A URL in Android using MediaPlayer?

I've been trying to stream mp3's over http using Android's built in MediaPlayer class. The documentation would suggest to me that this should be as easy as : MediaPlayer mp = new MediaPlayer();

Center HTML Input Text Field Placeholder

How can I centre the input field's placeholder's alignment in a html form? I am using the following code, but it doesn't work: CSS -> input.placeholder { text-align: center; } .emailField { ..

Java get String CompareTo as a comparator object

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

How to run python script with elevated privilege on windows

I am writing a pyqt application which require to execute admin task. I would prefer to start my script with elevate privilege. I am aware that this question is asked many times in SO or in other forum..

"java.lang.OutOfMemoryError: PermGen space" in Maven build

I'm getting this error while building Maven project, I increased MAVEN_OPTS but all the same, I found some similar posts but they are refering to something else. How do I fix this? The system is out..

Timeout a command in bash without unnecessary delay

This answer to Command line command to auto-kill a command after a certain amount of time proposes a 1-line method to timeout a long-running command from the bash command line: ( /path/to/slow command..

Adding timestamp to a filename with mv in BASH

Well, I'm a linux newbie, and I'm having an issue with a simple bash script. I've got a program that adds to a log file while it's running. Over time that log file gets huge. I'd like to create a sta..

Git: can't undo local changes (error: path ... is unmerged)

I have following working tree state $ git status foo/bar.txt # On branch master # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as approp..

Java: int[] array vs int array[]

Is there a difference between int[] array = new int[10]; and int array[] = new int[10]; ? Both do work, and the result is exactly the same. Which one is quicker or better? Is there a style guid..

Postgres password authentication fails

I tried to login with the postgres user from my windows machine to my server with Pgadmin. But it keeps giving me this error: psql: FATAL: password authentication failed for user "postgres" So th..

How to change the href for a hyperlink using jQuery

How can you change the href for a hyperlink using jQuery?..

Convert string to float?

Just as title says. I don't believe it is possible to do this but if it is let me know. This is needed for a bukkit (minecraft server) plugin I'm writing. I want to take a command: tnt [power]. Wher..

standard size for html newsletter template

i'm wanting to create an html newsletter template to be emailed out, however, i'm unsure of standard dimensions for it. would a 800w be good? or should i go w/ something smaller? for webpages my stan..

How do I encode/decode HTML entities in Ruby?

I am trying to decode some HTML entities, such as '&amp;lt;' becoming '<'. I have an old gem (html_helpers) but it seems to have been abandoned twice. Any recommendations? I will need to use ..

Can't draw Histogram, 'x' must be numeric

I have a data file with this format: Weight Industry Type 251,787 Kellogg h 253,9601 Kellogg a 256,0758 Kellogg h .... I read the data and try to draw an histogram with this comma..

Why are static variables considered evil?

I am a Java programmer who is new to the corporate world. Recently I've developed an application using Groovy and Java. All through the code I wrote used quite a good number of statics. I was asked by..

How can I generate an MD5 hash?

Is there any method to generate MD5 hash of a string in Java?..

Swift add icon/image in UITextField

I would like to add icon/image in UITextField. The icon/image should be left to placeholder. I tried this: var imageView = UIImageView(); var image = UIImage(named: "email.png"); imageView.image =..

difference between throw and throw new Exception()

what is the difference between try { ... } catch{ throw } and try{ ... } catch(Exception e) {throw new Exception(e.message) } Regardless that the second shows a message ?..

Getting the object's property name

I was wondering if there was any way in JavaScript to loop through an object like so. for(var i in myObject) { // ... } But get the name of each property like this. for(var i in myObject) { ..

How to convert string to string[]?

How to convert string type to string[] type in C#?..

Check if a user has scrolled to the bottom

I'm making a pagination system (sort of like Facebook) where the content loads when the user scrolls to the bottom. I imagine the best way to do that is to find when the user is at the bottom of the p..

The character encoding of the plain text document was not declared - mootool script

I just noticed that there is a warning message pops up when I view my mootool.js script on FireFox browser. The warning message is "The character encoding of the plain text document was not declared..

mailto link multiple body lines

having trouble getting multiple lines to work correctly in a mailto link In my case I'm testing it with an Outlook default mail reader. The following is put in an anchor href: mailto:email@address..

How to add 10 minutes to my (String) time?

I have this time: String myTime = "14:10"; Now I want to add 10 minutes to this time, so that it would be 14:20 How can I achieve this?..

Find the line number where a specific word appears with "grep"

Is grep capable of providing the line number on which the specified word appears? Also, is possible to use grep to search for a word starting from some certain line downward?..

Refused to execute script, strict MIME type checking is enabled?

Why am I getting this error in console? Refused to execute script from '

Execute ssh with password authentication via windows command prompt

I need to execute ssh from windows command line by providing password in a non interactive manner. I could implement the key based authentication and able to execute the ssh commands just like ssh &..

How to get host name with port from a http or https request

I have two applications deployed in jboss container(same unix box). If i get a request from app1, i need to frame a corresponding request for app2. eg: if app1 request is:

Div height 100% and expands to fit content

I have a div element on my page with its height set to 100%. The height of the body is also set to 100%. The inner div has a background and all that and is different from the body background. This wo..

JavaScript checking for null vs. undefined and difference between == and ===

How do I check a variable if it's null or undefined and what is the difference between the null and undefined? What is the difference between == and === (it's hard to search Google for "===" )? ..

Python: Open file in zip without temporarily extracting it

How can I open files in a zip archive without extracting them first? I'm using pygame. To save disk space, I have all the images zipped up. Is it possible to load a given image directly from the zip ..

UnicodeDecodeError when reading CSV file in Pandas with Python

I'm running a program which is processing 30,000 similar files. A random number of them are stopping and producing this error... File "C:\Importer\src\dfman\", line 26, in import_..

Binary Search Tree - Java Implementation

I'm writing a program that utilizes a binary search tree to store data. In a previous program (unrelated), I was able to implement a linked list using an implementation provided with Java SE6. Is ther..

java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing

While running junit test in eclipse I am getting this Exception: java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing I've added junit.jar library file. I've tried different versions of jun..

Is there an easy way to strike through text in an app widget?

I was wondering if there is an easy way to strike text within an app widget in Android. In a normal activity, it is pretty easy, using textview flags: textView.setPaintFlags(textView.getPaintFlags() ..

how to modify an existing check constraint?

Is there any way to modify an existing check constraint on a table other than dropping and re-creating it? create table t ( n number); ora10g> Tabelle wurde erstellt. ora10g> alter table t ad..

How to see full absolute path of a symlink

When I'm using ls -la symlinkName or stat symlinkName not all the path is displayed (e.g ../../../one/two/file.txt) What is the linux command that reveals the full path?..

conflicting types for 'outchar'

I am a newbie to C programming. I'm learning by reading the chapters and doing the examples from the book "Teach Yourself C" by Herbert Schildt. I'm trying to run this program in Dev C: #include <..

Error while trying to retrieve text for error ORA-01019

I have a question related to oracle. I have a machine which earlier had Oracle client installed on it. I was able to connect to my oracle server using the client. Now I recently installed oracle 11g ..

Does an HTTP Status code of 0 have any meaning?

It appears that when you make an XMLHttpRequest from a script in a browser, if the browser is set to work offline or if the network cable is pulled out, the request completes with an error and with st..

How to check if a "lateinit" variable has been initialized?

I wonder if there is a way to check if a lateinit variable has been initialized. For example: class Foo() { private lateinit var myFile: File fun bar(path: String?) { path?.let { my..

Creating folders inside a GitHub repository without using Git

I want to add a new folder to my newly created GitHub repository without installing the Git setup for (Mac, Linux, and Windows). Is it possible to do so? I can't have Git all the time with me when I ..

builtins.TypeError: must be str, not bytes

I've converted my scripts from Python 2.7 to 3.2, and I have a bug. # -*- coding: utf-8 -*- import time from datetime import date from lxml import etree from collections import OrderedDict # Create..

How to generate Javadoc HTML files in Eclipse?

I have written Javadoc style comments like this in my project's code: /** * Description... * * @param ... * @return ..... */ How can I generate Javadoc HTML files using the Eclipse IDE?..

Controlling a USB power supply (on/off) with Linux

Is it possible to turn on/off power supplies from USB manually with Linux? There's this external USB cooling fan (the kind you use to cool yourself off, not the PC), and it would be nice to be able t..

Node.js Best Practice Exception Handling

I just started trying out node.js a few days ago. I've realized that the Node is terminated whenever I have an unhandled exception in my program. This is different than the normal server container tha..

How to create a DateTime equal to 15 minutes ago?

I need to create a DateTime object that represents the current time minus 15 minutes...

What does 'URI has an authority component' mean?

I am attempting to build a Java web project on NetBeans 6.8, but I get get the following error: The module has not been deployed. It points to my build-impl.xml file, line 577: <nbdeploy cli..

How to perform a LEFT JOIN in SQL Server between two SELECT statements?

I have two SELECT statements in SQL Server like these: (SELECT [UserID] FROM [User]) (SELECT [TailUser], [Weight] FROM [Edge] WHERE [HeadUser] = 5043) I want to perform a LEFT JOIN between these tw..

How to view hierarchical package structure in Eclipse package explorer

OK here's what I would like: in the Eclipse package explorer, I see the following: (dot represents a clickable arrow that I can use to expand the folder) PROJECT Source Folder Package Cl..

Bootstrap 3 Collapse show state with Chevron icon

Using the core example taken from the Bootstrap 3 Javascript examples page for Collapse, I have been able to show the state of collapse using chevron icons. I have this working using: $('#accordion..

How to trim a string after a specific character in java

I have a string variable in java having value: String result="34.1 -118.33\n<!--ABCDEFG-->"; I want my final string to contain the value: String result="34.1 -118.33"; How can I do this? I..

VBA error 1004 - select method of range class failed

First time poster, so if there is any formatting, or guidelines I failed to adhere to, please let me know so that I can fix it. So I am basically asking the user for the file directory of the excel ..

shell script. how to extract string using regular expressions

I am new to shell scripts. I want to send a http request using curl and then extract some string using regular expressions. For example, how can I extract a domain name from a http response? (The exam..

Gaussian fit for Python

I'm trying to fit a Gaussian for my data (which is already a rough gaussian). I've already taken the advice of those here and tried curve_fit and leastsq but I think that I'm missing something more fu..

How to add include path in Qt Creator?

I have a project I'm working on in Qt creator that requires a third-party library. I want to add the headers to the include path for the project. How do I do this?..

MySQL select rows where left join is null

I have these MySQL tables: table1: id | writer 1 | Bob 2 | Marley 3 | Michael table2: user_one | user_two 1 | 2 And this query: SELECT FROM table1 LEFT JOIN table2 ON ta..

Convert array of strings to List<string>

I've seen examples of this done using .ToList() on array types, this seems to be available only in .Net 3.5+. I'm working with .NET Framework 2.0 on an ASP.NET project that can't be upgraded at this t..

JQuery window scrolling event?

I have an ad in my header and a fixed ad at the bottom of my page that is always there. I want the fixed ad to appear only if the user has scrolled under the header ad. I looked into the JQuery docume..

Dynamically adding elements to ArrayList in Groovy

I am new to Groovy and, despite reading many articles and questions about this, I am still not clear of what is going on. From what I understood so far, when you create a new array in Groovy, the unde..

Max retries exceeded with URL in requests

I'm trying to get the content of App Store > Business: import requests from lxml import html page = requests.get("") tree = html.fromstring(..

Create an ISO date object in javascript

I have a mongo database set up. creating a new date object in mongoDb create a date object in ISO format eg: ISODate("2012-07-14T00:00:00Z") I am using node.js to connect to mongo database and query..

Errors: Data path ".builders['app-shell']" should have required property 'class'

I am getting this error while running my application. Here are the details of my application. Angular CLI: 7.3.3 Node: 10.15.1 Angular: 7.2.7 @angular-devkit/architect -0.13.3 @angular-devkit/bu..

Mod of negative number is melting my brain

I'm trying to mod an integer to get an array position so that it will loop round. Doing i % arrayLength works fine for positive numbers but for negative numbers it all goes wrong. 4 % 3 == 1 3 % 3..

What's the difference between console.dir and console.log?

In Chrome the console object defines two methods that seem to do the same thing: console.log(...) console.dir(...) I read somewhere online that dir takes a copy of the object before logging it, whe..

How to bind a List to a ComboBox?

I want to connect a BindingSource to a list of class objects and then objects value to a ComboBox. Can anyone suggest how to do it? public class Country { public string Name { get; set; } pub..

Python 3: UnboundLocalError: local variable referenced before assignment

The following code gives the error UnboundLocalError: local variable 'Var1' referenced before assignment: Var1 = 1 Var2 = 0 def function(): if Var2 == 0 and Var1 > 0: print("Result On..

Conflict with dependency '' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ.

I am new to Android App Development. When I tried to create a new project,Android Project...the following message popped up.. Error:Execution failed for task ':app:preDebugAndroidTestBuild'. Conf..

Does Django scale?

I'm building a web application with Django. The reasons I chose Django were: I wanted to work with free/open-source tools. I like Python and feel it's a long-term language, whereas regarding Ruby I ..

Good examples using java.util.logging

I want to use logs in my program. I heard about java.util.logging, but I don't know how to begin. Are there any examples of what can I do with logging? How would I use logging in my own program?..

Why does this code using random strings print "hello world"?

The following print statement would print "hello world". Could anyone explain this? System.out.println(randomString(-229985452) + " " + randomString(-147909649)); And randomString() looks like this..

Javascript array declaration: new Array(), new Array(3), ['a', 'b', 'c'] create arrays that behave differently

Consider this example Javascript code: a = new Array(); a['a1']='foo'; a['a2']='bar'; b = new Array(2); b['b1']='foo'; b['b2']='bar'; c=['c1','c2','c3']; console.log(a); console.log(b); console.lo..

Uri content://media/external/file doesn't exist for some devices

I have an issue with some devices. I cannot replicate it on any device but I have quite a lot of crash reports reported by some users. It is this exception: java.lang.IllegalArgumentException: Unkno..

How to read a single character from the user?

Is there a way of reading one single character from the user input? For instance, they press one key at the terminal and it is returned (sort of like getch()). I know there's a function in Windows for..

No route matches "/users/sign_out" devise rails 3

I've installed devise on my app and applied the following in my application.html.erb file: <div id="user_nav"> <% if user_signed_in? %> Signed in as <%= ..

Can a table have two foreign keys?

I have the following tables (Primary key in bold. Foreign key in Italic) Customer table ID---Name---Balance---Account_Name---Account_Type Account Category table Account_Type----Balance Custom..

java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

The following code: Class.forName("com.mysql.jdbc.Driver"); Connection m_connection = DriverManager.getConnection("jdbc:mysql://localhost","root","root"); Throws this exception on getConnection(): ..

how to remove the dotted line around the clicked a element in html

I found that if there is a a link in the page which does not link to a new page,then when user click it,there will be a dotted line around the element,it will only disappear when user click anything e..

How to send a simple string between two programs using pipes?

I tried searching on the net, but there are hardly any resources. A small example would suffice. EDIT I mean, two different C programs communicating with each other. One program should send "Hi" and ..

Java: unable to find valid certification path to requested target

I have a class that will download a file from a https server. When I run it, it returns a lot of errors. It seems that I have a problem with my certificate. Is it possible to ignore the client-server..

How to use BOOLEAN type in SELECT statement

I have a PL/SQL function with BOOLEAN in parameter: function get_something(name in varchar2, ignore_notfound in boolean); This function is a part of 3rd party tool, I cannot change this. I would l..

How to print binary number via printf

Possible Duplicate: Is there a printf converter to print in binary format? Here is my program #include<stdio.h> int main () { int i,a=2; i=~a; printf("a=%d\ni=%d\n",a,i); ..

C++ static virtual members?

Is it possible in C++ to have a member function that is both static and virtual? Apparently, there isn't a straightforward way to do it (static virtual member(); is a compile error), but is there at l..

Efficiently finding the last line in a text file

I need to extract the last line from a number of very large (several hundred megabyte) text files to get certain data. Currently, I am using python to cycle through all the lines until the file is em..

Catching "Maximum request length exceeded"

I'm writing an upload function, and have problems catching "System.Web.HttpException: Maximum request length exceeded" with files larger than the specified max size in httpRuntimein web.config (max si..

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

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

How to have comments in IntelliSense for function in Visual Studio?

In Visual Studio and C#, when using a built in function such as ToString(), IntelliSense shows a yellow box explaining what it does. How can I have that for functions and properties I write?..

How to reset Android Studio

I want to reset Android Studio 0.2.13 to the default state. That means reset all settings, remove all projects, all gradle files so that it would act like a fresh installation. What steps do I have to..

PHP: How to generate a random, unique, alphanumeric string for use in a secret link?

How would it be possible to generate a random, unique string using numbers and letters for use in a verify link? Like when you create an account on a website, and it sends you an email with a link, an..

How to remove all click event handlers using jQuery?

I'm having a problem. Basically, when a user clicks an 'Edit' link on a page, the following Jquery code runs: $("#saveBtn").click(function () { saveQuestion(id); }); By doing this, the onClick ..

ALTER TABLE on dependent column

I am trying to alter column datatype of a primary key to tinyint from int.This column is a foreign key in other tables.So,I get the following error: Msg 5074, Level 16, State 1, Line 1 The objec..

Django request get parameters

In a Django request I have the following: POST:<QueryDict: {u'section': [u'39'], u'MAINS': [u'137']}> How do I get the values of section and MAINS? if request.method == 'GET': qd = reque..

ssh-copy-id no identities found error

I have few client systems where I need to push the ssh key and login from my server without authentication prompts. First, on the server, I created ssh key as below which was successful ]# ssh-keyg..

how to set radio button checked in edit mode in MVC razor view

I am new in MVC razor. I am trying to edit the web page. In which I have two radio buttons. I am successful in save data for radio button values. But when I trying to edit that value I am not able to ..

mssql '5 (Access is denied.)' error during restoring database

I want to restore a database from a file (Tasks ? Restore ? Database; after I select from device and select file) via SQL Server Management Studio. After that, I get this error: The operating sy..

How to force Chrome's script debugger to reload javascript?

I really like the ability to edit javascript in the chrome debugger however, I find that it can be really problematic getting the debugger to re-fetch the JavaScript from the server. Sometimes I have..

How to add plus one (+1) to a SQL Server column in a SQL Query

The simple question is, how do you increment a field value in a MS Query by 1 ? I am trying to add 1 (+1) to an int column in my SQL Server database using a parametrized method. Similar to an i++ oper..

What is the backslash character (\\)?

What is the string literal \\ backslash? What does it do? I have thought about it but I do not understand it. I also read it on wikipedia. When I try to print the following: System.out.println("Mango..

How to import a class from default package

Possible Duplicate: How to access java-classes in the default-package? I am using Eclipse 3.5 and I have created a project with some package structure along with the default package. I have one..

What are the Android SDK build-tools, platform-tools and tools? And which version should be used?

I know this is a very rudimentary question, but to my surprise, I could not find any document about Android SDK Build-tools. Besides Android SDK Tools and Android SDK Platform-tools, there are a bunch..

Link to the issue number on GitHub within a commit message

Is it somehow possible to automatically have a link to GitHub issue number in the git commit message?..

How to define custom sort function in javascript?

I use atocomplete.jquery plugin to suggest input text, as the result I get this array: ['White 023','White','White flower', 'Teatr'] When I start to search something thats begin from te substring i..

New line in JavaScript alert box

How do you put in a new line into a JavaScript alert box? ..

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

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

What is the difference between "Form Controls" and "ActiveX Control" in Excel 2010?

Using Microsoft Excel 2010, I noticed two kind of controls that can be inserted into a document: Form Controls and ActiveX Controls. What is the difference between them?..

Write to text file without overwriting in Java

I am trying to write a method that makes a "log.txt file" if one does not already exist and then writes to the file. The problem that I am encountering is every time I call the method, it overwrites t..

Oracle ORA-12154: TNS: Could not resolve service name Error?

I am a SQL Server user . I am on a project that is using oracle (which I rarely use) I need to create an ODBC connection so I can access the some data via MS Access I have a application on my machin..

How do I return JSON without using a template in Django?

This is related to this question: Django return json and html depending on client python I have a command line Python API for a Django app. When I access the app through the API it should return JS..

Difference between StringBuilder and StringBuffer

What is the main difference between StringBuffer and StringBuilder? Is there any performance issues when deciding on any one of these?..

textarea character limit

I would like to be able to limit the number of characters in a textarea. The method I am using works great in Google Chrome, but is slow in Firefox, and doesn't work in IE. Javascript: function len(..

How do I implement charts in Bootstrap?

I'm referring to the bar charts in the background (they are actually really subtle) of the repositories here: Example:

iPhone Safari Web App opens links in new window

I have problem with web after adding icon to Home Screen. If the web is launched from Home Screen, all links will open in new window in Safari (and lose full screen functionality). How can I prevent i..

Python Git Module experiences?

What are people's experiences with any of the Git modules for Python? (I know of GitPython, PyGit, and Dulwich - feel free to mention others if you know of them.) I am writing a program which will h..

MySQL error - #1062 - Duplicate entry ' ' for key 2

I'm trying to insert a huge list of users to a MySQL database but everytime I try I get the error: #1062 - Duplicate entry '' for key 2 It gives me this because the 2nd column is blank on quite a ..

Angular JS Uncaught Error: [$injector:modulerr]

I am having a problem with Angular JS receiving an error : Uncaught Error: [$injector:modulerr]. My JS-file looks angular.module('MyApp', ['ngRoute']); angular.module('MyApp',['ngResource']); function..

How do I properly escape quotes inside HTML attributes?

I have a drop down on a web page which is breaking when the value string contains a quote. The value is "asd, but in the DOM it always appears as an empty string. I have tried every way I know to es..

When use ResponseEntity<T> and @RestController for Spring RESTful applications

I am working with Spring Framework 4.0.7, together with MVC and Rest I can work in peace with: @Controller ResponseEntity<T> For example: @Controller @RequestMapping("/person") @Profile("..

How to show Snackbar when Activity starts?

I want to show android Snackbar ( when the activity starts just like we show a Toast. But the problem is we have to specify the parent layout when creating Sna..

How to use MD5 in javascript to transmit a password

I have a jquery dialog modal box pop up for logging into my website. When a user clicks login it does a post request to a login.php file as follows: $.post( 'includes/login.php', { user..

jQuery events .load(), .ready(), .unload()

Just a simple question, for the jQuery event. Are the .load(), .ready() and .unload() run in order when the DOM is loaded? The answer seems yes when I see the jQuery Documentation. <script type="t..

What are the rules for casting pointers in C?

K&R doesn't go over it, but they use it. I tried seeing how it'd work by writing an example program, but it didn't go so well: #include <stdio.h> int bleh (int *); int main(){ char ..

Using iText to convert HTML to PDF

Does anyone know if it is possible to convert a HTML page (url) to a PDF using iText? If the answer is 'no' than that is OK as well since I will stop wasting my time trying to work it out and just sp..

redirect COPY of stdout to log file from within bash script itself

I know how to redirect stdout to a file: exec > foo.log echo test this will put the 'test' into the foo.log file. Now I want to redirect the output into the log file AND keep it on stdout i.e...

How do you run CMD.exe under the Local System Account?

I'm currently running Vista and I would like to manually complete the same operations as my Windows Service. Since the Windows Service is running under the Local System Account, I would like to emulat..

Testing web application on Mac/Safari when I don't own a Mac

Having been caught out recently when a web site I launched displayed perfectly on IE, Firefox, Chrome and Safari on Windows but was corrupted when viewed using Safari on the Mac (by a potential custom..

PHP memcached Fatal error: Class 'Memcache' not found

I've pasted the example from for using memcached in php and I'm getting: Fatal error: Class 'Memcache' not found I have this in my php.ini: [memcache] memcache.hash_strategy = "consiste..

How to check if a line is blank using regex

I am trying to make simple regex that will check if a line is blank or not. Case; " some" // not blank " " //blank "" // blank ..

How to make a text box have rounded corners?

I have this wireframe and you see on the top-right there is a text box that has rounded corners. Is that done with css only or image and css? I have an image..

How do I get the last character of a string?

How do I get the last character of a string? public class Main { public static void main(String[] args) { String s = "test string"; //char lastChar = ??? } } ..

How to process SIGTERM signal gracefully?

Let's assume we have such a trivial daemon written in python: def mainloop(): while True: # 1. do # 2. some # 3. important # 4. job # 5. sleep mainloop() ..

How to generate range of numbers from 0 to n in ES2015 only?

I have always found the range function missing from JavaScript as it is available in python and others? Is there any concise way to generate range of numbers in ES2015 ? EDIT: MY question is differen..

What is the difference between an int and a long in C++?

Correct me if I am wrong, int is 4 bytes, with a range of values from -2,147,483,648 to 2,147,483,647 (2^31) long is 4 bytes, with a range of values from -2,147,483,648 to 2,147,483,647 (2^31) What ..

DropDownList's SelectedIndexChanged event not firing

I have a DropDownList object in my web page. When I click on it and select a different value, nothing happens, even though I have a function wired up to the SelectedIndexChanged event. First, the act..

How to query a CLOB column in Oracle

I'm trying to run a query that has a few columns that are a CLOB datatype. If i run the query like normal, all of those fields just have (CLOB) as the value. I tried using DBMS_LOB.substr(column) and..

Adding backslashes without escaping [Python]

I need to escape a & (ampersand) character in a string. The problem is whenever I string = string.replace ('&', '\&') the result is '\\&'. An extra backslash is added to escape the ori..

Laravel Pagination links not including other GET parameters

I am using Eloquent together with Laravel 4's Pagination class. Problem: When there are some GET parameters in the URL, eg:, the pagination links prod..

Using tr to replace newline with space

Have output from sed: 72-profile Those two strings should be merged into one and separated with space like: 72-profile Two..

Find an object in array?

Does Swift have something like _.findWhere in Underscore.js? I have an array of structs of type T and would like to check if array contains a struct object whose name property is equal to Foo. Tried..

how to get the one entry from hashmap without iterating

Is there a elegant way of obtaining only one Entry<K,V> from HashMap, without iterating, if key is not known. As order of entry of entry is not important, can we say something like hashMapObje..

Virtualbox shared folder permissions

I'm using Windows and Virtualbox with RedHat, putting it simple: I've created a shared folder so I can use Eclipse on my Windows OS and do some testing in Linux. However, I can't access the shared fo..

Open PDF in new browser full window

How do I open PDF document in new browser window? The window should be full and withouth menu. Just a PDF document in a clean full window with native Javascript or jQuery...

Multi-line string with extra space (preserved indentation)

I want to write some pre-defined texts to a file with the following: text="this is line one\n this is line two\n this is line three" echo -e $text > filename I'm expecting something like this: ..