Questions Tagged with #Preconditions

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.

I have been trying from a couple of days to resolve the following error but I am unable to resolve it :( My module's pom.xml file is: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xs..

REST response code for invalid data

What response code should be passed to client in case of following scenarios? Invalid data passed while user registration like wrong email format User name/ Email is already exists I chose 403. I ..

Check whether $_POST-value is empty

if(isset($_POST['submit'])) { if(!isset($_POST['userName'])) { $username = 'Anonymous'; } else $username = $_POST['userName']; } I cannot get the $username to be "Anonymous..

How using try catch for exception handling is best practice

while maintaining my colleague's code from even someone who claims to be a senior developer, I often see the following code: try { //do something } catch { //Do nothing } or sometimes they write ..

NuGet Package Restore Not Working

I checked in a project on one computer, checked out on another, and find that the binaries installed by NuGet are missing. I could check them in to source control as well, but it looks like there's a..

How to make image hover in css?

I want to change the image from normal to brighter when it's on hover, My code: <div class="nkhome"> <a href="Home.html"><img src="Images/btnhome.png" /></a> &..

How to import a JSON file in ECMAScript 6?

How can I access a JSON file in ECMAScript 6? The following doesn't work: import config from '../config.json' This works fine if I try to import a JavaScript file...

C# how to create a Guid value?

One field of our struct is Guid type. How to generate a valid value for it?..

Support for ES6 in Internet Explorer 11

According to this page http://kangax.github.io/compat-table/es6/, ES6 features are not implemented in IE 11. Does IE 11 have a plan for implementing them one day or can I forget about it? Is there a..

Adding onClick event dynamically using jQuery

Due to a plugin being used, I can't add the "onClick" attribute to the HTML form inputs like usual. A plugin is handling the forms part in my site and it doesn't give an option to do this automaticall..

Getting only Month and Year from SQL DATE

I need to access only Month.Year from Date field in SQL Server...

Opening a .ipynb.txt File

I have got downloaded a file that got downloaded in a format .pynb.txt extension. Can anyone help me to figure how to make it in a readable format? Attaching a screenshot of the file when i tried open..

Storyboard - refer to ViewController in AppDelegate

consider the following scenario: I have a storyboard-based app. I add a ViewController object to the storyboard, add the class files for this ViewController into the project and specify the name of th..

app.config for a class library

I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists. Is it a bad thing to add an app.config ma..

GET and POST methods with the same Action name in the same Controller

Why is this incorrect? { public class HomeController : Controller { [HttpGet] public ActionResult Index() { Some Code--Some Code---Some Code r..

How to find the path of Flutter SDK

How to configure Flutter SDK? How to locate the Flutter SDK? I don't know the location of the SDK file. ..

Selecting Values from Oracle Table Variable / Array?

Following on from my last question (Table Variables in Oracle PL/SQL?)... Once you have values in an array/table, how do you get them back out again? Preferably using a select statement or something..

Subtracting 1 day from a timestamp date

I am using Datagrip for Postgresql. I have a table with a date field in timestamp format (ex: 2016-11-01 00:00:00). I want to be able to: apply a mathematical operator to subtract 1 day filter it..

Difference between 2 dates in SQLite

How do I get the difference in days between 2 dates in SQLite? I have already tried something like this: SELECT Date('now') - DateCreated FROM Payment It returns 0 every time...

Why has it failed to load main-class manifest attribute from a JAR file?

I have created a JAR file in this way jar cf jar-file input-files. Now, I'm trying to run it. Running it does not work (jre command is not found): jre -cp app.jar MainClass This does not work eithe..

Convert DateTime to TimeSpan

I want to convert a DateTime instance into a TimeSpan instance, is it possible? I've looked around but I couldn't find what I want, I only find time difference. More specifically, I want to convert ..

What is makeinfo, and how do I get it?

I'm trying to build GNU grep, and when I run make, I get: [snip] /bin/bash: line 9: makeinfo: command not found What is makeinfo, and how do I get it? (This is Ubuntu, if it makes a difference)..

iOS 7 App Icons, Launch images And Naming Convention While Keeping iOS 6 Icons

I just finished an app on iOS 6 and bought a developer account a week ago so haven't had much time playing with the iOS 7 SDK. Just downloaded the Golden Master version and trying to upgrade my app to..

Why does my sorting loop seem to append an element where it shouldn't?

I am trying to sort an array of Strings using compareTo(). This is my code: static String Array[] = {" Hello ", " This ", "is ", "Sorting ", "Example"}; String temp; public static void main(String[]..

CSS image resize percentage of itself?

I am trying to resize an img with a percentage of itself. For example, I just want to shrink the image by half by resizing it to 50%. But applying width: 50%; will resize the image to be 50% of the co..

How do I setup a SSL certificate for an express.js server?

Before, in an older version of express, I could do this: express.createServer({key:'keyFile', cert:'certFile'}); However, in newer versions of express this no longer works: var app = express(); ..

Combine two or more columns in a dataframe into a new column with a new name

For example if I have this: n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b) n s b 1 2 aa TRUE 2 3 bb FALSE 3 5 cc TRUE Then how do I combine th..

How to cast/convert pointer to reference in C++

How can I pass a pointer (Object *ob) to a function which prototype is void foo(Object &) ?..

Angular directives - when and how to use compile, controller, pre-link and post-link

When writing an Angular directive, one can use any of the following functions to manipulate the DOM behaviour, contents and look of the element on which the directive is declared: compile controller ..

How to replace multiple substrings of a string?

I would like to use the .replace function to replace multiple strings. I currently have string.replace("condition1", "") but would like to have something like string.replace("condition1", "").r..

What is a good alternative to using an image map generator?

I have a large image and I want to make certain sections of the image clickable. I also want to specify the shape of the clickable area (square, circle, custom). Without relying on Javascript, how c..

How can I add a username and password to Jenkins?

When I go to mydomain.com:8080 there is no authorization mechanism by default. I have had look at the configuration area but cannot find anywhere to add a basic username and password..

Run JavaScript in Visual Studio Code

Is there a way to execute JavaScript and display the results using Visual Studio Code? For example, a script file containing: console.log('hello world'); I assume that Node.js would be needed but ..

What would be the Unicode character for big bullet in the middle of the character?

I want something like 0x2022 8226 BULLET • But bigger. I can't even seem to find them at http://www.ssec.wisc.edu/~tomw/java/unicode.html What should I search for? Dots? bullets?..

Default optional parameter in Swift function

When I set firstThing to default nil this will work, without the default value of nil I get a error that there is a missing parameter when calling the function. By typing Int? I thought it made it op..

Count how many rows have the same value

How do i write an SQL query to count the total number of a specific num value in the num column of a table. e.g. select where num = 1 result: 2 +-----+-----+ | NAME | NUM | +=====+=====+ | SAM | ..

Apply vs transform on a group object

Consider the following dataframe: columns = ['A', 'B', 'C', 'D'] records = [ ['foo', 'one', 0.162003, 0.087469], ['bar', 'one', -1.156319, -1.5262719999999999], ['foo', 'two', 0.833892, -1..

What is the difference between \r and \n?

How are \r and \n different? I think it has something to do with Unix vs. Windows vs. Mac, but I'm not sure exactly how they're different, and which to search for/match in regexes...

MySql Error: 1364 Field 'display_name' doesn't have default value

I have just switched from a MAMP installation to a native Apache, MySql and PHP installation. I have got everything working, but I have started using my web app in the new environment and suddenly any..

Creating a new directory in C

I want to write a program that checks for the existence of a directory; if that directory does not exist then it creates the directory and a log file inside of it, but if the directory already exists,..

Xcode : Adding a project as a build dependency

Im playing around with the soundcloud api, in its instructions it says to drag SoundCloudAPI.xcodeproj into your project add it as a build dependency I can drag the project in pretty easily, but h..

How to fix a locale setting warning from Perl

When I run perl, I get the warning: perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "en_US.UTF-8"..

javac: invalid target release: 1.8

I recently downloaded JDK 1.8.0.0_06 that comes bundled with NetBeans. I then got to find out that my JavaFx project, that I have been developing in Java 1.7 won't compile in Java 1.8, and so I steppe..

How to put a horizontal divisor line between edit text's in a activity

I'm making an activity to configure my app, and I have to divide the sections of my configuration window with a line. I used this: divider_horizontal_bright, from this example: http://android.cryx.li..

How to dynamically add and remove form fields in Angular 2

I'm trying to add input fields dynamically while the user clicks the add button and for each form field there must be a remove button, when the user clicks that the form fields must be removed, I need..

here-document gives 'unexpected end of file' error

I need my script to send an email from terminal. Based on what I've seen here and many other places online, I formatted it like this: /var/mail -s "$SUBJECT" "$EMAIL" << EOF Here's a line of my..

Remove table row after clicking table row delete button

Solution can use jQuery or be plain JavaScript. I want to remove a table row after user has clicked the corresponding button contained in the table row cell so for example: <script> function S..

In python, how do I cast a class object to a dict

Let's say I've got a simple class in python class Wharrgarbl(object): def __init__(self, a, b, c, sum, version='old'): self.a = a self.b = b self.c = c self.sum = ..

React js onClick can't pass value to method

I want to read the onClick event value properties. But when I click on it, I see something like this on the console: SyntheticMouseEvent {dispatchConfig: Object, dispatchMarker: ".1.1.0.2.0.0:1", na..

CSS horizontal scroll

I'm trying to create a <div> with a series of photos which are horizontally scrollable only. It should look something like this LINK; However the above is only achieved by specifying a width..

Multiline string literal in C#

Is there an easy way to create a multiline string literal in C#? Here's what I have now: string query = "SELECT foo, bar" + " FROM table" + " WHERE id = 42"; I know PHP has <<<BLOCK BLO..

How to fix "'System.AggregateException' occurred in mscorlib.dll"

I'm receiving an unhandled exception while debugging, and the program stops executing. The debugger doesn't show me the line so I don't know what to fix. An unhandled exception of type 'System.Agg..

Python: Converting string into decimal number

I have a python list with strings in this format: A1 = [' "29.0" ',' "65.2" ',' "75.2" '] How do I convert those strings into decimal numbers to perform arithmetic operations on the list elements?..

Android Split string

I have a string called CurrentString and is in the form of something like this "Fruit: they taste good". I would like to split up the CurrentString using the : as the delimiter.So that way the word "..

How to fade changing background image

I want to fade the images when I do this code: $("#large-img").css('background-image', 'url('+$img+')'); I've tried putting fade in so many places. Thanks..

Is there a Max function in SQL Server that takes two values like Math.Max in .NET?

I want to write a query like this: SELECT o.OrderId, MAX(o.NegotiatedPrice, o.SuggestedPrice) FROM Order o But this isn't how the MAX function works, right? It is an aggregate function so it expec..

Generating an MD5 checksum of a file

Is there any simple way of generating (and checking) MD5 checksums of a list of files in Python? (I have a small program I'm working on, and I'd like to confirm the checksums of the files)...

Referencing Row Number in R

How do I reference the row number of an observation? For example, if you have a data.frame called "data" and want to create a variable data$rownumber equal to each observation's row number, how would ..

Java: Check if command line arguments are null

I am looking to do some error checking for my command line arguments public static void main(String[] args) { if(args[0] == null) { System.out.println("Proper Usage is: java program f..

jQuery Datepicker onchange event issue

I have a JS code in which when you change a field it calls a search routine. The problem is that I can't find any jQuery events that will fire when the Datepicker updates the input field. For some re..

How to find the first and second maximum number?

I am trying to find first highest number and second highest number in excel. What shall i do for that. I did not find the right formula. Note: I have already used the large and max formula. =LARGE(E..

Text on image mouseover?

I am trying to get a small box to appear on the bottom-left side of an image when a mouse moves over it. Inside the box there will be a link to a different page. Here is somewhat similar to what I wa..

Matplotlib/pyplot: How to enforce axis range?

I would like to draw a standard 2D line graph with pylot, but force the axes' values to be between 0 and 600 on the x, and 10k and 20k on the y. Let me go with an example... import pylab as p p.tit..

Best radio-button implementation for IOS

I would like to ask if there are examples out there on how to implement radio-button options on an iPhone app. I find the Picker View quite big for a simple selection feature. I'm not sure if Apple ..

Wait until boolean value changes it state

I have a thread which wait for a boolean value to change like this: while(!value) { Thread.sleep(1000) } // Do some work after change of the value This is not my prefered way to do this, cause of..

How to do scanf for single char in C

In C: I'm trying to get char from the user with scanf and when I run it the program don't wait for the user to type anything... This is the code: char ch; printf("Enter one char"); scanf("%c", &..

How can I pass a parameter to a Java Thread?

Can anyone suggest to me how I can pass a parameter to a thread? Also, how does it work for anonymous classes?..

How to get child element by ID in JavaScript?

I have following html: <div id="note"> <textarea id="textid" class="textclass">Text</textarea> </div> How can I get textarea element? I can't use document.getElementById("te..

Change icon-bar (?) color in bootstrap

I want to change ? color. HTML: <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#menu"> <span class="sr-only">Toggle menu navigation</span> <..

HTTP Content-Type Header and JSON

I have always been trying to avoid using most of the HTTP protocol's properties for the sake of fear of the unknown. However, I said to myself that I'm going to face fear today and start using header..

PHP post_max_size overrides upload_max_filesize

In my site host, I have seen (via phpinfo) that post_max_size = 8Mb upload_max_filesize = 16Mb This led me to think that I should be able to upload as file as big as 16Mb. However, when I do this..

PHP shorthand for isset()?

Is there a shorthand way to assign a variable to something if it doesn't exist in PHP? if(!isset($var) { $var = ""; } I'd like to do something like $var = $var | ""; ..

HTML5 Canvas Resize (Downscale) Image High Quality?

I use html5 canvas elements to resize images im my browser. It turns out that the quality is very low. I found this: Disable Interpolation when Scaling a <canvas> but it does not help to increas..

How should strace be used?

A colleague once told me that the last option when everything has failed to debug on Linux was to use strace. I tried to learn the science behind this strange tool, but I am not a system admin guru a..

What are the differences between virtual memory and physical memory?

I am often confused with the concept of virtualization in operating systems. Considering RAM as the physical memory, why do we need the virtual memory for executing a process? Where does this virtual..

What does enumerate() mean?

What does for row_number, row in enumerate(cursor): do in Python? What does enumerate mean in this context?..

How do I perform an IF...THEN in an SQL SELECT?

How do I perform an IF...THEN in an SQL SELECT statement? For example: SELECT IF(Obsolete = 'N' OR InStock = 'Y' ? 1 : 0) AS Saleable, * FROM Product ..

What does -> mean in Python function definitions?

I've recently noticed something interesting when looking at Python 3.3 grammar specification: funcdef: 'def' NAME parameters ['->' test] ':' suite The optional 'arrow' block was absent in Python..

How to use custom font in a project written in Android Studio

I was trying to use custom font in Android Studio as we did in Eclipse. But unfortunately could not figure out where to put the 'assets' folder!..

Can I specify multiple users for myself in .gitconfig?

In my ~/.gitconfig, I list my personal email address under [user], since that's what I want to use for Github repos. But, I've recently started using git for work, too. My company's git repo allows m..

Efficiently counting the number of lines of a text file. (200mb+)

I have just found out that my script gives me a fatal error: Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 440 bytes) in C:\process_txt.php on line 109 That line ..

Redirect with CodeIgniter

Can anyone tell me why my redirect helper does not work the way I'd expect it to? I'm trying to redirect to the index method of my main controller, but it takes me www.mysite.com/index/provider1/ when..

How to check if DST (Daylight Saving Time) is in effect, and if so, the offset?

This is a bit of my JS code for which this is needed: var secDiff = Math.abs(Math.round((utc_date-this.premiere_date)/1000)); this.years = this.calculateUnit(secDiff,(86400*365)); this.days = this.ca..

How to pipe list of files returned by find command to cat to view all the files

I am doing a find and then getting a list of files. How do I pipe it to another utility like cat (so that cat displays the contents of all those files) and basically need to grep something from these ..

Extract names of objects from list

I have a list of objects. How do I grab the name of just one object from the list? As in: LIST <- list(A=1:5, B=1:10) LIST$A some.way.cool.function(LIST$A) #function I hope exists "A" #yay! it..

Why do we not have a virtual constructor in C++?

Why does C++ not have a virtual constructor?..

Get started with Latex on Linux

Impressed by is-latex-worth-learning-today, and many how-to's on Windows, How do you have someone started with LaTeX on Linux? How do you generate a pdf out of it and give up the OOO Word processer?..

How can I loop through a List<T> and grab each item?

How can I loop through a List and grab each item? I want the output to look like this: Console.WriteLine("amount is {0}, and type is {1}", myMoney.amount, myMoney.type); Here is my code: static ..

How to request a random row in SQL?

How can I request a random row (or as close to truly random as is possible) in pure SQL?..

What is the HTML5 equivalent to the align attribute in table cells?

I'm refactoring an old site, and that maze is full of tables. We're moving to HTML5 and I need to fix a table full of <td align="center"> code. I found a partial solution by creating a class..

Disable cache for some images

I generate some images using a PHP lib. Sometimes the browser does not load the new generated file. How can I disable cache just for images created dynamically by me? Note: I have to use same name..

The mysqli extension is missing. Please check your PHP configuration

I have looked through all of the forums that I could find relevant to this question and my problem yet nothing works. I have apache2.2 with php5, phpMyAdmin, and MySQL. I have uncommented the extensio..

jQuery: Handle fallback for failed AJAX Request

Can jQuery provide a fallback for failed AJAX calls? This is my try: function update() { var requestOK = false; $.getJSON(url, function(){ alert('request successful'); reques..

What is an IIS application pool?

What exactly is an application pool? What is its purpose?..

PHP foreach loop key value

I am running this DB call to get me multi-dimensional array I am trying to get the keys of each but when I try it comes up blank or as array. $root_array = array(); $sites = $this->sites($membe..

Copying files from one directory to another in Java

I want to copy files from one directory to another (subdirectory) using Java. I have a directory, dir, with text files. I iterate over the first 20 files in dir, and want to copy them to another direc..

How to reset Jenkins security settings from the command line?

Is there a way to reset all (or just disable the security settings) from the command line without a user/password as I have managed to completely lock myself out of Jenkins?..

Change image source in code behind - Wpf

I need to set image source dynamically, please note my image is in somewhere on the Network, here is my code BitmapImage logo = new BitmapImage(); logo.BeginInit(); logo.UriSource = new Uri(@"pack://..

Errors: "INSERT EXEC statement cannot be nested." and "Cannot use the ROLLBACK statement within an INSERT-EXEC statement." How to solve this?

I have three stored procedures Sp1, Sp2 and Sp3. The first one (Sp1) will execute the second one (Sp2) and save returned data into @tempTB1 and the second one will execute the third one (Sp3) and sav..

Adding an HTTP Header to the request in a servlet filter

I'm integrating with an existing servlet that pulls some properties out of the HTTP header. Basically, I'm implementing an interface that doesn't have access to the actual request, it just has access..

Tooltip with HTML content without JavaScript

There are plenty of JavaScript-based libraries that show tooltips when you hover your mouse over a certain area of a web page. Some are rather plain, some allow the tooltip to display HTML content sty..

How to disable compiler optimizations in gcc?

I am trying to learn assembly language. I have searched and found how to disassemble a .c file but I think it produces some optimized version of the program. Is there any way so that I can see the exa..

executing shell command in background from script

how can I execute a shell command in the background from within a bash script, if the command is in a string? For example: #!/bin/bash cmd="nohup mycommand"; other_cmd="nohup othercommand"; "$cmd &..

Escaping a forward slash in a regular expression

My question is a simple one, and it is about regular expression escaping. Do you have to escape a forward slash / in a regular expression? And how would you go about doing it?..

Accessing nested JavaScript objects and arrays by string path

I have a data structure like this : var someObject = { 'part1' : { 'name': 'Part 1', 'size': '20', 'qty' : '50' }, 'part2' : { 'name': 'Part 2', 's..

R - " missing value where TRUE/FALSE needed "

I'm trying to execute the following code in R comments = c("no","yes",NA) for (l in 1:length(comments)) { if (comments[l] != NA) print(comments[l]); } But I'm getting an error Error in if (com..

How do I make an auto increment integer field in Django?

I am making an Order model for a shopping cart and I need to make a field that auto increments when the order is made: class Order(models.Model): cart = models.ForeignKey(Cart) add_date = mod..

How to set different colors in HTML in one statement?

I'm thinking of having different color of text in one line. How could that be possible? <p style="color:#4C4C4C;font-weight:bold;font-family:Calibri;font-size:20"> My Name is: <"color:#FF..

How to error handle 1004 Error with WorksheetFunction.VLookup?

I have this code: Dim wsFunc As WorksheetFunction: Set wsFunc = Application.WorksheetFunction Dim ws As Worksheet: Set ws = Sheets("2012") Dim rngLook As Range: Set rngLook = ws.Range("A:M") 'within..

Visual Studio 2013 Install Fails: Program Compatibility Mode is on (Windows 10)

I want to install Visual Studio Ultimate 2013 on my Windows 10 but I have this error: I have done these two things (they have solved the problem on Windows 8) but still I cannot install it. ..

CURL and HTTPS, "Cannot resolve host"

I'm trying to fetch the contents of a page using CURL. The page that is doing the fetching is https and the page it is trying to fetch is also https. I'm getting an error "Couldn't resolve host" wit..

Remove a string from the beginning of a string

I have a string that looks like this: $str = "bla_string_bla_bla_bla"; How can I remove the first bla_; but only if it's found at the beginning of the string? With str_replace(), it removes all bl..

How to format strings using printf() to get equal length in the output

I have two functions, one which produces messages like Starting initialization... and another which checks return codes and outputs "Ok", "Warning" or "Error". However, t..

IntelliJ, can't start simple web application: Unable to ping server at localhost:1099

I'm trying to make a simple web app in IntelliJ by following this tutorial: http://wiki.jetbrains.net/intellij/Creating_a_simple_Web_application_for_Tomcat_in_IntelliJ_IDEA_12 I believe my Tomcat is ..

Datatable to html Table

I have question, that maybe someone here wouldn't mind to help me with. I have lets say 3 datatables, each one of them has the following columns: size, quantity, amount, duration Name of datatables an..

Setting the height of a SELECT in IE

IE seems to ignore the height set in CSS when rendering a HTML SELECT. Are there any work around's for this or do we have to just accept IE will not look as good as other browsers?..

How to access the local Django webserver from outside world

I followed the instructions here to run Django using the built-in webserver and was able to successfully run it using python manage.py runserver. If I access 127.0.0.1:port locally from the webserver..

how to avoid a new line with p tag?

How can I stay on the same line while working with <p> tag?..

How can I detect if this dictionary key exists in C#?

I am working with the Exchange Web Services Managed API, with contact data. I have the following code, which is functional, but not ideal: foreach (Contact c in contactList) { string openItemUrl ..

What does LINQ return when the results are empty

I have a question about LINQ query. Normally a query returns a IEnumerable<T> type. If the return is empty, not sure if it is null or not. I am not sure if the following ToList() will throw an e..

How to make a div center align in HTML

Possible Duplicate: How to horizontally center a div? One simple way to make an object centered in HTML is using align='center', but it's not working for a div. I tried: style='text-alig..

How to skip the OPTIONS preflight request?

I had developed a PhoneGap app which is now being transformed to a mobile website. Everything works smoothly besides one small glitch. I use a certain third party API via a POST request, which works f..

Force sidebar height 100% using CSS (with a sticky bottom image)?

I've been banging my head against the wall for hours trying to figure out this issue and think it must be something small I'm missing. I've searched online, but nothing I have found seems to work. T..

Fatal error: Maximum execution time of 30 seconds exceeded

I am downloading a JSON file from an online source and and when it runs through the loop I am getting this error: Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\temp\fet..

Username and password in https url

Consider the URL: https://foo:password@example.com Does the username/password portion in the above example qualify as a "URL parameter", as defined in this question?..

Convert a bitmap into a byte array

Using C#, is there a better way to convert a Windows Bitmap to a byte[] than saving to a temporary file and reading the result using a FileStream?..

docker error - 'name is already in use by container'

Running the docker registry with below command always throws an error: dev:tmp me$ docker run \ -d --name registry-v1 \ -e SETTINGS_FLAVOR=local \ -e STORAGE_PATH=/registry \ -e S..

Android Viewpager as Image Slide Gallery

I am using Jake's ViewPageIndicator and want to display Images like a swipe gallery. Any refernce link where i can get started. I have implemented the basic viewpager and now want to implement image v..

no suitable HttpMessageConverter found for response type

Using spring, with this code : List<HttpMessageConverter<?>> messageConverters = restTemplate.getMessageConverters(); for(HttpMessageConverter httpMessageConverter : messageConverters){ ..

SQL Developer with JDK (64 bit) cannot find JVM

I just wasted one morning trying to get SQL developer to work on my current setup: OS: Windows 8.1 virtual machine running on mac via Parallels. No oracle client or instant client installed No Java i..

Remove items from one list in another

I'm trying to figure out how to traverse a generic list of items that I want to remove from another list of items. So let's say I have this as a hypothetical example List<car> list1 = GetTheLi..

What should my Objective-C singleton look like?

My singleton accessor method is usually some variant of: static MyClass *gInstance = NULL; + (MyClass *)instance { @synchronized(self) { if (gInstance == NULL) gInstance ..

Converting stream of int's to char's in java

This has probably been answered else where but how do you get the character value of an int value? Specifically I'm reading a from a tcp stream and the readers .read() method returns an int. How do ..

How do I declare a namespace in JavaScript?

How do I create a namespace in JavaScript so that my objects and functions aren't overwritten by other same-named objects and functions? I've used the following: if (Foo == null || typeof(Foo) != "ob..

How to start IDLE (Python editor) without using the shortcut on Windows Vista?

I'm trying to teach Komodo to fire up IDLE when I hit the right keystrokes. I can use the exact path of the shortcut in start menu in the Windows Explorer location bar to launch IDLE so I was hoping ..

Using variables inside strings

In PHP I can do the following: $name = 'John'; $var = "Hello {$name}"; // => Hello John Is there a similar language construct in C#? I know there is String.Format(); but I want to know if it..

What is the JUnit XML format specification that Hudson supports?

I have Hudson as continuous integration server and I want to use option 'Publish JUnit test result report'. But I don't use xUnit tools for testing, instead of that i have shell scripts which run test..

How to set host_key_checking=false in ansible inventory file?

I would like to use ansible-playbook command instead of 'vagrant provision'. However setting host_key_checking=false in the hosts file does not seem to work. # hosts file vagrant ansible_ssh_private..

Validate that text field is numeric usiung jQuery

I have a simple issue -- I would like to check a field to see if it's an integer if it is not blank. I'm not using any additional plugins, just jQuery. My code is as follows: if($('#Field').val() != ..

In Java, what purpose do the keywords `final`, `finally` and `finalize` fulfil?

In Java, what purpose do the keywords final, finally and finalize fulfil? ..

What is the equivalent of Java static methods in Kotlin?

There is no static keyword in Kotlin. What is the best way to represent a static Java method in Kotlin?..

How do I get a div to float to the bottom of its container?

I have floated images and inset boxes at the top of a container using float:right (or left) many times. Recently I hit a need to float a div at the bottom right corner of another div with the normal t..

GoogleTest: How to skip a test?

Using Google Test 1.6 (Windows 7, Visual Studio C++). How can I turn off a given test? (aka how can I prevent a test from running). Is there anything I can do besides commenting out the whole test?..

How do I find my host and username on mysql?

I need to open my database through PHP. But I need to know my username and the name of my host (e.g. localhost), and I don't know them. When I used mysql and did my database, it just asked me directly..

"Cannot GET /" with Connect on Node.js

I'm trying to start serving some static web pages using connect like this: var connect = require("connect"); var nowjs = require("now"); var io = require("socket.io"); var app = connect.createServe..

java.util.Date vs java.sql.Date

java.util.Date vs java.sql.Date: when to use which and why?..

How to use wget in php?

I have this parameters to download a XML file: wget --http-user=user --http-password=pass http://www.example.com/file.xml How I have to use that in php to open this xml file?..

AWS CLI S3 A client error (403) occurred when calling the HeadObject operation: Forbidden

I'm trying to setup a Amazon Linux AMI(ami-f0091d91) and have a script that runs a copy command to copy from a S3 bucket. aws --debug s3 cp s3://aws-codedeploy-us-west-2/latest/codedeploy-agent.noar..

What are the differences between a multidimensional array and an array of arrays in C#?

What are the differences between multidimensional arrays double[,] and array-of-arrays double[][] in C#? If there is a difference, what is the best use for each one?..

How to trigger click on page load?

I'm looking for a way to automatically "click" an item when the page loads. I've tried using $("document").ready(function() { $("ul.galleria li:first-child img").trigger('click'); }); but it ..

set pythonpath before import statements

My code is: import scriptlib.abc import scriptlib.xyz def foo(): ... some operations but the scriptlib is in some other directory, so I will have to include that directory in environment variabl..

Android image caching

How can I cache images after they are downloaded from web?..

What is the proper way to re-attach detached objects in Hibernate?

I have a situation in which I need to re-attach detached objects to a hibernate session, although an object of the same identity MAY already exist in the session, which will cause errors. Right now, ..

How can I scroll a div to be visible in ReactJS?

I have a popup list which is a div that contains a vertical list of child divs. I have added up/down keyboard navigation to change which child is currently highlighted. Right now, if I press the dow..

Have Excel formulas that return 0, make the result blank

A recurring Excel problem I have is formulas such as INDEX(array,row,column) that return 0 when there's no result, rather than returning blank. What is the best way to change the zero result to blank..

Passing an Array as Arguments, not an Array, in PHP

I seem to remember that in PHP there is a way to pass an array as a list of arguments for a function, dereferencing the array into the standard func($arg1, $arg2) manner. But now I'm lost on how to d..

In Python, how to check if a string only contains certain characters?

In Python, how to check if a string only contains certain characters? I need to check a string containing only a..z, 0..9, and . (period) and no other character. I could iterate over each character ..

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

I use the following command: mysql -u root -h 127.0.0.1 -p and the error message is : ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) Who can help me to fix it?..

Should I use past or present tense in git commit messages?

I read once that git commit messages should be in the imperative present tense, e.g. "Add tests for x". I always find myself using the past tense, e.g. "Added tests for x" though, which feels a lot mo..

Deny direct access to all .php files except index.php

I want to deny direct access to all .php files except one: index.php The only access to the other .php files should be through php include. If possible I want all files in the same folder. UPDATE: ..

How can I record a Video in my Android App.?

How can I capture a video recording on Android?..

Apache could not be started - ServerRoot must be a valid directory and Unable to find the specified module

I'm using xampp portable server and I'm having some trouble with Apache http server, it says "ServerRoot must be a valid directory" Command line output: Please close this command only for Shutdown A..

Convert generator object to list for debugging

When I'm debugging in Python using IPython, I sometimes hit a break-point and I want to examine a variable that is currently a generator. The simplest way I can think of doing this is converting it to..

Closing Bootstrap modal onclick

I am using a Bootstrap modal for users to choose product options before adding an item to their cart. I've used them before in this scenario with no issues but this one isn't closing as expected. Wh..

JsonParseException: Unrecognized token 'http': was expecting ('true', 'false' or 'null')

We have the following string which is a valid JSON written to a file on HDFS. { "id":"tag:search.twitter.com,2005:564407444843950080", "objectType":"activity", "actor":{ "objectType":"..

How to rename a pane in tmux?

How to rename a pane in tmux ?..

How can I have a newline in a string in sh?

This STR="Hello\nWorld" echo $STR produces as output Hello\nWorld instead of Hello World What should I do to have a newline in a string? Note: This question is not about echo. I'm aware of e..

What is the 'open' keyword in Swift?

The ObjectiveC.swift file from the standard library contains the following few lines of code around line 228: extension NSObject : Equatable, Hashable { /// ... open var hashValue: Int { retu..

How to change the font size and color of x-axis and y-axis label in a scatterplot with plot function in R?

I used the following code to draw a scatterplot. How to increase the font size and change colour of x-axis and y-axis label? data=read.csv("data.csv") plot(data$column1,data$column2,xlab="x axis", ..

Execution time of C program

I have a C program that aims to be run in parallel on several processors. I need to be able to record the execution time (which could be anywhere from 1 second to several minutes). I have searched for..

Why should you use strncpy instead of strcpy?

Edit: I've added the source for the example. I came across this example: char source[MAX] = "123456789"; char source1[MAX] = "123456789"; char destination[MAX] = "abcdefg"; char destination1[MAX] = ..

mappedBy reference an unknown target entity property

I am having an issue in setting up a one to many relationship in my annotated object. I have the following: @MappedSuperclass public abstract class MappedModel { @Id @GeneratedValue(strategy..

How to copy marked text in notepad++

I have a part of HTML source file that contains strings that I want to select and copy at once, using the regex functionality of Notepad++. Here is a part of the text source: <option value="Perfo..

How to configure slf4j-simple

api 1.7 and slf4j-simple as implementation. I just can't find how to configure the logging level with this combination. Can anyone help out?..

using CASE in the WHERE clause

simplified version of my query SELECT * FROM logs WHERE pw='correct' AND CASE WHEN id<800 THEN success=1 ELSE END AND YEAR(timestamp)=2011 this doesn't work. What i'm trying to do is to add i..

How do I loop through a list by twos?

I want to loop through a Python list and process 2 list items at a time. Something like this in another language: for(int i = 0; i < list.length(); i+=2) { // do something with list[i] and list..

Remove a modified file from pull request

I have 3 modified files (no new files) in a pull request at the moment. I would like to remove one of those files from the pull request, so that the pull request only contains changes to two files a..

Count the number of items in my array list

I want to count the number of itemids in my array, can i get an example of how i would go about adding this to my code. code below; if (value != null && !value.isEmpty()) { Set set = valu..

How can I export data to an Excel file

I have an Excel file with data in it. I want to write some specific rows of it to another Excel file that I created by code. By the way I have the indexes of these rows in a list. How can i do that?..

Get user input from textarea

I'm new to angular2. I want to store user input from a text area in a variable in my component so I can apply some logic to this input. I tried ngModel but it doesn't work. My code for the textarea: ..

Differences between Lodash and Underscore.js

Why would someone prefer either the Lodash or Underscore.js utility library over the other? Lodash seems to be a drop-in replacement for underscore, the latter having been around longer. I think both ..

What's the algorithm to calculate aspect ratio?

I plan to use it with JavaScript to crop an image to fit the entire window. Edit: I'll be using a 3rd party component that only accepts the aspect ratio in the format like: 4:3, 16:9...

Using python map and other functional tools

This is quite n00bish, but I'm trying to learn/understand functional programming in python. The following code: foos = [1.0,2.0,3.0,4.0,5.0] bars = [1,2,3] def maptest(foo, bar): print foo, bar ..

Bogus foreign key constraint fail

I get this error message: ERROR 1217 (23000) at line 40: Cannot delete or update a parent row: a foreign key constraint fails ... when I try to drop a table: DROP TABLE IF EXISTS `area`; ..

How do I "select Android SDK" in Android Studio?

After a successful import of an Eclipse-Android-Project into "Android Studio 1.4", I get the error "Please select Android SDK" when I click on the button to run the application in simulator, bu..

How to preview selected image in input type="file" in popup using jQuery?

In my code, I am allowing the user to upload an image. Now I want to show this selected image as a preview in this same popup. How can I do it using jQuery? The following is the input type I am using..

get current date and time in groovy?

What is the code to get the current date and time in groovy? I've looked around and can't find an easy way to do this. Essentially I'm looking for linux equivalent of date I have : import java.text...

What does "int 0x80" mean in assembly code?

Can someone explain what the following assembly code does? int 0x80 ..

Working with time DURATION, not time of day

I'm doing some benchmarking, and I want to use Excel to produce graphs of the results. I've got a simple but annoying problem which is baking my noodle. The problem is that Excel insists that "time" ..

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

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

Accessing a property in a parent Component

I have a property in a top level Component that is used data from a HTTP source like so (this is in a file called app.ts): import {UserData} from './services/user-data/UserData'; Component({ sel..

How do I get current date/time on the Windows command line in a suitable format for usage in a file/folder name?

Update: Now that it's 2016 I'd use PowerShell for this unless there's a really compelling backwards-compatible reason for it, particularly because of the regional settings issue with using date. See @..

Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters

I want a regular expression to check that: A password contains at least eight characters, including at least one number and includes both lower and uppercase letters and special characters, for exam..

Git Diff with Beyond Compare

I have succeeded in getting git to start Beyond Compare 3 as a diff tool however, when I do a diff, the file I am comparing against is not being loaded. Only the latest version of the file is loaded ..

Difference between String replace() and replaceAll()

What's the difference between java.lang.String 's replace() and replaceAll() methods, other than later uses regex? For simple substitutions like, replace . with / , is there any difference?..

How to print color in console using System.out.println?

How can I print color in console? I want to show data in colors when the processor sends data and in different colors when it receives data...

adb is not recognized as internal or external command on windows

I set the c:/android-sdk/tools path to the path environment and commands like emulator is working just fine. But the adb command is still not recognized, what should I do ? In the path system variabl..

ReactJS - Add custom event listener to component

In plain old javascript I have the DIV <div class="movie" id="my_movie"> and the following javascript code var myMovie = document.getElementById('my_movie'); myMovie.addEventListener('nv-en..

Excel concatenation quotes

I'm trying to concatenate several fields and want certain fields to start and end with quotes ("....."). When I put a cell (B2) inside this, the cell (B2) is shown as plain text with quotes around it...

Task vs Thread differences

I'm new to parallel programming. There are two classes available in .NET: Task and Thread. So, my questions are: What is the difference between those classes? When is it better to use Thread over Tas..

Array definition in XML?

In XML, how do I declare array of integers? I can declare it as the following: <numbers type="array"> <value>3</value> <value>2</value> <value>1</v..

Cut Java String at a number of character

I would like to cut a Java String when this String length is > 50, and add "..." at the end of the string. Example : I have the following Java String : String str = "abcdefghijklmnopqrtuvwxyz"; I..