Questions Tagged with #Observable

Wait for Angular 2 to load/resolve model before rendering view/template

In Angular 1.x, UI-Router was my primary tool for this. By returning a promise for "resolve" values, the router would simply wait for the promise to complete before rendering directives. Alternately,..

Using an array from Observable Object with ngFor and Async Pipe Angular 2

I am trying to understand how to use Observables in Angular 2. I have this service: import {Injectable, EventEmitter, ViewChild} from '@angular/core'; import {Observable} from "rxjs/Observable&q..

Delegation: EventEmitter or Observable in Angular

I am trying to implement something like a delegation pattern in Angular. When the user clicks on a nav-item, I would like to call a function which then emits an event which should in turn be handled ..

Angular/RxJs When should I unsubscribe from `Subscription`

When should I store the Subscription instances and invoke unsubscribe() during the NgOnDestroy life cycle and when can I simply ignore them? Saving all subscriptions introduces a lot of mess into comp..

How to catch exception correctly from http.request()?

Part of my code: import {Injectable} from 'angular2/core'; import {Http, Headers, Request, Response} from 'angular2/http'; import {Observable} from 'rxjs/Observable'; import 'rxjs/add/operator/map';..

Angular 4: InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe'

i need your help, i'm trying to display some datas from my firebase but it trhows me an error like InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe'. There is my service: import { Injec..

How to create an Observable from static data similar to http one in Angular?

I am having a service that has this method: export class TestModelService { public testModel: TestModel; constructor( @Inject(Http) public http: Http) { } public fetchModel(uuid: s..

How to make one Observable sequence wait for another to complete before emitting?

Say I have an Observable, like so: var one = someObservable.take(1); one.subscribe(function(){ /* do something */ }); Then, I have a second Observable: var two = someOtherObservable.take(1); No..

TypeError: You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

I am trying to map from a service call but getting an error. Looked at subscribe is not defined in angular 2? and it said that in order to subscribe we need to return from inside the operators. I have..

Http post and get request in angular 6

In angular 5.2.x for http get and post I had this code: post(url: string, model: any): Observable<boolean> { return this.http.post(url, model) .map(response => response) .do(data => ..

How to get data from observable in angular2

I am trying to print the result of http call in Angular using rxjs Consider the following code import { Component, Injectable, OnInit } from '@angular/core'; import { Http, HTTP_PROVIDERS } from '@a..

Return an empty Observable

The function more() is supposed to return an Observable from a get request export class Collection{ public more = (): Observable<Response> => { if (this.hasMore()) { re..

Creating and returning Observable from Angular 2 Service

This is more of a "best practices" question. There are three players: a Component, a Service and a Model. The Component is calling the Service to get data from a database. The Service is using: this...

How can I create an observable with a delay

Question For testing purposes, I'm creating Observable objects that replace the observable that would be returned by an actual http call with Http. My observable is created with the following code: ..

When should we use Observer and Observable?

An interviewer asked me: What is Observer and Observable and when should we use them? I wasn't aware of these terms, so when I got back home and started Googling about Observer and Observable, I fou..

Div table-cell vertical align not working

I am trying to simply center text horizontally and vertically using DIV and display type as table-cell but it is not working in either IE8 or Firefox. Below is the CSS that I am using and that is all..

When to use StringBuilder in Java

It is supposed to be generally preferable to use a StringBuilder for string concatenation in Java. Is this always the case? What I mean is this: Is the overhead of creating a StringBuilder object, ca..

Android Service needs to run always (Never pause or stop)

I created a service and want to run this service always until my phone restarts or force closed. The service should run in background. Sample code of created service and start services: Start the s..

How to log SQL statements in Spring Boot?

I want to log SQL statements in a file. I have the following properties in application.properties spring.datasource.url=... spring.datasource.username=user spring.datasource.password=1234 spring.data..

password for postgres

In the short version of postgres' installing it tell me to do the following ./configure gmake su gmake install adduser postgres mkdir /usr/local/pgsql/data chown postgres /usr/local/pgsql/data su - p..

MySQL user DB does not have password columns - Installing MySQL on OSX

I am trying to change MySql root password. What I have done is below. Install MySql-5.7.6 ~ .dmg(Community Server) and workbench. Turn off the server on OSX System preferences. Access MySql with co..

Set focus on TextBox in WPF from view model

I have a TextBox and a Button in my view. Now I am checking a condition upon button click and if the condition turns out to be false, displaying the message to the user, and then I have to set the cu..

How to get a variable type in Typescript?

I have a variable. abc:number|string; How can I check its type? I want to do something like below: if (abc.type === "number") { // do something } ..

Node.js Web Application examples/tutorials

So I finished watching Douglas Crockford's excellent series on Javascript, and in the final episode (so far), loopage he lays out why Node.js is a near perfect solution for server side code. He tal..

iOS: present view controller programmatically

I'm using the presentViewController:animated:completion: method to go to another view controller. This is my code: AddTaskViewController *add = [[AddTaskViewController alloc] init]; [self presentVie..

Twitter Bootstrap 3, vertically center content

I know this has been asked a thousand time but I can't find a way to make the text and image to be centered vertically. I'm using Twitter Bootstrap 3 with dynamic content so therefor, I do not know t..

How do I get ruby to print a full backtrace instead of a truncated one?

When I get exceptions, it is often from deep within the call stack. When this happens, more often than not, the actual offending line of code is hidden from me: tmp.rb:7:in `t': undefined method `ba..

Rails: How to run `rails generate scaffold` when the model already exists?

I'm new to Rails so my current project is in a weird state. One of the first things I generated was a "Movie" model. I then started defining it in more detail, added a few methods, etc. I now reali..

selecting from multi-index pandas

I have a multi-index data frame with columns 'A' and 'B'. Is there is a way to select rows by filtering on one column of the multi-index without resetting the index to a single column index? For ..

HTML5 Video Autoplay not working correctly

Im using this code: <video width="440px" loop="true" autoplay="true" controls> <source src="http://www.example.com/CorporateVideo.mp4" type="video/mp4" /> <source src="http://www.examp..

Unable to locate an executable at "/usr/bin/java/bin/java" (-1)

I am having a pathetic issue with Java in my mac osx 10.7.3 . Previously I installed it and it was working fine. After some changes in the .bash_profile and .profile file in the course of time, I am h..

How to parse float with two decimal places in javascript?

I have the following code. I would like to have it such that if price_result equals an integer, let's say 10, then I would like to add two decimal places. So 10 would be 10.00. Or if it equals 10.6 wo..

How to download the latest artifact from Artifactory repository?

I need the latest artifact (for example, a snapshot) from a repository in Artifactory. This artifact needs to be copied to a server (Linux) via a script. What are my options? Something like Wget / S..

TypeError: '<=' not supported between instances of 'str' and 'int'

I'm learning python and working on exercises. One of them is to code a voting system to select the best player between 23 players of the match using lists. I'm using Python3. My code: players= [0,..

Objects inside objects in javascript

I'm somewhat new to Javascript, so maybe this is just a noob mistake, but I haven't found anything that specifically helps me while looking around. I'm writing a game, and I'm trying to build an objec..

C++ error 'Undefined reference to Class::Function()'

I was wondering if anyone could help me out with this - I'm only new to C++ and it's causing me a fair amount of troubles. I'm trying to make relatively simple Deck and Card class objects. The erro..

error: RPC failed; curl transfer closed with outstanding read data remaining

I'm facing this error when I try to clone a repository from GitLab (GitLab 6.6.2 4ef8369): remote: Counting objects: 66352, done. remote: Compressing objects: 100% (10417/10417), done. error: RPC fail..

Generate an integer sequence in MySQL

I need to do a join with a table/result-set/whatever that has the integers n to m inclusive. Is there a trivial way to get that without just building the table? (BTW what would that type of construct..

How do I make a simple makefile for gcc on Linux?

I have three files: program.c, program.h and headers.h. program.c includes program.h and headers.h. I need to compile this on Linux using gcc compiler. I'm not sure how to do this. Netbeans created..

Convert DateTime to String PHP

I have already researched a lot of site on how can I convert PHP DateTime object to String. I always see "String to DateTime" and not "DateTime to String" PHP DateTime can be echoed, but what i want..

Exit Shell Script Based on Process Exit Code

I have a shell script that executes a number of commands. How do I make the shell script exit if any of the commands exit with a non-zero exit code?..

Is this the proper way to do boolean test in SQL?

Assume active is a "boolean field" (tiny int, with 0 or 1) # Find all active users select * from users where active # Find all inactive users select * from users where NOT active In words, can t..

Visual Studio 2017 - Git failed with a fatal error

I am using Visual Studio 2017 Community Edition (CE), and I have signed into my Microsoft account and I am connected to VSTS. I can see all my projects and repositories, but when I attempt t..

Image resolution for new iPhone 6 and 6+, @3x support added?

I have looked on few articles and discussion like one here and Here about image resolutions that new iPhones will use @3x images for display. Is it true? So does it mean we will have to keep three i..

Determine number of pages in a PDF file

I need to determine the number of pages in a specified PDF file using C# code (.NET 2.0). The PDF file will be read from the file system, and not from an URL. Does anyone have any idea on how this c..

Various ways to remove local Git changes

I just cloned a git repository and checked out a branch. I worked on it, and then decided to remove all my local changes, as I wanted the original copy. In short, I had to do the following two comman..

"java.lang.OutOfMemoryError : unable to create new native Thread"

We are getting "java.lang.OutOfMemoryError : unable to create new native Thread" on 8GB RAM VM after 32k threads (ps -eLF| grep -c java) However, "top" and "free -m" shows 50% free memory available. ..

How to remove leading and trailing white spaces from a given html string?

I've the following HTML string. What would be sample code in JavaScript to remove leading and trailing white spaces from this string? <p>&nbsp;&nbsp;</p> <div>&nbsp;<..

tmux set -g mouse-mode on doesn't work

I've been looking around and people say that putting set -g mouse-mode on should let you scroll through the terminal output when running tmux. However, after both putting this in my ~/.tmux.conf f..

Can PHP cURL retrieve response headers AND body in a single request?

Is there any way to get both headers and body for a cURL request using PHP? I found that this option: curl_setopt($ch, CURLOPT_HEADER, true); is going to return the body plus headers, but then I ne..

Using the passwd command from within a shell script

I'm writing a shell script to automatically add a new user and update their password. I don't know how to get passwd to read from the shell script instead of interactively prompting me for the new pas..

what's the easiest way to put space between 2 side-by-side buttons in asp.net

I have 2 buttons side by side, and I would like to have some inbetween them. Following code will have 2 buttons right next to each other. I have tried margin for the div, and just couldn't get some n..

Concatenate two JSON objects

I have two JSON objects with the same structure and I want to concat them together using Javascript. Is there an easy way to do this?..

How to force an entire layout View refresh?

I want to force the main layout resource view to redraw / refresh, in say the Activity.onResume() method. How can I do this ? By main layout view, I mean the one ('R.layout.mainscreen' below) that i..

Differentiate between function overloading and function overriding

Differentiate between function overloading and function overriding in C++?..

Check line for unprintable characters while reading text file

My program must read text files - line by line. Files in UTF-8. I am not sure that files are correct - can contain unprintable characters. Is possible check for it without going to byte level? Thanks...

Jquery/Ajax Form Submission (enctype="multipart/form-data" ). Why does 'contentType:False' cause undefined index in PHP?

I have been trying to submit a form with enctype="multipart/form-data". I have this setting because the form will involve jpeg/png uploads once I have figured out the ajax submission for text inputs. ..

Processing $http response in service

I recently posted a detailed description of the issue I am facing here at SO. As I couldn't send an actual $http request, I used timeout to simulate asynchronous behavior. Data binding from my model t..

How do I install PHP cURL on Linux Debian?

How do I install PHP cURL on Linux Debian? I tried the following code and got the error below apt-get update apt-get install curl libcurl3 php5-curl Error: W: Failed to fetch http://zm.archive.ub..

ASP.Net Download file to client browser

I'm writing a simple test page to download a text file from a browser on button click. I am getting a really strange error that I have never seen before. Any thoughts? The error occurs on Response...

How to check empty DataTable

I have a DataSet where I need to find out how many rows has been changed using the following code: dataTable1 = dataSet1.Tables["FooTable"].GetChanges(); foreach (DataRow dr in dataTable1) { // ....

How to bind an enum to a combobox control in WPF?

I am trying to find a simple example where the enums are shown as is. All examples I have seen tries to add nice looking display strings but I don't want that complexity. Basically I have a class tha..

CSS3 transitions inside jQuery .css()

When I add the transition line into my code it breaks jQuery. How can I fix it? a(this).next().css({ left: c, transition: 'opacity 1s ease-in-out' }); I'm trying to set up a fade from one d..

Expanding a parent <div> to the height of its children

I have a page structure similar to this: <body> <div id="parent"> <div id="childRightCol"> /*Content*/ </div> <div id="childLeftCol"> /*Content..

Giving UIView rounded corners

My login view has a subview which has a UIActivityView and a UILabel saying "Signing In…". This subview has corners which aren't rounded. How can I make them round? Is there any way to do it inside..

Writing File to Temp Folder

I want to use StreamWriter to write a file to the temp folder. It might be a different path on each PC, so I tried using %temp%\SaveFile.txt but it didn't work. How can I save to the temp folder, us..

How to call MVC Action using Jquery AJAX and then submit form in MVC?

On my MVC View I have button: <input id="btnSave" type="submit" name="Save" value="Save" /> When I click this button I need call one Action, do some stuff there and then Submit my form. I ha..

How to pass an array to a function in VBA?

I am trying to write a function that accepts an array as an argument. The array can have any number of elements. Function processArr(Arr() As Variant) As String Dim N As Variant dim finalSt..

How to specify the actual x axis values to plot as x axis ticks in R

I am creating a plot in R and I dont like the x axis values being plotted by R. For example: x <- seq(10,200,10) y <- runif(x) plot(x,y) This plots a graph with the following values on the ..

Setting Remote Webdriver to run tests in a remote computer using Java

I was trying to setup remote webdriver to run my tests in remote computer, as my application is deployed to my localhost. Using Selenium RC I used host address to run those tests and it worked fine; b..

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 is __main__.py?

What is the __main__.py file for, what sort of code should I put into it, and when should I have one?..

Detecting request type in PHP (GET, POST, PUT or DELETE)

How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP?..

How to find pg_config path

Complete newbie here, trying to set up Django to work with PostgreSQL. I'm using mac osx 10.6.8. I have also installed PostgreSQL 9.3 When I run pip install psycopg2 in terminal I get the following..

Simple way to query connected USB devices info in Python?

How can we query connected USB devices info in Python? I want to get UID Device Name (ex: SonyEricsson W660), path to device (ex: /dev/ttyACM0) And also what would be the best Parameter out of above ..

Select DataFrame rows between two dates

I am creating a DataFrame from a csv as follows: stock = pd.read_csv('data_in/' + filename + '.csv', skipinitialspace=True) The DataFrame has a date column. Is there a way to create a new DataFrame..

Is there any native DLL export functions viewer?

Is there any free native Windows DLL export functions viewer, which shows the function name, and a list of their parameters?..

How do I wrap text in a span?

I've got a span that's 350 pixels wide. If there's more text than that, it just goes straight out to the right off to the side of the span. How do I force the text to wrap down into a paragraph? I've ..

Content Type application/soap+xml; charset=utf-8 was not supported by service

I am getting the error below while trying to add WCF service to WCFTestClient. I went through a number of solutions on the web but I couldn't get it to work. Can someone help me with the issues? I ..

MySQL fails on: mysql "ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded"

My local environment is: fresh Ubuntu 16.04 with PHP 7 with installed MySQL 5.7 sudo apt-get install mysql-common mysql-server When I tried to login to MySQL (via CLI): mysql -u root -p I c..

Import and Export Excel - What is the best library?

In one of our ASP.NET applications in C#, we take a certain data collection (SubSonic collection) and export it to Excel. We also want to import Excel files in a specific format. I'm looking for a lib..

What does Maven do, in theory and in practice? When is it worth to use it?

I am about to start a Java project just for practice. I've read about Maven, but I don't actually understand when it is meant to be used. Can you give me some practical tips? Does Maven help a lot? ..

Setting equal heights for div's with jQuery

I want to set equal height for divs with jQuery. All the divs may have different amount of content and different default height. Here is a sample of my html layout: <div class="container"> ..

Send raw ZPL to Zebra printer via USB

Typically, when I plug in my Zebra LP 2844-Z to the USB port, the computer sees it as a printer and I can print to it from notepad like any other generic printer. However, my application has some bar ..

Practical uses of git reset --soft?

I have been working with git for just over a month. Indeed I have used reset for the first time only yesterday, but the soft reset still doesn't make much sense to me. I understand I can use the soft..

Column count doesn't match value count at row 1

So I read the other posts but this question is unique. So this SQL dump file has this as the last entry. INSERT INTO `wp_posts` VALUES(2781, 3, '2013-01-04 17:24:19', '2013-01-05 00:24:19'. I'm try..

How can I change the color of a Google Maps marker?

I'm using the Google Maps API to build a map full of markers, but I want one marker to stand out from the others. The simplest thing to do, I think, would be to change the color of the marker to blue,..

Angular 6 Material mat-select change method removed

In Angular Material Design 6, the (change) method was removed. I cant find how to replace the change method to execute code in the component when the user change selection Thanks!..

How do I get video durations with YouTube API version 3?

I'm using YouTube API v3 to search YouTube. https://developers.google.com/youtube/v3/docs/search As you can see, the response JSON doesn't contains video durations. Is there way to get video duratio..

Close window automatically after printing dialog closes

I have a tab open when the user clicks a button. On the onload I have it bring up the print dialog, but the user asked me whether it was possible that after it sends to the printer to print, if the ta..

Where do I find the current C or C++ standard documents?

For many questions the answer seems to be found in "the standard". However, where do we find that? Preferably online. Googling can sometimes feel futile, again especially for the C standards, since t..

python exception message capturing

import ftplib import urllib2 import os import logging logger = logging.getLogger('ftpuploader') hdlr = logging.FileHandler('ftplog.log') formatter = logging.Formatter('%(asctime)s %(levelname)s %(mess..

Does Python have a string 'contains' substring method?

I'm looking for a string.contains or string.indexof method in Python. I want to do: if not somestring.contains("blah"): continue ..

Get AVG ignoring Null or Zero values

How can I get the AVG of a column ignoring NULL and zero values? I have three columns to get their average, I try to use the following script: SELECT distinct AVG(cast(ISNULL(a.SecurityW,0) as ..

Make flex items take content width, not width of parent container

I have a container <div> with display: flex. It has a child <a>. How can I make the child appear "inline"? Specifically, how can I make the child's width determined by its content, an..

Refresh Part of Page (div)

I have a basic html file which is attached to a java program. This java program updates the contents of part of the HTML file whenever the page is refreshed. I want to refresh only that part of the pa..

What exactly is \r in C language?

#include <stdio.h> int main() { int countch=0; int countwd=1; printf("Enter your sentence in lowercase: "); char ch='a'; while(ch!='\r') { ch=getche(); if(ch==' ') co..

Oracle - Insert New Row with Auto Incremental ID

I have a workqueue table that has a workid column. The workID column has values that increment automatically. Is there a way I can run a query in the backend to insert a new row and have the workID co..

Proper way to rename solution (and directories) in Visual Studio

I have a rather involved Visual Studio solution (2010, but it shouldn't matter) that I need to rename. I want to rename the folders to match the new solution name, but I can't figure out a way to ref..

How to implement band-pass Butterworth filter with Scipy.signal.butter

UPDATE: I found a Scipy Recipe based in this question! So, for anyone interested, go straight to: Contents » Signal processing » Butterworth Bandpass I'm having a hard time to achieve what seeme..

How can I make a menubar fixed on the top while scrolling

I'd like to make a menubar, which is fixed on the top of the page while scrolling. Something like the top menu in Facebook. Also, I want a div holding the logo float at the left of menubar, and a na..

Sass - Converting Hex to RGBa for background opacity

I have the following Sass mixin, which is a half complete modification of an RGBa example: @mixin background-opacity($color, $opacity: .3) { background: rgb(200, 54, 54); /* The Fallback */ b..

ECMAScript 6 arrow function that returns an object

When returning an object from an arrow function, it seems that it is necessary to use an extra set of {} and a return keyword because of an ambiguity in the grammar. That means I can’t write p =>..

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

Add inline style using Javascript

I'm attempting to add this code to a dynamically created div element style = "width:330px;float:left;" The code in which creates the dynamic div is var nFilter = document.createElement('div'); n..

Why does find -exec mv {} ./target/ + not work?

I want to know exactly what {} \; and {} \+ and | xargs ... do. Please clarify these with explanations. Below 3 commands run and output same result but the first command takes a little time and the f..

Check if a radio button is checked jquery

I have this HTML: <input type="radio" name="test" id="test" value="1"><br> <input type="radio" name="test" id="test" value="2"><br> <input type="radio" name="test" id="test..

Bootstrap collapse animation not smooth

_x000D_ _x000D_ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_ <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3..

java.net.MalformedURLException: no protocol on URL based on a string modified with URLEncoder

So I was attempting to use this String in a URL :- http://site-test.com/Meetings/IC/DownloadDocument?meetingId=c21c905c-8359-4bd6-b864-844709e05754&itemId=a4b724d1-282e-4b36-9d16-d619a807ba67&am..

Visual Studio opens the default browser instead of Internet Explorer

When I debug in Visual Studio, Firefox opens and that is annoying because of the hookups that Internet Explorer and Visual Studio have, such as when you close the Internet Explorer browser that starti..

In-memory size of a Python structure

Is there a reference for the memory size of Python data stucture on 32- and 64-bit platforms? If not, this would be nice to have it on SO. The more exhaustive the better! So how many bytes are used b..

Android Fragment handle back button press

I have some fragments in my activity [1], [2], [3], [4], [5], [6] And on Back Button Press I must to return from [2] to [1] if current active fragment is [2], or do nothing otherwise. What is the ..

How can I get seconds since epoch in Javascript?

On Unix, I can run date '+%s' to get the amount of seconds since epoch. But I need to query that in a browser front-end, not back-end. Is there a way to find out seconds since Epoch in JavaScript?..

Where is the IIS Express configuration / metabase file found?

Where can the IIS Express configuration / metabase file be found?..

Can lambda functions be templated?

In C++11, is there a way to template a lambda function? Or is it inherently too specific to be templated? I understand that I can define a classic templated class/functor instead, but the question is..

How to change Android version and code version number?

How to change Android version and code version number Android Studio? I want to change apk file (app) on Google Play and I need to change Android version and code version number. I tried with this in ..

Optional Parameters in Web Api Attribute Routing

I want to handle POST of the following API-Call: /v1/location/deviceid/appid Additional Parameter are coming from the Post-Body. This all works fine for me. Now I wnat to extend my code by allowing..

Extracting substrings in Go

I'm trying to read an entire line from the console (including whitespace), then process it. Using bufio.ReadString, the newline character is read together with the input, so I came up with the followi..

How to break lines at a specific character in Notepad++?

I have a text file containing text like: ['22APR2012 23:10', '23APR2012 07:10', 1, 3, 0], ['22APR2012 23:10', '23APR2012 07:20', 1, 3, 0], ['22APR2012 23:15', '23APR2012 06:40', 0, 1, 0], ['22APR2012..

SecurityError: Blocked a frame with origin from accessing a cross-origin frame

I am loading an <iframe> in my HTML page and trying to access the elements within it using Javascript, but when I try to execute my code, I get the following error: SecurityError: Blocked a fra..

Using PowerShell to remove lines from a text file if it contains a string

I am trying to remove all the lines from a text file that contains a partial string using the below PowerShell code: Get-Content C:\new\temp_*.txt | Select-String -pattern "H|159" -notmatch | Out-Fi..

Node.js/Windows error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm'

I have Windows 7 32-bit. I installed the latest Node.js 32 bit. When I try to run the command npm install jquery, I receive the error: Error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm How d..

How to start Apache and MySQL automatically when Windows 8 comes up

I am using XAMPP, version 3.2.1. I just installed it on Windows 8. Every time I need to go to the XAMPP Control Panel to start services (MySQL, Apache,...); in Windows 7 it started automatic..

change cursor to finger pointer

I have this a and I don't know that I need to insert into the "onmouseover" so that the cursor will change to finger pointer like a regular link: <a class="menu_links" onclick="displayData(11,1,0,..

How does the getView() method work when creating your own custom adapter?

My questions are: What is exactly the function of the LayoutInflater? Why do all the articles that I've read check if convertview is null or not first? What does it mean when it is null and what doe..

Using app.config in .Net Core

I have problem. I need to write a program in .Net Core(C#) which use app.config like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section..

Django set default form values

I have a Model as follows: class TankJournal(models.Model): user = models.ForeignKey(User) tank = models.ForeignKey(TankProfile) ts = models.IntegerField(max_length=15) title = models..

Is there are way to make a child DIV's width wider than the parent DIV using CSS?

Is there a way to have a child DIV within a parent container DIV that is wider than it's parent. The child DIV needs to be the same width of the browser viewport. See example below: The child DIV m..

How do you create a Swift Date object?

How do you create a date object from a date in swift xcode. eg in javascript you would do: var day = new Date('2014-05-20');..

Eclipse jump to closing brace

What is the keyboard short cut in Eclipse to jump to the closing brace of a scope?..

Finding child element of parent pure javascript

What would the most efficient method be to find a child element of (with class or ID) of a particular parent element using pure javascript only. No jQuery or other frameworks. In this case, I would n..

How To Convert A Number To an ASCII Character?

I want to create an application where user would input a number and the program will throw back a character to the user. Edit: How about vice versa, changing a ascii character into number?..

How to refer to Excel objects in Access VBA?

What declarations I have to make in order to be able to use Excel objects and constants from my Access 2007 VBA script? Dim wb As Workbook or Set objExcelApp = New Excel.Application or .Border..

Creating a blurring overlay view

In the Music app of the new iOS, we can see an album cover behind a view that blurs it. How can something like that be accomplished? I've read the documentation, but did not find anything there. ..

mysql: get record count between two date-time

I am stuck with a problem in MySQL. I want to get the count of records between two date-time entries. For example: I have a column in my table named 'created' having the datetime data type. I want to..

Heatmap in matplotlib with pcolor?

I'd like to make a heatmap like this (shown on FlowingData): The source data is here, but random data and labels would be fine to use, i.e. import numpy column_labels = list('ABCD') row_labels = li..

How to get first and last day of week in Oracle?

I need to get the first day and the last day of the week from some strings that have the format like this: '201118' where 2011 is the year and 18 is the number of the week. Knowing the number of th..

Fatal error: Out of memory, but I do have plenty of memory (PHP)

Since my question is getting longer and longer, I decide to re-write the whole question to make it better and shorter. I run my website on dedicated server with 8GB memory. I am fully aware that I ne..

Homebrew refusing to link OpenSSL

I'm on: OSX 10.11.6, Homebrew version 0.9.9m OpenSSL 0.9.8zg 14 July 2015 I'm trying to play with with dotnetcore and by following their instructions, I've upgraded/installed the latest version of ..

Memory errors and list limits?

I need to produce large and big (very) matrices (Markov chains) for scientific purposes. I perform calculus that I put in a list of 20301 elements (=one row of my matrix). I need all those data in mem..

throw checked Exceptions from mocks with Mockito

I'm trying to have one of my mocked objects throw a checked Exception when a particular method is called. I'm trying the following. @Test(expectedExceptions = SomeException.class) public void throwCh..

How to use Git for Unity3D source control?

What are best practices for using Git source control with Unity 3D, particularly in dealing with the binary nature of Unity 3D projects? Please describe the workflow, what paths would be included in ...

Checking if a string is empty or null in Java

I'm parsing HTML data. The String may be null or empty, when the word to parse does not match. So, I wrote it like this: if(string.equals(null) || string.equals("")){ Log.d("iftrue", "seem to b..

How to extract HTTP response body from a Python requests call?

I'm using the Python requests library. I'm trying to figure out how to extract the actual HTML body from a response. The code looks a bit like this: r = requests.get(...) print r.content This shoul..

How to keep a git branch in sync with master

At the moment git is doing my head in, I cannot come up with the best solution for the following. There are two branches, one called master and one called mobiledevicesupport. I want to keep mobilede..

How can I convert the "arguments" object to an array in JavaScript?

The arguments object in JavaScript is an odd wart—it acts just like an array in most situations, but it's not actually an array object. Since it's really something else entirely, it doesn't have the..

How do I get into a non-password protected Java keystore or change the password?

I'm trying to import a trusted certificated into the Java cacerts keystore, but I have a problem. I tried to list existing trusted certificates and it seems that the keystore isn't password protected...

How to serialize Joda DateTime with Jackson JSON processor?

How do I get Jackson to serialize my Joda DateTime object according to a simple pattern (like "dd-MM-yyyy")? I've tried: @JsonSerialize(using=DateTimeSerializer.class) private final DateTime date; ..

DateTime.Compare how to check if a date is less than 30 days old?

I'm trying to work out if an account expires in less than 30 days. Am I using DateTime Compare correctly? if (DateTime.Compare(expiryDate, now) < 30) { matchFound = true; } ..

How to check if object has any properties in JavaScript?

Assuming I declare var ad = {}; How can I check whether this object will contain any user-defined properties?..

Pass variables from servlet to jsp

How can I pass variable from servlet to jsp? setAttribute and getAttribute didn't work for me :-(..

How to read file from relative path in Java project? java.io.File cannot find the path specified

I have a project with 2 packages: tkorg.idrs.core.searchengines tkorg.idrs.core.searchengines In package (2) I have a text file ListStopWords.txt, in package (1) I have a class FileLoadder. Here ..

C++, copy set to vector

I need to copy std::set to std::vector: std::set <double> input; input.insert(5); input.insert(6); std::vector <double> output; std::copy(input.begin(), input.end(), output.begin()); //E..

How to access shared folder without giving username and password

I have shared one folder to "Everyone" on a machine 1 and trying to access the folder from another machine 2. It is asking for username and password of the machine 1. I am accessing the share folder f..

What is the point of the diamond operator (<>) in Java 7?

The diamond operator in java 7 allows code like the following: List<String> list = new LinkedList<>(); However in Java 5/6, I can simply write: List<String> list = new LinkedList..

SSL cert "err_cert_authority_invalid" on mobile chrome only

Domain: https://www.amz2btc.com Analysis from SSL Labs: https://www.ssllabs.com/ssltest/analyze.html?d=amz2btc.com All my desktop browsers open this fine. Mobile Firefox opens this fine. Only wh..

Python: tf-idf-cosine: to find document similarity

I was following a tutorial which was available at Part 1 & Part 2. Unfortunately the author didn't have the time for the final section which involved using cosine similarity to actually find the d..

Scroll to element on click in Angular 4

I want to be able to scroll to a target when a button is pressed. I was thinking something like this. <button (click)="scroll(#target)">Button</button> And in my component.ts a ..

SQL-Server: The backup set holds a backup of a database other than the existing

I am trying to restore a SQL Server backup file for my database, but it is throwing an error as follow: The backup set holds a backup of a database other than the existing My database in SQL Se..

Is 'bool' a basic datatype in C++?

I got this doubt while writing some code. Is 'bool' a basic datatype defined in the C++ standard or is it some sort of extension provided by the compiler ? I got this doubt because Win32 has 'BOOL' wh..

Easy interview question got harder: given numbers 1..100, find the missing number(s) given exactly k are missing

I had an interesting job interview experience a while back. The question started really easy: Q1: We have a bag containing numbers 1, 2, 3, …, 100. Each number appears exactly once, so there are 10..

Beginner Python: AttributeError: 'list' object has no attribute

The error says: AttributeError: 'list' object has no attribute 'cost' I am trying to get a simple profit calculation to work using the following class to handle a dictionary of bicycles: class Bi..

Better naming in Tuple classes than "Item1", "Item2"

Is there a way to use a Tuple class, but supply the names of the items in it? For example: public Tuple<int, int, int int> GetOrderRelatedIds() That returns the ids for OrderGroupId, OrderTy..

Converting a number with comma as decimal point to float

I have a list of prices with a comma for a decimal point and a dot as the thousand separator. Some examples: 12,30 116,10 1.563,14 These come in this format from a third party. I want to convert t..

How to quit a java app from within the program

What's the best way to quit a Java application with code?..

Node.js on multi-core machines

Node.js looks interesting, BUT I must miss something - isn't Node.js tuned only to run on a single process and thread? Then how does it scale for multi-core CPUs and multi-CPU servers? After all, it ..

Run a controller function whenever a view is opened/shown

I'm building an app with angular+ionic that uses a classic three-button menu at the bottom with three ion-tabs in it. When a user clicks a tab, that template opens through ui-router. I have states l..

Calling a particular PHP function on form submit

I was trying to call a particular php function in submit of a form both the form and php scripts are in same page. My code is below.(it is not working and so I need help) <html> <body>..

<img>: Unsafe value used in a resource URL context

Since upgrading to the latest Angular 2 release candidate, my img tags: <img class='photo-img' [hidden]="!showPhoto1" src='{{theMediaItem.photoURL1}}'> are throwing a browser error: ORIGI..

How do I show running processes in Oracle DB?

Is it possible to show other processes in progress on an Oracle database? Something like Sybases sp_who..

Spring MVC Missing URI template variable

I have a Controller class with a function that saves a record to the Database. I am passing several parameters to the Controller function however i think i may be writing the @RequestMapping incorrect..

How to bring a window to the front?

We have a Java application that needs to be brought to the foreground when a telecontrol mechanism activates something in the application. In order to get this, we have realized in the called method ..

CSS Always On Top

I have a website with a fixed image at the top of my screen. When I scroll down my page the image stays at the top like it should. However, all content below overlaps my image and it is then covered. ..

Creating a dynamic choice field

I'm having some trouble trying to understand how to create a dynamic choice field in django. I have a model set up something like: class rider(models.Model): user = models.ForeignKey(User) ..

Bootstrap 3 Carousel Not Working

My carousel from Bootstrap won't display my images or react to the controls. This is my HTML: <!DOCTYPE HTML> <html> <head> <title>Skates R Us</title> ..

How to "perfectly" override a dict?

How can I make as "perfect" a subclass of dict as possible? The end goal is to have a simple dict in which the keys are lowercase. It would seem that there should be some tiny set of primitives I can..

HTML table needs spacing between columns, not rows

I have an HTML table. I need to have spacing between the table columns, but not the table rows. If I use the cellspacing CSS property it does it between both rows and columns. I also cannot use CSS i..

How to make an alert dialog fill 90% of screen size?

I can create and display a custom alert dialog just fine but even so I have android:layout_width/height="fill_parent" in the dialog xml it is only as big as the contents. What I want is dialog that f..

Spring 3 RequestMapping: Get path value

Is there a way to get the complete path value after the requestMapping @PathVariable values have been parsed? That is: /{id}/{restOfTheUrl} should be able to parse /1/dir1/dir2/file.html into id=1 an..

Displaying a Table in Django from Database

How do you display the information from a database table in a table format on a webpage? Is there a simple way to do this in django or does it require a more complicated approach. More specifically, h..

Plugin org.apache.maven.plugins:maven-compiler-plugin or one of its dependencies could not be resolved

I'm having some issues to configure properly my eclipse to work with maven. I create a new project, this one is correctly build with maven in command line (mvn install), but in Eclipse I got this err..

How can I check Drupal log files?

How can I check Drupal log files? I'm using Ubuntu 10.10 + Apache2 + PHP 5.33 + MySQL and Drupal 7...

Custom Authentication in ASP.Net-Core

I am working on a web app that needs to integrate with an existing user database. I would still like to use the [Authorize] attributes, but I don't want to use the Identity framework. If I did want to..

Format numbers in thousands (K) in Excel

In MS Excel, I would like to format a number in order to show only thousands and with 'K' in from of it, so the number 123000 will be displayed in the cell as 123K It is easy to format to show only t..

How to SELECT based on value of another SELECT

I have a table that looks something like this: Name Year Value A 2000 5 A 2001 3 A 2002 7 A 2003 1 B 2000 6 B 2001 1 B 2002 8..

Redirect from asp.net web api post action

I'm very new to ASP.NET 4.0 Web API. Can we redirect to another URL at the end of the POST action?, something like ... Response.Redirect(url) Actually I upload file from a MVC application (say www.ab..

Single Form Hide on Startup

I have an application with one form in it, and on the Load method I need to hide the form. The form will display itself when it has a need to (think along the lines of a outlook 2003 style popup), b..

How to style a disabled checkbox?

Do you know how I could style a checkbox when it is disabled? E.g.: <input type="checkbox" value="All Terrain Vehicle" name="exfilter_All Terrain Vehicle" id="exfilter_All_Terrain_V..

How to write hello world in assembler under Windows?

I wanted to write something basic in assembly under Windows, I'm using NASM, but I can't get anything working. How to write and compile hello world without the help of C functions on Windows?..

Replace text in HTML page with jQuery

How do I replace any string in jQuery? Let's say I have a string "-9o0-9909" and I want to replace it with another string. ..

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in

struggling with my web design assignment. I've been following a tutorial to add in a search feature for my website, but I've been getting the following error: Warning: mysqli_num_rows() expects param..

What are advantages of Artificial Neural Networks over Support Vector Machines?

ANN (Artificial Neural Networks) and SVM (Support Vector Machines) are two popular strategies for supervised machine learning and classification. It's not often clear which method is better for a part..

Twitter Bootstrap - how to center elements horizontally or vertically

is there any way to center html elements vertically or horizontally inside the main parents?..

Can the "IN" operator use LIKE-wildcards (%) in Oracle?

I have searched this question, and found an answer in MySQL but this is one of those incidents where the statement fails to cross over into Oracle. Can I use wildcards in "IN" MySQL stateme..

How can I let a table's body scroll but keep its head fixed in place?

I am writing a page where I need an HTML table to maintain a set size. I need the headers at the top of the table to stay there at all times but I also need the body of the table to scroll no matter h..

jQuery Loop through each div

I'm pretty sure this will be a really easy answer for you jQuery whizzes, and I'm also pretty such it involves a loop of some kind. I'm trying to perform essentially the same calculation on two separ..

Vertical Alignment of text in a table cell

Here's a portion of my table (it's a form): Those are just two <td>'s in a <tr>. I'm trying to get Description up top, to the top of the table cell, rather than resting on the bottom. ..

Calculate the center point of multiple latitude/longitude coordinate pairs

Given a set of latitude and longitude points, how can I calculate the latitude and longitude of the center point of that set (aka a point that would center a view on all points)? EDIT: Python soluti..

What's the purpose of SQL keyword "AS"?

You can set table aliases in SQL typing the identifier right after the table name. SELECT * FROM table t1; You can even use the keyword AS to indicate the alias. SELECT * FROM table AS t1; What'..

Android custom dropdown/popup menu

How do I do a custom dropdown/popup menu anchored to a button? I need it to work like the popup menu (anchored to a view), and do something when I click an item from the menu. How do I add items to..

Having a UITextField in a UITableViewCell

I'm trying to do that for a couple of days now, and after reading tons of messages of people trying to do that too, I'm still unable to have a fully working UITextField in some of my UITableViewCells,..

Why use the 'ref' keyword when passing an object?

If I am passing an object to a method, why should I use the ref keyword? Isn't this the default behaviour anyway? For example: class Program { static void Main(string[] args) { TestR..

CSS technique for a horizontal line with words in the middle

I'm trying to make a horizontal rule with some text in the middle. For example: ----------------------------------- my title here ----------------------------- Is there a way to do that in CSS? With..

How to approach a "Got minus one from a read call" error when connecting to an Amazon RDS Oracle instance

I'm running Oracle 11GR2 on an Amazon RDS instance. occasionally I get an IO Error: Got minus one from a read call when making a call to DriverManager.getConnection(getUrl()) and I'm not sure why. Oth..

Syntax for an If statement using a boolean

I just recently joined the python3 HypeTrain. However I just wondered how you can use an if statement onto a boolean. Example: RandomBool = True # and now how can I check this in an if statement? L..

Recover from git reset --hard?

Is there any way to recover uncommitted changes to the working directory from a git reset --hard HEAD? ..

Warning - Build path specifies execution environment J2SE-1.4

I create a Maven project in Eclipse Helios. It works fine for a day, but then this warning shows up: Build path specifies execution environment J2SE-1.4. There are no JREs installed in the workspa..

How to remove duplicates from Python list and keep order?

Given a list of strings, I want to sort it alphabetically and remove duplicates. I know I can do this: from sets import Set [...] myHash = Set(myList) but I don't know how to retrieve the list memb..

How to pass arguments from command line to gradle

I'm trying to pass an argument from command line to a java class. I followed this post: http://gradle.1045684.n5.nabble.com/Gradle-application-plugin-question-td5539555.html but the code does not wor..

How can I replace non-printable Unicode characters in Java?

The following will replace ASCII control characters (shorthand for [\x00-\x1F\x7F]): my_string.replaceAll("\\p{Cntrl}", "?"); The following will replace all ASCII non-printable characters (shorthan..

EL access a map value by Integer key

I have a Map keyed by Integer. Using EL, how can I access a value by its key? Map<Integer, String> map = new HashMap<Integer, String>(); map.put(1, "One"); map.put(2, "Two"); map.put(3, "..

Javascript Regexp dynamic generation from variables?

How to construct two regex patterns into one? For example I have one long pattern and one smaller, I need to put smaller one in front of long one. var pattern1 = ':\(|:=\(|:-\('; var pattern2 = ':\(..

Extract file name from path, no matter what the os/path format

Which Python library can I use to extract filenames from paths, no matter what the operating system or path format could be? For example, I'd like all of these paths to return me c: a/b/c/ a/b/c \a\..

open cv error: (-215) scn == 3 || scn == 4 in function cvtColor

I'm currently in Ubuntu 14.04, using python 2.7 and cv2. When I run this code: import numpy as np import cv2 img = cv2.imread('2015-05-27-191152.jpg',0) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRA..

Granting DBA privileges to user in Oracle

How do I grant a user DBA rights in Oracle? I guess something like: CREATE USER NewDBA IDENTIFIED BY passwd; GRANT DBA TO NewDBA WITH ADMIN OPTION; Is it the right way, or.....