Questions Tagged with #Getdistance

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

Android-java- How to sort a list of objects by a certain value within the object

Im trying to sort through an arraylist of objects by a particular value within the object. What would be the best approach to do such a thing. Should I use Collections.sort() with some kind of compara..

What is the difference between YAML and JSON?

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

Can't find bundle for base name /Bundle, locale en_US

I'm using a library that has a dependency on JSF. When I try to run my project, it show following exception massage.. java.util.MissingResourceException: Can't find bundle for base name /Bundle, lo..

What is a Windows Handle?

What is a "Handle" when discussing resources in Windows? How do they work?..

Printing an array in C++?

Is there a way of printing arrays in C++? I'm trying to make a function that reverses a user-input array and then prints it out. I tried Googling this problem and it seemed like C++ can't print array..

How to get the background color code of an element in hex?

How do I get the background color code of an element? _x000D_ _x000D_ console.log($(".div").css("background-color"));_x000D_ <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery..

javascript variable reference/alias

Is it possible in javascript to assign an alias/reference to a local var someway? I mean something C-like: function foo() { var x = 1; var y = &x; y++; alert(x); // prints 2 } = EDIT ..

ReactJS - Does render get called any time "setState" is called?

Does React re-render all components and sub components every time setState() is called? If so, why? I thought the idea was that React only rendered as little as needed - when state changed. In the fol..

C# HttpWebRequest The underlying connection was closed: An unexpected error occurred on a send

I've been Googling and trying all the solutions I could find or think of myself. The site I'm trying to load is running TLS1.2 as is a few other sites I tried to test with to make sure it wasn't a TLS..

Service located in another namespace

I have been trying to find a way to define a service in one namespace that links to a Pod running in another namespace. I know that containers in a Pod running in namespaceA can access serviceX defin..

What exactly does the .join() method do?

I'm pretty new to Python and am completely confused by .join() which I have read is the preferred method for concatenating strings. I tried: strid = repr(595) print array.array('c', random.sample(st..

R - test if first occurrence of string1 is followed by string2

I have an R string, with the format s = `"[some letters and numbers]_[a number]_[more numbers, letters, punctuation, etc, anything]"` I simply want a way of checking if s contains "_2" in the first..

Compare two objects in Java with possible null values

I want to compare two strings for equality when either or both can be null. So, I can't simply call .equals() as it can contain null values. The code I have tried so far : boolean compare(String str1,..

Catch checked change event of a checkbox

How do I to catch check/uncheck event of <input type="checkbox" /> with jQuery?..

How to select the first, second, or third element with a given class name?

How can I select a certain element in a list of elements? I have the following: <div class="myclass">my text1</div> <!-- some other code follows --> <div> <p>stuff&l..

How do I check if a string contains another string in Swift?

In Objective-C the code to check for a substring in an NSString is: NSString *string = @"hello Swift"; NSRange textRange =[string rangeOfString:@"Swift"]; if(textRange.location != NSNotFound) { ..

In UML class diagrams, what are Boundary Classes, Control Classes, and Entity Classes?

I'm now using NetBeans as my IDE-of-choice, and it has a plugin for UML modeling. In the class diagram, there are model elements known as Boundary Class, Control Class, and Entity Class. However, I ca..

How to call function of one php file from another php file and pass parameters to it?

I want to call a function in one PHP file from a second PHP file and also pass two parameters to that function. How can I do this? I am very new to PHP. So please tell me, should I include the first ..

foreach vs someList.ForEach(){}

There are apparently many ways to iterate over a collection. Curious if there are any differences, or why you'd use one way over the other. First type: List<string> someList = <some way to ..

Is there a way to detect if an image is blurry?

I was wondering if there is a way to determine if an image is blurry or not by analyzing the image data...

Peak memory usage of a linux/unix process

Is there a tool that will run a command-line and report the peak RAM usage total? I'm imagining something analogous to /usr/bin/time..

Undefined reference to pthread_create in Linux

I picked up the following demo off the web from https://computing.llnl.gov/tutorials/pthreads/ #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 void *PrintHello(void *th..

Printing the correct number of decimal points with cout

I have a list of float values and I want to print them with cout with 2 decimal places. For example: 10.900 should be printed as 10.90 1.000 should be printed as 1.00 122.345 should be printed as 1..

Count(*) vs Count(1) - SQL Server

Just wondering if any of you people use Count(1) over Count(*) and if there is a noticeable difference in performance or if this is just a legacy habit that has been brought forward from days gone pas..

What is the maximum possible length of a .NET string?

What is the longest string that can be created in .NET? The docs for the String class are silent on this question as far as I can see, so an authoritative answer might require some knowledge of intern..

Shortcut to Apply a Formula to an Entire Column in Excel

If I select a cell containing a formula, I know I can drag the little box in the right-hand corner downwards to apply the formula to more cells of the column. Unfortunately, I need to do this for 300,..

Shuffle DataFrame rows

I have the following DataFrame: Col1 Col2 Col3 Type 0 1 2 3 1 1 4 5 6 1 ... 20 7 8 9 2 21 10 11 12 2 ... 45 13 14 15 ..

ASP.NET MVC - passing parameters to the controller

I have a controller with an action method as follows: public class InventoryController : Controller { public ActionResult ViewStockNext(int firstItem) { // Do some stuff } } And..

MySQL case sensitive query

This has been asked on this site before but I couldn't find a sufficient answer. If I'm doing a query like: Select Seller from Table where Location = 'San Jose' How can I make it return only Seller..

Substring with reverse index

How can I extract "456" from "xxx_456" where xxx is of indefinite length?..

Using StringWriter for XML Serialization

I'm currently searching for an easy way to serialize objects (in C# 3). I googled some examples and came up with something like: MemoryStream memoryStream = new MemoryStream ( ); XmlSerializer xs = ..

Returning a pointer to a vector element in c++

I have a vector of myObjects in global scope. I have a method which uses a std::vector<myObject>::const_iterator to traverse the vector, and doing some comparisons to find a specific element. On..

How to make rectangular image appear circular with CSS

I've used border-radius: 50% or border-radius: 999em, but the problem is the same: with squared images there's no problem, but with rectangular images I obtain an oval circle. I'm also disposed to cro..

Giving my function access to outside variable

I have an array outside: $myArr = array(); I would like to give my function access to the array outside it so it can add values to it function someFuntion(){ $myVal = //some processing here t..

AngularJS - Multiple ng-view in single template

I am building a dynamic web app by using AngularJS. Is it possible to have multiple ng-view on a single template?..

PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT (in windows 10)

While running an app on the virtual device (AVD) created on Android studio (in Windows 10), I am getting an error and panic. Emulator: PANIC: Cannot find AVD system path. Please define ANDROID_SDK_RO..

Best practice to return errors in ASP.NET Web API

I have concerns on the way that we returns errors to client. Do we return error immediately by throwing HttpResponseException when we get an error: public void Post(Customer customer) { if (stri..

jQuery get html of container including the container itself

How do i get the html on '#container' including '#container' and not just what's inside it. <div id="container"> <div id="one">test 1 </div> <div id="two">test 2 </div&g..

CSS hover vs. JavaScript mouseover

There are times when I have a choice between using a CSS element:hover or JavaScript onmouseover to control the appearance of html elements on a page. Consider the following scenario where a div wrap..

Get just the filename from a path in a Bash script

How would I get just the filename without the extension and no path? The following gives me no extension, but I still have the path attached: source_file_filename_no_ext=${source_file%.*} ..

How to change the floating label color of TextInputLayout

With reference to the new TextInputLayout released by Google, how do I change the floating label text color? Setting colorControlNormal, colorControlActivated, colorControlHighLight in styles does no..

Windows could not start the SQL Server (MSSQLSERVER) on Local Computer... (error code 3417)

For some reasons I moved this folder : (Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL) to another drive, then returned it to the same location, but sql server has stopped working, showi..

Volatile vs. Interlocked vs. lock

Let's say that a class has a public int counter field that is accessed by multiple threads. This int is only incremented or decremented. To increment this field, which approach should be used, and wh..

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

OnClick in Excel VBA

Is there a way to catch a click on a cell in VBA with Excel? I am not referring to the Worksheet_SelectionChange event, as that will not trigger multiple times if the cell is clicked multiple times. B..

Converting serial port data to TCP/IP in a Linux environment

I need to get data from the serial port of a Linux system and convert it to TCP/IP to send to a server. Is this difficult to do? I have some basic programming experience, but not much experience with ..

How to stop execution after a certain time in Java?

In the code, the variable timer would specify the duration after which to end the while loop, 60 sec for example. while(timer) { //run //terminate after 60 sec } ..

Drawing an image from a data URL to a canvas

How can i open an image in a Canvas ? which is encoded I am using the var strDataURI = oCanvas.toDataURL(); The output is the encoded base 64 image. How can i draw this image on a canvas? I wa..

Find the number of employees in each department - SQL Oracle

I have two tables Emp and Dept and I am trying to display how many people work in each department along with their department name, but I can't get it to work. I have tried this select count(ename) as..

iPhone - Grand Central Dispatch main thread

I have been using with success, grand central dispatch in my apps, but I was wondering what is the real advantage of using something like this: dispatch_async(dispatch_get_main_queue(), ^{ ... do stu..

Transfer data between databases with PostgreSQL

I need to transfer some data from another database. The old database is called paw1.moviesDB and the new database is paw1. The schema of each table are the following. Awards (name of the table)(new D..

Fastest way to count exact number of rows in a very large table?

I have come across articles that state that SELECT COUNT(*) FROM TABLE_NAME will be slow when the table has lots of rows and lots of columns. I have a table that might contain even billions of rows [..

Write to CSV file and export it?

In C# ASP.net, could someone show me how I can write entries from an Array/List to a CSV file on the server and then open the file? I think the second part would be something like - Response.Redirect(..

Best implementation for hashCode method for a collection

How do we decide on the best implementation of hashCode() method for a collection (assuming that equals method has been overridden correctly) ?..

Convert double to string C++?

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

What are SP (stack) and LR in ARM?

I am reading definitions over and over again and I still not getting what are SP and LR in ARM? I understand PC (it shows next instruction's address), SP and LR probably are similar, but I just don't ..

What does "&" at the end of a linux command mean?

I am a system administrator and I have been asked to run a linux script to clean the system. The command is this: perl script.pl > output.log & so this command is ending with a & sign, ..

Convert XmlDocument to String

Here is how I'm currently converting XMLDocument to String StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); xmlDoc.WriteTo(xmlTextWriter..

Correct format specifier to print pointer or address?

Which format specifier should I be using to print the address of a variable? I am confused between the below lot. %u - unsigned integer %x - hexadecimal value %p - void pointer Which w..

Why does my Eclipse keep not responding?

I'm using Eclipse, and at random times, it will just freeze up and stop responding. Does this happen to anyone else? It usually happens when I click on a line of code, whether it be Java or XML. Any i..

Get safe area inset top and bottom heights

On the new iPhone X, what would be the most proper way to get both top and bottom height for the unsafe areas? ..

Logging levels - Logback - rule-of-thumb to assign log levels

I'm using logback in my current project. It offers six levels of logging: TRACE DEBUG INFO WARN ERROR OFF I'm looking for a rule of thumb to determine the log level for common activities...

Java properties UTF-8 encoding in Eclipse

I've recently had to switch encoding of webapp I'm working on from ISO-xx to utf8. Everything went smooth, except properties files. I added -Dfile.encoding=UTF-8 in eclipse.ini and normal files work f..

Excel Create Collapsible Indented Row Hierarchies

I would like to create indented collapsible row hierarchies in Excel for my spreadsheet. I have used group function but that becomes hard to manage for me. Here is an example of what I am trying to ..

Search for value in DataGridView in a column

I want the user to be able to search for a number in a column in the DataGridView (dgv). The dgv can hold many records. Each record has a Project Number. So I want the user to be able to search for a ..

How to check if a line has one of the strings in a list?

Possible Duplicate: Check if multiple strings exist in another string I am trying to find out if there is a nice and clean way to test for 3 different strings. Basically I am looping troug..

Button inside of anchor link works in Firefox but not in Internet Explorer?

Everything else in my site seems to be compatible with all browsers except for my links. They appear on the page, but they do not work. My code for the links are as follows- <td bgcolor="#ffff..

Best way to check if a Data Table has a null value in it

what is the best way to check if a Data Table has a null value in it ? Most of the time in our scenario, one column will have all null values. (This datatable is returned by a 3rd party application ..

How to get milliseconds from LocalDateTime in Java 8

I am wondering if there is a way to get current milliseconds since 1-1-1970 (epoch) using the new LocalDate, LocalTime or LocalDateTime classes of Java 8. The known way is below: long currentMilli..

C# get and set properties for a List Collection

How are properties for a Collection set? I've created a class with a Collection properties. I want to add to the List anytime I set a new value. Using _name.Add(value) within the set method doesn't w..

Is there any WinSCP equivalent for linux?

I love WinSCP for Windows. What are the best equivalent softwares for linux? I tried to use sshfs to mount the remote file system on my local machine, but it is not as user friendly as simply launch..

How to create a trie in Python

I'm interested in tries and DAWGs (direct acyclic word graph) and I've been reading a lot about them but I don't understand what should the output trie or DAWG file look like. Should a trie be an ob..

Why can a function modify some arguments as perceived by the caller, but not others?

I'm trying to understand Python's approach to variable scope. In this example, why is f() able to alter the value of x, as perceived within main(), but not the value of n? def f(n, x): n = 2 ..

Conversion of Char to Binary in C

I am trying to convert a character to its binary representation (so character --> ascii hex --> binary). I know to do that I need to shift and AND. However, my code is not working for some reason. H..

How can you make a custom keyboard in Android?

I want to make a custom keyboard. I don't know how to do it using XML and Java. The following picture is a model of the keyboard I want to make. It only needs numbers. ..

How to print the array?

int main() { int my array[3][3] = 10, 23, 42, 1, 654, 0, 40652, 22, 0 }; printf("%d\n", my_array[3][3]); return 0; } I am not able to get the array to print.. Any ..

eclipse stuck when building workspace

I am using eclipse 3.4.1 Java EE under Vista. It seems to like getting stuck when building my workspace. Canceling the build doesn't seem to do anything as well. Why is this happening and how do I fi..

Oracle SQL escape character (for a '&')

While attempting to execute SQL insert statements using Oracle SQL Developer I keep generating an "Enter substitution value" prompt: insert into agregadores_agregadores ( idagregador, nombre, url..

Leave only two decimal places after the dot

public void LoadAveragePingTime() { try { PingReply pingReply = pingClass.Send("logon.chronic-domination.com"); double AveragePing = (pingReply.RoundtripTime / 1.75); ..

How to concatenate columns in a Postgres SELECT?

I have two string columns a and b in a table foo. select a, b from foo returns values a and b. However, concatenation of a and b does not work. I tried : select a || b from foo and select a||',..

C# switch on type

Possible Duplicate: C# - Is there a better alternative than this to 'switch on type'? C# doesn't support switching on the type of an object. What is the best pattern of simulating t..

How to split csv whose columns may contain ,

Given 2,1016,7/31/2008 14:22,Geoff Dalgas,6/5/2011 22:21,http://stackoverflow.com,"Corvallis, OR",7679,351,81,b437f461b3fd27387c5d8ab47a293d35,34 How to use C# to split the above information..


Regex: matching up to the first occurrence of a character

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

Javascript: Unicode string to hex

I'm trying to convert a unicode string to a hexadecimal representation in javascript. This is what I have: function convertFromHex(hex) { var hex = hex.toString();//force conversion var str..

Group a list of objects by an attribute

I need to group a list of objects (Student) using an attribute (Location) of the particular object. The code is like below: public class Grouping { public static void main(String[] args) { ..

momentJS date string add 5 days

i have a start date string "20.03.2014" and i want to add 5 days to this with moment.js but i don't get the new date "25.03.2014" in the alert window. here my javascript Code: startdate = "20.03.201..

Get current date in Swift 3?

How can I set label.text current date in Swift 3? I want to print just today to the screen. I did not find how to do that. In c# is very simple: var date = DateTime.Now I need to write 15.09.201..

How to set a header for a HTTP GET request, and trigger file download?

Update 20140702: The solution Detailed answer as a blog post (but I'm marking one of the other answers as accepted instead of my own, as it got me halfway there, and to reward the effort) It ap..

Converting std::__cxx11::string to std::string

I use c++11, but also some libraries that are not configured for it, and need some type conversion. In particular I need a way to convert std::__cxx11::string to regular std::string, but googling I ca..

Return value from exec(@sql)

I want get the value from Exec(@sql) and assign to @Rowcount(int) Here is my query: 'SET @RowCount = (select count(*) FROM dbo.Comm_Services WHERE CompanyId ..

git replace local version with remote version

How can I tell git to ignore my local file and take the one from my remote branch without trying to merge and causing conflicts?..

C pass int array pointer as parameter into a function

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

How can I render HTML from another file in a React component?

Is it possible to render HTML from another file in a React component? I have tried the following, but it does not work: var React = require('react'); /* Template html */ var template = require('./t..

How to avoid Sql Query Timeout

I have RO access on a SQL View. This query below times out. How to avoid this? select count(distinct Status) from [MyTable] with (NOLOCK) where MemberType=6 The error message I get is: ..

m2eclipse not finding maven dependencies, artifacts not found

I'm using m2eclipse as my maven 2 plugin for eclipse. I'm brand new to maven, so my mistake might be simple, although searching has not yielded any solutions for me. I can run maven from the command..

How to prevent IFRAME from redirecting top-level window

Some websites have code to "break out" of IFRAME enclosures, meaning that if a page A is loaded as an IFRAME inside an parent page P some Javascript in A redirects the outer window to A. Typically th..

Why are elementwise additions much faster in separate loops than in a combined loop?

Suppose a1, b1, c1, and d1 point to heap memory, and my numerical code has the following core loop. const int n = 100000; for (int j = 0; j < n; j++) { a1[j] += b1[j]; c1[j] += d1[j]; } T..

How to read/write files in .Net Core?

What are the options to read/write files in .Net Core? I am working on my first .Net Core app and looking for File.Read*/File.Write* functions (System.IO from .Net) alternatives...

Python equivalent to 'hold on' in Matlab

Is there an explicit equivalent command in Python's matplotlib for Matlab's hold on? I'm trying to plot all my graphs on the same axes. Some graphs are generated inside a for loop, and these are plott..

What's the best practice for putting multiple projects in a git repository?

As some reason, I only have one repository to use. But I have multiple projects including java projects, php scripts and Android apps projects. Now my problem is, I have to put them to different su..

How to remove origin from git repository

Basic question: How do I disassociate a git repo from the origin from which it was cloned? git branch -a shows: * master remotes/origin/HEAD -> origin/master and I want to remove all knowledg..

Can you change what a symlink points to after it is created?

Does any operating system provide a mechanism (system call — not command line program) to change the pathname referenced by a symbolic link (symlink) — other than by unlinking the old one and crea..

How to add a custom CA Root certificate to the CA Store used by pip in Windows?

I just installed Python3 from python.org and am having trouble installing packages with pip. By design, there is a man-in-the-middle packet inspection appliance on the network here that inspects all ..

HTML 'td' width and height

The 'height' and 'width' are not supported in HTML5. How can I set a td's width and height while conforming to the HTML5 standard? <!DOCTYPE html> <html> <head> <meta http-..

How can I generate a list of files with their absolute path in Linux?

I am writing a shell script that takes file paths as input. For this reason, I need to generate recursive file listings with full paths. For example, the file bar has the path: /home/ken/foo/bar b..

How do I return a char array from a function?

I've tried the following: char[10] testfunc() { char[10] str; return str; } ..

Box shadow for bottom side only

I have an box of content and need to give shadow for that. But I want to give shadow for the bottom of the box only. I used this css box-shadow: 0 3px 5px #000000; If i give this code it shows left,..

How to open a different activity on recyclerView item onclick

i am using a recyclerView to show my listitems in the navigation drawer.I have implemented the onclickListener but i have been stuck on how to open a different activity when items are clicked. All my ..

Change header background color of modal of twitter bootstrap

I am trying to change the background color of modal header of twitter bootstrap using following css code. .modal-header { padding:9px 15px; border-bottom:1px solid #eee; background-c..

What is the meaning of curly braces?

Just starting to figure Python out. I've read this question and its responses: Is it true that I can't use curly braces in Python? and I still can't fathom how curly braces work, especially sin..

How to split a string into an array in Bash?

In a Bash script, I would like to split a line into pieces and store them in an array. For example, given the line: Paris, France, Europe I would like to have the resulting array to look like so: arr..

Difference between string and char[] types in C++

I know a little C and now I'm taking a look at C++. I'm used to char arrays for dealing with C strings, but while I look at C++ code I see there are examples using both string type and char arrays: #..

How to parse XML using jQuery?

How do I parse XML, and how can I navigate the result using jQuery? Here is my sample XML: <Pages> <Page Name="test"> <controls> <test>this is a test.</test>..

Change size of text in text input tag?

I have a large input box for text but I can't change the font size? <input type="text"> I would like to change the font size inside the text field but I can't seem to do it using CSS. Any help..

HttpWebRequest using Basic authentication

I'm trying to go through an authentication request that mimics the "basic auth request" we're used to seeing when setting up IIS for this behavior. The URL is: https://telematicoprova.agenziadogane.i..

Node.js throws "btoa is not defined" error

In my node.js application I did an npm install btoa-atob so that I could use the btoa() and atob() functions which are native in client-side javascript but for some reason weren't included in node. Th..

Why this line xmlns:android="http://schemas.android.com/apk/res/android" must be the first in the layout xml file?

Why is this line needed in xml layout file? xmlns:android="http://schemas.android.com/apk/res/android" ..

How to run different python versions in cmd

How can I configure windows command dialog to run different python versions in it? For example when I type python2 it runs python 2.7 and when I type python3 it runs python 3.3? I know how to configur..

Android textview usage as label and value

I want to group two textviews in a group and use like a label and value. Is there any component to group two textviews in android? How can it be accomplished in android layout? ..

Checking that a List is not empty in Hamcrest

I was wondering if anyone knew of a way to check if a List is empty using assertThat() and Matchers? Best way I could see just use JUnit: assertFalse(list.isEmpty()); But I was hoping that there w..

Python, remove all non-alphabet chars from string

I am writing a python MapReduce word count program. Problem is that there are many non-alphabet chars strewn about in the data, I have found this post Stripping everything but alphanumeric chars from ..

Distribution certificate / private key not installed

Using Xcode 9.1, after building an iOS app, I want to archive it and upload it to the appStore for beta-testing. But I get the following issue after clicking the button Upload to the App Store... and ..

SQL split values to multiple rows

I have table : id | name 1 | a,b,c 2 | b i want output like this : id | name 1 | a 1 | b 1 | c 2 | b ..

What is a "bundle" in an Android application

What is a bundle in an Android application? When to use it?..

How to join a slice of strings into a single string?

package main import ( "fmt" "strings" ) func main() { reg := [...]string {"a","b","c"} fmt.Println(strings.Join(reg,",")) } gives me an error of: prog.go:10: cannot use reg (type [3]string) as..

Disabling radio buttons with jQuery

I'm trying to disable these radio buttons when a the loadActive link is clicked but for some reason it only disables the first in the order and then skips the rest. <form id="chatTickets" method="..

"Could not load type [Namespace].Global" causing me grief

In my .Net 2.0 Asp.net WebForms app, I have my Global.asax containing the following code: <%@ Application CodeBehind="Global.asax.cs" Inherits="MyNamespace.Global" Language="C#" %> However wh..

How to know elastic search installed version from kibana?

Currently I am getting these alerts: Upgrade Required Your version of Elasticsearch is too old. Kibana requires Elasticsearch 0.90.9 or above. Can someone tell me if there is a way I can find ..

Send auto email programmatically

i want to send email programmatically. i tried out the following code. final Intent emailIntent = new Intent( android.content.Intent.ACTION_SEND); emailIntent.setType("plain/te..

Linq code to select one item

I find myself writing a lot of code like this to select one item that matches var item = (from x in Items where x.Id == 123 select x).First(); Is there a cleaner way of doing it or is this as conc..

How do you uninstall MySQL from Mac OS X?

I accidentally installed the PowerPC version of MySQL on my Intel Mac in Snow Leopard, and it installed without a problem but of course doesn't run properly. I just didn't pay enough attention. Now wh..

Select dropdown with fixed width cutting off content in IE

The issue: Some of the items in the select require more than the specified width of 145px in order to display fully. Firefox behavior: clicking on the select reveals the dropdown elements list adjus..

Android Studio error: "Environment variable does not point to a valid JVM installation"

When trying to run Android Studio on my computer, I get the following error: The Environment variable JAVA_HOME (with a value of C:\Program Files(x86)\Java\jdk1.7.0_51\bin) does not point to a va..

Use a loop to plot n charts Python

I have a set of data that I load into python using a pandas dataframe. What I would like to do is create a loop that will print a plot for all the elements in their own frame, not all on one. My data ..

Why use @Scripts.Render("~/bundles/jquery")

How does @Scripts.Render("~/bundles/jquery") differ from just referencing the script from html like this <script src="~/bundles/jquery.js" type="text/javascript"></script> Are the..

JavaScript style.display="none" or jQuery .hide() is more efficient?

document.getElementById("elementId").style.display="none" is used in JavaScript to hide an element. But in jQuery, $("#elementId").hide(); is used for the same purpose. Which way is more efficien..

How to display Oracle schema size with SQL query?

I have a Oracle schema with 70+ tables. I want to create simple page which can display the HDD space occupied by the tables. How I can get this value with SQL query? P.S And how I can get the Oracle..

How to use a DataAdapter with stored procedure and parameter

I want to fill a DataGridView control using DataAdapter. But I don't know how to do it since I'm using a stored procedure with parameter. Can someone cite an example please?..

How to check if a URL exists or returns 404 with Java?

String urlString = "http://www.nbc.com/Heroes/novels/downloads/Heroes_novel_001.pdf"; URL url = new URL(urlString); if(/* Url does not return 404 */) { System.out.println("exists"); } else { S..

Angular directive how to add an attribute to the element?

I'm wondering what's the way to do work this snippet: //html <div ng-app="app"> <div ng-controller="AppCtrl"> <a my-dir ng-repeat="user in users">{{user.name}}</a>..

How can I read and parse CSV files in C++?

I need to load and use CSV file data in C++. At this point it can really just be a comma-delimited parser (ie don't worry about escaping new lines and commas). The main need is a line-by-line parser..

Convert Time DataType into AM PM Format:

I have one Table which has two fields such as "StartTime" and "EndTime". The DataType of the Two columns are Time. So the Values of the Table looks like as follows: TableA: StartTime ..

TypeScript enum to object array

I have an enum defined this way: export enum GoalProgressMeasurements { Percentage = 1, Numeric_Target = 2, Completed_Tasks = 3, Average_Milestone_Progress = 4, Not_Measured = 5 }..

Pythonic way to check if a file exists?

Which is the preferred way to check if a file exists and if not create it?..

Is it possible to include one CSS file in another?

Is it possible to include one CSS file in another?..

How do you add input from user into list in Python

print ('This is your Shopping List') firstItem = input('Enter 1st item: ') print (firstItem) secondItem = input('Enter 2nd item: ') print (secondItem) Ho..

What's the difference between align-content and align-items?

Can anybody show me the difference between align-items and align-content?..

jQuery each loop in table row

I am having something like: <table id="tblOne"> <tbody> <tr> <td> <table id="tblTwo"> ..

JQuery Calculate Day Difference in 2 date textboxes

I have 2 asp.net texboxes with calendar extender. I want to find out the number of days between both dates when one of the date control is changed. how can I achieve this using jquery or javascript?..

Import .bak file to a database in SQL server

I have a file with .bak extension. How can I import this date to a database in SQL Server?..

Setting focus to a textbox control

If I want to set the focus on a textbox when the form is first opened, then at design time, I can set it's tabOrder property to 0 and make sure no other form control has a tabOrder of 0. If I want to..

TimeSpan to DateTime conversion

I want to convert a Timespan to Datetime. How can I do this? I found one method on Google: DateTime dt; TimeSpan ts="XXX"; //We can covnert 'ts' to 'dt' like this: dt= Convert.ToDateTime(ts.ToStri..

Google Chrome form autofill and its yellow background

I have design problem with Google Chrome and its form autofill function. If Chrome remembers some login/password it changes a background color to a yellow one. Here are some screenshots: How to r..

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

How to select only date from a DATETIME field in MySQL?

I have a table in the MySQL database that is set up with DATETIME. I need to SELECT in this table only by DATE and excluding the time. How do I SELECT in this table by only date and bypassing the time..

SQL Server Operating system error 5: "5(Access is denied.)"

I am starting to learn SQL and I have a book that provides a database to work on. These files below are in the directory but the problem is that when I run the query, it gives me this error: Msg 5..

Is it possible for UIStackView to scroll?

Let's say I have added more views in UIStackView which can be displayed, how I can make the UIStackView scroll?..

Fixing broken UTF-8 encoding

I am in the process of fixing some bad UTF-8 encoding. I am currently using PHP 5 and MySQL. In my database I have a few instances of bad encodings that print like: î The database collation ..

How to implement a simple scenario the OO way

After starting to read a book on OO programming, I am attempting to make my android app more OO. However I am stumped on a simple scenario. I have a Book object, which can have many say Chapter objec..

How to set image in circle in swift

How can i make i circle picture with swift ? My ViewController : import UIKit import Foundation class FriendsViewController : UIViewController{ @IBOutlet weak var profilPicture: UIImageView! ..

T-SQL string replace in Update

I need to update the values of a column, with a substring replace being done on the existing values. Example: Data contains abc@domain1, pqr@domain2 etc. I need to update the values such that @dom..

Angular HttpPromise: difference between `success`/`error` methods and `then`'s arguments

According to AngularJS doc, calls to $http return the following: Returns a promise object with the standard then method and two http specific methods: success and error. The then method takes two ..

java.lang.NoClassDefFoundError: org/json/JSONObject

I am using Eclipse IDE and am writing a servlet. The servlet should accept values from an html file and return JSON response accordingly. My doPost() is: protected void doPost(HttpServletRequest re..

Check whether variable is number or string in JavaScript

Does anyone know how can I check whether a variable is a number or a string in JavaScript?..

Convert list of ASCII codes to string (byte array) in Python

I have a list of integer ASCII values that I need to transform into a string (binary) to use as the key for a crypto operation. (I am re-implementing java crypto code in python) This works (assuming ..

How Stuff and 'For Xml Path' work in SQL Server?

Table is: Id Name 1 aaa 1 bbb 1 ccc 1 ddd 1 eee Required output: Id abc 1 aaa,bbb,ccc,ddd,eee Query: SELECT ID, abc = STUFF( (SELECT ',' + name FR..

PHP validation/regex for URL

I've been looking for a simple regex for URLs, does anybody have one handy that works well? I didn't find one with the zend framework validation classes and have seen several implementations...

How to Implement DOM Data Binding in JavaScript

Please treat this question as strictly educational. I'm still interested in hearing new answers and ideas to implement this tl;dr How would I implement bi-directional data-binding with JavaScript? ..

Drop columns whose name contains a specific string from pandas DataFrame

I have a pandas dataframe with the following column names: Result1, Test1, Result2, Test2, Result3, Test3, etc... I want to drop all the columns whose name contains the word "Test". The numbers of s..

IntelliJ can't recognize JavaFX 11 with OpenJDK 11

I'm having trouble getting IntellJ to recognize JavaFX packages. With a new JavaFX project, with OpenJDK 11, when trying to build the project, IntelliJ can't recognize the JavaFX packages. I've impor..

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

Shortcut to comment out a block of code with sublime text

I want to comment out a block of code in sublime text. I see it in RailsCasts, but don't think he uses sublime text ... to do the following ... if (uncommented) some uncommented example # if (co..

number several equations with only one number

How can I number several equations in a align environment using only one number? For example \begin{align} w^T x_i + b \geqslant 1-\xi_i \text{ if } y_i=1, \nonumber \\ w^T x_i + b \leqslant -1+\xi..

Flexbox: how to get divs to fill up 100% of the container width without wrapping?

I'm in the process of updating an old inline-block-based grid model I have to a newer Flexbox one I created. Everything has worked fine, apart from one little snag, which has become a bit of a dealbre..

Check if element is visible in DOM

Is there any way that I can check if an element is visible in pure JS (no jQuery) ? So, for example, in this page: Performance Bikes, if you hover over Deals (on the top menu), a window of deals appe..

How do you clear Apache Maven's cache?

Recently, Apache Maven seems to be having caching issues. Performing clean installs on our projects using Windows Vista or Windows 7 sometimes produce artifacts with the same data as a previous build ..

Django Model() vs Model.objects.create()

What it the difference between running two commands: foo = FooModel() and bar = BarModel.objects.create() Does the second one immediately create a BarModel in the database, while for FooModel, t..

What is a word boundary in regex, does \b match hyphen '-'?

I'm trying to use regexes to match space-separated numbers. I can't find a precise definition of \b ("word boundary"). I had assumed that -12 would be an "integer word" (matched by..

Meaning of "referencing" and "dereferencing" in C

I read different things on the Internet and got confused, because every website says different things. I read about * referencing operator and & dereferencing operator; or that referencing means ..

How can I get LINQ to return the object which has the max value for a given property?

If I have a class that looks like: public class Item { public int ClientID { get; set; } public int ID { get; set; } } And a collection of those items... List<Item> items = getItems(..

How to calculate an age based on a birthday?

Possible Duplicate: How do I calculate someone’s age in C#? I want to write an ASP.NET helper method which returns the age of a person given his or her birthday. I've tried code like..

Authenticate with GitHub using a token

I am trying to authenticate with GitHub using a personal access token. In the help files at github, it states to use the cURL method to authenticate (https://help.github.com/articles/creating-an-acces..

How to create own dynamic type or dynamic object in C#?

There, is for example, ViewBag property of ControllerBase class and we can dynamically get/set values and add any number of additional fields or properties to this object, which is cool .I want to use..

bootstrap 3 tabs not working properly

I almost copied the code from their website. The tab is initiated perfectly, and when I click on tabs, new panels are activated. However, the "active" class is not applied to the activated tab. This i..

Determining the size of an Android view at runtime

I am trying to apply an animation to a view in my Android app after my activity is created. To do this, I need to determine the current size of the view, and then set up an animation to scale from th..

How can I determine if a String is non-null and not only whitespace in Groovy?

Groovy adds the isAllWhitespace() method to Strings, which is great, but there doesn't seem to be a good way of determining if a String has something other than just white space in it. The best I've ..

How to identify if a webpage is being loaded inside an iframe or directly into the browser window?

I am writing an iframe based facebook app. Now I want to use the same html page to render the normal website as well as the canvas page within facebook. I want to know if I can determine whether the p..

How to get a jqGrid selected row cells value

Does anyone know how to get the cells value of the selected row of JQGrid ? i m using mvc with JQGrid, i want to access the value of the hidden column of the selected row ?..

Difference between request.getSession() and request.getSession(true)

I understand the difference between request.getSession(true) and request.getSession(false). But request.getSession() & request.getSession(true) look very similar! Both "return the current session..

C# find biggest number

It's the first time I am using c# so I am not very familiar with it. I would like to create a simple program to find the biggest number if I have the user entering 3 numbers. I just need to know what ..

Cannot find java. Please use the --jdkhome switch

I have just installed Netbeans 8.0.2 on CentOS 6.5. When I try to run it, I get the message Cannot find java. Please use the --jdkhome switch I have /usr/share/java-1.7.0 so I typed /usr/local/n..

Usage of MySQL's "IF EXISTS"

Here are two statements that I'd like to work, but which return error messages: IF EXISTS (SELECT * FROM gdata_calendars WHERE `group` = ? AND id = ?) SELECT 1 ELSE SELECT 0 and IF ((SELECT COUNT..

Performance of FOR vs FOREACH in PHP

First of all, I understand in 90% of applications the performance difference is completely irrelevant, but I just need to know which is the faster construct. That and... The information currently ava..

What are file descriptors, explained in simple terms?

What would be a more simplified description of file descriptors compared to Wikipedia's? Why are they required? Say, take shell processes as an example and how does it apply for it? Does a process ta..

PivotTable to show values, not sum of values

I'm wanting to display a pivot table and for it to show me the actual values, one on each row, rather than a sum of the values. E.g. Name Jan Feb Mar Apr Bob 12 10 4 ..

Laravel Eloquent where field is X or null

I have a table like this: table - field1: tinyint - field2: varchar (nullable) - datefield: timestamp (nullable) Now I want to get all entries where field1 is 1, field2 is null and where datefield ..

internal/modules/cjs/loader.js:582 throw err

I'm getting following Console Error. Error : Cannot find module Here is the full error i'm getting in console. What should I do? internal/modules/cjs/loader.js:582 throw err; ^ Error: Canno..

using extern template (C++11)

Figure 1: function templates TemplHeader.h template<typename T> void f(); TemplCpp.cpp template<typename T> void f(){ //... } //explicit instantation template void f<T>()..

.NET End vs Form.Close() vs Application.Exit Cleaner way to close one's app

sometimes, when I use Form.close() when debugging my program, although the form is closed, the application is still running. I noticed this behaviour when using the msgbox function. I have no thread ..

Different color for each bar in a bar chart; ChartJS

I'm using ChartJS in a project I'm working on and I need a different color for each bar in a Bar Chart. Here's an example of the bar chart data set: var barChartData = { labels: ["001", "002", "0..