qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
64,861,831 | I am using java 11. Wanted to know whats the best(Most importantly **Recommended**) way to validate if the datetime string is ISO8601 complaint in java.
Also how to compare this string value with java.sql.Timestamp? | 2020/11/16 | [
"https://Stackoverflow.com/questions/64861831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10267860/"
] | Assuming you are using at least Java 8 the simplest way to do so would be something like this:
```
private static boolean isIsoDate(String date) {
try {
Instant.from(DateTimeFormatter.ISO_INSTANT.parse(date));
return true;
} catch (DateTimeParseException e) {
//log the failure here
... | ```
public static boolean isValidISODateTime(String date){
try {
LocalDateTime.parse(date, DateTimeFormatter.ISO_DATE_TIME);
return true;
} catch (DateTimeParseException e) {
return false;
}
}
``` |
9,492,641 | I need my sprite to transition to one color to another and on and on... like blue tint then green then purple, but i cannot find any good actions for that and am wondering, should i use animations? or is there an incorporated action for this? | 2012/02/29 | [
"https://Stackoverflow.com/questions/9492641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1104126/"
] | you can use CCTintTo action to change the color of the sprite
```
[sprite runAction:[CCTintTo actionWithDuration:2 red:255 green:0 blue:0]];
``` | since i saw several questions about replacing pixel colours in sprites, and i did'nt see any good solution (all solution only tint the color, and none of them is able to change an array of colours without forcing you into creating multiple image layers which construct the final image you want, i.e: one layer for pans, ... |
395,100 | If $g\in C^{\infty}\_c$ defined on $\Bbb R^n$ and K is the support of function $g$. I want to find the support of $g\_\epsilon$. Where $g\_\epsilon$ is regularization of $g$.
---
Regularization of $g$ is defined as:
$g\_\epsilon$:= $g\*\omega\_\epsilon$ (convolution of g and a test function) i.e. $g\_\epsilon(x
)$... | 2013/05/18 | [
"https://math.stackexchange.com/questions/395100",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/76098/"
] | Definition: Let $f:\mathbb{R}^N\to\mathbb{R}$ be a function. Consider the family $\omega\_i$ of all open sets on $\mathbb{R}^N$ such that for each $i$, $f=0$ a.e. in $\omega\_i$, then $f=0$ a.e. on $\omega=\cup\omega\_i$ and we define the support of $f$ by $$\operatorname{supp}(f)=\mathbb{R}^N\setminus\omega$$
Suppose... | Reminder: The sum of two compact sets, e.g. K an the closed ball $M := B\_\varepsilon(0)$ is compact again, as it is the continuous image of a
compact set $K \times M$ in the product domain. Therefore, if both supports are compact you can omit the closure on the right hand side. |
11,787,043 | I have an ActiveRecord and when i click on save all records are saved except the date.
My contorller
```
class UsersController < ApplicationController
def create
puts params[:user]
@user1 = User.new(params[:user])
if @user1.save
saveduser = User.where("fbid = ?",params[:user][:fbid])
unless saveduser... | 2012/08/02 | [
"https://Stackoverflow.com/questions/11787043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67476/"
] | Ruby doesn't understand your date format. You can fix this by explicitly parsing the date with [`Date::strptime`](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html#method-c-strptime), perhaps in the model as a setter method:
```
class User < ActiveRecord::Base
def dob=(date)
date = Date.strptime(da... | it could be the problem with your date format. You can either configure active record to accept this format or convert your date param to Date object using strftime or something like it |
73,362,668 | I have an array (images\_lst) having shape (250,500,500), it is basically a list of 250 images having dimensions 500X500. How do I select only the first dimension of the array to use it in a loop given below
```
for n in images_lst:
p=n
print(p)
#some other lines in the loop which works fine
while ... | 2022/08/15 | [
"https://Stackoverflow.com/questions/73362668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15358982/"
] | The way to do it **efficiently** is to iterate over all combinations of the positions of the letters 'A', and for each such combination - iterate over all the ways *other letters* can be positioned, and just insert the 'A's there.
**Be warned that with your inputs this will produce almost 3 million words!**
On my mac... | First determine the two indices where the letter "A" will occur, then produce the letters at the other 8 indices:
```
from itertools import combinations, product
def solve():
for i, j in combinations(range(10), 2):
for b in map(list, product("BNME", repeat=8)):
b.insert(i, "A")
b.i... |
1,477,740 | Using method: `System.IO.File.Create()`
After the file gets created, it still remains used by a process, and I can't delete it.
Any idea how I can better create the file, should be a 0byte file, and then somehow close and dispose? | 2009/09/25 | [
"https://Stackoverflow.com/questions/1477740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41543/"
] | JL,
You should wrap your call to .Create in a using statement so that the FileStream that .Create returns will be closed properly. IE:
```
using (File.Create("path")){...}
``` | nikmd23 has the short answer, the long answer is: the `FileStream` that `File.Create(...)` is returning is not being deterministically disposed of, therefore it's file handle is not closed when you're trying to delete it.
As nikmd23 put it, wrapping your `File.Create(...)` call will with a `using` statement will make... |
108 | As per [The 7 Essential Meta Questions of Every Beta](http://blog.stackoverflow.com/2010/07/the-7-essential-meta-questions-of-every-beta/), we should decide on a good FAQ. This will grow organically, but IMO, it deserves its own question. Right now, [this is what we have](https://ux.stackexchange.com/faq). As I opined ... | 2010/08/26 | [
"https://ux.meta.stackexchange.com/questions/108",
"https://ux.meta.stackexchange.com",
"https://ux.meta.stackexchange.com/users/114/"
] | The FAQ has been updated, but let's continue to evolve it by editing and commenting on this question.
>
> ### What makes a good question?
>
>
> Prefer questions that elicit
> definitive answers or solutions rather
> than prolonged discussions. Remember,
> this a Q&A site, not a discussion
> board.
>
>
> More ... | I think we should pull from this great post on the SE blog <http://blog.stackoverflow.com/2010/09/good-subjective-bad-subjective/>
In summary we could write:
>
> What makes a good question?
> ---------------------------
>
>
> 1. Questions inspire answers that explain “why” and “how”.
> 2. Questions tend to have lo... |
46,941,498 | I've been through itertools inside and out and I cannot figure out how to do the following. I want to take a list.
`x = [1,2,3,4,5,6,7,8]` and I want to get a new list:
```
y = [[1],[1,2],[1,2,3],.......[2],[2,3],[2,3,4].....[8]]
```
I need a list of all slices, but not combinations or permutations.
`x = list(zip(... | 2017/10/25 | [
"https://Stackoverflow.com/questions/46941498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2843275/"
] | You can utilize list comprehension if you insist on a one-liner:
```
> x=[1,2,3,4]
> [x[a:b+1] for a in range(len(x)) for b in range(len(x)) if a<=b]
```
>
> [[1], [1, 2], [1, 2, 3], [1, 2, 3, 4], [2], [2, 3], [2, 3, 4], [3], [3, 4], [4]]
>
>
>
Or you can even get rid of that `if`:
```
> [x[a:b+1] for a in ran... | I think this is a good aproach, an iterative way, I could understand it well:
```
lst = [1,2,3,4,5,6,7,8]
res = []
ln= len(lst)
for n in range(ln):
for ind in range(n+1, ln+1):
res.append(lst[n:ind])
``` |
5,221,270 | I'm making my own forum software.
Well its normal to have smileys in your forum.
So i made an array with all the smileys and putted them in a function:
```
function si_ubb($string){
$smileys = array(
'0<:)' => 'angelnot.gif',
'>:(' => 'angry.gif',
':@' => 'blush.gif',
':*' => 'cen... | 2011/03/07 | [
"https://Stackoverflow.com/questions/5221270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/528370/"
] | ```
':)' => 'happy.gif'
```
You have already on case. Your `0<:)` is part of `:)`. After first replacement you get `0<happy.gif`
You'll get same issue with `':(' => 'sad.png'` | Like Michiel said. It does a 'non-greedy' replace. You might want to read up on greedy-regexp's (@see preg\_replace) |
62,374,331 | I need some help with converting an MS Access table with data in Rows into Columns. Created some sample data table that suits my scenario. I need to convert "**Table 1**" to "**Table 3**". If possible using the "**Table 2**" to identify the column order of the Fruits.
[;
var brush = paper.getContext('2d');
var y = 100;
var speed = 1;
function draw() {
if ((y < 10) || (y > 150)) {
speed *= -1
}
y += speed
brush.clearRect(0, 0, 16... | For animations running smoothly on the browser, you should really use a requestAnimationFrame loop instead of setInterval
checkout the example here:
<https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations>
here is why:
[Why is requestAnimationFrame better than setInterval or setTimeout]... |
66,123,643 | **UPDATE**
This works in the snippet example with the var data array, when I try to implement it into my REST example, nothing is populating the html list. I am going to move the working example to a fiddle and update the snippet with the implementation that isn't working.
Fiddle (working hard coded array): <https://... | 2021/02/09 | [
"https://Stackoverflow.com/questions/66123643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13983399/"
] | Add a check for `value==""` then show all rather than filter to none:
```
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$('#under_txt').text(value);
if (value == "") {
$("li").fadeIn();
} else {
$('li').fadeOut(10);
$('[data-weekof=' + value + ']').... | I dunno if you want to keep the last data displayed when cleared or the data displayed at the initialization: here i display the initialization data when `value ==''`
You just relaunch Onsuccess(data) when you clear input:
```js
var data = [
{
"Team": "Eagles",
"WeekOf": "2021-01-31",
"Tasks": "... |
16,282,219 | I'm beginner in Excel VBA and your help is much appreciated.
Please advice how can I create a common function to Open and database connection, and another function to close it, to avoid duplication of coding?
---
Here is my code. I'm stuck on how to move on...
```
Const connection_string As String = "Provider=SQLOL... | 2013/04/29 | [
"https://Stackoverflow.com/questions/16282219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2294485/"
] | This type of stuff is best done in a class. Right click your VBA project in the "IDE" and go to Insert -> Class Module. Name your class something meaningful like clsAdoHelper (if Hungarian Notation is your thing), AdoDbHelper, or something. The following is an example of the code you'd put in this class:
```
Option Co... | Use the Microsoft ActiveX Data Objects Library x.x:
In your VBA window go to Tools> References > Microsoft ActiveX Data Objects Library x.x
I usually use 2.7 for downward compatibility. Now you can create ADODB objects to open connections, perform queries (select/update/delete/...) and use the query results (called r... |
15,107,553 | I have been using SOAP UI Tool to test my web service for Schema Compliance. I would like to export the Schema Compliance failures to an Excel or Text File. Is there a possible way to do this?
Thanks | 2013/02/27 | [
"https://Stackoverflow.com/questions/15107553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1129805/"
] | In C++11 you have the option of initializing non static member variables at the point of declaration:
```
class A{
public:
A();
private:
std::string a = "a"; // curly braces allowed too: std::string a{"a"};
};
```
C++11 also adds delegating constructors, so you can call a class' constructor from other construct... | You initialize it in the class constructors [*initializer list*](http://en.cppreference.com/w/cpp/language/initializer_list):
```
A::A()
: a("a")
{
}
``` |
10,030,505 | I am working on a mathematical problem that has the advantage of being able to "pre-compute" about half of the problem, save this information to file, and then reuse it many times to compute various 'instances' of my problem. The difficulty is that uploading all of this information in order to solve the actual problem ... | 2012/04/05 | [
"https://Stackoverflow.com/questions/10030505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1023645/"
] | It really depends on how much memory is available and what the access pattern is.
---
The simplest solution is to use memory mapped files. This generally requires that the file has been layed out as if the objects were in memory, so you will need to only use POD data with no pointers (but you can use relative indexes... | >
> More specifically: I can pre-compute a huge amount of information - tons of probabilities (long double), a ton of std::map, and much more - and save all this stuff to disk (several Gb).
>
>
>
Don't reinvent the wheel. I'd suggest using a key-value data store, such as berkeley db: <http://docs.oracle.com/cd/E17... |
47,815,232 | Assume I have two classes A and B.
```
Class A{
public String methodA(String name) {
B b = new B();
b.methodB(name);
}
}
Class B{
public String methodB(String name) {
return name+name;
}
}
```
Now I want to mock methodA which has a nested method call to Class B.I have tried writing the bel... | 2017/12/14 | [
"https://Stackoverflow.com/questions/47815232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5453286/"
] | Several issues here.
First, don't use two mocking frameworks at the same time. There's no reason to expect when creating expectations in one framework, that the other would know about it.
Second, if, as stated, you want to mock `methodA`, supposedly as a part of a test of something that uses `A`, then there's no reas... | If you want to mock `methodA` then there is no need to do anything with class B. Just do
```
@Test
public void testCase() {
A a = mock(A.class);
expect(a.methodA()).andReturn("HELLO");
replay(a);
// use the mock to test something
String result = a.methodA("hello ptr");
assertEquals(result, "HEL... |
26,478,687 | I keep seeing CSS with
```
content:"";
```
but often, there's nothing in the quotations. What's the purpose for this? | 2014/10/21 | [
"https://Stackoverflow.com/questions/26478687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3321223/"
] | Defining `content`, even empty, is a requirement if you want CSS applied to the `:before` or `:after` selectors to work.
```css
div:after
{
display: block;
width: 20px;
height: 20px;
background: red;
}
div#withcontent:after
{
content: '';
}
```
```html
<div></div>
<div id="withcontent"... | "Content" is needed for pseudo elements like `::before` and `::after`. It is set to `''` when no text content is desired, such as when the element is used just as a vanilla container for styling.
<https://developer.mozilla.org/en-US/docs/Web/CSS/content> |
60,132,617 | Let's say that we have a random number generator that can generate random 32 or 64 bit integers (like [rand.Rand](https://golang.org/pkg/math/rand/#Rand) in the standard library)
Generating a random int64 in a given range `[a,b]` is fairly easy:
```
rand.Seed(time.Now().UnixNano())
n := rand.Int63n(b-a) + a
```
Is ... | 2020/02/09 | [
"https://Stackoverflow.com/questions/60132617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6858274/"
] | Possible, but by no means easy. Here is a sketch of a solution that might be acceptable — writing and debugging it would probably be at least a day of concerted effort.
Let `min` and `max` be [primitive.Decimal128](https://godoc.org/go.mongodb.org/mongo-driver/bson/primitive#Decimal128) objects from go.mongodb.org/mon... | Go has a large number package that can do arbitrary length integers: <https://golang.org/pkg/math/big/>
It has a pseudo random number generator <https://golang.org/pkg/math/big/#Int.Rand>, and the crypto package also has <https://golang.org/pkg/crypto/rand/#Int>
You'd want to specify the max using <https://golang.org... |
58,043,066 | So I am writing a program to work out the number of days you have been alive after imputting your birthday. There is a problem as i am getting the wrong number of days but can figure out why. i inputted my birthday as 04/04/19 and i got 730625 days which is clearly wrong.
```
import datetime #imports module
year = in... | 2019/09/21 | [
"https://Stackoverflow.com/questions/58043066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12100405/"
] | You have the parameters the wrong way round in `datetime.date` they should be `(year,month,day)` | [`class datetime.date(year, month, day)`](https://docs.python.org/3/library/datetime.html#datetime.date)
should be in the format `yy/mm/dd`.
Try this code for Python **3.6** or higher,
because of [f-stings](https://realpython.com/python-f-strings):
```
import datetime
year = int(input("What year were you born in: ")... |
15,106,490 | ```
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me to... | 2013/02/27 | [
"https://Stackoverflow.com/questions/15106490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2034961/"
] | Your jQuery path can only work if your file is on the server. If not then use this path:
<http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js> | The `<script>` source is wrong
```
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
``` |
42,736,828 | After I Binding the ObversableCollection to the DataGrid,The DataGrid Can't show my data.[](https://i.stack.imgur.com/GfKvY.jpg)
this picture show that the xx.xaml can use the Staff\_Show.but this picture that the data can't be shown normaly.
[![enter... | 2017/03/11 | [
"https://Stackoverflow.com/questions/42736828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7433705/"
] | For the given directory structure, You can put your static files on same level as of the directory with file, `mr_doorbeen/settings.py`
```
mrdoorbeen
manage.py
mr_doorbeen
setting.py
mrdoorbeen
migrations
templates
index.html
profile
profile.html
static/
`... | I had this same problem and solved it by adding to my settings file the import of os from pathlib and the STATICFILES\_DIRS line provided in one of the other responses:
```
from pathlib import Path, os
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
```
STATIC\_URL was already properly specified to... |
60,055,587 | The database I'm designing needs to store matrices of arbitrary size where each column has a description attribute and many-to-one relation with a table representing quantity (length, area, speed etc).
Current design has a table "ValueMatrix" which has a one-to-many relationship with table "MatrixColumn" (allowing for... | 2020/02/04 | [
"https://Stackoverflow.com/questions/60055587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12838175/"
] | It's hard to comment on what would be a good design without a more detailed use-case but I think I would have a design with two tables:-
**Table one**
PK
MatrixName
All other matrix level data
**Table two**
FK
X-coord
Y-coord
Value
There's some basic questions to consider:-
-How do you ensu... | I *think* your problem domain can be described thus:
```
They system has many *matrices*
A matrix has 0 or more *cells*
A cell is identified within the matrix by *coordinates* (x, y)
A cell has exactly one *numerical value*
A cell has exactly one *description*
A description applies to 0 or more cells
```
If that's t... |
21,432,708 | I'm working with ASP.NET and I want to load once a big object (specific by user) in my controller and then use it in my view.
I though about a static property but I find some problems with it.
See : [Is it a bad idea to use a large static variable?](https://stackoverflow.com/questions/21432228/is-it-a-bad-idea-to-use-a... | 2014/01/29 | [
"https://Stackoverflow.com/questions/21432708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2377449/"
] | A singleton won't help you here if this big object is going to be different for every user.
Without knowing all the details, I'd say perhaps your best option is to store it in the Session object,
```
HttpContext.Current.Session["bigObject"] = bigObject;
```
Depending on the size & traffic, this can have performan... | If you want to get to use something for the next simultaneous request, then use `TempData` - which is a bucket where you can hold data that is only needed for the following request. That is, anything you put into TempData is discarded after the next request completes.
If you want to persist the information specific t... |
28,273 | I know there are lots of programs for drawing chemical molecules, but I cannot find the most advanced/suitable one for my needs:
* Drawing eye-catching 3D molecules with glassy colors.
* Having a large database of organic molecules to find a molecule by
name.
* Any OS is acceptable, but it should not be a web-app
* I ... | 2016/01/25 | [
"https://softwarerecs.stackexchange.com/questions/28273",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/18761/"
] | You could try using [OneDrive](https://onedrive.live.com/about/en-us/). Music stored in OneDrive can be automatically played through Groove, Microsoft's music platform available on the web or as an app. I use it for many of my music needs and I don't really have any issues with it. | Try [Mega](https://mega.nz/) or Dropbox. Their Android apps have offline folder. |
54,808,474 | This is just small part of my complete query
I have some data where am calculating This Year and last year (a lot other things) values using aggregation and subquery.
Below is the working and simplest version of my query:
```
SELECT distinct
t1.country,
t1.manufacturer,
t1.category,
t1.m... | 2019/02/21 | [
"https://Stackoverflow.com/questions/54808474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3001015/"
] | The following should replicate your idea: 1 event emitted before completition.
```js
import { of } from 'rxjs';
import { expand, takeWhile, reduce } from 'rxjs/operators';
let count = 0;
const FINISH = "finished";
const limit = 5;
const send$ = () => of(count++ < limit ? "sent" : FINISH);
const expander$ = send$().p... | Not tested but you can try this pattern
```
exec=()=>http.get(....)
exec().pipe(
expand((resp)=>exec()),
takeWhile(resp=>resp !== 'end'),
scan((acc,curr)=>acc.concat(curr),[])
).subscribe()
``` |
4,203,174 | I'm editing orgmode, a time-management mode for emacs. I'm adding some new time functions.
In my addition i need to determine the day of the week for a given date. I use the following code:
```
(defun org-day-of-week (day month year)
(nth-value 6 (decode-universal-time (encode-universal-time 0 0 0 day month year 0) 0)... | 2010/11/17 | [
"https://Stackoverflow.com/questions/4203174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/510605/"
] | A cleaner version of Vatine's [answer](https://stackoverflow.com/questions/4203174/lisp-decode-universal-time-is-void/4203576#4203576) is:
```
(defun day-of-week (year month day)
"Return the day of the week given a YEAR MONTH DAY"
(nth 6 (decode-time (encode-time 0 0 0 day month year))))
```
`decode-time` and `e... | I haven't found the source of this problem, but found a workaround:
```
(defun day-of-week (day month year)
"Returns the day of the week as an integer.
Sunday is 0. Works for years after 1752."
(let ((offset '(0 3 2 5 0 3 5 1 4 6 2 4)))
(when (< month 3)
(decf year 1))
(mod
(truncate (+ year
... |
212,062 | 
Hello, friends. Well, a picture is worth a thousand words. I would like the behavior on the left rather than on the right, the latters are CircuitTikZ defaults. A helpful guy helped me to do it with independent voltage sources,unfortunately I forgot about a... | 2014/11/13 | [
"https://tex.stackexchange.com/questions/212062",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/48128/"
] | Some more free available versions:
```
% arara: lualatex
\documentclass{article}
\usepackage{fontspec}
\begin{document}
Script Capital H:
{\fontspec{arialuni.ttf}\symbol{"210B}}
{\fontspec{code2000.ttf}\symbol{"210B}}
{\fontspec{dejavusans.ttf}\symbol{"210B}}
{\fontspec{freeserif.otf}\symbol{"2... | You can get something very similar to what Mico showed using `\mathscr{H}` and `mathrsfs`, which is free.

```
\documentclass{standalone}
\usepackage{mathrsfs}
\begin{document}
$\mathscr{H}$
\end{document}
``` |
62,082,621 | I try to join two tables:
```
var data = from request in context.Requests
join account in context.AutolineAccts
on request.PkRequest.ToString() equals account.AccountCode
select new
{
ID = r... | 2020/05/29 | [
"https://Stackoverflow.com/questions/62082621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10429263/"
] | You have splitted the query errorneously.
Must be:
```
SELECT (months*salary) as earnings, -- 2 and 4
COUNT(*) -- 4
FROM Employee -- 1
GROUP BY earnings -- 3
ORDER BY earnings DESC -- 5
LIMIT 1; -- 6
```
Step ... | **Step 3:** `GROUP BY earnings` was used to GROUP TOGETHER same value earnings. If you have, for example, earnings of $3,000, and there were 3 of them, they will be grouped together. `GROUP BY` is also required in combination with the aggregate function `COUNT(*)`. Otherwise, `COUNT(*)` will not work and return an erro... |
18,195 | Is it possible to completely disable Bulk Edit functionality?
I'm using Wordpress 3.1. | 2011/05/25 | [
"https://wordpress.stackexchange.com/questions/18195",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/3545/"
] | ```
add_filter( 'bulk_actions-' . 'edit-post', '__return_empty_array' );
add_filter( 'bulk_actions-' . 'upload', '__return_empty_array' );
```
That will do the job | You can completely disable bulk edit input by removing all actions from this filter:
```
function removeBulkActionsInput ($actions) {
// remove all actions
return array();
}
add_filter ('bulk_actions-edit-' . POST_TYPE, 'removeBulkActionsInput' );
```
POST\_TYPE ist your custom post type as string or... |
16,835,478 | I'm trying to round a **float** down to 6 decimal places. Converting from double to float seems to pretty much do this, however in the process I've noticed some weirdness.
Whatever I do I seem to end up with fictitious extra decimal values on the end if I convert back to a **double** later on. I cannot avoid the conver... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16835478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/229587/"
] | There's actually a few subtly different things happening in this example:
>
> I'm trying to round a float down to 6 decimal places. Converting from double to float seems to pretty much do this
>
>
>
If you need to round, use the [Round](http://msdn.microsoft.com/en-us/library/75ks3aby.aspx) method. Converting can... | The literal 50.8467178 is a double by default so it is implicitly converted to a float when asigned to foo. And because float has a smaller percision it is rounded and not so acurate. You should use 50.8467178f when you asign to foo because it is a float literal. In the second example you are converting a double litera... |
1,544,006 | I am trying to chain multiple compiled linq queries together. I have succeeded in chaining two queries together, but I cannot get a chain of three to work correctly. So here is a reduction of my code to recreate the issue. My two questions are: 'Why isn't this working?' and 'Is there a better way to keep the performanc... | 2009/10/09 | [
"https://Stackoverflow.com/questions/1544006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/66101/"
] | Looks like you need to convert your first compiled query to a list before executing the second one. In theory that should have caused an error with your two queried chain as well.
From [MSDN CompiledQuery](http://msdn.microsoft.com/en-us/library/system.data.linq.compiledquery.compile.aspx):
>
> If a new query operat... | Do you need to use the CompiledQuery class? Try this...
```
static Func<DataContext, IQueryable<User>> selectUsers =
(dc) => dc.Users.Select(x => x);
//
static Func<DataContext, string, IQueryable<User>> filterUserName =
(DataContext dc, string name) =>
selectUsers(dc).Where(user => user.Name == ... |
20,073,638 | I've table with accounts rest with following data:
```
T_ID T_RESTDATE T_RESTSUM T_INCOME T_OUTCOME
1135782 20.04.2013 16714,31 16714,31 0
1135782 20.05.2013 33362,4 16648,09 0
1135782 20.06.2013 49179,59 15817,19 0
1135782 20.07.2013 64207,42 15027,83 0
1135782 20.08.2013 784... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20073638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1063474/"
] | **Why neither `data-remote` or `href` work on remote sites like youtube**
Twitter bootstrap's modal uses AJAX to load remote content via `data-remote`/`href`. AJAX is constrained by the [same origin policy](http://en.wikipedia.org/wiki/Same_origin_policy) so accessing a site with a different origin, like youtube, will... | Probably an old post, I had a similar problem a time ago, i wanted to press a link, which would pass the href of a text file (or any other file) to an iframe inside a modal window, i solved like this:
```js
function loadiframe(htmlHref) //load iframe
{
document.getElementById('targetiframe').src = htmlHref;
}
fun... |
44,948 | John 5:3-5 NIV
>
> 3 Here a great number of disabled people used to lie—the blind, the lame, the paralyzed. [4] [b] 5 One who was there had been an invalid for thirty-eight years.
>
>
>
John 5:3-5 KJV
>
> 3 In these lay a great multitude of impotent folk, of blind, halt, withered, waiting for the moving of the ... | 2020/02/12 | [
"https://hermeneutics.stackexchange.com/questions/44948",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/16527/"
] | The Revised Standard Version and some others omit this fourth verse with the reason given that it was insufficiently supported by earlier text.
**However, John 5:3 and 7 could not be properly understood without this verse.**
**Also**, at the excavation site of the pool of Bethesda, archaeologists found a faded fresco... | E.W.Bullinger is pretty good at noting textual issues in The Companion Bible.
He offers no note of concern about authenticity .
>
> Verse 4
>
>
> **For an angel**. The water was intermittent from the upper springs of the waters of Gihon (see App-68 , and 2 Chronicles 32:33 , Revised Version) The common belief of th... |
107,059 | Which famous movie is suggested by the following chess position (by Trevor Tao)?
[](https://i.stack.imgur.com/I2Meu.png) | 2021/02/02 | [
"https://puzzling.stackexchange.com/questions/107059",
"https://puzzling.stackexchange.com",
"https://puzzling.stackexchange.com/users/70146/"
] | This is also (one would hope) not the intended answer, but I'll go with the [garbagious](https://www.imdb.com/event/ev0005190/2018/1?ref_=ttawd_ev_4)
>
> [Transformers: The Last Knight](https://www.imdb.com/title/tt3371366/?ref_=adv_li_tt).
>
>
>
That would be because to my eye white can only win by
>
> sacri... | I already posted this in a comment, but might as well make it an actual guess:
>
> [*Henry VIII* (2003)](https://www.imdb.com/title/tt0382737/?ref_=fn_al_tt_1) (or maybe [*Henry VIII* (1979)](https://www.imdb.com/title/tt0080860/?ref_=fn_al_tt_3), or even [*Henry VIII: Man, Monarch, Monster*](https://www.imdb.com/ti... |
156,628 | The [2019 UA artificer](https://media.wizards.com/2019/dnd/downloads/UA-Artificer2-2019.pdf) can infuse any simple or martial weapon that has the thrown weapon property with the [Returning Weapon](https://media.wizards.com/2019/dnd/downloads/UA-Artificer2-2019.pdf#page=14) infusion. The net is a martial ranged weapon w... | 2019/09/22 | [
"https://rpg.stackexchange.com/questions/156628",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/57038/"
] | The rules simply don’t cover this case; it is entirely up to the DM to decide what happens.
Four possibilities spring to my mind:
1. The net returns, without the target, making the endeavor pointless.
2. The *returning* property fails entirely, the net being pinned in place by the target.
3. The target is dragged bac... | [UA Eberron Arificer](https://media.wizards.com/2019/dnd/downloads/UA-Artificer2-2019.pdf) states:
>
> **Returning Weapon**: This magic weapon grants a +1 bonus to attack
> and damage rolls made with it, and **it returns to the wielder’s hand immediately after it is used to make a ranged attack**
>
>
>
So immedi... |
96,790 | I just had a lecture from someone who has been a senior scientist (and has completed a PhD, post-doc) at a hospital for already 15 years. So I'm assuming this person is experienced in giving talks in English. However, almost one out of three words was completely unintelligible because of a very strong Spanish accent wh... | 2017/10/02 | [
"https://academia.stackexchange.com/questions/96790",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/80681/"
] | **Don't send the email**. Based on my experience, I predict that the anonymous email you are proposing to send almost certainly won't tell the speaker any information she does not already know, only something that she is either in denial about or that she is (for whatever mysterious reasons of human psychology) helples... | **Yes, you might want to send the email**. I think it will have good and productive effect overall, and help the speaker further in her career a lot. Such criticism, though very unpleasant and even hurtful to hear at first, opens the opportunity to self-improvement.
Your act thus shows that you do care for the speaker... |
1,612,723 | I was trying to solve another integral when then I reached this, I've no idea of how to select the contour for the integration. | 2016/01/14 | [
"https://math.stackexchange.com/questions/1612723",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/304873/"
] | Let $t^2= e^x-1$. We have
$$2tdt = e^xdx = (1+t^2)dx \implies dx = \dfrac{2tdt}{1+t^2}$$
Hence, we have
$$I = \int\_0^{\infty} \dfrac{xdx}{\sqrt{e^x-1}} = \int\_0^{\infty} \dfrac{2t \log(1+t^2)dt}{(1+t^2)t} = 2\int\_0^{\infty} \dfrac{\log(1+t^2)}{(1+t^2)}dt$$
Let
$$I(a) = \int\_0^{\infty} \dfrac{\log(1+a^2t^2)}{1+t^2}d... | $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\new... |
10,115,234 | Is there any way I can save all the things that is happening on my Windows 7 Command Prompt in a file. So that I can see what are the things that got printed on the console. I am running a multithreaded Java Program from the command prompt as-
```
java -server -Xms512m -Xmx512m -XX:PermSize=512m -XX:MaxPermSize=512m -... | 2012/04/11 | [
"https://Stackoverflow.com/questions/10115234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/663148/"
] | You can record mouse clicks using the clientX and clientY properties of the mouse event object:
```
document.addEventListener('click', function(event){event.clientX;event.clientY;}, false);
```
The above code is just a demonstration, it isn't even cross browser compatible. `event.clientX` and `event.clientY` hold th... | *[demo](http://jsbin.com/uzadoy/edit#javascript,html,live)*
-----------------------------------------------------------
I used the jQuery library.
```
var boxX = 0;
var boxY = 0;
var box = '<div class="box" />'; // define the .box element
for(var i = 0; i<100;i++){ // create 100 boxes
$('#grid').append(box);... |
37,007,271 | In Octave, I have this cell array:
`y = { 'hello' 'world' 'a' 'world' 'g' 'I' 'w' 'hi'};`
I need to be able to remove the duplicates of an element. So for example I want to remove the duplicates of `'world'`, this should be the output:
```
ans =
{
[1,1] = hello
[1,2] = a
[1,3] = g
[1,4] = I
[1,5] = w
[1,6... | 2016/05/03 | [
"https://Stackoverflow.com/questions/37007271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6213337/"
] | As you already have inside your code (but commented out) you can use `json_decode($_POST['table'],true);` When you us this function you get a array, with 7 entrys (in this example).
Like this:
```
$data = json_decode($_POST['table'], true);
```
The error occurs, because you `echo` the variable. Use `var_dump($data)... | Your commented line
```
$data = json_decode($_POST['table'],true);
```
is good, but you can't echo an array. This will fail:
```
echo $data;
```
This will work:
```
print_r($data);
``` |
115,530 | I have a big shapefile that contains all the buildings and houses of the town that I work in (approx. 90,000 features). The data of the buildings/houses are saved by the town's surveying engineers and due to bad practice and the access of different surveyors to that data, many buildings/houses have been saved twice and... | 2014/09/29 | [
"https://gis.stackexchange.com/questions/115530",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/22887/"
] | You can do this in SQL using a spatial self join. You don't state which SQL dialect you are using, so this example uses Postgres/Postgis, but it could be easily adapted to Oracle or SQL Server. Assuming a table called buildings, with geometry stored in a column called geom:
```
SELECT a.id, b.id from buildings a, buil... | In QGIS you can create a Virtual Layer with the query:
```
select a.id, a.geometry
from yourlayername a
join yourlayername b
on st_equals(a.geometry, b.geometry)
where a.id<b.id
```
Which will join the layer to itself where the geometries are the same but have different id's |
54,116,784 | I have a JTable application. I need to change the cell values and save the data, but only cells with index smaller than or equal to 4 are within the array bounds.
```
package fi.allu.neliojuuri;
import com.sun.glass.events.KeyEvent;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing... | 2019/01/09 | [
"https://Stackoverflow.com/questions/54116784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5964318/"
] | With ES6, by calling the entries() method on the array you can do it =>
```
const array = [1, 2, 3];
for (const [i, v] of array.entries()) {
//Handled last iteration
if( i === array.length-1) {
continue;
}
console.log(i, v)// it will print index and value
}
``` | ```
pre>
const chain = ['ABC', 'BCA', 'CBA'];
let findOut;
for (const lastIter of chain) {
findOut = lastIter; //Last iteration value stored in each iteration.
}
```
console.log(findOut);
```
enter code here
CBA
``` |
1,232 | Les différentes catégories de pronoms personnels — sujet, complément direct, complément indirect — sont en général décrites comme des survivances en français du système de cas du latin.
Pour mémoire
```
Je | Pronom personnel sujet | Nominatif
Me | Pronom personnel complément direct | Accusatif ... | 2011/09/19 | [
"https://french.stackexchange.com/questions/1232",
"https://french.stackexchange.com",
"https://french.stackexchange.com/users/82/"
] | En ancien français, le système casuel s'était déjà partiellement effondré, et les noms ne présentaient plus que deux cas : le *cas sujet* et le *cas régime*. Dans la plupart des cas, le mot n'a eu de descendance que sous sa forme au cas régime, mais il y a des exceptions. [Albert Wikipédia](http://fr.wikipedia.org/wiki... | Je dirais les pronoms relatifs: qui, que, dont |
28,566,616 | I need to remove a line containing "not a dynamic executable" and a previous line from a stream using grep, awk, sed or something other. My current working solution would be to tr the entire stream to strip off newlines then replace the newline preceding my match with something else using sed then use tr to add the new... | 2015/02/17 | [
"https://Stackoverflow.com/questions/28566616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1933452/"
] | Most simply with `pcregrep` in multi-line mode:
```
pcregrep -vM '\n\tnot a dynamic executable' filename
```
If `pcregrep` is not available to you, then `awk` or `sed` can also do this by reading one line ahead and skipping the printing of previous lines when a marker line appears.
You could be boring (and sensible... | Always keep in mind that while grep and sed are line-oriented awk is record-oriented and so can easily handle problems that span multiple lines.
It's a guess given you didn't post any sample input and expected output but it sounds like all you need is (using GNU awk for multi-char RS):
```
awk -v RS='^$' -v ORS= '{g... |
41,505,085 | I have below code i need to call function on click of button. but it is not atall calling those function. What is wrong in below code.
```
<!DOCTYPE html>
<html>
<body>
<input type="button" value="Copy Parent Text" id="CopyParent" onclick="getRate("SEK", "USD")">
<input type="button" value="Copy Child Text" id="Copy... | 2017/01/06 | [
"https://Stackoverflow.com/questions/41505085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6611071/"
] | You have a syntax error because you're enclosing double quotes within double quotes. If you look in the browser's console when you click the button it will show you the error.
You can change the HTML like this to resolve it:
```
<input type="button" value="Copy Parent Text" id="CopyParent" onclick="getRate('SEK', 'U... | You have add double `quot` inside double `quote` `"getRate("USD", "SEK")"`. Just change you html like below:
```
<input type="button" value="Copy Parent Text" id="CopyParent" onclick='getRate("SEK", "USD")'>
<input type="button" value="Copy Child Text" id="CopyChild" onclick='getRate("USD", "SEK")'>
``` |
13,452,522 | Im using the [MBProgressHUD](https://github.com/jdg/MBProgressHUD) to make an overview loading screen while logging out in my ipad app. That progress takes some time because I have to encrypt some bigger files.
Because Im doing it in a background thread and the [MBProgressHUD](https://github.com/jdg/MBProgressHUD) is ... | 2012/11/19 | [
"https://Stackoverflow.com/questions/13452522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/753628/"
] | You can directly dismiss the `MBProgressHUD` from `doSomethingElse` method using `dispatch_async`
```
-(void)doSomethingElse
{
[self encrypt];
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
});
}
``` | Create an atomic property you can get to
```
@property BOOL spinning;
```
and
```
- (void)myTask
{
while ( self.spinning )
{
usleep(1000*250); // 1/4 second
}
}
```
then use something in your view controller like
```
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:... |
23,088,558 | Is there a way to detect on WP8 that web browser control is automatically opening media files using media player which then activate OnNavigateFrom event, and how to differ that event from OnNavigateFrom event that is activated when backBtn,Start or search button pressed.
This is important because different code need t... | 2014/04/15 | [
"https://Stackoverflow.com/questions/23088558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3536623/"
] | Derp, looks like the variable g appeared out of nowhere. When I changed it to i, it started working. Why didn't I get an error in the console, though? Do promises suppress errors in some way? | You've run into swallowed exception issue.
Proposed `catch` in accepted answer is actually same as doing `then(null, fn)`, it's also transformation function that will swallow eventual exceptions (so not real solution for your problem).
If you just want to process the value, cleanest way is via `done` (with no error s... |
351,086 | I want to create a style that makes the selected text have something similar to margin/padding in CSS, but in the horizontal axis only. Example:
>
> Normal text normal text New Style normal text
>
>
> | 2011/10/27 | [
"https://superuser.com/questions/351086",
"https://superuser.com",
"https://superuser.com/users/95744/"
] | I tried this and it works.
1. Select the document you wish to include additional spaces between text
2. Use the Search button shortcut ( CTRL + H ).
3. In the find section type " " (i.e. one space character)
4. In the replace section type the number of spaces you wish to include
5. Click on the Replace All button
You... | Highlight the space you want to enlarge. Access the font style and try various fonts. Typically "CONSOLAS" and "chi-boot" have particularly wide spaces between words, the alphabet of your text will remain unchanged.
Once you have done one space to your satisfaction, others can be done by simply copy and paste of the fi... |
32,668,984 | I'm inputting a program that I'm to assess into visual studio to see where things are taking place, but it's closing immediately.
Here's the code:
```
#include <iostream>
int dowork(int a, int b);
int main()
{
using namespace std;
int x = 4, y = 6;
cout << "Welcome to SIT153..." << endl;
x = dowork(x, y);
for (int... | 2015/09/19 | [
"https://Stackoverflow.com/questions/32668984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5353702/"
] | A floating point literal without a suffix is of type `double`. Suffixing it with an `f` makes a literal of type `float`.
When assigning to a variable, the right operand to `=` is converted to the type of the left operand, thus you observe truncation.
When comparing, the operands to `==` are converted to the larger of... | `0.1` is a double value whereas `0.1f` is a float value.
The reason we can write `float x=0.1` as well as `double x=0.1` is due to implicit conversions .
But by using suffix `f` you make it a float type .
In this -
```
if(x == 0.1)
```
is flase because `0.1` is not exactly `0.1` at some places after decimal .Ther... |
49,781,097 | I want to use Google architecture components in my app, but after updating android studio to version 3.1.1 when I add `android.arch.lifecycle:extensions:1.1.1` dependency into app.gradle file, it will show `Failed to resolve: support-fragment`
My gradle version is 4.4
[` comes before `jcenter()` fixed it.
I had to change the order for the `repositories` within `buildscript` **and** `allprojects` in the top level `build.gradle` file.
Please see this commit:
<https://github.com/kunadawa/ud851-Exercises/commi... | i add this line in build.gradle and fixed bug :
`implementation 'androidx.fragment:fragment:1.2.5'` |
697,098 | I have the following code in accessing a database via nhibernate:
```
ISessionFactory factory =
new NHibernate.Cfg.Configuration().Configure().BuildSessionFactory();
using (ISession session = factory.OpenSession())
{
ICriteria sc = session.CreateCriteria(typeof(Site));
... | 2009/03/30 | [
"https://Stackoverflow.com/questions/697098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] | This is what you usually do:
```
using (ISession session = factory.OpenSession()) {
ICriteria sc = session.CreateCriteria(typeof(Site));
siteList = sc.List();
}
```
However you open build your factory just once - at the start of application. You should not really bother by cl... | Your 2nd code example has at least one bad practice: you're building your SessionFactory, and afterwards you destroy it. So, I assume that you build your SessionFactory each time you need to have a session ? |
6,866,464 | I'm currently running into an issue of needing to pass a SAFEARRAY(GUID) as a return value from C++ to C#.
Currently the C# side is using an Interop dll generated from Tlbimp.exe (Type Library Importer).
The IDL is:
```
HRESULT GetGuids(
[out]SAFEARRAY(GUID)* guids);
```
I've also tried [out, retval]
The func... | 2011/07/28 | [
"https://Stackoverflow.com/questions/6866464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/488267/"
] | You're absolutely right - the problem is that VT\_CLSID isn't allowed in either VARIANT or SAFEARRAY. It boils down to GUID not being an Automation-compatible type.
I often need to do the same thing that you're trying. The easiest way around the problem is to convert the GUID to a string and then pass SAFEARRAY(VT\_BS... | The way to do it involves passing GUIDs as a UDT (user defined type).
For that, we use a SAFEARRAY of VT\_RECORD elements which will be initialized with SafeArrayCreateEx. But first, we have to get a pointer to IRecordInfo that can describe the type.
Since GUID is defined in the windows/COM headers and has no uuid a... |
576,228 | Why are the methods of the Math class static ? | 2009/02/23 | [
"https://Stackoverflow.com/questions/576228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | They are static because the methods do not rely on [instance variables](http://en.wikipedia.org/wiki/Instance_variable) of the Math class. | They can be invoked as if they are a mathematical code library. |
36,379,956 | How can I link to a user's profile view without getting a `no implicit conversion of Fixnum into String` error?
What I currently have:
```
- @questions.each do |question|
= link_to question.user.username, "/users/"+question.user.id
```
Basically what I am trying to achieve is:
When the user clicks on a link, he... | 2016/04/02 | [
"https://Stackoverflow.com/questions/36379956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5841629/"
] | You need to cast the id manually to a string:
```
= link_to question.user.username, "/users/"+question.user.id.to_s
```
I hope that helps. | Also this one should work.
```
= link_to question.user.username, "/users/#{question.user.id}"
``` |
192,723 | I took up a somewhat interesting challenge when I answered [this question](https://softwareengineering.stackexchange.com/questions/369599/short-circuiting-an-infinite-java-8-stream/369749#369749). The task is to collect the first occurrences of different types of animals from an infinite stream until you've caught them... | 2018/04/23 | [
"https://codereview.stackexchange.com/questions/192723",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/40367/"
] | Unit tests
----------
Let's talk about your test assertions first. Your test claims:
>
>
> ```
> String actual = setOfAnimals.toString();
> String expected = "[first HUMAN animal, first DOG animal, first CAT animal]";
>
> ```
>
>
This is broken... ;-)
**EDIT:** I encountered this problem *after* I changed the... | I find your solution a bit convoluted and rather confusing, for several reasons:
* You are relying on the collector returned by `Collectors.toSet()` to have the characteristic [`IDENTITY_FINISH`](https://docs.oracle.com/javase/10/docs/api/java/util/stream/Collector.Characteristics.html#IDENTITY_FINISH), which, while l... |
2,148,997 | I would like to create a Javascript class that I can use like so:
```
var f = new myFunction(arg1, arg2);
f.arg1; // -> whatever was passed as arg1 in the constructor
f();
f instanceof myFunction // -> true
typeof f // -> function
```
I can treat it like a normal object, even adding the native `Function` object to t... | 2010/01/27 | [
"https://Stackoverflow.com/questions/2148997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46768/"
] | First and foremost, you should probably be considering some other way of doing this, because it is unlikely to be portable. I'm just going to assume Rhino for my answer.
Second, I'm not aware of any way in Javascript of assigning a function's body after construction. The body is always specified as the object is const... | `function Foo() { var o = function() {return "FOO"}; o.__proto__ = Foo.prototype; return o; }`
`(new Foo()) instanceof Foo`: true
`(new Foo())()`: FOO |
41,319,720 | Im using google charts in a project but im having a hard time to make them responsive.
Iǘe seen other examples on responsive charts but I cant seem to get it to work in my case.
All my charts gets rendered and after that their sizes do not change.
If someone can make this chart responsive id appreciate it. Thank you... | 2016/12/25 | [
"https://Stackoverflow.com/questions/41319720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7339280/"
] | The solution was already given online elsewhere.
You need to call your drawChart() function whenever the window is resized to get the desired behaviour. The website [flopreynat.com](https://flopreynat.com/blog/2015-09-08-make-google-charts-responsive) exactly describes this problem and solution ([codepen](https://code... | I created a class chart, and used the window resize event like the accepted answer.
css:
```
.chart {
width: 100%;
min-height: 500px;
}
```
js:
```
$(window).resize(function(){
drawChart();
});
```
html:
```
<div id="barchart" class="chart"></div>
``` |
18,384,609 | My problem is likely all about date formatting in a `SELECT`.
In an asp file I open an ADO Recordset wanting to retrieve rows of a MS SQL table that fall between `date1 (08/15/2013)` and `date2 (08/22/2013)` (i.e., the previous 7 days from today's date.)
The `SELECT` does retrieve the appropriate 2013 rows but also... | 2013/08/22 | [
"https://Stackoverflow.com/questions/18384609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2033850/"
] | STOP STORING DATES IN VARCHAR COLUMNS! And STOP CONCATENATING STRINGS, USE PROPER PARAMETERS.
Sorry to yell, but we are getting multiple questions a day where people use the wrong data type for some unknown and probably silly reason, and these are the problems it leads to.
The problem here is that you are comparing *... | The fact that your entry\_Date column is a varchar field and not an actual date is the problem. If you cast it to a datetime during the select, you'll get the results you expect.
```
select *
from aTable
where cast(entry_Date as datetime) between '08/15/2013' and '08/22/2013'
```
[Sql Fiddle link](http://sqlfiddle.c... |
12,507 | My invention is a better solution to existing problem. There are a few other patents and publication that tried to solve the same problem, but as far as I know none was implemented. Only known to me documentation describing the solution actually used by the industry is available online in the form of web pages.
Can I u... | 2015/03/24 | [
"https://patents.stackexchange.com/questions/12507",
"https://patents.stackexchange.com",
"https://patents.stackexchange.com/users/11947/"
] | You can cite a URL that refers to prior art on an information disclosure statement [IDS] using form PTO-892.
URLs in the specification are 'impermissible.' You should not put a URL in your specification.
MPEP 608.01(VII) states:
>
> If hyperlinks and/or other forms of browser-executable code are embedded in the te... | I have used a reference to a website (also as prior art) in my 1st patent application and the patent was issued without any changes. I also have read mpep 608.01(p) and my understanding is that active hyperlinks are not allowed. Apparently my text reference to a hyperlink and not an embedded hyperlink itself wasn't tri... |
26,498,644 | I found this example at `wiki.bash-hackers.org`, however it is not explained in
detail, so I was hoping maybe someone here, could put some light on this, and explain
what is happening.
I understand the first line of `isSubset` function, as it is taking passed args, and using indirect
referencing, stores keys into inte... | 2014/10/22 | [
"https://Stackoverflow.com/questions/26498644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2434479/"
] | 2nd line:
```
${@/%/[key]}
```
`%` as first character of the pattern indicates that pattern has to match at the end. There is nothing else in the pattern so the meaning is "replace empty string at the end, with '[key]'". After that positional parameters look like this:
```
1 = a[key]
2 = b[key]
```
Ne... | The explanation for `${@/%/[key]}` is this section of the bash man page:
>
> ${parameter/pattern/string}
>
>
> The pattern is expanded to produce a pattern just as in pathname
> expansion. Parameter is expanded and the longest match of pat-
> tern against its value is replaced with string. If Ipattern
> begins w... |
121,659 | First of all I'm using `Centos 6` server, putty and wordpress.org
I followed the instructions from [this link](http://www.servermom.org/how-to-install-and-setting-up-vsftpd-on-centos-server/535/#comment-1343) to set up `vsftpd` and ftp in `centos` server.
For the `vsftpd.conf` file, these were the changes I made:
``... | 2014/03/26 | [
"https://unix.stackexchange.com/questions/121659",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/62691/"
] | I am sure there are many ways to accomplish this. Here is one method:
```
echo a{b,c,d} | sed 's/ /,/g'
``` | Here's a bash-only solution.
```
(IN=$(echo a{b,c,d}); echo ${IN// /,})
# ab,ac,ad
```
The part before the semicolon assigns `ab ac ad` to the variable `IN` and the second part uses search and replace to change all spaces to commas. The `//` means all matches, not just the first.
Do it all in a subshell (the enclos... |
20,996,796 | I wrote a simple OpenCV program that recovers my webcam video stream and display it on a simple window. I wante to resize this window to the resolution 256x256 but it changed it to 320x240.
Here's my source code :
```
#include <iostream>
#include <opencv/cv.h>
#include <opencv/highgui.h>
using namespace std;
int ma... | 2014/01/08 | [
"https://Stackoverflow.com/questions/20996796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1364743/"
] | The answers before explained why you are getting a "**weird toast**" so to fix that, in your `tweetAdapter` class you are using `tweet.title` as a `string`.
So try this:
```
adapter.getItem(position).title;
```
Because the `adapter` will get the item that is sent through your `TweetAdapter`, using the `twee... | Try this
```
String itemValue = ((TextView)view).getText().toString();
```
Hope this helps. |
32,121,686 | This may seem like an odd question, but I'm trying to practice writing reusable code, or least trying to practice thinking about it in the right way, if you know what I mean? I have an assignment that involves writing a text interface with a couple of different menus. So there are two approaches to this: (1) a class fo... | 2015/08/20 | [
"https://Stackoverflow.com/questions/32121686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3593486/"
] | I think I understand what you mean, but I also think that when you say `but the methods can be added at another time?` you mean that *what the methods do is added at another time*.
Menus, in your case, usually need to take care of some basic things, such as
* Showing the actual menu text (let's call it title);
* Show... | You could have a general class for a menu-item and for a menu itself (as a collection of menu-items). These classes would not contain any logic regarding on click behaviour, but they would just cover general parts, like UI, layout, title placeholder - general configurations.
You can have 'methods added later'. This ca... |
11,183,065 | I've been learning about divs over the past few months, and am now able to align divs side by side.
However, today I was working on my website, and my divs suddenly stopped lining up.
The divs in question are: `#dorsey_left`, `#dorsey_middle` and `#dorsey_right`.
When I remove `#dorsey_left` from the `HTML` docum... | 2012/06/25 | [
"https://Stackoverflow.com/questions/11183065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1377319/"
] | I think you'll find the solution by cleaning up your code. There are numerous syntax errors (unclosed quotes, children of `<ul>` that aren't `<li>`, etc). If your code passes [validation](http://validator.w3.org/) and the problem still exists try to simplify it so you get to the root of the problem by removing things t... | This tutorial will solve your problem which also has code in it for aligning 3 divs horizontally
<http://codejigz.com/forget-tables-use-divscss-for-page-layouts/> |
38,928,764 | This is my first attempt on using ionic 2. But already I'm having difficulties. But I'm trying.
So after i start a new project, I went on to see how click event is used. I search and read throught the net. But still got no proper answer.
So I used this code on button click event.
```
<button myitem (click)='openFilte... | 2016/08/13 | [
"https://Stackoverflow.com/questions/38928764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6711310/"
] | To work with click function
your code should look like this
**.html**
```
<button myitem (click)='openFilters();'>CLICK</button>
```
**.ts**
```
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
@Component({
templateUrl: 'build/pages/home/home.html'
})
export class HomePa... | The code in the `button` element is perfect. The issue is that you have declared the `openfilters()` method *inside the constructor of the class*, so the click event handler could not find it.
Put it outside the constructor, as another method of the class, and it will work as expected.
```
export class HomePage {
c... |
7,094 | I have this snippet of code that gets the most recently added products:
```
$_productCollection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->addAttributeToFilter($preorderAttribute, array(
'eq' => Mage::getResourceModel('catalo... | 2013/08/24 | [
"https://magento.stackexchange.com/questions/7094",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/3029/"
] | I managed to resolve this (after much trial and error) with the following code:
```
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->addAttributeToFilter('status', 1);
$collection->addAttributeToSelect(array('name','sku','price','small_image'));
// Filter by multiple categories
$collecti... | for error: 'invalid attribut entity\_id'
don't make space between product\_id = entity\_id !!
the good syntax is:
```
->joinField(
'category_id', 'catalog/category_product', 'category_id',
'product_id=entity_id', null, 'left'
)
``` |
46,609,082 | I'm currently teaching myself HTML/Javascript, with a few challenges set by a colleague.
I'm trying to create loops which will display 3 random numbers between 1-99. Each displaying a random colour. Have done some searching and unable to find anything that incorporates these four aspects of my loop.
Below is where I... | 2017/10/06 | [
"https://Stackoverflow.com/questions/46609082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8665947/"
] | As @Lamak mentioned in a comment, you cannot avoid sorting all rows in the table, but not for the reason stated. A sort is required to determine distinct categories by which the result set should be partitioned, and, in the absence of explicit ordering within each partition, row numbers are easily determined as a side ... | Other method of rownumber, but i have doubts of performance too. I agree @mustaccio. My example take 5 rows...
```
select distinct f1.category, f3.*
from yourtable f1
inner join lateral
( ... |
5,990,020 | I want to remove the message Nothing Found to Display in Struts 1.3 Display Tag , When no record fetch from database.
Its possible to do this...? | 2011/05/13 | [
"https://Stackoverflow.com/questions/5990020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/627789/"
] | From my point of view the default behavior should be that no message must be displayed in case of empty data source.
The **empty\_list** didn't work in my case. I tried this and it works:
```
<display:table ...
<display:setProperty name="basic.msg.empty_list" value="" />
<display:column ...
...
</display:ta... | remove "pagesize" attribute, it fixes the issue for struts2 & Displaytag 1.2 (that annoying message is called PageBanner" |
15,289,627 | I want to create two arrays b and c at the same time. I know two methods which can be able to achieve it. The first method is
```
b = ([i, i * 2] for i in [0..10])
c = ([i, i * 3] for i in [0..10])
alert "b=#{b}"
alert "c=#{c}"
```
This method is very handy for creating only one array. I can not be the better way t... | 2013/03/08 | [
"https://Stackoverflow.com/questions/15289627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1494999/"
] | You can use a little help from `underscore` (or any other lib that provides `zip`-like functionality):
```
[b, c] = _.zip ([[i, i * 2], [i, i * 3]] for i in [0..10])...
```
After executing it we have:
```
coffee> b
[ [ 0, 0 ],
[ 1, 2 ],
[ 2, 4 ],
[ 3, 6 ],
[ 4, 8 ],
[ 5, 10 ],
[ 6, 12 ],
[ 7, 14 ],
... | How about this using the existential operator:
```
for i in [0..10]
b = [] if not b?.push [i, i*2]
c = [] if not c?.push [i, i*3]
console.log "b=#{b}"
console.log "c=#{c}"
```
Or to be a bit more understandable:
```
for i in [0..10]
(if b? then b else b = []).push [i, i*2]
(if c? then c else c = []... |
4,320,476 | Consider equations in polar coordinates of the form
$$r = f(\theta) = 1 - \alpha \sin{\theta}$$
When I plot a few of these polar functions, I always get a graph that is symmetric relative to the $y$ axis, indicating that $f(\theta)$ is in fact odd.
Is $f(\theta)$ an odd function?
$$f(-\theta)=1-\alpha\sin{(-\theta)... | 2021/11/30 | [
"https://math.stackexchange.com/questions/4320476",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/333842/"
] | Odd functions: $f(-x)=-f(x)$
Let's try this odd function statement with yours: Assuming function $f$ is odd,
$$f(-x)=-f(x)\\
f(-\theta)=-[1+\alpha \sin(\theta)]\\
[1+\alpha \sin(-\theta)]=-[1+\alpha \sin(\theta)]\\
1-\alpha \sin(\theta) =-1-\alpha \sin(\theta)
$$
Adding $\alpha \sin(\theta)$ to either side, we get: $... | Consider the function $f(x) = 1 - \alpha \sin{(x)}$ in Cartesian coordinates.
Though $\alpha\sin{(x)}$ is an odd function, $1-\alpha\sin{(x)}$ is not, as shown by Mateus Figueiredo's answer.
Note also that shifting $\alpha\sin{(x)}$ to the left by $\frac{\pi}{2}$ makes it equal to $\cos{(x)}$, which is an even functio... |
38,893,452 | i can't add Jquery library to my codes and i have to use js code
can somebody help me with converting following code to js
thanks ..
```
<script type="text/javascript">
$(function(){
$("#gorightslide").click(function(){
if(!$(this).is('.diactiveisbtn')){
$(this).addClass('diac... | 2016/08/11 | [
"https://Stackoverflow.com/questions/38893452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5869303/"
] | You can try this :
```
$(function(){
document.getElementById("gorightslide").click(function(){
if(!hasClass(this, 'diactiveisbtn')){
this.className += " diactiveisbtn";
document.getElementById("goleftslide").className = document.getElementById("goleftslide").className.replace(/\diac... | Try this
```
function yourfunction() {
document.getElementById("gorightslide").onclick = function(event) {
if(event.target.className != "diactiveisbtn"){
event.target.classList = "diactiveisbtn";
document.getElementById("goleftslide").classList = "";
document.getElementById("oneblocks... |
25,729,901 | Is there any expert out there that can help me with the following?
I have the following system calls in C:
```
access()
unlink()
setsockopt()
fcntl()
setsid()
socket()
bind()
listen()
```
I want to know if they may fail with error code -1 and errno EINTR/EAGAIN.
Should I have to handle EINTR/EAGAIN for these?
The... | 2014/09/08 | [
"https://Stackoverflow.com/questions/25729901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3763715/"
] | See <http://man7.org/linux/man-pages/man7/signal.7.html> -- start reading near the bottom where it talks about "Interruption of system calls and library functions..." This is a Linux man page, but the info is pretty generally applicable to any Unix/Posix/Linux-flavored system. | [signal(7)](http://man7.org/linux/man-pages/man7/signal.7.html) for Linux lists
```
accept
connect
fcntl
flock
futex
ioctl
open
read
readv
recv
recvfrom
recvmsg
send
sendmsg
sendto
wait
wait3
wait4
waitid
waitpid
write
writev
```
as possibly interruptible (EINTR) by no-SA\_RESTART handlers and
```
setsockopt
accept... |
179,255 | My partner and I have worked as software engineers in academia for several years in multiple very different schools & departments. However every job has been very independent. I have a boss and coworkers but I end up working mostly independently and on very different projects than my coworkers.
My partner recently lef... | 2021/10/14 | [
"https://workplace.stackexchange.com/questions/179255",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/130010/"
] | Collaboration is driven by a need for collaboration, bottom line. In academia, collaboration often manifests itself in mentor-mentee relationships or in co-writing papers. In software, collaboration manifests in terms of large projects and separation of responsibilities, but also in mentor-mentee relationships.
If you... | In the real world, companies fight each other. If a company does not deliver, its employee will soon need to find themselves a new working place.
So, usually, in companies, the main goal is the success of the company.
So people will, usually, cooperate in order to deliver faster and better products for the overall go... |
15,424,910 | I'm trying to see if there's a simple way to access the internal scope of a controller through an external javascript function (completely irrelevant to the target controller)
I've seen on a couple of other questions here that
`angular.element("#scope").scope();`
would retrieve the scope from a DOM element, but my a... | 2013/03/15 | [
"https://Stackoverflow.com/questions/15424910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1709725/"
] | Here's a reusable solution: <http://jsfiddle.net/flobar/r28b0gmq/>
```
function accessScope(node, func) {
var scope = angular.element(document.querySelector(node)).scope();
scope.$apply(func);
}
window.onload = function () {
accessScope('#outer', function (scope) {
// change any property inside t... | The accepted answer is great. I wanted to look at what happens to the Angular scope in the context of `ng-repeat`. The thing is, Angular will create a sub-scope for each repeated item. When calling into a method defined on the original `$scope`, that retains its original value (due to javascript closure). However, the ... |
43,120,912 | It's probably really obvious once you know the answer, but I can't find it anywhere.
I'm not talking about *making* an installer, I'm talking about running the installer that lets me modify which features of Visual Studio 2017 are installed.
The main screen looks like this:
[%\Microsoft Visual Studio\Installer\vs_installer.exe
``` | Under Projects/New in VS there is a link to go to the Installer. That is the easiest way
to start the Installer and get to the positions (panels) you want. |
22,761,101 | I have a navigation called #nav ul li a. In this list, I want to add the class active to the element on which has been clicked.
This is my jquery
```
$(document).ready(function() {
$('#nav ul li a').click(function() {
$('#nav ul li a').removeClass('active"');
$(this).addClass('active');
... | 2014/03/31 | [
"https://Stackoverflow.com/questions/22761101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3320275/"
] | Try
```
$(document).ready(function() {
$('#nav ul li a').click(function(e) {
$('.active').removeClass('active');
$(this).addClass('active');
return false;
});
});
```
[**Demo**](http://jsfiddle.net/Usgk3/4/) | You're missing jQuery in your fiddle demo.
You also need yo use:
```
$('#nav ul li a').removeClass('active');
```
instead of:
```
$('#nav ul li a').removeClass('active"');
// -- ^ Remove this
```
**[Updated Fiddle](http://jsfiddle.net/Usgk3/11/)** |
917,566 | Working on a little Ruby script that goes out to the web and crawls various services. I've got a module with several classes inside:
```
module Crawler
class Runner
class Options
class Engine
end
```
I want to share one logger among all those of those classes. Normally I'd just put this in a constant in the mo... | 2009/05/27 | [
"https://Stackoverflow.com/questions/917566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/113347/"
] | With the design you've laid out, it looks like the easiest solution is to give Crawler a module method that returns a module ivar.
```
module Crawler
def self.logger
@logger
end
def self.logger=(logger)
@logger = logger
end
end
```
Or you could use "`class <<self` magic" if you wanted:
```
module Cr... | A little chunk of code to demonstrate how this works. I'm simply creating a new basic Object so that I can observe that the object\_id remains the same throughout the calls:
```
module M
class << self
attr_accessor :logger
end
@logger = nil
class C
def initialize
puts "C.initialize, before set... |
11,382,975 | How can I make `QGraphicsView` look flat? It looks like this:

I don't want the outline to be shown.
Thanks! | 2012/07/08 | [
"https://Stackoverflow.com/questions/11382975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/288280/"
] | `QGraphicsView` inherits from `QFrame`. Use the [`setFrameStyle`](http://qt-project.org/doc/qt-4.8/qframe.html#setFrameStyle) method and the [`lineWidth`](http://qt-project.org/doc/qt-4.8/qframe.html#lineWidth-prop) property to change the frame [appearance](http://qt-project.org/doc/qt-4.8/qframe.html#details). | You can also use the stylesheet to customize the look (including the borders) of a QFrame, see the [stylesheet doc](http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qframe).
To make your widget look flat just add this CSS : `border: 0px` |
9,080 | In Luke 24:16, in the use of the passive voice true to the Greek?
>
> "Their eyes were kept from recognizing him." (NRSV)
>
>
>
Only one English translation (NLV) has it that God kept them from recognizing Jesus on the road to Emmaus. I'm wondering if the Greek really implies that it was God, or if it may have be... | 2014/05/01 | [
"https://hermeneutics.stackexchange.com/questions/9080",
"https://hermeneutics.stackexchange.com",
"https://hermeneutics.stackexchange.com/users/4056/"
] | It is Passive
-------------
The verb is ἐκρατοῦντο (ekratounto), which is the imperfect **passive** indicative 3rd plural of the verb κρατέω (krateō), which in this context has the idea of "restrain."1
However, it is not that they did not "see" Jesus (v.15) in some respect, but that when they saw Him, they did not "... | The causal agent of the passive voice does not appear to be God, but unbelief. That is, there is compelling biblical evidence that the agent of the blindness in this context (in the passive voice) was "slowness of heart."
First we see that when Jesus had earlier spoken of his imminent death and resurrection, the disci... |
69,828,503 | Within my app the user is prompted to create a zip file using intent ACTION\_CREATE\_DOCUMENT (as in [here](https://stackoverflow.com/questions/8586691/how-to-open-file-save-dialog-in-android))
This returns a content URI to my app, similar to: `content:/com.android.externalstorage.documents/document/primary%3ADocument... | 2021/11/03 | [
"https://Stackoverflow.com/questions/69828503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260782/"
] | I encoutered this same problem before...
When you change the definition of `Future` (in `_userProfile`), you expect the future to update... but nothing happens...
The reason is that the Future will NOT update the `snapshot.hasError`, nor `snapshot.hasData` nor the `else`... The only thing that changes is `ConnectionS... | This is how I would do it:
```
return FutureBuilder<UserProfile>(
future: _userProfile,
builder: (context, snapshot) {
if (snapshot.connectionState != ConnectionState.done) {
return const Center(child: CircularProgressIndicator());
}
if (snapshot.hasError) {
print(snapshot.error);
ret... |
17,666,803 | My code works as follows:
* Text comes to server (from textarea)
* Text is ran through trim() then nl2br
But what is happening is it is adding a `<br>` but not removing the new line so
```
"
something"
```
becomes
```
"<br>
something"
```
which adds a double new line. Please help this error is ruining all for... | 2013/07/16 | [
"https://Stackoverflow.com/questions/17666803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1763295/"
] | It's because [`nl2br()`](http://php.net/nl2br) doesn't remove new lines at all.
>
> Returns string with `<br />` or `<br>` **inserted before** all newlines (`\r\n`, `\n\r`, `\n` and `\r`).
>
>
>
Use `str_replace` instead:
```
$string = str_replace(array("\r\n", "\r", "\n"), "<br />", $string);
``` | Aren't you using UTF-8 charset? If you are using multibyte character set (ie UTF-8), trim will not work well. You must use multibyte functions. Try something like this one: <http://www.php.net/manual/en/ref.mbstring.php#102141>
Inside `<pre>` you should not need to call nl2br function to display break lines.
Check if... |
1,355,608 | I would like to be able to do something like (psuedo-code):
```
if (classAvailable) {
// do a thing
} else {
// do a different thing
}
```
What would be even better is if I could extend a class from ClassA if it's available or ClassB, if it isn't. I suspect this isn't possible though. | 2009/08/31 | [
"https://Stackoverflow.com/questions/1355608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76835/"
] | I don't think there's a way to dynamically choose whether to extend one class or another, except if you made a program that can manipulate bytecode directly (simple example: hold the compiled bytecode for both versions of the subclass as strings, and just use a `ClassLoader` to load whichever one corresponds to the sup... | In case you are using Spring, try to use org.springframework.util.ClassUtils#isPresent |
9,201,816 | I am trying to use a DataView.RowFilter in order to filter all entries that do not belong in a specified year. My code is as follows:
```
bigDT.DefaultView.RowFilter = "year(date_posted)=2011";
```
This however, does not work. I have read that I can specify DateTimes using a format like "#mm/dd/yyyy#".
I'd prefer ... | 2012/02/08 | [
"https://Stackoverflow.com/questions/9201816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1178551/"
] | Valid [expressions](http://msdn.microsoft.com/en-us/library/cabd21yw%28vs.71%29.aspx) for DateTime.
You can do something like
```
"date_posted > #1/1/2011# AND date_posted < #12/31/2011#"
``` | Make sure the document has the column name "year" and the field in that column is a text or datetime. If it is datetime, you need to be specific and probably include the date, time, etc. If it is text it should be defaultview.rowfilter = "year = 2011". |
62,454,825 | ```
const express = require('express'),
app = express(),
path = require('path'),
mongoose = require('mongoose'),
userGuess = document.getElementById('userGuess'),
lastResult = document.getElementById('lastResult'),
numRound = document.getElementById('numR... | 2020/06/18 | [
"https://Stackoverflow.com/questions/62454825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13648276/"
] | I was able to bypass nmy problem by just linking my DOM manipulation from a seprate index.js file, instead of manipulating from my app.js which runs my node. Thank you for your help guys. | Nodejs is server-side. It really isn't supposed to use methods from `windows` or
`document`. If you do it will say it's undefined. There is one way and that is to use puppeteer.
<https://www.npmjs.com/package/puppeteer>
Keep in mind you must run puppeteer commands asynchronously. But for the basics and to just do w... |
14,852,251 | I am programming in VS2010 and Windows 7.
I am calling the `WinBioOpenSession` function from `winbio.h`
This is my code:
```
WINBIO_SESSION_HANDLE sessionHandle = NULL;
hr = WinBioOpenSession(
WINBIO_TYPE_FINGERPRINT,
WINBIO_POOL_SYSTEM,
WINBIO_FLAG_RAW, ... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14852251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1360473/"
] | Polymorphism?
```
public class UserController : Controller
{
[HttpPost]
public virtual ActionResult SaveUser(User user)
{
}
}
public class UserController : Core.UserController
{
[HttpPost]
public override ActionResult SaveUser(User user)
{
var customUser = user as Custom.User;
... | Another possible workaround if the polymorphism solution doesn't work or isn't acceptable, would be to either rename your UserController or its action method to something slightly different:
```
public class CustomUserController : Core.UserController
{
[HttpPost]
public ActionResult SaveUser(Custom.User user)
... |
619,155 | Considering the scattering of gamma rays on a deuteron, which leads to its break up acording to:
$$ \gamma+ d \longrightarrow p +n $$
we can use the conservation of energy and momentum in order to determine the minimum photon energy in order to make this reaction possible, which happens to be very close to the bindin... | 2021/03/06 | [
"https://physics.stackexchange.com/questions/619155",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/276140/"
] | There are several presentations of [Zeno's paradoxes](https://en.wikipedia.org/wiki/Zeno%27s_paradoxes). One version is as follows (taken from Wikipedia):
---
Suppose Atalanta wishes to walk to the end of a path. Before she can get there, she must get halfway there. Before she can get halfway there, she must get a qu... | Zeno's paradox is based on incorrect logical reasoning, as he did not take into account that shorter length steps are associated with shorter time steps as well. And incorrect logical reasoning can not hold the key to *anything*. |
26,174 | We all know the halacha of [עִבְדוּ אֶת-יְה-ה בְּשִׂמְחָה](http://www.mechon-mamre.org/p/pt/pt26a0.htm#2) (Tehillim 100:2). But the gemara paskens (Pesachim 109a) that since the destruction of the Beis Hamikdash "אין שמחה אלא ביין" ("Joy only comes from wine"). So obviously, one must be drunk whenever serving G-d. Lest... | 2013/02/11 | [
"https://judaism.stackexchange.com/questions/26174",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/883/"
] | In the Gemara it says: "לבסומי בפוריא". Which is commonly translated as drink. However it's clear that לבסומי is actually a reference to the word סמים which means drugs.
Other translations for לבסומי are "sweet things", and "sing agreeably". [Ref](http://joshyuter.com/wp-content/uploads/2011/03/Drinking-on-Purim.pdf)
... | So it's well known that you must drink on Purim - however it does not specify *what* you must drink.
On every day of the year you must drink wine (אלא ביין....) but on Purim you must drink water till you experience [water intoxication](http://en.wikipedia.org/wiki/Water_intoxication).
Some of the symptoms of water in... |
74,174,807 | i am trying to use the isEnabled and setIsEnabled useState Hook to update the icon of the play button. When I hit the playbutton, the icon changes appropriately with the useState Hook assumingly triggering a re render, but hitting the restart btn (although i am calling the setIsEnabled) is not triggering a re render of... | 2022/10/23 | [
"https://Stackoverflow.com/questions/74174807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11683609/"
] | You forgot a period for nav\_links class. This should work:
```
.nav_links li {
display: inline-block;
}
``` | Because you couldn't focus properly on the class selector.
Actually `.nav_links` not `nav_links`. Please run the example below.
```css
@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap');
*{
box-sizing: border-box;
background-color: #EFF7E1;
text-decoration: none;
}
li,a,bu... |
80,581 | Assume a capacitor's voltage limit be v, and the target voltage limit be V.
What is the way of connecting the capacitors to reach the V? | 2013/08/29 | [
"https://electronics.stackexchange.com/questions/80581",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/28163/"
] | The hypothetical case of ideal capacitors which are perfectly identical in leakage current and voltage ratings, is well described in existing answers. In practice, things get a bit more complicated.
If the load in the application has a high duty cycle, **active balancing of capacitors connected in series** is require... | Capacitors connected in series add their voltage tolerances. (This is true if their capacitance values are identical.)
Note that the equivalent capacitance value of capacitors in series is *smaller* than any individual value according to the formula:
$$\frac{1}{C\_{eq}} = \frac{1}{C\_1} + \frac{1}{C\_2} + \frac{1}{C\... |
16,275,928 | According to my understanding in hibernate (please confirm)
1- You have to `session.close()` if you get it by `getSessionFactory().openSession()`.
2- No need to `session.close()` if you get it by `getSessionFactory().getCurrentSession()`. It is automatically closed after **commit()**.
3- *@2* When using `getSess... | 2013/04/29 | [
"https://Stackoverflow.com/questions/16275928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343275/"
] | session.close() is only responsible to close the session
<https://docs.jboss.org/hibernate/orm/3.5/javadocs/org/hibernate/Session.html#close()>
how to work with hibernate session:
<https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/transactions.html#transactions-basics>
```
// Non-managed environment idiom
Se... | Whenever you carry out any unit of work on the database objects, Transactions have to be used. <http://docs.jboss.org/hibernate/orm/4.0/hem/en-US/html/transactions.html> shows why they are used and how they can be used. But, the key is to use a `transaction` object by calling `session.beginTransaction()` which returns ... |
137,675 | So we have this beautiful Grohe Minta (sort of upside down 7-shaped) kitchen faucet. We want to add a drinking water faucet next to it, but cannot find any filtered water faucet that goes with the Minta's looks.
So, I'm thinking of buying another kitchen or prep faucet, connect the cold water hose to the filters and c... | 2018/04/20 | [
"https://diy.stackexchange.com/questions/137675",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/84979/"
] | Good idea. There's really no problem with that approach aside from the stagnant water that will accumulate in the faucet's hot water stub, which could be a health concern (or just gross).
Instead, split your filtered water supply and run it to both the hot and cold sides of the faucet. This has the additional benefit... | I installed a whirlpool filter #WHKF-DWHBB, item #631984 that I purchased from Lowes, on the cold side of the kitchen faucet, about 10 years ago. I change the filter every 6 months. I installed the filter since we do not like the taste of the city water. The replacement filter is the one that is for taste and odor only... |
103,064 | Recently i have written a test class for Webservice.i got 79% .But the test class failed. And the error is "Methods defined as Test Method do not support Web service callouts ". how to resolve this error and improve code coverage?
My apex class :
```
global class Rfleet_Searchaddress {
public String StNumber... | 2015/12/21 | [
"https://salesforce.stackexchange.com/questions/103064",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/25911/"
] | * Apex Code has built in functionality to call external Web services,
such as Amazon Web Services, Facebook, Google, or any publicly available web service. You will also need to have the proper test method code coverage for the related Apex code that makes these
callouts.
* But since the Force.com platform has no c... | Remove HttpMockCallout code from test method and check to see if you are in test mode and instantiate the Mock before the actual callout in the method being tested:
req.setMethod('GET');
if (Test.isRunningTest()) {
Test.setMock(HttpCalloutMock.class, new Rfleet\_MockHttpResponseGenerator());
}
HttpResponse res = h... |
5,391,945 | I was modifying files renaming them and switching them around (I was testing alternative homepages). Now I get a status message that says 'File has been replaced' and an R. I'm not sure what to do to solve this. I'm using Coda, and it does not solve it. So i guess it's command line time. The version that I care about i... | 2011/03/22 | [
"https://Stackoverflow.com/questions/5391945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/545822/"
] | 1. Copy the file and put it in a temp location
2. Run "svn revert "
3. Now copy it back to the same location
4. Run "svn st " to check status | I used a similar procedure to that explained by Version Control Buddy to correct this issue in RAD with Subversive SVN Connector (Eclipse may be similar):
1. List item
2. Copy the file(s) to a temp location outside of RAD
3. Revert the file(s) in RAD using Right-click > Team > Revert
4. Outside of RAD, copy the saved ... |
567,160 | I have VirtualBox on Ubuntu 14.10 and some programs don't work on Wine, so I wanted to use a Windows XP SP3 ISO (for basic programs) and it gives me the error "FATAL: No bootable medium found! System halted." These are my settings for Storage:

And he... | 2014/12/30 | [
"https://askubuntu.com/questions/567160",
"https://askubuntu.com",
"https://askubuntu.com/users/309517/"
] | Seems like you have not a hard-drive... you can add one on Settings like here on my image (I have it in Catalan language, sorry)

If you have already one, just add a CD (at the left from add hard-drive button) and run VirtualBox machine again.
**Edited:*... | I just had the same issue, but for me i needed to re-order my SATA optical drives with the windows iso as port 1, and the physical cd/dvd as port 2. then it worked! |
13,137,967 | I want to update a field in table1 with another field in table2.I wrote the following query but it is not working.
```
UPDATE tempdata A
SET A.new_user_id =
(SELECT B.id FROM user B
WHERE A.usr_email = B.usr_email)
```
It is giving "#1242 - Subquery returns more than 1 row" error. Anybody please help me. | 2012/10/30 | [
"https://Stackoverflow.com/questions/13137967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/966881/"
] | ```
UPDATE tempdata A, user B
SET A.new_user_id = B.id
WHERE A.usr_email = B.usr_email
``` | This is also one way to handle this scenerio
```
UPDATE A
SET A.new_user_id = B.id
FROM tempdata A
INNER JOIN user B ON A.usr_email = B.usr_email
``` |
17,931,755 | I have the problem of connecting with mysql on my debian server. I run `mysql -u root` and get the error message:
```
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
```
... | 2013/07/29 | [
"https://Stackoverflow.com/questions/17931755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/931738/"
] | This question would be better asked on [serverfault.com](http://serverfault.com). However, the easiest way to do this (without confusing other Debian apps) would be to create (as root) a symbolic link to the sock file:
```
# ln -s /run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock
``` | Connect with `mysql -u root -S /run/mysqld/mysqld.sock`, this should work. |
2,283,937 | As I continue to build more and more websites and web applications I am often asked to store user's passwords in a way that they can be retrieved if/when the user has an issue (either to email a forgotten password link, walk them through over the phone, etc.) When I can I fight bitterly against this practice and I do a... | 2010/02/17 | [
"https://Stackoverflow.com/questions/2283937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258497/"
] | Pursuant to the comment I made on the question:
One important point has been very glossed over by nearly everyone... My initial reaction was very similar to @Michael Brooks, till I realized, like @stefanw, that the issue here is broken requirements, but these are what they are.
But then, it occured to me that tha... | Securing credentials is not a binary operation: secure/not secure. Security is all about risk assessment and is measured on a continuum. Security fanatics hate to think this way, but the ugly truth is that nothing is perfectly secure. Hashed passwords with stringent password requirements, DNA samples, and retina scans ... |
3,898,301 | When I boot up Linux Mint from a Live CD, I am able to save files to the "File System". But where are these files being saved to? Can't be the disc, since it's a CDR. I don't think it's stored in the RAM, because it can only hold so much data and isn't really intended to be used as a "hard drive". The only other option... | 2010/10/09 | [
"https://Stackoverflow.com/questions/3898301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/403736/"
] | RAM. In Linux, and indeed most unix systems, any kind of device is seen as a file system.
For example, to get memory info on linux you use `cat /proc/meminfo`, where `cat` is used to read files. Then, there's all sorts of strange stuff like `/dev/random` (to read random crap) and `/dev/null` (to throw away crap). ;-) | To make it persistent - use a USB device - properly formatted and with a special name. See here:
<https://help.ubuntu.com/community/LiveCD/Persistence> |
47,354,226 | I am using Boost::Spirit to build simple "data-filter" language in my C++ GUI application for non-technical users. Language is very similiar to plain English and parse-able into AST. I am requested to make the process as user-friendly as possible, so I wish to provide CLang-like error messages ("Unrecognized 'tokken', ... | 2017/11/17 | [
"https://Stackoverflow.com/questions/47354226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/151150/"
] | Out of curiosity, I decided to try the concept.
Here's my attempt.
Plan
----
Let's parse arithmetic expressions with function calls.
Now, we want to parse (partial) expression with possible unknown identifiers.
In case of incomplete expressions, we want to "imply" the minimal token to complete it (and potentially ... | Spirit doesn't have that feature. You could generate it yourself but it would be considerable effort to do it generically (if not straight up impossible, due NP-completeness). Perhaps just detect parse error (`on_error`) and have a limited number of stock "options" - the 80% rule should go a long way.
Also, I think t... |
29,836,610 | Firefox version: 37
Chrome version: 40
I am calling from chrome-firefox in a WebRTC application and it is not showing a remote stream. firefox-firefox and chrome-chrome are both fine.
I add my local stream to the peer connection, create my answer and send it via my signalling method, and then start sending my ice ca... | 2015/04/24 | [
"https://Stackoverflow.com/questions/29836610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4399172/"
] | not sure if this would work, but give the below code a try, before adding the ICE candidate, just try reforming the RTCIceCandidate from what is being sent...
```
...
candidate = new RTCIceCandidate({
sdpMLineIndex: candidate.label,
candidate: candidate.candidate
});
peerConnection.addIceCandidate(cand... | the "null" sdpMid looks wrong... does it work if you omit that? The mline index should be enough usually. |
4,232,018 | Simplify $$\sum\_{k=0} \binom{n−2k} k$$ Or alternatively, show that it can't be simplified any more.
I tried Hockey stick identity but I had issues with the fact that the top had a -2k term. I then tried using $\binom {n+1}{k+1}$ = $\binom{n}{k} + \binom{n}{k+1}$, but again the -2k term means you can't add consecutive... | 2021/08/24 | [
"https://math.stackexchange.com/questions/4232018",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/955800/"
] | This is only an alternative to find the recurrence relation above. The expression $\binom{n-k}{k}$ gives the number of solutions to the equation $n=\sum{x\_{i}}\phantom{x}|\phantom{x}x\_{i}\in\{1,3\}$ when there are $k$ threes. Therefore the following expression gives the number of possibilities to express $n$ as summa... | **Recursive Solution**
Considering [an old answer](https://math.stackexchange.com/a/1549204) to a related problem, I tried
$$
\begin{align}
a\_n
&=\sum\_k\binom{n-2k}{k}[3k\le n]\tag{1a}\\[3pt]
&=\sum\_k\binom{n-2k-1}{k}[3k\le n]+\sum\_k\binom{n-2k-1}{k-1}[3k\le n]\tag{1b}\\[3pt]
&=\sum\_k\binom{n-2k-1}{k}[3k\le n]+\s... |
29,670,261 | Do we have any option of publishing any API to particular user/subscriber group which is visible only to those subscriber in wso2 API manager.
For Example - I have created an API - userValidateAPI which require to be used only by internal application team & shouldn't be visible to all. If application team login in sto... | 2015/04/16 | [
"https://Stackoverflow.com/questions/29670261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4658730/"
] | A relatively simple one-liner might suffice:
Tested on OSX,
```
md5 -q file*.txt | sort -u
```
If you see more than one line as output, the files are not the same | Put this script in the directory which has `file*.txt` and run
```
#!/bin/bash
FILES=./file*.txt
for filename in $FILES; do
for other in $FILES; do
if [ "$filename" != "$other" ]
then
cmp -s $filename $other
retval=$?
if [ $retval -eq 0 ]
then
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.