Questions Tagged with #Nsrunloop

GIT: Checkout to a specific folder

I want to use something similar to: git checkout -- <path>/<file> but I want to checkout the file to some folder I choose, rather than the overwriting the local <path>/<file>..

What's the valid way to include an image with no src?

I have an image that I will dynamically populate with a src later with javascript but for ease I want the image tag to exist at pageload but just not display anything. I know <img src='' /> is i..

How to find a parent with a known class in jQuery?

I have a <div> that has many other <div>s within it, each at a different nesting level. Rather than give every child <div> an identifier, I rather just give the root <div> the ..

Android Studio : Failure [INSTALL_FAILED_OLDER_SDK]

Today I have downloaded Android Studio v 0.8.0 beta. I am trying to test my app on SDK 17 . Android studio error Failure [INSTALL_FAILED_OLDER_SDK] Here is my android manifest <?xml version="..

Disabling of EditText in Android

In my application, I have an EditText that the user only has Read access not Write access. In code I set android:enabled="false". Although the background of EditText changed to dark, when I click o..

Android get current Locale, not default

How do I get the user's current Locale in Android? I can get the default one, but this may not be the current one correct? Basically I want the two letter language code from the current locale. Not ..

git rm - fatal: pathspec did not match any files

I added over 9000 photos by accident to my project folder. And committed them. Then deleted them from disk. Committed. Now I try to push changes to git server. But it takes too long and tries to se..

Process list on Linux via Python

How can I get running process list using Python on Linux?..

"No rule to make target 'install'"... But Makefile exists

I am running into issues installing a C++ library. The CMake command is successful and generates the Makefile, but it gives a warning: CMake Warning (dev) at CMakeLists.txt:27 (LINK_DIRECTORIES): Thi..

Transposing a 1D NumPy array

I use Python and NumPy and have some problems with "transpose": import numpy as np a = np.array([5,4]) print(a) print(a.T) Invoking a.T is not transposing the array. If a is for example [[],[]] th..

What is the most accurate way to retrieve a user's correct IP address in PHP?

I know there are a plethora of $_SERVER variables headers available for IP address retrieval. I was wondering if there is a general consensus as to how to most accurately retrieve a user's real IP add..

Get current time in seconds since the Epoch on Linux, Bash

I need something simple like date, but in seconds since 1970 instead of the current date, hours, minutes, and seconds. date doesn't seem to offer that option. Is there an easy way?..

How can I get an int from stdio in C?

I have significant trouble with this... printf("> "); int x = getchar(); printf("got the number: %d", scanf("%d", &x)); Output > 1234 got the number: 1 ..

How to capture the screenshot of a specific element rather than entire page using Selenium Webdriver?

Currently I'm trying to capture a screenshot using the Selenium WebDriver. But I can only obtain the whole page screen shot. However, what I wanted is just to capture a part of the page or perhaps jus..

Fixed header, footer with scrollable content

How can I get fixed header, footer with scrollable content? Something like this page. I can look at the source to get the CSS, but I just want to know minimum CSS and HTML I need to get this working. ..

Java Timestamp - How can I create a Timestamp with the date 23/09/2007?

How can I create a Timestamp with the date 23/09/2007? ..

java: ArrayList - how can I check if an index exists?

I'm using ArrayList<String> and I add data at specific indices, how can I check if a specific index exists? Should I simply get() and check the value? Or should I wait for an exception? Is there..

Capitalize words in string

What is the best approach to capitalize words in a string?..

Convert string to date in Swift

How can I convert this string "2016-04-14T10:44:00+0000" into an NSDate and keep only the year, month, day, hour? The T in the middle of it really throws off what I am used to when working with dates..

Converting HTML to plain text in PHP for e-mail

I use TinyMCE to allow minimal formatting of text within my site. From the HTML that's produced, I'd like to convert it to plain text for e-mail. I've been using a class called html2text, but it's rea..

MySQL INNER JOIN select only one row from second table

I have a users table and a payments table, for each user, those of which have payments, may have multiple associated payments in the payments table. I would like to select all users who have payments,..

How to playback MKV video in web browser?

I am trying to make a MKV video with a MPEG4 video codec and AC3 audio codec available to be played online using Mozilla or Chrome. I have tried multiple methods including native HTML5, which plays ba..

LISTAGG function: "result of string concatenation is too long"

I'm using Oracle SQL developer version 3.0.04. I attempted to use the function LISTAGG to group the data together.. CREATE TABLE FINAL_LOG AS SELECT SESSION_DT, C_IP, CS_USER_AGENT, lista..

Double value to round up in Java

I have a double value = 1.068879335 i want to round it up with only two decimal values like 1.07. I tried like this DecimalFormat df=new DecimalFormat("0.00"); String formate = df.format(value); dou..

Remove duplicates from an array of objects in JavaScript

