Questions Tagged with #Computus

Anything related to the "computus" (from medieval Latin), i.e. the computation of the date of Easter.

Java System.out.print formatting

Here is my code (well, some of it). The question I have is, can I get the first 9 numbers to show with a leading 00 and numbers 10 - 99 with a leading 0. I have to show all of the 360 monthly payment..

Set height 100% on absolute div

I am facing a problem with overlaying a 100% height div. I could use position fixed to solve the cover, but that's not really what I want because you should be able to scroll down on the 'cover' > so ..

CSS Selector for <input type="?"

Is there any way with CSS to target all inputs based on their type? I have a disabled class I use on various disabled form elements, and I'm setting the background color for text boxes, but I don't wa..

Using an HTTP PROXY - Python

I familiar with the fact that I should set the HTTP_RPOXY environment variable to the proxy address. Generally urllib works fine, the problem is dealing with urllib2. >>> urllib2.urlopen(&quo..

The preferred way of creating a new element with jQuery

I've got 2 ways I can create a <div> using jQuery. Either: var div = $("<div></div>"); $("#box").append(div); Or: $("#box").append("<div></div>"); What are the dra..

How to add users to Docker container?

I have a docker container with some processes (uwsgi and celery) running inside. I want to create a celery user and a uwsgi user for these processes as well as a worker group that they will both belon..

VBA test if cell is in a range

I want to test if a given cell is within a given range in Excel VBA. What is the best way to do this?..

Python check if website exists

I wanted to check if a certain website exists, this is what I'm doing: user_agent = 'Mozilla/20.0.1 (compatible; MSIE 5.5; Windows NT)' headers = { 'User-Agent':user_agent } link = "http://www.abc.co..

Java's L number (long) specification

It appears that when you type in a number in Java, the compiler automatically reads it as an integer, which is why when you type in (long) 6000000000 (not in integer's range) it will complain that 600..

Why are Python lambdas useful?

I'm trying to figure out Python lambdas. Is lambda one of those "interesting" language items that in real life should be forgotten? I'm sure there are some edge cases where it might be needed, but ..

how to put image in a bundle and pass it to another activity

is there a way to put an image in a bundle and pass it to another activity? i've done my research and came up with putParcelable but i don't know how to get the passed image from the other activity an..

Gradle - Error Could not find method implementation() for arguments [com.android.support:appcompat-v7:26.0.0]

I am trying to open existing android project in android studio and it gradle cannot build the app without the error Error android studio keeps on throwing Error:(74, 1) A problem occurred evaluating..

How can I get the current directory name in Javascript?

I'm trying to get the current directory of the file in Javascript so I can use that to trigger a different jquery function for each section of my site. if (current_directory) = "example" { var active..

Maximum number of rows of CSV data in excel sheet

It is known that Excel sheets can display a maximum of 1 million rows. Is there any row limit for csv data, i.e. does Excel allow more than 1 million rows in csv format? One more question: About this..

Could not load file or assembly CrystalDecisions.ReportAppServer.ClientDoc

I've looked at similar questions on SO, but nothing quite matches my issue as far as I can tell. The exception message: Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc..

Perform debounce in React.js

How do you perform debounce in React.js? I want to debounce the handleOnChange. I tried with debounce(this.handleOnChange, 200) but it doesn't work. function debounce(fn, delay) { var timer = nul..

"Cannot instantiate the type..."

When I try to run this code: import java.io.*; import java.util.*; public class TwoColor { public static void main(String[] args) { Queue<Edge> theQueue = new Queue<Edge&g..

Having services in React application

I'm coming from the angular world where I could extract logic to a service/factory and consume them in my controllers. I'm trying to understand how can I achieve the same in a React application. Let..

How to put/get multiple JSONObjects to JSONArray?

Is it possible to store multiple different JSONObjects into a single JSONArray? This is the structure, I want to store in a JSONArray. [{"value1":1,"value2":900,"value3":1368349},{"value1":2,"value2"..

VBA Public Array : how to?

So today's problem is getting me mad because that should be easy and i can not find the answer : How to declare a public array in VBA ? I'm using an array with the letters A, B, C,... because i'm wor..

Can I extend a class using more than 1 class in PHP?

If I have several classes with functions that I need but want to store separately for organisation, can I extend a class to have both? i.e. class a extends b extends c edit: I know how to extend cla..

"R cannot be resolved to a variable"?

In Eclipse, I've created a project from a source and now it shows errors - "R cannot be resolved to a variable". From what I found here, I had cleared and rebuilt the project, but still the R file doe..

How can I split a string into segments of n characters?

As the title says, I've got a string and I want to split into segments of n characters. For example: var str = 'abcdefghijkl'; after some magic with n=3, it will become var arr = ['abc','def','gh..

How to find the privileges and roles granted to a user in Oracle?

I am using Linux, Oracle10g. I have created one user called test. and granted create session and select any dictionary permission to the same user. i also granted sysdba and sysoper roles to the same..

How do you create a dictionary in Java?

I am trying to implement a dictionary (as in the physical book). I have a list of words and their meanings. What data structure / type does Java provide to store a list of words and their meanings a..

#1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation

Hello, I am currently having an issue with MySQL! What's going wrong here? I am a cPanel user, and yes I have searched this and found no definitive answers. It appears this is more specific than othe..

How to retrieve an Oracle directory path?

I created the following Oracle Directory csvDir: create or replace directory csvDir as 'd:\oracle\oradata\external_data\downloadedFiles'; Now, how can I retrieve the path from this csvDir alias? ..

How to connect to a remote Git repository?

I am working with a team and we want to use Git (Not with GitHub, we have a private remote machine). We were using SVN until now. We have a remote machine that works like an SVN repository. Now, we wa..

Enable Hibernate logging

I'm trying to create a log of hibernate statements. I perform my sql statements using JPA where Hibernate 2.0 is the persistence provider (my application server is JBoss AS 6.0). I call my CRUD method..

How to round to 2 decimals with Python?

I am getting a lot of decimals in the output of this code (Fahrenheit to Celsius converter). My code currently looks like this: def main(): printC(formeln(typeHere())) def typeHere(): globa..

Save file/open file dialog box, using Swing & Netbeans GUI editor

I am a beginner to Java. I am making a simple text editor in netbeans 7(.3) IDE, using its GUI editor. The main problem I face in it is that I can't make it to save/open the file. I have created the "..

How does one generate a random number in Apple's Swift language?

I realize the Swift book provided an implementation of a random number generator. Is the best practice to copy and paste this implementation in one's own program? Or is there a library that does thi..

How to properly add include directories with CMake

About a year ago I asked about header dependencies in CMake. I realized recently that the issue seemed to be that CMake considered those header files to be external to the project. At least, when gen..

How to get all Errors from ASP.Net MVC modelState?

I want to get all the error messages out of the modelState without knowing the key values. Looping through to grab all the error messages that the ModelState contains. How can I do this?..

Angular 2 - Setting selected value on dropdown list

I have run into an issue in pre-selecting values on a dropdown list in Angular 2. I set an array of colours in the component which I bind successfully to the dropdown list. The issue I'm experienc..

What does DIM stand for in Visual Basic and BASIC?

What does DIM stand for in Visual Basic? ..

Where are static methods and static variables stored in Java?

For example: class A { static int i=0; static int j; static void method() { // static k=0; can't use static for local variables only final is permitted // static int L; ..

Switch on ranges of integers in JavaScript

I want to do something like this switch (this.dealer) { case 1-4: // Do something. break; case 5-8: // Do something. break; ..

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

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

How to decrypt a password from SQL server?

I have this query in sql server 2000: select pwdencrypt('AAAA') which outputs an encrypted string of 'AAAA': 0x0100CF465B7B12625EF019E157120D58DD46569AC7BF4118455D12625EF019E157120D58DD46569AC7BF..

Creating a div element inside a div element in javascript

I'm trying a very basic example of creating a div inside an already existing div. It doesn't seem to be working when I use: document.getElementbyId('lc').appendChild(element) but works fine when I..

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

How to change maven logging level to display only warning and errors?

I want to prevent maven from displaying INFO messages, I want to see only WARNINGS and ERRORS (if any). How can I achieve this, preferably by changing the command line that calls maven?..

git: fatal: Could not read from remote repository

I am trying to set git up with http://danielmiessler.com/study/git/#website to manage my site. I have gotten to the last step in the instructions: git push website +master:refs/heads/master I am wo..

Why are Python's 'private' methods not actually private?

Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like this: __myPrivateMethod(). How, then, can one explain this >>> ..

git stash blunder: git stash pop and ended up with merge conflicts

I did a git stash pop and ended up with merge conflicts. I removed the files from the file system and did a git checkout as shown below, but it thinks the files are still unmerged. I then tried replac..

Bootstrap 3 Flush footer to bottom. not fixed

I am using Bootstrap 3 for a site I am designing. I want to have a footer like this sample. Sample Please note that I don't want it FIXED so bootstrap navbar-fixed-bottom does not solve my problem. ..

How do I change JPanel inside a JFrame on the fly?

To put it simple, there's a simple java swing app that consists of JFrame with some components in it. One of the components is a JPanel that is meant to be replaced by another JPanel on user action. ..

GitLab git user password

I have just installed GitLab. I created a project called project-x. I have created few users and assigned it to the project. Now I tried to clone: git clone [email protected]:project-x.git It p..

How do I Merge two Arrays in VBA?

Given Dim arr1 As Variant Dim arr2 As Variant Dim arr3 As Variant arr1 = Array("A", 1, "B", 2) arr2 = Array("C", 3, "D", 4) What kind of operations can I do on arr1 and arr2 and store result in a..

How do I clone a generic list in C#?

I have a generic list of objects in C#, and wish to clone the list. The items within the list are cloneable, but there doesn't seem to be an option to do list.Clone(). Is there an easy way around thi..

Use jQuery to change an HTML tag?

Is this possible? example: $('a.change').click(function(){ //code to change p tag to h5 tag }); <p>Hello!</p> <a id="change">change</a> So clicking the change anchor shou..

Laravel Eloquent compare date from datetime field

I want to get all the rows from a table through an expression: table.date <= 2014-07-10 But if the column contains a datetime let's say: 2014-07-10 12:00:00 But if I do: where('date', '<..

MySQL - How to parse a string value to DATETIME format inside an INSERT statement?

I have a MySQL database, with a column that is date type DATETIME. I am getting a string value for a date / time from an external application. That string value looks like this: '5/15/2012 8:06:26..

Objective-C: Reading a file line by line

What is the appropriate way of dealing with large text files in Objective-C? Let's say I need to read each line separately and want to treat each line as an NSString. What is the most efficient way of..

How to make a promise from setTimeout

This is not a realworld problem, I'm just trying to understand how promises are created. I need to understand how to make a promise for a function that returns nothing, like setTimeout. Suppose I ha..

How to launch Safari and open URL from iOS app

On the settings page, I want to include three links to My app support site YouTube app tutorial My primary site (ie: linked to a 'Created by Dale Dietrich' label.) I've searched this site and the ..

Python: Get the first character of the first string in a list?

How would I get the first character from the first string in a list in Python? It seems that I could use mylist[0][1:] but that does not give me the first character. >>> mylist = [] >&..

Count unique values with pandas per groups

I need to count unique ID values in every domain I have data ID, domain 123, 'vk.com' 123, 'vk.com' 123, 'twitter.com' 456, 'vk.com' 456, 'facebook.com' 456, 'vk.com' 456, 'google.com' 789, 'twitter...

Why do I get "a label can only be part of a statement and a declaration is not a statement" if I have a variable that is initialized after a label?

I have the following simplified code: #include <stdio.h> int main () { printf("Hello "); goto Cleanup; Cleanup: char *str = "World\n"; printf("%s\n", str); } I get an error b..

Why can't I see the "Report Data" window when creating reports?

I'm creating RDLC reports in VS10. When the program is NOT running, I can see the toolbox, and add controls to the report, but the "Report Data" pane is nowhere to be found, so I can't fill the contr..

jQuery count child elements

_x000D_ _x000D_ <div id="selected">_x000D_ <ul>_x000D_ <li>29</li>_x000D_ <li>16</li>_x000D_ <li>5</li>_x000D_ <li>8</li>_..

Sorting HashMap by values

I need to sort my HashMap according to the values stored in it. The HashMap contains the contacts name stored in phone. Also I need that the keys get automatically sorted as soon as I sort the values..

CSS Background Opacity

I am using something similar to the following code: <div style="opacity:0.4; background-image:url(...);"> <div style="opacity:1.0;"> Text </div> </div> I ex..

How do I use a custom deleter with a std::unique_ptr member?

I have a class with a unique_ptr member. class Foo { private: std::unique_ptr<Bar> bar; ... }; The Bar is a third party class that has a create() function and a destroy() function. I..

PHP foreach loop through multidimensional array

I have an array: $arr_nav = array( array( "id" => "apple", "url" => "apple.html", "name" => "My Apple" ), array( "id" => "orange", "url" =..

Google Play Services Missing in Emulator (Android 4.4.2)

For the emulator I have below, I am getting the error message that "Google Play Services not installed on the device". As per the developer site, it says that 'The Android emulator with an AVD that r..

Failed to load AppCompat ActionBar with unknown error in android studio

Below is my xml file. In preview there is two error'Failed to load AppCompat ActionBar with unknown error' & 'Failed to instaniate more than one class'. How ever am able to run the app.But the app..

Anaconda Installed but Cannot Launch Navigator

Anaconda (listed as "Python 3.6.0 (Anaconda 4.3.1 64 bit)" ) is in my programs and features list, but there is seeming no Anaconda Navigator desktop app, as their seems to be no icon on my desktop and..

android listview item height

Why when i use SimpleCursorAdapter for ListView i have items height in ListView like this - (My code based on this) But when using arrays Listview items have big height (I learn listview based..

Multiple inputs on one line

I have looked to no avail, and I'm afraid that it might be such a simple question that nobody dares ask it. Can one input multiple things from standard input in one line? I mean this: float a, b; ch..

How to get the function name from within that function?

How can I access a function name from inside that function? // parasitic inheritance var ns.parent.child = function() { var parent = new ns.parent(); parent.newFunc = function() { } return..

How to change symbol for decimal point in double.ToString()?

I would like to change decimal point to another character in C#. I have a double variable value double value; and when I use the command: Console.WriteLine(value.ToString()); // output is 1,25 I..

How to select date without time in SQL

When I select date in SQL it is returned as 2011-02-25 21:17:33.933. But I need only the Date part, that is 2011-02-25. How can I do this?..

Import Error: No module named numpy

I have a very similar question to this question, but still one step behind. I have only one version of Python 3 installed on my Windows 7 (sorry) 64-bit system. I installed numpy following this link ..

Number of occurrences of a character in a string

I am trying to get the number of occurrences of a certain character such as & in the following string. string test = "key1=value1&key2=value2&key3=value3"; How do I determine that there..

CATALINA_HOME environmental variable is not defined correctly

I installed Apache Tomcat 6.0 to a C:/Program Files folder and I set the environmental variables JAVA_HOME and CATALINA_HOME, but when I start the server using startup.bat, I am getting the error: ..

Regular expression to match a word or its prefix

I want to match a regular expression on a whole word. In the following example I am trying to match s or season but what I have matches s, e, a, o and n. [s|season] How do I make a regular expre..

Implementing a simple file download servlet

How should I implement simple file download servlet? The idea is that with the GET request index.jsp?filename=file.txt, the user can download for example. file.txt from the file servlet and the file..

Why is my JQuery selector returning a n.fn.init[0], and what is it?

I have a set of dynamically generated checkboxes, where each of them has a data-id attribute corresponding to a database integer id. When i populate my html-form with an object to edit, there is a lis..

Create an array with random values

How can I create an array with 40 elements, with random values from 0 to 39 ? Like [4, 23, 7, 39, 19, 0, 9, 14, ...] I tried using solutions from here: http://freewebdesigntutorials.com/javaScript..

slideToggle JQuery right to left

i'm new in JQ i have this script i found on the internet and its do exactly what i need but i want the sliding will be from the right to the left how can i do it? please help this is the code <sc..

How to git reset --hard a subdirectory?

UPDATE²: With Git 2.23 (August 2019), there's a new command git restore that does this, see the accepted answer. UPDATE: This will work more intuitively as of Git 1.8.3, see my own answer. ..

How to truncate milliseconds off of a .NET DateTime

I'm trying to compare a time stamp from an incoming request to a database stored value. SQL Server of course keeps some precision of milliseconds on the time, and when read into a .NET DateTime, it in..

How do I uniquely identify computers visiting my web site?

I need to figure out a way uniquely identify each computer which visits the web site I am creating. Does anybody have any advice on how to achieve this? Because i want the solution to work on all mach..

Remove all files in a directory

Trying to remove all of the files in a certain directory gives me the follwing error: OSError: [Errno 2] No such file or directory: '/home/me/test/*' The code I'm running is: import os test = "..

How to view the dependency tree of a given npm module?

How can I get the tree of a module available to npm, but not installed locally ? npm ll does the job for locally installed packages. But it doesn't work for modules not installed or modules installed..

How is a CRC32 checksum calculated?

Maybe I'm just not seeing it, but CRC32 seems either needlessly complicated, or insufficiently explained anywhere I could find on the web. I understand that it is the remainder from a non-carry-based..

Property 'value' does not exist on type 'EventTarget'

I am using TypeScript Version 2 for an Angular 2 component code. I am getting error "Property 'value' does not exist on type 'EventTarget'" for below code, what could be the solution. Thanks..

How to parse XML using jQuery?

How do I parse XML, and how can I navigate the result using jQuery? Here is my sample XML: <Pages> <Page Name="test"> <controls> <test>this is a test.</test>..

Better way to find index of item in ArrayList?

For an Android app, I have the following functionality private ArrayList<String> _categories; // eg ["horses","camels"[,etc]] private int getCategoryPos(String category) { for(int i = 0; i..

Select columns based on string match - dplyr::select

I have a data frame ("data") with lots and lots of columns. Some of the columns contain a certain string ("search_string"). How can I use dplyr::select() to give me a subset including only the column..

Boolean checking in the 'if' condition

Which one is better Java coding style? boolean status = true; if (!status) { //do sth } else { //do sth } or: if (status == false) { //do sth } else { //do sth } ..

What is the difference between ng-if and ng-show/ng-hide

I'm trying to understand the difference between ng-if and ng-show/ng-hide, but they look the same to me. Is there a difference that I should keep in mind choosing to use one or the other?..

How do I set the focus to the first input element in an HTML form independent from the id?

Is there a simple way to set the focus (input cursor) of a web page on the first input element (textbox, dropdownlist, ...) on loading the page without having to know the id of the element? I would l..

regex match any whitespace

I want to make a replacement using regex and preg_replace function. this is my code $verif = "/wordA(\s*)wordB(?! wordc)/i"; $replacement = 'wordA wordb wordc'; $newvar = preg_replace($verif, $replac..

npm install vs. update - what's the difference?

What is the practical difference between npm install and npm update? When should I use which?..

concat yesterdays date with a specific time

I need to create a query that looks at yesterdays date but at a specific time. I would like the time portion to be in the 'hh24:mi:ss' format as this is how the search field is formated. when I run ..

Distribution certificate / private key not installed

Using Xcode 9.1, after building an iOS app, I want to archive it and upload it to the appStore for beta-testing. But I get the following issue after clicking the button Upload to the App Store... and ..

Finding Number of Cores in Java

How can I find the number of cores available to my application from within Java code?..

Multiple submit buttons on HTML form – designate one button as default

I have a form that has three submit buttons as follows: <input type="submit" name="COMMAND" value="&lsaquo; Prev"> <input type="submit" name="COMMAND" value="Save"> <input type="re..

MySQL 'Order By' - sorting alphanumeric correctly

I want to sort the following data items in the order they are presented below (numbers 1-12): 1 2 3 4 5 6 7 8 9 10 11 12 However, my query - using order by xxxxx asc sorts by the first digit above ..

MySql difference between two timestamps in days?

How can I get the difference between two timestamps in days? Should I be using a datetime column for this? I switched my column to datetime. Simple subtraction doesn't seem to give me a result in day..

Assert that a method was called in a Python unit test

Suppose I have the following code in a Python unit test: aw = aps.Request("nv1") aw2 = aps.Request("nv2", aw) Is there an easy way to assert that a particular method (in my case aw.Clear()) was cal..

How to create a batch file to run cmd as administrator

I need to run a batch file which needs to register a DLL. The DLL registration is failing because the Batch file is not starting the command prompt as "administrator". Is there any way to start the ..

How to create a CPU spike with a bash command

I want to create a near 100% load on a Linux machine. It's quad core system and I want all cores going full speed. Ideally, the CPU load would last a designated amount of time and then stop. I'm ho..

How to get the difference between two dictionaries in Python?

I have two dictionaries. I need to find the difference between the two which should give me both key and value. I have searched and found some addons/packages like datadiff, dictdiff-master but when ..

How can I change my Cygwin home folder after installation?

I just installed Cygwin, and it looks like the home directory in the bash prompt is on my Z: drive. That's not where I want it. How can I change this?..

Append key/value pair to hash with << in Ruby

In Ruby, one can append values to existing arrays using <<: a = [] a << "foo" but, can you also append key/value pairs to an existing hash? h = {} h << :key "bar" I know you ca..

How to call C++ function from C?

I know this. Calling C function from C++: If my application was in C++ and I had to call functions from a library written in C. Then I would have used //main.cpp extern "C" void C_library_functio..

How to find available directory objects on Oracle 11g system?

I assume this information is available in Oracle metadata tables, but where exactly ? I need the directory object for BFILENAME as in this answer: Using PL/SQL how do you I get a file's contents ..

Basic Ajax send/receive with node.js

So I'm trying to make a very basic node.js server that with take in a request for a string, randomly select one from an array and return the selected string. Unfortunately I'm running into a few prob..

How to export a MySQL database to JSON?

I am interested in exporting a subset of values from a MySQL database into a JSON-formatted file on disk. I found a link that talks about a possible way to do this: http://www.thomasfrank.se/mysql_to..

Error Installing Homebrew - Brew Command Not Found

I've spent the bulk of my Friday trying to get the latest version of Ruby installed on my new MacBook Air (w/ Mountain Lion installed). I have all the latest versions of XCode and command line tools...

How should I use Outlook to send code snippets?

As a programmer at a big corporation, I frequently send Outlook emails that contain code samples. I'll actually type code directly into an email. This inevitably causes problems, as Outlook really l..

How do you return a JSON object from a Java Servlet

How do you return a JSON object form a Java servlet. Previously when doing AJAX with a servlet I have returned a string. Is there a JSON object type that needs to be used, or do you just return a Str..

TypeError: 'tuple' object does not support item assignment when swapping values

I am writing a simple sort program in python and encounter this error. I want to swap list elements but it returns an error. I am attaching the error and program in question below. list[i+1] = list[i..

In oracle, how do I change my session to display UTF8?

I can't figure out Oracle's encryptic syntax for the life of me. This is Oracle 10g My session's NLS_LANGUAGE is currently defaulting to AMERICAN. I need to be able to display UTF8 characters. Belo..

Converting BigDecimal to Integer

I have Hibernate method which returns me a BigDecimal. I have another API method to which I need to pass that number but it accepts Integer as parameter. I cannot change return types or variable types..

Utils to read resource text file to String (Java)

Is there any utility that helps to read a text file in the resource into a String. I suppose this is a popular requirement, but I couldn't find any utility after Googling...

Failed to connect to camera service

I'm trying to access the camera on my phone. I'm writing a simple stub app prior to putting the code in a widget. I'm not getting very far. The code always throws a runtime exception "failed to connec..

Core dumped, but core file is not in the current directory?

While running a C program, It says "(core dumped)" but I can't see any files under the current path. I have set and verified the ulimit: ulimit -c unlimited ulimit -a I also tried to find a file..

How to validate inputs dynamically created using ng-repeat, ng-show (angular)

I have a table that is created using ng-repeat. I want to add validation to each element in the table. The problem is that each input cell has the same name as the cell above and below it. I attempted..

Classes vs. Modules in VB.NET

Is it considered an acceptable practice to use Modules instead of Classes with Shared member functions in VB.NET? I tend to avoid Modules, because they feel like leftover remains from Visual Basic 6...

How to prevent browser to invoke basic auth popup and handle 401 error using Jquery?

I need to send authorization request using basic auth. I have successfully implemented this using jquery. However when I get 401 error basic auth browser popup is opened and jquery ajax error callback..

"Correct" way to specifiy optional arguments in R functions

I am interested in what is the "correct" way to write functions with optional arguments in R. Over time, I stumbled upon a few pieces of code that take a different route here, and I couldn't find a pr..

How I could add dir to $PATH in Makefile?

I want to write a Makefile which would run tests. Test are in a directory './tests' and executable files to be tested are in the directory './bin'. When I run the tests, they don't see the exec files..

Reversing an Array in Java

If I have an array like this: 1 4 9 16 9 7 4 9 11 What is the best way to reverse the array so that it looks like this: 11 9 4 7 9 16 9 4 1 I have the code below, but I feel it is a little ted..

The network path was not found

I'm running my code and getting this error. But what does it mean? The network path was not found Description: An unhandled exception occurred during the execution of the current web request. P..

Style disabled button with CSS

I'm trying to change the style of a button with an embedded image as seen in the following Fiddle: http://jsfiddle.net/krishnathota/xzBaZ/1/ In the example there are no images, I'm afraid. I'm tryi..

Restful API service

I'm looking to make a service which I can use to make calls to a web-based REST API. Basically I want to start a service on app init then I want to be able to ask that service to request a url and re..

Dynamic classname inside ngClass in angular 2

I need to interpolate a value inside of an ngClass expression but I can't get it to work. I tried these solution which are the only ones that makes sense to me, these two fails with the interpolation..

Read String line by line

Given a string that isn't too long, what is the best way to read it line by line? I know you can do: BufferedReader reader = new BufferedReader(new StringReader(<string>)); reader.readLine(); ..

Set color of text in a Textbox/Label to Red and make it bold in asp.net C#

I want a text color to be red in color on certain condition. Here is how i want to get it done. string minusvalue = TextBox1.Text.ToString(); if (Convert.ToDouble(minusvalue) < 0) { // set colo..

Using a Loop to add objects to a list(python)

I'm trying to use a while loop to add objects to a list. Here's basically what I want to do: class x: pass choice = raw_input(pick what you want to do) while(choice!=0): if(choice==1): ..

How can I use a batch file to write to a text file?

I need to make a script that can write one line of text to a text file in the same directory as the batch file...

Regex replace uppercase with lowercase letters

I'm trying to replace uppercase letters with corresponding lowercase letters using regex. So that EarTH: 1, MerCury: 0.2408467, venuS: 0.61519726, becomes earth: 1, mercury: 0.2408467, venus..

How do I use select with date condition?

In sqlserver, how do I compare dates? For example: Select * from Users where RegistrationDate >= '1/20/2009' (RegistrationDate is datetime type) Thanks..

when exactly are we supposed to use "public static final String"?

I have seen much code where people write public static final String mystring = ... and then just use a value. Why do they have to do that? Why do they have to initialize the value as final prior to u..

Run on server option not appearing in Eclipse

I'm learning SpringMVC framework and checked out a copy of their code: https://src.springframework.org/svn/spring-samples/mvc-basic/trunk/ I can do maven build, install and everything. But on Eclipse,..

What do the icons in Eclipse mean?

What do the icons in the Eclipse debugger mean? What do the icon decorators in Eclipse mean? What do the icons in Eclipse's Package Explorer mean? What do the little letters on top of Eclipse icons m..

Why can't Python parse this JSON data?

I have this JSON in a file: { "maps": [ { "id": "blabla", "iscategorical": "0" }, { "id": "blabla", "iscategorical": "0" ..

How to access cookies in AngularJS?

What's the AngularJS way to access cookies? I've seen references to both a service and a module for cookies, but no examples. Is there, or is there not an AngularJS canonical approach?..

Authentication versus Authorization

What's the difference in context of web applications? I see the abbreviation "auth" a lot. Does it stand for auth-entication or auth-orization? Or is it both?..

Split page vertically using CSS

Sorry guys for the really simple question but I have tried to float one div left and one right with predefined widths along these lines <div style="width: 100%;"> <div style="float:left;..

Android button with icon and text

I have some buttons like this in my app: <Button android:id="@+id/bSearch" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddi..

OPENSSL file_get_contents(): Failed to enable crypto

I'm building a personal stock platform (not distributed). A component I would like to have is the EPS graph on this page: https://eresearch.fidelity.com/eresearch/evaluate/fundamentals/earnings.jhtml..

Convert base-2 binary number string to int

I'd simply like to convert a base-2 binary number string into an int, something like this: >>> '11111111'.fromBinaryToInt() 255 Is there a way to do this in Python? ..

Jersey stopped working with InjectionManagerFactory not found

I am receiving below error while running my Jersey API in Tomcat 8.5.11 which is causing my API to stop: HTTP Status 500 - Servlet.init() for servlet Jersey REST Service threw exception typ..

How can I represent an infinite number in Python?

How can I represent an infinite number in python? No matter which number you enter in the program, no number should be greater than this representation of infinity...

Why catch and rethrow an exception in C#?

I'm looking at the article C# - Data Transfer Object on serializable DTOs. The article includes this piece of code: public static string SerializeDTO(DTO dto) { try { XmlSerializer xmlSe..

get unique machine id

I want to get unique unchangeable Machine id Like Processor serial number of the computer for distribute a software with out copying. I tried with processor serial number and hard disk serial number ..

Is there a 'foreach' function in Python 3?

When I meet the situation I can do it in javascript, I always think if there's an foreach function it would be convenience. By foreach I mean the function which is described below: def foreach(fn,ite..

Why not use Double or Float to represent currency?

I've always been told never to represent money with double or float types, and this time I pose the question to you: why? I'm sure there is a very good reason, I simply do not know what it is...

Removing newline after <h1> tags?

I am having a problem with removing linebreaks after the <h1> tag, as everytime it prints, it adds a line break straight after it, so something like <h1>Hello World!</h1> <h2>H..

Laravel 5 route not defined, while it is?

I'm a little confused on how this is supposed to work. But I'm getting an Route [/preferences/1] not defined error. In my routes.php I have: Route::patch('/preferences/{id}', 'UserController@update'..

Selenium Web Driver & Java. Element is not clickable at point (x, y). Other element would receive the click

I used explicit waits and I have the warning: org.openqa.selenium.WebDriverException: Element is not clickable at point (36, 72). Other element would receive the click: ... Command duratio..

How do I delete specific lines in Notepad++?

I'm cleaning up some code files (C#) and want to remove the regions. And I would like to delete all the lines that have the string '#region'. That's just an example, and I can think of several more us..

How to decompile an APK or DEX file on Android platform?

Is it possible to decompile an APK package or DEX file on Android platform? Are there any tools that can decompile an APK file?..

Not connecting to SQL Server over VPN

I have connected for the first time to an existing network over VPN. I can ping the IP address which is used by the SQL Server from the VPN client, but SSMS does not connect to the SQL Server. I am us..

How line ending conversions work with git core.autocrlf between different operating systems

I've read a lot of different questions and answers on Stack Overflow as well as git documentation on how the core.autocrlf setting works. This is my understanding from what I've read: Unix and Mac O..

Support for the experimental syntax 'classProperties' isn't currently enabled

While I was setting up React within Django project I came across this error ModuleBuildError in Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: C:\U..

Moment.js get day name from date

I'm using jquery and moment.js for a custom calendar. I have a date object in a variable myDate like : Object { date="2014-12-23 14:00:00", timezone_type=3, timezone="Europe/Paris"} I want, usin..

No ConcurrentList<T> in .Net 4.0?

I was thrilled to see the new System.Collections.Concurrent namespace in .Net 4.0, quite nice! I've seen ConcurrentDictionary, ConcurrentQueue, ConcurrentStack, ConcurrentBag and BlockingCollection. ..

Is there an XSLT name-of element?

In XSLT there is the <xsl:value-of select="expression"/> to get the value of an element, but is there something to select the tag-name of the element? In a situation like this: <person&g..

Android error: Failed to install *.apk on device *: timeout

I'm getting this error from time to time and don't know what causing this: When trying to run/debug an Android app on a real device (Galaxy Samsung S in my case) I'm getting the following error in the..

How to read response headers in angularjs?

My server returns this kind of header: Content-Range:0-10/0: I tried to read this header in angular with no luck: var promise = $http.get(url, { params: query }).then(function(response) { c..

Ignore parent padding

I'm trying to get my horizontal rule to ignore the parent padding. Here's a simple example of what I have: #parent { padding:10px; width:100px; } hr { width:100px; } You will find that the h..

Write a file on iOS

How do I write a file on iOS? I'm trying to do it with the following code but I'm doing something wrong: char *saves = "abcd"; NSData *data = [[NSData alloc] initWithBytes:saves length:4]; NSArray *..

How to run test cases in a specified file?

My package test cases are scattered across multiple files, if I run go test <package_name> it runs all test cases in the package. It is unnecessary to run all of them though. Is there a way to ..

What does the 'b' character do in front of a string literal?

Apparently, the following is the valid syntax: my_string = b'The string' I would like to know: What does this b character in front of the string mean? What are the effects of using it? What are a..

pandas: multiple conditions while indexing data frame - unexpected behavior

I am filtering rows in a dataframe by values in two columns. For some reason the OR operator behaves like I would expect AND operator to behave and vice versa. My test code: import pandas as pd df..

How can I know if a branch has been already merged into master?

I have a git repository with multiple branches. How can I know which branches are already merged into the master branch?..

Ruby: How to get the first character of a string

How can I get the first character in a string using Ruby? Ultimately what I'm doing is taking someone's last name and just creating an initial out of it. So if the string was "Smith" I just want "S"..

Getting Data from Android Play Store

I have seen some Apps and Websites who use Data from the Android Play store. E.g. Apps or Sites with a top Apps ranking etc. But how can you get the Data? From where I can parse it? ..

sql server invalid object name - but tables are listed in SSMS tables list

I am attempting to create a Stored Procedure for a newly created database. However the SSMS intellisense does not recognize more than half of the tables which have been created. For example whilst i..

How to iterate for loop in reverse order in swift?

When I use the for loop in Playground, everything worked fine, until I changed the first parameter of for loop to be the highest value. (iterated in descending order) Is this a bug? Did any one else ..

SQLRecoverableException: I/O Exception: Connection reset

Yesterday evening I left the office with a running Java program written by me. It should insert a lot of records into our company database (Oracle) using a JDBC connection. This morning when I came ba..

Background blur with CSS

I want an Vista/7-aero-glass-style effect on a popup on my site, and it needs to be dynamic. I'm fine with this not being a cross-browser effect as long as the site still works on all modern browsers...

Select all contents of textbox when it receives focus (Vanilla JS or jQuery)

What is a Vanilla JS or jQuery solution that will select all of the contents of a textbox when the textbox receives focus?..

How to get dictionary values as a generic list

I just want get a list from Dictionary values but it's not so simple as it appears ! here the code : Dictionary<string, List<MyType>> myDico = GetDictionary(); List<MyType> items =..

What is a 'Closure'?

I asked a question about Currying and closures were mentioned. What is a closure? How does it relate to currying?..

What exactly is the function of Application.CutCopyMode property in Excel

Well first of all I found couple of answers while googling but most of the forums are blocked in my Office Network hence asking this question here! One more intention is to get an answer in plain Engl..

How to convert a 3D point into 2D perspective projection?

I am currently working with using Bezier curves and surfaces to draw the famous Utah teapot. Using Bezier patches of 16 control points, I have been able to draw the teapot and display it using a 'worl..

How to work offline with TFS

Our TFS server has some temporary connectivity issues right now, and as such VS has gone unresponsive, leaving 50+ developers unable to work! Is it possible to switch TFS into an offline mode in the ..

Count occurrences of a char in a string using Bash

I need to count the number of occurrences of a char in a string using Bash. In the following example, when the char is (for example) t, it echos the correct number of occurrences of t in var, but whe..

Could not find server 'server name' in sys.servers. SQL Server 2014

I recently upgraded our SQL Server from 2005 to 2014 (linked server) and I am noticing that one of the stored procedures which calls the exec command to execute a stored procedure on the upgraded link..

Is there way to use two PHP versions in XAMPP?

We are running XAMPP with PHP 7.0 because our new products requires PHP 7. But there are old projects which use functions like mysql_connect, etc. Those are removed in PHP 7.0. So, is there a way to..

two divs the same line, one dynamic width, one fixed

I have two divs under one parent div, the parent div has 100% width: <div id="parent"> <div class="left"></div> <div class="right"></div> </div> The conditio..

Create directories using make file

I'm a very new to makefiles and i want to create directories using makefile. My project directory is like this +--Project +--output +--source +Testfile.cpp +Makefile I want ..

Convert Base64 string to an image file?

I am trying to convert my base64 image string to an image file. This is my Base64 string: http://pastebin.com/ENkTrGNG Using following code to convert it into an image file: function base64_to_jpeg..

java.lang.ClassNotFoundException on working app

I have created and published my first Android app. It's very simple. It works fine on simulator and some phones, but I am getting this error: java.lang.RuntimeException: Unable to instantiate applica..

How to declare a global variable in C++

I know one should not use global variables but I have a need for them. I have read that any variable declared outside a function is a global variable. I have done so, but in another *.cpp File that va..

Connecting to SQL Server with Visual Studio Express Editions

I find it odd that in Visual C# 2008 Express edition, when you use the database explorer, your options are: Microsoft Access SQL Server Compact 3.5, and SQL Server Database File. BUT if you use..

Error after upgrading pip: cannot import name 'main'

Whenever I am trying to install any package using pip, I am getting this import error: guru@guru-notebook:~$ pip3 install numpy Traceback (most recent call last): File "/usr/bin/pip3", line 9, in &..

C++ templates that accept only certain types

In Java you can define generic class that accept only types that extends class of your choice, eg: public class ObservableList<T extends List> { ... } This is done using "extends" keyword. ..

How do you specify a different port number in SQL Management Studio?

I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when connecting to the server using SQL Management Studio?..

Count distinct value pairs in multiple columns in SQL

What query will count the number of rows, but distinct by three parameters? Example: Id Name Address ============================== 1 MyName MyAddress 2 MySecondName Add..

What is this spring.jpa.open-in-view=true property in Spring Boot?

I saw spring.jpa.open-in-view=true property in Spring Boot documentation for JPA configuration. Is the true default value for this property if it's not provided at all?; What does this really do? I ..

C++ Fatal Error LNK1120: 1 unresolved externals

What is causing this error? I google'd it and first few solutions I found were that something was wrong with the library and the main function but both seem to be fine in my problem, I even retyped bo..