qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
60,499,045 | I have the following string value: `"Y AFGHANISTAN Y ALBANIA A ALGERIA Y ANDORRA A ANGOLA Y ANTIGUA AND BARBUDA Y ARGENTINA Y ARMENIA Y AUSTRALIA A AUSTRIA Y AZERBAIJAN Y BAHAMAS Y BAHRAIN Y BANGLADESH Y BARBADOS Y BELARUS Y BELGIUM Y BELIZE Y BENIN Y BHUTAN"`
And I have a list of countries:
```
[1] "AFGHANISTAN" ... | 2020/03/03 | [
"https://Stackoverflow.com/questions/60499045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12996661/"
] | You can split the string on either "Y" or "A" and create a 2-column dataframe from it.
```
data.frame(matrix(trimws(strsplit(string, "(?=\\bY\\b|\\bA\\b)", perl = TRUE)[[1]]),
ncol = 2, byrow = TRUE))
# X1 X2
#1 Y AFGHANISTAN
#2 Y ALBANIA
#3 A ALGER... | If you wanted to use the list of countries, you could create a search string from it, and then split the string at those country names.
**Edit**: Additional modifications made based on comment.
First, the parentheses are escaped in the list of countries. For example: BOLIVIA (PLURINATIONAL STATE OF).
In addition, s... |
31,446,505 | I am struggling to get images to be in center, which are in horizontal list view. As well as I want that images to get equal space(Weight). If I add two images they would take 0.5 weight(Space) of layout each. If I add three they would take 0.33 weight(Space) each.
Below image shows what I get from my code.
![enter i... | 2015/07/16 | [
"https://Stackoverflow.com/questions/31446505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5060536/"
] | Here was the issues:
Error showed up: TypeError: **init**() takes exactly 2 argument
documentaton: <https://pypi.python.org/pypi/python-crontab> helped to resolve the issue.
Reason:
1 - crontab was installed not python-crontab
Here's the completed code:
```
def main():
from crontab import CronTab
cron =... | You may be using an old version of crontab (See - Documentation for [1.4.1 here](https://pypi.python.org/pypi/python-crontab/1.4.1)) . You can either upgrade to latest version of python-crontab using -
```
pip install python-crontab --upgrade
```
Or download the 1.9.3 version from [here](https://pypi.python.org/pypi... |
11,227,104 | I've coded a few ABAP programs and created a some messages in a custom message class, they are under an specific Transport Request/Task.
I need to translate all translatable strings (Messages, Text Symbols, Selection Texts, etc) of the objects found in that Transport Request/Task.
Is there any tool (transaction, progr... | 2012/06/27 | [
"https://Stackoverflow.com/questions/11227104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/236871/"
] | Use a [translation worklist](http://help.sap.com/saphelp_NW04/helpdata/en/77/571a1f492011d1894a0000e829fbbd/frameset.htm). It might be sensible to group the objects to be translated into separate packages for this - this also facilitates packaging and delivery of later versions. | You can use tcode SE63 in order to translate your messages, programs, screens basically everything.
For example you can use this path in order to translate your text elements in an ABAP program:
>
> se63 -> Translation -> ABAP Objects -> Short Texts -> ABAP Texts ->
> REPT Text Elements.
>
>
>
Write down your p... |
60,533 | I've got a `xls` file with exactly 167 images that I must save and post on a website. The sheer number itself is painful, but what complicates things is that you can't directly save images from Calc - you need to copy it to Writer first and then save.
This isn't the way I would like to do things, so is there a way to... | 2011/09/08 | [
"https://askubuntu.com/questions/60533",
"https://askubuntu.com",
"https://askubuntu.com/users/814/"
] | 1. Open the xls file in OpenOffice or LibreOffice
2. save it as a open document (`.ods`).
3. rename file to have `.zip` extension
4. uncompress that zip file
All images should be in a `Pictures/` directory in that zip file.
This also works if you are given a .PPT which can be saved in Impress. | If you want to get scripty there are some perl scripts to unpack Open Document Formats at:
<http://books.evc-cit.info/odbook/ch01.html#unpack-program-example> |
50,176,394 | I have tried multiple suggested fixes for this problem including using the required attribute on only one input and using required="required." At this point, I'm not sure what to do. Any advice on a solution would be really helpful. Thank you for your time! Here's my code:
```
function questionGenerator(score, multipl... | 2018/05/04 | [
"https://Stackoverflow.com/questions/50176394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9717463/"
] | I think you'll need a `BindingAdapter/InverseBindingAdapter` or a conversion method. The easiest is probably a conversion method:
```
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:c... | `<import type="Integer"/>`
```
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/port"
android:inputType="number"
android:text='@={item.port}'
... |
26,189,178 | ```
1. country=Country.create(:name=>'Australia')
2. country.states
#<ActiveRecord::Associations::CollectionProxy []>
3. first_state=State.new(:name=>'Queensland')
=> #<State id: nil, country_id: nil, name: "Queensland", created_at: nil, update
d_at: nil>
4. first_state.country
=> nil
5.country.states=firs... | 2014/10/04 | [
"https://Stackoverflow.com/questions/26189178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4083176/"
] | It's state**s** (plural); it's expecting an array
```
country.states = [first_state]
``` | Or you could push to the states array like
```
country.states<< first_state
```
Additionally, since you are using constant tables, you could use [this](https://github.com/Codebrahma/constantizable) gem to query them. Also please feel free to contribute to the gem if you like it. |
47,275,102 | I'm trying to install the fabric composer runtime on my local hyperledger fabric using the composer runtime install command but 'runtime' is not recognized as a command.
```
$ composer runtime install -n manuf-network -c PeerAdmin@hlfv1
Commands:
archive <subcommand> Composer archive command
generator <subc... | 2017/11/13 | [
"https://Stackoverflow.com/questions/47275102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7829440/"
] | In the newer version of Composer, the "runtime install" command has been changed to "network install", and the --businessNetworkName parameter is no longer required. This command should work:
```
$ composer network install -a your-bna-file.bna -c PeerAdmin@hlfv1
```
See more on official documentation here:
[Hyperled... | The problem is that composer was installed at multiple locations - (it had been installed as the 8.1 version prior to the recent installation of nvm and as the most recent version subsequent to installation of nvm). To fix the problem, I found and deleted all instances of composer (from .npm and from .nvm except for in... |
59,925,384 | I would like to remove elements that are greater than a threshold from a list.
For example, a list with elements `a = [1,9,2,10,3,6]`.
I would like to remove all elements that are greater than 5.
Return should be [1,2,3].
I tried using enumerate and pop but it doesn't work.
```
for i,x in enumerate(a):
if x > ... | 2020/01/27 | [
"https://Stackoverflow.com/questions/59925384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12114752/"
] | Try using a [list comprehension](https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions):
```
>>> a = [1,9,2,10,3,6]
>>> [x for x in a if x <= 5]
[1, 2, 3]
```
This says, "make a new list of *x* values where *x* comes from *a* but only if *x* is less than or equal to the threshold *5*.
The issue... | You can also use the [`filter()`](https://docs.python.org/3/library/functions.html#filter) function along with a `lambda` function, which could work better for something that is tuple and not just a list.
---
Regular example
---------------
```
a = [1, 9, 2, 10, 3, 6]
filtered = filter(lambda num: num > 5, a)
print... |
45,024,025 | Assume I have the following 2 classes `Super` and `Deriv` where `Deriv` is a subclass of `Super`.
`Super` and `Deriv` are both templated classes. I want to create a `vector` of type `Super<?>`. Where the `?` signifies any type. Currently I have come up with this:
```
#include <iostream>
#include <vector>
template <t... | 2017/07/11 | [
"https://Stackoverflow.com/questions/45024025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3262003/"
] | Not sure if this can solve your problem, but it might give you some ideas. The basic idea here is to make a super class for all kinds of `T`. For fundamental data types, wrapper classes are needed.
```
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
class SuperT {
public:
virtual std::st... | Create a new class `RealSuper` that cache the type is a possible workaround.
It is not perfect, but I am afraid that it can't be much better than this :-
```
class RealSuper{ //<-- new class
public: enum TYPE{ type_int, type_float, type_notIni }; // (yes, it is awkward)
TYPE t... |
45,024,025 | Assume I have the following 2 classes `Super` and `Deriv` where `Deriv` is a subclass of `Super`.
`Super` and `Deriv` are both templated classes. I want to create a `vector` of type `Super<?>`. Where the `?` signifies any type. Currently I have come up with this:
```
#include <iostream>
#include <vector>
template <t... | 2017/07/11 | [
"https://Stackoverflow.com/questions/45024025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3262003/"
] | This
```
std::vector<Super*> a;
```
Is wrong.
There is no type named `Super` in your code. Yes, you declared something named "Super", but it's not a class, it's a class template.
The name of the feature says it all. It's a template. The compiler will use `Super` to generate new types at compile time.
For example,... | Create a new class `RealSuper` that cache the type is a possible workaround.
It is not perfect, but I am afraid that it can't be much better than this :-
```
class RealSuper{ //<-- new class
public: enum TYPE{ type_int, type_float, type_notIni }; // (yes, it is awkward)
TYPE t... |
45,024,025 | Assume I have the following 2 classes `Super` and `Deriv` where `Deriv` is a subclass of `Super`.
`Super` and `Deriv` are both templated classes. I want to create a `vector` of type `Super<?>`. Where the `?` signifies any type. Currently I have come up with this:
```
#include <iostream>
#include <vector>
template <t... | 2017/07/11 | [
"https://Stackoverflow.com/questions/45024025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3262003/"
] | Not sure if this can solve your problem, but it might give you some ideas. The basic idea here is to make a super class for all kinds of `T`. For fundamental data types, wrapper classes are needed.
```
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
class SuperT {
public:
virtual std::st... | C++ does not have the feature you are asking for (I believe it is a kind of reification). This means you cannot store arbitrary types in location one, then specify arbitrary operations in a completely unrelated source file in location two, then apply the operations to the data in location three.
There are many problem... |
45,024,025 | Assume I have the following 2 classes `Super` and `Deriv` where `Deriv` is a subclass of `Super`.
`Super` and `Deriv` are both templated classes. I want to create a `vector` of type `Super<?>`. Where the `?` signifies any type. Currently I have come up with this:
```
#include <iostream>
#include <vector>
template <t... | 2017/07/11 | [
"https://Stackoverflow.com/questions/45024025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3262003/"
] | This
```
std::vector<Super*> a;
```
Is wrong.
There is no type named `Super` in your code. Yes, you declared something named "Super", but it's not a class, it's a class template.
The name of the feature says it all. It's a template. The compiler will use `Super` to generate new types at compile time.
For example,... | C++ does not have the feature you are asking for (I believe it is a kind of reification). This means you cannot store arbitrary types in location one, then specify arbitrary operations in a completely unrelated source file in location two, then apply the operations to the data in location three.
There are many problem... |
30,210,751 | I have started learning Wicket framework and I came across wicket models and I read about Model(), CompouneModel() and CompoundPropertyModel() but I didn't get the actual difference between them. I searched on Google for this, but I didn't get any information about this.
This [link](http://www.simplecodestuffs.com/dif... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30210751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4762813/"
] | All of them are implementations of the interface **IModel**.
Class **Model** is a basic implementation, that is almost just a 'data holder' so you can store an object in that model and get. The added value of this class is to forward to get and to set model object if the stored object is an other model (IModel).
Clas... | Please check <https://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models>. It gives very good explanations.
You can also read the official docs at <http://ci.apache.org/projects/wicket/guide/6.x/guide/modelsforms.html> |
30,210,751 | I have started learning Wicket framework and I came across wicket models and I read about Model(), CompouneModel() and CompoundPropertyModel() but I didn't get the actual difference between them. I searched on Google for this, but I didn't get any information about this.
This [link](http://www.simplecodestuffs.com/dif... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30210751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4762813/"
] | All of them are implementations of the interface **IModel**.
Class **Model** is a basic implementation, that is almost just a 'data holder' so you can store an object in that model and get. The added value of this class is to forward to get and to set model object if the stored object is an other model (IModel).
Clas... | Very good example. Just need some correction:
According to
```
IModel idModel = new PropertyModel(data, "id");
```
and
```
private Integer data;
```
I expect that In Data class supposed to be
```
private Integer id;
```
instead.
And the same mistake in next place
```
add(new Label("data"));
```
expect ... |
30,210,751 | I have started learning Wicket framework and I came across wicket models and I read about Model(), CompouneModel() and CompoundPropertyModel() but I didn't get the actual difference between them. I searched on Google for this, but I didn't get any information about this.
This [link](http://www.simplecodestuffs.com/dif... | 2015/05/13 | [
"https://Stackoverflow.com/questions/30210751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4762813/"
] | Please check <https://cwiki.apache.org/confluence/display/WICKET/Working+with+Wicket+models>. It gives very good explanations.
You can also read the official docs at <http://ci.apache.org/projects/wicket/guide/6.x/guide/modelsforms.html> | Very good example. Just need some correction:
According to
```
IModel idModel = new PropertyModel(data, "id");
```
and
```
private Integer data;
```
I expect that In Data class supposed to be
```
private Integer id;
```
instead.
And the same mistake in next place
```
add(new Label("data"));
```
expect ... |
15,853,705 | I'm using this simple HTML code
```
<html>
<head>
<meta name='viewport' content='width=device-width; initial-scale=1.0;
maximum-scale=1.0; user-scalable=0;' />
<meta name='apple-mobile-web-app-capable' content='yes' />
</head>
<body>
<div align='center'>
<img ... | 2013/04/06 | [
"https://Stackoverflow.com/questions/15853705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/617801/"
] | The [content model of tr elements](http://www.w3.org/TR/html5/tabular-data.html#the-tr-element) is "Zero or more td or th elements".
Since a br element is not allowed there, your browser is attempting to recover from the error by moving it to before the table.
To solve the problem, [write valid HTML](http://validato... | Remove all `<br/>` from your `<tr>` will solve your issue. |
36,075,233 | I am writing a program on how to simulate a car for school. I have the majority of the program done however, I'm stumped on an error.
I called these functions mid program:
```
find_gallons(total_distance, mpg)
find_total_cost (gallon, cost_per_gallon)
def find_gallons(total_distance, mpg):
try:
gallon =... | 2016/03/18 | [
"https://Stackoverflow.com/questions/36075233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6080313/"
] | You are calling `find_gallons(total_distance, mpg)` and the other function before defining them.
```
def find_gallons(total_distance, mpg):
try:
gallon = total_distance / mpg
print(gallon)
except ZeroDivisionError:
print("MPG is Zero!")
return gallon
def find_total_cost(gallon, co... | Your code formatting isn't completely clear, but you can't call a function in python before you've defined it. Move the calls below the definition.
```
def find_gallons(total_distance, mpg):
try:
gallon = total_distance / mpg
print(gallon)
except ZeroDivisionError:
print("MPG is Zero!")
return gallon
def f... |
36,772,194 | I have been trying to read following data table and create an object for the HUBs(rows) and another object for continent (columns). Since I am not a C++ experienced user I have been facing some difficulties. The data is in following. The number after HUB and the dash shows the order from the hub. The other numbers unde... | 2016/04/21 | [
"https://Stackoverflow.com/questions/36772194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6236145/"
] | TL/DR: It appears like it is not implemented for sql changelogs - but properties are passed from the xml changelogfile.
I looked into the code of the FormattedSqlChangeLogParser and could not find any references to property parsing.
As a workaround you can enter the properties in the xml changelog file. This will als... | This feature has been added in Liquibase 3.5.0, which was released today (April 21, 2016) |
36,772,194 | I have been trying to read following data table and create an object for the HUBs(rows) and another object for continent (columns). Since I am not a C++ experienced user I have been facing some difficulties. The data is in following. The number after HUB and the dash shows the order from the hub. The other numbers unde... | 2016/04/21 | [
"https://Stackoverflow.com/questions/36772194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6236145/"
] | TL/DR: It appears like it is not implemented for sql changelogs - but properties are passed from the xml changelogfile.
I looked into the code of the FormattedSqlChangeLogParser and could not find any references to property parsing.
As a workaround you can enter the properties in the xml changelog file. This will als... | We had a similar problem with our MSSQL changelogs and Spring Boot 2.x. The changelog contains a view with schemabinding, where we wanted to make the schema configurable.
SQL changelog:
```
CREATE VIEW foo WITH SCHEMABINDING AS
SELECT * FROM ${schema}.bar;
```
Then in application.yml
```
spring:
liquibase:
... |
36,772,194 | I have been trying to read following data table and create an object for the HUBs(rows) and another object for continent (columns). Since I am not a C++ experienced user I have been facing some difficulties. The data is in following. The number after HUB and the dash shows the order from the hub. The other numbers unde... | 2016/04/21 | [
"https://Stackoverflow.com/questions/36772194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6236145/"
] | This feature has been added in Liquibase 3.5.0, which was released today (April 21, 2016) | We had a similar problem with our MSSQL changelogs and Spring Boot 2.x. The changelog contains a view with schemabinding, where we wanted to make the schema configurable.
SQL changelog:
```
CREATE VIEW foo WITH SCHEMABINDING AS
SELECT * FROM ${schema}.bar;
```
Then in application.yml
```
spring:
liquibase:
... |
73,435,450 | ```
List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join("", names.ToArray());
```
I would like to Join only 1 specific character from each string. Let's say, the 3rd one. Without loop if possible.
```
// result = "hnn"
``` | 2022/08/21 | [
"https://Stackoverflow.com/questions/73435450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13120956/"
] | Hello probably you want something like this:
```
List<string> names = new List<string>() { "John", "Anna", "Monica" };
const int specificCharacter = 2;
var result = names.Where(name => specificCharacter < name.Length)
.Aggregate(string.Empty, (current, name) => current + name[specificCharact... | You can do this with LINQ:
```
List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join
(
"",
from x in names
select x[2]
);
``` |
73,435,450 | ```
List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join("", names.ToArray());
```
I would like to Join only 1 specific character from each string. Let's say, the 3rd one. Without loop if possible.
```
// result = "hnn"
``` | 2022/08/21 | [
"https://Stackoverflow.com/questions/73435450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13120956/"
] | To Add to the Linq answers, the simplest one would likely be:
```
var result = new string(names.Where(name => name.Count() >= 3).Select(x => x[2]).ToArray());
```
To break that down, you first filter the list to make sure there is no name that is too short:
```
var filteredNames = names.Where(name => name.Count() >... | You can do this with LINQ:
```
List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join
(
"",
from x in names
select x[2]
);
``` |
73,435,450 | ```
List<string> names = new List<string>() { "John", "Anna", "Monica" };
var result = String.Join("", names.ToArray());
```
I would like to Join only 1 specific character from each string. Let's say, the 3rd one. Without loop if possible.
```
// result = "hnn"
``` | 2022/08/21 | [
"https://Stackoverflow.com/questions/73435450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13120956/"
] | To Add to the Linq answers, the simplest one would likely be:
```
var result = new string(names.Where(name => name.Count() >= 3).Select(x => x[2]).ToArray());
```
To break that down, you first filter the list to make sure there is no name that is too short:
```
var filteredNames = names.Where(name => name.Count() >... | Hello probably you want something like this:
```
List<string> names = new List<string>() { "John", "Anna", "Monica" };
const int specificCharacter = 2;
var result = names.Where(name => specificCharacter < name.Length)
.Aggregate(string.Empty, (current, name) => current + name[specificCharact... |
27,989 | I use symmetric encryption in emacs 24 and somewhere along the line the variable named epa-file-cache-passphrase-for-symmetric-encryption seems to have disappeared from emacs. I am going crazy entering the passphrase twice each time I try to save or open a file. I must have missed some big change but google does not se... | 2016/10/21 | [
"https://emacs.stackexchange.com/questions/27989",
"https://emacs.stackexchange.com",
"https://emacs.stackexchange.com/users/9068/"
] | I cannot comment on Emacs 24, but here's how I solved this for Emacs 25:
By default epa in Emacs 25 uses gpg2 (GnuPG 2.x). According to the Epa manual, caching with gpg2 requires gpg-agent.
For some reason, I had to enable pinentry in the minibuffer, see: [Enabling minibuffer pinentry with Emacs 25 and GnuPG 2.1 on U... | To prevent EPG from prompting for a key every time you save a file, put the following at the top of your file:
```
-*- epa-file-encrypt-to: ("your@email.address") -*-
``` |
6 | The answers to many questions on this site will depend on the specific culture in which the OP lives. The norms of interpersonal contact vary a lot from one culture to another. (I realised this when I read [this question](https://interpersonal.stackexchange.com/q/11/25); in Britain, if someone bumps into you in the str... | 2017/06/27 | [
"https://interpersonal.meta.stackexchange.com/questions/6",
"https://interpersonal.meta.stackexchange.com",
"https://interpersonal.meta.stackexchange.com/users/25/"
] | Like I said here:
>
> Social skills and norms, traditions, values... etc vary so much depending on where you are and the culture of that region. Pakistani social norms will be different from Canadian norms, which themselves will be different from those of South Africa.
>
>
>
### So, what does that mean?
Question... | You can specify in the answer which locale/culture you're referring to, provided the OP hasn't specified.
Alternatively, or perhaps additionally, we could make tags such as [united-states-culture](https://interpersonal.stackexchange.com/questions/tagged/united-states-culture "show questions tagged 'united-states-cultu... |
62,632,912 | I have 2 component parent and child relationship.
I want to call parent component method in my child component.
I tried @Input decorator but that was not working.
Please help | 2020/06/29 | [
"https://Stackoverflow.com/questions/62632912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13832691/"
] | **Parent listens for child event**
The child component exposes an EventEmitter property with which it emits events when something happens. The parent binds to that event property and reacts to those events.
The child's EventEmitter property is an output property, typically adorned with an @Output decoration as seen i... | @Input decorator is used for child component to get data from parent component. To call method from parent component from child component you have a two option:
1. Use @Output decorator with event emitter to emit event from child component to parent and on that event you can call method in parent component.
`@Output(... |
68,040,354 | ```
struct A {};
template<typename T>
void f(int n, T m = 3.14159)
{}
int main()
{
f(8, A{}); // ok
f(8); // error: no matching function for call to 'f'
}
```
See [online demo](https://godbolt.org/z/PrKfYvaaE)
**Why does the default argument not work in a template function?**
---
**EDIT:** I also tri... | 2021/06/18 | [
"https://Stackoverflow.com/questions/68040354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/508343/"
] | Default function arguments don't affect template argument deduction.
You need a default argument for the template parameter too: `typename T = double`.
---
As for `void g(int, auto = 3.14159)`, there seems to be no way to fix it. | In the first case, you gave a value for the second function parameter at the call site, which the compiler could use to deduce the type of the second template argument, which then let it determine which version of the template to instantiate and call.
In the second case, you gave the compiler no information about the ... |
84,058 | What would the last digit be in a base 11 system? Base 12?
I'm mostly wondering because I was thinking of a base 36 system with digits 0-9 immediately followed by the letters A-Z but I wasn't sure if that would be considered a proper numeral system, or if there was something else in place. | 2011/11/20 | [
"https://math.stackexchange.com/questions/84058",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/19828/"
] | The extra digits can be anything you want (the symbols 0-9 themselves are arbitrary, and could be switched around or replaced by other things, though that'd be adding unnecessary confusion). As Arturo mentions above, [hexadecimal notation](http://en.wikipedia.org/wiki/Positional_notation#Computing) is common in computi... | IIRC, on the SWAC at UCLA in the 50's and 60's, the 6 hex digits beyond 9 were U V W X Y Z.
Also, for some reason, this pops into my mind for the hex digits: G B N J F L. These stood for "Great Big Numbers Just For Laughs". |
84,058 | What would the last digit be in a base 11 system? Base 12?
I'm mostly wondering because I was thinking of a base 36 system with digits 0-9 immediately followed by the letters A-Z but I wasn't sure if that would be considered a proper numeral system, or if there was something else in place. | 2011/11/20 | [
"https://math.stackexchange.com/questions/84058",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/19828/"
] | In addition to the standard A-F, etc. for hexadecimal and other systems, [this old Schoolhouse Rock](http://www.youtube.com/watch?v=BblsNzx6yEk) video (which implicitly talks about duodecimal) uses symbols that look an awful lot like the Greek chi ($\chi$) and epsilon ($\epsilon$) for ten and eleven, respectively. | IIRC, on the SWAC at UCLA in the 50's and 60's, the 6 hex digits beyond 9 were U V W X Y Z.
Also, for some reason, this pops into my mind for the hex digits: G B N J F L. These stood for "Great Big Numbers Just For Laughs". |
26,320 | Wordperfect 5.1 (for DOS) doesn't work without modification under Vista. How can I get it to work (as well as possible) under Windows Vista? | 2008/09/16 | [
"https://superuser.com/questions/26320",
"https://superuser.com",
"https://superuser.com/users/23864/"
] | **Run it inside [DOSBox](http://www.dosbox.com/).** That should solve your problems.
Their emulation is quiet decent, they have solved problems with EMS/DOS4GW/whatever etc.
I think it should run any DOS application pretty much OK. | I would suggest creating a Virual Machine running DOS. You can download Virtual PC for free [here](http://www.microsoft.com/windows/downloads/virtualpc/default.mspx). You will need a copy of DOS to do the install. |
26,320 | Wordperfect 5.1 (for DOS) doesn't work without modification under Vista. How can I get it to work (as well as possible) under Windows Vista? | 2008/09/16 | [
"https://superuser.com/questions/26320",
"https://superuser.com",
"https://superuser.com/users/23864/"
] | I would suggest creating a Virual Machine running DOS. You can download Virtual PC for free [here](http://www.microsoft.com/windows/downloads/virtualpc/default.mspx). You will need a copy of DOS to do the install. | Maybe DosBox does work. It works fine with most Dos Games and Programmes. It's free and still beeing improved <http://www.dosbox.com/> |
26,320 | Wordperfect 5.1 (for DOS) doesn't work without modification under Vista. How can I get it to work (as well as possible) under Windows Vista? | 2008/09/16 | [
"https://superuser.com/questions/26320",
"https://superuser.com",
"https://superuser.com/users/23864/"
] | I would suggest creating a Virual Machine running DOS. You can download Virtual PC for free [here](http://www.microsoft.com/windows/downloads/virtualpc/default.mspx). You will need a copy of DOS to do the install. | Also info at <http://www.columbia.edu/~em36/wpdos/vista.html> |
26,320 | Wordperfect 5.1 (for DOS) doesn't work without modification under Vista. How can I get it to work (as well as possible) under Windows Vista? | 2008/09/16 | [
"https://superuser.com/questions/26320",
"https://superuser.com",
"https://superuser.com/users/23864/"
] | **Run it inside [DOSBox](http://www.dosbox.com/).** That should solve your problems.
Their emulation is quiet decent, they have solved problems with EMS/DOS4GW/whatever etc.
I think it should run any DOS application pretty much OK. | Maybe DosBox does work. It works fine with most Dos Games and Programmes. It's free and still beeing improved <http://www.dosbox.com/> |
26,320 | Wordperfect 5.1 (for DOS) doesn't work without modification under Vista. How can I get it to work (as well as possible) under Windows Vista? | 2008/09/16 | [
"https://superuser.com/questions/26320",
"https://superuser.com",
"https://superuser.com/users/23864/"
] | **Run it inside [DOSBox](http://www.dosbox.com/).** That should solve your problems.
Their emulation is quiet decent, they have solved problems with EMS/DOS4GW/whatever etc.
I think it should run any DOS application pretty much OK. | Also info at <http://www.columbia.edu/~em36/wpdos/vista.html> |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | In C++03, `boost::hash`. In C++11, `std::hash`.
```
std::hash<std::string>()("foo");
``` | Boost provides a hash function:
[boost hash](http://www.boost.org/doc/libs/1_47_0/doc/html/hash.html)
```
#include <boost/functional/hash.hpp>
int hashCode()
{
boost::hash<std::string> string_hash;
return string_hash("Hash me");
}
``` |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | The following is the source for the default `String.hashCode()` in Java, this is a trival exercise to implement in C++.
```
public int hashCode()
{
int h = hash;
if (h == 0 && count > 0)
{
int off = offset;
char val[] = value;
int len = count;
for (i... | //For C++ Qt you can use this code, the result is the sames as for Java hashcode()
```
int hashCode(QString text){
int hash = 0, strlen = text.length(), i;
QChar character;
if (strlen == 0)
return hash;
for (i = 0; i < strlen; i++) {
character = text.at(i);
hash = (31 * hash) +... |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | In C++03, `boost::hash`. In C++11, `std::hash`.
```
std::hash<std::string>()("foo");
``` | I encoutered the same question as you have, hope this code will help you :
```
int HashCode (const std::string &str) {
int h = 0;
for (size_t i = 0; i < str.size(); ++i)
h = h * 31 + static_cast<int>(str[i]);
return h;
}
``` |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | Boost provides a hash function:
[boost hash](http://www.boost.org/doc/libs/1_47_0/doc/html/hash.html)
```
#include <boost/functional/hash.hpp>
int hashCode()
{
boost::hash<std::string> string_hash;
return string_hash("Hash me");
}
``` | The following is the source for the default `String.hashCode()` in Java, this is a trival exercise to implement in C++.
```
public int hashCode()
{
int h = hash;
if (h == 0 && count > 0)
{
int off = offset;
char val[] = value;
int len = count;
for (i... |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | In C++03, `boost::hash`. In C++11, `std::hash`.
```
std::hash<std::string>()("foo");
``` | Personally, I like to use boost's hash functions
<http://www.boost.org/doc/libs/1_47_0/doc/html/hash.html>
making a string hash is pretty simple,
```
boost::hash<std::string> string_hash;
std::size_t h = string_hash("Hash me");
```
newer versions of C++ have an equivalent with std::hash |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | In C++03, `boost::hash`. In C++11, `std::hash`.
```
std::hash<std::string>()("foo");
``` | The following is the source for the default `String.hashCode()` in Java, this is a trival exercise to implement in C++.
```
public int hashCode()
{
int h = hash;
if (h == 0 && count > 0)
{
int off = offset;
char val[] = value;
int len = count;
for (i... |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | The following is the source for the default `String.hashCode()` in Java, this is a trival exercise to implement in C++.
```
public int hashCode()
{
int h = hash;
if (h == 0 && count > 0)
{
int off = offset;
char val[] = value;
int len = count;
for (i... | I encoutered the same question as you have, hope this code will help you :
```
int HashCode (const std::string &str) {
int h = 0;
for (size_t i = 0; i < str.size(); ++i)
h = h * 31 + static_cast<int>(str[i]);
return h;
}
``` |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | The following is the source for the default `String.hashCode()` in Java, this is a trival exercise to implement in C++.
```
public int hashCode()
{
int h = hash;
if (h == 0 && count > 0)
{
int off = offset;
char val[] = value;
int len = count;
for (i... | Personally, I like to use boost's hash functions
<http://www.boost.org/doc/libs/1_47_0/doc/html/hash.html>
making a string hash is pretty simple,
```
boost::hash<std::string> string_hash;
std::size_t h = string_hash("Hash me");
```
newer versions of C++ have an equivalent with std::hash |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | I encoutered the same question as you have, hope this code will help you :
```
int HashCode (const std::string &str) {
int h = 0;
for (size_t i = 0; i < str.size(); ++i)
h = h * 31 + static_cast<int>(str[i]);
return h;
}
``` | //For C++ Qt you can use this code, the result is the sames as for Java hashcode()
```
int hashCode(QString text){
int hash = 0, strlen = text.length(), i;
QChar character;
if (strlen == 0)
return hash;
for (i = 0; i < strlen; i++) {
character = text.at(i);
hash = (31 * hash) +... |
8,094,790 | Following java code returns hash code of a string.
```
String uri = "Some URI"
public int hashCode() {
return uri.hashCode();
}
```
I want to translate this code to c++. Is there any function availabe in c++ or an easy way to translate this. | 2011/11/11 | [
"https://Stackoverflow.com/questions/8094790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1040109/"
] | Boost provides a hash function:
[boost hash](http://www.boost.org/doc/libs/1_47_0/doc/html/hash.html)
```
#include <boost/functional/hash.hpp>
int hashCode()
{
boost::hash<std::string> string_hash;
return string_hash("Hash me");
}
``` | Personally, I like to use boost's hash functions
<http://www.boost.org/doc/libs/1_47_0/doc/html/hash.html>
making a string hash is pretty simple,
```
boost::hash<std::string> string_hash;
std::size_t h = string_hash("Hash me");
```
newer versions of C++ have an equivalent with std::hash |
72,240,939 | I am looking to compare two instances of the same class, but only the items for which both are not `None`.
for instance,
I will have a `Bolt` class, and one instance will have:
```
bolt1.locx = 1.0
bolt1.locy = 2.0
bolt1.locz = 3.0
bolt1.rpid = 1234
bolt1.nsid = [1,2,3,4]
bolt2.locx = 1.0
bolt2.locy = 2.0
bolt2.loc... | 2022/05/14 | [
"https://Stackoverflow.com/questions/72240939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12508289/"
] | I would just keep it simple:
```py
class Bolt:
# ...
def __eq__(self, other):
if [self.locx, self.locy, self.locz] != [other.locx, other.locy, other.locz]:
return False
if self.rpid is not None && other.rpid is not None && self.rpid != other.rpid:
return False
i... | I haven't got exactly the requirments for equality but I think that
[`attrgetter`](https://docs.python.org/3/library/operator.html) from `operator` may be useful **for a comparison of instances in a loop**. Here an example of usage:
```
from operator import attrgetter
attrs = ('locx', 'locx', 'locz', 'rpid', 'nsid')
... |
72,240,939 | I am looking to compare two instances of the same class, but only the items for which both are not `None`.
for instance,
I will have a `Bolt` class, and one instance will have:
```
bolt1.locx = 1.0
bolt1.locy = 2.0
bolt1.locz = 3.0
bolt1.rpid = 1234
bolt1.nsid = [1,2,3,4]
bolt2.locx = 1.0
bolt2.locy = 2.0
bolt2.loc... | 2022/05/14 | [
"https://Stackoverflow.com/questions/72240939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12508289/"
] | I would just keep it simple:
```py
class Bolt:
# ...
def __eq__(self, other):
if [self.locx, self.locy, self.locz] != [other.locx, other.locy, other.locz]:
return False
if self.rpid is not None && other.rpid is not None && self.rpid != other.rpid:
return False
i... | Here is a more generic way of doing it that doesn't require to hardcode the attribute comparisons
```
class Bolt:
def __eq__(self, other):
# check if the objects have a different set of attributes
if self.__dict__.keys() != other.__dict__.keys():
return False
for attr, self_attr... |
8,141,287 | I have a VB script that takes in several parameters that could include spaces using cscript, and I make the call using:
```
nsExec::exec 'cscript.exe "$PATH_TO_FILE\program.vbs" "Something with spaces" "Something else"'
```
Now, I want one of the "Something else" strings to include a double quote character, where th... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8141287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834201/"
] | It seems that not exactly but `InetAddress` has some isXX() methods like: `isAnyLocalAddress()` and `isSiteLocalAddress()` | If [InetAddress](http://download.oracle.com/javase/1.4.2/docs/api/java/net/InetAddress.html) doesn't work for you then it should be easy enough to translate following [python code](http://pypi.python.org/packages/source/I/IPy/IPy-0.75.tar.gz) to java:
```
IPv4ranges = {
'0': 'PUBLIC', # fall back
... |
8,141,287 | I have a VB script that takes in several parameters that could include spaces using cscript, and I make the call using:
```
nsExec::exec 'cscript.exe "$PATH_TO_FILE\program.vbs" "Something with spaces" "Something else"'
```
Now, I want one of the "Something else" strings to include a double quote character, where th... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8141287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834201/"
] | It seems that not exactly but `InetAddress` has some isXX() methods like: `isAnyLocalAddress()` and `isSiteLocalAddress()` | I believe Inet4Address.isSiteLocalAddress() is themethod you want. Here is an example:
```
public final class IPFreely
{
public static void main(String[] args)
{
byte[] rawAddress1 =
{ 10, 0, 0, 0 };
byte[] rawAddress2 =
{ 10, 0, 32, 0 };
byte[] rawAddress3 =
{ (... |
8,141,287 | I have a VB script that takes in several parameters that could include spaces using cscript, and I make the call using:
```
nsExec::exec 'cscript.exe "$PATH_TO_FILE\program.vbs" "Something with spaces" "Something else"'
```
Now, I want one of the "Something else" strings to include a double quote character, where th... | 2011/11/15 | [
"https://Stackoverflow.com/questions/8141287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834201/"
] | I believe Inet4Address.isSiteLocalAddress() is themethod you want. Here is an example:
```
public final class IPFreely
{
public static void main(String[] args)
{
byte[] rawAddress1 =
{ 10, 0, 0, 0 };
byte[] rawAddress2 =
{ 10, 0, 32, 0 };
byte[] rawAddress3 =
{ (... | If [InetAddress](http://download.oracle.com/javase/1.4.2/docs/api/java/net/InetAddress.html) doesn't work for you then it should be easy enough to translate following [python code](http://pypi.python.org/packages/source/I/IPy/IPy-0.75.tar.gz) to java:
```
IPv4ranges = {
'0': 'PUBLIC', # fall back
... |
55,202,000 | I am trying to modify a string in my project. The string I am modifying contains a paragraph that the user enters, and I am trying to replace specific occurrences of words(like NOUN/VERB), with the user entered nouns and verbs. Everything is working perfectly, except I am attempting to make the font of the user entered... | 2019/03/16 | [
"https://Stackoverflow.com/questions/55202000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11206017/"
] | ```
$stringParagraph = str_replace('VERB2',
'<span class="highlight">' . $stringSecondVerb . '</span>', $stringParagraph);
```
Then the highlight class can style the replacements with whatever CSS you want, making it easy to change in the future
Also you it's probably worth doing some sanitising on your variables, ... | When you are replacing your tokens, such as `VERB1` with the corresponding values, you want to wrap that value in bold tags. So:
```
$stringParagraph = str_replace('VERB1',
$stringFirstVerb, $stringParagraph);
```
Should be:
```
$stringParagraph = str_replace('VERB1',
"<b>".$stringFirstVerb."</b>", $stringParagra... |
55,202,000 | I am trying to modify a string in my project. The string I am modifying contains a paragraph that the user enters, and I am trying to replace specific occurrences of words(like NOUN/VERB), with the user entered nouns and verbs. Everything is working perfectly, except I am attempting to make the font of the user entered... | 2019/03/16 | [
"https://Stackoverflow.com/questions/55202000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11206017/"
] | ```
$stringParagraph = str_replace('VERB2',
'<span class="highlight">' . $stringSecondVerb . '</span>', $stringParagraph);
```
Then the highlight class can style the replacements with whatever CSS you want, making it easy to change in the future
Also you it's probably worth doing some sanitising on your variables, ... | I really don't really understand your question?
Maybe you want to make an action if the user enters a noun / verb in lowercase the action goes well, but if the user enters a noun / verb with one of the letters inputted by the user the uppercase action fails??
You can use the **strtolower()** function, before you combi... |
23,436 | Yesterday I did put some water with a dissolved soap in an aluminum pan. I think the soap is a Dove like this one: <https://www.dove.com/content/dam/unilever/dove/brazil/portuguese/pack_shot/front/skin_cleansing/skin_cleansing/sabonete_dove_original_90g/fop_original_90g_derm_seal_-_83344562-1147482-png.png.ulenscale.49... | 2020/04/04 | [
"https://lifehacks.stackexchange.com/questions/23436",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/31035/"
] | I would ask you to try using butter (not margarine) to neutralize the residual odour of Dove™ skin cleanser.
The butter is an intermediate step. The concept is that the fats in the butter will bond with the organic base of the "soap" film coating the aluminum pan. When removed, the butter will pull the odour with it. ... | Facial soap like Dove contains oils that adhere to the skin as a surface film, and to the container with which the soap and water mixture has come in contact.
You can remove that film by scrubbing with scouring powder or another soap that does not contain oils- like dishwashing liquid, which is designed to remove oily ... |
23,436 | Yesterday I did put some water with a dissolved soap in an aluminum pan. I think the soap is a Dove like this one: <https://www.dove.com/content/dam/unilever/dove/brazil/portuguese/pack_shot/front/skin_cleansing/skin_cleansing/sabonete_dove_original_90g/fop_original_90g_derm_seal_-_83344562-1147482-png.png.ulenscale.49... | 2020/04/04 | [
"https://lifehacks.stackexchange.com/questions/23436",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/31035/"
] | I would ask you to try using butter (not margarine) to neutralize the residual odour of Dove™ skin cleanser.
The butter is an intermediate step. The concept is that the fats in the butter will bond with the organic base of the "soap" film coating the aluminum pan. When removed, the butter will pull the odour with it. ... | Try using Lemon with Baking soda, it removes the odour from surface.
Coat the pan with the baking powder and then rub it using lemon. Leave it as it is for at least 15-20 min and then wash it. |
1,388,254 | I have never been good at solving recurrence relations. Part of the reason is that I have never found a book that is good at explaining the strategies for solving them; The books just give formulas for solving recurrence relations of specific forms.
So, what books do you recommend to learn how to solve recurrence rela... | 2015/08/07 | [
"https://math.stackexchange.com/questions/1388254",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/226362/"
] | Here I'd like to draw attention to *[The Concrete Tetrahedron](https://www.maa.org/press/maa-reviews/the-concrete-tetrahedron)* by M. Kauers and P. Paule. This book puts the focus on four strongly connected types of mathematical objects
* recurrences
* generating functions
* symbolic sums
* asymptotic estimations
and... | RECURRENCE AND TOPOLOGY,
John M. Alongi,
Gail S. Nelson,
Graduate Studies in Mathematics,Volume 85,
American Mathematical Society.
Providence, Rhode Island.
Publication Year: 2007
ISBN-10: 0-8218-4234-X
ISBN-13: 978-0-8218-4234-8
[www.ams.org/bookpages/gsm-85](http://www.ams.org/bookpages/gsm-85) |
10,199 | Consider a system of many point particles each having a certain mass and electric charge and certain initial velocity. This system is completely governed by the laws of gravitation and electromagnetic field. If this system is left on its own without any external influence, any physical quantity like velocity of a parti... | 2011/05/21 | [
"https://physics.stackexchange.com/questions/10199",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/540/"
] | This would be chemical energy that is converted to heat. The heat from the wick melts the wax which gets absorbed in the wick and then gets burnt (which is really oxidation) to produce heat energy as well as light energy. | The energy transforms from chemical energy to heat and light energy. Because when the candle burns a chemical reaction occurs, and produces heat and light. |
26,433,145 | I have a couple of animations in my app that involve changing the alpha value of different objects. These work great for fading the object in, but they never seem to work for fading to 0.
```
UIView.animateWithDuration(0.4,
delay: 0,
options: .CurveLinear & .AllowUserInteraction & .Begi... | 2014/10/17 | [
"https://Stackoverflow.com/questions/26433145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3746428/"
] | The Python *parser* interprets that as one string. This is well documented in the [Lexical Analysis documentation](https://docs.python.org/2/reference/lexical_analysis.html#string-literal-concatenation):
>
> String literal concatenation
> ----------------------------
>
>
> Multiple adjacent string literals (delimit... | The strings are being concatenated by the python parser before anything is executed, so its not really like `'y' + 'z'` or `''.join('y','z')`, except that it has the same effect. |
16,829,211 | I downloaded `eclipse-juno`, and run it. It was giving error as " A `Java Runtime Environment` (JRE) or `Java Development Kit` (JDK) must be available in order to run `Eclipse`. No Java virtual machine was found after searching the following locations:
```
C:\Program Files\eclipse\jre\bin\javaw.exe javaw.exe in your ... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16829211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2310041/"
] | First of all make sure your Java and Eclipse have the same architecture - they **both** have to be either 32-bit or 64-bit. If that checks out, it should be OK.
I had the same problem: in my case everything was in fact 64-bit - 64-bit OS, 64-bit Eclipse and 64-bit JRE in use, so there was some confusion as to the orig... | Possibly you have installed wrong BIT version of Java on your machine. If your machine is 64 bit, you might have installed 32 bit java only. You can able to view whats your machine architecture by right clicking on computer and say properties.
If your machine is 64 bit machine. Install `64 bit Java, 64 bit Eclipse`. M... |
16,829,211 | I downloaded `eclipse-juno`, and run it. It was giving error as " A `Java Runtime Environment` (JRE) or `Java Development Kit` (JDK) must be available in order to run `Eclipse`. No Java virtual machine was found after searching the following locations:
```
C:\Program Files\eclipse\jre\bin\javaw.exe javaw.exe in your ... | 2013/05/30 | [
"https://Stackoverflow.com/questions/16829211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2310041/"
] | First of all make sure your Java and Eclipse have the same architecture - they **both** have to be either 32-bit or 64-bit. If that checks out, it should be OK.
I had the same problem: in my case everything was in fact 64-bit - 64-bit OS, 64-bit Eclipse and 64-bit JRE in use, so there was some confusion as to the orig... | You can test this solution, maybe works: go to `window->preference->server->runtime environments->and set your server path` **Example**: `tomcat path`.
for set java invironment variable and classpath:try like this:

and in path section:
![enter image... |
45,272,047 | I have following string vector:
```
EC02 502R 603 515 602
KL07 601 511R 505R 506R 503
508 514 501 509R 510 501R
512R 516 507 604 502 601R
SPK01 504 504R ACK01 503R 508R
507R ACK03 513 EC01 506 ECH01
ACK02 SPK02 509 51... | 2017/07/24 | [
"https://Stackoverflow.com/questions/45272047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2927983/"
] | If you have a string vector and want to replace the last `R` character from it you can use `sub`. `$` here ensures that the `R` is the last character in your vector.
```
sub("R$", "", str)
#[1] "EC02" "502" "603" "5RFRS"
```
**data**
```
str <- c("EC02", "502R","603", "5RFRS)
```
I have used `sub` here ins... | ```
lapply( dfrm, function(col_) {gsub( "R","",col_)} )
``` |
45,272,047 | I have following string vector:
```
EC02 502R 603 515 602
KL07 601 511R 505R 506R 503
508 514 501 509R 510 501R
512R 516 507 604 502 601R
SPK01 504 504R ACK01 503R 508R
507R ACK03 513 EC01 506 ECH01
ACK02 SPK02 509 51... | 2017/07/24 | [
"https://Stackoverflow.com/questions/45272047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2927983/"
] | ```
lapply( dfrm, function(col_) {gsub( "R","",col_)} )
``` | If you want to remove *all* occurrences of the specific character at the end of string, you may want to use
```r
x <- c("EC02", "502R", "603RR")
sub("R+$", "", x)
# => [1] "EC02" "502" "603"
trimws(x, which="right", whitespace="R+")
# => [1] "EC02" "502" "603"
```
See the [R demo](https://tio.run/##K/r/v0LBRlchW... |
45,272,047 | I have following string vector:
```
EC02 502R 603 515 602
KL07 601 511R 505R 506R 503
508 514 501 509R 510 501R
512R 516 507 604 502 601R
SPK01 504 504R ACK01 503R 508R
507R ACK03 513 EC01 506 ECH01
ACK02 SPK02 509 51... | 2017/07/24 | [
"https://Stackoverflow.com/questions/45272047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2927983/"
] | If you have a string vector and want to replace the last `R` character from it you can use `sub`. `$` here ensures that the `R` is the last character in your vector.
```
sub("R$", "", str)
#[1] "EC02" "502" "603" "5RFRS"
```
**data**
```
str <- c("EC02", "502R","603", "5RFRS)
```
I have used `sub` here ins... | If you want to remove *all* occurrences of the specific character at the end of string, you may want to use
```r
x <- c("EC02", "502R", "603RR")
sub("R+$", "", x)
# => [1] "EC02" "502" "603"
trimws(x, which="right", whitespace="R+")
# => [1] "EC02" "502" "603"
```
See the [R demo](https://tio.run/##K/r/v0LBRlchW... |
39,792,559 | I have spent way to much time trying to figure this out.... looking a dozens of other answers.
I have table in SQL Server with a column of type `Char(32) NULL`. All items in the table column are only `char(9)`, but I have blanks in the remaining spots (when running `select ascII(right(myField, 1))` there is a 32 in t... | 2016/09/30 | [
"https://Stackoverflow.com/questions/39792559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6904838/"
] | You must distinguish between
* strings with **fixed width** and
* strings with **variable width**.
In your case you are dealing with a fixed width. That means, that the string is always padded to its defined length. *Fixed-width-strings* live together with datetime or int values *within* the row.
If you define your ... | char(32) will occupy all 32 characters.
If you want it to be trimmed and stored, you should use varchar(32).
Try converting your field to varchar. |
21,674,958 | I am working on search functionality for a website designed through umbraco. I am using **Examine** to fetch the search results. Here is my code:
```
var Searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
var searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or)... | 2014/02/10 | [
"https://Stackoverflow.com/questions/21674958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1297239/"
] | I have finally managed to get the values directly from the property.This is the code I have used:
```
List<string> nodesList = new List<string>();
var Searcher = ExamineManager.Instance.SearchProviderCollection["ExternalSearcher"];
var searchCriteria = Searcher.CreateSearchCriteria(BooleanOperation.Or);
... | If you want to costumize your search you need to define a new index set with the properties that you actually want to search on the /config/examineIndex.config file.
Quite well explained in this [post](http://umbraco.com/follow-us/blog-archive/2011/9/16/examining-examine.aspx). |
25,347,009 | I have the following input fields and I would like to have a link above them that uses pure javascript *(ie: no js libraries)* that would remove the commas from all of the input fields.
**Current:**
```
<span id="remove">click to remove commas</span>
<input type="text" name="1" id="1" value="14,22,25,2,26,1,15,8,... | 2014/08/17 | [
"https://Stackoverflow.com/questions/25347009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797620/"
] | [Fiddle](http://jsfiddle.net/fzasvbyb/)
JavaScript:
```
var removeSpan = document.querySelector('#remove');
removeSpan.addEventListener('click', function(e){
[].slice.call(document.querySelectorAll('[type="text"]')).forEach(function(text){
text.value = text.value.replace(/,/g, '')
});
});
``` | You can use [.replace](http://www.w3schools.com/jsref/jsref_replace.asp), like this:
```
var res = str.replace(",", "");
``` |
25,347,009 | I have the following input fields and I would like to have a link above them that uses pure javascript *(ie: no js libraries)* that would remove the commas from all of the input fields.
**Current:**
```
<span id="remove">click to remove commas</span>
<input type="text" name="1" id="1" value="14,22,25,2,26,1,15,8,... | 2014/08/17 | [
"https://Stackoverflow.com/questions/25347009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797620/"
] | [Fiddle](http://jsfiddle.net/fzasvbyb/)
JavaScript:
```
var removeSpan = document.querySelector('#remove');
removeSpan.addEventListener('click', function(e){
[].slice.call(document.querySelectorAll('[type="text"]')).forEach(function(text){
text.value = text.value.replace(/,/g, '')
});
});
``` | To replace all occurrence, try
```
var res=str.replace(/,/g,'');
``` |
25,347,009 | I have the following input fields and I would like to have a link above them that uses pure javascript *(ie: no js libraries)* that would remove the commas from all of the input fields.
**Current:**
```
<span id="remove">click to remove commas</span>
<input type="text" name="1" id="1" value="14,22,25,2,26,1,15,8,... | 2014/08/17 | [
"https://Stackoverflow.com/questions/25347009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797620/"
] | [Fiddle](http://jsfiddle.net/fzasvbyb/)
JavaScript:
```
var removeSpan = document.querySelector('#remove');
removeSpan.addEventListener('click', function(e){
[].slice.call(document.querySelectorAll('[type="text"]')).forEach(function(text){
text.value = text.value.replace(/,/g, '')
});
});
``` | Set a common name for all the inputs, for example, `values`. Then add calling of this method to span's onclick event:
```
function removeCommas() {
var values = document.getElementsByName("values");
for (var i = 0; i < values.length; i++) {
values[i].value = values[i].value.replace(/,/g, '');
}
}
... |
44,247,569 | So, this question has been asked multiple times, but I'm having a hard time applying those solutions to my app.
Models:
```
class User(models.Model):
name = models.CharField(max_length=45)
alias = models.CharField(max_length=45)
email = models.EmailField()
password = models.CharField(max_length=45... | 2017/05/29 | [
"https://Stackoverflow.com/questions/44247569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601105/"
] | ```
public final class SquareImageView extends ImageView {
public SquareImageView(Context context) {
super(context);
}
public SquareImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attr... | GridLayoutManager gives each item same width by default. You gave each image a fixed width and as a result have what you have.
I do not know the sizes of your images but if you change .resize(240,120) to .resize(0,120) you should get desired result.
also your RecyclerView's width and height should be match\_parent. |
46,777,395 | I have a route like this in `routes/api.php`:
```
Route::group(['middleware' => 'auth:api'], function() {
Route::post('messages/{pet}', 'MessageController@store')->middleware('can:create,message');
});
```
We see here that it has implicit `{pet}`.
My controller accesses `{pet}` just fine like this:
`app\Http... | 2017/10/16 | [
"https://Stackoverflow.com/questions/46777395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3791822/"
] | You could use the **request()** helper method.
<https://laravel.com/docs/5.5/helpers#method-request> | The `$request` have a method `has()` for determining if a value is present ([Link](https://laravel.com/docs/5.5/requests#retrieving-input)).
You can alter your method to check if the value exists or its equals to `"PLAIN"`
```
public function create(User $user, Request $request)
{
return !$request->has('kind') || ... |
46,777,395 | I have a route like this in `routes/api.php`:
```
Route::group(['middleware' => 'auth:api'], function() {
Route::post('messages/{pet}', 'MessageController@store')->middleware('can:create,message');
});
```
We see here that it has implicit `{pet}`.
My controller accesses `{pet}` just fine like this:
`app\Http... | 2017/10/16 | [
"https://Stackoverflow.com/questions/46777395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3791822/"
] | Assuming you want create a Pet for a given message, in this case the [implicit model binding](https://laravel.com/docs/5.5/routing#implicit-binding) will not work here because the pet not yet created so finding a pet by the given id will always return null.
In this case laravel offer the possibility to use Actions Tha... | The `$request` have a method `has()` for determining if a value is present ([Link](https://laravel.com/docs/5.5/requests#retrieving-input)).
You can alter your method to check if the value exists or its equals to `"PLAIN"`
```
public function create(User $user, Request $request)
{
return !$request->has('kind') || ... |
46,777,395 | I have a route like this in `routes/api.php`:
```
Route::group(['middleware' => 'auth:api'], function() {
Route::post('messages/{pet}', 'MessageController@store')->middleware('can:create,message');
});
```
We see here that it has implicit `{pet}`.
My controller accesses `{pet}` just fine like this:
`app\Http... | 2017/10/16 | [
"https://Stackoverflow.com/questions/46777395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3791822/"
] | You could use the **request()** helper method.
<https://laravel.com/docs/5.5/helpers#method-request> | use
```
return ( $request->has('kind') )? $request->has('kind') && $request->input('kind') === 'PLAIN': true;
``` |
46,777,395 | I have a route like this in `routes/api.php`:
```
Route::group(['middleware' => 'auth:api'], function() {
Route::post('messages/{pet}', 'MessageController@store')->middleware('can:create,message');
});
```
We see here that it has implicit `{pet}`.
My controller accesses `{pet}` just fine like this:
`app\Http... | 2017/10/16 | [
"https://Stackoverflow.com/questions/46777395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3791822/"
] | Assuming you want create a Pet for a given message, in this case the [implicit model binding](https://laravel.com/docs/5.5/routing#implicit-binding) will not work here because the pet not yet created so finding a pet by the given id will always return null.
In this case laravel offer the possibility to use Actions Tha... | You could use the **request()** helper method.
<https://laravel.com/docs/5.5/helpers#method-request> |
46,777,395 | I have a route like this in `routes/api.php`:
```
Route::group(['middleware' => 'auth:api'], function() {
Route::post('messages/{pet}', 'MessageController@store')->middleware('can:create,message');
});
```
We see here that it has implicit `{pet}`.
My controller accesses `{pet}` just fine like this:
`app\Http... | 2017/10/16 | [
"https://Stackoverflow.com/questions/46777395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3791822/"
] | Assuming you want create a Pet for a given message, in this case the [implicit model binding](https://laravel.com/docs/5.5/routing#implicit-binding) will not work here because the pet not yet created so finding a pet by the given id will always return null.
In this case laravel offer the possibility to use Actions Tha... | use
```
return ( $request->has('kind') )? $request->has('kind') && $request->input('kind') === 'PLAIN': true;
``` |
32,233,253 | I have a table with ID and Dept.
Table is
```
id dept salary date
1 30 2000 8/25/2015 12:06:54.870 PM
2 20 5500 7/12/2015 12:06:54.870 PM
3 30 6700 11/21/2013 12:06:54.870 PM
4 30 8900 4/16/2009 12:06:54.870 PM
5 30 9900 6/29/2014 12:06:54.870 PM
6 10 11... | 2015/08/26 | [
"https://Stackoverflow.com/questions/32233253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2012492/"
] | This is the best way I know. Please do post if anyone knows a better solution:
I have named your table `sal`
```
DECLARE @id INT
, @max INT
, @dep INT
, @all VARCHAR(255)
SELECT @id = 1
, @max = MAX(id)
FROM sal
SELECT * INTO #tmp FROM sal
WHILE (1=1)
BEGIN
SELECT @... | I had similar problem and came up with the following solution:
```
select dept,list(id,',' order by dept) from TableName group by dept
```
Assuming `TableName` is the name of your table. |
32,233,253 | I have a table with ID and Dept.
Table is
```
id dept salary date
1 30 2000 8/25/2015 12:06:54.870 PM
2 20 5500 7/12/2015 12:06:54.870 PM
3 30 6700 11/21/2013 12:06:54.870 PM
4 30 8900 4/16/2009 12:06:54.870 PM
5 30 9900 6/29/2014 12:06:54.870 PM
6 10 11... | 2015/08/26 | [
"https://Stackoverflow.com/questions/32233253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2012492/"
] | A bit simpler solution for those who want this to work for particular query:
```
DECLARE @res_csv VARCHAR(10000)
BEGIN
SELECT SomeIntField INTO #tmp FROM YourTblName WHERE 1=1 -- a hardcoded query
UPDATE #tmp
SET @res_csv = @res_csv + case when @res_csv is not NULL then ',' end + CONVERT(VARCHAR, Som... | I had similar problem and came up with the following solution:
```
select dept,list(id,',' order by dept) from TableName group by dept
```
Assuming `TableName` is the name of your table. |
160,243 | I'm currently working on a problem in which an object's speed remains the same, but it experiences a change in direction after some time. I'm fairly sure it experiences an acceleration in order to change direction.
However, I am confused because of the change in direction.
I want to use the formula $A\_x = \Delta v ... | 2015/01/19 | [
"https://physics.stackexchange.com/questions/160243",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/71039/"
] | >
> I'm fairly sure it experiences an acceleration in order to change direction.
>
>
>
Yes, any change in velocity means an acceleration has occurred. That includes a change in direction of the velocity.
>
> Since the object experiences a change in direction at some point but still travels at the same speed, wou... | That is wrong.
In uniform circular motion you have to use this equation:
$$a=v^2/r $$
where $a$ is the acceleration and
$v$ is the speed and $r$ is radius of the circular path.
You have to know the radius of the circular path because an object with speed 5m/s will have different acceleration in circular paths with dif... |
160,243 | I'm currently working on a problem in which an object's speed remains the same, but it experiences a change in direction after some time. I'm fairly sure it experiences an acceleration in order to change direction.
However, I am confused because of the change in direction.
I want to use the formula $A\_x = \Delta v ... | 2015/01/19 | [
"https://physics.stackexchange.com/questions/160243",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/71039/"
] | >
> I'm fairly sure it experiences an acceleration in order to change direction.
>
>
>
Yes, any change in velocity means an acceleration has occurred. That includes a change in direction of the velocity.
>
> Since the object experiences a change in direction at some point but still travels at the same speed, wou... | You've confused velocity and speed. Speed is independent of direction, and is therefor always positive. For a 2-dimensional analysis, you have to consider the two different components of the velocity, Vx and Vy, but the speed S is $$S=\sqrt{V\_x^2 + V\_y^2}$$
Let's take a version of your example. An object travels alo... |
27,755,752 | I installed `xWebAdministration` module. For some reason I am still getting this error message
>
> The term 'xWebsite' is not recognized as the name of a cmdlet"
>
>
>

image url: [http://i.stack.imgur.com/tTwUe.jpg](https://i.stack.imgur.com/t... | 2015/01/03 | [
"https://Stackoverflow.com/questions/27755752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/817314/"
] | The screenshot is showing you the problem: The `xWebsite` resource isn't installed. Only the `xwebApplication` and `xWebVirtualDirectory` resources are installed.
I just downloaded the `xWebAdministration` 1.3.2.3 zip file from [Technet](https://gallery.technet.microsoft.com/scriptcenter/xWebAdministration-Module-3c8b... | To enact the configuration, run the following command:
```
Start-DscConfiguration -Wait -Verbose -Path .\MvcWebTest
```
This cmdlet is part of the DSC system. The Wait parameter is optional and makes the cmdlet run interactively. Without this parameter, the cmdlet will create and return a job. |
149,491 | If a Bard has concerns that a statue or corpse is actually a dormant construct or an undead, can they cast the Message cantrip, and target the statue/corpse to determine if either is indeed a creature?
The Spell Target is "one creature/level". The Saving Throw & Spell Resistance is "none" and "no". | 2019/06/07 | [
"https://rpg.stackexchange.com/questions/149491",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/36939/"
] | The [*message*](https://www.d20pfsrd.com/magic/all-spells/m/message/) spell doesn't provide feedback
====================================================================================================
A caster doesn't know automatically when he's cast a spell on an invalid target; instead, nothing happens and the spe... | Probably Not
============
A reading of the entry for this spell does not specify that the caster knows if the message is failed to be received, however if the target talked back to you, using its option to do so, it would certainly give it away. The overview rules on magic do not specify that you have any knowledge of... |
56,528,633 | So I'm trying to find a string within a string, now I currently have this constructed in,
```
string str4;
var str5 = " type: '");
foreach (string str6 in response.Split(new char[] { '\n' }))
{
if (str6.StartsWith(str5))
{
str4 = str6.Replace(str5, "").Replace(" ", "").Replace("',", "");
bre... | 2019/06/10 | [
"https://Stackoverflow.com/questions/56528633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11601525/"
] | Here we would simply add optional spaces before and after our desired outputs, e.g., `Example`, and we can start with this expression, for instance:
```
type:(\s+)?'(\s+)?(.+?)(\s+)?',
```
### [Demo](https://regex101.com/r/jNmoP2/1/)
or:
```
type:(\s+)?'(\s+)?(.+?)(\s+)?'
```
if we might have types of `'`, we ... | You can use `.Trim()`, `.TrimStart()` and `.TrimEnd()`. Using Regex looks like extra overhead which you don't really need. |
56,528,633 | So I'm trying to find a string within a string, now I currently have this constructed in,
```
string str4;
var str5 = " type: '");
foreach (string str6 in response.Split(new char[] { '\n' }))
{
if (str6.StartsWith(str5))
{
str4 = str6.Replace(str5, "").Replace(" ", "").Replace("',", "");
bre... | 2019/06/10 | [
"https://Stackoverflow.com/questions/56528633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11601525/"
] | You can use `.Trim()`, `.TrimStart()` and `.TrimEnd()`. Using Regex looks like extra overhead which you don't really need. | If this is just a simple extraction task with very limited variation in inputs, you *can* do it with plain Regex:
```
var response = @"[{
type: 'foo',
something: 'bar',
},
{
type: 'baz',
something: 'bat'
}]";
var types = Regex.Matches(response, @"\s*type\:\s*\'(.+)\'")
.Cast<Match>()
.Select(m => m.Gro... |
56,528,633 | So I'm trying to find a string within a string, now I currently have this constructed in,
```
string str4;
var str5 = " type: '");
foreach (string str6 in response.Split(new char[] { '\n' }))
{
if (str6.StartsWith(str5))
{
str4 = str6.Replace(str5, "").Replace(" ", "").Replace("',", "");
bre... | 2019/06/10 | [
"https://Stackoverflow.com/questions/56528633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11601525/"
] | You can use `.Trim()`, `.TrimStart()` and `.TrimEnd()`. Using Regex looks like extra overhead which you don't really need. | First, if you are going to use Regex try out your regex strings here: <https://regex101.com/>
Second, If you can avoid RegEx, I would advise you to so. If a developer uses regex to solve a problem, now he has two problems. Regex can be tricky if you haven't worked with a lot. Having said that, here's another regex bas... |
56,528,633 | So I'm trying to find a string within a string, now I currently have this constructed in,
```
string str4;
var str5 = " type: '");
foreach (string str6 in response.Split(new char[] { '\n' }))
{
if (str6.StartsWith(str5))
{
str4 = str6.Replace(str5, "").Replace(" ", "").Replace("',", "");
bre... | 2019/06/10 | [
"https://Stackoverflow.com/questions/56528633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11601525/"
] | Here we would simply add optional spaces before and after our desired outputs, e.g., `Example`, and we can start with this expression, for instance:
```
type:(\s+)?'(\s+)?(.+?)(\s+)?',
```
### [Demo](https://regex101.com/r/jNmoP2/1/)
or:
```
type:(\s+)?'(\s+)?(.+?)(\s+)?'
```
if we might have types of `'`, we ... | If this is just a simple extraction task with very limited variation in inputs, you *can* do it with plain Regex:
```
var response = @"[{
type: 'foo',
something: 'bar',
},
{
type: 'baz',
something: 'bat'
}]";
var types = Regex.Matches(response, @"\s*type\:\s*\'(.+)\'")
.Cast<Match>()
.Select(m => m.Gro... |
56,528,633 | So I'm trying to find a string within a string, now I currently have this constructed in,
```
string str4;
var str5 = " type: '");
foreach (string str6 in response.Split(new char[] { '\n' }))
{
if (str6.StartsWith(str5))
{
str4 = str6.Replace(str5, "").Replace(" ", "").Replace("',", "");
bre... | 2019/06/10 | [
"https://Stackoverflow.com/questions/56528633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11601525/"
] | Here we would simply add optional spaces before and after our desired outputs, e.g., `Example`, and we can start with this expression, for instance:
```
type:(\s+)?'(\s+)?(.+?)(\s+)?',
```
### [Demo](https://regex101.com/r/jNmoP2/1/)
or:
```
type:(\s+)?'(\s+)?(.+?)(\s+)?'
```
if we might have types of `'`, we ... | First, if you are going to use Regex try out your regex strings here: <https://regex101.com/>
Second, If you can avoid RegEx, I would advise you to so. If a developer uses regex to solve a problem, now he has two problems. Regex can be tricky if you haven't worked with a lot. Having said that, here's another regex bas... |
97,043 | Why is an antenna is used in this electronic [electroscope circuit](http://amasci.com/emotor/chargdet.html)?
I would like to do this as my mini project. | 2014/01/20 | [
"https://electronics.stackexchange.com/questions/97043",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/35832/"
] | The antenna is used to pick up an electric field (*not* the same thing as a radio signal). It can be any length but I'd expect that the further away from the ground plane of the circuit the "stronger" a field you will get.
The "optional" 1Mohm resistor is really ought to be included otherwise you risk damaging the FET... | it's not really an antenna in the normal sense .... it's a metal so it's a sea of electrons, when there's an electric field around they all get attracted down one end leaving the other end with the opposite charge, since it's connected to the gate of the FET the FET turns on or off, depending on the charge
As mentione... |
97,043 | Why is an antenna is used in this electronic [electroscope circuit](http://amasci.com/emotor/chargdet.html)?
I would like to do this as my mini project. | 2014/01/20 | [
"https://electronics.stackexchange.com/questions/97043",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/35832/"
] | I called it "antenna" in my article, but really it's just one plate of a capacitor.
The second capacitor-plate is the entire JFET source/drain circuit, which is connected to the ground surface ...or the surface of whatever battery is being used.
The input of this JFET circuit is actually a capacitive divider circuit,... | it's not really an antenna in the normal sense .... it's a metal so it's a sea of electrons, when there's an electric field around they all get attracted down one end leaving the other end with the opposite charge, since it's connected to the gate of the FET the FET turns on or off, depending on the charge
As mentione... |
7,226,123 | I have an art site. I need to show related art pieces now. I have 3 tables:
```
art_info : art_id, title
art_tag_relationship : art_id, tag_id
art_tags : tag_id, tag (in text)
```
**I'm trying to get the related art for a given piece of art sorted by most relevant tag matches.**
So now ... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7226123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/887528/"
] | You can select the most relevant art piece, given another art\_id.
```
SELECT
ai.art_id,
ai.title
count(DISTINCT r2.tag_id) as relevance
FROM art_tag_relationship r1
INNER JOIN art_tag_relationship r2 ON (r1.tag_id = r2.tag_id
AND r1.art_id <> r2.art_id)
INNER JOIN a... | Given that the piece of art you are looking at is `art_id = 1000`
```
SELECT
art_info.art_id,
art_info.title
count(*) as Cnt
FROM
art_tag_relationship A1,
art_tag_relationship A2,
art_info
WHERE
A1.art_id = 1000
AND
A1.tag_id = A2.tag_id
AND
A2.art_id = art_info.art_... |
66,258,682 | I have a problem with queries and the whole logic of sql script.
My database has 2 tables. The first "travel" table has many unique trips with many columns. The second table "like" is the likes that exist for each trip as well as the name of the country to which the trip belongs
Now I want to `select * from trips ord... | 2021/02/18 | [
"https://Stackoverflow.com/questions/66258682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10986977/"
] | Based on your code it looks like you're using jquery, rather than just plain javascript.
I've updated your snippet to:
* Run your function based on a button click, rather than as soon as the document is ready
* Find all td's with the word "Hello" using the JQuery `:contains()` selector
* Set a class with the css `vis... | The value of `dataTableText` will never be `"Hello"`. It will be the text value of the complete table. Your `if`-condition is therefore never true.
So this line:
```
$('table tbody').find('td').style.display = "none";
```
is never executed. If it were, it would hide all `<td>`s in the table, regardless of their con... |
66,258,682 | I have a problem with queries and the whole logic of sql script.
My database has 2 tables. The first "travel" table has many unique trips with many columns. The second table "like" is the likes that exist for each trip as well as the name of the country to which the trip belongs
Now I want to `select * from trips ord... | 2021/02/18 | [
"https://Stackoverflow.com/questions/66258682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10986977/"
] | You need to find the correct td to hide, here I have updated your code sippet.
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
... | The value of `dataTableText` will never be `"Hello"`. It will be the text value of the complete table. Your `if`-condition is therefore never true.
So this line:
```
$('table tbody').find('td').style.display = "none";
```
is never executed. If it were, it would hide all `<td>`s in the table, regardless of their con... |
222,843 | I was reading about diodes and I know that they have a certain parasitic capacitance.
Now, according to Wikipedia,
>
> At low frequencies parasitic capacitance can usually be ignored, but
> in high frequency circuits it can be a major problem.
>
>
>
I have trouble understanding what exactly happens, so if you c... | 2016/03/15 | [
"https://electronics.stackexchange.com/questions/222843",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/103697/"
] | Often you want to use a diode to block currents flowing in a certain direction. But the parasitic capacitor will pass high-frequency current signals, regardless of phase.
Often you want to use a diode to provide a high-impedance in normal operation (while providing a path to divert unwanted signals like ESD strikes). ... | You have to realize that all electromagnetic fields are continuous to infinity and operate on the principle of superposition (2 fields interact with each other to make a resultant field) so when you put components in near locations they undergo mutual effects. As boards get smaller the distances get closer. The reality... |
222,843 | I was reading about diodes and I know that they have a certain parasitic capacitance.
Now, according to Wikipedia,
>
> At low frequencies parasitic capacitance can usually be ignored, but
> in high frequency circuits it can be a major problem.
>
>
>
I have trouble understanding what exactly happens, so if you c... | 2016/03/15 | [
"https://electronics.stackexchange.com/questions/222843",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/103697/"
] | Often you want to use a diode to block currents flowing in a certain direction. But the parasitic capacitor will pass high-frequency current signals, regardless of phase.
Often you want to use a diode to provide a high-impedance in normal operation (while providing a path to divert unwanted signals like ESD strikes). ... | At low frequencies capacitors appear as open circuits, which can be ignored. At higher frequencies their impedance starts to decrease, so they can't be ignored any more. This has nothing to do with the diode, it is common to all parasitic capacitors. |
222,843 | I was reading about diodes and I know that they have a certain parasitic capacitance.
Now, according to Wikipedia,
>
> At low frequencies parasitic capacitance can usually be ignored, but
> in high frequency circuits it can be a major problem.
>
>
>
I have trouble understanding what exactly happens, so if you c... | 2016/03/15 | [
"https://electronics.stackexchange.com/questions/222843",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/103697/"
] | You have to realize that all electromagnetic fields are continuous to infinity and operate on the principle of superposition (2 fields interact with each other to make a resultant field) so when you put components in near locations they undergo mutual effects. As boards get smaller the distances get closer. The reality... | At low frequencies capacitors appear as open circuits, which can be ignored. At higher frequencies their impedance starts to decrease, so they can't be ignored any more. This has nothing to do with the diode, it is common to all parasitic capacitors. |
4,518,045 | I have such code:
```
<div style="width:500; height:500;">
<input type="button"/>
</div>
```
how to fit the button to the div's sizes?
if its imposible ny css, i can use js,jquery | 2010/12/23 | [
"https://Stackoverflow.com/questions/4518045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438597/"
] | Make sure you give your width and height of parent container a unit suffix on the value:
```
<div style="width:500px;height:500px;">
<input type="button" style="width:100%;height:100%;"/>
</div>
``` | You can use css for this
```
<input type="button" style="width: 500px; height: 500px;" />
```
Better use a class for that
```
.inpbutton
{
width: 500px;
height: 500px;
}
<input type="button" class="inpbutton" />
``` |
4,518,045 | I have such code:
```
<div style="width:500; height:500;">
<input type="button"/>
</div>
```
how to fit the button to the div's sizes?
if its imposible ny css, i can use js,jquery | 2010/12/23 | [
"https://Stackoverflow.com/questions/4518045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438597/"
] | Make sure you give your width and height of parent container a unit suffix on the value:
```
<div style="width:500px;height:500px;">
<input type="button" style="width:100%;height:100%;"/>
</div>
``` | Untested, but you can start by something like this...
HTML:
```
<div style="width:500; height:500;">
<input class="expand" type="button"/>
</div>
```
JS:
```
$('document').ready(function() {
$('.expand').each(function(i) {
$(this).width($(this).parent().width());
$(this).height($(this).pare... |
4,518,045 | I have such code:
```
<div style="width:500; height:500;">
<input type="button"/>
</div>
```
how to fit the button to the div's sizes?
if its imposible ny css, i can use js,jquery | 2010/12/23 | [
"https://Stackoverflow.com/questions/4518045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438597/"
] | Make sure you give your width and height of parent container a unit suffix on the value:
```
<div style="width:500px;height:500px;">
<input type="button" style="width:100%;height:100%;"/>
</div>
``` | ```
$('document').ready(function() {
$('input[type=button]').each(function(){
$(this).height($(this).parent().height());
$(this).width($(this).parent().width());
});
});
``` |
4,518,045 | I have such code:
```
<div style="width:500; height:500;">
<input type="button"/>
</div>
```
how to fit the button to the div's sizes?
if its imposible ny css, i can use js,jquery | 2010/12/23 | [
"https://Stackoverflow.com/questions/4518045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438597/"
] | Make sure you give your width and height of parent container a unit suffix on the value:
```
<div style="width:500px;height:500px;">
<input type="button" style="width:100%;height:100%;"/>
</div>
``` | If all you need is getting the button to fill out the div why not remove one of the elements, making either the div act as a button by putting whatever action you want on it's onclick, or just setting the button as the main element with a size.
Might be that you need both, but unless there's a reason you need both, th... |
4,518,045 | I have such code:
```
<div style="width:500; height:500;">
<input type="button"/>
</div>
```
how to fit the button to the div's sizes?
if its imposible ny css, i can use js,jquery | 2010/12/23 | [
"https://Stackoverflow.com/questions/4518045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/438597/"
] | Make sure you give your width and height of parent container a unit suffix on the value:
```
<div style="width:500px;height:500px;">
<input type="button" style="width:100%;height:100%;"/>
</div>
``` | Why don't you just put the size on the button instead of the div? The div would automatically take on the correct size, and you'll get a perfect fit, without JS. |
51,327,620 | I'm working on a project where I'm getting a large (70k) array of bytes.
I have to decode it and parse the result properly, based on the data.
Array is built like this:
```
{ header_cells, dataType1, dataType1..., dataType2, dataType2...}
```
Is it the best solution to use here the ByteBuffer?I know all lengths, ... | 2018/07/13 | [
"https://Stackoverflow.com/questions/51327620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2290763/"
] | I'm not an expert on `ggplot2`, but I think you lose the legend because you remove your aesthetic mapping in `geom_bar` with the argument assignment `fill=Palette`. Essentially, your `fill` aesthetic is not just by `Response`, but by a combination of `Response` and `Group`, because each group has a different color for ... | I used the code Zack suggested, and added "guides(fill=guide\_legend(ncol=2))" to it. This is the graph I got
[Revised graph](https://i.stack.imgur.com/5LrOm.png) |
46,941,949 | I'm currently trying to make a variadic templated function named `MakeByte` that will take any number of arguments of bits, and put them into one byte. Here's an example of the usage for it:
```
// The Wii U has 4 RAM chips, here we select a seemingly "random" one using an
// algorithm to generate one from the coordin... | 2017/10/25 | [
"https://Stackoverflow.com/questions/46941949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5719930/"
] | Maybe it's question of personal taste but I prefer to avoid to have two version of the function that are doing the same thing (in this case: shift and or).
I suggest to write the terminal case that simply return a value (no shift, no or)
```
template <typename T1>
constexpr T1 MakeByte_ (T1 byte, quint32)
{ return by... | I worked out a solution thanks to `eracpp` on the Coding Den Discord server, using a [fold expression](http://en.cppreference.com/w/cpp/language/fold):
```
template <typename T1, typename... T2>
constexpr T1 MakeByte(T1 bit, T2... bits)
{
T1 byte = bit;
quint32 pos = 0;
((byte |= ((bits & 1) << ++pos)), ...);
... |
46,941,949 | I'm currently trying to make a variadic templated function named `MakeByte` that will take any number of arguments of bits, and put them into one byte. Here's an example of the usage for it:
```
// The Wii U has 4 RAM chips, here we select a seemingly "random" one using an
// algorithm to generate one from the coordin... | 2017/10/25 | [
"https://Stackoverflow.com/questions/46941949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5719930/"
] | In your case, there are clearly different methods, as
```
quint32 bank_bit_0 = Bit((y / (16 * m_num_pipes)) ^ x_3);
quint32 bank_bit_1 = Bit((y / (8 * m_num_pipes)) ^ x_4);
quint32 bank_bit_2 = Bit((y / (m_num_pipes)) ^ x_5);
quint32 bank = MakeByte(bank_bit_0, bank_bit_1, bank_bit_1);
```
Would call your helper fu... | I worked out a solution thanks to `eracpp` on the Coding Den Discord server, using a [fold expression](http://en.cppreference.com/w/cpp/language/fold):
```
template <typename T1, typename... T2>
constexpr T1 MakeByte(T1 bit, T2... bits)
{
T1 byte = bit;
quint32 pos = 0;
((byte |= ((bits & 1) << ++pos)), ...);
... |
24,696 | I do not allow users to login to my blog, but I would like to enable facebook connect for those who do not want to enter their details in the comments fields all the time. How should I start doing it?
Enable on wordpress settings user logins, when implement facebook comment and thats it? | 2011/08/02 | [
"https://wordpress.stackexchange.com/questions/24696",
"https://wordpress.stackexchange.com",
"https://wordpress.stackexchange.com/users/7552/"
] | Try the new beta version of my Simple Facebook Connect plugin.
<http://plugins.svn.wordpress.org/simple-facebook-connect/branches/new-sfc/>
I prefer this comment implementation over others as mine does not create WordPress users directly from Facebook connected users when just used for commenting. | Use Facebook connect plugin
<http://wordpress.org/extend/plugins/wp-facebookconnect/> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.