Questions Tagged with #Xmlconvert

Where's the DateTime 'Z' format specifier?

[Update: Format specifiers are not the same thing as format strings; a format specifier is a piece of a custom format string, where a format string is 'stock' and doesn't provide customization. My pro..

Get the data received in a Flask request

I want to be able to get the data sent to my Flask app. I've tried accessing but it is an empty string. How do you access request data? from flask import request @app.route('/', methods..

Output array to CSV in Ruby

It's easy enough to read a CSV file into an array with Ruby but I can't find any good documentation on how to write an array into a CSV file. Can anyone tell me how to do this? I'm using Ruby 1.9.2 i..

Specify the date format in XMLGregorianCalendar

I want to use a Date in XMLGregorianCalendar format for sending to a web service. The web service expects information in yyyy-dd-mm format. I use the below code to create an XMLGregorianCalendar and s..

Setting up a JavaScript variable from Spring model by using Thymeleaf

I am using Thymeleaf as template engine. How I pass a variable from Spring model to JavaScript variable? Spring-side: @RequestMapping(value = "message", method = RequestMethod.GET) public String mes..

How to get year and month from a date - PHP

How to get year and month from a given date. e.g. $dateValue = '2012-01-05'; From this date I need to get year as 2012 and month as January. ..

How to use requirements.txt to install all dependencies in a python project

I am new to python. Recently I got a project written by python and it requires some installation. I run below command to install but got an error. # pip install requirements.txt Collecting requireme..

Running conda with proxy

I'm using Anaconda 2.7 on windows, and my internet connection uses a proxy. Previously, when using python 2.7 (Not Anaconda), I installed package like this: pip install {packagename} --proxy proxy-u..

How to create a notification with NotificationCompat.Builder?

I need to create a simple notification which will be shown in notification bar along with the sound and icon if possible? I also need it to be compatitible with Android 2.2, so i found that Notificati..

How can I find out the current route in Rails?

I need to know the current route in a filter in Rails. How can I find out what it is? I'm doing REST resources, and see no named routes...

Upload DOC or PDF using PHP

I'm able to upload images fine, but when when I change the types from image/jpg, image/gif to application/msword and application/pdf, it doesn't work. Here's my code. The exact same code works for ima..

Does Java SE 8 have Pairs or Tuples?

I am playing around with lazy functional operations in Java SE 8, and I want to map an index i to a pair / tuple (i, value[i]), then filter based on the second value[i] element, and finally output jus..

Java 8, Streams to find the duplicate elements

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

UIViewController viewDidLoad vs. viewWillAppear: What is the proper division of labor?

I have always been a bit unclear on the type of tasks that should be assigned to viewDidLoad vs. viewWillAppear: in a UIViewController subclass. e.g. I am doing an app where I have a UIViewControlle..

How do I set default value of select box in angularjs

I have a form that is used to edit a object and I can't select a value in the select box. I have a json array which represents the to be edited and look like this: $scope.item = [{ "objec..

How to generate unique IDs for form labels in React?

I have form elements with labels and I want to have unique IDs to link labels to elements with htmlFor attribute. Something like this: React.createClass({ render() { const id = ???; ..

How to add header row to a pandas DataFrame

I am reading a csv file into pandas. This csv file constists of four columns and some rows, but does not have a header row, which I want to add. I have been trying the following: Cov = pd.read_csv("..

Best way to deploy Visual Studio application that can run without installing

I wrote a fairly simple application with C#/.NET and can't figure out a good way to publish it. It's a sort of a "tool" that users would only run once, or run every few months. Because of this, I'm ho..

How to trigger jQuery change event in code

I have a change event that is working fine but I need to get it to recurse. So I have a function that is triggered on change that will "change" other drop downs based on a class selector (notice "dro..

nvarchar(max) still being truncated

So I'm writing a stored procedure in MS SQL Server 2008. It's a really long query and I have to write it dynamically, so I create a variable called @Query and make it of type NVARCHAR(MAX). Now, I hav..

Cannot invoke an expression whose type lacks a call signature

I have apple and pears - both have an isDecayed attribute: interface Apple { color: string; isDecayed: boolean; } interface Pear { weight: number; isDecayed: boolean; } And both ty..

Java : Cannot format given Object as a Date

I have Date in this format (2012-11-17T00:00:00.000-05:00). I need to convert the date into this format mm/yyyy. I tried this way, but I am getting this Exception. Exception in thread "main" java.l..


I have the following table but unsure of whether it is possible to pivot this and retain all the labels. RATIO RESULT SCORE GRADE Current Ratio 1.294 60 Good Gearing R..

How to use comparison and ' if not' in python?

In one piece of my program I doubt if i use the comparison correctly. i want to make sure that ( u0 <= u < u0+step ) before do something. if not (u0 <= u) and (u < u0+step): u0 = u0+..

nodeJS - How to create and read session with express

I want to create a user sessison when user enter the app. And read the session whenever needed. Here is my try var io = require(''), express = require('express'); querystring = req..

Get User's Current Location / Coordinates

How can I store the user's current location and also show the location on a map? I am able to show pre-defined coordinates on a map, I just don't know how to receive information from the device. Als..

ASP.NET MVC: Custom Validation by DataAnnotation

I have a Model with 4 properties which are of type string. I know you can validate the length of a single property by using the StringLength annotation. However I want to validate the length of the 4 ..

DD/MM/YYYY Date format in Moment.js

How can i change the current date to this format(DD/MM/YYYY) using moment.js? I have tried below code. $scope.SearchDate = moment(new Date(), "DD/MM/YYYY"); But it's return 0037-11-24T18:30:00.000..

Flutter: RenderBox was not laid out

I'm trying to create a ListView but when I import the list_form.dart class i get this error. Maybe I made some mistakes with the layout because if I try to run it inside the main file I don't get this..

Dialog throwing "Unable to add window — token null is not for an application” with getApplication() as context

My Activity is trying to create an AlertDialog which requires a Context as a parameter. This works as expected if I use: AlertDialog.Builder builder = new AlertDialog.Builder(this); However, I am l..

Nginx location "not equal to" regex

How do I set a location condition in Nginx that responds to anything that isn't equal to the listed locations? I tried: location !~/(dir1|file2\.php) { rewrite ^/(.*)$1 perm..

CSS: Set Div height to 100% - Pixels

I have a header on my page which is just over 100px (111px to be exact) The div below it needs to extend to the bottom of the viewport, as if i had set the bottom to 0px. The problem lies in the fact ..

How can I install Python's pip3 on my Mac?

I'm trying to install pip3, but I'm not having any luck. Also, I tried sudo install and it did not work. How could I install pip3 on my Mac? sudo easy_install pip3 Password: Searching for pip3 Reading..

How do I add a newline to command output in PowerShell?

I run the following code using PowerShell to get a list of add/remove programs from the registry: Get-ChildItem -path hklm:\software\microsoft\windows\currentversion\uninstall ` | ForEach-Object ..

How can I remove the search bar and footer added by the jQuery DataTables plugin?

I am using jQuery DataTables. I want to remove the search bar and footer (showing how many rows there are visible) that is added to the table by default. I just want to use this plugin for sorting, ..

Java Spring Boot: How to map my app root (“/”) to index.html?

I'm new to Java and to Spring. How can I map my app root http://localhost:8080/ to a static index.html? If I navigate to http://localhost:8080/index.html its works fine. My app structure is : My c..

Is it a good practice to use try-except-else in Python?

From time to time in Python, I see the block: try: try_this(whatever) except SomeException as exception: #Handle exception else: return something What is the reason for the try-except-else..

Error handling with PHPMailer

I'm trying to use PHPMailer for a small project, but I'm a bit confused about error handling with this software. Hoping someone has experience with it. When I've set up an email and I use: $result = ..

How to detect a textbox's content has changed

I want to detect whenever a textbox's content has changed. I can use the keyup method, but that will also detect keystrokes which do not generate letters, like the arrow keys. I thought of two methods..

R: Break for loop

Can you confirm if the next break cancels the inner for loop? for (out in 1:n_old){ id_velho <- old_table_df$id[out] for (in in 1:n) { id_novo <- new_table_df$ID[in..

Number of processors/cores in command line

I am running the following command to get the number of processors/cores in Linux: cat /proc/cpuinfo | grep processor | wc -l It works but it does not look elegant. How would you suggest improve it..

How long to brute force a salted SHA-512 hash? (salt provided)

Here is an algorithm in Java: public String getHash(String password, String salt) throws Exception { String input = password + salt; MessageDigest md = MessageDigest.getInstance(SHA-512); ..

How to add an extra column to a NumPy array

Let’s say I have a NumPy array, a: a = np.array([ [1, 2, 3], [2, 3, 4] ]) And I would like to add a column of zeros to get an array, b: b = np.array([ [1, 2, 3, 0], [2, 3..

MySQL IF ELSEIF in select query

I'm trying to select different prices of a product based on the quantity that user chooses. This is the query I'm working on (it has a syntax error): select id, (SELECT IF(qty_1<='23',p..

How to stop C# console applications from closing automatically?

My console applications on Visual Studio are closing automatically, so I'd like to use something like C's system("PAUSE") to "pause" the applications at the end of its execution, how can I achieve tha..

Python: Split a list into sub-lists based on index ranges

UPDATED: In python, how do i split a list into sub-lists based on index ranges e.g. original list: list1 = [x,y,z,a,b,c,d,e,f,g] using index ranges 0 - 4: list1a = [x,y,z,a,b] using index rang..

Differences between dependencyManagement and dependencies in Maven

What is the difference between dependencyManagement and dependencies? I have seen the docs at Apache Maven web site. It seems that a dependency defined under the dependencyManagement can be used in it..

HTML for the Pause symbol in audio and video control

I'm trying to find the Unicode symbol to make a button display the Unicode pause symbol. I was able to find that the Unicode play symbol is &#9658 but I'm looking for the equivalent of the Unicode..

how to inherit Constructor from super class to sub class

How to inherit the constructor from a super class to a sub class?..

iOS: set font size of UILabel Programmatically

I'm trying to set the font size of a UILabel. No matter what value I put though the text size doesn't seem to change. Here's the code I'm using. [self setTitleLabel:[[UILabel alloc] initWithFrame:CGR..

In Python try until no error

I have a piece of code in Python that seems to cause an error probabilistically because it is accessing a server and sometimes that server has a 500 internal server error. I want to keep trying until ..

How to display the string html contents into webbrowser control?

I have a c# win app program. I save the text with html format in my database but I want to show it in a webbrowser to my user.How to display the string html contents into webbrowser control? thanks i..

Post multipart request with Android SDK

I'm trying to do something I thought would be relatively simple: Upload an image to a server with the Android SDK. I'm found a lot of example code:

Using Ajax.BeginForm with ASP.NET MVC 3 Razor

Is there a tutorial or code example of using Ajax.BeginForm within MVC 3 where unobtrusive validation and Ajax exist? This is an elusive topic for MVC 3, and I cannot seem to get my form to w..

How to get current url in view in core 1.0

In previous versions of, we could use @Request.Url.AbsoluteUri But it seems it's changed. How can we do that in core 1.0?..

git: diff between file in local repo and origin

I want to find the differences between a file I have in my local repo vs what is in the origin master. I know that there is git diff, however I just want to isolate it down to this one particular fil..

Creation timestamp and last update timestamp with Hibernate and MySQL

For a certain Hibernate entity we have a requirement to store its creation time and the last time it was updated. How would you design this? What data types would you use in the database (assuming ..

How to use Servlets and Ajax?

I'm very new to web apps and Servlets and I have the following question: Whenever I print something inside the servlet and call it by the webbrowser, it returns a new page containing that text. Is th..

How to print a percentage value in python?

this is my code: print str(float(1/3))+'%' and it shows: 0.0% but I want to get 33% What can I do?..

Unable to run 'adb root' on a rooted Android phone

After rooting my device, I need to run adb root and then adb shell so I could then access my applications database. When trying to run adb root I keep getting "adbd cannot run as root in production b..

Save a subplot in matplotlib

Is it possible to save (to a png) an individual subplot in a matplotlib figure? Let's say I have import pyplot.matplotlib as plt ax1 = plt.subplot(121) ax2 = plt.subplot(122) ax1.plot([1,2,3],[4,5,6]..

python pandas: apply a function with arguments to a series

I want to apply a function with arguments to a series in python pandas: x = my_series.apply(my_function, more_arguments_1) y = my_series.apply(my_function, more_arguments_2) ... The documentation d..

How to equalize the scales of x-axis and y-axis in Python matplotlib?

I wish to draw lines on a square graph. The scales of x-axis and y-axis should be the same. e.g. x ranges from 0 to 10 and it is 10cm on the screen. y has to also range from 0 to 10 and has to be al..

Convert into a useable string using Arduino?

I'm using two Arduinos to sent plain text strings to each other using newsoftserial and an RF transceiver. Each string is perhaps 20-30 characters in length. How do I convert into a str..

Combining C++ and C - how does #ifdef __cplusplus work?

I'm working on a project that has a lot of legacy C code. We've started writing in C++, with the intent to eventually convert the legacy code, as well. I'm a little confused about how the C and C++ ..

Determine the data types of a data frame's columns

I'm using R and have loaded data into a dataframe using read.csv(). How do I determine the data type of each column in the data frame?..

Subquery returned more than 1 value.This is not permitted when the subquery follows =,!=,<,<=,>,>= or when the subquery is used as an expression

I have a stored procedure that select * from book table , using sub query my query is USE [library] GO /****** Object: StoredProcedure [dbo].[report_r_and_l] Script Date: 04/17/2013 12:42:39 **..

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

HTML button onclick event

This might be a very basic question; believe me I found very hard to find the answer to this question on the internet. I have 3 HTML pages stored in my server (Tomcat locally) & i want to open t..

JDBC ResultSet: I need a getDateTime, but there is only getDate and getTimeStamp

I would like to get the DATETIME column from an Oracle DB Table with JDBC. Here is my code: int columnType = rsmd.getColumnType(i); if(columnType == Types.DATE) { Date aDate = rs.getDate(i); ..

Javascript Date - set just the date, ignoring time?

I have a bunch of objects, each of which has a timestamp, that I want to group by date, into a JSON object. The ultimate goal is something like this: myObject = { "06/07/2012" : [ { ..

Conditional Formatting (IF not empty)

How do I conditionally format a cell so if not blank it is grey? I tried to do 'not equal', but it didn't work. I am using Windows Office 2003 with Windows XP at work. I don't see the same feature..

Jquery Smooth Scroll To DIV - Using ID value from Link

So i'm having some issues with my JQuery which is suppose to scroll to particular divs. HTML <div id="searchbycharacter"> <a class="searchbychar" href="#" id="#0-9" onclick="return fals..

Is there a keyboard shortcut (hotkey) to open Terminal in macOS?

One of my primary tools used for programming is my Terminal. It makes my programming process more efficient when I'm able to quickly open a Terminal window. In Ubuntu, I was using (window+Alt+T) to o..

How to determine if a number is positive or negative?

I was asked in an interview, how to determine whether a number is positive or negative. The rules are that we should not use relational operators such as <, and >, built in java functions (like ..

cell format round and display 2 decimal places

I have one cell formatted as Number and with 2 decimal places. The actual number is 69.30217 so in my cell, imagine cell A1, it appears like 69.30. This is OK. With that cell, I'm making some conca..

Twitter Bootstrap 3: How to center a block

It seems to me that the class center-block is missing from the bootstrap 3 style sheets. Am I missing something? Its usage is described here,

Compare two folders which has many files inside contents

Have two folders with approx. 150 java property files. In a shell script, how to compare both folders to see if there is any new property file in either of them and what are the differences between t..

Android EditText for password with android:hint

Just noticed that android:password has been deprecated, and we should be using android:inputType. Was experimenting with it by setting in my xml android:inputType="textPassword" Indeed it behaves..

Creating a procedure in mySql with parameters

I am trying to make a stored procedure using mySQL. This procedure will validate a username and a password. I'm currently running mySQL 5.0.32 so it should be possible to create procedures. Heres th..

How to rotate the background image in the container?

I want to rotate the image which is placed in the button of scrollbar in Chrome. Now I have a CSS with this content: ::-webkit-scrollbar-button:vertical:decrement { background-image:url(images/ar..

SmartGit Installation and Usage on Ubuntu

I have downloaded latest SmartGit installation and each time I want to use it I need to run script from SmartGit bin directory, this process requires the same repository setup every time. ..

removing html element styles via javascript

I'm trying to replace an element's inline style tag value. The current element looks like this: `<tr class="row-even" style="background: red none repeat scroll 0% 0%; position: relative; -moz-..

SQL Server 2008 Connection Error "No process is on the other end of the pipe"

Let me begin by saying, I am aware of this thread and others around the web that seek to trouble shoot this issue. The solutions posted there do not apply to my issue. I have spent 5 hours trying to..

fopen deprecated warning

On Visual Studio 2005 C++ compiler, I get the following warning when my code uses the fopen and such calls. 1>foo.cpp(5) : warning C4996: 'fopen' was declared deprecated 1> c:\program fi..

You don't have permission to access / on this server

I have CentOS 6.1 server and I installed apache 2.2.15 on it. Now When I try to access it from another pc (windows 7) from IE (http:/// (=centos ip)) I get the "You don't have permission to access / o..

How to filter array when object key value is in array

I have an array model as below: records:[{ "empid":1, "fname": "X", "lname": "Y" }, { "empid":2, "fname": &quo..

What does /p mean in set /p?

What does /p stand for in set /p=? I know that / enables a switch, and I'm fairly sure that I know /a is for arithmetic. I've heard numerous rumours, some saying /p is for prompt, others stating it st..

Passing multiple values to a single PowerShell script parameter

I have a script to which I pass server name(s) in $args. This way I can do stuff to this (these) server(s) using foreach: .\script.ps1 host1 host2 host3 foreach ($i in $args) { Do-Stuff $i } ..

start/play embedded (iframe) youtube-video on click of an image

I'm trying to start playing an embedded youtube video by clicking an image. The idea is to have an image on top of a video, and when the image is clicked it fades out and starts playing the video. I'..

How to get the Full file path from URI

I'd like to get the full file path, from a URI. The URI isn't a Image, but it's a music file, but if i do it like the MediaStore Solution, it won't work if the app user selects eg Astro as browser, in..

Ajax post request in laravel 5 return error 500 (Internal Server Error)

This is my test ajax in laravel 5 (refer below) $("#try").click(function(){ var url = $(this).attr("data-link"); $.ajax({ url: "test", type:"..

Can I write or modify data on an RFID tag?

maybe my question would be lost in the forum, but has somebody work with RFID tags? I know I can read them, but can I write or modify the inside data? Does anyone know where can I find more about this..

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

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

RegEx: How can I match all numbers greater than 49?

I'm somewhat new to regular expressions and am writing validation for a quantity field where regular expressions need to be used. How can I match all numbers greater than or equal to 50? I tried [..

How to get current language code with Swift?

I want get the language code of the device (en, es...) in my app written with Swift. How can get this? I'm trying this: var preferredLanguages : NSLocale! let pre = preferredLanguages.displayNameFor..

Convert UTC datetime string to local datetime

I've never had to convert time to and from UTC. Recently had a request to have my app be timezone aware, and I've been running myself in circles. Lots of information on converting local time to UTC, w..

Allowing Java to use an untrusted certificate for SSL/HTTPS connection

I've been working on a program to extract information from a dynamic web application, and the program worked fine until I set my tomcat server to use SSL using a self-signed(thus, untrusted) certifica..

How many bytes in a JavaScript string?

I have a javascript string which is about 500K when being sent from the server in UTF-8. How can I tell its size in JavaScript? I know that JavaScript uses UCS-2, so does that mean 2 bytes per charac..

What design patterns are used in Spring framework?

What design patterns are used in Spring framework?..

Access denied for root user in MySQL command-line

I've just installed xampp, and am using command line to write mySQL. I am using 'root' with no password and can connect to mysql but cannot CREATE DATABASE as I get the error 1044 access denied for us..

Bash script to run php script

I have a php script that I want to be run using a bash script, so I can use Cron to run the php script every minute or so. As far as I'm aware I need to create the bash script to handle the php scrip..

How to kill/stop a long SQL query immediately?

I am using SQL server 2008 and its management studio. I executed a query that yields many rows. I tried to cancel it via the red cancel button, but it has not stopped for the past 10 minutes. It usual..

Passing an array using an HTML form hidden element

I am trying to post an array in a hidden field and want to retrieve that array after submitting a form in PHP. $postvalue = array("a", "b", "c"); <input type="hidden" name="result" value="<?php..

what is the most efficient way of counting occurrences in pandas?

I have a large (about 12M rows) dataframe df with say: df.columns = ['word','documents','frequency'] So the following ran in a timely fashion: word_grouping = df[['word','frequency']].groupby('wor..

Replacing NULL and empty string within Select statement

I have a column that can have either NULL or empty space (i.e. '') values. I would like to replace both of those values with a valid value like 'UNKNOWN'. The various solutions I have found suggest ..

How do I reset a sequence in Oracle?

In PostgreSQL, I can do something like this: ALTER SEQUENCE serial RESTART WITH 0; Is there an Oracle equivalent?..

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

Python Selenium accessing HTML source

How can I get the HTML source in a variable using the Selenium module with Python? I wanted to do something like this: from selenium import webdriver browser = webdriver.Firefox() browser.get("http..

How to check whether java is installed on the computer

I am trying to install java windows application on client machine.I want to check whether requried JRE is installed on the machine or not. I want to check it by java program not by cmd command..

Combine two integer arrays

Is there a way to create a single array out of two? E.g. int[] array1 = {1,2,3}; int[] array2 = {4,5,6}; int[] array1and2 = array1 + array2; ..

PKIX path building failed: unable to find valid certification path to requested target

I am calling some HTTPS web service which the following Client: import; import; import; import; import ja..

Using Mockito to mock classes with generic parameters

Is there a clean method of mocking a class with generic parameters? Say I have to mock a class Foo<T> which I need to pass into a method that expects a Foo<Bar>. I can do the following e..

Showing which files have changed between two revisions

I want to merge two branches that have been separated for a while and wanted to know which files have been modified. Came across this link: which was quite useful. ..

How can I fix MySQL error #1064?

When issuing a command to MySQL, I'm getting error #1064 "syntax error". What does it mean? How can I fix it? ..

Why do I need to explicitly push a new branch?

I am new in git and I am practicing. I created a local branch but I saw that when I did git push my branch was not uploaded to the repository. I had to actually do: git push -u origin --all. Why is th..

py2exe - generate single executable file

I thought I heard that py2exe was able to do this, but I never figured it out. Has anyone successfully done this? Can I see your file, and what command line options you used? Basically I'm..

Mean of a column in a data frame, given the column's name

I'm inside a big function I have to write. In the last part I have to calculate the mean of a column in a data frame. The name of the column I am operating on is given as an argument to the function...

Iterate over a Javascript associative array in sorted order

Let's say I have a Javascript associative array (a.k.a. hash, a.k.a. dictionary): var a = new Array(); a['b'] = 1; a['z'] = 1; a['a'] = 1; How can I iterate over the keys in sorted order? If it hel..

My prerelease app has been "processing" for over a week in iTunes Connect, what gives?

I used Xcode 6.1.1 to upload a new version of a prerelease app to iTunes Connect so I could distribute it to my external beta testers. I've done this with two versions of the same app previously and i..

Loop through an array in JavaScript

In Java you can use a for loop to traverse objects in an array as follows: String[] myStringArray = {"Hello", "World"}; for (String s : myStringArray) { // Do something } Can you do the same in..

Tick symbol in HTML/XHTML

We need to display a tick symbol (✓ or ✔) within an internal web app and would ideally like to avoid using an image. Has to work starting with IE 6.0.2900 on a XP box, ideally we need i..

Converting Swagger specification JSON to HTML documentation

For some REST APIs written in PHP, I was asked to create Swagger documentation, and since I was not aware of any easy way of adding annotations to those existing APIs and create such a documentation, ..

How do I change tab size in Vim?

Every time I add a selector in CSS and I press Enter to define the properties it ends up like this: #selector { property: value; } (8-space tabs) How can I configure Vim to make it like ..

Java 8 lambda get and remove element from list

Given a list of elements, I want to get the element with a given property and remove it from the list. The best solution I found is: ProducerDTO p = producersProcedureActive .stream()..

X-Frame-Options: ALLOW-FROM in firefox and chrome

I'm implementing a "pass-through" for X-Frame-Options to let a partner site wrap my employer's site in an iframe, as per this article:

How to run Python script on terminal?

I want to run a Python script in Terminal, but I don't know how? I already have a saved file called in the directory "/User/luca/Documents/python"...

How to use a WSDL

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

ionic 2 - Error Could not find an installed version of Gradle either in Android Studio

I create ionic 2 project and add diagnostic cordova plugin like this : ionic plugin add cordova.plugins.diagnostic npm install --save @ionic-native/diagnostic and add android platform like this : ..

How to make a select with array contains value clause in psql

I have column arr which is of type array. I need to get rows, where arr column contains value s This query: SELECT * FROM table WHERE arr @> ARRAY['s'] gives the error: ERROR: operator do..

Text in Border CSS HTML

I'd like to have a div that looks like this: Is this possible to do with HTML + CSS? I will also be animating this div with jQuery. When the div is hidden I would like the title and the top line to..

Git submodule push

If I modify a submodule, can I push the commit back to the submodule origin, or would that require a clone? If clone, can I store a clone inside another repository?..

UITableView - scroll to the top

In my table view I have to scroll to the top. But I cannot guarantee that the first object is going to be section 0, row 0. May be that my table view will start from section number 5. So I get an exc..

C# looping through an array

I am looping through an array of strings, such as (1/12/1992 apple truck 12/10/10 orange bicycle). The array's length will always be divisible by 3. I need to loop through the array and grab the first..

Looping through JSON with node.js

I have a JSON file which I need to iterate over, as shown below... { "device_id": "8020", "data": [{ "Timestamp": "04-29-11 05:22:39 pm", "Start_Value": 0.02, "Abstra..

How do I make a new line in swift

Is there a way to have a way to make a new line in swift like "\n" for java? var example: String = "Hello World \n This is a new line" ..

Setting onSubmit in React.js

On submission of a form, I'm trying to doSomething() instead of the default post behaviour. Apparently in React, onSubmit is a supported event for forms. However, when I try the following code: var..

Remote debugging a Java application

I have a java application running on linux machine. I run the java application using the following: java myapp -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000, suspend=n I have opened ..

static constructors in C++? I need to initialize private static objects

I want to have a class with a private static data member (a vector that contains all the characters a-z). In java or C#, I can just make a "static constructor" that will run before I make any instance..

How do I set the proxy to be used by the JVM

Many times, a Java app needs to connect to the Internet. The most common example happens when it is reading an XML file and needs to download its schema. I am behind a proxy server. How can I set my ..

Why is Maven downloading the maven-metadata.xml every time?

Below is the error I usually get when my internet connection is flanky when trying to build a web application with maven. My question is that, why does maven always have to download every time when ..

XXHDPI and XXXHDPI dimensions in dp for images and icons in android

I have been able to get dimensions for the following : A set of six generalized densities: ldpi (low) ~120dpi mdpi (medium) ~160dpi hdpi (high) ~240dpi xhdpi (extra-high) ~320dpi xxhdpi (extra-extr..

Declaring and using MySQL varchar variables

I'm trying to do some simple manipulations with variables in MySQL 5.0 but I can't quite get it to work. I've seen many (very!) different syntaxen for DECLARE/SET, I'm not sure why... in any case I'm..

git checkout tag, git pull fails in branch

I have cloned a git repository and then checked out a tag: # git checkout 2.4.33 -b my_branch This is OK, but when I try to run git pull in my branch, git spits out this error: There is no tra..

Postgresql SQL: How check boolean field with null and True,False Value?

In my database table I am having one boolean column. which have some transaction with will False, True and Null. These are the cases i have tried: Case:1 select * from table_name where boolean_colu..

Hive load CSV with commas in quoted fields

I am trying to load a CSV file into a Hive table like so: CREATE TABLE mytable ( num1 INT, text1 STRING, num2 INT, text2 STRING ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ","; LOAD DATA LOCAL INPAT..

Where to find extensions installed folder for Google Chrome on Mac?

I can not find them under ~/Library/Application Support/Google/Chrome/; Where are they? Mac Pro 10.8.4 Chrome Version 26.0.1410.65 ..

How to import existing *.sql files in PostgreSQL 8.4?

I am using PostgreSQL 8.4, and I have some *.sql files to import into a database. How can I do so?..

Hash function for a string

We are currently dealing with hash function in my class. Our instructor asked us to a hash function on the internet to compare to the two we have used in our code. The first one: int HashTable::hash..

Xcode 4: create IPA file instead of .xcarchive

In Xcode 3.2.5 I use "Build And Archive" to create an IPA file. In Xcode 4 you can use "Product -> Archive" to archive an application in an .xcarchive bundle. How can I create an .ipa file with Xcode..

What is the difference between a .cpp file and a .h file?

Because I've made .cpp files then transfered them into .h files, the only difference I can find is that you can't #include .cpp files. Is there any difference that I am missing?..

How to determine if a point is in a 2D triangle?

Is there an easy way to determine if a point is inside a triangle? It's 2D, not 3D...

Java count occurrence of each item in an array

Is there any method for counting the occurrence of each item on an array? Lets say I have: String[] array = {"name1","name2","name3","name4", "name5"}; Here the output will be: name1 1 name2 1 na..

Redirect from an HTML page

Is it possible to set up a basic HTML page to redirect to another page on load?..

Get the filename of a fileupload in a document through JavaScript

var fu1 = document.getElementById("FileUpload1"); How can I get the filename of the fileupload control with id FileUpload1?..

What data type to use for hashed password field and what length?

I'm not sure how password hashing works (will be implementing it later), but need to create database schema now. I'm thinking of limiting passwords to 4-20 characters, but as I understand after encry..

What is sharding and why is it important?

I think I understand sharding to be putting back your sliced up data (the shards) into an easy to deal with aggregate that makes sense in the context. Is this correct? Update: I guess I am struggli..

Paused in debugger in chrome?

When debugging in chrome, the scripts are always paused in the debugger even if there are no break points set, and if the the pause is un-paused, it again pauses itself. What can be done? ..

Export to xls using angularjs

I am working on angular js app and I stuck in a situation in which I have to export data to Xls using angular js. I have searched a lot on the internet for export functionality or any library for angu..

Could not load the Tomcat server configuration

I have installed apache tomcat7 using sudo apt get in ubuntu. I have added apache tomcat 7 to eclipse using Windows > Preferences > Server > Runtime Environment.But when I'm starting the server from s..

How do I change the language of moment.js?

I am trying to change the language of the date which is being set by moment.js. The default one is English, but I want to set the German language. These is what I tried: var now = moment().format("LL..

Check if a String is in an ArrayList of Strings

How can I check if a String is there in the List? I want to assign 1 to temp if there is a result, 2 otherwise. My current code is: Integer temp = 0; List<String> bankAccNos = new ArrayList&l..

how to update spyder on anaconda

I have Anaconda installed (Python 2.7.11 |Anaconda custom (64-bit)| (default, Feb 16 2016, 09:58:36) [MSC v.1500 64 bit (AMD64)] on win32) and I am using Spyder 2.3.8 Would like to update Spyder to..

How to create image slideshow in html?

I wanna make image slideshow on my web, here's my code <head> <script type="text/javascript"> var image1 = new Image() image1.src = "images/pentagg.jpg" var image2 = new Image..


Normally whats the reason to get java.lang.ClassCastException ..? I get the following error in my application java.lang.ClassCastException: [Lcom.rsa.authagent.authapi.realmstat.AUTHw ..

How to efficiently check if variable is Array or Object (in NodeJS & V8)?

Is there any way to efficiently check if the variable is Object or Array, in NodeJS & V8? I'm writing a Model for MongoDB and NodeJS, and to traverse the object tree I need to know if the object..

What's the best way to determine which version of Oracle client I'm running?

The subject says it all: What is the best way to determine the exact version of the oracle client I'm running? Our clients are all running Windows. I found one suggestion to run the tnsping utility..

How correctly produce JSON by RESTful web service?

I am writing a web service the first time. I created a RESTful web service based on Jersey. And I want to produce JSON. What do I need to do to generate the correct JSON type of my web service? Here'..

PHP Configuration: It is not safe to rely on the system's timezone settings

Here a weird one. I just upgrade to php 5.3.0 and since the upgrade I'm getting the following warning: Warning: getdate() [function.getdate]: It is not safe to rely on the system's timezone s..

Split value from one field to two

I've got a table field membername which contains both the last name and the first name of users. Is it possible to split those into 2 fields memberfirst, memberlast? All the records have this format..

NotificationCompat.Builder deprecated in Android O

After upgrading my project to Android O buildToolsVersion "26.0.1" Lint in Android Studio is showing a deprecated warning for the follow notification builder method: new NotificationCompat.Builder..

How to load a UIView using a nib file created with Interface Builder

I'm trying to do something a bit elaborate, but something that should be possible. So here is a challenge for all you experts out there (this forum is a pack of a lot of you guys :) ). I'm creating a..

Laravel Query Builder where max id

How do I accomplish this in Laravel 4.1 Query Builder? select * from orders where id = (select max(`id`) from orders) I tried this, working but can't get the eloquent feature. DB::select(DB::raw(..

Parsing XML in Python using ElementTree example

I'm having a hard time finding a good, basic example of how to parse XML in python using Element Tree. From what I can find, this appears to be the easiest library to use for parsing XML. Here is a sa..

How to create a string with format?

I need to create a string with format which can convert int, long, double etc. types into string. Using Obj-C, I can do it via below way. NSString *str = [NSString stringWithFormat:@"%d , %f, %ld, %@..

Merging two images with PHP

I'm trying to merge two images together with PHP. For example... how would I go about placing image one on top of image two or merge, with basic PHP? I have tried something such as watermarking, but ..

How to split a dataframe string column into two columns?

I have a data frame with one (string) column and I'd like to split it into two (string) columns, with one column header as 'fips' and the other 'row' My dataframe df looks like this: row 0 ..

Math operations from string

Let's say I have a standard Python string (such as one obtained from raw_input()), maybe "2 + 2" for simplicity's sake. I'd like to convert this string to standard math operations in Python, such th..

Get last dirname/filename in a file path argument in Bash

I'm trying to write a post-commit hook for SVN, which is hosted on our development server. My goal is to try to automatically checkout a copy of the committed project to the directory where it is hos..

How can I align all elements to the left in JPanel?

I would like to have all elements in my JPanel to be aligned to the left. I try to do it in the following way: JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); pa..

Convert a string representation of a hex dump to a byte array using Java?

I am looking for a way to convert a long string (from a dump), that represents hex values into a byte array. I couldn't have phrased it better than the person that posted the same question here. But..

Undefined index with $_POST

I am trying to relearn some PHP basics for making a simple login script, however I get an error I have not received before(I made the same script a little over a year ago and never had this error. I s..

Add marker to Google Map on Click

I'm surprisingly struggling to find a very simple example of how to add a marker(s) to a Google Map when a user left clicks on the map. I have looked around for the past couple of hours, and consulte..

How do I consume the JSON POST data in an Express application

I'm sending the following JSON string to my server. ( { id = 1; name = foo; }, { id = 2; name = bar; } ) On the server I have this.

Convert a String to int?

Note: this question contains deprecated pre-1.0 code! The answer is correct, though. To convert a str to an int in Rust, I can do this: let my_int = from_str::<int>(my_str); The only way I k..

How to add two strings as if they were numbers?

I have two strings which contain only numbers: var num1 = '20', num2 = '30.5'; I would have expected that I could add them together, but they are being concatenated instead: num1 + num2; // = ..

How to delete a specific line in a file?

Let's say I have a text file full of nicknames. How can I delete a specific nickname from this file, using Python?..

How to draw a standard normal distribution in R

Possible Duplicate: Making a standard normal distribution in R Using R, draw a standard normal distribution. Label the mean and 3 standard deviations above and below the (10) mean. Inclu..

Java 8: Lambda-Streams, Filter by Method with Exception

I have a problem trying out the Lambda expressions of Java 8. Usually it works fine, but now I have methods that throw IOException's. It's best if you look at the following code: class Bank{ .....

How to find the last field using 'cut'

Without using sed or awk, only cut, how do I get the last field when the number of fields are unknown or change with every line?..

How to display list items as columns?

I'm trying to build my first responsive layout. I want to display list items in a vertical line, depending on width. <div style="height:800px;"> <ul> <li>1</li> ..

Read a text file using Node.js?

I need to pass in a text file in the terminal and then read the data from it, how can I do this? node server.js file.txt How do I pass in the path from the terminal, how do I read that on the other..

PHP sessions default timeout

Do PHP sessions timeout by default - ie without any coding on my part would a user eventually be "logged out" after some time of inactivity?..

Remove white space above and below large text in an inline-block element

Say I have a single span element defined as an inline-block. It's only contents is plain text. When the font size is very large, you can clearly see how the browser adds a little padding above and bel..

.htaccess redirect www to non-www with SSL/HTTPS

I've got several domains operating under a single .htaccess file, each having an SSL certificate. I need to force a https prefix on every domain while also ensuring www versions redirect to no-www on..

When should static_cast, dynamic_cast, const_cast and reinterpret_cast be used?

What are the proper uses of: static_cast dynamic_cast const_cast reinterpret_cast C-style cast (type)value Function-style cast type(value) How does one decide which to use in which specific cases?..

How to import component into another root component in Angular 2

I am trying to import component from one file another root component file. it give error as .. zone.js:484 Unhandled Promise rejection: Template parse errors: 'courses' is not a known element: ..

Convert UTC/GMT time to local time

We are developing a C# application for a web-service client. This will run on Windows XP PC's. One of the fields returned by the web service is a DateTime field. The server returns a field in GMT for..

Init array of structs in Go

I'm newbie in Go. This issue is driving me nuts. How do you init array of structs in Go? type opt struct { shortnm char longnm, help string needArg bool } const basename_opts []..

How to upgrade glibc from version 2.13 to 2.15 on Debian?

I heard I can do it using apt-get install libc6, but I need to add something to /etc/apt/sources.list to receive the newest glibc version. What should I do?..

Should functions return null or an empty object?

What is the best practice when returning data from functions. Is it better to return a Null or an empty object? And why should one do one over the other? Consider this: public UserEntity GetUserBy..