Questions Tagged with #Read unread

Detecting negative numbers

I was wondering if there is any way to detect if a number is negative in PHP? I have the following code: $profitloss = $result->date_sold_price - $result->date_bought_price; I need to find o..

Fatal error: Out of memory, but I do have plenty of memory (PHP)

Since my question is getting longer and longer, I decide to re-write the whole question to make it better and shorter. I run my website on dedicated server with 8GB memory. I am fully aware that I ne..

MySQL combine two columns and add into a new column

I have the following structure with a MySQL table: +----------------+----------------+----------+ | zipcode | city | state | +----------------+----------------+----------+ | 1..

Python wildcard search in string

Lets say that I have a list list = ['this','is','just','a','test'] how can I have a user do a wildcard search? Search Word: 'th_s' Would return 'this'..

Change a Django form field to a hidden field

I have a Django form with a RegexField, which is very similar to a normal text input field. In my view, under certain conditions I want to hide it from the user, and trying to keep the form as simila..

Java: Convert a String (representing an IP) to InetAddress

Possible Duplicate: Is there an easy way to convert String to Inetaddress in Java? I'm trying to convert a string(representing an IP address, e.g. into an InetAddress obj. Acc..

How to emulate a do-while loop in Python?

I need to emulate a do-while loop in a Python program. Unfortunately, the following straightforward code does not work: list_of_ints = [ 1, 2, 3 ] iterator = list_of_ints.__iter__() element = None w..

pow (x,y) in Java

What's the difference between: Math.pow ( x,y ); // x^y To: x^y; // x^y ? Will I prefer to use x^y with double type numbers? Or shell I have to use always with Math.pow() method?..

ERROR 1067 (42000): Invalid default value for 'created_at'

When I tried to alter the table it showed the error: ERROR 1067 (42000): Invalid default value for 'created_at' I googled for this error but all I found was as if they tried to alter the timestamp ..

How can I get the count of line in a file in an efficient way?

I have a big file. It includes approximately 3.000-20.000 lines. How can I get the total count of lines in the file using Java?..

Sequelize OR condition object

By creating object like this var condition= { where: { LastName:"Doe", FirstName:["John","Jane"], Age:{ gt:18 } } } and pass it in Student.findAll(condition) ...

Find files containing a given text

In bash I want to return file name (and the path to the file) for every file of type .php|.html|.js containing the case-insensitive string "document.cookie" | "setcookie" How would I do that?..

How to convert XML to java.util.Map and vice versa

I'm searching a lightweight API (preferable single class) to convert a Map<String,String> map = new HashMap<String,String(); to xml and, vice versa, convert the XML back to a Map. example..

How to access parent scope from within a custom directive *with own scope* in AngularJS?

I'm looking for any manner of accessing the "parent" scope within a directive. Any combination of scope, transclude, require, passing in variables (or the scope itself) from above, etc. I'm totally ..

Testing whether a value is odd or even

