Questions Tagged with #Pipelined function

Automatic prune with Git fetch or pull

If someone deleted a remote branch because the work is over and I don't know, I won't do a git fetch --prune and eventually I will push back the deleted branch. Is there a viable solution for forcing..

How to create file object from URL object (image)

I need to create a File object from URL object My requirement is I need to create a file object of a web image (say googles logo) URL url = new URL(""); File f = c..

Oracle date format picture ends before converting entire input string

My table has two DATE format attributes, however, when i try to insert value it throws an error: date format picture ends before converting entire input string. Here is my attempted code: insert into..

Eclipse projects not showing up after placing project files in workspace/projects

I've searched for 2 days and can't find anything. I find things that are close, but not what I need. I got a new computer recently and copied all of my projects over to my new computer. I opened Ecl..

WPF User Control Parent

I have a user control that I load into a MainWindow at runtime. I cannot get a handle on the containing window from the UserControl. I have tried this.Parent, but it's always null. Does anyone know ..

Git Symlinks in Windows

Our developers use a mix of Windows and Unix based OS's. Therefore, symlinks created on Unix machines become a problem for Windows developers. In windows (msysgit), the symlink is converted to a text ..

An error occurred while executing the command definition. See the inner exception for details

In my mvc application, I am getting an error in edit function : in given code public ActionResult Edit(int id) { var res = (from r in objeEntities.DocumentationsSet.Include("DocStatus"..

Android Fragment onClick button Method

I'm trying to invoke the method in my onClick (View v) XML, but does not work with Fragment. This is the error. 01-17 12:38:36.840: E/AndroidRuntime(4171): java.lang.IllegalStateException: Could not..

Error Code 1292 - Truncated incorrect DOUBLE value - Mysql

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

Programmatically close aspx page from code behind

What is the best way to close an ASPX page from the code-behind? I have a button event handler that I want to close the page after the user has clicked an ASP.NET button on the page. I have tried ..

How to pass objects to functions in C++?

I am new to C++ programming, but I have experience in Java. I need guidance on how to pass objects to functions in C++. Do I need to pass pointers, references, or non-pointer and non-reference values..

Can I run HTML files directly from GitHub, instead of just viewing their source?

If I have a .html file in a GitHub repository, e.g. for running a a set of JavaScript tests, is there any way I can view that page directly—thus running the tests? For example, could I somehow actu..

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

what is the multicast doing on

On my debian server (squeeze) I get this message every few seconds: Sep 18 21:28:14 myhost kernel: [7903784.720091] AIF:UNPRIV connect attempt: IN=eth0 OUT= MAC= SRC=my_serverip_eth0 DST=224.0.0..

animating addClass/removeClass with jQuery

I am using jQuery and jQuery-ui and want to animate various attributes on various objects. For the sake of explaining the issue here I've simplified it to one div that changes from blue to red when ..

Find an element in a list of tuples

I have a list 'a' a= [(1,2),(1,4),(3,5),(5,7)] I need to find all the tuples for a particular number. say for 1 it will be result = [(1,2),(1,4)] How do I do that?..

Sorting an ArrayList of objects using a custom sorting order

I am looking to implement a sort feature for my address book application. I want to sort an ArrayList<Contact> contactArray. Contact is a class which contains four fields: name, home number, mo..

Trouble using ROW_NUMBER() OVER (PARTITION BY ...)

I'm using SQL Server 2008 R2. I have table called EmployeeHistory with the following structure and sample data: EmployeeID Date DepartmentID SupervisorID 10001 20130101 001 10009 ..

How can I get a specific parameter from

If I had a URL such as http://localhost/search.php?year=2008 How would I write a JavaScript function to grab the variable year and see if it contains anything? I know it can be done with location...

What is the right way to debug in iPython notebook?

As I know, %debug magic can do debug within one cell. However, I have function calls across multiple cells. For example, In[1]: def fun1(a) def fun2(b) # I want to set a b..

How to check if variable's type matches Type stored in a variable

User u = new User(); Type t = typeof(User); u is User -> returns true u is t -> compilation error How do I test if some variable is of some type in this way?..

How to get a view table query (code) in SQL Server 2008 Management Studio

I have a view in SQL Server 2008 and would like to view it in Management Studio. Example: --is the underlying query for the view Example_1 select * from table_aView View name: Example_1 How to ..

Shrinking navigation bar when scrolling down (bootstrap3)

I would like to build a navigation-bar effect like it is on on my page (after scrolling down the bar getting smaller and the logo changes). Im using bootstrap 3 for my page. Is the..

Excel Date to String conversion

In a cell in Excel sheet I have a Date value like: 01/01/2010 14:30:00 I want to convert that Date to Text and also want the Text to look exactly like Date. So a Date value of 01/01/2010 14:30:00 s..

Collision Detection between two images in Java

I have two characters displayed in a game I am writing, the player and the enemy. defined as such: public void player(Graphics g) { g.drawImage(plimg, x, y, this); } public void enemy(Graphics g..

EOFError: EOF when reading a line

I am trying to define a function to make the perimeter of a rectangle. Here is the code: width = input() height = input() def rectanglePerimeter(width, height): return ((width + height)*2) print(r..

How do I print out the value of this boolean? (Java)

I have tried a few different methods, like print(boolean isLeapYear) and a few others, but I can not figure out how to get it to work. It always says that I have a missing class (boolean is primitive,..

How to write Unicode characters to the console?

I was wondering if it was possible, in a console application, to write characters like ? using .NET. When I try to write this character, the console outputs a question mark...

Listen to port via a Java socket

A server software my client communicates with regularly sends transaction messages on port 4000. I need to print those messages to the console line by line. (Eventually I will have to write those valu..

Java System.out.print formatting

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

Calling a java method from c++ in Android

I'm trying to get a simple Java method call from C++ while Java calls native method. Here's the Java code: public class MainActivity extends Activity { private static String LIB_NAME = "name"; ..

Post values from a multiple select

How can I post values from a multiple select in a form? When I hit submit none of the selected values are posted. <form id="form" action="" method="post"> <div> <select id..

How to use regex in String.contains() method in Java

I want to check if a String contains the words "stores", "store", and "product" in that order, no matter what is in between them. I tried using someString.contains(stores%store%product); and also .co..

HashSet vs. List performance

It's clear that a search performance of the generic HashSet<T> class is higher than of the generic List<T> class. Just compare the hash-based key with the linear approach in the List<T&..

Filter Java Stream to 1 and only 1 element

I am trying to use Java 8 Streams to find elements in a LinkedList. I want to guarantee, however, that there is one and only one match to the filter criteria. Take this code: public static void main..

How to trigger SIGUSR1 and SIGUSR2?

I'm getting acquainted with signals in C. I can't figure out what kind of signals SIGUSR1 and SIGUSR2 are and how can I trigger them. Can anyone please explain it to me?..

Cancel a UIView animation?

Is it possible to cancel a UIView animation while it is in progress? Or would I have to drop to the CA level? i.e. I've done something like this (maybe setting an end animation action too): [UIView ..

How to stop PHP code execution?

Is there a way to immediately stop PHP code execution? I am aware of exit but it clearly states: Terminates execution of the script. Shutdown functions and object destructors will always be execu..

Bitbucket git credentials if signed up with Google

I have an account on that I created by signing up with my Google account. Now everytime I log in I just click "Log in with Google" and that's fine. How can I access my repos from git co..

All ASP.NET Web API controllers return 404

I'm trying to get an API Controller to work inside an ASP.NET MVC 4 web app. However, every request results in a 404 and I'm stumped. :/ I have the standard API controller route from the project temp..

How to download file in swift?

I just started learning apple swift programming for iOS coming from android. I basically can now read and manipulate swift code and also learned some common classes used in iOS swift programming but s..

Object cannot be cast from DBNull to other types

Object cannot be cast from DBNull to other types. I have a following function which throws the above error. I am handling all nulls in store procedure and in the C# code. So where is it getting this..

How can I get the nth character of a string?

I have a string, char* str = "HELLO" If I wanted to get just the E from that how would I do that?..

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive

I just installed vs 2010, followed by IIS in window 7. when building a website in .net framework 4.0 and convert this into application in IIS then its shows this error If i remove the targetFramew..

Installing SciPy and NumPy using pip

I'm trying to create required libraries in a package I'm distributing. It requires both the SciPy and NumPy libraries. While developing, I installed both using apt-get install scipy which installed..

Could not resolve all dependencies for configuration ':classpath'

I cant seem to get build tools for the latest gradle at all. I suspect its something to do with proxy setting for gradle. I have had a good look online but still cant seem to find a solution. I use gr..

How can I show an element that has display: none in a CSS rule?

I have a really simple external css stylesheet that has the following : div.hideBox { display:none; } So when the html page loads, the div with that class attribute 'hideBox' will not show on t..

linux: kill background task

How do I kill the last spawned background task in linux? Example: doSomething doAnotherThing doB & doC doD #kill doB ???? ..

How to install an npm package from GitHub directly?

Trying to install modules from github results in: ENOENT error on package.json. Easily reproduced using express: npm install throws error. npm install ..

How to style the menu items on an Android action bar

There's been many questions on styling on action bars, but the ones I've found either are relating to styling the tabs, or have answers that don't work for me. The question is really quite simple. I ..

Convert Pandas DataFrame to JSON format

I have a Pandas DataFrame with two columns – one with the filename and one with the hour in which it was generated: File Hour F1 1 F1 2 F2 1 F3 1 I..

UL list style not applying

I've got a stylesheet that will not, for whatever reason, apply list-style-type to a UL element. I'm using YUI's Grid CSS with their reset-fonts-grid.css file, which I know strips that out as part of ..

What is the size of ActionBar in pixels?

I need to know the exact size of ActionBar in pixels so to apply correct background image...

How to get line count of a large file cheaply in Python?

I need to get a line count of a large file (hundreds of thousands of lines) in python. What is the most efficient way both memory- and time-wise? At the moment I do: def file_len(fname): with op..

Java - How to create a custom dialog box?

I have a button on a JFrame that when clicked I want a dialog box to popup with multiple text areas for user input. I have been looking all around to try to figure out how to do this but I keep on ge..

How to remove line breaks (no characters!) from the string?

This might appear to be a dupe, but rest assured it isn't - I have searched both SO as well as the rest of the web for an answer to my problem and ended up finding the same insufficient "solutions" ov..

JavaScript .replace only replaces first Match

var textTitle = "this is a test" var result = textTitle.replace(' ', '%20'); But the replace functions stops at the first instance of the " " and I get the Result : "this%20is a test" Any ideas o..

Finding the position of bottom of a div with jquery

I have a div and want to find the bottom position. I can find the top position of the Div like this, but how do I find the bottom position? var top = $('#bottom').position().top; return top; ..

What does jQuery.fn mean?

What does the fn here mean? jQuery.fn.jquery ..

nano error: Error opening terminal: xterm-256color

After the installation of OSX Lion, I tried to: nano /etc/apt/sources.list But I get this error: Error opening terminal: xterm-256color If I try to switch preferences to open termin..

Printing 1 to 1000 without loop or conditionals

Task: Print numbers from 1 to 1000 without using any loop or conditional statements. Don't just write the printf() or cout statement 1000 times. How would you do that using C or C++?..

NUnit vs. MbUnit vs. MSTest vs.

There are quite a lot of unittesting frameworks out there for .NET. I found this little feature comparison: Now I am to choose the best one for us. But how..

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

Find IP address of directly connected device

Is there a way to find out the IP address of a device that is directly connected to a specific ethernet interface? I.e. given one host, one wired ethernet connection and one second host connected to t..

Java 8 stream's .min() and .max(): why does this compile?

Note: this question originates from a dead link which was a previous SO question, but here goes... See this code (note: I do know that this code won't "work" and that Integer::compare should be used ..

Delete all but the most recent X files in bash

Is there a simple way, in a pretty standard UNIX environment with bash, to run a command to delete all but the most recent X files from a directory? To give a bit more of a concrete example, imagine ..

Auto refresh page every 30 seconds

I have a JSP page which has to display the status of various jobs that are running. Some of these jobs take time, so it takes a while for their status to change from processing to complete. Is it a g..

How do I find out my MySQL URL, host, port and username?

I need to find my MySQL username. When I open the MySQL command line client, it only asks me for my password. I don't remember my username. And for connectivity with JDBC, I need the URL, host and por..

Using a PagedList with a ViewModel ASP.Net MVC

I'm trying to using a PagedList in my ASP.Net application and I found this example on the Microsoft website

how to parse JSONArray in android

I want to read this JSON lines but because it start with JSONArray i'm a little confused "abridged_cast": [ { "name": "Jeff Bridges", "id": "162655890",..

Counting lines, words, and characters within a text file using Python

I'm having a bit of a rough time laying out how I would count certain elements within a text file using Python. I'm a few months into Python and I'm familiar with the following functions; raw_input..

Powershell folder size of folders without listing Subdirectories

I have found several resources that use the following script to get folder sizes $colItems = (Get-ChildItem $startFolder -recurse | Where-Object {$_.PSIsContainer -eq $True} | Sort-Object) foreach ($..

What are the applications of binary trees?

I am wondering what the particular applications of binary trees are. Could you give some real examples?..

Check if a Postgres JSON array contains a string

I have a table to store information about my rabbits. It looks like this: create table rabbits (rabbit_id bigserial primary key, info json not null); insert into rabbits (info) values ('{"name":"He..

How to display .svg image using swift

I have a .svg image file I want to display in my project. I tried using UIImageView, which works for the .png & .jpg image formats, but not for the .svg extension. Is there any way to display a ..

Start/Stop and Restart Jenkins service on Windows

I have downloaded "" from . I have extracted zip file and installed Jenkins on Windows 7 successfully. Jenkins ..

Unknown SSL protocol error in connection

I want to push my commits to a Bitbucket repository but this error occurred: Fatal: unable to access 'https://[email protected]/myUsername/myRepository.git/': Unknown SSL protocol error in con..

'Property does not exist on type 'never'

This is similar to #40796374 but that is around types, while I am using interfaces. Given the code below: _x000D_ _x000D_ interface Foo {_x000D_ name: string;_x000D_ }_x000D_ _x000D_ function go()..

Does tkinter have a table widget?

I'm learning Python, and I would like to use it to create a simple GUI application, and since Tkinter is already built-in (and very simple to use) I would like to use it to build my application. I wo..

How to get base URL in Web API controller?

I know that I can use Url.Link() to get URL of a specific route, but how can I get Web API base URL in Web API controller?..

Sum rows in data.frame or matrix

I have a very large dataframe with rows as observations and columns as genetic markers. I would like to create a new column that contains the sum of a select number of columns for each observation usi..

How to find column names for all tables in all databases in SQL Server

I want to find all column names in all tables in all databases. Is there a query that can do that for me? The database is Microsoft SQL Server 2000...

This app won't run unless you update Google Play Services (via Bazaar)

I'm testing out the new Google Maps API V2 for Android, and I'm getting this message when the app launches: This is running on an 4.1 emulator. Here is my AndroidManifest.xml file: <manifest x..

Build fails with "Command failed with a nonzero exit code"

When I try to build my app with Xcode, an error interrupts the build process: Command CompileStoryboard failed with a nonzero exit code Sometimes, it shows this error instead: Command Compil..

What is difference between Implicit wait and Explicit wait in Selenium WebDriver?

There are Implicit and Explicit wait in Selenium WebDriver. What's the difference between them? Kindly share the knowledge about Selenium WebDriver. Please show the real time example with Implicit &a..

Python os.path.join() on a list

I can do >>> os.path.join("c:/","home","foo","bar","some.txt") 'c:/home\\foo\\bar\\some.txt' But, when I do >>> s = "c:/,home,foo,bar,some.txt".split(",") >>>

Cannot open backup device. Operating System error 5

Below is the query that I am using to backup (create a .bak) my database. However, whenever I run it, I always get this error message: Msg 3201, Level 16, State 1, Line 1 Cannot open backup de..

Warning: Use the 'defaultValue' or 'value' props on <select> instead of setting 'selected' on <option>

SCENARIO A user has a dropdown and he selects an option. I want to display that dropdown and make that option a default value which was selected by that user last time. I am using selected attribute ..

SameSite warning Chrome 77

Since the last update, I'm having an error with cookies, related with SameSite attribute. The cookies are from third party developers (Fontawesome, jQuery, Google Analytics, Google reCaptcha, Google ..

Integrating the ZXing library directly into my Android application

I'm writing this in mere desperation :) I've been assigned to make a standalone barcode scanner (as a proof of concept) to an Android 1.6 phone. For this i've discovered the ZXing library. I've goog..

How can I find the current OS in Python?

Possible Duplicate: Python: What OS am I running on? As the title says, how can I find the current operating system in python?..

How to get parameters from a URL string?

I have a HTML form field $_POST["url"] having some URL strings as the value. Example values are:[email protected]

What is an HttpHandler in ASP.NET

What is an HttpHandler in ASP.NET? Why and how is it used?..

What's the use of "enum" in Java?

So I looked into this "enum" type, and it kind of seems like a glorified array/ArrayList/List to me. What exactly is the use of it? ..

How to get the directory of the currently running file?

In nodejs I use __dirname . What is the equivalent of this in Golang? I have googled and found out this article . Where he use..

Get the IP address of the machine

This Question is almost the same as the previously asked Get the IP Address of local computer-Question. However I need to find the IP address(es) of a Linux Machine. So: How do I - programmatically i..

Connect to Active Directory via LDAP

I want to connect to our local Active Directory with C#. I've found this good documentation. But I really don't get how to connect via LDAP. Can somebody of you explain how to use the asked paramet..

What is the difference between a hash join and a merge join (Oracle RDBMS )?

What are the performance gains/losses between hash joins and merge joins, specifically in Oracle RDBMS?..

Understanding checked vs unchecked exceptions in Java

Joshua Bloch in "Effective Java" said that Use checked exceptions for recoverable conditions and runtime exceptions for programming errors (Item 58 in 2nd edition) Let's see if I understa..

Command-line Unix ASCII-based charting / plotting tool

Is there a good command-line UNIX charting / graphing / plotting tool out there? I'm looking for something that will plot xy points on an ASCII graph. Just to clarify, I'm looking for something that..

Set up Python 3 build system with Sublime Text 3

I want to configure Sublime Text 3 to build Python 3, but I don't seem to understand how the builds work. Many tutorials have told me to make a build file containing code such as: { 'cmd': ['/usr..

Why use armeabi-v7a code over armeabi code?

In my current project I make use of multiple .so files. These are located at the armeabi and armeabi-v7a folder. Unfortunately one of the .so files is a 6MB and I need to reduce file size. Instead of ..

`require': no such file to load -- mkmf (LoadError)

I was trying to install rails on Ubuntu Natty Narwhal 11.04, using ruby1.9.1. I installed ruby using apt-get install ruby1.9.1-full which contains the dev package. I googled the error and all have su..

nginx: how to create an alias url route?

basically an server instance is running at I want to point to /production/folder/here so when user types

Send HTTP POST message in ASP.NET Core using HttpClient PostAsJsonAsync

I want to send dynamic object like new { x = 1, y = 2 }; as body of HTTP POST message. So I try to write var client = new HttpClient(); but I can't find method client.PostAsJsonAsync() So I ..

Can JavaScript connect with MySQL?

Can JavaScript connect with MySQL? If so, how?..

Execute combine multiple Linux commands in one line

I am trying to merge multiple linux commands in one line to perform deployment operation. For example cd /my_folder rm *.jar svn co path to repo mvn compile package install ..

What is the Swift equivalent to Objective-C's "@synchronized"?

I've searched the Swift book, but can't find the Swift version of @synchronized. How do I do mutual exclusion in Swift?..

What does ':' (colon) do in JavaScript?

I'm learning JavaScript and while browsing through the jQuery library I see : (colon) being used a lot. What is this used for in JavaScript? // Return an array of filtered elements (r) // and the mo..

How can I set the form action through JavaScript?

I have an HTML form whose action should be set dynamically through JavaScript. How do I do it? Here is what I am trying to achieve: <script type="text/javascript"> function get_act..

What is the @Html.DisplayFor syntax for?

I understand that in Razor, @Html does a bunch of neat things, like generate HTML for links, inputs, etc. But I don't get the DisplayFor function... Why would I write: @Html.DisplayFor(model => ..

Better way to sum a property value in an array

I have something like this: $scope.traveler = [ { description: 'Senior', Amount: 50}, { description: 'Senior', Amount: 50}, { description: 'Adult', Amount: 75}, ..

How to join two tables by multiple columns in SQL?

I have two tables named Evaluation and Value. In both tables, there are four columns. But three of the four are the same. In other words, they both have the CaseNum, FileNum, ActivityNum columns. In a..

Javascript Iframe innerHTML

Does anyone know how to get the HTML out of an IFRAME I have tried several different ways: document.getElementById('iframe01').contentDocument.body.innerHTML document.frames['iframe01'].document.body..

iOS for VirtualBox

Is there anyway to install Apple iOS in VirtualBox? i have installed Android on VirtualBox with live Android and i have installed Snow leopard on VirtualBox but i don't know whether i could do the sam..

How can I use a search engine to search for special characters?

Google strips most special characters from the text they index so it's not a good tool for many troubleshooting-related tasks, such as finding out what the variable "$-" is in perl, or searching for e..

Scanner method to get a char

What is the Scanner method to get a char returned by the keyboard in Java. like nextLine() for String, nextInt() for int, etc...

Bold words in a string of strings.xml in Android

I have a long text in one of the strings at strings.xml. I want to make bold and change the color of some words in that text. How can I do it?..

Simplest SOAP example

What is the simplest SOAP example using Javascript? To be as useful as possible, the answer should: Be functional (in other words actually work) Send at least one parameter that can be set elsewher..

How to declare a global variable in React?

I initialized i18n translation object once in a component (a first component that loads in the app ). That same object is required In all other components. I don't want to re-initialize it in every co..

Best way to return a value from a python script

I wrote a script in python that takes a few files, runs a few tests and counts the number of total_bugs while writing new files with information for each (bugs+more). To take a couple files from curr..

How can I make a CSS glass/blur effect work for an overlay?

I am having trouble applying a blur effect on a semi-transparent overlay div. I'd like everything behind the div the be blurred, like this: Here is a jsfiddle which doesn't work:

Search and replace a particular string in a file using Perl

Possible Duplicate: How to replace a string in an existing file in Perl? I need to create a subroutine that does a search and replace in file. Here's the contents of myfiletemplate.txt: ..

Unique device identification

We are developing in-house web-based application for viewing data reports while targeting on smartphones and tablets. Our customer asked us for possibility that only certain devices could access the c..

Laravel Advanced Wheres how to pass variable into function?

Example in doc: DB::table('users') ->whereExists(function($query) { $query->select(DB::raw(1)) ->from('orders') ->whereRaw(..

Why an interface can not implement another interface?

What I mean is: interface B {...} interface A extends B {...} // allowed interface A implements B {...} // not allowed I googled it and I found this: implements denotes defining an implemen..

What does "dereferencing" a pointer mean?

Please include an example with the explanation...

display: flex not working on Internet Explorer

My flex container: .back_pattern { display: flex; display: -ms-flexbox; -ms-flex-pack: center; flex-direction: column; align-content: center; justify-content: center; min-..

How to print variables without spaces between values

I would like to know how to remove additional spaces when I print something. Like when I do: print 'Value is "', value, '"' The output will be: Value is " 42 " But I want: Value is "42" Is t..

How to mount host volumes into docker containers in Dockerfile during build

Original question: How to use the VOLUME instruction in Dockerfile? The actual question I want to solve is -- how to mount host volumes into docker containers in Dockerfile during build, i.e., having ..

Loading and parsing a JSON file with multiple JSON objects

I am trying to load and parse a JSON file in Python. But I'm stuck trying to load the file: import json json_data = open('file') data = json.load(json_data) Yields: ValueError: Extra data: line 2 ..

Line continue character in C#

We have a unit test with variable that contains a very long string. Question is how to write this in code, without having problems with line breaks or that the code is difficult to read. In VB there..

Is there a method that calculates a factorial in Java?

I didn't find it, yet. Did I miss something? I know a factorial method is a common example program for beginners. But wouldn't it be useful to have a standard implementation for this one to reuse? I ..

How can I create directory tree in C++/Linux?

I want an easy way to create multiple directories in C++/Linux. For example I want to save a file lola.file in the directory: /tmp/a/b/c but if the directories are not there I want them to be cr..

What does double question mark (??) operator mean in PHP

I was diving into Symfony framework (version 4) code and found this piece of code: $env = $_SERVER['APP_ENV'] ?? 'dev'; I'm not sure what this actually does but I imagine that it expands to something..

Naming threads and thread-pools of ExecutorService

Let's say I have an application that utilizes the Executor framework as such Executors.newSingleThreadExecutor().submit(new Runnable(){ @Override public void run(){ // do stuff } ..

Java: using switch statement with enum under subclass

First I'll state that I'm much more familiar with enums in C# and it seems like enums in java is a quite mess. As you can see, I'm trying to use a switch statement @ enums in my next example but I al..

How to SUM two fields within an SQL query

I need to get the total of two fields which are within the same row and input that number in a field at the end of that same row. This is my code. Sum(tbl1.fld1 + tbl1.fld2) AS [Total] Is this wh..

Algorithm to randomly generate an aesthetically-pleasing color palette

I'm looking for a simple algorithm to generate a large number of random, aesthetically pleasing colors. So no crazy neon colors, colors reminiscent of feces, etc. I've found solutions to this proble..

How to check if an element is in an array

In Swift, how can I check if an element exists in an array? Xcode does not have any suggestions for contain, include, or has, and a quick search through the book turned up nothing. Any idea how to che..

Retrofit 2 - URL Query Parameter

I am using a query parameters to set the values needed by the Google Maps API. The issue is I do not need the & sign for the first query parameter. @GET("/maps/api/geocode/json?") Call<Js..

Restore DB — Error RESTORE HEADERONLY is terminating abnormally.

I have taken backup of SQL Server 2008 DB on server, and download them to local environment. I am trying to restore that database and it is keep on giving me following error. An exception o..

Could not determine the dependencies of task ':app:crashlyticsStoreDeobsDebug' if I enable the proguard

I get following error when I was running an app within Android Studio 2. Gradle tasks [:app:assembleDebug] Could not determine the dependencies of task ':app:crashlyticsStoreDeobsDebug'. > Task wi..

Why is width: 100% not working on div {display: table-cell}?

I'm trying to vertically and horizontally center some content overlaying an image slide (flexslider). There were some similar questions to this one, but I couldn't find a satisfactory solution that a..

How to exclude property from Json Serialization

I have a DTO class which I Serialize Json.Serialize(MyClass) How can I exclude a public property of it? (It has to be public, as I use it in my code somewhere else)..

How do I convert an existing callback API to promises?

I want to work with promises but I have a callback API in a format like: 1. DOM load or other one time event: window.onload; // set to callback ... window.onload = function() { }; 2. Plain callba..

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

How to add plus one (+1) to a SQL Server column in a SQL Query

The simple question is, how do you increment a field value in a MS Query by 1 ? I am trying to add 1 (+1) to an int column in my SQL Server database using a parametrized method. Similar to an i++ oper..

Could not find a part of the path ... bin\roslyn\csc.exe

I am trying to run MVC project retrieved from TFS source control. I have added all assembly references and I am able to build and compile successfully without any error or warning. But I get..

How to get the mouse position without events (without moving the mouse)?

Is it possible to get the mouse position with JavaScript after page loads without any mouse movement event (without moving the mouse)?..

download csv file from web api in angular js

my API controller is returning a csv file as seen below: [HttpPost] public HttpResponseMessage GenerateCSV(FieldParameters fieldParams) { var output = new byte[] { }; if (..

How to return images in flask response?

As an example, this URL: should return a response with a image/gif MIME type. I have two static .gif images, and if type is 1, it should return ok.gif, else retu..

How to get the currently logged in user's user id in Django?

How to get the currently logged-in user's id? in class Game(models.model): name = models.CharField(max_length=255) owner = models.ForeignKey(User, related_name='game_user', verbos..

Run a mySQL query as a cron job?

I would like to purge my SQL database from all entires older than 1 week, and I'd like to do it nightly. So, I'm going to set up a cron job. How do I query mySQL without having to enter my password ma..

How to load external scripts dynamically in Angular?

I have this module which componentize the external library together with additional logic without adding the <script> tag directly into the index.html: import ''..

rake assets:precompile RAILS_ENV=production not working as required

I am trying to precompile assets using the command rake assets:precompile RAILS_ENV=production, but I always get the error below. ** Invoke assets:precompile (first_time) ** Execute assets:precom..

Is there a limit on an Excel worksheet's name length?

When I try to set a longish worksheet name using ruby and win32ole with the following code: require "win32ole" excel ='Excel.Application') excel.Visible = 1 puts excel.version workbook ..

href="javascript:" vs. href="javascript:void(0)"

Our web app is rendered totally on the browser.The server only talks to the browser through JSON messaging. As a result, we only need a single page for the app and mostly all the <a> tags do no..

Converting serial port data to TCP/IP in a Linux environment

I need to get data from the serial port of a Linux system and convert it to TCP/IP to send to a server. Is this difficult to do? I have some basic programming experience, but not much experience with ..

How to make HTML code inactive with comments

I have some HTML code on a page that I don't want to erase, but make inactive for the short term. How can I make the browser ignore parts of the page in the same way the // works in some programming l..

How do I exit from a function?

i know that in you can just do Exit Sub but i would like to know how do i exit a click event in a button? here's my code: private void button1_Click(object sender, EventArgs e) { if (tex..

Python - Extracting and Saving Video Frames

So I've followed this tutorial but it doesn't seem to do anything. Simply nothing. It waits a few seconds and closes the program. What is wrong with this code? import cv2 vidcap = cv2.VideoCapture('..

How to install a Python module via its in Windows?

I downloaded dateutil which comes with a file but it throws an error when I try to open it. What's the proper way to install this module? This is the error: error: no commands supplied ..

How do I create an iCal-type .ics file that can be downloaded by other users?

I want to create an iCal Calendar that can be downloaded from my website to the users Calendar program or imported to Google Calendar. What I want to know is if I do a direct Export from iCal on Mac O..

How to switch to the new browser window, which opens after click on the button?

I have situation, when click on button opens the new browser window with search results. Is there any way to connect and focus to new opened browser window? And work with it, then return back to or..

How to access array elements in a Django template?

I am getting an array arr passed to my Django template. I want to access individual elements of the array in the array (e.g. arr[0], arr[1]) etc. instead of looping through the whole array. Is there ..

Python : How to parse the Body from a raw email , given that raw email does not have a "Body" tag or anything

It seems easy to get the From To Subject etc via import email b = email.message_from_string(a) bbb = b['from'] ccc = b['to'] assuming that "a" is the raw-email string which looks something like..

How do I run PHP code when a user clicks on a link?

I want to have a page run some PHP code when a user clicks on a link, without redirecting them. Is this possible with <a href=""></a> or with the javascript onclick event?..

Find the paths between two given nodes?

Say I have nodes connected in the below fashion, how do I arrive at the number of paths that exist between given points, and path details? 1,2 //node 1 and 2 are connected 2,3 2,5 4,2 5,11 11,12 6,7 ..

How to hide the soft keyboard from inside a fragment?

I have a FragmentActivity using a ViewPager to serve several fragments. Each is a ListFragment with the following layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:andro..

Generating matplotlib graphs without a running X server

Matplotlib seems to require the $DISPLAY environment variable which means a running X server.Some web hosting services do not allow a running X server session.Is there a way to generate graphs using m..

python: NameError:global name '...‘ is not defined

in my code, I have: class A: def a(): ...... def b(): a() ...... b() Then the compiler will say "NameError: global name a() is not defined." If I pull all the s..

Set position / size of UI element as percentage of screen size

I'm trying to work out if it's possible to use percentage positions/sizes when creating a layout. What I want is something like this... ^ | | | 68% | | v Gallery (height equivalent of 16% total scree..

Use Invoke-WebRequest with a username and password for basic authentication on the GitHub API

With cURL, we can pass a username with an HTTP web request as follows: $ curl -u <your_username> The -u flag accepts a username for authentication, and then cURL ..

using setTimeout on promise chain

Here i am trying to wrap my head around promises.Here on first request i fetch a set of links.and on next request i fetch the content of first link.But i want to make a delay before returning next pro..

Merge unequal dataframes and replace missing rows with 0

I have two data.frames, one with only characters and the other one with characters and values. df1 = data.frame(x=c('a', 'b', 'c', 'd', 'e')) df2 = data.frame(x=c('a', 'b', 'c'),y = c(0,1,0)) merge(d..

How can I get the current date and time in UTC or GMT in Java?

When I create a new Date object, it is initialized to the current time but in the local timezone. How can I get the current date and time in GMT?..

TypeError: expected a character buffer object - while trying to save integer to textfile

I'm trying to make a very simple 'counter' that is supposed to keep track of how many times my program has been executed. First, I have a textfile that only includes one character: 0 Then I open the..

Fastest way to implode an associative array with keys

I'm looking for a fast way to turn an associative array in to a string. Typical structure would be like a URL query string but with customizable separators so I can use '&amp;' for xhtml links or ..

How to set the image from drawable dynamically in android?

I am storing my project related images in drawable folder. Also I am storing the image names in string variable and dynamically I am trying to set those images to the imageview. But the image is not d..

3 column layout HTML/CSS

I have the following HTML layout: <div class="container"> <div class="column-center">Column center</div> <div class="column-left">Column left</div> <div clas..

Encrypt & Decrypt using PyCrypto AES 256

I'm trying to build two functions using PyCrypto that accept two parameters: the message and the key, and then encrypt/decrypt the message. I found several links on the web to help me out, but each o..

How can I get the index from a JSON object with value?

This is my JSON string. [{ "name": "placeHolder", "section": "right" }, { "name": "Overview", "section": "lef..

How to get selenium to wait for ajax response?

How can I get selenium to wait for something like a calendar widget to load? Right now I am just doing a Thread.sleep(2500) after exporting the testcase to a junit program...

Bloomberg Open API

Bloomberg Open API announced recently - is it just the Bloomberg SDK which had been (limitedly) exposed to public for quite a while? My understanding is that Bloomberg SDK is possible to use only on ..

What is the difference between Collection and List in Java?

What is the difference between Collection and List in Java? When should I use which?..

org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing

In my project I have User, Role, UserRole and BloodGroup entities. Firstly I take List<BloodGroup> from DB and set to User. Then I give User and Role entites to UserRole. After that I insert Use..

Init function in javascript and how it works

I often see the following code: (function () { // init part })(); but I never could get my head around how it works. I find the last brackets especially confusing. Could someone explain how it wo..

Explicitly assigning values to a 2D Array?

I've never done this before and can't find the answer. This may not be the correct data type to use for this, but I just want to assign an int, then another int without a for loop into a 2D array, the..

Sample settings.xml

How to configure settings.xml in Maven? Also, please share a sample settings.xml!..

How to add some non-standard font to a website?

Is there a way to add some custom font on a website without using images, Flash or some other graphics? For example, I was working on a wedding website, and I found a lot of nice fonts for that subje..

mongo - couldn't connect to server

I am coming from riak and redis where I never had an issue with this services starting, or to interact. This is a pervasive problem with mongo and am rather clueless. Restarting does not help.I am n..

favicon.png vs favicon.ico - why should I use PNG instead of ICO?

Other than the fact that PNG is a more common image format, is there any technical reason to favor favicon.png vs. favicon.ico? I'm supporting modern browsers which all support PNG favorite icons...

Passing ArrayList through Intent

I am trying to pass an arrayList to another activity using intents. Here is the code in the first activity. case Toast.makeText(this, "edit was clicked", Toast.LENGTH_LONG).s..

React Native fixed footer

I try to create react native app that looks like existing web app. I have a fixed footer at bottom of window. Do anyone have idea how this can be achieved with react native? in existing app it's simp..

Append data frames together in a for loop

I have a for loop which produces a data frame after each iteration. I want to append all data frames together but finding it difficult. Following is what I am trying, please suggest how to fix it: d..

Enter key press behaves like a Tab in Javascript

I'm looking to create a form where pressing the enter key causes focus to go to the "next" form element on the page. The solution I keep finding on the web is... <body onkeydown="if(event.keyCode..

How to find if a file contains a given string using Windows command line

I am trying to create a batch (.bat) file for windows XP to do the following: If (file.txt contains the string 'searchString') then (ECHO found it!) ELSE(ECHO not found) So far, I have found a way..

What is the meaning of the word logits in TensorFlow?

In the following TensorFlow function, we must feed the activation of artificial neurons in the final layer. That I understand. But I don't understand why it is called logits? Isn't that a mathematical..

Maven - Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean

I've a problem with the following dependency in my pom.xml where org.springframework.version = 3.1.0.RELEASE: <!-- Spring MVC framework --> <dependency> <groupId>org.springframe..