qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
30,685,853 | After trying numerous different JVM GC setting and doing a lot of testing where I was having problems with long major GC pauses I'm now testing with G1GC JVM GC. Beside this I'm also collecting data with performance monitor and only applications that is running (beside system services,...) is GlassFish server with my a... | 2015/06/06 | [
"https://Stackoverflow.com/questions/30685853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341206/"
] | There is a loophole for the question you literally asked.
If `int` has (strictly) greater integer conversion rank than `string::size_type` and `int` can store the full range of values of `string::size_type`, then `string::npos == -1` will be false, as both arguments will get promoted to `int`, rather than being promot... | Yes, it is defined as `-1`
[N4296](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf) § 21.4 / 5 provides the class template for `std::basic_string` which includes the line
```
static const size_type npos = -1;
``` |
30,685,853 | After trying numerous different JVM GC setting and doing a lot of testing where I was having problems with long major GC pauses I'm now testing with G1GC JVM GC. Beside this I'm also collecting data with performance monitor and only applications that is running (beside system services,...) is GlassFish server with my a... | 2015/06/06 | [
"https://Stackoverflow.com/questions/30685853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341206/"
] | *NO*, it is not always true. It is however a bit more complicated than it seems at first glance:
In the beginning, let us see what `std::string` is (21.3/1):
>
> The header `<string>` defines the `basic_string` class template for manipulating varying-length sequences
> of char-like objects and four typedefs, `string... | Yes, it is defined as `-1`
[N4296](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf) § 21.4 / 5 provides the class template for `std::basic_string` which includes the line
```
static const size_type npos = -1;
``` |
30,685,853 | After trying numerous different JVM GC setting and doing a lot of testing where I was having problems with long major GC pauses I'm now testing with G1GC JVM GC. Beside this I'm also collecting data with performance monitor and only applications that is running (beside system services,...) is GlassFish server with my a... | 2015/06/06 | [
"https://Stackoverflow.com/questions/30685853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4341206/"
] | *NO*, it is not always true. It is however a bit more complicated than it seems at first glance:
In the beginning, let us see what `std::string` is (21.3/1):
>
> The header `<string>` defines the `basic_string` class template for manipulating varying-length sequences
> of char-like objects and four typedefs, `string... | There is a loophole for the question you literally asked.
If `int` has (strictly) greater integer conversion rank than `string::size_type` and `int` can store the full range of values of `string::size_type`, then `string::npos == -1` will be false, as both arguments will get promoted to `int`, rather than being promot... |
48,727,188 | I have a SQLite method that returns an entire column in String[] form. It crashes only with a single column. I can substitute other columns and it works fine. Here is the method.
```
public String[] getLocationColumn(){
ArrayList<String> arrayList = new ArrayList<>();
String[] column = { KEY_LOCATION };
db.be... | 2018/02/11 | [
"https://Stackoverflow.com/questions/48727188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6592058/"
] | The issue you have is that `getColumnIndex()` can be/is (see comments) case sensitive and thus may return -1 for what should be an acceptable column name.
* ***Clarification of can be/is*** :-
* >
> The Cursor implementation that **ContentResolver** uses does an
> **`equalsIgnoreCase()`** when looking through the co... | try this,and there is no need to start transaction.
```
public String[] getLocationColumn(){
ArrayList<String> arrayList = new ArrayList<>();
String[] column = { KEY_LOCATION };
try{
Cursor c = db.query(TABLE_TRAILS, column, null, null, null, null, null);
if (c != null){
while (c.move... |
49,588,665 | Suppose, I have
```
type,type,type,type,description,description,description.
type,type,type,type,description,description.
```
I want to -
```
type|type|type|type|description,description,description.
type|type|type|type|description,description.
```
Where I have no I idea about the content of the file. Jus... | 2018/03/31 | [
"https://Stackoverflow.com/questions/49588665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Nothing sofisticated but it get's the job done
```
:%norm f,r|;.;.;.
```
### breakdown
```
:%norm start a normal command on all lines
f,r| f(ind) a ',' and r(eplace) with '|'
;.;.;. ';' jumps to next match and '.' repeats the change
``` | I guess it could solve your problem
```
:%s/\v(type)./\1|/g
\v ......... very magic to avoid "\"
(type) ..... group 1
. ........ any char (in our case ,)
\1 ......... back reference to group 1
| .......... literal |
``` |
49,588,665 | Suppose, I have
```
type,type,type,type,description,description,description.
type,type,type,type,description,description.
```
I want to -
```
type|type|type|type|description,description,description.
type|type|type|type|description,description.
```
Where I have no I idea about the content of the file. Jus... | 2018/03/31 | [
"https://Stackoverflow.com/questions/49588665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Nothing sofisticated but it get's the job done
```
:%norm f,r|;.;.;.
```
### breakdown
```
:%norm start a normal command on all lines
f,r| f(ind) a ',' and r(eplace) with '|'
;.;.;. ';' jumps to next match and '.' repeats the change
``` | Use a macro.
Create a macro. Repeat it on all lines. Done. |
22,473,917 | I need to be able to store a type value into a file, and read it back into a type value later. What's the best way to go about this?
```
Type type = typeof(SomeClass);
binaryWriter.Write?(type);
``` | 2014/03/18 | [
"https://Stackoverflow.com/questions/22473917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1871016/"
] | I'd store the [assembly-qualified name](http://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname%28v=vs.110%29.aspx), assuming the assembly will still be present later:
```
binaryWriter.Write(type.AssemblyQualifiedName);
...
string typeName = binaryReader.ReadString();
Type type = Type.GetType(typeNam... | You can also use [`BinaryFormatter`](http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.binary.binaryformatter%28v=vs.110%29.aspx) class:
```
Type t = typeof (SomeClass);
BinaryFormatter serializer = new BinaryFormatter();
using (var stream = File.OpenWrite(filePath))
{
serializer.Ser... |
32,678,241 | I have struggle with this problem for days, not knowing how to solve it.
The scenario is:
There is a string from database as `QUESTION`, and another string as `ANSWER`.
```
$scope.exam = {};
$timeout(function () {
$scope.exam.QUESTION = 'Find the perimeter of a rhombus whose diagonals measure 12 and 16. <br />A.... | 2015/09/20 | [
"https://Stackoverflow.com/questions/32678241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1686094/"
] | at last i found the answer:
API 23 (android 6.o) required different type of permission.....
<http://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en> | Permission name is READ\_SMS it seems you are using SMS\_READ. |
32,678,241 | I have struggle with this problem for days, not knowing how to solve it.
The scenario is:
There is a string from database as `QUESTION`, and another string as `ANSWER`.
```
$scope.exam = {};
$timeout(function () {
$scope.exam.QUESTION = 'Find the perimeter of a rhombus whose diagonals measure 12 and 16. <br />A.... | 2015/09/20 | [
"https://Stackoverflow.com/questions/32678241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1686094/"
] | at last i found the answer:
API 23 (android 6.o) required different type of permission.....
<http://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en> | Just update here -if you want to use READ\_SMS permission then you request Google with declaration why your app needs this permission, then they give access to your app. read this [support.google.com/googleplay/android-developer/answer/9214102](https://support.google.com/googleplay/android-developer/answer/9214102) |
39,958,745 | For example, I'd like to load data from the DB, based on some filter, convert(map) it to some objects, limit the data and collect it to a list:
```
List<Person> people = new DbStream("PERSON").filter(...).limit(20l).map(...).collect(...);
```
Can I do it against a DB, using the stream API (probably with JDBC unseen ... | 2016/10/10 | [
"https://Stackoverflow.com/questions/39958745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/435605/"
] | You can do it by using an external library called [Speedment](https://github.com/speedment/speedment). They allow you to generate code from your database's metadata, and then use the generated classes to stream over the database's tables.
In this example, we use a database Users which have three fields:
```
---------... | ### Doing exactly what you need to do
An interesting library that does what you're looking to do is [JINQ](http://www.jinq.org), which performs *symbolic bytecode execution* to translate ordinary Java code to SQL / JPQL or jOOQ queries. Here's an example taken from the documentation:
```
cityStream
.where( c -> c.... |
26,969,446 | I have a windows-form application, with pages in it.
Short and simple question;
How to I check wether the Page-UP or Page-Down key is pressed when in the windows-form?
The purpose of this is, so that I can go through the pages by clicking one of those 2 buttons. | 2014/11/17 | [
"https://Stackoverflow.com/questions/26969446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4011386/"
] | Set [KeyPreview](http://msdn.microsoft.com/en-us/library/system.windows.forms.form.keypreview(v=vs.110).aspx) property on your form. And add form key down event handler:
```
private void form_KeyDown(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.PageUp)
//do something on page up
if(e.KeyCode == Key... | You should override `ProcessCmdKey` method
```
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) {
if (keyData == Keys.PageUp) {
MessageBox.Show("Pressed PageUp");
return true;
}
if (keyData == Keys.PageDown) {
MessageBox.Show("Pressed Page... |
7,423,841 | In my application, I am often creating new Views and ViewModels, but persisting the same Models. For example, I might show a simple view of a list of items in my main window, and have another window with further details of any particular item. The detail window can be opened and closed at any time, or multiple windows ... | 2011/09/14 | [
"https://Stackoverflow.com/questions/7423841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/244342/"
] | At first I thought this would be the way to go:
```
public class DetailViewModel : IDisposable
{
public DetailViewModel(MyDetailModel detailModel)
{
// Retain the Detail Model
this.model = detailModel;
// Handle changes to the Model not coming from this ViewModel
this.model.Pr... | You may want to consider using a [Weak Event Pattern](http://msdn.microsoft.com/en-us/library/aa970850.aspx). I believe that Microsoft introduced `WeakEventManager` and `IWeakEventListener` to solve this exact garbage collection issue. |
7,423,841 | In my application, I am often creating new Views and ViewModels, but persisting the same Models. For example, I might show a simple view of a list of items in my main window, and have another window with further details of any particular item. The detail window can be opened and closed at any time, or multiple windows ... | 2011/09/14 | [
"https://Stackoverflow.com/questions/7423841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/244342/"
] | At first I thought this would be the way to go:
```
public class DetailViewModel : IDisposable
{
public DetailViewModel(MyDetailModel detailModel)
{
// Retain the Detail Model
this.model = detailModel;
// Handle changes to the Model not coming from this ViewModel
this.model.Pr... | I'm a big fan of using `IDisposable` for this kind of thing. In fact, you can get excellent results using a `CompositeDisposable` to handle all of your clean-up needs.
Here's what I do:
```
public class DetailViewModel : IDisposable
{
private readonly CompositeDisposable _disposables
= new CompositeDispos... |
7,423,841 | In my application, I am often creating new Views and ViewModels, but persisting the same Models. For example, I might show a simple view of a list of items in my main window, and have another window with further details of any particular item. The detail window can be opened and closed at any time, or multiple windows ... | 2011/09/14 | [
"https://Stackoverflow.com/questions/7423841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/244342/"
] | At first I thought this would be the way to go:
```
public class DetailViewModel : IDisposable
{
public DetailViewModel(MyDetailModel detailModel)
{
// Retain the Detail Model
this.model = detailModel;
// Handle changes to the Model not coming from this ViewModel
this.model.Pr... | I'm following on the answer of [IAbstract](https://stackoverflow.com/a/7424261/7167572), the WPF got this implemented directly via `PropertyChangedEventManager`, more can be found [there](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.propertychangedeventmanager).
The final code might look like:
`... |
7,423,841 | In my application, I am often creating new Views and ViewModels, but persisting the same Models. For example, I might show a simple view of a list of items in my main window, and have another window with further details of any particular item. The detail window can be opened and closed at any time, or multiple windows ... | 2011/09/14 | [
"https://Stackoverflow.com/questions/7423841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/244342/"
] | I'm a big fan of using `IDisposable` for this kind of thing. In fact, you can get excellent results using a `CompositeDisposable` to handle all of your clean-up needs.
Here's what I do:
```
public class DetailViewModel : IDisposable
{
private readonly CompositeDisposable _disposables
= new CompositeDispos... | You may want to consider using a [Weak Event Pattern](http://msdn.microsoft.com/en-us/library/aa970850.aspx). I believe that Microsoft introduced `WeakEventManager` and `IWeakEventListener` to solve this exact garbage collection issue. |
7,423,841 | In my application, I am often creating new Views and ViewModels, but persisting the same Models. For example, I might show a simple view of a list of items in my main window, and have another window with further details of any particular item. The detail window can be opened and closed at any time, or multiple windows ... | 2011/09/14 | [
"https://Stackoverflow.com/questions/7423841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/244342/"
] | You may want to consider using a [Weak Event Pattern](http://msdn.microsoft.com/en-us/library/aa970850.aspx). I believe that Microsoft introduced `WeakEventManager` and `IWeakEventListener` to solve this exact garbage collection issue. | I'm following on the answer of [IAbstract](https://stackoverflow.com/a/7424261/7167572), the WPF got this implemented directly via `PropertyChangedEventManager`, more can be found [there](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.propertychangedeventmanager).
The final code might look like:
`... |
7,423,841 | In my application, I am often creating new Views and ViewModels, but persisting the same Models. For example, I might show a simple view of a list of items in my main window, and have another window with further details of any particular item. The detail window can be opened and closed at any time, or multiple windows ... | 2011/09/14 | [
"https://Stackoverflow.com/questions/7423841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/244342/"
] | I'm a big fan of using `IDisposable` for this kind of thing. In fact, you can get excellent results using a `CompositeDisposable` to handle all of your clean-up needs.
Here's what I do:
```
public class DetailViewModel : IDisposable
{
private readonly CompositeDisposable _disposables
= new CompositeDispos... | I'm following on the answer of [IAbstract](https://stackoverflow.com/a/7424261/7167572), the WPF got this implemented directly via `PropertyChangedEventManager`, more can be found [there](https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.propertychangedeventmanager).
The final code might look like:
`... |
254,750 | If software can be built to recognize faces and match those faces to names, then how is that CAPTCHA works? Recognizing letters seems a lot easier than matching faces. | 2014/08/28 | [
"https://softwareengineering.stackexchange.com/questions/254750",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/57479/"
] | Captcha doesn't always work; hackers use ever more sophisticated techniques to try and defeat it. In response, Captcha systems distort the letters in some way to confound those techniques, either by twisting the letters, putting a line through them, reversing the background and foreground colors randomly, and so on.
!... | It all comes down to recognizing patterns. Facial recognition works by [recognizing patterns](http://resources.infosecinstitute.com/wp-content/uploads/111212_1754_Chapter12Ap5.jpg) (distance ratios) of facial features, as well as shadows. These ratios are looked up in a database to try and match an actual face - this i... |
80,383 | Expanding on several questions asked 10 years ago on Stack Overflow, I'd like to elaborate what's the best CSV Viewer Editor in 2021.
**What makes a good viewer (for me):**
* Displays CSV in Grid view, not as plain text (as it would be in Notepad++)
* Has CSV centric features, like skipping the first x rows, define h... | 2021/08/30 | [
"https://softwarerecs.stackexchange.com/questions/80383",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/76720/"
] | I like [OpenRefine](https://openrefine.org/).
According to the documentation :
OpenRefine is a Java-based power tool that allows you to load data, understand it, clean it up, reconcile it, and augment it with data coming from the web. All from a web browser and the comfort and privacy of your own computer.
TSV, CSV,... | [LibreOffice](https://www.libreoffice.org/discover/calc/) would check all your boxes I suppose. |
80,383 | Expanding on several questions asked 10 years ago on Stack Overflow, I'd like to elaborate what's the best CSV Viewer Editor in 2021.
**What makes a good viewer (for me):**
* Displays CSV in Grid view, not as plain text (as it would be in Notepad++)
* Has CSV centric features, like skipping the first x rows, define h... | 2021/08/30 | [
"https://softwarerecs.stackexchange.com/questions/80383",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/76720/"
] | [AlternativeTo.Net](https://alternativeto.net/software/csved/?license=opensource) lists a bunch of alternatives to *CSVed* but they all seem to be VERY VERY unmaintained/outdated.
Since you mentioned Notepad++, There is a maintained plugin for it called [CsvQuery](https://github.com/jokedst/CsvQuery)
Although you spe... | [LibreOffice](https://www.libreoffice.org/discover/calc/) would check all your boxes I suppose. |
80,383 | Expanding on several questions asked 10 years ago on Stack Overflow, I'd like to elaborate what's the best CSV Viewer Editor in 2021.
**What makes a good viewer (for me):**
* Displays CSV in Grid view, not as plain text (as it would be in Notepad++)
* Has CSV centric features, like skipping the first x rows, define h... | 2021/08/30 | [
"https://softwarerecs.stackexchange.com/questions/80383",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/76720/"
] | I like [OpenRefine](https://openrefine.org/).
According to the documentation :
OpenRefine is a Java-based power tool that allows you to load data, understand it, clean it up, reconcile it, and augment it with data coming from the web. All from a web browser and the comfort and privacy of your own computer.
TSV, CSV,... | [AlternativeTo.Net](https://alternativeto.net/software/csved/?license=opensource) lists a bunch of alternatives to *CSVed* but they all seem to be VERY VERY unmaintained/outdated.
Since you mentioned Notepad++, There is a maintained plugin for it called [CsvQuery](https://github.com/jokedst/CsvQuery)
Although you spe... |
95,649 | I am troubleshooting an installer problem where it's giving an error writing to a registry key. So when I use the Registry Editor (regedit) to create the same key under
```
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
```
I get the following error:
>
> Cannot create key: Error writing to the regi... | 2010/01/14 | [
"https://superuser.com/questions/95649",
"https://superuser.com",
"https://superuser.com/users/2108/"
] | The computer seems to be screwy. This happened after a Windows update which failed. I did a whole backup and it works now. | Try running `C:\Windows\System32\regedt32.exe` using Run As credentials of the built-in administrator account. Note that some (few) registry keys mostly related to system can be modified only be the built-in administrator account.
Also if you are on your company network, it could be a group policy that may be prevent... |
95,649 | I am troubleshooting an installer problem where it's giving an error writing to a registry key. So when I use the Registry Editor (regedit) to create the same key under
```
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
```
I get the following error:
>
> Cannot create key: Error writing to the regi... | 2010/01/14 | [
"https://superuser.com/questions/95649",
"https://superuser.com",
"https://superuser.com/users/2108/"
] | Try running `C:\Windows\System32\regedt32.exe` using Run As credentials of the built-in administrator account. Note that some (few) registry keys mostly related to system can be modified only be the built-in administrator account.
Also if you are on your company network, it could be a group policy that may be prevent... | The EventLog is a virtualized part of the registry that cannot be written to by users. It's there so the system can log what's going on for diagnostic purposes when stuff goes wrong (e.g. during a crash).
You're not allowed to write stuff because that might that might confuse someone who has to fix problems later, an... |
95,649 | I am troubleshooting an installer problem where it's giving an error writing to a registry key. So when I use the Registry Editor (regedit) to create the same key under
```
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
```
I get the following error:
>
> Cannot create key: Error writing to the regi... | 2010/01/14 | [
"https://superuser.com/questions/95649",
"https://superuser.com",
"https://superuser.com/users/2108/"
] | Try running `C:\Windows\System32\regedt32.exe` using Run As credentials of the built-in administrator account. Note that some (few) registry keys mostly related to system can be modified only be the built-in administrator account.
Also if you are on your company network, it could be a group policy that may be prevent... | The best is to run regedit with the **Sysinternals** `PsExec` to give you the rights to access and modify these keys:
Somethings like this in a shortcut:
```
"c:\Program Files\PsExec\psexec" -i -d -s c:\windows\regedit.exe
```
This command works for example with legacy registry keys ("normally" undeletables...)
*S... |
95,649 | I am troubleshooting an installer problem where it's giving an error writing to a registry key. So when I use the Registry Editor (regedit) to create the same key under
```
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
```
I get the following error:
>
> Cannot create key: Error writing to the regi... | 2010/01/14 | [
"https://superuser.com/questions/95649",
"https://superuser.com",
"https://superuser.com/users/2108/"
] | The computer seems to be screwy. This happened after a Windows update which failed. I did a whole backup and it works now. | The EventLog is a virtualized part of the registry that cannot be written to by users. It's there so the system can log what's going on for diagnostic purposes when stuff goes wrong (e.g. during a crash).
You're not allowed to write stuff because that might that might confuse someone who has to fix problems later, an... |
95,649 | I am troubleshooting an installer problem where it's giving an error writing to a registry key. So when I use the Registry Editor (regedit) to create the same key under
```
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
```
I get the following error:
>
> Cannot create key: Error writing to the regi... | 2010/01/14 | [
"https://superuser.com/questions/95649",
"https://superuser.com",
"https://superuser.com/users/2108/"
] | The computer seems to be screwy. This happened after a Windows update which failed. I did a whole backup and it works now. | The best is to run regedit with the **Sysinternals** `PsExec` to give you the rights to access and modify these keys:
Somethings like this in a shortcut:
```
"c:\Program Files\PsExec\psexec" -i -d -s c:\windows\regedit.exe
```
This command works for example with legacy registry keys ("normally" undeletables...)
*S... |
44,989 | In the episode [The Climb (S03E06)](http://www.imdb.com/title/tt2178812/), Loras Tyrell is talking to Sansa Stark about their pending wedding, and he says:
>
> I've dreamed of a large wedding since I was quite young. The guests, the food, the tournaments. ... And the bride, of course! The most beautiful bride in the ... | 2013/11/15 | [
"https://scifi.stackexchange.com/questions/44989",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/2912/"
] | Lol at all these weird answers trying to blame the writers or coming up with elaborate explanations.
To put it simply, you misheard the scene. He says "Fringed Sleeves" not French Sleeves. | *A Song of Ice and Fire* takes place in a fictional world. Obviously they don't speak English there, and if they were written in the language of the place nobody on Earth would understand it. Therefore the books are 'translated'. When a concept or an object is mentioned, the name in English will have to be be used.
If... |
45,612,446 | I'm designing a database where I have a number of products, each of which belongs to one and only one category.
Products are meant to be tagged, but only with tags allowed for the category they belong to.
This is what I've got so far:
[](https://i.stack.imgur.c... | 2017/08/10 | [
"https://Stackoverflow.com/questions/45612446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1335076/"
] | I was able to do the following in Oracle. Note how the last insert fails, I believe this is what you are after.
```
CREATE TABLE product (
id INTEGER NOT NULL,
category_id INTEGER NOT NULL,
PRIMARY KEY ( id ),
CONSTRAINT uq_prod_cat UNIQUE ( id,category_id )
);
INSERT INTO product (
i... | My answer is pretty similar to that of [Ashuntosh A](https://stackoverflow.com/users/5945498/ashutosh-a), except that I would create a separate table for associating tags with categories, so that the schema allows for a tag to apply to more one category (e.g. both a tablet and phone could have a DualSim):
[![diagram]... |
5,137,594 | I am having a specific problem with the JS event "onclick" and how it works in a very specific case. I have a set of nested DIVs that looks like this (somewhat):
In code:
```
<div id="A" ...>
<div id="B" ...> </div>
<div id="C" ...> </div>
</div>
```
The exact position of the DIVs are arbitrary, just kno... | 2011/02/28 | [
"https://Stackoverflow.com/questions/5137594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/380213/"
] | If the `onclick` is on `A`, then `this` in the handler will represent that element.
```
document.getElementById('A').onclick = function() {
// "this" is the A element
alert( this.id ); // alert the ID attribute of the element
};
``` | Well, `div`s don't have a name per se in HTML4. They can have a title, though. In JS without a framework, you could get the title this way:
```
document.getElementById("A").onclick = function() {
alert(this.title);
}
```
This appears to work well in my tests. |
5,137,594 | I am having a specific problem with the JS event "onclick" and how it works in a very specific case. I have a set of nested DIVs that looks like this (somewhat):
In code:
```
<div id="A" ...>
<div id="B" ...> </div>
<div id="C" ...> </div>
</div>
```
The exact position of the DIVs are arbitrary, just kno... | 2011/02/28 | [
"https://Stackoverflow.com/questions/5137594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/380213/"
] | Well, `div`s don't have a name per se in HTML4. They can have a title, though. In JS without a framework, you could get the title this way:
```
document.getElementById("A").onclick = function() {
alert(this.title);
}
```
This appears to work well in my tests. | You can use Patrick's solution provided you attach the listener as a property of the element.
If you use IE's attachEvent method, it will not work as it doesn't set the listener's this keyword to the element when called. There are numerous work arounds for that. IE 9 introduces addEventListener, hopefully with the th... |
5,137,594 | I am having a specific problem with the JS event "onclick" and how it works in a very specific case. I have a set of nested DIVs that looks like this (somewhat):
In code:
```
<div id="A" ...>
<div id="B" ...> </div>
<div id="C" ...> </div>
</div>
```
The exact position of the DIVs are arbitrary, just kno... | 2011/02/28 | [
"https://Stackoverflow.com/questions/5137594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/380213/"
] | If the `onclick` is on `A`, then `this` in the handler will represent that element.
```
document.getElementById('A').onclick = function() {
// "this" is the A element
alert( this.id ); // alert the ID attribute of the element
};
``` | You can use Patrick's solution provided you attach the listener as a property of the element.
If you use IE's attachEvent method, it will not work as it doesn't set the listener's this keyword to the element when called. There are numerous work arounds for that. IE 9 introduces addEventListener, hopefully with the th... |
26,065,456 | I made a function in js which calculates the average of 5 numbers and stores it in a variable.
for example, if i have the variable
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
It gives me this answer : 0.37999999999999995.
I need the length of the answer to be only 3 or 4. Please help me resolve this probl... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26065456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4024127/"
] | ```
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
avg.toFixed(3);
```
limits the length to only show 3 numbers after the decimal point. | **EDIT: You can also use [.toFixed(n)](http://www.w3schools.com/jsref/jsref_tofixed.asp) see Answer below**
Greetings,... |
26,065,456 | I made a function in js which calculates the average of 5 numbers and stores it in a variable.
for example, if i have the variable
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
It gives me this answer : 0.37999999999999995.
I need the length of the answer to be only 3 or 4. Please help me resolve this probl... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26065456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4024127/"
] | I'm not sure about what you want to do
To limit the total length with **[toPrecision(n)](http://www.w3schools.com/jsref/jsref_toprecision.asp)**:
```
var num = new Number(14.12);
console.log(num.toPrecision(2));//outputs 14
console.log(num.toPrecision(3));//outputs 14.1
console.log(num.toPrecision(4));//outputs 14.12... | **EDIT: You can also use [.toFixed(n)](http://www.w3schools.com/jsref/jsref_tofixed.asp) see Answer below**
Greetings,... |
26,065,456 | I made a function in js which calculates the average of 5 numbers and stores it in a variable.
for example, if i have the variable
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
It gives me this answer : 0.37999999999999995.
I need the length of the answer to be only 3 or 4. Please help me resolve this probl... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26065456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4024127/"
] | I think you need:
```
parseFloat(avg.toFixed(3));
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
avg = parseFloat(avg.toFixed(3));
alert(avg);
``` | **EDIT: You can also use [.toFixed(n)](http://www.w3schools.com/jsref/jsref_tofixed.asp) see Answer below**
Greetings,... |
26,065,456 | I made a function in js which calculates the average of 5 numbers and stores it in a variable.
for example, if i have the variable
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
It gives me this answer : 0.37999999999999995.
I need the length of the answer to be only 3 or 4. Please help me resolve this probl... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26065456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4024127/"
] | ```
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
avg.toFixed(3);
```
limits the length to only show 3 numbers after the decimal point. | I'm not sure about what you want to do
To limit the total length with **[toPrecision(n)](http://www.w3schools.com/jsref/jsref_toprecision.asp)**:
```
var num = new Number(14.12);
console.log(num.toPrecision(2));//outputs 14
console.log(num.toPrecision(3));//outputs 14.1
console.log(num.toPrecision(4));//outputs 14.12... |
26,065,456 | I made a function in js which calculates the average of 5 numbers and stores it in a variable.
for example, if i have the variable
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
It gives me this answer : 0.37999999999999995.
I need the length of the answer to be only 3 or 4. Please help me resolve this probl... | 2014/09/26 | [
"https://Stackoverflow.com/questions/26065456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4024127/"
] | ```
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
avg.toFixed(3);
```
limits the length to only show 3 numbers after the decimal point. | I think you need:
```
parseFloat(avg.toFixed(3));
var avg = (0.18 + 0.18 + 0.19 + 0.21 + 1.14)/5;
avg = parseFloat(avg.toFixed(3));
alert(avg);
``` |
14,998,932 | I need to parse the following xml but when I use my code it just read the first p tags, I know its a simple loop but I am confused.
```
<s>
<j u="here1"/>
<p v="here1_1"/>
<p v="here1_2"/>
<p v="here1_3"/>
<p v="here1_4"/>
<p v="here1_5"/>
<p v="here1_6"/>
</s>
<s>
<j u="here2" />
<p v="here2_1... | 2013/02/21 | [
"https://Stackoverflow.com/questions/14998932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Maybe something like this?
```
$xml = simplexml_load_string($myXml);
foreach ($xml->s as $tags) foreach ($tags as $tag) {
echo $tag->attributes()->u . " "; // $tag['u'] you can access attributes like this too
echo $tag->attributes()->v . " "; // $tag['v']
}
```
This should give you
```
here1
here1_1
here1_... | since there are multiple p tags you need to loop through p tags
```
$xml = simplexml_load_string($myXml);
foreach ($xml->s as $tags) {
echo $tags->j->attributes()->u . " ";
foreach($tags->p as $ptags){
echo $ptags->attributes()->v . " ";
}
}
``` |
15,533,493 | Im trying to reverse a string in place.
```
void reverseStr(char *str)
{
int i;
int length;
int last_pos;
length = strlen(str);
last_pos = length-1;
for(i = 0; i < length / 2; i++)
{
char tmp = str[i];
str[i] = str[last_pos - i];
str[last_pos - i] = tmp;
}
}
Program received signal SIGSEGV, Segmenta... | 2013/03/20 | [
"https://Stackoverflow.com/questions/15533493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2192545/"
] | The code in `reverseStr` is fine, the problem is in the calling code. You almost certainly are passing a string literal or some other read-only memory to the function.
Most likely your calling code is:
```
char *str = "my string";//str points to a literal which cannot be modified
reverseStr(str);
```
But you need ... | You are passing a string literal to your function. String literals are non modifiable in C.
```
char *p = "this string is non modifiable";
reverseStr(p); // undefined behavior
```
Use an array initialized by a string instead:
```
char p[] = "this string is modifiable";
reverseStr(p); // OK
``` |
15,533,493 | Im trying to reverse a string in place.
```
void reverseStr(char *str)
{
int i;
int length;
int last_pos;
length = strlen(str);
last_pos = length-1;
for(i = 0; i < length / 2; i++)
{
char tmp = str[i];
str[i] = str[last_pos - i];
str[last_pos - i] = tmp;
}
}
Program received signal SIGSEGV, Segmenta... | 2013/03/20 | [
"https://Stackoverflow.com/questions/15533493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2192545/"
] | The code in `reverseStr` is fine, the problem is in the calling code. You almost certainly are passing a string literal or some other read-only memory to the function.
Most likely your calling code is:
```
char *str = "my string";//str points to a literal which cannot be modified
reverseStr(str);
```
But you need ... | It depends on how you are calling this function.
* If you're passing an address of a string constant (definition of type {char \*str = "String"} are called as string constants. Ans string constants are put into .rodata section in executable file), then you'll receive exception.
* If you're passing an address of array,... |
15,533,493 | Im trying to reverse a string in place.
```
void reverseStr(char *str)
{
int i;
int length;
int last_pos;
length = strlen(str);
last_pos = length-1;
for(i = 0; i < length / 2; i++)
{
char tmp = str[i];
str[i] = str[last_pos - i];
str[last_pos - i] = tmp;
}
}
Program received signal SIGSEGV, Segmenta... | 2013/03/20 | [
"https://Stackoverflow.com/questions/15533493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2192545/"
] | You are passing a string literal to your function. String literals are non modifiable in C.
```
char *p = "this string is non modifiable";
reverseStr(p); // undefined behavior
```
Use an array initialized by a string instead:
```
char p[] = "this string is modifiable";
reverseStr(p); // OK
``` | It depends on how you are calling this function.
* If you're passing an address of a string constant (definition of type {char \*str = "String"} are called as string constants. Ans string constants are put into .rodata section in executable file), then you'll receive exception.
* If you're passing an address of array,... |
51,891,789 | I have two multi dimensional array.If the key is same then i want to get the sum how do i do that.
one is-
```
Array
(
[2018-08-02] => Array
(
[male] => 1
[female] => 0
)
[2018-08-07] => Array
(
[male] => 1
[female] => 0
)
[20... | 2018/08/17 | [
"https://Stackoverflow.com/questions/51891789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9116669/"
] | Here is your code,
```
<?php
function pr($arr = [])
{
echo "<pre>";
print_r($arr);
echo "</pre>";
}
$arr1 = array
(
"2018-08-02" => array
(
"male" => 1,
"female" => 0,
),
"2018-08-07" => array
(
"male" => 1,
"female" => 0,
),
"2018-08-09... | You can use array\_intersect\_key() to check if there is a matching results to add them.
for example, Let's assume your two arrays are $array1 and $array2. Then you can use
```
$result = array_intersect_key($array1, $array2);
```
This will return intersection in an array. So you can identify which keys have (in you... |
51,891,789 | I have two multi dimensional array.If the key is same then i want to get the sum how do i do that.
one is-
```
Array
(
[2018-08-02] => Array
(
[male] => 1
[female] => 0
)
[2018-08-07] => Array
(
[male] => 1
[female] => 0
)
[20... | 2018/08/17 | [
"https://Stackoverflow.com/questions/51891789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9116669/"
] | Here is your code,
```
<?php
function pr($arr = [])
{
echo "<pre>";
print_r($arr);
echo "</pre>";
}
$arr1 = array
(
"2018-08-02" => array
(
"male" => 1,
"female" => 0,
),
"2018-08-07" => array
(
"male" => 1,
"female" => 0,
),
"2018-08-09... | You can use [array\_merge\_recursive](http://php.net/manual/en/function.array-merge-recursive.php) to join arrrays and then sum sub-arrays in the result array
```
$res = array_merge_recursive($arr1, $arr2);
foreach($res as &$date) {
foreach($date as &$sex) {
$sex = array_sum((array) $sex);
... |
51,891,789 | I have two multi dimensional array.If the key is same then i want to get the sum how do i do that.
one is-
```
Array
(
[2018-08-02] => Array
(
[male] => 1
[female] => 0
)
[2018-08-07] => Array
(
[male] => 1
[female] => 0
)
[20... | 2018/08/17 | [
"https://Stackoverflow.com/questions/51891789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9116669/"
] | Here is your code,
```
<?php
function pr($arr = [])
{
echo "<pre>";
print_r($arr);
echo "</pre>";
}
$arr1 = array
(
"2018-08-02" => array
(
"male" => 1,
"female" => 0,
),
"2018-08-07" => array
(
"male" => 1,
"female" => 0,
),
"2018-08-09... | You simply need to iterate the 2nd array and determine whether or not the date keys exist in the 1st array. `isset()` is the best / most efficient way to run that check.
If a date from the 2nd array does not yet exist in the first, you can simply store the row's data to the 1st array. If the date already exists in the... |
880,763 | A sheaf is a presheaf $F$ such that for all $U$ and for all covering $\{U\_i\}\_{i\in I} $ of $U$, $F(U)$ is the equalizer
$$ F(U) \overset{f}{\longrightarrow}\prod\_{i\in I} F(U\_i) {\overset{g}{\longrightarrow}\atop \underset{h}{\longrightarrow} } \prod\_{i,j\in I} F(U\_i\cap U\_j)$$
(cf. [this question](https://mat... | 2014/07/28 | [
"https://math.stackexchange.com/questions/880763",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/92038/"
] | In general, a $C$-valued precosheaf $F$ is a cosheaf iff for every object $T \in C$ the presheaf $\hom(F(-),T)$ is a sheaf. This should give you an intuition for cosheafs. Instead of talking about elements of $F(U)$, which are typically morphisms *into* $F(U)$, better think of "coelements", which might be morphisms *on... | The interpretation of the gluing axioms for sheaves is intimately related to the example in which $F(U)$ is some set of functions on $U$.
In order to find an analogue interpretation for cosheaves, one can either assume that a cosheaf is of this kind (claim that compactly supported functions yield a cosheaf in [this a... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | The error indicates that you're using undefined variables - `b`, `c`, etc. It seems you meant to use those **characters**, in which case you should surround them in quotes:
```
s_count = ['b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s']
```
Having said that, it's worth remembering that charac... | You can in your case as [Mureinik's answer](https://stackoverflow.com/a/33058324/2141635) see if each char is >= "b" and < ="s", another efficient approach for specifying certain characters would be using a set of the chars you want to check for and summing how many times a char from s is int the set:
```
def strange_... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | Rather than making a list, you can use the fact that letters sort lexicographically so you can compare them with `>` and `<`
```
def strange_count(s):
total = 0
for letter in s:
if letter >= 'b' and letter <= 's':
total += 1
return total
```
For example
```
>>> strange_count('diction... | If you are not dealing with very long strings or you are not requested to take in consideration computational costs you can use something like this:
```
input = "Hello world"
input = input.lower()
list_chars = ['b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s']
counts = {}
for c in list_chars:
... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | ### The Problem - Variables *vs* Letters
```
s_count = [b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
```
The above is **not** declaring a list with elements that corresponds to the range of letters you are talking about.
What you are really saying is that `s_count` should be a *list* where the elements shall have values co... | If you are not dealing with very long strings or you are not requested to take in consideration computational costs you can use something like this:
```
input = "Hello world"
input = input.lower()
list_chars = ['b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s']
counts = {}
for c in list_chars:
... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | This line:
```
s_count = [b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
```
should be like this:
```
s_count = ["b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"]
```
Then you'll find that you're in an infinite loop, so try rewriting like this:
```
def strange_count(s):
count = 0
s = s.l... | You can in your case as [Mureinik's answer](https://stackoverflow.com/a/33058324/2141635) see if each char is >= "b" and < ="s", another efficient approach for specifying certain characters would be using a set of the chars you want to check for and summing how many times a char from s is int the set:
```
def strange_... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | This line:
```
s_count = [b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
```
should be like this:
```
s_count = ["b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"]
```
Then you'll find that you're in an infinite loop, so try rewriting like this:
```
def strange_count(s):
count = 0
s = s.l... | If you are not dealing with very long strings or you are not requested to take in consideration computational costs you can use something like this:
```
input = "Hello world"
input = input.lower()
list_chars = ['b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s']
counts = {}
for c in list_chars:
... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | Rather than making a list, you can use the fact that letters sort lexicographically so you can compare them with `>` and `<`
```
def strange_count(s):
total = 0
for letter in s:
if letter >= 'b' and letter <= 's':
total += 1
return total
```
For example
```
>>> strange_count('diction... | You can in your case as [Mureinik's answer](https://stackoverflow.com/a/33058324/2141635) see if each char is >= "b" and < ="s", another efficient approach for specifying certain characters would be using a set of the chars you want to check for and summing how many times a char from s is int the set:
```
def strange_... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | This line:
```
s_count = [b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
```
should be like this:
```
s_count = ["b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"]
```
Then you'll find that you're in an infinite loop, so try rewriting like this:
```
def strange_count(s):
count = 0
s = s.l... | ### The Problem - Variables *vs* Letters
```
s_count = [b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
```
The above is **not** declaring a list with elements that corresponds to the range of letters you are talking about.
What you are really saying is that `s_count` should be a *list* where the elements shall have values co... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | This line:
```
s_count = [b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
```
should be like this:
```
s_count = ["b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s"]
```
Then you'll find that you're in an infinite loop, so try rewriting like this:
```
def strange_count(s):
count = 0
s = s.l... | Rather than making a list, you can use the fact that letters sort lexicographically so you can compare them with `>` and `<`
```
def strange_count(s):
total = 0
for letter in s:
if letter >= 'b' and letter <= 's':
total += 1
return total
```
For example
```
>>> strange_count('diction... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | The error indicates that you're using undefined variables - `b`, `c`, etc. It seems you meant to use those **characters**, in which case you should surround them in quotes:
```
s_count = ['b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s']
```
Having said that, it's worth remembering that charac... | If you are not dealing with very long strings or you are not requested to take in consideration computational costs you can use something like this:
```
input = "Hello world"
input = input.lower()
list_chars = ['b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s']
counts = {}
for c in list_chars:
... |
33,058,267 | I have two divs:
* one is floated right (this one has constant size)
* the other has width auto and overflow hidden, it uses all the leftover space in the line and when less space is available than the min-width, it jumps to the lower line, filling it
This is the behaviour I want, but it **isn't working in FireFox**,... | 2015/10/10 | [
"https://Stackoverflow.com/questions/33058267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5264035/"
] | ### The Problem - Variables *vs* Letters
```
s_count = [b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s]
```
The above is **not** declaring a list with elements that corresponds to the range of letters you are talking about.
What you are really saying is that `s_count` should be a *list* where the elements shall have values co... | You can in your case as [Mureinik's answer](https://stackoverflow.com/a/33058324/2141635) see if each char is >= "b" and < ="s", another efficient approach for specifying certain characters would be using a set of the chars you want to check for and summing how many times a char from s is int the set:
```
def strange_... |
13,386,407 | I'm looking for some help in troubleshooting a database. Another person(who is no longer reachable) wrote this database and there are several bugs in it. The first comes when trying to access an input form. It is "run-time error '2683'. There is no object in this control. When I select the 'debug' option, the following... | 2012/11/14 | [
"https://Stackoverflow.com/questions/13386407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1727692/"
] | Previous versions of Access came with an ActiveX control called the Calendar control, that lets you display a calendar for the user to choose a date. This Calendar control had a value property. It seems that Access 2010 doesn't support this ActiveX control.
On the other hand, in Access 2010 you can add a datepicker to... | Here's a solution I've applied to make it possible to use the old ActiveX control in versions < 2010 (i.e., version < 14) and the new date picker in 14+:
```
'set appropriate date picker for date box based on application version
If Val(Application.Version) >= 14 Then
Me!btnFYStart.Visible = False
M... |
13,220,482 | How can access a file in the System directory, knowing the main directory, it's extension. But not knowing the name of the file and the nodes in between ( = Subderectories ) ? | 2012/11/04 | [
"https://Stackoverflow.com/questions/13220482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1709607/"
] | How to find the contents of a directory, and hence find out what that file is named, differs from operating system to operating system. On Linux you would use `diropen`, and something else on windows. However, the [boost::filesystem](http://www.boost.org/doc/libs/1_51_0/libs/filesystem/doc/index.htm) library allows you... | You could do a search for all the files with that extension, starting from the System directory. Based on "System directory", I'm going to guess this is on Windows, in which case the functions you'd typically use for that search would be `FindFirstFile`, `FindNextFile` and `FindClose`. You might also use `SetCurrentDir... |
20,723,010 | I want to have a View which contains more than one view. see the below image:

as you see pageController controls page navigation and provide before and after viewController (page).
pageContentController displays text and process them.
soundPlayer m... | 2013/12/21 | [
"https://Stackoverflow.com/questions/20723010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1348121/"
] | What I would do is:
1) Create custom classes for each view.
2) Then I would set the View Classes to the classes that I created.

3) Then I would write the code to handle whatever functionality you need within these vi... | i would realize that with the container view object via interface builder. from the description:
"Container View defines a region within a view controller's view subgraph that can include a child view controller. Create an embed segue from the container view to the child view controller in the storyboard."
This way yo... |
20,723,010 | I want to have a View which contains more than one view. see the below image:

as you see pageController controls page navigation and provide before and after viewController (page).
pageContentController displays text and process them.
soundPlayer m... | 2013/12/21 | [
"https://Stackoverflow.com/questions/20723010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1348121/"
] | thanks for your detailed answers. your answers clarified me. what I did:
I added `SoundPalyerVC` as child of `PageContentVC`
```
SoundPlayerVC *soundPlayer = [[StoryViewController alloc] initWithStory:self.storyManagedObject];
[self addChildViewController:soundPlayer];
[self.view addSubview:soundPlayer.view];
[sound... | What I would do is:
1) Create custom classes for each view.
2) Then I would set the View Classes to the classes that I created.

3) Then I would write the code to handle whatever functionality you need within these vi... |
20,723,010 | I want to have a View which contains more than one view. see the below image:

as you see pageController controls page navigation and provide before and after viewController (page).
pageContentController displays text and process them.
soundPlayer m... | 2013/12/21 | [
"https://Stackoverflow.com/questions/20723010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1348121/"
] | To your pageController view, add pageContentController's view and soundPlayer's view as subview to it.
write below code in pageController.m file
```
soundPlayer = [[SoundPlayer alloc] init];
[self.view addSubview:soundPlayer.view];
souldPlayer.frame = //set it value as desired.
```
Similary the pageContentControlle... | i would realize that with the container view object via interface builder. from the description:
"Container View defines a region within a view controller's view subgraph that can include a child view controller. Create an embed segue from the container view to the child view controller in the storyboard."
This way yo... |
20,723,010 | I want to have a View which contains more than one view. see the below image:

as you see pageController controls page navigation and provide before and after viewController (page).
pageContentController displays text and process them.
soundPlayer m... | 2013/12/21 | [
"https://Stackoverflow.com/questions/20723010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1348121/"
] | thanks for your detailed answers. your answers clarified me. what I did:
I added `SoundPalyerVC` as child of `PageContentVC`
```
SoundPlayerVC *soundPlayer = [[StoryViewController alloc] initWithStory:self.storyManagedObject];
[self addChildViewController:soundPlayer];
[self.view addSubview:soundPlayer.view];
[sound... | To your pageController view, add pageContentController's view and soundPlayer's view as subview to it.
write below code in pageController.m file
```
soundPlayer = [[SoundPlayer alloc] init];
[self.view addSubview:soundPlayer.view];
souldPlayer.frame = //set it value as desired.
```
Similary the pageContentControlle... |
20,723,010 | I want to have a View which contains more than one view. see the below image:

as you see pageController controls page navigation and provide before and after viewController (page).
pageContentController displays text and process them.
soundPlayer m... | 2013/12/21 | [
"https://Stackoverflow.com/questions/20723010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1348121/"
] | Starting in iOS 5, Apple added parent/child view controller support to the OS. There are new calls in the UIViewController class to support setting up parent/child view controller relationships, where one view controller (the parent) sets up or ore more other view controllers so that their content views are inserted in... | i would realize that with the container view object via interface builder. from the description:
"Container View defines a region within a view controller's view subgraph that can include a child view controller. Create an embed segue from the container view to the child view controller in the storyboard."
This way yo... |
20,723,010 | I want to have a View which contains more than one view. see the below image:

as you see pageController controls page navigation and provide before and after viewController (page).
pageContentController displays text and process them.
soundPlayer m... | 2013/12/21 | [
"https://Stackoverflow.com/questions/20723010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1348121/"
] | thanks for your detailed answers. your answers clarified me. what I did:
I added `SoundPalyerVC` as child of `PageContentVC`
```
SoundPlayerVC *soundPlayer = [[StoryViewController alloc] initWithStory:self.storyManagedObject];
[self addChildViewController:soundPlayer];
[self.view addSubview:soundPlayer.view];
[sound... | i would realize that with the container view object via interface builder. from the description:
"Container View defines a region within a view controller's view subgraph that can include a child view controller. Create an embed segue from the container view to the child view controller in the storyboard."
This way yo... |
20,723,010 | I want to have a View which contains more than one view. see the below image:

as you see pageController controls page navigation and provide before and after viewController (page).
pageContentController displays text and process them.
soundPlayer m... | 2013/12/21 | [
"https://Stackoverflow.com/questions/20723010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1348121/"
] | thanks for your detailed answers. your answers clarified me. what I did:
I added `SoundPalyerVC` as child of `PageContentVC`
```
SoundPlayerVC *soundPlayer = [[StoryViewController alloc] initWithStory:self.storyManagedObject];
[self addChildViewController:soundPlayer];
[self.view addSubview:soundPlayer.view];
[sound... | Starting in iOS 5, Apple added parent/child view controller support to the OS. There are new calls in the UIViewController class to support setting up parent/child view controller relationships, where one view controller (the parent) sets up or ore more other view controllers so that their content views are inserted in... |
35,643 | I have some external hard disks. I have encrypted them with the default encryption utility that comes with OS X, so I get encrypted HFS+ disks. Now I need to encrypt the same disks, but I need to be able to read them in OS X, Linux (Ubuntu distro) and Windows.
What software I could use for encrypting those external h... | 2016/08/22 | [
"https://softwarerecs.stackexchange.com/questions/35643",
"https://softwarerecs.stackexchange.com",
"https://softwarerecs.stackexchange.com/users/-1/"
] | Until a yearor two back, the definitive answer would have been TrueCrypt.
I still use it myself, but, as it is no longer actively developed, you might want to choose one of the forks, based on its source code. [VeraCrypt](https://veracrypt.fr/en/Home.html) seems to be the best.
It is cross-platform, gratis and its so... | As an alternative,
Lately I've been playing with some things to store data securely on Owncloud/NextCloud.
Researching that I've found encFS as well as CryFS. Both are FUSE file systems.
The main difference is that CryFS divides everything into chunks of the same size while encFS encrypts the file.
Both encrypt the... |
2,180,819 | Can you please help me to write the following integral with gamma function using the proper change of variables:
$$ I = \int\_0^\infty e^{-a \cdot r^{\alpha}-b \cdot r^{2}} \; \cdot r^{c} \; dr $$
With a, b, c and $ \alpha $ are real positive numbers, and $ 2<\alpha<6 $. I tried with $ t = a \cdot r^{\alpha}+b \cdot ... | 2017/03/10 | [
"https://math.stackexchange.com/questions/2180819",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/341203/"
] | Since
$$
\Gamma (z) = \int\_0^\infty {e^{\, - x} x^{\,z - 1} dx}
$$
then we can try and transform the exponential function into a series, as in *Kyril*'s answer, but performing first some
"massaging". So, standing that the given parameters (particularly $a$ and $b$) are positive
$$ \bbox[lightyellow] {
\begin{gather... | Let $r^{2}=x$, then $dx=2rdr$ then
$$I=2\int\_{\mathbb{R}^{+}}x^{\frac{c-1}{2}}e^{-ax^{2}-bx}dx$$
Let $\xi=\sqrt{a}x+\frac{b}{2\sqrt{a}}$, then
$$I=\frac{2}{\sqrt{a}}e^{-\frac{b^{2}}{2a}}\int\_{\mathbb{R}^{+}}{\Big(\frac{\xi}{\sqrt{a}}-\frac{b}{2a}\Big)^{\frac{c-1}{2}}}e^{-\xi^{2}}d\xi=$$
Now if $c=2l+1$ where $l\in\ma... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | The example you chose to cite is poorly chosen to highlight an obvious self-serving post. The policy would also impact [this other, more neutrally worded](https://meta.stackoverflow.com/questions/251288/dealing-with-an-answer-that-wasnt-accepted-maybe-because-a-user-is-a-newbie-on/251298#251298) comment that I've quote... | No.
===
Please don't penalize users for simply reminding other users of how the site works. I would think Stack Exchange would want new users to learn how the site works.
If someone demands an upvote or an accept, that's being rude and such a comment should be deleted for that reason. Threatening or bullying comments... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | No.
===
Please don't penalize users for simply reminding other users of how the site works. I would think Stack Exchange would want new users to learn how the site works.
If someone demands an upvote or an accept, that's being rude and such a comment should be deleted for that reason. Threatening or bullying comments... | In addition to users asking for accepts (and perhaps upvotes) on their own answers, or of new users, I have on multiple times been in a situation when someone asked a question and failed to upvote or accept answers for a while - sometimes not even anything I had posted - and I commented asking them to indicate what wor... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | Asking for people to accept an answer is completely, well, acceptable. In fact, one of the canned comments in the VLQ queue asks the OP to accept an answer instead of adding a *thanks!* answer.
[](https://i.stack.imgur.com/jU1of.png)
Under t... | #### Counterproposal: A single comment flag will delete any comment requesting acceptance or upvotes.
Comments which contain [one or more keywords](https://meta.stackexchange.com/questions/251636/obsolete-flag-handled-automatically) are automatically deleted by the system when a flag is raised.
Thus, similar to this ... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | We really should use common sense with this rather than enforcing a blind rule. There's a difference between someone "begging" for votes or pressuring users into voting/accepting and someone trying to merely educate new users about the tools that the site provides for them to use instead of "thanks" comments or the lik... | This policy is a Y-solution (as in XY-problem). The problem here is users who encourage misuse of the voting and accept features, either actively by begging for votes when it's not appropriate or more subtly by just not providing any usage guidance when bringing it up. Users *must* be allowed to educate or remind other... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | Aside from the clearly problematic comments asking for upvotes, pressuring people into accepting answers, or posting unsolicited requests for acceptance, there is still definitely a need to better inform new users who, in many cases, are apparently *trying* to do something "acceptance-like" for an answer. This shows up... | It's been stated strongly in a number or answers and comments that new users are fully conversant with all SO policies including [question answered](https://stackoverflow.com/help/someone-answers)
Let's look at this from an analysis of actual data rather than strong opinions which IMHO are not backed up by data analys... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | Aside from the clearly problematic comments asking for upvotes, pressuring people into accepting answers, or posting unsolicited requests for acceptance, there is still definitely a need to better inform new users who, in many cases, are apparently *trying* to do something "acceptance-like" for an answer. This shows up... | From my perspective...
We've *always* done it this way, so codifying it makes it less painful/surprising for everyone when they encounter this.
========================================================================================================================
So, I'm in favor of this.
My philosophy over the las... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | We should have the system detect when a (new) user uses "Thanks" or "Thank you" in the comments, and show them a pop-up telling them to upvote/accept instead of thanking. A bit like what happens when we include +1 in the comments. | From the update to the question
>
> ... moderators will delete them if seen or ...
>
>
>
Don't do that. You would act directly against the expressed will of the meta community as documented here. This is in my opinion not acceptable. Moderators should be servants not leaders of the community and a score of curren... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | We should have the system detect when a (new) user uses "Thanks" or "Thank you" in the comments, and show them a pop-up telling them to upvote/accept instead of thanking. A bit like what happens when we include +1 in the comments. | I really do not care about the points. I think I've never asked someone for upvotes or accepted vote on my answer. And despite those... I thoroughly disagree with this. If someone is becoming a problem, that should be dealt with, but only *when* it becomes a problem. Explaining how a mechanic of the site works is never... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | Summary
=======
The underlying problem is a technical problem. If you want a rule change like this, obviate the technical problem with a technical solution first. The OP implies a belief that this has already happened, via the site tour and the tooltip for the accept button. My position is that these **do not** solve ... | #### Counterproposal: A single comment flag will delete any comment requesting acceptance or upvotes.
Comments which contain [one or more keywords](https://meta.stackexchange.com/questions/251636/obsolete-flag-handled-automatically) are automatically deleted by the system when a flag is raised.
Thus, similar to this ... |
418,169 | >
> **Moderator Note:** We appreciate the community's feedback on this and are not moving forward with this rule as currently proposed. We still recommend not leaving these comments, and moderators will delete them if seen or flagged (which has always been the case).
>
>
>
We'll get to the rule stuff in a moment, ... | 2022/05/18 | [
"https://meta.stackoverflow.com/questions/418169",
"https://meta.stackoverflow.com",
"https://meta.stackoverflow.com/users/2370483/"
] | We should have the system detect when a (new) user uses "Thanks" or "Thank you" in the comments, and show them a pop-up telling them to upvote/accept instead of thanking. A bit like what happens when we include +1 in the comments. | >
> ...it's frustrated some users who were genuinely unaware.
>
>
>
I can see why.
In your future moderator messages *(that is, if there will be any more)* regarding this, I would recommend adding something along the lines of
>
> We are aware of [this](https://meta.stackoverflow.com/questions/297597/what-should... |
44,054,924 | I've got a really old `ASP.NET WebForms` app that I am tasked with maintaining.
I'm not one of the original developers. Don't even know who they were.
Anyway, they used Crystal Reports for the reports they wrote for it. And they wrote it to use .NET Framework 2, in whatever version of Visual Studio that came out wit... | 2017/05/18 | [
"https://Stackoverflow.com/questions/44054924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/197791/"
] | You are not tell crystal report version which you have, so not exactly tell anything.
But yes, [here](https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads) is list of Visual Studio with Crystal report supported page.
Crystal report is related to visual studio, not .net f... | VS for crystal report has a `compatibility version` using VS 2015.
I am not really sure what version of `Crystal report`, do you want to install. The important is, if you `done installing` the crystal report you may `restart your pc` and try to test it by right click on
>
> Project -> Add new item -> Crystal Report... |
19,686,176 | I am creating a minesweeper game for a javascript project and have run into a problem that I can't get my head round. When you click on an empty cell (one which does not have any mines around it and so does not display a number) in the minesweeper game for those who don't know, this will reveal the whole block of empty... | 2013/10/30 | [
"https://Stackoverflow.com/questions/19686176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2630210/"
] | Without knowing slightly more of your program it's hard to give you an exact solution. You'll probably need a separate function to do this, as just using the same function will reveal everything (which is obviously not how the game works). You'll also need some way of keeping track of revealed cells, otherwise you'll g... | Just as a general advice, you need a better separation between the model of your game and the UI.
Here is the begining of my interpretation of the minesweeper game:
```
function init() {
var i,j; // indexes
map = []; // global map, because i'm lazy
for (i=0; i<10; i++) {
var row = [];
for (j=0; j<10;... |
55,482,830 | I am trying to achieve the following layout using CSS grid...
[](https://i.stack.imgur.com/yHbnk.jpg)
I currently use flex to generate it like this..
```css
.row1 {
display:flex;
}
.row1 .item {
background:red;
width:50%;
padding:20px;
... | 2019/04/02 | [
"https://Stackoverflow.com/questions/55482830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779681/"
] | With `display:grid`, a single container is enough. to repeat the pattern, you can use the `nth-child(xn)` selector.
example
```css
body {
display: grid;
grid-template-columns: repeat(6, 1fr);/* because it cannot be broken into 3 columns, but 2x3 columns*/
}
div {
grid-column: auto/span 2;/* makes a third ... | This CSS snippet, is easiest change you can start with..
```
body > .container {
display: grid;
grid-templet-column: repeat(6,1fr);
padding: 20px;
grid-gap: 20px;
}
.container div {
background: red;
grid-column: span 2;
padding: 20px;
height: 1pc;
}
.container div:nth-child(5n+1), .c... |
39,214,084 | So I'm working on a Chrome extension to help me on my job. I need to autocomplete some fields but for some reason I cant pass the info from HTML to the .js file.
I have a list for the input and a script to make you able to search among any part of the given words. For example, if you type 'la' it should suggest New Zea... | 2016/08/29 | [
"https://Stackoverflow.com/questions/39214084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4987838/"
] | The full power of RxJava is visible when you use it on Java 8, preferably with a library like Retrofit. It allows you to trivially chain operations together, with full control of error handling. For example, consider the following code given `id`: an int that specifies the order and apiClient: a Retrofit client for the... | RxBinding/RxAndroid by Jake Wharton provides some nice threading functionality that you can use to make async calls but RxJava provides waaay more benefits/functionality than just dealing with async threading. That said, There is a pretty steep learning curve (IMO). Also, it should be noted that there is nothing wrong ... |
222,951 | Here is my table :
[](https://i.stack.imgur.com/xIKj7.png)
In my table
* `Clustering_key` (Primary key and auto incremental)
* `ID` (Index Column)
* `Data` (Text datatype column)
* `Position`(Index column) maintain the order of `Data`
My table hav... | 2018/11/20 | [
"https://dba.stackexchange.com/questions/222951",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/165327/"
] | `EXPLAIN` is not as smart as one would like. It provided `42415` without noticing your `LIMIT 3`.
The important clue that says that it will use the index is the `Key` column lists the index name.
That query, with that index (I assume `ID` is a numeric datatype) will touch only 3 rows of the index, then 3 rows of the ... | As a complement to what @Rick James said about getting more info is that if you have Performance Schema installed and enabled, you can execute the query in MySQL Workbench with enough privileges and then get detailed execution info through the GUI (see the section "Query Stats" after executing your query). You only nee... |
10,949,328 | I am reading [James Iry's blog post](http://james-iry.blogspot.com/2007/10/monads-are-elephants-part-3.html) on Monads in scala. I am in part three and I am confused about his description of the second law of monads regarding Unit. Specifically this claim:
```
unit(x) flatMap f = f(x)
```
When I apply my mental exa... | 2012/06/08 | [
"https://Stackoverflow.com/questions/10949328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/528405/"
] | Scala's `flatMap` needs a function that returns a collection, not a function that returns a single element, like your function `f`.
Either use `map`:
```
List(x) map f
```
or make your function return a collection:
```
val f = (x: Int) => List(x * 2)
List(x) flatMap f
```
Note that it will also return a collect... | The fact that it doesn't compile due to type issues should tell you something: `f` is not the kind of function that the monad law applies to!
`flatMap`, when seen as a monadic operation rather than a collection operation, takes a "monadic value" and a function from ordinary values to monadic values. Your `f` function ... |
8,022,871 | What is the proper way to validate a form in PHP in server side? There are tons of examples on the web where the action of the form is itself, but what if the action of my form is another .php file?
For example I have a form element on page1.php. The action of this form is page2.php. I know how to validate this in cli... | 2011/11/05 | [
"https://Stackoverflow.com/questions/8022871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031516/"
] | What's wrong with:
```
case x
when y;
<code here>
if !something
<more code>
end
end
```
Note that `if !something` is the same as `unless something` | I see a couple of possible solutions.
At the first hand, you can define your block of instructions inside some method:
```
def test_method
<code here>
return if something
<more code>
end
case x
when y
test_method
end
```
At the other hand, you can use `catch-throw`, but I believe it's more uglier and no... |
8,022,871 | What is the proper way to validate a form in PHP in server side? There are tons of examples on the web where the action of the form is itself, but what if the action of my form is another .php file?
For example I have a form element on page1.php. The action of this form is page2.php. I know how to validate this in cli... | 2011/11/05 | [
"https://Stackoverflow.com/questions/8022871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031516/"
] | What's wrong with:
```
case x
when y;
<code here>
if !something
<more code>
end
end
```
Note that `if !something` is the same as `unless something` | Ruby has no built-in way to exit the "when" in a "case" statement. You could however get the desired outcome with an answer similar to the technique [WarHog](https://stackoverflow.com/users/791619/warhog) gave:
```
case x
when y
begin
<code here>
break if something
<more code>
end while... |
46,952,233 | I have a strange problem in VS2017.
I have a project which consists of multiple projects. To keep it simple lets say i have a Class Library and WPF Application. WPF uses Class Library.
WPF is set as Startup Project.
I make a change in Class Library and Run.
The change isnt compiled and therefore WPF uses the old c... | 2017/10/26 | [
"https://Stackoverflow.com/questions/46952233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3428214/"
] | Right-click on the solution in Visual Studio, choose `Configuration Manager` and check that the `Build` checkbox is checked for both projects for the active solution configuration. | Create object of that class in MainWindow.xaml.cs(or if you have your own Window) and make a call to those methods from class which you want to execute in MainWindow.xaml.cs |
46,952,233 | I have a strange problem in VS2017.
I have a project which consists of multiple projects. To keep it simple lets say i have a Class Library and WPF Application. WPF uses Class Library.
WPF is set as Startup Project.
I make a change in Class Library and Run.
The change isnt compiled and therefore WPF uses the old c... | 2017/10/26 | [
"https://Stackoverflow.com/questions/46952233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3428214/"
] | In the end we removed the project reference and re added and it suddenly worked. Thanks. | Create object of that class in MainWindow.xaml.cs(or if you have your own Window) and make a call to those methods from class which you want to execute in MainWindow.xaml.cs |
12,199,022 | Say, I have a simple class `Fruit` defined as follows:
```
public class Fruit {
int price;
public boolean isEqualPrice(Fruit object) {
return (object.price == price);
}
}
```
Now, there are several subclasses of `Fruit` such as `Apple`, `Orange`, `Mango` etc. I want the method `isEqualP... | 2012/08/30 | [
"https://Stackoverflow.com/questions/12199022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031888/"
] | Make Fruit generic, or add a generic subclass of fruit and derive Apple, Orange etc. from that.
```
class Fruit {
...
}
class FruitGeneric<T extends Fruit> extends Fruit {
public boolean isEqualPrice (T otherFruit) {
...
}
}
class Apple extends FruitGeneric<Apple> {
...
}
class Orange extends ... | You certainly can:
```
class Fruit <T extends Fruit>{
int price;
public boolean isEqualPrice(T object1) {
return (object1.price == price);
}
}
class Mango extends Fruit<Mango>{
}
``` |
45,515,499 | Trying to send serial messages using Arduino Uno and standard IDE. Ran into issue parsing the serial message sent to the device.
See that if I include this line `Serial.println("Serial.available() = " + String(Serial.available()));` I will be able to read the rest of the message. If this is commented out I will only s... | 2017/08/04 | [
"https://Stackoverflow.com/questions/45515499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5361331/"
] | have you tried Serial.readString() to parse the entire missing characters? | Serial data is transmitted and received one character at a time. At 9600 baud, the transmission rate is approximately one character per millisecond.
The code assumes that once the first character has arrived, all of them have. This is not the case. The addition of the `println` consumes CPU time, and therefore has the... |
70,777,856 | Jupyter notebook (ipynb) to Word-format document (.docx) conversion just is not working correctly. I have tried several approaches using jupyter nbconvert, pandoc, and commercial document format converters. So far, none have produced appropriate results. I have to believe there exists some way for pandoc to do the conv... | 2022/01/19 | [
"https://Stackoverflow.com/questions/70777856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11813472/"
] | The problem is in two places:
1. Just a raw `return` returns a value of `None`. So when you call `spell_elements()` recursively and try to concatenate a string, you get an error. You probably can fix this by doing `return ""`.
2. You have `if` with several `elif` but no `else`. If none of the conditions are met, the f... | May be you do not need a function to do it. Just use a 'dict'
```
elems={
"Silver":"SiLvEr",
"Hydrogen":"H",
"Potassium":"K"}
```
How to use it
```
print(elems["Silver"]) # output-> SiLvEr
print(elems["Hidrogen"]) # output-> H
```
You can extend the `dict` `elems` with other elements.
In practice you have a `Ke... |
43,617,120 | So, there's a bug in some legacy code I'm maintaining. It causes some mild data corruption, so it's rather serious. I've found the root cause, and have made a sample application that reliable reproduces the bug. I would like to fix it with as little impact on existing applications as possible, but I'm struggling.
The ... | 2017/04/25 | [
"https://Stackoverflow.com/questions/43617120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1157191/"
] | Instead of supplying the interceptor at each `ISessionFactory.OpenSession` call, I would use a single interceptor instance globally configured (`Configuration.SetInterceptor()`).
This instance would retrieve the data to use from an adequate context allowing to isolate this data per request/user/whatever suits the appl... | Dependency Injection example:
DependencyInjectionInterceptor.cs:
```
using NHibernate;
using System;
using Microsoft.Extensions.DependencyInjection;
namespace MyAmazingApplication
{
public class DependencyInjectionInterceptor : EmptyInterceptor
{
private readonly IServiceProvider _serviceProvider;
... |
22,067,696 | Hi in fragment I want to pick a phone number from contacts and inset it into EditText
but its not working in fragment I use it in activity and it works. Please could you help me how I should change it< thanks
```
public class Encrypt extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup... | 2014/02/27 | [
"https://Stackoverflow.com/questions/22067696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2999896/"
] | Ok, you have a parenthesis that is not well placed. I suppose you want `onActivityResult to be in the click listener.
```
contactsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(v==contactsButton){
Intent intent=... | For accessing the contacts form your phone, make sure that you added the `android.permission.READ_CONTACTS` Permission in manifest file.. |
22,067,696 | Hi in fragment I want to pick a phone number from contacts and inset it into EditText
but its not working in fragment I use it in activity and it works. Please could you help me how I should change it< thanks
```
public class Encrypt extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup... | 2014/02/27 | [
"https://Stackoverflow.com/questions/22067696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2999896/"
] | Ok, you have a parenthesis that is not well placed. I suppose you want `onActivityResult to be in the click listener.
```
contactsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(v==contactsButton){
Intent intent=... | There could be two possible reasons to this.
1. Call your statrtActivityForResults using Activity's reference, like
```
getActivity().startActivityForResult(intent, 1);
```
2. Calling super.onActivityResult(requestCode, resultCode, data) in you onActivityResult() as @marcin\_j also pointed.
Try either or both of th... |
22,067,696 | Hi in fragment I want to pick a phone number from contacts and inset it into EditText
but its not working in fragment I use it in activity and it works. Please could you help me how I should change it< thanks
```
public class Encrypt extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup... | 2014/02/27 | [
"https://Stackoverflow.com/questions/22067696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2999896/"
] | Ok, you have a parenthesis that is not well placed. I suppose you want `onActivityResult to be in the click listener.
```
contactsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(v==contactsButton){
Intent intent=... | You are trying to return value when onActivityResult is void return function, you need to implement your logic without returning any value |
22,067,696 | Hi in fragment I want to pick a phone number from contacts and inset it into EditText
but its not working in fragment I use it in activity and it works. Please could you help me how I should change it< thanks
```
public class Encrypt extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup... | 2014/02/27 | [
"https://Stackoverflow.com/questions/22067696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2999896/"
] | Ok, you have a parenthesis that is not well placed. I suppose you want `onActivityResult to be in the click listener.
```
contactsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(v==contactsButton){
Intent intent=... | ```
public String getPath(Uri uri) {
// just some safety built in
if( uri == null ) {
// TODO perform some logging or show user feedback
return null;
}
// try to retrieve the image from the media store first
// this will only work for images selected from gallery
String[] proje... |
58,771,220 | I want to take `arrayDevice`, `arrayidDevice`, `arrayDomCommande`, `arrayidCommande` from outside of my function `lectureCommand`, but I don't know how to take all these values and put them outside of this function to use it after.
This is my code:
```
function getCommand () {
var nameDevice = [];
va... | 2019/11/08 | [
"https://Stackoverflow.com/questions/58771220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The cleanest way is to have the disabled state somewhere where you can reset it, because re-rendering your component to reset it is making use of a side-effect of destroying and re-creating your components. It makes it hard for someone to figure out *why* the buttons are enabled again, because there is no code changing... | Could you please give a try to set a :key for keyboard like below
```
<keyboard v-if="!gameIsOver && showKeyboard" :key="increment" />
```
"increment": local component property
and increase the "increment" property value by one when you need to re-render view. use the vuex store property to sync with local "increm... |
58,771,220 | I want to take `arrayDevice`, `arrayidDevice`, `arrayDomCommande`, `arrayidCommande` from outside of my function `lectureCommand`, but I don't know how to take all these values and put them outside of this function to use it after.
This is my code:
```
function getCommand () {
var nameDevice = [];
va... | 2019/11/08 | [
"https://Stackoverflow.com/questions/58771220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | To answer your question first, the cleanest way to re-render a Vue component or any element is to bind it's `key` attribute to something reactive that will control the re-renders, whenever the key value changes it will trigger a re-render.
To make such a unique key per render, I would probably use an incremented numbe... | Could you please give a try to set a :key for keyboard like below
```
<keyboard v-if="!gameIsOver && showKeyboard" :key="increment" />
```
"increment": local component property
and increase the "increment" property value by one when you need to re-render view. use the vuex store property to sync with local "increm... |
58,771,220 | I want to take `arrayDevice`, `arrayidDevice`, `arrayDomCommande`, `arrayidCommande` from outside of my function `lectureCommand`, but I don't know how to take all these values and put them outside of this function to use it after.
This is my code:
```
function getCommand () {
var nameDevice = [];
va... | 2019/11/08 | [
"https://Stackoverflow.com/questions/58771220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The cleanest way is to have the disabled state somewhere where you can reset it, because re-rendering your component to reset it is making use of a side-effect of destroying and re-creating your components. It makes it hard for someone to figure out *why* the buttons are enabled again, because there is no code changing... | To answer your question first, the cleanest way to re-render a Vue component or any element is to bind it's `key` attribute to something reactive that will control the re-renders, whenever the key value changes it will trigger a re-render.
To make such a unique key per render, I would probably use an incremented numbe... |
61,971,264 | Been pulling my hair out over this one for several days. The Shiny app I'm building opens a database which regularly gets updated. As such, values in the columns can change, and I want to make sure the users can filter based on these values. Problem is: the checkboxes need to appear in seperate boxes (for organization ... | 2020/05/23 | [
"https://Stackoverflow.com/questions/61971264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13601859/"
] | Please Try this
```
if ($validator->fails()) {
return Redirect::back()->withErrors($validator);
}
```
Your method should be like
```
public function store(Request $request){
$data = array(
'fname' => $request->input('fname'),
'email' => $request->input('email'),
'message... | I made a new Laravel project and copy and pasted the views and routes to the new Laravel project and make a new controllers again and it works. No changes to the code was made |
63,797,647 | When using hard-coded username / email / password I have no problem getting a message sent with phpmailer. But when I use $\_ENV to hide the credentials I get the smtp error as shown here:
```
2020-09-08 15:50:51 SERVER -> CLIENT: 220 dd45234.kasserver.com ESMTP
2020-09-08 15:50:51 CLIENT -> SERVER: EHLO brows... | 2020/09/08 | [
"https://Stackoverflow.com/questions/63797647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12004151/"
] | Debug one thing at a time. There's no point in looking at error in your email when you know you know you have a problem before it ever gets that far. PHPMailer uses whatever you give it, so *you need to be sure you're giving it the right thing*.
You could reduce the code to debug in this case by cutting it back to:
`... | After installing dotenv (vlucas) I simply didn't include it correctly in my ContactController. So that's why var\_dump($\_ENV) always resulted in NULL. I compared my settings with the other route, NewsletterController. The difference is that in this route I query the database and in the models constructor (where the db... |
54,717,642 | I am writing a POST API where I need to form a payload as,
```
{
"questions":{
"preferredAnswer":{
answer[0]:"my first answer",
answer[1]:"second answer"
}
}
```
This needs to be mapped as a java object.
My questions is, Is there a way I can map this json to the below class? or Can I declare answers va... | 2019/02/15 | [
"https://Stackoverflow.com/questions/54717642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6689620/"
] | You can't declare variable with square brackets, however you can have your JSON property with brackets and map it using `@JsonProperty` annotation as below
```
public Class PreferredAnswer {
@JsonProperty("answer[0]")
private String answer0;
@JsonProperty("answer[1]")
private String answer1;
}
```
Not... | Java does not have native JSON support the way JavaScript does. You can use libraries (like GSON) to help you, or you can do it the Java way, which would involve building it with more code than this.
But Java does not natively convert from JSON into objects the way JS does. |
64,008,371 | I know that some similar issues already have been posted here, but I cannot find the solution for my issue and here I am stuck with this code.
The problem is when I want to Increase or Decrease a counter, all other counters changes. Also I'm wondering were should I store the counter, should it be a unique variable or a... | 2020/09/22 | [
"https://Stackoverflow.com/questions/64008371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13574458/"
] | So pandas doesnt seem to have a good way of having a case insensitive search, However you can get the sheetnames as a list and pd.read will accept an index for the sheet name so I came up with this to solve the problem
```
excel_file= pd.ExcelFile("file_name.xlsx")
sheet_to_find = "Test Sheet"
# Get all the sheetname... | I don't know how to make that request case insesitive, but you could try to manipulate the file with openpyxl something like this:
```
import openpyxl
filename = 'file_name.xlsx'
wb = openpyxl.load_workbook(filename)
for ws in wb.worksheets:
ws.title = ws.title.title()
filename = 'new_'+filename
wb.save(fil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.