I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 || !!(n && !(n%2)); } function isOdd(n) { return i..

Remove characters from NSString?

NSString *myString = @"A B C D E F G"; I want to remove the spaces, so the new string would be "ABCDEFG"...

What's the difference between <mvc:annotation-driven /> and <context:annotation-config /> in servlet?

I am migrating from Spring 2.5 to Spring 3. They have introduced <mvc:annotation-driven /> which does some black magic. This is expected to be declared in servlet configuration file only. In ..

How to default to other directory instead of home directory

I am developing on a windows machine. The only place I need for linux command line is Git Bash. The problem is: When I open it, I am in the home directory. I have to change the directory to my workspa..

Detect whether a Python string is a number or a letter

How can I detect either numbers or letters in a string? I am aware you use the ASCII codes, but what functions take advantage of them?..

Set The Window Position of an application via command line

I have an application which start in 0x0 position of my desktop. I want to open it in center of my desktop. I do not want to open it and use a move command to move it into center, just want my app to ..

How to make a link open multiple pages when clicked

I have two (or more) links. For example: and How can I make them both open when I click on a single link? For example, a link entitled "click here" which, when cl..

UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory'

I have a database configuration class to connect my spring web service with the database. I'm using spring boot, to make it stand alone application. Here is my class @Configuration @EnableTransactio..

How to clear variables in ipython?

Sometimes I rerun a script within the same ipython session and I get bad surprises when variables haven't been cleared. How do I clear all variables? And is it possible to force this somehow every tim..

Python 2: AttributeError: 'list' object has no attribute 'strip'

I have a small problem with list. So i have a list called l: l = ['Facebook;Google+;MySpace', 'Apple;Android'] And as you can see I have only 2 strings in my list. I want to separate my list l by '..

Drawing in Java using Canvas

I want to draw in Java's Canvas but can't get it work because I don't know what I'm doing. Here's my simple code: import javax.swing.JFrame; import java.awt.Canvas; import java.awt.Graphics; import ..

Is it possible to format an HTML tooltip (title attribute)?

Is it possible to format an HTML tooltip? E.g. I have a DIV with attribute title="foo!". When I have text-size of my browser zoomed in or out in, the text size of the tooltip remains unchanged. Is ..

How to use cURL in Java?

I am a newbie in java and wanted to use curl in java. What is my question is curl built-in in java or I have to install it from any 3rd party source to use with Java. If so, how to install curl in jav..

Collectors.toMap() keyMapper -- more succinct expression?

I'm trying to come up with a more succinct expression for the "keyMapper" function parameter in the following Collectors.toMap() call: List<Person> roster = ...; Map<String, Person> map..

Difference between a Seq and a List in Scala

I've seen in many examples that sometimes a Seq is being used, while other times is the List... Is there any difference, other than the former one being a Scala type and the List coming from Java?..

Opening a SQL Server .bak file (Not restoring!)

I have been reading a LOT of google posts and StackOverflow questions about how to restore a database in SQL Server from a .bak file. But none of them states how to just READ the tables in the databa..

How can I wait for a thread to finish with .NET?

I've never really used threading before in C# where I need to have two threads, as well as the main UI thread. Basically, I have the following. public void StartTheActions() { // Starting thread 1....

Raw_Input() Is Not Defined

I'm a seventh grade programmer so I may be missing a lot of things in this program, but for my coding club my instructor asked us to make a guess the number game. I have very limited knowledge on this..

How can I convert a series of images to a PDF from the command line on linux?

I have a scanning server I wrote in cgi/bash and want to be able to convert a bunch of images (all in one folder) to a pdf from the command line. How can that be done?..

Jenkins: Is there any way to cleanup Jenkins workspace?

How can I cleanup the workspace in Jenkins? I am using AccuRev as version control tool. I created freestyle projects in Jenkins...

How do we count rows using older versions of Hibernate (~2009)?

For example, if we have a table Books, how would we count total number of book records with hibernate?..

How do I set a fixed background image for a PHP file?

I have an .html file with a login form and wish to recreate it and save it as a .php file. However, I'm encountering difficulties with setting the background image and other CSS related stuff. Below..

What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow?

What is the difference between 'SAME' and 'VALID' padding in tf.nn.max_pool of tensorflow? In my opinion, 'VALID' means there will be no zero padding outside the edges when we do max pool. Accordin..

Inserting HTML into a div

I am trying to insert a chunk of HTML into a div. I want to see if plain JavaScript way is faster than using jQuery. Unfortunately, I forgot how to do it the 'old' way. :P var test2 = function(){ ..

Show div on scrollDown after 800px

I want to show a hidden div when scrolling down after 800px from the top of the page. By now I have this example, but I guess it needs modification in order to achive what I am looking for. EDIT: [A..

git ignore vim temporary files

What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?..

Setting the default value of a DateTime Property to DateTime.Now inside the System.ComponentModel Default Value Attrbute

Does any one know how I can specify the Default value for a DateTime property using the System.ComponentModel DefaultValue Attribute? for example I try this: [DefaultValue(typeof(DateTime),DateTime...

How to hide form code from view code/inspect element browser?

I want to hide form code from view code/inspect element browser , how can i do that ? This is my code, please see below: <div style=" text-align: center; padding: 300px; font-family: lato; ">..

Arithmetic operation resulted in an overflow. (Adding integers)

I can't understand this error: In this call to method SetVolume, Volume = 2055786000 and size = 93552000. Volume is an Integer property, and size is also Integer, as you can see. The class is a pa..

Find and extract a number from a string

I have a requirement to find and extract a number contained within a string. For example, from these strings: string test = "1 test" string test1 = " 1 test" string test2 = "test 99" How can I do ..

How to randomize Excel rows

How can I randomize lots of rows in Excel? For example I have an excel sheet with data in 3 rows. 1 A dataA 2 B dataB 3 C dataC I want to randomize the row order. For example 2 B dataB 1 A dataA ..

Change EditText hint color when using TextInputLayout

I am using the new TextInputLayout from the design library. I am able to get it to show and to change the color of the floating label. Unfortunately the actual EditText hint is now always white. I h..

bootstrap.min.js:6 Uncaught Error: Bootstrap dropdown require Popper.js

Suddenly I started to get error when I try to open my dropdown menu : bootstrap.min.js:6 Uncaught Error: Bootstrap dropdown require Popper.js ( at bootstrap.min.js:6 ..

Is there a way to style a TextView to uppercase all of its letters?

I would like to be able to assign a xml attribute or style to a TextView that will make whatever text it has in ALL CAPITAL LETTERS. The attributes android:inputType="textCapCharacters" and android:c..

Animate element to auto height with jQuery

I want to animate a <div> from 200px to auto height. I can’t seem to make it work though. Does anyone know how? Here’s the code: $("div:first").click(function(){ $("#first").animate({ ..

Where do I configure log4j in a JUnit test class?

Looking at the last JUnit test case I wrote, I called log4j's BasicConfigurator.configure() method inside the class constructor. That worked fine for running just that single class from Eclipse's "ru..

SQL Error: ORA-00942 table or view does not exist

I use SQL developer and i made a connection to my database with the system user, after I created a user and made a another connection with that user with all needed privileges. But when I try to proc..

Variable name as a string in Javascript

Is there a way to get a variable name as a string in Javascript? (like NSStringFromSelector in Cocoa) I would like to do like this: var myFirstName = 'John'; alert(variablesName(myFirstName) + ":" +..

int object is not iterable?

inp = int(input("Enter a number:")) for i in inp: n = n + i; print (n) ... throws an error: 'int' object is not iterable I wanted to find out the total by adding each digit, for eg, 110. 1..

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 create an array containing 1...N

I'm looking for any alternatives to the below for creating a JavaScript array containing 1 through to N where N is only known at runtime. var foo = []; for (var i = 1; i <= N; i++) { foo.push(i..

Center a DIV horizontally and vertically

Is there a way to CENTER A DIV vertically and horizontally but, and that is important, that the content will not be cut when the window is smaller than the content The div must have a background colo..

What does %w(array) mean?

I'm looking at the documentation for FileUtils. I'm confused by the following line: FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6' What does the %w mean? Can you point me to th..

Installing Java 7 on Ubuntu

to install java I have always used the classic way from the terminal. I would like to install java manually. I placed the folder of the JDK on the desk and I set environment variables (PATH, CLASSPATH..

Digital Certificate: How to import .cer file in to .truststore file using?

Has anyone came across where they have to deal with .truststore file? and knowing how to import .cer into .truststore file? I am not sure if I have to use Java Keytool or Linux command (such as open..

Flexbox and Internet Explorer 11 (display:flex in <html>?)

I am planning to move away from "floaty" layouts and use CSS flexbox for future projects. I was delighted to see that all major browsers in their current versions seem to support (in one way or anothe..

Running JAR file on Windows

I have a JAR file named helloworld.jar. In order to run it, I'm executing the following command in a command-line window: java -jar helloworld.jar This works fine, but how do I execute it with doub..

What are the special dollar sign shell variables?

In Bash, there appear to be several variables which hold special, consistently-meaning values. For instance, ./myprogram &; echo $! will return the PID of the process which backgrounded myprogr..

Drop columns whose name contains a specific string from pandas DataFrame

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

Async/Await Class Constructor

At the moment, I'm attempting to use async/await within a class constructor function. This is so that I can get a custom e-mail tag for an Electron project I'm working on. customElements.define('e-m..

python selenium click on button

I am quite new to python selenium and I am trying to click on a button which has the following html structure: <div class="b_div"> <div class="button c_button s_button" onclick="submitF..

@viewChild not working - cannot read property nativeElement of undefined

I'm trying to access a native element in order to focus on it when another element is clicked (much like the html attribute "for" - for cannot be used on elements of this type. However I get the erro..

Invoking JavaScript code in an iframe from the parent page

Basically, I have an iframe embedded in a page and the iframe has some JavaScript routines I need to invoke from the parent page. Now the opposite is quite simple as you only need to call parent.func..

Make docker use IPv4 for port binding

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

Sending HTTP Post request with SOAP action using org.apache.http

I'm trying to write a hard-coded HTTP Post request with SOAP action, using the org.apache.http api. My problem is I didn't find a way to add a request body (in my case - SOAP action). I'll be glad for..

Create a string with n characters

Is there a way in java to create a string with a specified number of a specified character? In my case, I would need to create a string with 10 spaces. My current code is: StringBuffer outputBuffer..

Reliable method to get machine's MAC address in C#

I need a way to get a machine's MAC address, regardless of the OS it is running, by using C#. The application will need to work on XP/Vista/Win7 32bit and 64bit, as well as on those OSs but with a for..

How to style a checkbox using CSS

I am trying to style a checkbox using the following: _x000D_ _x000D_ <input type="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;" />_x000D_ _x000D_ _x000D_ But the ..

How, in general, does Node.js handle 10,000 concurrent requests?

I understand that Node.js uses a single-thread and an event loop to process requests only processing one at a time (which is non-blocking). But still, how does that work, lets say 10,000 concurrent re..

Android; Check if file exists without creating a new one

I want to check if file exists in my package folder, but I don't want to create a new one. File file = new File(filePath); if(file.exists()) return true; Does this code check without creating..

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'

I want to begin writing queries in MySQL. show grants shows: +--------------------------------------+ | Grants for @localhost | +--------------------------------------+ | GRANT USAGE ..

Replacing Pandas or Numpy Nan with a None to use with MysqlDB

I am trying to write a Pandas dataframe (or can use a numpy array) to a mysql database using MysqlDB . MysqlDB doesn't seem understand 'nan' and my database throws out an error saying nan is not in th..

Html.HiddenFor value property not getting set

I could have used @Html.HiddenFor(x=> ViewData["crn"]) but, I get, <input id="ViewData_crn_" name="ViewData[crn]" type="hidden" value="500" /> To somehow circumvent that issue(id=ViewDa..

How does Subquery in select statement work in oracle

I have looked all over for an explanation, to how does the subquery in a select statement work and still I cannot grasp the concept because of very vague explanations. I would like to know how do you..

How do I run Python script using arguments in windows command line

This is my python script: def hello(a,b): print "hello and that's your sum:" sum=a+b print sum import sys if __name__ == "__main__": hello(sys.argv[2]) The problem is ..

How can I get the full object in Node.js's console.log(), rather than '[Object]'?

When debugging using console.log(), how can I get the full object? const myObject = { "a":"a", "b":{ "c":"c", "d":{ "e":"e", "f":{ "g":"g", ..

Why does the Visual Studio editor show dots in blank spaces?

I have a strange bug in the Visual Studio text editor. All my blank spaces are replaced by a "." public class Person { int age; } looks like this public..class..Person.......................... ..

Swapping two variable value without using third variable

One of the very tricky questions asked in an interview. Swap the values of two variables like a=10 and b=15. Generally to swap two variables values, we need 3rd variable like: temp=a; a=b; b=temp; ..

C# Double - ToString() formatting with two decimal places but no rounding

How do I format a Double to a String in C# so as to have only two decimal places? If I use String.Format("{0:0.00}%", myDoubleValue) the number is then rounded and I want a simple truncate without a..

How to get the latest record in each group using GROUP BY?

Let's say I have a table called messages with the columns: id | from_id | to_id | subject | message | timestamp I want to get the latest message from each user only, like you would see in your Face..

Redirecting Output from within Batch file

I am creating a batch file with some simple commands to gather information from a system. The batch file contains commands to get the time, IP information, users, etc. I assembled all the commands ..

Which MIME type to use for a binary file that's specific to my program?

My program uses its own binary file type, so I assume I can't use MIME type text/plain, as it is not a 7-bit ASCII file. Should I just call it "application/myappname"?..

batch/bat to copy folder and content at once

I'm writing a batch script that does a copy. I want to script it to copy an entire folder. When I want to copy a single file, I do this copy %~dp0file.txt file.txt If I have a folder with this st..

Visual Studio build fails: unable to copy exe-file from obj\debug to bin\debug

Update: A sample project reproducing this bug can be found here at Microsoft Connect. I have also tested and verified that the solution given in the accepted answer below works on that sample project...

In Angular, how to redirect with $location.path as $ success callback

I am attempting to make a simple authentication service by sending a Post to a php file, I need it to load the home page partial on my ng-view when its successful. This is what I tried : function lo..

convert json ipython notebook(.ipynb) to .py file

How do you convert an IPython notebook file (json with .ipynb extension) into a regular .py module?..

How to update/modify an XML file in python?

I have an XML document that I would like to update after it already contains data. I thought about opening the XML file in "a" (append) mode. The problem is that the new data will be written after th..

How do I solve this error, "error while trying to deserialize parameter"

I have a web service that is working fine in one environment but not in another. The web service gets document meta data from SharePoint, it running on a server where I cant debug but with logging I ..

Where to declare variable in react js

I am trying to declare a variable in a react-js class. The variable should be accessible in different functions. This is my code class MyContainer extends Component { constructor(props) { ..

What causes a TCP/IP reset (RST) flag to be sent?

I'm trying to figure out why my app's TCP/IP connection keeps hiccuping every 10 minutes (exactly, within 1-2 seconds). I ran Wireshark and discovered that after 10 minutes of inactivity the other en..

Forward host port to docker container

Is it possible to have a Docker container access ports opened by the host? Concretely I have MongoDB and RabbitMQ running on the host and I'd like to run a process in a Docker container to listen to..

How to resize superview to fit all subviews with autolayout?

My understanding of autolayout is that it takes the size of superview and base on constrains and intrinsic sizes it calculates positions of subviews. Is there a way to reverse this process? I want to..

Importing modules from parent folder

I am running Python 2.5. This is my folder tree: ptdraft/ simulations/ life/ (I also have in each folder, omitted here for readability) How do I import th..

What's the best way to add a drop shadow to my UIView

I am trying to add a drop shadow to views that are layered on top of one another, the views collapse allowing content in other views to be seen, in this vein i want to keep view.clipsToBounds ON so th..

Error inflating when extending a class

I'm trying to create a custom view GhostSurfaceCameraView that extends SurfaceView. Here's my class definition file public class GhostSurfaceCameraView extends SurfaceV..

IIs Error: Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication”

I am trying to deploy my web project and I keep getting this error: Line 1: <%@ Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication” Language=“C#” %> I looked ..

AngularJS ngClass conditional

Is there any way to make an expression for something like ng-class to be a conditional? For example, I have tried the following: <span ng-class="{test: 'obj.value1 == \'someothervalue\''}">tes..

How do I create a new Git branch from an old commit?

Possible Duplicate / a more recent/less clear question Branch from a previous commit using Git I have a Git branch called jzbranch and have an old commit id: a9c146a09505837ec03b. How do I ..

TypeError: no implicit conversion of Symbol into Integer

I encounter a strange problem when trying to alter values from a Hash. I have the following setup: myHash = { company_name:"MyCompany", street:"Mainstreet", postcode:"1234", city:"MyCity",..

Git Bash is extremely slow on Windows 7 x64

I've been using Git on both Windows and Ubuntu during the development of a small project, frequently flipping back and forth between the two. The issue is that Git Bash consistently becomes slow. Whe..

T-SQL How to create tables dynamically in stored procedures?

Code like this, but it's wrong: CREATE PROC sp_createATable @name VARCHAR(10), @properties VARCHAR(500) AS CREATE TABLE @name ( id CHAR(10) PRIMARY KEY, --...Properties extr..

How to hide collapsible Bootstrap 4 navbar on click

I've created this collapsable navbar using Bootstrap 4 that works nicely, but I would like it to close when the user clicks on a link. Any way to do this? Thanks html navbar: <nav class="navbar ..

jQuery get specific option tag text

All right, say I have this: <select id='list'> <option value='1'>Option A</option> <option value='2'>Option B</option> <option value='3'>Option C</o..

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

Python: SyntaxError: keyword can't be an expression

In a Python script I call a function from rpy2, but I get this error: #using an R module res = DirichletReg.ddirichlet(np.asarray(my_values),alphas, log=False, sum.up=F..

How to create an executable .exe file from a .m file

I was wondering if there is a way to create a '.exe' file from ' .m' file in MATLAB, such that it can be run in machine which does not have MATLAB (like it can be done in C, C++). I know writing a M..

Value cannot be null. Parameter name: source

This is probably the biggest waste of time problem I have spent hours on solving for a long time. var db = new hublisherEntities(); establishment_brands est = new establishment_brands(); est.brand_i..

Get top n records for each group of grouped results

The following is the simplest possible example, though any solution should be able to scale to however many n top results are needed: Given a table like that below, with person, group, and age column..

Bootstrap 4 Dropdown Menu not working?

I copied the official Bootstrap 4 example for dropdown menus but it is not working, that is nothing is dropped down. <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" hr..

Can Windows Containers be hosted on linux?

Is it possible to run Windows Containers on Linux? The scenario is based on an app written in the .NET (old net) and the Linux user that wants to run this with Docker to provide a net462 written API o..

How to avoid the "Circular view path" exception with Spring MVC test

I have the following code in one of my controllers: @Controller @RequestMapping("/preference") public class PreferenceController { @RequestMapping(method = RequestMethod.GET, produces = "text/ht..

How do you select a particular option in a SELECT element in jQuery?

If you know the Index, Value or Text. also if you don't have an ID for a direct reference. This, this and this are all helpful answers. Example markup <div class="selDiv"> <select class=..

Python: How to create a unique file name?

I have a python web form with two options - File upload and textarea. I need to take the values from each and pass them to another command-line program. I can easily pass the file name with file uploa..

How to convert DOS/Windows newline (CRLF) to Unix newline (LF) in a Bash script?

How can I programmatically (i.e., not using vi) convert DOS/Windows newlines to Unix? The dos2unix and unix2dos commands are not available on certain systems. How can I emulate these with commands li..

Copying files into the application folder at compile time

If I have some files I want to copy from my project into the .\bin\debug\ folder on compilation, then it seems I have to put them into the root of the project. Putting them into a subfolder seems to c..

Subprocess check_output returned non-zero exit status 1

This is my python code: import subprocess subprocess.check_output("ls",shell=True,stderr=subprocess.STDOUT) import subprocess subprocess.check_output("yum",shell=True,stderr=subprocess.STDOUT) The..

Maximum request length exceeded.

I am getting the error Maximum request length exceeded when I am trying to upload a video in my site. How do I fix this?..

Call to undefined method mysqli_stmt::get_result

Here's my code: include 'conn.php'; $conn = new Connection(); $query = 'SELECT EmailVerified, Blocked FROM users WHERE Email = ? AND SLA = ? AND `Password` = ?'; $stmt = $conn->mysqli->prepare..

Unable to capture screenshot. Prevented by security policy. Galaxy S6. Android 6.0

Does someone know how to turn off this screen? Also phone has a message (Toast) when trying to make a screenshot: Unable to capture screenshot. Prevented by security policy . One of recomme..

Removing NA in dplyr pipe

I tried to remove NA's from the subset using dplyr piping. Is my answer an indication of a missed step. I'm trying to learn how to write functions using dplyr: > outcome.df%>% + group_by(Hospit..

Get ID of element that called a function

How can I get the ID of an element that called a JS function? body.jpg is an image of a dog as the user points his/her mouse around the screen at different parts of the body an enlarged image is sho..

Android java.lang.NoClassDefFoundError

I have an Android project in eclipse IDE which was working. After some imports and tests, I get the error: java.lang.NoClassDefFoundError. In my project I have two packages: the main one and the sec..

Changing button color programmatically

Is there a way to change the color of a button, or at least the color of the button label programmatically? I can change the label itself with document.getElementById("button")

How to get visitor's location (i.e. country) using geolocation?

I'm trying to extend the native geolocation function if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { var latitude = position.coords.latitude; ..

PHP error: Notice: Undefined index:

I am working on a shopping cart in PHP and I seem to be getting this error "Notice: Undefined index:" in all sorts of places. The error refers to the similar bit of coding in different places. For exa..

<hr> tag in Twitter Bootstrap not functioning correctly?

Here is my code: <div class="container"> <div> <h1>Welcome TeamName1</h1> asdf <hr> asdf </div> </div> <!-- /container --> The hr tag does not..

How to convert latitude or longitude to meters?

If I have a latitude or longitude reading in standard NMEA format is there an easy way / formula to convert that reading to meters, which I can then implement in Java (J9)? Edit: Ok seems what I want..

How to call a function, PostgreSQL

I'm trying to use a function with PostgreSQL to save some data. Here is the create script: -- Function: "saveUser"(integer, character varying, character varying, character varying, character..

How to install a .ipa file into my iPhone?

I need to install an app into my iPhone, I have the .ipa file of that app and also my device is added to the developer's account. I downloaded the file and open it in iTunes and when I am trying to s..

Java Mouse Event Right Click

On my three button mouse MouseEvent.BUTTON2= Middle Click and MouseEvent.BUTTON3 = Right Click. Is this the case on a two button mouse? Thanks..

Using Python, find anagrams for a list of words

If I have a list of strings for example: ["car", "tree", "boy", "girl", "arc"...] What should I do in order to find anagrams in that list? For example (car, arc). I tried using for loop for each st..

System.Net.WebException: The operation has timed out

I have a big problem: I need to send 200 objects at once and avoid timeouts. while (true) { NameValueCollection data = new NameValueCollection(); data.Add("mode", nat); using (var clien..

"Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions" error

Why am I receiving the error: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions at this code: @model IE..

How do I call a function twice or more times consecutively?

Is there a short way to call a function twice or more consecutively in Python? For example: do() do() do() maybe like: 3*do() ..

How do I make a C++ console program exit?

Is there a line of code that will terminate the program? Something like python's sys.exit()?..

How can I get the number of days between 2 dates in Oracle 11g?

I'm trying to find an integer number of days between two dates in Oracle 11g. I can get close by doing select sysdate - to_date('2009-10-01', 'yyyy-mm-dd') from dual but this returns an interva..

How to install a package inside virtualenv?

I created a virtualenv with the following command. mkvirtualenv --distribute --system-site-packages "$1" After starting the virtualenv with workon, I type ipython. It prompts me WARNING: Attempti..

How to use Bash to create a folder if it doesn't already exist?

#!/bin/bash if [!-d /home/mlzboy/b2c2/shared/db]; then mkdir -p /home/mlzboy/b2c2/shared/db; fi; This doesn't seem to work. Can anyone help?..

ConcurrentModificationException for ArrayList

I have the following piece of code: private String toString(List<DrugStrength> aDrugStrengthList) { StringBuilder str = new StringBuilder(); for (DrugStrength aDrugStrength : aDrugS..

How do I make a semi transparent background?

I need to make a white background 50% transparent without affecting anything else. How do I do it?..

Laravel 5.1 - Checking a Database Connection

I am trying to check if a database is connected in Laravel. I've looked around the documentation and can't find anything. The closest thing I've found is this, but this doesn't solve my problem. I h..

Spring Boot Java Config Set Session Timeout

How can I configure my (embedded) Tomcat Session Timeout in a Spring Boot Application? public class SessionListener implements HttpSessionListener{ @Override public void sessionCreated(HttpSessionEv..

exception in initializer error in java when using Netbeans

I am using Netbeans. I did some things with bindings and now whenever I start my program, before it even initializes the form, it gives me an error The exception in thread main is occuring before the..

How do I find out which process is locking a file using .NET?

I've seen several of answers about using Handle or Process Monitor, but I would like to be able to find out in my own code (C#) which process is locking a file. I have a nasty feeling that I'm going t..

How to wait till the response comes from the $http request, in angularjs?

I am using some data which is from a RESTful service in multiple pages. So I am using angular factories for that. So, I required to get the data once from the server, and everytime I am getting the da..

Git merge without auto commit

Is it possible to do a git merge, but without a commit? "man git merge" says this: With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to..

Parsing ISO 8601 date in Javascript

Need help/tips on converting an ISO 8601 date with the following structure into javascript. CCYY-MM-DDThh:mm:ssTZD I'd like to format the date like so: January 28, 2011 - 7:30PM EST I'd like to ..

Show an image preview before upload

In my HTML form I have input filed with type file for example : <input type="file" multiple> Then I'm selecting multiple files by clicking that input button. Now I want to show preview of s..

How to write the code for the back button?

I have a php code here and I would like to create a "back" href to get me back to where I was before. Here's what I have: <input type="submit" <a href="#" onclick=&..

Fake "click" to activate an onclick method

I have an element with an onclick method. I would like to activate that method (or: fake a click on this element) within another function. Is this possible?..

Declaring a python function with an array parameters and passing an array argument to the function call?

I am a complete newbie to python and attempting to pass an array as an argument to a python function that declares a list/array as the parameter. I am sure I am declaring it wrong, here goes: def d..

Apache shutdown unexpectedly

I am using XAMPPS to host PHP files from my machine. I have recently installed XAMPPs but I am unable to start Apache service as port 80 is in use by PID 4 - NT Kernel & System. I know by using a..

GridView Hide Column by code

I want to hide ID column in my GridView, I knew the code GridView1.Columns[0].Visible = false; but the surprise was that my count property for my GridView columns is 0 !!! while I can see data in ..

PHP file_get_contents() returns "failed to open stream: HTTP request failed!"

I am having problems calling a url from PHP code. I need to call a service using a query string from my PHP code. If I type the url into a browser, it works ok, but if I use file-get-contents() to mak..

How to replace (null) values with 0 output in PIVOT

I tried to convert the (null) values with 0 (zeros) output in PIVOT function but have no sucess. Below is the table and the syntax i've tried" SELECT CLASS, [AZ], [CA], [TX] FROM #TEMP PIVOT (SUM(D..

Encoding conversion in java

Is there any free java library which I can use to convert string in one encoding to other encoding, something like iconv? I'm using Java version 1.3...

How to create dictionary and add key–value pairs dynamically?

From post: Sending a JSON array to be received as a Dictionary<string,string> I’m trying to do this same thing as that post. The only issue is that I don’t know what the keys and the value..

How to cast Object to boolean?

How can I cast a Java object into a boolean primitive I tried like below but it doesn't work boolean di = new Boolean(someObject).booleanValue(); The constructor Boolean(Object) is undefined ..

How to open google chrome from terminal?

I'm trying to create an alias that opens google chrome to localhost. Port 80 in this case. I'd also really like to be able to be in any git directory and have it open that specific project in the br..

jQuery find and replace string

I have somewhere on website a specific text, let's say "lollypops", and I want to replace all the occurrences of this string with "marshmellows". The problem is that I don't know where exactly the tex..

How do I print bytes as hexadecimal?

I know in C# you can use String.Format method. But how do you do this in C++? Is there a function that allows me to convert a byte to a Hex?? Just need to convert a 8 byte long data to Hex, how do I d..

Having trouble setting working directory

I created a folder in order for it to be the main work directory meaning all the files I create go there, and files I read will be from there. For some reason after I created the folder and I'm trying..

OAuth 2.0 Authorization Header

I want to develop a SDK that encapsules the OAuth 2.0 functions. I have checked the differences between OAuth 1.0 & 2.0, and I have some confusion on Authorization Header (1.0 and 2.0), OAuth 1...

Gray out image with CSS?

What's the best way (if any) to make an image appear "grayed out" with CSS (i.e., without loading a separate, grayed out version of the image)? My context is that I have rows in a table that all have..

Bootstrap Datepicker - Months and Years Only

I am using bootstrap datepicker and my code is like following, Demo of the code on jsfiddle <div class="input-append date" id="datepicker" data-date="02-2012" data-date-format="mm-yyyy"> ..

Fatal error: Call to undefined function base_url() in C:\wamp\www\Test-CI\application\views\layout.php on line 5

Hello I am new to CodeIgniter and PHP, I am trying to setup it for the firs time, but it give the following error. Fatal error: Call to undefined function base_url() in C:\wamp\www\Test-CI\applicati..

Refresh image with a new one at the same url

I am accessing a link on my site that will provide a new image each time it is accessed. The issue I am running into is that if I try to load the image in the background and then update the one on th..

Which HTTP methods match up to which CRUD methods?

In RESTful style programming, we should use HTTP methods as our building blocks. I'm a little confused though which methods match up to the classic CRUD methods. GET/Read and DELETE/Delete are obvious..

How do I align views at the bottom of the screen?

Here's my layout code; <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="" android:orientation="vertical" android:layout_w..

Referring to the null object in Python

How do I refer to the null object in Python?..

Playing a video in VideoView in Android

I can't figure out why I'm not able to play the video in my VideoView. All I'm getting for a message is: Cannot Play Video : Sorry, this video cannot be played. I created an SD card for my emul..

Programmatically change input type of the EditText from PASSWORD to NORMAL & vice versa

In my application, I have an EditText whose default input type is set to android:inputType="textPassword" by default. It has a CheckBox to its right, which is when checked, changes the input..

Parse Json string in C#

I'm trying to read a Json string in C#, but I'm having trouble figuring out just how to parse the string into C#. Say I have the following Json string [ { "AppName": { "Descri..

How to pass prepareForSegue: an object

I have many annotations in a mapview (with rightCalloutAccessory buttons). The button will perform a segue from this mapview to a tableview. I want to pass the tableview a different object (that hold..

How to install Ruby 2.1.4 on Ubuntu 14.04

I dont know how to install the latest Ruby on Ubuntu. First I installed the default Ruby 1.9.3, using sudo apt-get install ruby Then I tried to install the 2.0 version using sudo apt-get install..

Set Label Text with JQuery

This should be quite straight forward, however the following code does not do anything as far as changing the next label's text. I have tried using .text, .html, and so on to no avail. Is there anythi..

Accessing @attribute from SimpleXML

I am having a problem accessing the @attribute section of my SimpleXML object. When I var_dump the entire object, I get the correct output, and when I var_dump the rest of the object (the nested tags..

JavaScript get clipboard data on paste event (Cross browser)

How can a web application detect a paste event and retrieve the data to be pasted? I would like to remove HTML content before the text is pasted into a rich text editor. Cleaning the text after bein..

FloatingActionButton example with Support Library

Recently, I read these posts: Android Design Support Library Android Support Library, revision 22.2.0 FloatingActionButton But, none of them give me a detail example about creating a new FloatingAct..

How to use radio on change event?

I have two radio button on change event i want change button How it is possible? My Code <input type="radio" name="bedStatus" id="allot" checked="checked" value="allot">Allot <input type="..

Why when I transfer a file through SFTP, it takes longer than FTP?

I manually copy a file to a server, and the same one to an SFTP server. The file is 140MB. FTP: I have a rate arround 11MB/s SFTP: I have a rate arround 4.5MB/s I understand the file has to be encr..

UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only

I have this scenario: fetch (read and delete) a record from IncomingMessage table read record content insert something to some tables if an error (any exception) occurred in steps 1-3, insert an err..

WPF Binding StringFormat Short Date String

I would like to use Short Date named string format in WPF. I tried something like: <TextBlock Text="{Binding Date, StringFormat='Short Date'}" /> How to do this?..

Use JSTL forEach loop's varStatus as an ID

I want to use the count from the JSTL forEach loop, but my code doesnt seem to work. <c:forEach items="${loopableObject}" var="theObject" varStatus="theCount"> <div id="divIDNo${theCount..

Java, How to get number of messages in a topic in apache kafka

I am using apache kafka for messaging. I have implemented the producer and consumer in Java. How can we get the number of messages in a topic?..

Float a div above page content

I've implemented a popup box that dynamically displays search options. I want the box to "float" above all of the site content. Currently, when the box is displayed it displaces all of the content b..

Finding the length of an integer in C

I would like to know how I can find the length of an integer in C. For instance: 1 => 1 25 => 2 12512 => 5 0 => 1 and so on. How can I do this in C?..

Updating records codeigniter

I am trying to update a table where id of the row is entered and title is selected through a dropdown list, but I have two problems. Firstly Im not sure how to pass the data to the model, and the seco..

Arithmetic overflow error converting numeric to data type numeric

I keep getting this error message everytime I run this query: Msg 8115, Level 16, State 8, Line 33 Arithmetic overflow error converting numeric to data type numeric. The statement has been terminated..

Compile/run assembler in Linux?

I'm fairly new to Linux (Ubuntu 10.04) and a total novice to assembler. I was following some tutorials and I couldn't find anything specific to Linux. So, my question is, what is a good package to com..

How do I copy a string to the clipboard?

I'm trying to make a basic Windows application that builds a string out of user input and then adds it to the clipboard. How do I copy a string to the clipboard using Python?..

Default value of 'boolean' and 'Boolean' in Java

What are the default values of boolean (primitive) and Boolean (primitive wrapper) in Java?..

Case statement in MySQL

I have a database table called 'tbl_transaction' with the following definition: id INT(11) Primary Key action_type ENUM('Expense', 'Income') action_heading VARCHAR (255) action_amount FLOAT I would..

event.returnValue is deprecated. Please use the standard event.preventDefault() instead

I have this script: <script> $(document).ready(function () { $("#changeResumeStatus").click(function () { $.get("{% url 'main:changeResumeStatus' %}", function (data) { ..

Convert Datetime column from UTC to local time in select statement

I'm doing a few SQL select queries and would like to convert my UTC datetime column into local time to be displayed as local time in my query results. Note, I am NOT looking to do this conversion via ..

How to create Android Facebook Key Hash?

I do not understand this process at all. I have been able to navigate to the folder containing the keytool in the Java SDK. Although I keep getting the error openssl not recognised as an internal or e..