I have an object that contains an array of objects. things = new Object(); things.thing = new Array(); things.thing.push({place:"here",name:"stuff"}); things.thing.push({place:"there",name:"morestu..

How to fix "Attempted relative import in non-package" even with

I'm trying to follow PEP 328, with the following directory structure: pkg/ components/ tests/ In I have t..

Running Java gives "Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'"

After years of working OK, I'm suddenly getting this message when trying to start the JVM: Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg' I tried uninstalling, and got a messa..

Changing Locale within the app itself

My users can change the Locale within the app (they may want to keep their phone settings in English but read the content of my app in French, Dutch or any other language ...) Why is this working per..

NodeJs : TypeError: require(...) is not a function

I am trying to require a file and afterwards pass it to a var. I am following this tutorial to create a authentication system. After writing the server.js file and trying to compile I got a bson error..

How to uninstall with msiexec using product id guid without .msi file present

I'm trying to automate the uninstallation of packages created using WiX for the purposes of changing the installed software stack & configuration without reprovisioning a whole OS. Eventually I'll..

Concept of void pointer in C programming

Is it possible to dereference a void pointer without type-casting in the C programming language? Also, is there any way of generalizing a function which can receive a pointer and store it in a void p..

Design Patterns web based applications

I am designing a simple web-based application. I am new to this web-based domain.I needed your advice regarding the design patterns like how responsibility should be distributed among Servlets, criter..

Get 2 Digit Number For The Month

I have an integer column "Month" I would like to get 2 digit number for month. This is what I have tried: DATEPART(mm, @Date) It returns one digit for months January to September I am using SQL Serv..

Correct way to use StringBuilder in SQL

I just found some sql query build like this in my project: return (new StringBuilder("select id1, " + " id2 " + " from " + " table")).toString(); Does this StringBuilder achieve its aim, i.e reduci..

Functions are not valid as a React child. This may happen if you return a Component instead of from render

I have written a Higher Order Component: import React from 'react'; const NewHOC = (PassedComponent) => { return class extends React.Component { render(){ return ( ..

How to add app icon within phonegap projects?

I created a new phonegap (v 3.0.0-0.14.0) project with default config.xml and then added iOS and Android platforms. The config contains all the paths to all platform icons. I have overwritten the de..

How should I remove all the leading spaces from a string? - swift

I need a way to remove the first character from a string which is a space. I am looking for a method or even an extension for the String type that I can use to cut out a character of a string...

If statement in aspx page

I want to write a basic if statement on my site to display either item 1 or item 2 depending on if a variable is set to true. I'm not too familiar with .NET and need a little help with the basic stru..

How can I change the font-size of a select option?

I am trying to style a select option dropdown list. Is it possible to make the font-sizes of the options different from the default value? For example, the default: -- Select Country -- Would be ..

Validation of radio button group using jQuery validation plugin

How to perform validation for a radio button group (one radio button should be selected) using jQuery validation plugin?..

How to remove unused C/C++ symbols with GCC and ld?

I need to optimize the size of my executable severely (ARM development) and I noticed that in my current build scheme (gcc + ld) unused symbols are not getting stripped. The usage of the arm-strip --..

Byte and char conversion in Java

If I convert a character to byte and then back to char, that character mysteriously disappears and becomes something else. How is this possible? This is the code: char a = 'È'; // line 1 ..

Making an svg image object clickable with onclick, avoiding absolute positioning

I have tried to change the images on my site from img to svg, changing img tags to embed and object tags. But, implementing the onclick function, which previously was contained in the img tag, is prov..

Change GitHub Account username

I want to change my account's user name on GitHub, but I can't find how to do it. Is this possible at all? To clarify, I'm not talking about the parameter in a git repository, but the userna..

Java: export to an .jar file in eclipse

I'm trying to export a program in Eclipse to a jar file. In my project I have added some pictures and PDF:s. When I'm exporting to jar file, it seems that only the main has been compiled and exporte..

How to link to a named anchor in Multimarkdown?

I have come across a number of mentions of MultiMarkdown's support for internal links / named anchors but I am unable to find a single example of how to actually do it. So, what is the syntax for de.. localhost/ - Connection refused

I am using xampp apache server to serve resources to the application from my machine. But i am getting the above error. I got something on the google. pointing towards possible solution here http://..

Sort objects in ArrayList by date?

Every example I find is about doing this alphabetically, while I need my elements sorted by date. My ArrayList contains objects on which one of the datamembers is a DateTime object. On DateTime I can..

How to use a ViewBag to create a dropdownlist?

Controller: public ActionResult Filter() { ViewBag.Accounts = BusinessLayer.AccountManager.Instance.getUserAccounts(HttpContext.User.Identity.Name); return View(); } View: <td>Accoun..

I want to get Year, Month, Day, etc from Java Date to compare with Gregorian Calendar date in Java. Is this possible?

I have a Date object in Java stored as Java's Date type. I also have a Gregorian Calendar created date. The gregorian calendar date has no parameters and therefore is an instance of today's date (and..

postgresql - sql - count of `true` values

myCol ------ true true true false false null In the above table, if I do : select count(*), count(myCol); I get 6, 5 I get 5 as it doesn't count the null entry. How do I also count the nu..

Two Decimal places using c#

decimal Debitvalue = 1156.547m; decimal DEBITAMT = Convert.ToDecimal(string.Format("{0:0.00}", Debitvalue)); I have to get only two decimal places but by using this code I am getting 1156.547. Let ..

jQuery add text to span within a div

<div id="tagscloud"> <span></span> </div> How would I do to add some text within the span like code below ? <span>**tag cloud**</span> Edit: actually the..

How do I get the Git commit count?

I'd like to get the number of commits of my Git repository, a bit like SVN revision numbers. The goal is to use it as a unique, incrementing build number. I currently do like that, on Unix/Cygwin/ms..

TimeSpan to DateTime conversion

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

Why do 64-bit DLLs go to System32 and 32-bit DLLs to SysWoW64 on 64-bit Windows?

I would like to know when do we need to place a file under C:\Windows\System32 or C:\Windows\SysWOW64, on a 64-bits windows system. I had two DLL's, one for 32-bit, one for 64-bit. Logically, I th..

HTML image not showing in Gmail

I'm sending an e-mail newsletter in HTML. Inside the HTML I have something like <img height='70' width='70' style='display:block' src=''> When I open the newsletter ..

Error converting data types when importing from Excel to SQL Server 2008

Every time that I try to import an Excel file into SQL Server I'm getting a particular error. When I try to edit the mappings the default value for all numerical fields is float. None of the fields ..

How to Load RSA Private Key From File

I am working on a test harness for a SAML 1.1 Assertion Consumer Service. The test must generate a signed SAMLResponse and submit it to the ACS encoded in Base64. The ACS must be able to verify the ..

Jboss server error : Failed to start service jboss.deployment.unit."jbpm-console.war"

When starting the jboss server, it giving an error Failed to start service jboss.deployment.unit."jbpm-console.war". But when i'm running jbpm6 demo using start.demo its working fine. 23:43:41,042 ER..

Using LIKE in an Oracle IN clause

I know I can write a query that will return all rows that contain any number of values in a given column, like so: Select * from tbl where my_col in (val1, val2, val3,... valn) but if val1, for exa..

Converting UTF-8 to ISO-8859-1 in Java - how to keep it as single byte

I am trying to convert a string encoded in java in UTF-8 to ISO-8859-1. Say for example, in the string 'âabcd' 'â' is represented in ISO-8859-1 as E2. In UTF-8 it is represented as two bytes. C3 A2..

Converting string format to datetime in mm/dd/yyyy

I have to convert string in mm/dd/yyyy format to datetime variable but it should remain in mm/dd/yyyy format. string strDate = DateTime.Now.ToString("MM/dd/yyyy"); Please help...

XAMPP on Windows - Apache not starting

I have installed XAMPP on my windows 7 machine but can't get Apache to work. On start I get the following errors: 13:09:21 [apache] Apache Service Detected With Wrong Path 13:09:21 [apache] Unin..

A keyboard shortcut to comment/uncomment the select text in Android Studio

How do I comment out several lines of text selected in the IDE with a control key combination? I thought that Ctrl + Alt + C was the correct sequence, but that's not working...

GoogleMaps API KEY for testing

I'd like to add an API_KEY for GoogleMaps for testing and in documentation I've read this : Tip: During development and testing, you can register a project for testing purposes in the Google Clou..

QLabel: set color of text and background

How do I set color of text and background of a QLabel ?..

Print to the same line and not a new line?

Basically I want to do the opposite of what this guy did... hehe. Python Script: Print new line each time to shell rather than update existing line I have a program that is telling me how far along ..

Query to check index on a table

I need a query to see if a table already has any indexes on it...

How to add an action to a UIAlertView button using Swift iOS

I want to add another button other than the "OK" button which should just dismiss the alert. I want the other button to call a certain function. var logInErrorAlert: UIAlertView = UIAlertView() logIn..

RecyclerView vs. ListView

From android developer (Creating Lists and Cards): The RecyclerView widget is a more advanced and flexible version of ListView. Okay, it sounds cool, but when I saw this example picture, I got..

Using Server.MapPath() inside a static field in ASP.NET MVC

I'm building an ASP.NET MVC site where I'm using Lucene.Net for search queries. I asked a question here about how to properly structure Lucene.Net usage in an ASP.NET MVC application and was told that..

setInterval in a React app

I'm still fairly new at React, but I've been grinding along slowly and I've encountered something I'm stuck on. I am trying to build a "timer" component in React, and to be honest I don't know if I'..

document.getElementById vs jQuery $()

Is this: var contents = document.getElementById('contents'); The same as this: var contents = $('#contents'); Given that jQuery is loaded?..

How to create a multi line body in C# System.Net.Mail.MailMessage

If create the body property as System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.Body ="First Line \n second line"; I also tried message.Body ="First Line" + syste..

How to change ProgressBar's progress indicator color in Android

I have set Horizontal ProgressBar. I would like to change the progress color to yellow. <ProgressBar android:id="@+id/progressbar" android:layout_width="80dip" android:layout_heigh..

QComboBox - set selected item based on the item's data

What would be the best way of selecting an item in a QT combo box out of a predefined list of enum based unique values. In the past I have become accustomed to .NET's style of selection where the ite..

Java 8, Streams to find the duplicate elements

I am trying to list out duplicate elements in the integer list say for eg, List<Integer> numbers = Arrays.asList(new Integer[]{1,2,1,3,4,4}); using Streams of jdk 8. Has anybody tried out..

How to check if a std::thread is still running?

How can I check if a std::thread is still running (in a platform independent way)? It lacks a timed_join() method and joinable() is not meant for that. I thought of locking a mutex with a std::lock_g..

PHP: Show yes/no confirmation dialog

My PHP page has a link to delete one MySQL table datum. I want it to be in such a way that when I click the 'delete' link a confirmation box should appear and it should ask "are you sure, you want to..

Transpose a matrix in Python

I'm trying to create a matrix transpose function in Python. A matrix is a two dimensional array, represented as a list of lists of integers. For example, the following is a 2X3 matrix (meaning the hei..

PHP string concatenation

I need to know if its possible to concatenate strings, as follows ? and if not, what is the alternative of doing so ? while ($personCount < 10) { $result+= $personCount . "person "; } echo $resul..

Enabling error display in PHP via htaccess only

I am testing a website online. Right now, the errors are not being displayed (but I know they exist). I have access to only the .htaccess file. How do I make all errors to display using my .htacces..

regex for zip-code

Possible Duplicate: What is the ultimate postal code and zip regex? I need Regex which can satisfy all my three condtions for zip-code. E.g- 12345 12345-6789 12345 1234 Any pointers ..

PSEXEC, access denied errors

While I'm using PSEXEC.exe getting 'Access denied' error for remote systems. Any idea about how to solve this?..

How do I increase the scrollback buffer in a running screen session?

Lets say I have a currently running screen session I am interacting with through putty. I've realized that the scrollback buffer is too small and would like to increase it without starting a new scre..

How can I use xargs to copy files that have spaces and quotes in their names?

I'm trying to copy a bunch of files below a directory and a number of the files have spaces and single-quotes in their names. When I try to string together find and grep with xargs, I get the followi..

Web scraping with Java

I'm not able to find any good web scraping Java based API. The site which I need to scrape does not provide any API as well; I want to iterate over all web pages using some pageID and extract the HTML..

Replace Multiple String Elements in C#

Is there a better way of doing this... MyString.Trim().Replace("&", "and").Replace(",", "").Replace(" ", " ") .Replace(" ", "-").Replace("'", "").Replace("/", "").ToLower(); I've ext..

How to remove elements from a generic list while iterating over it?

I am looking for a better pattern for working with a list of elements which each need processed and then depending on the outcome are removed from the list. You can't use .Remove(element) inside a f..

How do I get a file name from a full path with PHP?

For example, how do I get from F:\Program Files\SSH Communications Security\SSH Secure Shell\ with PHP?..

How to check if a div is visible state or not?

I have tabs like this. <li id="singlechatpanel-1" style="visibility: hidden;"> //content </li> Trying to check it like this: $(".subpanel a").click(function() { var ..

Keylistener in Javascript

I'm looking for a KeyListener for a game I'm developing in JavaScript. I have no idea how this would work in real code but it would be something like this: if(keyPress == upKey) { playerSpriteX ..

How can I use break or continue within for loop in Twig template?

I try to use a simple loop, in my real code this loop is more complex, and I need to break this iteration like: {% for post in posts %} {% if == 10 %} {# break #} {% endif %} ..

How to do jquery code AFTER page loading?

If you want an event to work on your page, you should call it inside the $(document).ready() function. Everything inside it will load as soon as the DOM is loaded and before the page cont..

Npm install cannot find module 'semver'

I can't use npm install using the command prompt in NodeJS. I'm getting these errors when running npm install: module.js:339 throw err; ^ Error: Cannot find module 'semver' at Function.Mo..

Stop absolutely positioned div from overlapping text

Here is a simplification of my layout: _x000D_ _x000D_ <div style="position: relative; width:600px;">_x000D_ <p>Content of unknown length, but quite quite quite quite quite qu..

Test if registry value exists

In my powershell script I'm creating one registry entry for each element I run script on and I would like to store some additional info about each element in registry (if you specify optional paramete..

How to plot a subset of a data frame in R?

Is there a simple way to do this in R: plot(var1,var2, for all observations in the data frame where var3 < 155) It is possible by creating a new data newdata <- data[which( data$var3 < 1..

Selecting only numeric columns from a data frame

Suppose, you have a data.frame like this: x <- data.frame(v1=1:20,v2=1:20,v3=1:20,v4=letters[1:20]) How would you select only those columns in x that are numeric? ..

Warning: Permanently added the RSA host key for IP address

When I do pull from Github, I am getting this warning message. MYPC:/Rails$ git pull origin master Warning: Permanently added the RSA host key for IP address '#{Some IP address}' to the l..

Multi-dimensional associative arrays in JavaScript

There is the following query results: (key1 and key2 could be any text) id key1 key2 value 1 fred apple 2 2 mary orange 10 3 fred banana 7 4 fred orange ..

How do you reindex an array in PHP but with indexes starting from 1?

I have the following array, which I would like to reindex so the keys are reversed (ideally starting at 1): Current array (edit: the array actually looks like this): Array ( [2] => Object ( ..

Any easy way to use icons from resources?

I have an C# app. I need to add an icon to that app so i added an icon resource. Adding resource went fine, but is there any way to use my (resource) icon as form icon WITHOUT adding additional code? ..

Java Regex to Validate Full Name allow only Spaces and Letters

I want regex to validate for only letters and spaces. Basically this is to validate full name. Ex: Mr Steve Collins or Steve Collins I tried this regex. "[a-zA-Z]+\.?" But didnt work. Can someone a..

Can the :not() pseudo-class have multiple arguments?

I'm trying to select input elements of all types except radio and checkbox. Many people have shown that you can put multiple arguments in :not, but using type doesn't seem to work anyway I try it. f..

Split a string using C++11

What would be easiest method to split a string using c++11? I've seen the method used by this post, but I feel that there ought to be a less verbose way of doing it using the new standard. Edit: I w..

How to clone git repository with specific revision/changeset?

How can I clone git repository with specific revision, something like I usually do in Mercurial: hg clone -r 3 /path/to/repository ..

Centos/Linux setting logrotate to maximum file size for all logs

we use logrotate and it runs daily ... now we have had some situations where logs have grown significantly (read: gigbaytes) and killing our server. So now we would like to set a maximum filesize to t..

multi line comment in Visual studio 2010

Possible Duplicate: commenting VB code Lack of block comments in VB .NET? How to? Is there a way to comment out more than one line of code in using VS 2010?..

JQuery: dynamic height() with window resize()

I'm having an issue identical to this poster: Jquery problem with height() and resize() But the solution doesn't fix my issue. I have three stacked divs, and I want to use JQuery to make the middle o..

How to change date format using jQuery?

I have a date in a format like this fecha2.value = '2014-01-06', but I want to change the format to this '01-06-14' using jQuery. How can I do this? Thanks in advance...

How to use php serialize() and unserialize()

My problem is very basic. I did not find any example to meet my needs as to what exactly serialize() and unserialize() mean in php? They just give an example - serialize an array and show an output i..

How does `scp` differ from `rsync`?

An article about setting up Ghost blogging says to use scp to copy from my local machine to a remote server: scp -r ghost-0.3 root@*your-server-ip*:~/ However, Railscast 339: Chef Solo Basics uses ..

Resize image in PHP

I'm wanting to write some PHP code which automatically resizes any image uploaded via a form to 147x147px, but I have no idea how to go about it (I'm a relative PHP novice). So far, I've got images ..

How to select a drop-down menu value with Selenium using Python?

I need to select an element from a drop-down menu. For example: <select id="fruits01" class="select" name="fruits"> <option value="0">Choose your fruits:</option> <option v..

CORS error :Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response

I am trying to send the request from one localhost port to the another. I am using angularjs on the frontend and node on the backend. Since it is CORS request, In node.js, i am using res.header('Ac..

Is there are way to make a child DIV's width wider than the parent DIV using CSS?

Is there a way to have a child DIV within a parent container DIV that is wider than it's parent. The child DIV needs to be the same width of the browser viewport. See example below: The child DIV m..

Can I apply the required attribute to <select> fields in HTML5?

How can I check if a user has selected something from a <select> field in HTML5? I see <select> doesn't support the new required attribute... do I have to use JavaScript then? Or is the..

Postgresql : syntax error at or near "-"

I am Trying to run a query to update the user password using. alter user dell-sys with password 'Pass@133'; But because of - it's giving me error like, ERROR: syntax error at or near "-" LINE 1: ..

Creating composite primary key in SQL Server

How to add composite primary keys in SQL Server 2008? I have a table as follows. testRequest (wardNo nchar(5) , BHTNo nchar(5) , testID nchar(5) , reqDateTime dat..

How do I restrict my EditText input to numerical (possibly decimal and signed) input?

I have read Android: Limiting EditText to numbers and How do I show the number keyboard on an EditText in android?. Unfortunately, none of them seems to fit my needs. I want to restrict my EditText i..

Java String declaration

What is the difference between String str = new String("SOME") and String str="SOME" Does these declarations gives performance variation...

Move SQL Server 2008 database files to a new folder location

Logical Name my_Data my_Log Path: C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA FileName: my.MDF m..

Converting list to numpy array

I have managed to load images in a folder using the command line sklearn: load_sample_images() I would now like to convert it to a numpy.ndarray format with float32 datatype I was able to convert it..

Reload nginx configuration

I am trying to make modification in the Nginx conf file to remove a "rewrite". Now I have this configuration file: worker_processes 1; events { worker_connections 1024; } http { include..

Making sure at least one checkbox is checked

I have a form with multiple checkboxes and I want to use JavaScript to make sure at least one is checked. This is what I have right now but no matter what is chosen an alert pops up. JS (wrong) ..

How to redirect to a route in laravel 5 by using href tag if I'm not using blade or any template?

Route::get('/page','UserController@view page'); is my route. I have a list with href tag and I want to redirect to this route. <ul> <li><a href="">how it works</a><..

How to initialize a variable of date type in java?

import java.util.Date; Date firstDate; I don't know how to intialize the firstDate for example for String you say String line1="First line" but what is the format for date can you give me an e..

How do I auto size a UIScrollView to fit its content

Is there a way to make a UIScrollView auto-adjust to the height (or width) of the content it's scrolling? Something like: [scrollView setContentSize:(CGSizeMake(320, content.height))]; ..

Calculate distance in meters when you know longitude and latitude in java

Possible Duplicate: Working with latitude/longitude values in Java Duplicate: Working with latitude/longitude values in Java How do I calculate distance between two latitude longitude points? I n..

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

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

How to close <img> tag properly?

<img src='stackoverflow.png'> <img src='stackoverflow.png'></img> <img src='stackoverflow.png' /> Which one(s) of them is correct?..

What is the difference between compare() and compareTo()?

What is the difference between Java's compare() and compareTo() methods? Do those methods give same answer?..

PopupWindow $BadTokenException: Unable to add window -- token null is not valid

I have the following error when showing a PopupWindow. The errors are triggered by the line: checkInPopup.showAtLocation((ViewGroup) mapView.getParent(), Gravity.CENTER_HORIZONTAL, 0, 0); mapView i..

MySQL dump by query

Is it possible to do mysqldump by single SQL query? I mean to dump the whole database, like phpmyadmin does when you do export to SQL..

Eclipse : Failed to connect to remote VM. Connection refused.

When ever i tried to launch my eclipse debug(for server side code) i'm getting the following error Failed to connect to remote VM. Connection refused. What's the problem may be? I already tried with..

Why is git push gerrit HEAD:refs/for/master used instead of git push origin master

I've just started using gerrit and I want to know why we need to do git push gerrit HEAD:refs/for/master instead of doing git push origin master If I do git push origin master I get the error saying ..

Correlation heatmap

I want to represent correlation matrix using a heatmap. There is something called correlogram in R, but I don't think there's such a thing in Python. How can I do this? The values go from -1 to 1, fo..

Load text file as strings using numpy.loadtxt()

I would like to load a big text file (around 1 GB with 3*10^6 rows and 10 - 100 columns) as a 2D np-array containing strings. However, it seems like numpy.loadtxt() only takes floats as default. ..

Apply jQuery datepicker to multiple instances

I've got a jQuery date picker control that works fine for once instance, but I'm not sure how to get it to work for multiple instances. <script type="text/javascript"> $(function() { ..

How do I log errors and warnings into a file?

How do I turn on all error and warnings and log them to a file, but to set up all of that within the script (not changing anything in php.ini)? I want to define a file name and so that all errors and..

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

"Instantiating" a List in Java?

Trying to use the following code: List<Integer> list = new List<Integer>(); I get the following error message: java.util.List is abstract; cannot be instantiated What does this m..

How to differ sessions in browser-tabs?

In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions ..

__init__ and arguments in Python

I want to understand arguments of the constructor __init__ in Python. class Num: def __init__(self,num): self.n = num def getn(self): return self.n def getone(): r..

How can I have Github on my own server?

Is there anything out there like Github that is for your own local server? I am curious if there is like a PHP script or even a desktop client that mimics Github's functionality, I love Github but it..

Visual Studio SignTool.exe Not Found

I have completed an application I have made in Visual Studio 14.0, but when I tried to publish the program, I get an error as Visual Studio cannot find 'SignTool.exe'. I have searched my Hard drive a..

log4j vs logback

We are using log4j behind a selfmade wrapper. We plan to use much more features of it now. Should we update to logback ? (I mean the framework not a facade like SLF4J)..

How do I deserialize a JSON string into an NSDictionary? (For iOS 5+)

In my iOS 5 app, I have an NSString that contains a JSON string. I would like to deserialize that JSON string representation into a native NSDictionary object. "{\"password\" : \"1234\", \"user\" :..

Docker-Compose with multiple services

THIS IS A SAMPLE QUESTION! NEVER DO IT IN PRODUCTION. RUN NGINX / PHP / OTHER SERVICES IN SEPARATE CONTAINERS! When I start docker-compose up the Ubuntu container exits with ubuntu exited with code 0..

How to make several plots on a single page using matplotlib?

I have written code that opens 16 figures at once. Currently they all open as separate graphs. I'd like them to open all on the same page. Not the same graph. I want 16 separate graphs on a single ..

Returning a boolean value in a JavaScript function

I am doing a client side form validation to check if passwords match. But the validation function always returns undefined. function validatePassword(errorMessage) { var password = document.getEle..

Why "net use * /delete" does not work but waits for confirmation in my PowerShell script?

I have a script where I want to disconnect from the mapped drives before I create a new PSDrive. Otherwise I get this error: New-PSDrive : Multiple connections to a server or shared resource by t..

PHP - Check if the page run on Mobile or Desktop browser

In my PHP page I should display two different text contents according to whether the page run under mobile or desktop browser. Is there a way to perform this control in PHP?..

Passing html values into javascript functions

I was making a javascript function in which I need to confirm the input. I wrote the following code but its giving negative value i.e. "else" part even if i enter a valid value. Can some one please su..

Remove blank values from array using C#

How can I remove blank values from an array? For example: string[] test={"1","","2","","3"}; in this case, is there any method available to remove bl..

CSS change button style after click

I was wondering if there was a way to change a button's style, in css, after it's been clicked, so not a element:active. Thanks!..

Merge Cell values with PHPExcel - PHP

I have a simple table like: - id - first_name - last_name - email - phone I'm using PHPExcel to export my data in XLS format $rowNumber = 1; while ($row = mysql_fetch_row($result)) ..

Inversion of Control vs Dependency Injection

According to the paper written by Martin Fowler, inversion of control is the principle where the control flow of a program is inverted: instead of the programmer controlling the flow of a program, the..

Is quitting an application frowned upon?

Moving on in my attempt to learn Android, I just read the following: Question: Does the user have a choice to kill the application unless we put a menu option in to kill it? If no such option e..

Eloquent: find() and where() usage laravel

I am trying to get a record from a posts database table using its id. I've been banging my head on the find() method for quite sometime now, confused as to why it wasn't working. Here is my query that..

how to get the last part of a string before a certain character?

I am trying to print the last part of a string before a certain character. I'm not quite sure whether to use the string .split() method or string slicing or maybe something else. Here is some ..

error LNK2005: xxx already defined in MSVCRT.lib(MSVCR100.dll) C:\something\LIBCMT.lib(setlocal.obj)

I'm using DCMTK library for reading Dicom files (Image format used in medical image processing.) I'm having a problem in compiling this DCMTK source code. DCMTK uses some additional external libraries..

RestClientException: Could not extract response. no suitable HttpMessageConverter found

Using the curl command: curl -u 591bf65f50057469f10b5fd9:0cf17f9b03d056ds0e11e48497e506a2 I am getting a JSON response: {"..

How to parse JSON and access results

I am using CURL to send a request. The response dataType is json. How can I parse this data and insert it into the database? <?php $url = '

How to write into a file in PHP?

I have this script on one free PHP-supporting server: <html> <body> <?php $file = fopen("lidn.txt","a"); fclose($file); ?> </body> </html> It creates the file lidn..

PHP float with 2 decimal places: .00

When I do this typecasting: (float) '0.00'; I get 0. How do I get 0.00 and still have the data type as a float? ..

How do I install PIL/Pillow for Python 3.6?

I have a script that requires PIL to run. Other than downgrading my Python, I couldn't find anyway to install PIL on my Python 3.6 Here are my attempts: pip install pil Collecting pil Could not fi..

GroupBy pandas DataFrame and select most common value

I have a data frame with three string columns. I know that the only one value in the 3rd column is valid for every combination of the first two. To clean the data I have to group by data frame by firs..

What values can I pass to the event attribute of the f:ajax tag?

I am trying to find a list of all the possible values I can pass to the attribute event of the f:ajax tag. I know that I can also pass function names from my .js files, but what I need just the ones ..

How to clean old dependencies from maven repositories?

I have too many files in .m2 folder where maven stores downloaded dependencies. Is there a way to clean all old dependencies? For example, if there is a dependency with 3 different versions: 1, 2 and ..

Scroll event listener javascript

Is there a js listener for when a user scrolls in a certain textbox that can be used? Kinda like onclick except for scrolling. I saw HTML5 event listener for number input scroll - Chrome only but that..

How to set initial size of std::vector?

I have a vector<CustomClass*> and I put a lot of items in the vector and I need fast access, so I don't use list. How to set initial size of vector (for example to be 20 000 places, so to avoid ..

Load an image from a url into a PictureBox

I want to load an image into a PictureBox. This is the image I want to load: How do I do this?..

How do I read a file line by line in VB Script?

I have the following to read a file line by line: wscript.echo "BEGIN" filePath = WScript.Arguments(0) filePath = "C:\Temp\vblist.txt" Set ObjFso = CreateObject("Scripting.FileSystemObject") Set Obj..

Should I use encodeURI or encodeURIComponent for encoding URLs?

Which of these two methods should be used for encoding URLs?..

How do I find the current executable filename?

Possible Duplicate: How do I get the name of the current executable in C#? An executable file loads an external library. Is there a way for the library to know the calling executable file? ..

Convert decimal to binary in python

Is there any module or function in python I can use to convert a decimal number to its binary equivalent? I am able to convert binary to decimal using int('[binary_value]',2), so any way to do the rev..

generate random double numbers in c++

How to generate random numbers between two doubles in c++ , these numbers should look like xxxxx,yyyyy ...

How do you enable mod_rewrite on any OS?

If I understand correctly, I need to put something in httpd.config to enable mod_rewrite. If this is true, what do I need to put in httpd.conf or apache.conf? Please be OS specific...

Delete duplicate records from a SQL table without a primary key

I have the below table with the below records in it create table employee ( EmpId number, EmpName varchar2(10), EmpSSN varchar2(11) ); insert into employee values(1, 'Jack', '555-55-5555'); inser..

Node.js Error: connect ECONNREFUSED

I am new to node and running into this error on a simple tutorial. I am on the OS X 10.8.2 trying this from CodeRunner and the Terminal. I have also tried putting my module in the node_modules folder..

Why isn't .ico file defined when setting window's icon?

When I tried to change the window icon in the top left corner from the ugly red "TK" to my own favicon using the code below, Python threw an error: from tkinter import * root = Tk() #some buttons, w..

How to find out the number of CPUs using python

I want to know the number of CPUs on the local machine using Python. The result should be user/real as output by time(1) when called with an optimally scaling userspace-only program...

How to get complete address from latitude and longitude?

I want to get following values from Latitude and Longitude in android Street Address City / State Zip Complete Address How to achieve this?..

reading and parsing a TSV file, then manipulating it for saving as CSV (*efficiently*)

My source data is in a TSV file, 6 columns and greater than 2 million rows. Here's what I'm trying to accomplish: I need to read the data in 3 of the columns (3, 4, 5) in this source file The fifth..

How to identify object types in java

Possible Duplicate: How to determine an object's class (in Java)? Java determine which class an object is I have following sample incomplete method to compare the object type of a giv..

How do operator.itemgetter() and sort() work?

I have the following code: # initialize a = [] # create the table (name, age, job) a.append(["Nick", 30, "Doctor"]) a.append(["John", 8, "Student"]) a.append(..

css width: calc(100% -100px); alternative using jquery

I'd like to use width: calc(100% -100px); which does the job perfectly for what I need it for, the only problem is its compatibility. At the moment it only works in the latest browsers and not at all ..

c++ bool question

in c++ , the bool , is that true == 1, false == 0?? thanks..

Copying files to a container with Docker Compose

I have a Dockerfile where I copy an existing directory (with content) to the container which works fine: Dockerfile FROM php:7.0-apache COPY Frontend/ /var/www/html/aw3somevideo/ COPY Frontend/ /var..

How to get all count of mongoose model?

How can I know the count of a model that data has been saved? there is a method of Model.count(), but it doesn't seem to work. var db = mongoose.connect('mongodb://localhost/myApp'); var use..

Get row-index values of Pandas DataFrame as list?

I'm probably using poor search terms when trying to find this answer. Right now, before indexing a DataFrame, I'm getting a list of values in a column this way... list = list(df['column']) ...the..

javascript get x and y coordinates on mouse click

I have a little div tag that when I click it (onClick event), it will run the printMousePos() function. This is the HTML tags: <html> <header> <!-- By the way, this is not..

Can I pass a JavaScript variable to another browser window?

I have a page which spawns a popup browser window. I have a JavaScript variable in the parent browser window and I would like to pass it to the popped-up browser window. Is there a way to do this? I ..

configuring project ':app' failed to find Build Tools revision

My android gradle build fails with a helpful error message $ gradle FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring project ':app'. > failed to find Bu..

Run two async tasks in parallel and collect results in .NET 4.5

I've been trying for a while to get something I thought would be simple working with .NET 4.5 I want to fire off two long running tasks at same time and collect the results in in the best C# 4.5 ..

Gradle store on local file system

How does Gradle store downloaded jar files on the local file system? Maven stores them in the .m2 directory under USER_HOME, but where does Gradle store them? I checked the .gradle folder there, but s..

Regular expression for only characters a-z, A-Z

I don't know how to create a regular expression in JavaScript or jQuery. I want to create a regular expression that will check if a string contains only characters between a-z and A-Z with any arrang..