Questions Tagged with #Coin change

All problems (regardless of currency) with making change from a given amount of currency into a specific number of coins and bills of varying denominations.

How to find all combinations of coins when given some dollar value

I found a piece of code that I was writing for interview prep few months ago. According to the comment I had, it was trying to solve this problem: Given some dollar value in cents (e.g. 200 = 2 d..

Twitter bootstrap progress bar animation on page load

I have a page with several bootstrap progress bars. Setting their values initially works fine. Though I would like the progress bars to animate/transition to their specific states when a user opens th..

Android Design Support Library expandable Floating Action Button(FAB) menu

Now that the Android Design Support Library is out, does anyone knows how to implement expanded Fab menu with it, like the fab on Inbox App? Should look like this: ..

Parsing JSON objects for HTML table

I am trying to display a "leaderboard" table based on JSON data. I have read a lot about the JSON format and overcome some initial obstacles, but my Javascript knowledge is very limited and I need he..

PHP Create and Save a txt file to root directory

I am trying to create and save a file to the root directory of my site, but I don't know where its creating the file as I cannot see any. And, I need the file to be overwritten every time, if possible..

Double vs. BigDecimal?

I have to calculate some floating point variables and my colleague suggest me to use BigDecimal instead of double since it will be more precise. But I want to know what it is and how to make most out ..

Showing which files have changed between two revisions

I want to merge two branches that have been separated for a while and wanted to know which files have been modified. Came across this link: http://linux.yyz.us/git-howto.html which was quite useful. ..

java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty on Linux, or why is the default truststore empty

When you google for this exception: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty, multiple results appear. However there is no definitive solution, on..

How to nicely format floating numbers to string without unnecessary decimal 0's

A 64-bit double can represent integer +/- 253 exactly. Given this fact, I choose to use a double type as a single type for all my types, since my largest integer is an unsigned 32-bit number. But now ..

Cloning git repo causes error - Host key verification failed. fatal: The remote end hung up unexpectedly

I am using SSH to clone a git repo to my web server, but every time I get this error $git clone [email protected]:aleccunningham/marjoram.git Cloning into marjoram... Host key verification failed. I h..

FB OpenGraph og:image not pulling images (possibly https?)

First -- I do not believe this is a duplicate issue. I've searched for same or similar problems on SO extensively, and due to the nature of troubleshooting before asking, I believe this problem is uni..

Could not extract response: no suitable HttpMessageConverter found for response type

I am new with spring integration and working in spring integration http module for my project requirement. I am sending request from outbound gateway as a http client. I am trying to initiate a requ..

How can I express that two values are not equal to eachother?

Is there a method similar to equals() that expresses "not equal to"? An example of what I am trying to accomplish is below: if (secondaryPassword.equals(initialPassword)) { JOptionPane.showMess..

Does a TCP socket connection have a "keep alive"?

I have heard of HTTP keep-alive but for now I want to open a socket connection with a remote server. Now will this socket connection remain open forever or is there a timeout limit associated with it ..

How many bits is a "word"?

This is from the book Assembly Language Step By Step, Jeff Duntemann: Here’s the quick tour: A bit is a single binary digit, 0 or 1. A byte is 8 bits side by side. A word is 2 bytes side by si..

make UITableViewCell selectable only while editing

I have a UITableView where the selectionStyle is set to UITableViewCellSelectionStyleNone because I don't want any visible change when a cell is tapped, but when it is in editing mode I do want the th..

PHP + MySQL transactions examples

I really haven't found normal example of PHP file where MySQL transactions are being used. Can you show me simple example of that? And one more question. I've already done a lot of programming and d..

How to output MySQL query results in CSV format?

Is there an easy way to run a MySQL query from the Linux command line and output the results in CSV format? Here's what I'm doing now: mysql -u uid -ppwd -D dbname << EOQ | sed -e 's/ ..

How do I install chkconfig on Ubuntu?

I am running Ubuntu 13.10, and I'm pretty new to Linux. I tried: $ sudo apt-get install chkconfig Package chkconfig is not available, but is referred to by another package. This may mean that..

php get values from json encode

I have an url passing parameters use json_encode each values like follow: $json = array ( 'countryId' => $_GET['CountryId'], 'productId' => $_GET['ProductId'], 'status' => $_G..

Check if object exists in JavaScript

How do I verify the existence of an object in JavaScript? The following works: if (!null) alert("GOT HERE"); But this throws an Error: if (!maybeObject) alert("GOT HERE"); The Error: ..

How can I plot a confusion matrix?

I am using scikit-learn for classification of text documents(22000) to 100 classes. I use scikit-learn's confusion matrix method for computing the confusion matrix. model1 = LogisticRegression() mode..

What's the simplest way of detecting keyboard input in a script from the terminal?

I have a simple python script, that has some functions that run in a loop (I'm taking sensor readings). while True: print "Doing a function" If the keyboard is pressed I'd like to print "key pr..

Using String Format to show decimal up to 2 places or simple integer

I have got a price field to display which sometimes can be either 100 or 100.99 or 100.9, What I want is to display the price in 2 decimal places only if the decimals are entered for that price , for ..

Large WCF web service request failing with (400) HTTP Bad Request

I've encountered this apparently common problem and have been unable to resolve it. If I call my WCF web service with a relatively small number of items in an array parameter (I've tested up to 50), ..

Example of Named Pipes

How do I write a simple--bare minimum needed for it to work--test application that illustrates how to use IPC/Named Pipes? For example, how would one write a console application where Program 1 says ..

What does "for" attribute do in HTML <label> tag?

I wonder what is the difference between the following two code snippets: <label>Input here : </label> <input type='text' name='theinput' id='theinput'/> and <label for='theinput'..

What does the percentage sign mean in Python

In the tutorial there is an example for finding prime numbers: >>> for n in range(2, 10): ... for x in range(2, n): ... if n % x == 0: ... print(n, 'equals', x, '*', ..

What is mapDispatchToProps?

I was reading the documentation for the Redux library and it has this example: In addition to reading the state, container components can dispatch actions. In a similar fashion, you can define a f..

How to start/stop/restart a thread in Java?

I am having a real hard time finding a way to start, stop, and restart a thread in Java. Specifically, I have a class Task (currently implements Runnable) in a file Task.java. My main application nee..

How to append a newline to StringBuilder

I have a StringBuilder object, StringBuilder result = new StringBuilder(); result.append(someChar); Now I want to append a newline character to the StringBuilder. How can I do it? result.append("/..

How to change the port number for Asp.Net core app?

I added the following section in project.json. "commands": { "run": "run server.urls=http://localhost:8082", "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --serv..

How to get rid of punctuation using NLTK tokenizer?

I'm just starting to use NLTK and I don't quite understand how to get a list of words from text. If I use nltk.word_tokenize(), I get a list of words and punctuation. I need only the words instead. Ho..

Get the current language in device

How can we get the current language selected in the Android device?..

How to detect current state within directive

I'm using AngularUI's routing and I'd like to do a ng-class="{active: current.state}" but I'm unsure how to exactly detect the current state in a directive like this...

Wrap long lines in Python

How do I wrap long lines in Python without sacrificing indentation? For example: def fun(): print '{0} Here is a really long sentence with {1}'.format(3, 5) Suppose this goes over the 79 cha..

Oracle - What TNS Names file am I using?

Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using. What's the best way to figure this out? ++happy for various platform soluti..

How to initialize HashSet values by construction?

I need to create a Set with initial values. Set<String> h = new HashSet<String>(); h.add("a"); h.add("b"); Is there a way to do this in one line of code? For instance, it's useful for a..

How can I copy a file from a remote server to using Putty in Windows?

How do I copy a file from a remote server to my local Windows system using a Putty session?..

How do I do a not equal in Django queryset filtering?

In Django model QuerySets, I see that there is a __gt and __lt for comparative values, but is there a __ne or != (not equals)? I want to filter out using a not equals. For example, for Model: bool..

Read a text file in R line by line

I would like to read a text file in R, line by line, using a for loop and with the length of the file. The problem is that it only prints character(0). This is the code: fileName="up_down.txt" con=fi..

Cannot stop or restart a docker container

When trying to stop or restart a docker container I'm getting the following error message: $ docker restart 5ba0a86f36ea Error response from daemon: Cannot restart container 5ba0a86f36ea: [2] Contain..

Printf width specifier to maintain precision of floating-point value

Is there a printf width specifier which can be applied to a floating point specifier that would automatically format the output to the necessary number of significant digits such that when scanning th..

How are environment variables used in Jenkins with Windows Batch Command?

I'm trying to use Jenkins (Global) environment variables in my xcopy script. ${WORKSPACE} doesn't work "${WORKSPACE}" doesn't work '${WORKSPACE}' doesn't work ..

Make docker use IPv4 for port binding

I have docker host and inside I have one container. The docker host is binding the port on IPv6 interface only, not on IPv4. This is the output tcp 0 0 0.0.0.0:22 0.0.0.0:*..

How to replace a string in an existing file in Perl?

I want to replace word "blue" to "red" in all text files named as 1_classification.dat, 2_classification.dat and so on. I want to edit the same file so I tried this code but it does not work. Where am..

Drop all tables command

What is the command to drop all tables in SQLite? Similarly I'd like to drop all indexes...

How do I link object files in C? Fails with "Undefined symbols for architecture x86_64"

So I'm trying trying to use a function defined in another C (file1.c) file in my file (file2.c). I'm including the header of file1 (file1.h) in order to do this. However, I keep getting the following..

calculating execution time in c++

I have written a c++ program , I want to know how to calculate the time taken for execution so I won't exceed the time limit. #include<iostream> using namespace std; int main () { int st[..

Calculating average of an array list?

I'm trying to use the below code to calculate the average of a set of values that a user enters and display it in a jTextArea but it does not work properly. Say, a user enters 7, 4, and 5, the program..

"The transaction log for database is full due to 'LOG_BACKUP'" in a shared host

I have an Asp.Net MVC 5 website with EntityFramework codefirst approach in a shared hosting plan. It uses the open source WebbsitePanel for control panel and its SQL Server panel is somewhat limited. ..

Joining pandas dataframes by column names

I have two dataframes with the following column names: frame_1: event_id, date, time, county_ID frame_2: countyid, state I would like to get a dataframe with the following columns by joining (left..

How to find the statistical mode?

In R, mean() and median() are standard functions which do what you'd expect. mode() tells you the internal storage mode of the object, not the value that occurs the most in its argument. But is there..

List of All Locales and Their Short Codes?

I'm looking for a list of all locales and their short codes for a PHP application I am writing. Is there much variation in this data between platforms? Also, if I am developing an international appli..

ERROR 1049 (42000): Unknown database

I can't seem to login to my tutorial database development environment: Ayman$ mysql -u blog -p blog_development Enter password: ERROR 1049 (42000): Unknown database 'blog_development' I can login..

Set Background color programmatically

I try to set background color programmatically but when I set every one of my colors, the background being black but with any color background being white like the application theme. View someView = ..

jQuery find() method not working in AngularJS directive

I am having trouble with angularjs directives finding child DOM elements with the injected angular element. For example I have a directive like so: myApp.directive('test', function () { return {..

Getting the Username from the HKEY_USERS values

Is there a way to connect between the values under HKEY_USERS to the actual username? I saw some similar questions, but most (if not all) talks about C# code, and my need is in VBScript...

How to check for an active Internet connection on iOS or macOS?

I would like to check to see if I have an Internet connection on iOS using the Cocoa Touch libraries or on macOS using the Cocoa libraries. I came up with a way to do this using an NSURL. The way I d..

Editing in the Chrome debugger

How do I "dynamically" edit JavaScript code in the Chrome debugger? It's not for me, so I don't have access to the source file. I want to edit code and see what effects they have on the page, in this ..

Find and replace - Add carriage return OR Newline

In the case of following string to be parsed. ford mustang,10,blue~~?bugatti veyron,13,black I want to replace the ~~? with a carriage return Replacing with \n just adds the string "\n" How can t..

Running EXE with parameters

I need help in trying to execute an executable from my C# application. Suppose the path is cPath, the EXE is HHTCtrlp.exe and the parameter that has to be passed is cParams. How would I go about this..

Calculate difference in keys contained in two Python dictionaries

Suppose I have two Python dictionaries - dictA and dictB. I need to find out if there are any keys which are present in dictB but not in dictA. What is the fastest way to go about it? Should I conver..

CSS: How to position two elements on top of each other, without specifying a height?

I have two DIVs that I need to position exactly on top of each other. However, when I do that, the formatting gets all screwed up because the containing DIV acts like there is no height. I think this ..

Download file from web in Python 3

I am creating a program that will download a .jar (java) file from a web server, by reading the URL that is specified in the .jad file of the same game/application. I'm using Python 3.2.1 I've manage..

iOS 11, 12, and 13 installed certificates not trusted automatically (self signed)

On our internal network, we use a self-signed CA certificate. This has worked fine for years, in both Safari and our iOS product, all the way through iOS 10. We simply install the CA certificate on an..

Count of "Defined" Array Elements

Given following array: var arr = [undefined, undefined, 2, 5, undefined, undefined]; I'd like to get the count of elements which are defined (i.e.: those which are not undefined). Other than loopi..

How to compile a 64-bit application using Visual C++ 2010 Express?

Is there a simple way to compile a 64 bit app with the 32-bit edition of Visual C++ 2010 Express? What configurations, if any, are necessary?..

How do I pass a list as a parameter in a stored procedure?

Looking to pass a list of User IDs to return a list names. I have a plan to handle the outputed names (with a COALESCE something or other) but trying to find the best way to pass in the list of user I..

Writing/outputting HTML strings unescaped

I've got safe/sanitized HTML saved in a DB table. How can I have this HTML content written out in a Razor view? It always escapes characters like < and ampersands to &amp;...

Post an object as data using Jquery Ajax

My code that I tried is as follows: var dataO = new Object(); dataO.numberId = 1; dataO.companyId = 531; $.ajax({ type: "POST", url: "TelephoneNumbers.aspx/DeleteNumber", data: "{numberId:1,compa..

excel vba getting the row,cell value from selection.address

For i = 1 To 20 '' select the cell in question Cells.Find(...).Select '' get the cell address CellAddr = Selection.Address(False, False, xlR1C1) Next The above is my code for searchin..

How do you loop in a Windows batch file?

What is the syntax for a FOR loop in a Windows batch file?..

getElementsByClassName not working

I coded a php page that displays information from a mysql database neatly into tables. I would like to hide empty table rows with an onLoad event handler. Here is a sample table with code that hides ..

Mapping a JDBC ResultSet to an object

I have a user class that has 16 attributes, things such as firstname, lastname, dob, username, password etc... These are all stored in a MySQL database and when I want to retrieve users I use a Result..

What is the 'realtime' process priority setting for?

From what I've read in the past, you're encouraged not to change the priority of your Windows applications programmatically, and if you do, you should never change them to 'Realtime'. What does the 'R..

How to check Network port access and display useful message?

I was trying to check whether the port is opened or not using powershell like follows. (new-object Net.Sockets.TcpClient).Connect("10.45.23.109", 443) This method works , but the output is not user..

How to close a JavaFX application on window close?

In Swing you can simply use setDefaultCloseOperation() to shut down the entire application when the window is closed. However in JavaFX I can't find an equivalent. I have multiple windows open and I ..

Convert string (without any separator) to list

I have a phone number(string), e.g. "+123-456-7890", that I want to turn into a list that looks like: [+, 1, 2, 3, -, ...., 0]. Why? So I can go iterate through the list and remove all the symbols, ..

How can I use numpy.correlate to do autocorrelation?

I need to do auto-correlation of a set of numbers, which as I understand it is just the correlation of the set with itself. I've tried it using numpy's correlate function, but I don't believe the re..

Page redirect after certain time PHP

There is a certain PHP function for redirecting after some time. I saw it somewhere but can't remember. It's like the gmail redirection after logging in. Please, could anyone remind me?..

Currency Formatting in JavaScript

Possible Duplicate: How can I format numbers as money in JavaScript? I have a form with some simple JavaScript to perform an instant calculation. My problem is that I'm struggling to format..

Parsing CSV / tab-delimited txt file with Python

I currently have a CSV file which, when opened in Excel, has a total of 5 columns. Only columns A and C are of any significance to me and the data in the remaining columns is irrelevant. Starting on ..

To get specific part of a string in c#

I have a string string a = "abc,xyz,wer"; Now, I need a part of this string like string b = "abc"; I need everything before the first comma.How shall I get it?..

How to initialize an array of custom objects

First, as this leads to my question, I'll start by noting that I've worked with XML a fair bit in PowerShell, and like how I can read data from XML files, quickly, into arrays of custom objects. For e..

How different is Scrum practice from Agile Practice?

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

How do you properly use WideCharToMultiByte

I've read the documentation on WideCharToMultiByte, but I'm stuck on this parameter: lpMultiByteStr [out] Pointer to a buffer that receives the converted string. I'm not quite sure how to properly ..

How to create a HTML Table from a PHP array?

How do I create a HTML table from a PHP array? A table with heading as 'title', 'price', and 'number'. $shop = array( array("rose", 1.25, 15), array("daisy", 0.75, 25), array("orchid",..

How to generate classes from wsdl using Maven and wsimport?

When I attempt to run "mvn generate-sources" this is my output : SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J:..

creating an array of structs in c++

I'm trying to create an array of structs. Is the code below valid? I keep getting an expected primary-expression before '{' token error. int main() { int pause; struct Customer { int uid; ..

How to include a quote in a raw Python string

Consider: >>> r"what"ever" SyntaxError: invalid syntax >>> r"what\"ever" 'what\\"ever' So how do we get the quote, but not the slash? And please don't suggest r'what"ever', becau..

How to get data by SqlDataReader.GetValue by column name

I use SqlDataReader.GetValue method to read values from DB: Log.WriteLine("Value of CompanyName column:" + thisReader.GetValue(1)); As parameter GetValue get index of column. How could I specify C..

How to properly create composite primary keys - MYSQL

Here is a gross oversimplification of an intense setup I am working with. table_1 and table_2 both have auto-increment surrogate primary keys as the ID. info is a table that contains information about..

ImportError: No module named scipy

I am using Python 2.7 and trying to get PyBrain to work. But I get this error even though scipy is installed - Traceback (most recent call last): File "<stdin>", line 1, in <module> ..

Can I disable a CSS :hover effect via JavaScript?

I’m trying to prevent the browser from using the :hover effect of the CSS, via JavaScript. I have set the a and a:hover styles in my CSS, because I want a hover effect, if JS isn’t available. But..

How to pull specific directory with git

I have a project with git, and I just want to clone or pull a specific directory, like myproject/javascript just like subversion does. make some changes, commit and push back again. It's possible?..

How can I send an inner <div> to the bottom of its parent <div>?

The div inside another div picture and code below. Because there will be text and images of the parent div. And red div will be the last element of the parent div. <div style="width: 200px; heig..

How do I convert a number to a letter in Java?

Is there a nicer way of converting a number to its alphabetic equivalent than this? private String getCharForNumber(int i) { char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); if (..

How to get number of rows inserted by a transaction

I have to manage a log where i have to see the number of rows that are inserted by a transaction. Is there any way of doing it dynamically ?..

How do I plot only a table in Matplotlib?

Is it possible to draw only a table with matplotlib? If I uncomment the line plt.bar(index, data[row], bar_width, bottom=y_offset, color=colors[row]) of this example code, the plot is still visibl..

Disable form autofill in Chrome without disabling autocomplete

How can we disable Chrome's autofill feature on certain <input>s to prevent them from being automatically populated when the page loads? At the same time I need to keep autocomplete enabled, s..

Malformed String ValueError ast.literal_eval() with String representation of Tuple

I'm trying to read in a string representation of a Tuple from a file, and add the tuple to a list. Here's the relevant code. raw_data = userfile.read().split('\n') for a in raw_data : print a ..

how to check if List<T> element contains an item with a Particular Property Value

public class PricePublicModel { public PricePublicModel() { } public int PriceGroupID { get; set; } public double Size { get; set; } public double Size2 { get; set; } public int[]..

CSS word-wrapping in div

I have a div with a width of 250px. When the innertext is wider than that i want it to break down. The div is float: left and now has an overflow. I want the scrollbar to go away by using word-wrappin..

Chrome javascript debugger breakpoints don't do anything?

I can't seem to figure out the Chrome debugging tool. I have chrome version 21.0.1180.60 m. Steps I took: I pressed ctrl-shift-i to bring up the console. Clicked on Sources then select the relevan..

Overlay with spinner

I'm trying to create an overlay that overlays a page with a spinner in the middle. What's the simplest way to accomplish this? I only need to worry about IE 8 and above...

1052: Column 'id' in field list is ambiguous

I have 2 tables. tbl_names and tbl_section which has both the id field in them. How do I go about selecting the id field, because I always get this error: 1052: Column 'id' in field list is ambiguous..

What are Maven goals and phases and what is their difference?

What is the difference/relation between Maven goals and phases? How they are related to each other?..

Write in body request with HttpClient

I want to write the body of a request with XML content-type but I don't know how with HttpClient Object ( http://hc.apache.org/httpclient-3.x/apidocs/index.html ) DefaultHttpClient httpClient = new D..

unique() for more than one variable

I have the following data frame in R: > str(df) 'data.frame': 545227 obs. of 15 variables: $ ykod : int 93 93 93 93 93 93 93 93 93 93 ... $ yad : Factor w/ 42 levels "BAKUGAN","BARBIE",..: ..

rails simple_form - hidden field - create?

How can you have a hidden field with simple form? The following code: = simple_form_for @movie do |f| = f.hidden :title, "some value" = f.button :submit results in this error: undefined metho..

How do I get the number of days between two dates in JavaScript?

How do I get the number of days between two dates in JavaScript? For example, given two dates in input boxes: <input id="first" value="1/1/2000"/> <input id="second" value="1/1/2001"/> &..

Sorting Characters Of A C++ String

If i have a string is there a built in function to sort the characters or would I have to write my own? for example: string word = "dabc"; I would want to change it so that: string sortedWord = "..

How do I 'git diff' on a certain directory?

git diff actually runs a diff on all source code. How do I do this on a certain directory, so that I can view modifications on files underneath it?..

Jquery/Ajax call with timer

I have a php page that echos out rows from a database. I want to call it via jquery/ajax every 30 seconds. But I also want to be able to call the page at any time so that if I add a record via the for..

How to bind Dataset to DataGridView in windows application

I have created Windows Application. In this, I have multiple tables in dataset, now I want to bind that to a single DataGridView. Can anybody help me?..

Import a file from a subdirectory?

I have a file called tester.py, located on /project. /project has a subdirectory called lib, with a file called BoxTime.py: /project/tester.py /project/lib/BoxTime.py I want to import BoxTime from..

Concatenate two NumPy arrays vertically

I tried the following: >>> a = np.array([1,2,3]) >>> b = np.array([4,5,6]) >>> np.concatenate((a,b), axis=0) array([1, 2, 3, 4, 5, 6]) >>> np.concatenate((a,b), ax..

Checking if an object is null in C#

I would like to prevent further processing on an object if it is null. In the following code I check if the object is null by either: if (!data.Equals(null)) and if (data != null) However, I re..

How to make a div with no content have a width?

I am trying to add a width to a div, but I seem to be running into a problem because it has no content. Here is the CSS and HTML I have so far, but it is not working: CSS body{ margin:0 auto; width:10..

Codeigniter's `where` and `or_where`

I'm trying to specify a query in my model $this->db ->select('*') ->from('library') ->where('library.rating >=', $form['slider']) ->where('library.vo..

Oracle date to string conversion

I have a string column COL1 when I am doing this SELECT TO_CHAR(TO_DATE(COL1,'dd-mon-yy'), 'mm/dd/yyyy') FROM TABLE1 The data in COL1 is in dd-mon-yy, eg: 27-11-89 and 89 is 1989 but the select ret..

What's the best visual merge tool for Git?

What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "ancestor" in separate panels, and a fourth "output" panel. Also, instructio..

How to run .sql file in Oracle SQL developer tool to import database?

I have exported database from Oracle SQL developer tool into .sql file. Now I want to run this file which is of size 500+ MB. I read about running scripts here, but I didn't understand the way. Is th..

Convert JsonObject to String

{ "data": { "map": { "allowNestedValues": true, "create": "2012-12-11 15:16:13", "title": "test201212110004", "transitions": []..

How can I String.Format a TimeSpan object with a custom format in .NET?

What is the recommended way of formatting TimeSpan objects into a string with a custom format?..

How to create timer in angular2

I need a timer in Angular 2, which tick after a time interval and do some task (may be call some functions). How to do this with Angular 2?..

Adobe Acrobat Pro make all pages the same dimension

Does anyone know how to change the dimensions of each page on an Acrobat document. Also how can I see the dimensions of each page seperately?? For example I have a 3 pages document. The first 2 pages..

Creating an empty bitmap and drawing though canvas in Android

I'd like to create an empty bitmap and set a canvas to that bitmap and then draw any shape on the bitmap...

How do I link to Google Maps with a particular longitude and latitude?

I have a small application that gives the current location: longitude and latitude. Now I have to browse to google maps with the longitude and latitude. Please suggest how I can do this...

Populate one dropdown based on selection in another

I need to change the contents of dropdown B based on the selection in dropdown A using javascript. There are no db queries involved--I know beforehand what the contents of B should be given the choic..

How do I use Assert to verify that an exception has been thrown?

How do I use Assert (or other Test class?) to verify that an exception has been thrown? ..

Find and kill a process in one line using bash and regex

I often need to kill a process during programming. The way I do it now is: [~]$ ps aux | grep 'python csp_build.py' user 5124 1.0 0.3 214588 13852 pts/4 Sl+ 11:19 0:00 python csp_build.py..

Fill drop down list on selection of another drop down list

I am using MVC and I am still new with MVC. Can anyone tell me if you can fill a drop down list with data on selection of another drop down list. I want to use Jquery to avoid postbacks and therefore..

Laravel Escaping All HTML in Blade Template

I'm building a small CMS in Laravel and I tried to show the content (which is stored in the DB). It is showing the HTML tags instead of executing them. Its like there is an auto html_entity_decode for..

Static variable inside of a function in C

What will be printed out? 6 6 or 6 7? And why? void foo() { static int x = 5; x++; printf("%d", x); } int main() { foo(); foo(); return 0; } ..

#define macro for debug printing in C?

Trying to create a macro which can be used for print debug messages when DEBUG is defined, like the following pseudo code: #define DEBUG 1 #define debug_print(args ...) if (DEBUG) fprintf(stderr, arg..

Exit from app when click button in android phonegap?

I am new to phonegap. I have prepared one sample application. My application has 2 pages, the first page has one button, when clicked the second page will open. It is working fine using the following ..

latex tabular width the same as the textwidth

I am generating some table as follow: \begin{tabular}[l]{|l|l|l|} \hline Input & Output& Action return \\ \hline \hline DNF & simulation & jsp\\ \hline \end{tabular} How can can I..

Error in strings.xml file in Android

I have declared a long string in string.xml of an application. Declared like this <string name="terms">PLEASE READ THESE TERMS OF USE CAREFULLY BY ACCESSING THIS .................</string..

What is an Endpoint?

I have been reading about OAuth and it keeps talking about endpoints. What is exactly an endpoint?..

NSURLSession/NSURLConnection HTTP load failed on iOS 9

Tried to run my existing app on iOS9 but getting failure while using AFURLSessionManager. __block NSURLSessionDataTask *task = [self.sessionManager dataTaskWithRequest:request completionHandler:^(NSU..

How to get Toolbar from fragment?

I have ActionBarActivity with NavigationDrawer and use support_v7 Toolbar as ActionBar. In one of my fragments toolbar has custom view. In other fragments Toolbar should show title. How get Toolbar i..

static function in C

What is the point of making a function static in C?..

NoSQL Use Case Scenarios or WHEN to use NoSQL

With all the hype it seems really hard to find reliable information on when to use this. So I pose the following questions, and I'm sorry if these are really dumb questions in advance: Should I use ..

What is default list styling (CSS)?

On my website I use reset.css. It adds exactly this to list styles: ol, ul { list-style: none outside none; } html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote,..

Cannot install Aptana Studio 3.6 on Windows

I'd like to use Aptana Studio for Rails development under Windows. I currently have different dev tools & ide's up and running (like git/ruby/jdk) and I'd like to install Aptana Studio as well but..

Executing command line programs from within python

I'm building a web application that will is going to manipulate (pad, mix, merge etc) sound files and I've found that sox does exactly what I want. Sox is a linux command line program and I'm feeling ..

How can I use a local image as the base image with a dockerfile?

I'm working on a dockerfile. I just realised that I've been using FROM with indexed images all along. So I wonder: How can I use one of my local (custom) images as my base (FROM) image without push..

Python: avoid new line with print command

I've started programming today and have this issue with Python. It's pretty dumb but I can't figure out how to do it. When I use the print command, it prints whatever I want and then goes to a differe..

AngularJS : ng-click not working

I am new in AngularJs, ng-click is not working as expected. I searched on the internet , Follow the tutorial , (that was working) - but this is not working!!! My Code: <div class="row" ng:repeat..

error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj

I was converting my projects from VS2010 to VS2012.But I am getting an _MSC_VER linker error in certain projects. After a long surfing through google I found out that the issue is due to linking of a ..

Display QImage with QtGui

I am new to Qt, and I am trying to create a simple GUI Application that displays an image once a button has been clicked on. I can read the image in a QImage object, but is there any simple way to ca..

What's the scope of a variable initialized in an if statement?

I'm new to Python, so this is probably a simple scoping question. The following code in a Python file (module) is confusing me slightly: if __name__ == '__main__': x = 1 print x In other langu..

Finding all possible permutations of a given string in python

I have a string. I want to generate all permutations from that string, by changing the order of characters in it. For example, say: x='stack' what I want is a list like this, l=['stack','satck','s..

Multi-line bash commands in makefile

Considering that every command is run in its own shell, what is the best way to run a multi-line bash command in a makefile? For example, like this: for i in `find` do all="$all $i" done..

How to remove constraints from my MySQL table?

I want to remove constraints from my table. My query is: ALTER TABLE `tbl_magazine_issue` DROP CONSTRAINT `FK_tbl_magazine_issue_mst_users` But I got an error: #1064 - You have an error in you..

Compare and contrast REST and SOAP web services?

I currently figure out the similar is both using internet protocol (HTTP) to exchange data between consumer and provider. The difference is: SOAP is a XML-based message protocol, while REST is an ..

Why an abstract class implementing an interface can miss the declaration/implementation of one of the interface's methods?

A curious thing happens in Java when you use an abstract class to implement an interface: some of the interface's methods can be completely missing (i.e. neither an abstract declaration or an actual i..

Select only rows if its value in a particular column is less than the value in the other column

I am using R and need to select rows with aged (age of death) less than or equal to laclen (lactation length). I am trying to create a new data frame to only include rows/ids whereby the value of colu..

Getting the 'external' IP address in Java

I'm not too sure how to go about getting the external IP address of the machine as a computer outside of a network would see it. My following IPAddress class only gets the local IP address of the mac..

Using a string variable as a variable name

Possible Duplicate: How do I do variable variables in Python? I have a variable with a string assigned to it and I want to define a new variable based on that string. foo = "bar" foo = "s..

CSV parsing in Java - working example..?

I want to write a program for a school java project to parse some CSV I do not know. I do know the datatype of each column - although I do not know the delimiter. The problem I do not even marginally..

How to fast-forward a branch to head?

I switched to master after developing on a branch for a long time. The log shows: Your branch is behind 'origin/master' by 167 commits, and can be fast-forwarded. I tried: git checkout HEAD I..

Having Django serve downloadable files

I want users on the site to be able to download files whose paths are obscured so they cannot be directly downloaded. For instance, I'd like the URL to be something like this: http://example.com/down..

In C#, can a class inherit from another class and an interface?

I want to know if a class can inherit from a class and an interface. The example code below doesn't work but I think it conveys what I want to do. The reason that I want to do this is because at my c..

How can I compile a Java program in Eclipse without running it?

I would like to compile my Java program in Eclipse but not to run it. I can't understand how to do it. How can I compile a Java program to .class files in Eclipse without running it?..

NumPy ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I was calculating eigenvectors and eigenvalues of a matrix in NumPy and just wanted to check the results via assert(). This would throw a ValueError that I don't quite understand, since printing those..

How to refresh page on back button click?

I use .htaccess to route all of my traffic to a single index.php file. The code below to directs traffic, but for some reason it doesn't work with the back button. I don't know what to do to get the b..

Android: Storing username and password?

If I want to store the username and password to be used inside an Android application, what is the best way to do it? Is it through the preferences screen (but what if the user misses this?), or pop u..

Search and get a line in Python

Is there a way to search, from a string, a line containing another string and retrieve the entire line? For example: string = qwertyuiop asdfghjkl zxcvbnm token qwerty asdfghj..

How to disable SSL certificate checking with Spring RestTemplate?

I am trying to write an integration test where our test launches an embedded HTTPS server using Simple. I created a self-signed certificate using keytool and am able to access the server using a brows..

Replace Div with another Div

I have this thing I m trying to do. I have a main picture of a map and within that map there are regions. These regions have hot spots on them so you can click them and it will replace the whole map w..

Sleep function Visual Basic

Is there a simple sleep function in Visual Basic that doens't involve thread. Something similiar like there exists in: C: sleep(1); We also tried this code: Declare Sub Sleep Lib "kernel32" (ByVal..

How to use multiple conditions (With AND) in IIF expressions in ssrs

I just want to hide rows in SSRS report having Zero Quantity.. There are following multiple Quantity Columns like Opening Stock , Gross Dispatched,Transfer Out, Qty Sold, Stock Adjustment and Closing ..

How to replace local branch with remote branch entirely in Git?

I have two branches: local branch (the one which I work with) remote branch (public, only well-tested commits go there) Recently I seriously messed up my local branch. How would I replace the loc..

Nexus 5 USB driver

I want to develop and debug Nexus 5 with ADT (based on Eclipse) in Windows 7 x64. As I connect Nexus 5, it appears in Windows in Explorer, so I can transfer files to/from Nexus. Next step I enable U..

Send an Array with an HTTP Get

How can i send an Array with a HTTP Get request? I'm Using GWT client to send the request...

CSS/HTML: What is the correct way to make text italic?

What is the correct way to make text italic? I have seen the following four approaches: <i>Italic Text</i> <em>Italic Text</em> <span class="italic">Italic Text</sp..

Set Locale programmatically

My app supports 3 (soon 4) languages. Since several locales are quite similar I'd like to give the user the option to change locale in my application, for instance an Italian person might prefer Spani..

adding .css file to ejs

im working on node.js(express) with ejs and im not able to include a .css file to it.i tried the same thing seperately as a html-css duo and it worked fine...how can i include the same in my .ejs fil..

What is the difference between Double.parseDouble(String) and Double.valueOf(String)?

I want to convert String to a Double data type. I do not know if I should use parseDouble or valueOf. What is the difference between these two methods?..

Using Service to run background and create notification

I want my app to start Service when the button is clicked and the Service should run in background to show a notification at a particular time of day. I have the following code to do this. But it show..

How to parse Excel (XLS) file in Javascript/HTML5

I am able to read Excel file via FileReader but it outputs text as well as weird characters with it. I need to read xls file row-wise, read data in every column and convert it to JSON. How to read x..

How to keep form values after post

I am trying to find what the easiest way to keep form values after post. I am really trying to have to keep from learning ajax right this second for the one form, Plus I am not sure how hard it would ..

Using gdb to single-step assembly code outside specified executable causes error "cannot find bounds of current function"

I'm outside gdb's target executable and I don't even have a stack that corresponds to that target. I want to single-step anyway, so that I can verify what's going on in my assembly code, because I'm ..

Unable to set variables in bash script

I am attempting to automate moving files from a folder to a new folder automatically every night using a bash script run from AppleScript on a schedule. I am attempting to write a bash script on Mac O..

Disable sorting for a particular column in jQuery DataTables

I am using the jQuery DataTables plugin to sort the table fields. My question is: how do I disable sorting for a particular column? I have tried with the following code, but it did not work: "aoColum..

How to embed PDF file with responsive width

I'm embedding pdf files using something like this: <div class="graph-outline"> <object style="width:100%;" data="path/to/file.pdf?#zoom=85&scrollbar=0&toolbar=0&navpanes=0" t..

Create empty data frame with column names by assigning a string vector?

Create an empty data frame: y <- data.frame() Assign x, a string vector, to y as its column names: x <- c("name", "age", "gender") colnames(y) <- x ..

How to iterate (keys, values) in JavaScript?

I have a dictionary that has the format of dictionary = {0: {object}, 1:{object}, 2:{object}} How can I iterate through this dictionary by doing something like for((key,value) in dictionary){..

Convert hex string (char []) to int?

I have a char[] that contains a value such as "0x1800785" but the function I want to give the value to requires an int, how can I convert this to an int? I have searched around but cannot find an answ..

Can you "compile" PHP code and upload a binary-ish file, which will just be run by the byte code interpreter?

I know that PHP is compiled to byte code before it is run on the server, and then that byte code can be cached so that the whole script doesn't have to be re-interpreted with every web access. But ca..

SQLException: No suitable driver found for jdbc:derby://localhost:1527

I get this error in Netbeans: java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/ How is this caused and how can I solve it?..

Using Spring MVC Test to unit test multipart POST request

I have the following request handler for saving autos. I have verified that this works when I use e.g. cURL. Now I want to unit test the method with Spring MVC Test. I have tried to use the fileUpload..

Detecting when a div's height changes using jQuery

I've got a div that contains some content that's being added and removed dynamically, so its height is changing often. I also have a div that is absolutely positioned directly underneath with javascri..

Nullable DateTime conversion

Possible Duplicate: c# why cant a nullable int be assigned null as a value Im trying to convert my reader[3] object which is datetime to be null if there is no lastPostDate for a Forum but ..

SQL Query - SUM(CASE WHEN x THEN 1 ELSE 0) for multiple columns

I'm looking to see if there is a better approach to the query below. What I'm trying to do is create a summary report, compiling stats by date. SELECT CAST(Detail.ReceiptDate AS DATE) AS 'DATE' , S..

C++ where to initialize static const

I have a class class foo { public: foo(); foo( int ); private: static const string s; }; Where is the best place to initialize the string s in the source file?..

Python TypeError must be str not int

I am having trouble with the following piece of code: if verb == "stoke": if items["furnace"] >= 1: print("going to stoke the furnace") if items["coal"] >=..

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