Questions Tagged with #Inexact arithmetic

How do you strip a character out of a column in SQL Server?

How do you remove a value out of a string in SQL Server? ..

Angular pass callback function to child component as @Input similar to AngularJS way

AngularJS has the & parameters where you could pass a callback to a directive (e.g AngularJS way of callbacks. Is it possible to pass a callback as an @Input for an Angular Component (something li..

Highlight Anchor Links when user manually scrolls?

I apologize for the long post. I wanted to include everything that might be helpful. I have a single page website that consists of several divs stacked vertically. I'm using a floating nav bar and so..

Any free WPF themes?

I'm not a designer, so I'm looking for some free WPF themes. Any suggestions?..

python numpy ValueError: operands could not be broadcast together with shapes

In numpy, I have two "arrays", X is (m,n) and y is a vector (n,1) using X*y I am getting the error ValueError: operands could not be broadcast together with shapes (97,2) (2,1) When (97,2)x(..

How to select first and last TD in a row?

How can you select the first and the last TD in a row? tr > td[0], tr > td[-1] { /* styles */ } ..

How do you perform a left outer join using linq extension methods

Assuming I have a left outer join as such: from f in Foo join b in Bar on f.Foo_Id equals b.Foo_Id into g from result in g.DefaultIfEmpty() select new { Foo = f, Bar = result } How would I express ..

Copy file from source directory to binary directory using CMake

I'm trying to create a simple project on CLion. It uses CMake (I'm new here) to generate Makefiles to build project (or some sort of it) All I need to is transfer some non-project file (some sort of ..

How to set up a squid Proxy with basic username and password authentication?

I currently I use ip in acl, and I want to use username and password to do this...

Which data type for latitude and longitude?

I am newbie to PostgreSQL and PostGIS. I want to store latitude and longitude values in PostgreSQL 9.1.1 database table. I will calculate distance between two points, find nearer points by using this..

How to make Java Set?

Can anyone help me? example A {1,2,3} B {1,4,5} Code snippet: a.intersect(b).print() // Result 1 . twin between two object a.merge(b).print() // Result 1,2,3,4,5 It is valid if I write code be..

How to delete node from XML file using C#

Possible Duplicate: How to remove an XmlNode from XmlNodeList Hi, How can i delete a set of nodes from an XML file.? Here is a code snippet. string path = @"C:\Documents and Settings\e45493..

How to remove specific elements in a numpy array

How can I remove some specific elements from a numpy array? Say I have import numpy as np a = np.array([1,2,3,4,5,6,7,8,9]) I then want to remove 3,4,7 from a. All I know is the index of the value..

What are OLTP and OLAP. What is the difference between them?

Actually what do they mean? All articles I find about them don't give me an idea, or my knowledge is too insufficient to understand it. Will some one give me some resources with which I can learn thi..

How to deal with certificates using Selenium?

I am using Selenium to launch a browser. How can I deal with the webpages (URLs) that will ask the browser to accept a certificate or not? In Firefox, I may have a website like that asks me to accept..

Enter key pressed event handler

I want to capture the text from the textbox when enter key is hit. I am using WPF/visual studio 2010/.NET 4. I dont know what event handler to be used in the tag ? I also want to do the same for m..

How can I print a quotation mark in C?

In an interview I was asked Print a quotation mark using the printf() function I was overwhelmed. Even in their office there was a computer and they told me to try it. I tried like this: void m..

How to get file path from OpenFileDialog and FolderBrowserDialog?

Hey there i started learning C# a few days ago and I'm trying to make a program that copies and pastes files (and replaces if needed) to a selected directory but I don't know how to get the directory ..

How many socket connections possible?

Has anyone an idea how many tcp-socket connections are possible on a modern standard root server? (There is in general less traffic on each connection, but all the connections have to be up all the ti..

What is the best IDE for PHP?

I'm a PHP developer and now I use Notepad++ for code editing, but lately I've been searching for an IDE to ease my work. I've looked into Eclipse, Aptana Studio and several others, but I'm not really..

Vertical and horizontal align (middle and center) with CSS

I am practicing CSS and I am so confused about how can I force my div element to be center (vertically and horizontally) at my page (mean which way or ways for cross browser compatibility)? Best rega..

How do I get ruby to print a full backtrace instead of a truncated one?

When I get exceptions, it is often from deep within the call stack. When this happens, more often than not, the actual offending line of code is hidden from me: tmp.rb:7:in `t': undefined method `ba..

Convert UTC/GMT time to local time

We are developing a C# application for a web-service client. This will run on Windows XP PC's. One of the fields returned by the web service is a DateTime field. The server returns a field in GMT for..

Change/Get check state of CheckBox

I just want to get/change value of CheckBox with JavaScript. Not that I cannot use jQuery for this. I've tried something like this but it won't work. JavaScript function function checkAddress() ..

VBA - If a cell in column A is not blank the column B equals

I'm looking for some code that will look at Column A and as long as the cell in Column A is not blank, then the corresponding cell in Column B will equal a specific value. So if Cell A1 <> "" then..

Resizing SVG in html?

So, I have an SVG file in HTML, and one of the things I've heard about the format is that it doesn't get all pixelated when you zoom in on it. I know with a jpeg or whatever I could have it stored as..

How to select unique records by SQL

When I perform "SELECT * FROM table" I got results like below: 1 item1 data1 2 item1 data2 3 item2 data3 4 item3 data4 As you can see, there are dup records from column2 (item1 are dupped). So how ..

What is the IntelliJ shortcut key to create a javadoc comment?

In Eclipse, I can press Alt+Shift+J and get a javadoc comment automatically generated with fields, returns, or whatever would be applicable for that specific javadoc comment. I'm assuming that Intelli..

Is there a native jQuery function to switch elements?

Can I easily swap two elements with jQuery? I'm looking to do this with one line if possible. I have a select element and I have two buttons to move up or down the options, and I already have the se..

Different ways of loading a file as an InputStream

What's the difference between: InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName) and InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStre..

Flutter: Run method on Widget build complete

I would like to be able to run functions once a Widget has finished building/loading but I am unsure how. My current use case is to check if a user is authenticated and if not, redirect to a login vi..

Regex find word in the string

In general terms I want to find in the string some substring but only if it is contained there. I had expression : ^.*(\bpass\b)?.*$ And test string: high pass h3 When I test the string via ex..

Ionic 2: Cordova is not available. Make sure to include cordova.js or run in a device/simulator (running in emulator)

I just set up my first ionic 2 app (I've used ionic 1 fairly extensively). I'm trying to use the ionic-native camera preview plugin. The setup was pretty straight forward: npm install -g ionic cordo..

Fetch: reject promise and catch the error if status is not OK?

Here's what I have going: import 'whatwg-fetch'; function fetchVehicle(id) { return dispatch => { return dispatch({ type: 'FETCH_VEHICLE', payload: fetch(`http..

How to detect the device orientation using CSS media queries?

In JavaScript the orientation mode can be detected using: if (window.innerHeight > window.innerWidth) { portrait = true; } else { portrait = false; } However, is there a way to detect th..

Filter Extensions in HTML form upload

I have a simple HTML upload form, and I want to specify a default extension ("*.drp" for example). I've read that the way to do this is through the ACCEPT attribute of the input tag, but I don't know ..

PostgreSQL - query from bash script as database user 'postgres'

I have a table in my PostgreSQL database which has 3 columns - c_uid, c_defaults and c_settings. c_uid simply stores the name of a user and c_defaults is a long piece of text which contains a lot of d..

How to get main div container to align to centre?

I have always been wondering how other people get to align to the centre the main div container as the only way I manage so far is adding to the css file the following: *{ padding:auto; margin:auto; ..

Draw text in OpenGL ES

I'm currently developing a small OpenGL game for the Android platform and I wonder if there's an easy way to render text on top of the rendered frame (like a HUD with the player´s score etc). The tex..

jQuery UI Tabs - How to Get Currently Selected Tab Index

I know this specific question has been asked before, but I am not getting any results using the bind() event on the jQuery UI Tabs plugin. I just need the index of the newly selected tab to perform ..

Determine SQL Server Database Size

SQL Server 2005/2008 Express edition has the limitation of 4 GB per database. As far as I known the database engine considers data only, thus excluding log files, unused space, and index size. Gettin..

Use tab to indent in textarea

I have a simple html textarea on my side. Right now if you click tab in it, it goes to the next field. I would like to make the tab button indent a few spaces instead. How can I do this? Thanks...

How to get current date in 'YYYY-MM-DD' format in ASP.NET?

How to get current date in 'YYYY-MM-DD' format in ASP.NET ?..

Pandas dataframe groupby plot

I have a dataframe which is structured as: Date ticker adj_close 0 2016-11-21 AAPL 111.730 1 2016-11-22 AAPL 111.800 2 2016-11-23 AAPL 111.230 3 ..

How to make a local variable (inside a function) global

Possible Duplicate: Using global variables in a function other than the one that created them I'm using functions so that my program won't be a mess but I don't know how to make a local var..

UTC Date/Time String to Timezone

How do I convert a date/time string (e.g. 2011-01-01 15:00:00) that is UTC to any given timezone php supports, such as America/New_York, or Europe/San_Marino...

AngularJS - Passing data between pages

I am an AngularJS starter. I am trying to send data from : Page A : Van Listing page to Page B: Van Update page. When user click the update link for a van, I am invoking a controller and retrievi..

TERM environment variable not set

I have a file.sh with this, when run show : TERM environment variable not set. smbmount //172.16.44.9/APPS/Interfas/HERRAM/sc5 /mnt/siscont5 -o iocharset=utf8,username=backup,password=backup2011,r ..

What is setup.py?

Can anyone please explain what setup.py is and how it can be configured or used?..

How to Get the HTTP Post data in C#?

I am using Mailgun API. There is a section that I need to provide a URL to them, then they are going to HTTP Post some data to me. I provide this URL (http://test.com/MailGun/Webhook.aspx) to Mailgun..

What difference does .AsNoTracking() make?

I have a question regarding the .AsNoTracking() extension, as this is all quite new and quite confusing. I'm using a per-request context for a website. A lot of my entities don't change so don't nee..

Command to get time in milliseconds

Is there a shell command in Linux to get the time in milliseconds?..

jQuery autocomplete with callback ajax json

I'm trying to find a way to use jQuery autocomplete with callback source getting data via an ajax json object list from the server. Could anybody give some directions? I googled it but couldn't find..

How to insert an item into an array at a specific index (JavaScript)?

I am looking for a JavaScript array insert method, in the style of: arr.insert(index, item) Preferably in jQuery, but any JavaScript implementation will do at this point...

Multiline for WPF TextBox

I am developing an app for sending some feedback. Basically I'm trying to make a TextBox for comments, but I'm used to the WinForms MultiLine=true. I've set MinLines to 3, which is getting there, but..

Using Mysql WHERE IN clause in codeigniter

I have the following mysql query. Could you please tell me how to write the same query in Codeigniter's way ? SELECT * FROM myTable WHERE trans_id IN ( SELECT trans_id FROM myTable WHERE co..

How to acces external json file objects in vue.js app

How to access JSON objects in the vue.js app I am new in this import json from './json/data.json' the JSON file is loaded and now I have to access the objects within it ..

Qt jpg image display

I want to display .jpg image in an Qt UI. I checked it online and found http://qt-project.org/doc/qt-4.8/widgets-imageviewer.html. I thought Graphics View will do the same, and also it has codec to di..

How to view the SQL queries issued by JPA?

When my code issues a call like this: entityManager.find(Customer.class, customerID); How can I see the SQL query for this call? Assuming I don't have access to database server to profile/monitor ..

How to set DateTime to null

Using C#. I have a string dateTimeEnd. If the string is in right format, I wish to generate a DateTime and assign it to eventCustom.DateTimeEnd of type public Nullable<System.DateTime> DateTi..

submitting a GET form with query string params and hidden params disappear

Consider this form: <form action="http://www.blabla.com?a=1&b=2" method="GET"> <input type="hidden" name="c" value="3" /> </fo..

How to remove a package in sublime text 2

I would like to remove and/or deactivate the Emmet package in Sublime Text 2. Should I just remove the Emmet directory or what is the typical workflow for removal of a package?..

Java : Convert formatted xml file to one line string

I have a formatted XML file, and I want to convert it to one line string, how can I do that. Sample xml: <?xml version="1.0" encoding="UTF-8"?> <books> <book> <title&..

Example for boost shared_mutex (multiple reads/one write)?

I have a multithreaded app that has to read some data often, and occasionally that data is updated. Right now a mutex keeps access to that data safe, but it's expensive because I would like multiple t..

Angular - Set headers for every request

I need to set some Authorization headers after the user has logged in, for every subsequent request. To set headers for a particular request, import {Headers} from 'angular2/http'; var headers = ..

ImportError: No module named 'Queue'

I am trying to import requests module, but I got this error my python version is 3.4 running on ubuntu 14.04 >>> import requests Traceback (most recent call last): File "/usr/local/lib/pyt..

Replace first occurrence of string in Python

I have some sample string. How can I replace first occurrence of this string in a longer string with empty string? regex = re.compile('text') match = regex.match(url) if match: url = url.replace(..

How to edit default.aspx on SharePoint site without SharePoint Designer

On several occations, I have faced the situation that the default.aspx page on a Site doesn't work. More specifically, a reference to a WebPart and/or Control is throwing a error because the assembly ..

Is there a way to use two CSS3 box shadows on one element?

I'm trying to replicate a button style in a Photoshop mock-up that has two shadows on it. The first shadow is an inner lighter box shadow (2px), and the second is a drop shadow outside the button (5px..

MySQL trigger if condition exists

I'm trying to write an update trigger that will only update a password when a new password is set in the update statement but I'm having a terrible time trying to nail down the syntax. This should be..

How can I see what I am about to push with git?

Is there a way to see what would be pushed if I did a git push command? What I'm picturing is something like the "Files Changed" tab of Github's "pull request" feature. When I issue a pull request, I..

What is the difference between 'classic' and 'integrated' pipeline mode in IIS7?

I was deploying an ASP.NET MVC application last night, and found out that it is less work to deploy with IIS7 set to integrated mode. My question is what is the difference? And what are the implicatio..

How to continue a Docker container which has exited

Consider: docker run -it centos /bin/bash I pressed Ctrl+D to exit it. I want to continue to run this container, but I found I can't. The only method is docker commit `docker ps -q -l` my_image ..

How to write lists inside a markdown table?

Can one create a list (bullets, numbered or not) inside a markdown table. A table looks like this: | Tables | Are | Cool | | ------------- |:-------------:| -----:| | col 3 is ..

JFrame.dispose() vs System.exit()

What is the difference between these two methods - System.exit() and JFrame.dispose()? If we want to close a Java Swing application when a button is clicked, which method should I use?..

Using Auto Layout in UITableView for dynamic cell layouts & variable row heights

How do you use Auto Layout within UITableViewCells in a table view to let each cell's content and subviews determine the row height (itself/automatically), while maintaining smooth scrolling performan..

How do I write output in same place on the console?

I am new to python and am writing some scripts to automate downloading files from FTP servers, etc. I want to show the progress of the download, but I want it to stay in the same position, such as: o..

Css transition from display none to display block, navigation with subnav

This is what I have jsFiddle link _x000D_ _x000D_ nav.main ul ul {_x000D_ position: absolute;_x000D_ list-style: none;_x000D_ display: none;_x000D_ opacity: 0;_x000D_ visibility: ..

How do I use SELECT GROUP BY in DataTable.Select(Expression)?

I try to remove the duplicate rows by select a first row from every group. For Example PK Col1 Col2 1 A B 2 A B 3 C C 4 C C I want a ..

How to show a confirm message before delete?

I want to get a confirm message on clicking delete (this maybe a button or an image). If the user selects 'Ok' then delete is done, else if 'Cancel' is clicked nothing happens. I tried echoing this ..

how to run or install a *.jar file in windows?

I have downloaded jbpm-installer-3.2.7.jar but I don't know how to install or run the file. If I double click on it, it opens in winrar. I tried installing through command prompt, but I got the follo..

T-SQL STOP or ABORT command in SQL Server

Is there a command in Microsoft SQL Server T-SQL to tell the script to stop processing? I have a script that I want to keep for archival purposes, but I don't want anyone to run it...

Iterate Multi-Dimensional Array with Nested Foreach Statement

I think this might be a pretty simple question, but I haven't been able to figure it out yet. If I've got a 2-dimensional array like so: int[,] array = new int[2,3] { {1, 2, 3}, {4, 5, 6} }; What's..

How to echo with different colors in the Windows command line

I know that the color bf command sets the colors of the whole command line window but I wanted to to print one single line in a different color...

What is the `zero` value for time.Time in Go?

In an error condition, I tried to return nil, which throws the error: cannot use nil as type time.Time in return argument What is the zero value for time.Time?..

How to restart a single container with docker-compose

I have a docker-compose.yml file that contains 4 containers: redis, postgres, api, worker During the development of worker, I often need to restart it in order to apply changes. Is there any good way..

Inline CSS styles in React: how to implement a:hover?

I quite like the inline CSS pattern in React and decided to use it. However, you can't use the :hover and similar selectors. So what's the best way to implement highlight-on-hover while using inline ..

100% height minus header?

I want to create a layout for an admin panel, but I dont know how to get the #nav and #content container always at 100% of the browser window. I don't understand the inherit of 100% height attributes,..

How to both read and write a file in C#

I want to both read from and write to a file. This doesn't work. static void Main(string[] args) { StreamReader sr = new StreamReader(@"C:\words.txt"); StreamWriter sw = new StreamWriter(@"C..

How to add icons to React Native app

I am making a React Native app. I would like to customize the app icon (meaning the icon that you click on to start the app). I have Googled this, but I keep finding different types of icons that refe..

PostgreSQL - SQL state: 42601 syntax error

I would like to know how to use a dynamic query inside a function. I've tried lots of ways, however, when I try to compile my function a message SQL 42601 is displayed. The code that I use: CREATE O..

Round float to x decimals?

Is there a way to round a python float to x decimals? For example: >>> x = roundfloat(66.66666666666, 4) 66.6667 >>>x = roundfloat(1.29578293, 6) 1.295783 I've found ways to trim/..

How to get access to job parameters from ItemReader, in Spring Batch?

This is part of my job.xml: <job id="foo" job-repository="job-repository"> <step id="bar"> <tasklet transaction-manager="transaction-manager"> <chunk commit-interval=..

How to calculate UILabel height dynamically?

I want to calculate number of lines and height of UILabel dynamically from given text for same...

Preventing form resubmission

Page one contains an HTML form. Page two - the code that handles the submitted data. The form in page one gets submitted. The browser gets redirected to page two. Page two handles the submitted data..

Fitting a density curve to a histogram in R

Is there a function in R that fits a curve to a histogram? Let's say you had the following histogram hist(c(rep(65, times=5), rep(25, times=5), rep(35, times=10), rep(45, times=4))) It looks norma..

What's the difference between "Solutions Architect" and "Applications Architect"?

As far as I can see Solutions Architect is just a different "marketing" term for Applications Architect. Is that correct or are the roles actually different somehow? If so, how? And yes, I have searc..

Why is nginx responding to any domain name?

I have nginx up and running with a Ruby/Sinatra app and all is well. However, I'm now trying to have a second application running from the same server and I noticed something weird. First, here's my n..

Difference between BYTE and CHAR in column datatypes

In Oracle, what is the difference between : CREATE TABLE CLIENT ( NAME VARCHAR2(11 BYTE), ID_CLIENT NUMBER ) and CREATE TABLE CLIENT ( NAME VARCHAR2(11 CHAR), -- or even VARCHAR2(11) ID_CLIENT..

Error CS2001: Source file '.cs' could not be found

I am getting the following error on a project of mine when I try to build... Error CS2001: Source file '.cs' could not be found. I took the two files that are causing this error out on purpose because..

How to call Stored Procedures with EntityFramework?

I have generated an EF4 Model from a MySQL database and I have included both StoredProcedures and Tables. I know how to make regular instert/update/fetch/delete operations against the EF but I can't ..

TypeScript add Object to array with push

I would just like to add an object of an class (Pixel) to an array. export class Pixel { constructor(x: number, y: number) {} } The class has the following attribute: pixels: Pixel[] = []; Th..

Remove all subviews?

When my app gets back to its root view controller, in the viewDidAppear: method I need to remove all subviews. How can I do this?..

Easy way to test a URL for 404 in PHP?

I'm teaching myself some basic scraping and I've found that sometimes the URL's that I feed into my code return 404, which gums up all the rest of my code. So I need a test at the top of the code to ..

How to extract numbers from a string in Python?

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

Quicksort with Python

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

Why does one use dependency injection?

I'm trying to understand dependency injections (DI), and once again I failed. It just seems silly. My code is never a mess; I hardly write virtual functions and interfaces (although I do once in a blu..

Send File Attachment from Form Using phpMailer and PHP

I have a form on example.com/contact-us.php that looks like this (simplified): <form method="post" action="process.php" enctype="multipart/form-data"> <input type="file" name="uploaded_fil..

Count number of columns in a table row

I have a table similar to: <table id="table1"> <tr> <td><input type="text" value="" /></td> <td><input type="text" value="" /></td> <td><..

Use LIKE %..% with field values in MySQL

I stumbled into a delicate SQL problem when I needed to use a value from a field inside a LIKE %..% statement. Example: SELECT t1.Notes, t2.Name FROM Table1 t1, Table2 t2 WHERE t1.Notes LIKE '%t2.Na..

How can I get date in application run by node.js?

Do I have to manually run date command using child_process and fetch the result from it to get the date? Is there any other way using node?..

How to show progress dialog in Android?

I want to show ProgressDialog when I click on Login button and it takes time to move to another page. How can I do this?..

What is <scope> under <dependency> in pom.xml for?

Looking at documentation http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html, we can see <scope> tag under <dependency> What is that and how can we use it for run..

Purpose of ESI & EDI registers?

What is the actual purpose and use of the EDI & ESI registers in assembler? I know they are used for string operations for one thing. Can someone also give an example?..

Getting the screen resolution using PHP

I need to find the screen resolution of a users screen who visits my website?..

What is Teredo Tunneling Pseudo-Interface?

Running ipconfig /all shows a Teredo Tunneling Pseudo-Interface. What is that? Does this have something to do with IPv4 vs IPv6? Should I get rid of it? If so how?..

Laravel view not found exception

I have problem with laravel view is not found by route function I did composer dumpautoload but no use ArticleController.php <?php class ArticleController extends BaseController { public func..

Joining Multiple Tables - Oracle

I'm studying multiple table joins this week and have some odd results being returned. Here is the scenario... Using the correct tables, create a query using the traditional join operation that will l..

How to see the changes between two commits without commits in-between?

How do you make git diff only show the difference between two commits, excluding the other commits in-between?..

How to serve static files in Flask

So this is embarrassing. I've got an application that I threw together in Flask and for now it is just serving up a single static HTML page with some links to CSS and JS. And I can't find where in the..

Convert Python dictionary to JSON array

Currently I have this dictionary, printed using pprint: {'AlarmExTempHum': '\x00\x00\x00\x00\x00\x00\x00\x00', 'AlarmIn': 0, 'AlarmOut': '\x00\x00', 'AlarmRain': 0, 'AlarmSoilLeaf': '\x00\x..

Why am I getting InputMismatchException?

So far I have this: public double checkValueWithin(int min, int max) { double num; Scanner reader = new Scanner(System.in); num = reader.nextDouble(); while (..

Git add and commit in one command

Is there any way I can do git add -A git commit -m "commit message" in one command? I seem to be doing those two commands a lot, and if Git had an option like git commit -Am "commit message", it ..

How do I get the XML root node with C#?

I know that it's possible to get any XML node using C# if you know the node name, but I want to get the root node so that I can find out the name. Is this possible? Update: I'm using XMLTextReader to..

The matching wildcard is strict, but no declaration can be found for element 'context:component-scan

I am getting the following errors while trying my first spring project: Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be fo..

How to find and replace all occurrences of a string recursively in a directory tree?

Using just grep and sed, how do I replace all occurrences of: a.example.com with b.example.com within a text file under the /home/user/ directory tree recursively finding and replacing all occu..

How to solve maven 2.6 resource plugin dependency?

ERROR: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.m..

JS file gets a net::ERR_ABORTED 404 (Not Found)

I am trying to create a simple Io-web-chat. I recently wanted to seperate my <script> inside my html file to an external js file. this is my very simple folder structure: Chat |-- index.html ..

Calculate mean across dimension in a 2D array

I have an array a like this: a = [[40, 10], [50, 11]] I need to calculate the mean for each dimension separately, the result should be this: [45, 10.5] 45 being the mean of a[*][0] and 10.5 the ..

How to center the text in PHPExcel merged cell

How to center text "test"? This is my code: <?php /** Error reporting */ error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); date..

Need to perform Wildcard (*,?, etc) search on a string using Regex

I need to perform Wildcard (*, ?, etc.) search on a string. This is what I have done: string input = "Message"; string pattern = "d*"; Regex regex = new Regex(pattern, RegexOptions.IgnoreCase); if (..

React prevent event bubbling in nested components on click

Here's a basic component. Both the <ul> and <li> have onClick functions. I want only the onClick on the <li> to fire, not the <ul>. How can I achieve this? I've played around ..

Change bootstrap datepicker date format on select

I'm using bootstrap datepicker on a textbox. The default format of the date when you select a date is mm/dd/yyyy. Now I want to change it to dd/mm/yyyy. How can I accomplish this. Right now I'm just i..

Error message "Forbidden You don't have permission to access / on this server"

I have configured my Apache by myself and have tried to load phpMyAdmin on a virtual host, but I received: 403 Forbidden You don't have permission to access / on this server My httpd.conf # #..

How do I get my Maven Integration tests to run

I have a maven2 multi-module project and in each of my child modules I have JUnit tests that are named Test.java and Integration.java for unit tests and integration tests respectively. When I execute..

Creating random colour in Java?

I want to draw random coloured points on a JPanel in a Java application. Is there any method to create random colours?..

How to add elements to an empty array in PHP?

If I define an array in PHP such as (I don't define its size): $cart = array(); Do I simply add elements to it using the following? $cart[] = 13; $cart[] = "foo"; $cart[] = obj; Don't arrays in ..

Why is there no Char.Empty like String.Empty?

Is there a reason for this? I am asking because if you needed to use lots of empty chars then you get into the same situation as you would when you use lots of empty strings. Edit: The reason for thi..

No Spring WebApplicationInitializer types detected on classpath

My Eclipse project is suddenly no longer deploying properly. I can't trace it to any particular change I've made to the environment. I have tested with multiple source-controlled projects and they a..

Getting a count of rows in a datatable that meet certain criteria

I have a datatable, dtFoo, and would like to get a count of the rows that meet a certain criteria. EDIT: This data is not stored in a database, so using SQL is not an option. In the past, I've used ..

Replace HTML Table with Divs

Alright, I'm trying to buy into the idea that html tables should not be used, and that divs should be. However, I often have code that resembles the following <table> <tr> <..

Hashcode and Equals for Hashset

Please clarify my doubt in Hashset. Consider the following code, class Person { String name; Person(String n) { name=n; } public String getName() { return na..

How to check existence of user-define table type in SQL Server 2008?

I have a user-defined table type. I want to check it's existence before editing in a patch using OBJECT_ID(name, type) function. What type from the enumeration should be passed for user-defined table..

Execute the setInterval function without delay the first time

It's there a way to configure the setInterval method of javascript to execute the method immediately and then executes with the timer..

Why does changing 0.1f to 0 slow down performance by 10x?

Why does this bit of code, const float x[16] = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6}; const float z..

How can I set NODE_ENV=production on Windows?

In Ubuntu it's quite simple; I can run the application using: $ NODE_ENV=production node myapp/app.js However, this doesn't work on Windows. Is there a configuration file where I can set the attrib..

How to use a TRIM function in SQL Server

I cannot get this TRIM code to work SELECT dbo.COL_V_Cost_GEMS_Detail.TNG_SYS_NR AS [EHP Code], dbo.COL_TBL_VCOURSE.TNG_NA AS [Course Title], LTRIM(RTRIM(FCT_TYP_CD)& ') AND (' & ..

Parsing JSON Array within JSON Object

I have some JSON with the following structure: {"source":[ {"name":"john","age":20}, {"name":"michael","age":25}, {"name":"sara", "age":23} ] } I have name..

Handling very large numbers in Python

I've been considering fast poker hand evaluation in Python. It occurred to me that one way to speed the process up would be to represent all the card faces and suits as prime numbers and multiply them..

Emulator in Android Studio doesn't start

I think it's a problem with the SDK reference in Project Structure, but when I click run and I choose Launch Emulator nothing appears...

How to overlay images

I want to overlay one image with another using CSS. An example of this is the first image (the background if you like) will be a thumbnail link of a product, with the link opening a lightbox / popup s..

Exporting functions from a DLL with dllexport

I'd like a simple example of exporting a function from a C++ Windows DLL. I'd like to see the header, the .cpp file, and the .def file (if absolutely required). I'd like the exported name to be unde..

Transposing a 2D-array in JavaScript

I've got an array of arrays, something like: [ [1,2,3], [1,2,3], [1,2,3], ] I would like to transpose it to get the following array: [ [1,1,1], [2,2,2], [3,3,3], ] It's n..

XML parsing of a variable string in JavaScript

I have a variable string that contains well-formed and valid XML. I need to use JavaScript code to parse this feed. How can I accomplish this using (browser-compatible) JavaScript code?..

Function Pointers in Java

This may be something common and trivial, but I seem to be having trouble finding a concrete answer. In C# there is a concept of delegates, which relates strongly to the idea of function pointers from..

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

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

How to customize listview using baseadapter

I wanna create a customized ListView like this: I think that I have to use BaseAdapter but I have no idea about it...

www-data permissions?

So I have a directory in /var/www (called cake) and I need to allow www-data to write to it, but I also want to write to it (without having to use sudo). I'm afraid to change the permissions to 777 in..

How can I open a .tex file?

I'm trying to open a .tex file. I'm not sure I've got to the bottom of the (possibly) surprisingly complex process. I was told I could do it with Notepad++, which I proceeded to download. Here is the..

Get generic type of class at runtime

How can I achieve this? public class GenericClass<T> { public Type getMyType() { //How do I return the type of T? } } Everything I have tried so far always returns type Ob..

MSVCP140.dll missing

I just developed my first program in C++ and I wanted to show it with one of my friends. Sadly, when he tries to open the exe it gets an error which says "MSVCP140.dll is missing". Why is this issue h..

PHP: How to send HTTP response code?

I have a PHP script that needs to make responses with HTTP response codes (status-codes), like HTTP 200 OK, or some 4XX or 5XX code. How can I do this in PHP?..

Android getActivity() is undefined

I have errors in my class MainActivity. The error: The method getActivity() is undefined for the type MainActivity public class MainActivity extends SherlockFragmentActivity{ PlaceSlidesFragment..

When to use @QueryParam vs @PathParam

I am not asking the question that is already asked here: What is the difference between @PathParam and @QueryParam This is a "best practices" or convention question. When would you use @PathParam vs..

sum two columns in R

I feel a bit embarrassed as I am trying to add two columns in R to get the product. I have tried sum(col1,col2) but this returns Error in Summary.factor(c(49L, 48L, 47L, 46L, 46L, 45L, 45L, 44L, ..

How to return a struct from a function in C++?

I've tried on a few different forums and can't seem to get a straight answer, how can I make this function return the struct? If I try 'return newStudent;' I get the error 'No suitable user-defined co..

Meaning of numbers in "col-md-4"," col-xs-1", "col-lg-2" in Bootstrap

I am confused with the grid system in the new Bootstrap, particularly these classes: col-lg-* col-md-* col-xs-* (where * represents some number). Can anyone please explain the following: How tha..

What does `set -x` do?

I have a shell script with the following line in it: [ "$DEBUG" == 'true' ] && set -x ..

Determine distance from the top of a div to top of window with javascript

How do I determine the distance between the very top of a div to the top of the current screen? I just want the pixel distance to the top of the current screen, not the top of the document. I've tri..

How do you use $sce.trustAsHtml(string) to replicate ng-bind-html-unsafe in Angular 1.2+

ng-bind-html-unsafe was removed in Angular 1.2 I'm trying to implement something where I need to use ng-bind-html-unsafe. In the docs and on the github commit they say: ng-bind-html provides ng-h..

Why does background-color have no effect on this DIV?

<div style="background-color:black" onmouseover="this.bgColor='white'"> <div style="float:left">hello</div> <div style="float:right"..

replace \n and \r\n with <br /> in java

This has been asked several times for several languages but I can't get it to work. I have a string like this String str = "This is a string.\nThis is a long string."; And I'm trying to replace the..

Creating a list of pairs in java

Which class would work best for a non-ordered list of pairs? I'll be taking a bunch of (float,short) pairs and will need to be able to perform simple math (like multiplying the pair together to return..

Why doesn't margin:auto center an image?

<html> <head> <title>Test</title> </head> <body> <div> <img src="queuedError.jpg" style="margin:auto; width:200px;" /> </div> <..

Change WPF window background image in C# code

I have a couple of Images configured as application resources. When my application starts, the background of the main window is set via XAML: <Window.Background> <ImageBrush ImageSource..

Sending a JSON to server and retrieving a JSON in return, without JQuery

I need to send a JSON (which I can stringify) to the server and to retrieve the resulting JSON on the user side, without using JQuery. If I should use a GET, how do I pass the JSON as a parameter? Is..

What is the difference between List and ArrayList?

I've been using ArrayList recently in my android project at the office and I'm a bit confused between List and ArrayList, what is the difference of the two and what should I use? Also I saw some impl..

How should I choose an authentication library for CodeIgniter?

I see there are a few. Which ones are maintained and easy to use? What are their pros and cons? ..

How to add new elements to an array?

I have the following code: String[] where; where.append(ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1"); where.append(ContactsContract.Contacts.IN_VISIBLE_GROUP + "=1"); Those two appends are no..

SELECT INTO Variable in MySQL DECLARE causes syntax error?

I´d like to SELECT a single value into a variable. I´d tried to following: DECLARE myvar INT(4); -- immediately returns some syntax error. SELECT myvalue FROM mytable WHERE anothervalue = 1..

How to set a JavaScript breakpoint from code in Chrome?

I want to force the Chrome debugger to break on a line via code, or else using some sort of comment tag such as something like console.break()...

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

Favicon dimensions?

I have a favicon with the dimensions of height=26px / width=20px named favicon.png <link href=http://www.example.com/images/favicon.png rel="shortcut icon" /> However, in my browser, my favic..

problem with <select> and :after with CSS in WebKit

I would like to add some style on a select box with the pseudo :after (to style my select box with 2 parts and without images). Here's the HTML: <select name=""> <option value="">Test&l..

Add row to query result using select

Is it possible to extend query results with literals like this? select name from users union select name from ('JASON'); or select age, name from users union select age, name from (25,'Betty'); ..

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

Checking if a variable is an integer in PHP

I have the following code $page = $_GET['p']; if($page == "") { $page = 1; } if(is_int($page) == false) { setcookie("error", "Invalid page.", time()+3600); ..

Add icon to submit button in twitter bootstrap 2

I want to use the twitter bootstrap icons on my form input submit buttons. The examples on http://twitter.github.com/bootstrap/base-css.html#icons mainly show styled hyperlinks. The closest I've c..

Change Project Namespace in Visual Studio

How can I change the project namespace in Visual Studio? The namespace is currently WindowsFormsApplication16, and I want the namespace to be MyName...

How to plot ROC curve in Python

I am trying to plot a ROC curve to evaluate the accuracy of a prediction model I developed in Python using logistic regression packages. I have computed the true positive rate as well as the false pos..

Where is git.exe located?

I have PyCharm and I am looking around trying to find git.exe to set it up with my repo. What is the PATH to git.exe?..

"git rebase origin" vs."git rebase origin/master"

I don't get the difference between git rebase origin and git rebase origin/master. In my case I cloned a git repository twice. In the first clone I have to use git rebase origin and in the other clone..

When to use .First and when to use .FirstOrDefault with LINQ?

I've searched around and haven't really found a clear answer as to when you'd want to use .First and when you'd want to use .FirstOrDefault with LINQ. When would you want to use .First? Only when yo..

Understanding dict.copy() - shallow or deep?

While reading up the documentation for dict.copy(), it says that it makes a shallow copy of the dictionary. Same goes for the book I am following (Beazley's Python Reference), which says: The m.c..

get all the images from a folder in php

I am using WordPress. I have an image folder like mytheme/images/myimages. I want to retrieve all the images name from the folder myimages Please advice me, how can I get images name...

Modulo operator in Python

What does modulo in the following piece of code do? from math import * 3.14 % 2 * pi How do we calculate modulo on a floating point number?..

Merge DLL into EXE?

I have two DLL files which I'd like to include in my EXE file to make it easier to distribute it. I've read a bit here and there how to do this, even found a good thread here, and here, but it's far t..

How to write a foreach in SQL Server?

I am trying to achieve something along the lines of a for-each, where I would like to take the Ids of a returned select statement and use each of them. DECLARE @i int DECLARE @PractitionerId int DECLA..

Which ORM should I use for Node.js and MySQL?

I'm rewriting a project to use Node.js. I'd like to keep using MySQL as the DB (even though I don't mind rewriting the schema). I'm looking for a simple-to-use, reasonable-performance ORM, which suppo..

Is there any difference between GROUP BY and DISTINCT

I learned something simple about SQL the other day: SELECT c FROM myTbl GROUP BY C Has the same result as: SELECT DISTINCT C FROM myTbl What I am curious of, is there anything different in the w..