Questions Tagged with #Optical drive

making a paragraph in html contain a text from a file

I have an html paragraph (inside a div) in which I want to display a simple fixed text. The text is a bit long so I'd rather the text will be in a seperate txt file. something like <div><p ..

How to create a pulse effect using -webkit-animation - outward rings

I have found this article: on css3 animations. I am trying to create a similar effect seen on the site above but on personal si..

Catch error if iframe src fails to load . Error :-"Refused to display '' in a frame.."

I am using Knockout.js to bind iframe src tag(This will be configurable with respect to User). Now, if user has configured (I know it won't load in iframe, thats why I am using..

How to make a node.js application run permanently?

On a Debian server, I installed Node.js. I understand how to launch an app from putty with this command line: node /srv/www/MyUserAccount/server/server.js and get to it on the address

PHP Include for HTML?

I have a navigational bar, an image, and a heading that I'll be including in every page of my website, so I wanted to use php include to refer to this code in several pages. However, I think I may hav..

How to find a hash key containing a matching value

Given I have the below clients hash, is there a quick ruby way (without having to write a multi-line script) to obtain the key given I want to match the client_id? E.g. How to get the key for client_i..

What does (function($) {})(jQuery); mean?

I am just starting out with writing jQuery plugins. I wrote three small plugins but I have been simply copying the line into all my plugins without actually knowing what it means. Can someone tell me ..

Mongodb: failed to connect to server on first connect

I get the following error: Warning { MongoError: failed to connect to server [mongodb:27017] on first connect at Pool.<anonymous> (/Users/michaelks/Desktop/users/node_modules/mongodb-core/l..

Read Post Data submitted to ASP.Net Form

I have a working login form in an application. Standard stuff with a username and password text box and a button to process the login. Works fine. I have a new requirement to allow the user..

How to change an Android app's name?

Is there a way to change the name (Launcher App Label) of an app without creating a new project? Note: Name of the App and The label shown on the Launcher Icon on Home Screen on Mobiles can be differ..

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 Would I Ever Need to Use C# Nested Classes

I'm trying to understand about nested classes in C#. I understand that a nested class is a class that is defined within another class, what I don't get is why I would ever need to do this...

Error Code 1292 - Truncated incorrect DOUBLE value - Mysql

I am not sure what is this error! #1292 - Truncated incorrect DOUBLE value: I don't have double value field or data! I have wasted a whole hour trying to figure this out! here is my query INSER..

Using Spring MVC Test to unit test multipart POST request

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

JavaScript require() on client side

Is it possible to use require() (or something similar) on client side? Example var myClass = require('./js/myclass.js'); ..

Parsing string as JSON with single quotes?

I have a string str = "{'a':1}"; JSON.parse(str); VM514:1 Uncaught SyntaxError: Unexpected token '(…) How can I parse the above string (str) into a JSON object ? This seems like a simple parsi..

Angular is automatically adding 'ng-invalid' class on 'required' fields

I am building an angular app for which I have some forms set up. I have some fields that are required to be filled before submission. Therefore I have added 'required' on them: <input type="text" ..

In the shell, what does " 2>&1 " mean?

In a Unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulation, I can append the following on the end of my command: 2>&1 So, if I want to use head o..

Setting selected option in laravel form

I need to give selected value like this html: <select name="myselect" id="myselect"> <option value="1">Item 1</option> <option value="2" selected='selected'>Item 2</optio..

How can I check if a string is null or empty in PowerShell?

Is there a built-in IsNullOrEmpty-like function in order to check if a string is null or empty, in PowerShell? I could not find it so far and if there is a built-in way, I do not want to write a func..

setting content between div tags using javascript

I'm trying to set some content in between some div tags on a JSP page using javascript. currently the div tag on the JSP page looks like this: <div id="successAndErrorMessages"></div> ..

MySQL remove all whitespaces from the entire column

Is there a way to remove all whitespaces from a specific column for all values?..

Use URI builder in Android or create URL with variables

I'm developing an Android app. I need to build a URI for my app to make an API request. Unless there's another way to put a variable in a URI, this is the easiest way I've found. I found that you need..

Reason to Pass a Pointer by Reference in C++?

Under which circumstances would you want to use code of this nature in c++? void foo(type *&in) {...} void fii() { type *choochoo; ... foo(choochoo); } ..

Where do I call the BatchNormalization function in Keras?

If I want to use the BatchNormalization function in Keras, then do I need to call it once only at the beginning? I read this documentation for it: I don't see w..

Extract only right most n letters from a string

How can I extract a substring which is composed of the rightmost six letters from another string? Ex: my string is "PER 343573". Now I want to extract only "343573". How can I do this?..

Get enum values as List of String in Java 8

Is there any Java 8 method or easy way, which returns Enum values as a List of String, like: List<String> sEnum = getEnumValuesAsString(); ..

How to select top 10 in Access query?

My Access database table has 2 columns: name and price. I want to do a query that select the top 10 highest prices. How to do this? Thanks...

How to search in commit messages using command line?

Possible Duplicate: How to search through all commits in the repository? Is there a way to search through commit headers using the command line?..

How do I recognize "#VALUE!" in Excel spreadsheets?

I'd like to write a formula such that if cell A1 displays #VALUE!, say TRUE in cell B1. Here's my formula in cell B1: =IF(A1="#VALUE!", "TRUE", "FALSE") I get FALSE when A1 does not say #VALUE! so..

How to avoid the "divide by zero" error in SQL?

I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide by zero error encountered. What is the best way to write SQL code so that I will never see this error message again? I coul..

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

The network adapter could not establish the connection - Oracle 11g

I wrote a servlet program and I want it to connect to my Oracle database but its giving me an error. I am using Eclipse Helios, Tomcat 6.0.37, Oracle 11g (, ojdbc6.jar(added in run configur..

Node.js setting up environment specific configs to be used with everyauth

I am using node.js + express.js + everyauth.js. I have moved all my everyauth logic into a module file var login = require('./lib/everyauthLogin'); inside this I load my oAuth config file with the ..

How do I get the time of day in javascript/Node.js?

I want to get 1 to 24, 1 being 1am Pacific Time. How can I get that number in Node.JS? I want to know what time it is in Pacific time right now...

Removing a Fragment from the back stack

I have a 3 fragments in an activity when the a tablet is held in portrait. However I only have 2 of these fragments when in landscape. The problem I am having is when going from portrait to landscape ..

How to add colored border on cardview?

I am new to Android and this is my first question here. I am trying to add a colored vertical border at the beginning of the cardview. How can I achieve it on xml ? I tried adding it with empty textv..

How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?

I want my batch file to only run elevated. If not elevated, provide an option for the user to relaunch batch as elevated. I'm writing a batch file to set a system variable, copy two files to a Progra..

How to use a WSDL

I need to consume a Web Service. They sent me the WSDL file. What should I do to add it to my website and start using it as the proxy. ( If I put it on a Virtual Directory it can be discovered, but d..

IF function with 3 conditions

I'm looking to create a formula with 3 conditions. It is currently only working with 2 conditions. Here's what I'm looking for: E9 has a number If the number is 21+ then I want it to show Text 1 I..

Return 0 if field is null in MySQL

In MySQL, is there a way to set the "total" fields to zero if they are NULL? Here is what I have: SELECT uo.order_id, uo.order_total, uo.order_status, (SELECT SUM(uop.price * uop.qty) ..

Is there shorthand for returning a default value if None in Python?

In C#, I can say x ?? "", which will give me x if x is not null, and the empty string if x is null. I've found it useful for working with databases. Is there a way to return a default value if Pytho..

ORA-01438: value larger than specified precision allows for this column

We get sometimes the following error from our partner's database: <i>ORA-01438: value larger than specified precision allows for this column</i> The full response looks like the followi..

Difference between map, applymap and apply methods in Pandas

Can you tell me when to use these vectorization methods with basic examples? I see that map is a Series method whereas the rest are DataFrame methods. I got confused about apply and applymap methods..

restart mysql server on windows 7

How do I restart MySQL on Windows 7? I'm using HeidiSql as a front end and there's no option in there. The only other things I have is the MySQL 5.5 command line client...

Why are exclamation marks used in Ruby methods?

In Ruby some methods have a question mark (?) that ask a question like include? that ask if the object in question is included, this then returns a true/false. But why do some methods have exclamatio..

How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version

I am trying to use Notepad++ as my all-in-one tool edit, run, compile, etc. I have JRE installed, and I have setup my path variable to the .../bin directory. When I run my "Hello world" in Notepad++..

Find and replace with a newline in Visual Studio Code

I am trying out the new Microsoft Visual Studio Code editor in Linux Fedora environment. I would like to know how to replace new line (\n) in place of some other text. For example, I have html text ..

How to redirect cin and cout to files?

How can I redirect cin to in.txt and cout to out.txt?..

How to delete shared preferences data from App in Android

How do I delete SharedPreferences data for my application? I'm creating an application that uses a lot of web services to sync data. For testing purposes, I need to wipe out some SharedPreferences va..

Using external images for CSS custom cursors

Is it possible to use external image URLs for CSS custom cursors? The following example doesn't work: HTML: <div class="test">TEST</div> CSS: .test { background:gray; width:200px;..

MySql: is it possible to 'SUM IF' or to 'COUNT IF'?

I have a column 'hour' I have a column 'kind' (it can be 1,2 or 3) I'd like to do something like: SELECT count(id), SUM(hour) as totHour, SUM( IF ( kind = 1, 1, 0 ) ) as countKindOne or SELECT ..

JavaScript: Upload file

Let's say I have this element on the page: <input id="image-file" type="file" /> This will create a button that allows the users of the web page to select a file via an OS "File open..." dial..

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

"An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page..."

I'm trying to publish an MVC website as an Azure webrole. When I run it locally, everything works fine. But once I publish it to Azure and surf to some MVC action, I get this error: Server Erro..

Javascript date.getYear() returns 111 in 2011?

I have this javascript for automatically setting a date filter to the first and last day of the previous month: $(document).ready(function () { $("#DateFrom").datepicker({ dateFormat: 'dd/mm/yy' ..

SQL Order By Count

If I have a table and data like this: ID | Name | Group 1 Apple A 2 Boy A 3 Cat B 4 Dog C 5 Elep C 6 Fish C and I wish to order it ..

What's the whole point of "localhost", hosts and ports at all?

I'm totally new to this web development stuff. So I see things like "localhost" all the time and ask myself: What's that? I feel to know what a "host" actually is. Something that executes something...

Ubuntu apt-get unable to fetch packages

Just installed Ubuntu 13.10 (Saucy) and anything I try to install via sudo apt-get install is failing and throwing a series of 404 erros. Example - installing tmux [jeeves@HAL] hadoop > sudo apt-..

Trying to make bootstrap modal wider

I am using this code but the modal is too thin: <div class="modal fade bs-example-modal-lg custom-modal" tabindex="-1" role="dialog" aria-labelledby="myModal" aria-hidden="true" id="myModal"> ..

Multi-line bash commands in makefile

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

HTML select form with option to enter custom value

I would like to have an input field that users can enter custom text value or choose from drop down. A regular <select> only offers drop down options. How can I make a <select> accept cus..

Best way to pretty print a hash

I have a large hash with nested arrays and hashes. I would like to simply print it out so it 'readable' to the user. I would like it to be sort of like to_yaml - that's pretty readable - but still t..

JavaScript: filter() for Objects

ECMAScript 5 has the filter() prototype for Array types, but not Object types, if I understand correctly. How would I implement a filter() for Objects in JavaScript? Let's say I have this object: ..

Check for special characters (/*-+_@&$#%) in a string?

How do I check a string to make sure it contains numbers, letters, or space only?..

How to stick table header(thead) on top while scrolling down the table rows with fixed header(navbar) in bootstrap 3?

Bootstrap layout with fixed-navbar. Having table with so many rows in body. Issue? As i scroll the page navigation-bar will be there because it is fixed. as i scroll more i want table header to be fi..

How to Generate Barcode using PHP and Display it as an Image on the same page

I want to Generate Bar code (any type) using PHP I am having a variable where i store a code <?php $code= 'f5c9b918c5'; ?> so just i want to generate a barcode of this and echo the bar..

sscanf in Python

I'm looking for an equivalent to sscanf() in Python. I want to parse /proc/net/* files, in C I could do something like this: int matches = sscanf( buffer, "%*d: %64[0-9A-Fa-f]:%X %64[..

Public free web services for testing soap client

Are there any publicly available SOAP 1.2/WSDL 2.0 compliant free web services for testing a Python based soap client library (e.g. Zolera SOAP Infrastructure)? So far, it appears to me that Google ..

Java: is there a map function?

I need a map function. Is there something like this in Java already? (For those who wonder: I of course know how to implement this trivial function myself...)..

Deleting a file in VBA

Using VBA, how can I: test whether a file exists, and if so, delete it? ..

Tensorflow r1.0 : could not a find a version that satisfies the requirement tensorflow

I want to install Tensorflow 1.o for python on windows. This is information for my system. D:\>python --version Python 3.5.2 :: Anaconda 4.2.0 (32-bit) D:\>pip3 --version pip 9.0.1 from d:\we..

How can I set an SQL Server connection string?

I'm developing a simple C# application, and I'd like to know this: When I connect my application to SQL Server on my PC, I know the connection string (server name, password, etc.), but when I connect ..

Query EC2 tags from within instance

Amazon recently added the wonderful feature of tagging EC2 instances with key-value pairs to make management of large numbers of VMs a bit easier. Is there some way to query these tags in the same wa..

Cannot send a content-body with this verb-type

I just got this exception (ProtocolViolationException) in my .NET 2.0 app (running on windows mobile 6 standard emulator). What confuses me is that as far as i know, I have not added any content body..

Changing every value in a hash in Ruby

I want to change every value in a hash so as to add '%' before and after the value so { :a=>'a' , :b=>'b' } must be changed to { :a=>'%a%' , :b=>'%b%' } What's the best way to do thi..

CSS overflow-x: visible; and overflow-y: hidden; causing scrollbar issue

Suppose you have some style and the markup: _x000D_ _x000D_ ul_x000D_ {_x000D_ white-space: nowrap;_x000D_ overflow-x: visible;_x000D_ overflow-y: hidden;_x000D_ /* added width so it would work..

Environment variables in Jenkins

Where do the environment variables under Jenkins ( manage jenkins -> system information ) come from? I checked /etc/init.d/tomcat5 , /usr/bin/dtomcat5, /usr/bin/tomcat5 , /etc/sysconfig/tomcat5 and /..

JQuery wait for page to finish loading before starting the slideshow?

I have a site with a rotating header image (you've all seen them). I want to do the following: Load the entire page plus the first header image Start the header image slideshow transitioning every x..

Android Spinner : Avoid onItemSelected calls during initialization

I created an Android application with a Spinner and a TextView. I want to display the selected item from the Spinner's drop down list in the TextView. I implemented the Spinner in the onCreate method ..

What is the difference between _tmain() and main() in C++?

If I run my C++ application with the following main() method everything is OK: int main(int argc, char *argv[]) { cout << "There are " << argc << " arguments:" << endl; ..

import .css file into .less file

Can you import .css files into .less files...? I'm pretty familiar with less and use it for all my development. I regularly use a structure as follows: @import "normalize"; //styles here @import "..

How to get the file path from URI?

Please find my code below. I need to get the file path of the pdf document, selected by the user from SDcard. The issue is that the URI.getPath() returns: /file:///mnt/sdcard/my%20Report.pdf/my Repor..

What's the difference between %s and %d in Python string formatting?

I don't understand what %s and %d do and how they work...

Convert List<Object> to String[] in Java

I need to convert from List<Object> to String[]. I made: List<Object> lst ... String arr = lst.toString(); But I got this string: ["...", "...", "..."] is just one string, but I nee..

How do I use a regex in a shell script?

I am trying to match a string with a regex in a shell script. This string is a parameter of the script ( $1 ) and it is a date (MM/DD/YYYY) The regex I'm trying to use is : ^\d{2}[\/\-]\d{2}[\/\-]\d..

Align a div to center

I want to float a div to center. Is it possible? text-align: center is not working in IE. ..

Node.js Port 3000 already in use but it actually isn't?

I have been working with a node.js project for a few weeks and it has been working great. Usually, I use npm start to run my app and view it in a browser on localhost, port 3000. Today, I started to ..

How does the @property decorator work in Python?

I would like to understand how the built-in function property works. What confuses me is that property can also be used as a decorator, but it only takes arguments when used as a built-in function and..

Change select box option background color

I have a select box and I'm trying to change the background color of the options when the select box has been clicked and shows all the options. See Fiddle HTML: <select> <option val="..

How do I show my global Git configuration?

I'd like to show all configured Git sections. I only found git config --get core.editor, and I'd like to output everything that's configured globally, not only the configured default editor...

percentage of two int?

I want to get two ints, one divided by the other to get a decimal or percentage. How can I get a percentage or decimal of these two ints? (I'm not sure if it is right.. I'm probably way off...) for ex..

Java 8 stream map on entry set

I'm trying to perform a map operation on each entry in a Map object. I need to take a prefix off the key and convert the value from one type to another. My code is taking configuration entries from a..

Multiple -and -or in PowerShell Where-Object statement

PS H:\> Invoke-Command -computername SERVERNAME { Get-ChildItem -path E:\dfsroots\datastore2\public} | Where-Object {{ $_.e xtension-match "xls" -or $_.extension-match "xlk" } -and { $_.creationti..

how to remove "," from a string in javascript

original string is "a,d,k" I want to remove all , and make it to "adk". I tried code below but it doesn't work. "a,d,k".replace(/,/,"") ..

Oracle to_date, from mm/dd/yyyy to dd-mm-yyyy

I have all dates inserted into table as varchar2(10) and formatted as 'mm/dd/yyyy'. What I need is the following format 'mm-dd-yyyy' and date data type. My implementation without PLSQL would be: se..

how to convert binary string to decimal?

I want to convert binary string in to digit E.g var binary = "1101000" // code for 104 var digit = binary.toString(10); // Convert String or Digit (But it does not work !) console.log(digit); How i..

Get integer value of the current year in Java

I need to determine the current year in Java as an integer. I could just use java.util.Date(), but it is deprecated...

How to get the public IP address of a user in C#

I want the public IP address of the client who is using my website. The code below is showing the local IP in the LAN, but I want the public IP of the client. //get mac address NetworkInterface[] nic..

python requests get cookies

x =, data=data) print x.cookies I used the requests library to get some cookies from a website, but I can only get the cookies from the Response, how to get the cookies from the Re..

Stop Chrome Caching My JS Files

I will make a change to my JS files but it won't really change in the browser, I have to rename the files every time so that it reloads it. Is there some sort of .htaccess command I can add or somethi..

What does "Could not find or load main class" mean?

A common problem that new Java developers experience is that their programs fail to run with the error message: Could not find or load main class ... What does this mean, what causes it, and how sho..

Simple way to change the position of UIView?

I change the position of a UIView with following codes without changing size of the view. CGRect f = aView.frame; f.origin.x = 100; // new x f.origin.y = 200; // new y aView.frame = f; Is there mor..

Sort array by firstname (alphabetically) in Javascript

I got an array (see below for one object in the array) that I need to sort by firstname using JavaScript. How can I do it? var user = { bio: null, email: "[email protected]", firstname: "Anna..

Soft hyphen in HTML (<wbr> vs. &shy;)

How do you solve the problem with soft hyphens on your web pages? In a text there can be long words which you might want to line break with a hyphen. But you do not want the hyphen to show if the whol..

Setting an HTML text input box's "default" value. Revert the value when clicking ESC

When a web form is written to the browser, the browsers remembers what the initial values are of a text INPUT box. ie. when it receives HTML like this: <input type="text" value="something"> T..

T-SQL XOR Operator

Is there an XOR operator or equivalent function in SQL Server (T-SQL)?..

Visual studio - getting error "Metadata file 'XYZ' could not be found" after edit continue

I have stumbled into an issue that is really annoying. When I debug my software, everything runs OK, but if I hit a breakpoint and edit the code, when I try to continue running I get an error: Metadat..

How to extract a single value from JSON response?

First off, I will freely concede to being little more than a clumsy liberal arts guy who is completely self taught in this scripting thing. That said, I am attempting to get values from a the USGS Wat..

Argparse optional positional arguments?

I have a script which is meant to be used like this: usage: dir [-h] [-v] dir is a positional argument which is defined like this: parser.add_argument('dir', default=os.getcwd()) I wa..

Convert Json string to Json object in Swift 4

I try to convert JSON string to a JSON object but after JSONSerialization the output is nil in JSON. Response String: [{\"form_id\":3465,\"canonical_name\":\"df_SAWERQ\",\"form_name\":\"Activity 4 w..

How do I attach events to dynamic HTML elements with jQuery?

Suppose I have some jQuery code that attaches an event handler to all elements with class .myclass. For example: $(function(){ $(".myclass").click( function() { // do something }); ..

server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

I can push by clone project using ssh, but it doesn't work when I clone project with https. The error message that shows me is: server certificate verification failed. CAfile: /etc/ssl/certs/cacerti..

How do I clear inner HTML

I've been fiddling with this for a while but it won't work and I can't figure out why. Please help. Here is what I have: <html> <head> <title>lala</title> </head> &l..

When should we use mutex and when should we use semaphore

When should we use mutex and when should we use semaphore ?..

RecyclerView: Inconsistency detected. Invalid item position

Our QA has detected a bug: when rotating the Android device (Droid Turbo), the following RecyclerView-related crash happened: java.lang.IndexOutOfBoundsException: Inconsistency detected. Inv..

Will Google Android ever support .NET?

Now that the G1 with Google's Android OS is now available (soon), will the android platform ever support .Net?..

How does java do modulus calculations with negative numbers?

Am I doing modulus wrong? Because in Java -13 % 64 is supposed to evaluate to -13 but I get 51...

how to read xml file from url using php

I have to read an XML file from an URL $map_url = "".$merchant_address_url."&destination=".$customer_address_url."&sensor=false"; This ..

Laravel: Auth::user()->id trying to get a property of a non-object

I'm getting the following error "trying to get a property of a non-object" when I submit a form to add a user, the error is apparently on the first line: Auth::user()->id of the following: $id = Auth..

Java: Difference between the setPreferredSize() and setSize() methods in components

What is the main difference between setSize() and setPreferredSize(). Sometimes I used setSize(), sometimes setPreferredSize(), sometimes one does what I want, sometimes the other. What call should I ..

Accessing a class' member variables in Python?

class Example(object): def the_example(self): itsProblem = "problem" theExample = Example() print(theExample.itsProblem) How do I access a class's variable? I've tried adding this defi..

Python: get key of index in dictionary

Possible Duplicate: Inverse dictionary lookup - Python reverse mapping of dictionary with Python How do i get key of index in dictionary? For example like: i = {'a': 0, 'b': 1, 'c': 2} ..

putting datepicker() on dynamically created elements - JQuery/JQueryUI

I have dynamically created textboxes, and I want each of them to be able to display a calendar on click. The code I am using is: $(".datepicker_recurring_start" ).datepicker(); Which will only work..

How do you check whether a number is divisible by another number (Python)?

I need to test whether each number from 1 to 1000 is a multiple of 3 or a multiple of 5. The way I thought I'd do this would be to divide the number by 3, and if the result is an integer then it would..

removing bold styling from part of a header

Is there a way to remove bold styling from part of a header? <h1>**This text should be bold**, but this text should not</h1> Is there a way to accomplish this?..

CSS3 transition on click using pure CSS

I'm trying to get an image (a plus symbol) to rotate 45 degrees to create a cross symbol. I have so far managed to achieve this using the code below but its working on hover, I wanted to have it rotat..

Android YouTube app Play Video Intent

I have created a app where you can download YouTube videos for android. Now, I want it so that if you play a video in the YouTube native app you can download it too. To do this, I need to know the Int..

Force a screen update in Excel VBA

My Excel tool performs a long task, and I'm trying to be kind to the user by providing a progress report in the status bar, or in some cell in the sheet, as shown below. But the screen doesn't refresh..

Pull is not possible because you have unmerged files, git stash doesn't work. Don't want to commit

I just want to pull. I have changes to disregard, my Gemfile and Gemlock files and I'd be happy to just overwrite them and just pull. I tried stashing my changes away, this didn't work out for me. Wha..

Apache default VirtualHost

How can I set a default VirtualHost in Apache? Preferably, I want the default host not to be the same as the IP address host. Now I have something like this: NameVirtualHost * <VirtualHost *> ..

Getting data from selected datagridview row and which event?

I have a DataGridView (Selectionmode: FullRowSelect) on a windows form along with some textboxes, so what i want to do is that whenever a user selects a row(click or double_click maybe), the contents ..

ORDER BY using Criteria API

When I write a HQL query Query q = session.createQuery("SELECT cat from Cat as cat ORDER BY cat.mother.kind.value"); return q.list(); Everything is fine. However, when I write a Criteria Criteria ..

How to determine if one array contains all elements of another array

Given: a1 = [5, 1, 6, 14, 2, 8] I would like to determine if it contains all elements of: a2 = [2, 6, 15] In this case the result is false. Are there any built-in Ruby/Rails methods to identify..

Unable to add window -- token null is not valid; is your activity running?

i want to show a custom popup menu when user click on a floating icon the float icon create with an service and i have no activity this is my floating icon code public class copy_actions_service ex..

Reading string from input with space character?

I'm using Ubuntu and I'm also using Geany and CodeBlock as my IDE. What I'm trying to do is reading a string (like "Barack Obama") and put it in a variable: #include <stdio.h> int main(void) {..

How to get min, seconds and milliseconds from in python?

>>> a = str( >>> a '2012-03-22 11:16:11.343000' I need to get a string like that: '16:11.34'. Should be as compact as possible. Or should I use time() instead? Ho..

Changing directory in Google colab (breaking out of the python interpreter)

So I'm trying to git clone and cd into that directory using Google collab - but I cant cd into it. What am I doing wrong? !rm -rf SwitchFrequencyAnalysis && git clone

Difference between readFile() and readFileSync()

The following code outputs the content of the index.html (it just contains the text hello world) to the browser. However, when I replace readFile() with readFileSync(), the request times out. What am ..

AngularJS: how to enable $locationProvider.html5Mode with deeplinking

When enabling the html5Mode in AngularJS via $locationProvider.html5Mode(true), navigation seems to be skewed when you land on a page deeper in the site. for example: when i nav..

Disabling Minimize & Maximize On WinForm?

WinForms have those three boxes in the upper right hand corner that minimize, maximize, and close the form. What I want to be able to do is to remove the minimize and maximize, while keeping the clos..

Which way is best for creating an object in JavaScript? Is `var` necessary before an object property?

So far I saw three ways for creating an object in JavaScript. Which way is best for creating an object and why? I also saw that in all of these examples the keyword var is not used before a property ..

How do I edit SSIS package files?

I have a DTSX file in a project I'm taking over. I have Visual Studio 2005 Pro, but it just opens it as an XML file. SQL Server Management Studio 2005 does the same. I've seen people opening these f..

What is the difference between a schema and a table and a database?

This is probably a n00blike (or worse) question. But I've always viewed a schema as a table definition in a database. This is wrong or not entirely correct. I don't remember much from my database cour..

Where Sticky Notes are saved in Windows 10 1607

It seems like Sticky Notes are no longer saved in %AppData%\Microsoft\Sticky Notes\ I even did a search for *.SNT with no results. It seems like Microsoft have changed the way Windows handles Notes...

How can I close a Twitter Bootstrap popover with a click from anywhere (else) on the page?

I'm currently using popovers with Twitter Bootstrap, initiated like this: $('.popup-marker').popover({ html: true, trigger: 'manual' }).click(function(e) { $(this).popover..

Downloading a large file using curl

I need to download remote file using curl. Here's the sample code I have: $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $st = curl_exec($ch); ..

How to call a PHP file from HTML or Javascript

I've looked around for a long while now and I can't find anywhere that answers this seemingly basic question. I don't care if the page reloads or displays the results immediately; I just want to have ..

YouTube Autoplay not working

My website has a player for multiple videos. I've been adapting the code to use YouTube's iframe API as the player. I can't get the videos to autoplay. Here's the relevant code: <body> ..

"multiple target patterns" Makefile error

My makefile fails with error: Makefile:34: *** multiple target patterns. Stop. What does it really mean, how can I fix this? (GNU make manual, written by Captain Obvious, isn't helping). Foun..

pandas GroupBy columns with NaN (missing) values

I have a DataFrame with many missing values in columns which I wish to groupby: import pandas as pd import numpy as np df = pd.DataFrame({'a': ['1', '2', '3'], 'b': ['4', np.NaN, '6']}) In [4]: df.g..

Which selector do I need to select an option by its text?

I need to check if a <select> has an option whose text is equal to a specific value. For example, if there's an <option value="123">abc</option>, I would be looking for "abc". Is t..

How to change CSS using jQuery?

I am trying to change the CSS using jQuery: _x000D_ _x000D_ $(init);_x000D_ _x000D_ function init() {_x000D_ $("h1").css("backgroundColor", "yellow");_x000D_ $("#myParagraph").css({"backg..

Android emulator shows nothing except black screen and adb devices shows "device offline"

I am just trying to start development in Android. So, the problem is that when I try to launch an emulator by issuing the command emulator @A2 , an emulator comes up on the screen. But even after wai..

General guidelines to avoid memory leaks in C++

What are some general tips to make sure I don't leak memory in C++ programs? How do I figure out who should free memory that has been dynamically allocated?..

python plot normal distribution

Given a mean and a variance is there a simple function call which will plot a normal distribution?..

Convert char array to string use C

I need to convert a char array to string. Something like this: char array[20]; char string[100]; array[0]='1'; array[1]='7'; array[2]='8'; array[3]='.'; array[4]='9'; ... I would like to get somet..

How to add scroll bar to the Relative Layout?

I am new to the Android app development. Now I am designing an app, in that I have an Activity which is containing some content but these content is some what more so the content is out of the screen...

Mockito. Verify method arguments

I've googled about this, but didn't find anything relevant. I've got something like this: Object obj = getObject(); Mockeable mock= Mockito.mock(Mockeable.class); Mockito.when(mock.mymethod(obj )).th..

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

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

SQL Developer is returning only the date, not the time. How do I fix this?

Here's what SQL Develoepr is giving me, both in the results window and when I export: CREATION_TIME ------------------- 27-SEP-12 27-SEP-12 27-SEP-12 Here's what another piece of software r..

Load different application.yml in SpringBoot Test

I'm using a spring boot app which runs my src/main/resources/config/application.yml. When I run my test case by : @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Ap..

How to add an element to the beginning of an OrderedDict?

I have this: d1 = OrderedDict([('a', '1'), ('b', '2')]) If I do this: d1.update({'c':'3'}) Then I get this: OrderedDict([('a', '1'), ('b', '2'), ('c', '3')]) but I want this: [('c', '3'), ('..

Get single row result with Doctrine NativeQuery

I'm trying to get a single row returned from a native query with Doctrine. Here's my code: $rsm = new ResultSetMapping; $rsm->addEntityResult('VNNCoreBundle:Player', 'p'); $rsm->addFieldResult(..

Where is jarsigner?

I have the Android SDK installed on both a Linux machine using open SuSE 12.1. I've used both machines to successfully build Android apps many times and sign them both with a debug key for testing and..

What's the difference between returning value or Promise.resolve from then()

What is the difference between: _x000D_ _x000D_ new Promise(function(res, rej) {_x000D_ res("aaa");_x000D_ })_x000D_ .then(function(result) {_x000D_ return "bbb";_x000D_ })_x000D_ .th..

Using HTML data-attribute to set CSS background-image url

I plan on building a custom photo gallery for a friend and I know exactly how I am going to be producing the HTML, however I am running into a small issue with the CSS.(I would prefer to not have the ..

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

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

Set session variable in laravel

I would like to set a variable in the session using laravel this way Session::set('variableName')=$value; but the problem is that I don't know where to put this code, 'cause I would like to set it ..

Search all of Git history for a string?

I have a code base which I want to push to GitHub as open source. In this git-controlled source tree, I have certain configuration files which contain passwords. I made sure not to track this file and..

File tree view in Notepad++

I was wondering how to make a file tree view in Notepad++, like other editors have, where I could open a file by clicking on it?..

Case objects vs Enumerations in Scala

Are there any best-practice guidelines on when to use case classes (or case objects) vs extending Enumeration in Scala? They seem to offer some of the same benefits...

How to set environment variable or system property in spring tests?

I'd like to write some tests that check the XML Spring configuration of a deployed WAR. Unfortunately some beans require that some environment variables or system properties are set. How can I set an ..

Can I use Homebrew on Ubuntu?

I just tried to use Homebrew and Linuxbrew to install packages on my Ubuntu Server but both failed. This is how I tried to install them: sudo apt-get install build-essential curl git m4 ruby texinfo ..

Hex-encoded String to Byte Array

String str = "9B7D2C34A366BF890C730641E6CECF6F"; I want to convert str into byte array, but str.getBytes() returns 32 bytes instead of 16. ..

canvas.toDataURL() SecurityError

So I'm using google maps and I get the picture so it looks like this <img id="staticMap" src=",New+York,NY&zoom=13&a..

Cordova - Error code 1 for command | Command failed for

I'm new on cordova, so if my question is not relevant, forgive me. i have a cordova project in my Windows 7 x64 machine. Yesterday i was build my cordova app via cordova build android --release. But i..

Setting font on NSAttributedString on UITextView disregards line spacing

I'm trying to set an attributed string to a UITextView in iOS 6. The problem is, if I attempt to set the font property on the attributed string, the line spacing is ignored. However, if I don't set th..

Django - makemigrations - No changes detected

I was trying to create migrations within an existing app using the makemigrations command but it outputs "No changes detected". Usually I create new apps using the startapp command but did not use it..

How to avoid warning when introducing NAs by coercion

I generally prefer to code R so that I don't get warnings, but I don't know how to avoid getting a warning when using as.numeric to convert a character vector. For example: x <- as.numeric(c("1",..

How to embed an autoplaying YouTube video in an iframe?

I am trying to embed the new iframe version of a YouTube video and get it to auto play. As far as I can tell, there is no way of doing this by amending flags to the URL. Is there a way to do it by u..

How to redirect output of an already running process

Normally I would start a command like longcommand &; I know you can redirect it by doing something like longcommand > /dev/null; for instance to get rid of the output or longcommand 2&g..

How to refresh an access form

I am building an MS Access application in which all the forms are modal. However, after data change in a form, I want to refresh the parent form of this form with newer data. Is there any way to do it..

Create a OpenSSL certificate on Windows

Since I'm very new to SSL certificates, and the creation and usage of them I figured maybe StackOverflow members can help me out. I'm from Holland, the common way of online payments is by implementin..

Rails 3 check if attribute changed

Need to check if a block of attributes has changed before update in Rails 3. street1, street2, city, state, zipcode I know I could use something like if @user.street1 != params[:user][:street1] t..

Split output of command by columns using Bash?

I want to do this: run a command capture the output select a line select a column of that line Just as an example, let's say I want to get the command name from a $PID (please note this is just a..

html button to send email

How do I send an email with specified initial values for the headers subject and message from a button in html, such as this <form method="post" action="

SwiftUI - How do I change the background color of a View?

I'm beginning to try out SwiftUI and I'm surprised that it doesn't seem to be straightforward to change the background color of a View. How do you do this using SwiftUI?..

How to select date from datetime column?

I have a column of type "datetime" with values like 2009-10-20 10:00:00 I would like to extract date from datetime and write a query like: SELECT * FROM data WHERE datetime = '2009-10-20' ORDER B..

Android 6.0 multiple permissions

I know that Android 6.0 has new permissions and I know I can call them with something like this if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != Package..

How to convert this var string to URL in Swift

I need url filepath be a URL (NSURL in old versions of Swift). I have this: let paths = NSSearchPathForDirectoriesInDomains( .documentDirectory, .userDomainMask, true) // NSString *documents..

How to catch all exceptions in c# using try and catch?

I want to write some try and catch that catch any type or exception, is this code is enough (that's the way to do in Java)? try { code.... } catch (Exception ex){} Or should it be try { code.... }..

ORA-01008: not all variables bound. They are bound

I have come across an Oracle problem for which I have so far been unable to find the cause. The query below works in Oracle SQL developer, but when running in .NET it throws: ORA-01008: not all va..

Good way of getting the user's location in Android

The problem: Getting the user's current location within a threshold ASAP and at the same time conserve battery. Why the problem is a problem: First off, android has two providers; network and GPS. ..

How to move the cursor word by word in the OS X Terminal

I know the combination Ctrl+A to jump to the beginning of the current command, and Ctrl+E to jump to the end. But is there any way to jump word by word, like Alt+←/→ in Cocoa applications ..

Create a folder if it doesn't already exist

I've run into a few cases with WordPress installs with Bluehost where I've encountered errors with my WordPress theme because the uploads folder wp-content/uploads was not present. Apparently the Blu..

How to hide command output in Bash

I want to make my Bash scripts more elegant for the end user. How do I hide the output when Bash is executing commands? For example, when Bash executes yum install nano The following will show up ..

Error 'tunneling socket' while executing npm install

I'm getting the error shown below while trying to execute 'npm install' command. Error: tunneling socket could not be established, cause=connect ECONNREFUSED What do I miss?..

How to get a cross-origin resource sharing (CORS) post request working

I have a machine on my local lan (machineA) that has two web servers. The first is the in-built one in XBMC (on port 8080) and displays our library. The second server is a CherryPy python script (po..