Questions Tagged with #Fitsharp

fitSharp is a set of open-source web-based functional testing tools for .NET, inspired by the Framework for Integrated Test.

Cycles in an Undirected Graph

Given an undirected graph G=(V, E) with n vertices (|V| = n), how do you find if it contains a cycle in O(n)?..

Convert String XML fragment to Document Node in Java

In Java how can you convert a String that represents a fragment of XML for insertion into an XML document? e.g. String newNode = "<node>value</node>"; // Convert this to XML Then ins..

How to use "raise" keyword in Python

I have read the official definition of "raise", but I still don't quite understand what it does. In simplest terms, what is "raise"? Example usage would help...

How to format numbers?

I want to format numbers using JavaScript. For example: 10 => 10.00 100 => 100.00 1000 => 1,000.00 10000 => 10,000.00 100000 => 100,000.00 ..

How to use "not" in xpath?

I want to write something of the sort: //a[not contains(@id, 'xx')] (meaning all the links that there 'id' attribute doesn't contain the string 'xx') I can't find the right syntax...

Plotting a python dict in order of key values

I have a python dictionary that looks like this: In[1]: dict_concentration Out[2] : {0: 0.19849878712984576, 5000: 0.093917341754771386, 10000: 0.075060643507712022, 20000: 0.06673074282575861, 3000..

How to insert close button in popover for Bootstrap

JS: $(function(){ $("#example").popover({ placement: 'bottom', html: 'true', title : '<span class="text-info"><strong>title</strong></span> <button type="but..

Convert blob URL to normal URL

My page generates a URL like this: "blob:http%3A//localhost%3A8383/568233a1-8b13-48b3-84d5-cca045ae384f" How can I convert it to a normal address? I'm using it as an <img>'s src attribute...

CGRectMake, CGPointMake, CGSizeMake, CGRectZero, CGPointZero is unavailable in Swift

After converting code to latest swift 3.0 I am shown this error. Also tell me solution for CGSize = CGSizeMake(0,0) static var frameAtStartOfPan: CGRect = CGRectZero static var startPointOfPan: C..

How to add a TextView to a LinearLayout dynamically in Android?

I try to add a TextView to a LinearLayout dynamically such as in the following code, but it doesn't appear when I run the application? setContentView(R.layout.advanced); m_vwJokeLayout=(LinearLayout..

Build tree array from flat array in javascript

I have a complex json file that I have to handle with javascript to make it hierarchical, in order to later build a tree. Every entry of the json has : id : a unique id, parentId : the id of the pare..

ImageView in circular through xml

I'd Like to make any image from my ImageView to be circular with a border. I searched but couldn't find any useful information (anything that I tried didn't work). How can I achieve this through xm..

Jquery selector input[type=text]')

I wrote a code that basically selects all input type=text element like this: $('.sys input[type=text]').each(function () {} How do I change it to select input[type=text] or select?..

Barcode scanner for mobile phone for Website in form

I have inventory maintenance website up and running. currently the back end users are manually typing the item id on the system and using to search and do their work. I would like to automate the typi..

maximum value of int

Is there any code to find the maximum value of integer (accordingly to the compiler) in C/C++ like Integer.MaxValue function in java?..

Checking if object is empty, works with ng-show but not from controller?

I have a JS object declared like so $scope.items = {}; I also have a $http request that fills this object with items. I would like to detect if this item is empty, it appears that ng-show supports ..

Delete data with foreign key in SQL Server table

I'm going to delete data in an SQL Server table (parent) which has a relationship with another table (child). I tried the basic Delete query. But it isn't working (and I know it won't). DELETE FROM t..

How to display with n decimal places in Matlab

I was wondering how to use command to set up displaying with n decimal places in Matlab? Must n be restricted to some predetermined numbers? Or one can just specify any for n? Thanks and regards!..

How to stop asynctask thread in android?

I want to stop a AsyncTask thread from another AsyncTask thread. I have tried like new AsyncTask.cancel(true) to stop the background process but it didn't stop. Could any one help me on this?..

how to read System environment variable in Spring applicationContext

How to read the system environment variable in the application context? I want something like : <util:properties id="dbProperties" location="classpath:config_DEV/" /> or..

Error java.lang.OutOfMemoryError: GC overhead limit exceeded

I get this error message as I execute my JUnit tests: java.lang.OutOfMemoryError: GC overhead limit exceeded I know what an OutOfMemoryError is, but what does GC overhead limit mean? How can I solv..

The request failed or the service did not respond in a timely fashion?

I have the following error while I connect to SQL Server 2008 Management Studio with Windows authentication. "The request failed or the service did not respond in a timely fashion. Consult the event ..

Maven build Compilation error : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Maven

I have a maven project forked and cloned from a git repo onto my eclipse. It is build on Java 8. The first thing i do is perform a mvn clean install But I get following failure message: [INFO]..

Permission denied error on Github Push

Recently, I'm added as a member/contributor for Github project. I have cloned that project on local machine. I have made some changes and committed locally and now trying to Push changes to original ..

What is the difference between require() and library()?

What is the difference between require() and library()?..

Where are the python modules stored?

I have recently started learning Python and I have 2 questions relating to modules. Is there a way to obtain a list of Python modules available (i.e. installed) on a machine? I am using Ubuntu Karmi..

How to select the last column of dataframe

I have done some searching for the answer to this question, but all I can figure out is this: df[df.columns[len(df.columns)-1]] which to me seems unweildy, and un-pythonic (and slow?). What is t..

How to cut first n and last n columns?

How can I cut off the first n and the last n columns from a tab delimited file? I tried this to cut first n column. But I have no idea to combine first and last n column cut -f 1-10 -d "<CTR>v..

Max retries exceeded with URL in requests

I'm trying to get the content of App Store > Business: import requests from lxml import html page = requests.get("") tree = html.fromstring(..

AngularJS HTTP post to PHP and undefined

I have a form with the tag ng-submit="login() The function gets called fine in javascript. function LoginForm($scope, $http) { $['Content-Type'] = 'application/x-www-fo..

Search a whole table in mySQL for a string

I'm trying to search a whole table in mySQL for a string. I want to search all fields and all entrees of a table, returning each full entry that contains the specified text. I can't figure out how ..

"insufficient memory for the Java Runtime Environment " message in eclipse

When I run my Java code in Eclipse, I get the following message: There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (malloc) failed to allocate 4088 b..

How do I fix the npm UNMET PEER DEPENDENCY warning?

I'm on Windows 10, with Node 5.6.0 and npm 3.6.0. I'm trying to install angular-material and mdi into my working folder. npm install angular-material mdi errors with: +-- [email protected] +-- UNMET PEE..

C compiling - "undefined reference to"?

I am making a reliable data transfer protocol and have the function prototype void tolayer5(int, char data[]); With the structs struct msg { char data[20]; }; struct pkt { int seqnum; int..

Count elements with jQuery

Is there a way to count how many elements on the page with a particular class?..

Best PHP IDE for Mac? (Preferably free!)

I need to find a good PHP IDE for Mac, but would prefer a free one. Any suggestions? Thanks!..

How to use switch statement inside a React component?

I have a React component, and inside the render method of the component I have something like this: render() { return ( <div> <div> // removed for ..

Unsupported major.minor version 52.0

Pictures: Command Prompt showing versions Picture of error import java.applet.Applet; import java.awt.*; public class Hello extends Applet { // Java applet to draw "Hello World"..

Where can I download mysql jdbc jar from?

I installed and tried to use jasper report studio. The first brick wall you hit when you try to create a datasource for your reports is java.lang.ClassNotFoundException: com.mysql.jdbc.Driver The ..

PDOException “could not find driver”

I have just installed Debian Lenny with Apache, MySQL, and PHP and I am receiving a PDOException could not find driver. This is the specific line of code it is referring to: $dbh = new PDO('mysql:ho..

Why boolean in Java takes only true or false? Why not 1 or 0 also?

Is there any reason why Java booleans take only true or false why not 1 or 0 also?..

How to set a class attribute to a Symfony2 form input

How can I set the HTML class attribute to a form <input> using the FormBuilder in Symfony2 ? Something like this: ->add('birthdate', 'date',array( 'input' => 'datetime', 'wid..

data.frame rows to a list

I have a data.frame which I would like to convert to a list by rows, meaning each row would correspond to its own list elements. In other words, I would like a list that is as long as the data.frame h..

Converting a Pandas GroupBy output from Series to DataFrame

I'm starting with input data like this df1 = pandas.DataFrame( { "Name" : ["Alice", "Bob", "Mallory", "Mallory", "Bob" , "Mallory"] , "City" : ["Seattle", "Seattle", "Portland", "Seattle", ..

How to check if one of the following items is in a list?

I'm trying to find a short way to see if any of the following items is in a list, but my first attempt does not work. Besides writing a function to accomplish this, is the any short way to check if on..

Android - how to make a scrollable constraintlayout?

I want to make a layout that lets me scroll down using constraint layout, but I don't know how to go about it. Should the ScrollView be the parent of the ConstraintLayout like this? <?xml version=..

In PHP with PDO, how to check the final SQL parametrized query?

In PHP, when accessing MySQL database with PDO with parametrized query, how can you check the final query (after having replaced all tokens)? Is there a way to check what gets really executed by the ..

How to add click event to a iframe with JQuery

I have an iframe on a page, coming from a 3rd party (an ad). I'd like to fire a click event when that iframe is clicked in (to record some in-house stats). Something like: $('#iframe_id').click(funct..

How does delete[] know it's an array?

Alright, I think we all agree that what happens with the following code is undefined, depending on what is passed, void deleteForMe(int* pointer) { delete[] pointer; } The pointer could be all..

How to call python script on excel vba?

trying to call a python script on Vba and I am a newb. I tried converting the main script to an exe using py2exe and then calling it from VBA (shell) but the main script calls other scripts therefore ..

PHP: Split string

How do I split a string by . delimiter in PHP? For example, if I have the string "a.b", how do I get "a"? ..

Convert a String to Modified Camel Case in Java or Title Case as is otherwise called

I want to convert any string to modified Camel case or Title case using some predefined libraries than writing my own functions. For example "HI tHiS is SomE Statement" to "Hi This Is Some Statement..

When is the init() function run?

I've tried to find a precise explanation of what the init() function does in Go. I read what Effective Go says but I was unsure if I understood fully what it said. The exact sentence I am unsure is th..

Cannot lower case button text in android studio

I have a trivial question that has been bothering me for a while. I tried to google this but no one seems to have the same problem as me or doesn't see it as an issue. When I make a button in activity..

fatal: Not a git repository (or any of the parent directories): .git

When I tried to push an existing repository on, and it when I entered the command the website prompted me to put into the terminal, I got this error message fatal: Not a g..

functional way to iterate over range (ES6/7)

What is the best way to do the below in more functional way (with ES6/ES7) let cols = []; for (let i =0; i <= 7; i++) { cols.push(i * i); } return cols; I tried like, return [ ...7 ].map(i =..

"Too many characters in character literal error"

I'm struggling with a piece of code and getting the error: Too many characters in character literal error Using C# and switch statement to iterate through a string buffer and reading tokens, but get..

What is correct content-type for excel files?

I want excel files on a website to open in Excel when clicked, not get saved on desktop, or get opened embedded in a browser etc. Now obviously it all depends on how everything is configured for each ..

How to get post slug from post in WordPress?

I want to get "abc_15_11_02_3" from How can i do this?..

React setState not updating state

So I have this: let total = newDealersDeckTotal.reduce(function(a, b) { return a + b; }, 0); console.log(total, 'tittal'); //outputs correct total setTimeout(() => { this.setState({dealersOve..

Ruby send JSON request

How do I send a JSON request in ruby? I have a JSON object but I dont think I can just do .send. Do I have to have javascript send the form? Or can I use the net/http class in ruby? With header - co..

What's the Use of '\r' escape sequence?

I have C code like this: #include<stdio.h> int main() { printf("Hey this is my first hello world \r"); return 0; } I have used the \r escape sequence as an experiment. When I run the ..

get all the elements of a particular form

function getInputElements() { var inputs = document.getElementsByTagName("input"); } The above code gets all the input elements on a page which has more than one form. How do I get the input ele..

Adding dictionaries together, Python

I have two dictionaries and I'd like to be able to make them one: Something like this pseudo-Python would be nice: dic0 = {'dic0': 0} dic1 = {'dic1': 1} ndic = dic0 + dic1 # ndic would equal {'dic0..

Finding the index of elements based on a condition using python list comprehension

The following Python code appears to be very long winded when coming from a Matlab background >>> a = [1, 2, 3, 1, 2, 3] >>> [index for index,value in enumerate(a) if value > 2] ..

How to get first/top row of the table in Sqlite via Sql Query

I need to fetch the first/top row of a table in a Sqlite database. But my program throws an SQLException "Sqlite Syntax Error: Syntax error near '1' " for the query that I am using: SELECT TOP 1 * ..

How to split string and push in array using jquery

var string = 'a,b,c,d'; var array = []; As we can see above I have one string values with separator*(,)*. I want to split these values and wants to push in the array. At last I want to read my array..

Delete certain lines in a txt file via a batch file

I have a generated txt file. This file has certain lines that are superfluous, and need to be removed. Each line that requires removal has one of two string in the line; "ERROR" or "REFERENCE". The..

Can't install APK from browser downloads

I've downloaded an APK from web, using the default browser and it can't be opened from the Browser -> Downloads. It tells me "Can't open file" But I can use a file browser (like OI File Browser) to ..

How do I revert back to an OpenWrt router configuration?

I recently ported Luci to an OpenWrt router. I was just exploring the thing. I disabled the DHCP server on LAN and enabled as DHCP client. I saved and applied the configuration to the router. Now afte..

Change color of Back button in navigation bar

I am trying to change the color of the Settings button to white, but can't get it to change. I've tried both of these: navigationItem.leftBarButtonItem?.tintColor = UIColor.whiteColor() navigationIt..

Can I load a .NET assembly at runtime and instantiate a type knowing only the name?

Is it possible to instantiate an object at runtime if I only have the DLL name and the class name, without adding a reference to the assembly in the project? The class implements a interface, so once ..

What's the best practice for primary keys in tables?

When designing tables, I've developed a habit of having one column that is unique and that I make the primary key. This is achieved in three ways depending on requirements: Identity integer column t..

Best way to define private methods for a class in Objective-C

I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods. I understand there may be several conventions and ha..

How can I convert integer into float in Java?

I have two integers x and y. I need to calculate x/y and as outcome I would like to get float. For example as an outcome of 3/2 I would like to have 1.5. I thought that easiest (or the only) way to do..

What is the difference between README and in GitHub projects?

I've noticed some GitHub projects have not only a README file, but also a file. What is the difference between these files? I know README serves also as introductory text in the project rep..

In Angular, how to pass JSON object/array into directive?

Currently, my app has a controller that takes in a JSON file then iterates through them using "ng-repeat". This is all working great, but I also have a directive that needs to iterate through the same..

Why does the C preprocessor interpret the word "linux" as the constant "1"?

Why does the C preprocessor in GCC interpret the word linux (small letters) as the constant 1? test.c: #include <stdio.h> int main(void) { int linux = 5; return 0; } Result of..

Copy row but with new id

I have a table "test" with an auto incremented id and an arbitrary number of columns. I want to make a copy of a row in this table with all columns the same except for the id of course. Is there a ..

GCC -fPIC option

I have read about GCC's Options for Code Generation Conventions, but could not understand what "Generate position-independent code (PIC)" does. Please give an example to explain me what does it mean...

Spring AMQP + RabbitMQ 3.3.5 ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN

I am getting below exception org.springframework.amqp.AmqpAuthenticationException: com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mecha..

How to add/update child entities when updating a parent entity in EF

The two entities are one-to-many relationship (built by code first fluent api). public class Parent { public Parent() { this.Children = new List<Child>(); } public int ..

Cannot resolve symbol 'AppCompatActivity'

I've just tried to use Android Studio. I've created blank project and tried to create Activity which extends AppCompatActivity. Unfortunalty Android Studio "says" that it Cannot resolve symbol 'Ap..

Combine two ActiveRecord::Relation objects

Suppose I have the following two objects: first_name_relation = User.where(:first_name => 'Tobias') # ActiveRecord::Relation last_name_relation = User.where(:last_name => 'Fünke') # ActiveRe..

What does mscorlib stand for?

mscorlib is definitely one of .net base class libraries and every program in C# depends on it, but what does it stand for? In the ECMA standard for the C# Language Specification the word is mentioned..

Auto-redirect to another HTML page

What is the syntax for making a page auto-redirect to a different HTML file in a separate folder? All of my searching returns how to redirect from one website to another...

TypeScript and React - children type?

I have a very simple functional component as follows: import * as React from 'react'; export interface AuxProps { children: React.ReactNode } const aux = (props: AuxProps) => props.child..

Iterate two Lists or Arrays with one ForEach statement in C#

This just for general knowledge: If I have two, let's say, List, and I want to iterate both with the same foreach loop, can we do that? Edit Just to clarify, I wanted to do this: List<String>..

Simulating ENTER keypress in bash script

I've created a really simple bash script that runs a few commands. one of these commands needs user input during runtime. i.e it asks the user "do you want to blah blah blah?", I want to simply send a..

Seaborn Barplot - Displaying Values

I'm looking to see how to do two things in Seaborn with using a bar chart to display values that are in the dataframe, but not in the graph 1) I'm looking to display the values of one field in a data..

Error Importing SSL certificate : Not an X.509 Certificate

I am trying to Update the SSL certificate in accordance with this post . I am noob in certificates, so i followed this guide. But, when i enter keytool -keystore mycacerts -storepass changeit -i..

Pass value to iframe from a window

I need to send a value to an iframe. The iframe is present within the current window. How can I achieve this? I need to do it with javascript in the parent window that contains the iframe...

Get all attributes of an element using jQuery

I am trying to go through an element and get all the attributes of that element to output them, for example an tag may have 3 or more attributes, unknown to me and I need to get the names and values ..

Merging Cells in Excel using C#

I have a database which contains 5 tables. Each table contains 24 rows and each row contains 4 columns. I want to display these records in Excel sheet. The heading of each table is the name of the ta..

Deep-Learning Nan loss reasons

Perhaps too general a question, but can anyone explain what would cause a Convolutional Neural Network to diverge? Specifics: I am using Tensorflow's iris_training model with some of my own data and k..

Android: How can I print a variable on eclipse console?

I wanted to print the value of a variable on the console for my debugging purpose, but System.out.println doesn't work...

Storing C++ template function definitions in a .CPP file

I have some template code that I would prefer to have stored in a CPP file instead of inline in the header. I know this can be done as long as you know which template types will be used. For example..

How do I pass an object to HttpClient.PostAsync and serialize as a JSON body?

I'm using System.Net.Http, I found several examples on the web. I managed to create this code for make a POST request: public static string POST(string resource, string token) { using (var client..

How to create a drop-down list?

How can I create a drop-down list? I've tried a ScrollView but it's not exactly what I need...

Regex - Does not contain certain Characters

I need a regex to match if anywhere in a sentence there is NOT either < or >. If either < or > are in the string then it must return false. I had a partial success with this but only if my <..

Add UIPickerView & a Button in Action sheet - How?

My application requires following things to be added in an action sheet. UIToolbar Button on UIToolbar UIPicker Control I have included an image to understand my requirements. Could you please ..

How to check if a subclass is an instance of a class at runtime?

In an android app test suite I have a class like this where B is a view: public class A extends B { ... etc... } now I have a list of view objects which may contain A objects but in this case I onl..

ModuleNotFoundError: No module named 'sklearn'

I want to import sklearn but there is no module apparently: ModuleNotFoundError: No module named 'sklearn' I am using Anaconda and Python 3.6.1; I have checked everywhere but still can't find answe..

How to execute a remote command over ssh with arguments?

In my .bashrc I define a function which I can use on the command line later: function mycommand() { ssh [email protected] cd testdir;./ "$1" } When using this command, just the cd comma..

Change tab bar item selected color in a storyboard

I want to change my tab bar items to be pink when selected instead of the default blue. How can i accomplish this using the storyboard editor in Xcode 6? Here are my current setting which are not wo..

macro run-time error '9': subscript out of range

I found a macro on the web to protect a worksheet with a password. It works fine, but when I save the file I get the message: run-time error '9': subscription out of range. I have never programmed ..

How to save a PNG image server-side, from a base64 data string

I'm using Nihilogic's "Canvas2Image" JavaScript tool to convert canvas drawings to PNG images. What I need now is to turn those base64 strings that this tool generates, into actual PNG files on the s..

Why does SSL handshake give 'Could not generate DH keypair' exception?

When I make an SSL connection with some IRC servers (but not others - presumably due to the server's preferred encryption method) I get the following exception: Caused by: java.lang.RuntimeException:..

how to loop through each row of dataFrame in pyspark

E.g sqlContext = SQLContext(sc) sample=sqlContext.sql("select Name ,age ,city from user") The above statement print entire table on terminal but i want to access each row in that tab..

What is the difference between a mutable and immutable string in C#?

What is the difference between a mutable and immutable string in C#?..

Is multiplication and division using shift operators in C actually faster?

Multiplication and division can be achieved using bit operators, for example i*2 = i<<1 i*3 = (i<<1) + i; i*10 = (i<<3) + (i<<1) and so on. Is it actually faster to use say..

How to see JavaDoc in IntelliJ IDEA?

I just switched from Eclipse to IntelliJ. IntelliJ lacks one feature from Eclipse - when you put your mouse over a method, Eclipse shows javadoc info. I think the way to show it is to use a shortcut..

Convert int to string?

How can I convert an int datatype into a string datatype in C#?..

multiple where condition codeigniter

How can I convert this query to active record? "UPDATE table_user SET email = '$email', last_ip = '$last_ip' where username = '$username' and status = '$status'"; I tried to convert the query a..

XML element with attribute and content using JAXB

How can I generate the following XML using JAXB? <sport type="" gender=""> sport description </sport> ..

isPrime Function for Python Language

So I was able to solve this problem with a little bit of help from the internet and this is what I got: def isPrime(n): for i in range(2,int(n**0.5)+1): if n%i==0: return False..

Show/hide image with JavaScript

I have an HTML page with an image that I set to be invisible by CSS visibility: hidden. I want to make a link called "Show image", so that when I click on it, the image appears. Now, I don't know ho..

span with onclick event inside a tag

Sample code <a href="page" style="text-decoration:none;display:block;"> <span onclick="hide()">Hide me</span> </a> Since the a tag is over the span is not possible to cl..

Trying Gradle build - "Task 'build' not found in root project"

I just started to read "Pro Spring MVC with web flow" and it comes with a code sample that I want to follow. What I want - I want to build the applications as it's done in the book, using Gradle Wh..

how to stop a loop arduino

I have this loop, how would I end the loop? void loop() { // read the pushbutton input pin: a ++; Serial.println(a); analogWrite(speakerOut, NULL); if(a > 50..

Plotting with C#

C# seems to show some promise for scientific computing, but I found very little about one plotting 2D graphs, which is very important both for science student and scientists. Is there a reliable, fre..

Oracle: is there a tool to trace queries, like Profiler for sql server?

i work with sql server, but i must migrate to an application with Oracle DB. for trace my application queries, in Sql Server i use wonderful Profiler tool. is there something of equivalent for Oracle?..

How can I redirect a php page to another php page?

Possible Duplicate: How to redirect users to another page? I'm a beginner in the programming field....I want to redirect a php page to another one..How is it possible in the most easiest way? My co..

SQL: Two select statements in one query

I want to select information from two SQL tables within one query, the information is unrelated though, so no potential joints exist. An example could be the following setup. tblMadrid id | name..

Python creating a dictionary of lists

I want to create a dictionary whose values are lists. For example: { 1: ['1'], 2: ['1','2'], 3: ['2'] } If I do: d = dict() a = ['1', '2'] for i in a: for j in range(int(i), int(i) + 2..

How to scroll to an element inside a div?

I have a scrolled div and I want to have an event when I click on it, it will force this div to scroll to view an element inside. I wrote its JavasSript like this: document.getElementById(chr).scrollI..

How to disable spring security for particular url

I am using stateless spring security,but in case of signup i want to disable spring security.I disabled using antMatchers("/api/v1/signup").permitAll(). but it is not working,i am getting error b..

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

I download from Laravel for openshift then upload over my repository over github. This code for connect to database not work. The problem is that load variable f..

What are named pipes?

What are they and how do they work? Context happens to be SQL Server..

Find the greatest number in a list of numbers

Is there any easy way or function to determine the greatest number in a python list? I could just code it, as I only have three numbers, however it would make the code a lot less redundant if I could ..

getActionBar() returns null

I'm having an odd problem. I am making an app with targetsdk 13. In my main activity's onCreate method i call getActionBar() to setup my actionbar. This works fine when running on the Android 3.2 em..

Python matplotlib multiple bars

How to plot multiple bars in matplotlib, when I tried to call the bar function multiple times, they overlap and as seen the below figure the highest value red can be seen only. How can I plot the mult..

Bootstrap modal in React.js

I need to open a Bootstrap Modal from clicking on a button in a Bootstrap navbar and other places (to show data for a component instance, ie. providing "editing" functionality), but I don't know how t..

How do I pass command line arguments to a Node.js program?

I have a web server written in Node.js and I would like to launch with a specific folder. I'm not sure how to access arguments in JavaScript. I'm running node like this: $ node server.js folder her..

Error: Cannot find module 'webpack'

I'm just getting started with webpack and am having difficulty getting the multiple-entry-points sample to build. The webpack.config.js file in the example includes the line var CommonsChunkPlugin ..

Effective swapping of elements of an array in Java

I am wondering if there is a more efficient way of swapping two elements in an Array, than doing something like this: String temp = arr[1]; arr[1] = arr[2]; arr[2] = temp; Well, this is obviously n..

invalid multibyte char (US-ASCII) with Rails and Ruby 1.9

I'm using Ruby 1.9.1 with Rails 2.3.4 My application is to handle text input If I try something like (the inside quotation marks look different) text = "”“" I get the following error: #<Sy..

How can I get the day of a specific date with PHP

I want to get the day (Sunday, Monday,...) of October 22. How can I do that?..

Eclipse, regular expression search and replace

In eclipse, is it possible to use the matched search string as part of the replace string when performing a regular expression search and replace? Basically, I want to replace all occurrences of var..

What's the difference between "end" and "exit sub" in VBA?

In VBA, sometimes we want to exit the program after some condition is true. But do I use end or exit sub? ..

How to find and return a duplicate value in array

arr is array of strings: ["hello", "world", "stack", "overflow", "hello", "again"] What would be an easy and elegant way to check if arr has duplicates, and if so, return one of them (no matter whi..

instantiate a class from a variable in PHP?

I know this question sounds rather vague so I will make it more clear with an example: $var = 'bar'; $bar = new {$var}Class('var for __construct()'); //$bar = new barClass('var for __construct()'); ..

Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister

I am actually new to hibernate and tried to set up 2 classes. Account and Person. Now all i try to do is create a one to one bidirectional dependency using annotations. Here are some details and code ..

Importing Pandas gives error AttributeError: module 'pandas' has no attribute 'core' in iPython Notebook

I am running a iPython notebook via the Anaconda Navigator app (version 1.1.0). When I want to import pandas it gives me a strange error. I thought the Anaconda app included the pandas package? -----..

How to enable file upload on React's Material UI simple input?

I am creating a simple form to upload file using electron-react-boilerplate with redux form & material ui. The problem is that I do not know how to create input file field because material ui doe..

Make a VStack fill the width of the screen in SwiftUI

Given this code : import SwiftUI struct ContentView : View { var body: some View { VStack(alignment: .leading) { Text("Title") .font(.title) Text..

jQuery UI Color Picker

I have heard that jQuery UI includes a Color Picker but could find little documentation regarding it. Does it exist? Any decent documentation on how to implement it? I found this: http://docs.jque..

How to Add Stacktrace or debug Option when Building Android Studio Project

I was trying to investigate the project build error in the console output as follow: :myapp:processDebugResources FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed..

Install .ipa to iPad with or without iTunes

I have the .ipa from PhoneGap build and I need to test it. I got provisioning profile from Developer account. So my question is: can I directly put my .ipa to iPad to install for testing, or do I hav..

How to hide the bar at the top of "youtube" even when mouse hovers over it?

I am attempting to embed a youtube video, however, I have not discovered a way to keep the bar at the top from showing when the mouse hovers over it. For my purposes it is important that users are not..

How to write a stored procedure using phpmyadmin and how to use it through php?

I want to be able create stored procedures using phpMyAdmin and later on use it through php. But I dont know how to? From what I know, I found out that we cannot manage stored procedures through phpMy..

How can I save a screenshot directly to a file in Windows?

Is there a one button way to save a screenshot directly to a file in Windows? TheSoftwareJedi accurately answered above question for Windows 8 and 10. Below original extra material remains for poste..

PHP foreach with Nested Array?

I have a nested array in which I want to display a subset of results. For example, on the array below I want to loop through all the values in nested array[1]. Array ( [0] => Array ( [0]..

What's the difference between Html.Label, Html.LabelFor and Html.LabelForModel

What's the difference between @Html.Label(), @Html.LabelFor() and @Html.LabelForModel() methods?..

SaveFileDialog setting default path and file type?

I'm using SaveFileDialog.SaveFile. How can I get it to the default (operating system) drive letter and also limit the options to show only .BIN as the file extension? I tried reading the docs on MSDN..

Create html documentation for C# code

I'm currently working on a C# project and VisualAssist generates these fancy /// <summary></summary> comments for me and I've been using them do document my code. I assume there must be a..

Fatal error: Class 'ZipArchive' not found in

I have a problem that I install 'Archive_Zip 0.1.1' on Linux server, but when I try to run the script to create the zip file it gives the fatal error Fatal error: Class ZipArchive not found in .....

How to detect a mobile device with JavaScript?

I have been asked to create an actual HTML page / JavaScript to simulate detection of the mobile devices (iPhone / iPad / Android) using JavaScript code. This will then take the user to a different sc..

Now() function with time trim

So the function =Now() there a way I can use this and only get the date, not the time? or is there just a function for this idea?..

How to center form in bootstrap 3

How can I center my login form ? I'm using bootstrap column but it's not working. Here is my code: <div class="container"> <div class="row"> <div class="col-md-4 col-md-of..

Expand div to max width when float:left is set

I have something like that: <div style="width:100px;float:left">menu</div> <div style="float:left">content</div> both floats are neccesary. I want the content div to fill th..

Full examples of using pySerial package

Can someone please show me a full python sample code that uses pyserial, i have the package and am wondering how to send the AT commands and read them back!..

Split String by delimiter position using oracle SQL

I have a string and I would like to split that string by delimiter at a certain position. For example, my String is F/P/O and the result I am looking for is: Therefore, I would like to separate th..

How to set MouseOver event/trigger for border in XAML?

I want the border to turn green when the mouse is over it and then to return to blue when the mouse is no longer over the border. I attempted this without any luck: <Border Name="ClearButto..

Python - use list as function parameters

How can I use a Python list (e.g. params = ['a',3.4,None]) as parameters to a function, e.g.: def some_func(a_char,a_float,a_something): # do stuff ..

How do I install command line MySQL client on mac?

I want to install the MySQL client for the command line, not a GUI. I have searched over the web but only found instructions on installing the MySQL server...

T-SQL to list all the user mappings with database roles/permissions for a Login

I am looking for a t-sql script which can list the databases and and the respective roles/privileges mapped for a particular user. Using SQL Server 2008 R2...

Bootstrap Modal before form Submit

I'm new to Modals, I have a Form and when the user clicks submit, It will show a Modal confirming if the user wants to submit, the modal also contains the user input from the form fields. I searched a..

What's a concise way to check that environment variables are set in a Unix shell script?

I've got a few Unix shell scripts where I need to check that certain environment variables are set before I start doing stuff, so I do this sort of thing: if [ -z "$STATE" ]; then echo "Need to s..

In Bash, how to add "Are you sure [Y/n]" to any command or alias?

In this particular case, I'd like to add a confirm in Bash for Are you sure? [Y/n] for Mercurial's hg push ssh://[email protected]//somepath/morepath, which is actually an alias. Is there ..

Alternative to the HTML Bold tag

Okay, so I know that in HTML you can use the <b> tag, but isn't there a "weight=bold" attribute that I can use in the <p> tag? Or is that in CSS, or Javascript?..

Material Design not styling alert dialogs

I've added the appCompat material design to my app and it seems that the alert dialogs are not using my primary, primaryDark, or accent colors. Here is my base style: <style name="MaterialNavyTh..

Copy folder recursively in Node.js

Is there an easier way to copy a folder and all its content without manually doing a sequence of fs.readir, fs.readfile, fs.writefile recursively? I am just wondering if I'm missing a function which w..

Maven project version inheritance - do I have to specify the parent version?

I have two projects: Parent project: A, Sub project: B A/pom.xml: <groupId>com.dummy.bla</groupId> <artifactId>parent</artifactId> <version>0.1-SNAPSHOT</version>..

CSS set li indent

Googling and searching stack overflow did not return any results that I could recognize, so forgive me if this has been asked before... I have drop down main menu which uses lists as its basis. The p..

How to convert current date to epoch timestamp?

How to convert current date to epoch timestamp ? Format current date: 29.08.2011 11:05:02 ..

Avoiding "resource is out of sync with the filesystem"

I develop Java code with Eclipse and regularly get this message: resource is out of sync with the filesystem. Right-click > Refresh will always clear this. But why can't Eclipse refresh automa..

How to change text transparency in HTML/CSS?

I'm very new to HTML/CSS and I'm trying to display some text as like 50% transparent. So far I have the HTML to display the text with full opacity <html><font color=\"black\" face=\"arial\"..

javascript set cookie with expire time

I am setting a cookie by Javascript and it is working fine but it is not taking the expire time I am giving. It keeps on taking session value regardless of what I give, below is the code which I took ..

Alternating Row Colors in Bootstrap 3 - No Table

I am looking for a way to do alternating row colors in a responsive layout in Bootstrap 3. I cannot figure out how to do it without a LOT of extensive, confusing CSS and was hoping that someone had a ..

Printing newlines with print() in R

I am trying to print a multiline message in R. For example, print("File not supplied.\nUsage: ./program F=filename",quote=0) I get the output File not supplied.\nUsage: ./program F=filename inst..

How to set background color of an Activity to white programmatically?

How can I set the background color of an Activity to white programatically?..

Best way to do Version Control for MS Excel

What version control systems have you used with MS Excel (2003/2007)? What would you recommend and Why? What limitations have you found with your top rated version control system? To put this in pers..

Python; urllib error: AttributeError: 'bytes' object has no attribute 'read'

Note: This is Python 3, there is no urllib2. Also, I've tried using json.loads(), and I get this error: TypeError: can't use a string pattern on a bytes-like object I get this error if I use json..

React-Router External link

Since I'm using react-router to handle my routes in a react app, I'm curious if there is a way to redirect to an external resource. Say someone hits: I would like it to r..

how to sort pandas dataframe from one column

I have a data frame like this: print(df) 0 1 2 0 354.7 April 4.0 1 55.4 August 8.0 2 176.5 December 12.0 3 95.5 February 2.0 4 85.6 January ..

How do you convert a byte array to a hexadecimal string, and vice versa?

How can you convert a byte array to a hexadecimal string, and vice versa?..

Easy way to concatenate two byte arrays

What is the easy way to concatenate two byte arrays? Say, byte a[]; byte b[]; How do I concatenate two byte arrays and store it in another byte array?..

How to set the project name/group/version, plus {source,target} compatibility in the same file?

I intend to generalize the use of gradle for my projects and would like to reuse the same build file everywhere. Unfortunately, I have trouble trying to define the properties mentioned in $subject in ..

Repeat table headers in print mode

Is it possible in CSS using a property inside an @page to say that table headers (th) should be repeated on every page if the table spreads over multiple pages?..

How to remove css property in jQuery

if(prev_clicked) { $("#accordion li a.category").css('background-image', 'url("img/off_all_channel.png")'); $("#accordion li a.comment").css('background-image', 'url("im..

CSS display:table-row does not expand when width is set to 100%

I'm having a bit of a problem. I'm using FireFox 3.6 and have the following DOM structure: <div class="view-row"> <div class="view-type">Type</div> <div class="view-name"..

Error: Could not find or load main class

I am having trouble compiling and running my Java code, intended to allow me to interface Java with a shared object for Vensim, a simulation modeling package. The following code compiles without erro..

CSS two divs next to each other

I want to put two <div>s next to each other. The right <div> is about 200px; and the left <div> must fill up the rest of the screen width? How can I do this?..

Telling Python to save a .txt file to a certain directory on Windows and Mac

How do you tell Python where to save a text file? For example, my computer is running the Python file off my desktop. I want it to save all the text file in my documents folder, not on my desktop. Ho..

Convert DateTime to TimeSpan

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

Deserializing a JSON into a JavaScript object

I have a string in a Java server application that is accessed using AJAX. It looks something like the following: var json = [{ "adjacencies": [ { "nodeTo": "graphnode2", ..

How do you right-justify text in an HTML textbox?

I have a need to display many numerical values in columns. These values need to be easily editable so I cannot just display them in a table. I am using textboxes to display them. Is there a way for me..

How to change credentials for SVN repository in Eclipse?

I have Eclipse 3.4.2 installed on Windows with subclipse. Another developer added an SVN repository with his credentials and selected 'Save password'. Now every time I do anything with SVN his cached ..

JSON Java 8 LocalDateTime format in Spring Boot

I'm having a small problem with formatting a Java 8 LocalDateTime in my Spring Boot Application. With 'normal' dates I have no problem, but the LocalDateTime fields are converted to the following: "s..