qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
9,071,174 | As part of strengthening session authentication security for a site that I am building, I am trying to compile a list of the best ways to register a user's computer as a second tier of validation - that is in addition to the standard username/password login, of course. Typical ways of registering a user's computer are ... | 2012/01/30 | [
"https://Stackoverflow.com/questions/9071174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708034/"
] | Simply calling read doesn't guarantee that you will receive all the 63 bytes or that you receive the 63 bytes you were hoping for.. I would suggest that you somehow determine how much data you need to receive(send the data length first) and then put the recv function in a loop until you have all the data.. The send fun... | How about trying to close the socket at the end of dostuff()?
The server may be getting too many open connections. |
9,071,174 | As part of strengthening session authentication security for a site that I am building, I am trying to compile a list of the best ways to register a user's computer as a second tier of validation - that is in addition to the standard username/password login, of course. Typical ways of registering a user's computer are ... | 2012/01/30 | [
"https://Stackoverflow.com/questions/9071174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708034/"
] | Simply calling read doesn't guarantee that you will receive all the 63 bytes or that you receive the 63 bytes you were hoping for.. I would suggest that you somehow determine how much data you need to receive(send the data length first) and then put the recv function in a loop until you have all the data.. The send fun... | Solution: The error was that the XOpenDisplay was inside an infinite loop without being closed. I simply moved the XOpenDisplay command before the infinite loop in dostuff().
It was in fact not a socket error. |
43,985,851 | If I'm using webpack, I can create a program using CommonJS module syntax
```
#File: src-client/entry-point.js
helloWorld1 = require('./hello-world');
alert(helloWorld1.getMessage());
#File: src-client/hello-world.js
var toExport = {};
toExport.getMessage = function(){
return 'Hello Webpack';
}
module.exports... | 2017/05/15 | [
"https://Stackoverflow.com/questions/43985851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4668/"
] | The presence of `import` automatically puts the module in [strict mode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode), as defined in the [Spec](https://www.ecma-international.org/ecma-262/6.0/#sec-strict-mode-code). In strict mode you're not allowed to use a variable that hasn't been de... | Webpack should not have any trouble mixing the different module syntaxes.
The problem is you *implicitly declared* `helloWorld1` in an ES2015 module. These modules [are in strict mode by default](https://stackoverflow.com/questions/29283935/which-ecmascript-6-features-imply-strict-mode), which means you can not decla... |
1,439,713 | I want to build an ant script that does exactly the same compilation actions on a Flash Builder 4 (Gumbo) project as the `Project->Export Release Build...` menu item does. My ant-fu is reasonably strong, that's not the issue, but rather I'm not sure exactly what that entry is doing.
Some details:
* I'll be using the ... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1439713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23309/"
] | One quick way to know the compiler options is to add this tag into your compiler options:
-dump-config your/drive/to/store/the/xmlfile.xml
This will output the entire ant compiler options and you can copy off the parts you want to keep. | I had some issues with the Adobe Flex Ant tasks a while back, so I ended up using an exec call to the mxmlc compiler with a boatload of options and we've just built upon it from there. There are a few nagging doubts that what I do with the build.xml is not exactly the same that FB3 (what we have) does, but this might b... |
1,439,713 | I want to build an ant script that does exactly the same compilation actions on a Flash Builder 4 (Gumbo) project as the `Project->Export Release Build...` menu item does. My ant-fu is reasonably strong, that's not the issue, but rather I'm not sure exactly what that entry is doing.
Some details:
* I'll be using the ... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1439713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23309/"
] | HellFire Compiler Daemon (<http://bytecode-workshop.com>/) can generate build.xml directly from the compiler calls made by Flex/Flash Builder. That means your ant script produces SWCs and SWFs based on the exact same set of compiler settings that you set in Flex/Flash Builder.
Also, check out this blog:
<http://stopc... | I had some issues with the Adobe Flex Ant tasks a while back, so I ended up using an exec call to the mxmlc compiler with a boatload of options and we've just built upon it from there. There are a few nagging doubts that what I do with the build.xml is not exactly the same that FB3 (what we have) does, but this might b... |
1,439,713 | I want to build an ant script that does exactly the same compilation actions on a Flash Builder 4 (Gumbo) project as the `Project->Export Release Build...` menu item does. My ant-fu is reasonably strong, that's not the issue, but rather I'm not sure exactly what that entry is doing.
Some details:
* I'll be using the ... | 2009/09/17 | [
"https://Stackoverflow.com/questions/1439713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23309/"
] | One quick way to know the compiler options is to add this tag into your compiler options:
-dump-config your/drive/to/store/the/xmlfile.xml
This will output the entire ant compiler options and you can copy off the parts you want to keep. | HellFire Compiler Daemon (<http://bytecode-workshop.com>/) can generate build.xml directly from the compiler calls made by Flex/Flash Builder. That means your ant script produces SWCs and SWFs based on the exact same set of compiler settings that you set in Flex/Flash Builder.
Also, check out this blog:
<http://stopc... |
40,358,562 | I wish to use connection pooling using NodeJS with MySQL database. According to docs, there are two ways to do that: either I explicitly get connection from the pool, use it and release it:
```
var pool = require('mysql').createPool(opts);
pool.getConnection(function(err, conn) {
conn.query('select 1+1', function... | 2016/11/01 | [
"https://Stackoverflow.com/questions/40358562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2882245/"
] | Yes, the second one means that the pool is responsible to get the next free connection do a query on that and then release it again. You use this for *"one shot"* queries that have no dependencies.
You use the first one if you want to do multiple queries that depend on each other. A connection holds certain states, li... | In case anyone else stumbles upon this:
When you use pool.query you are in fact calling a shortcut which does what the first example does.
From the [readme](https://github.com/mysqljs/mysql#pooling-connections):
>
> This is a shortcut for the pool.getConnection() -> connection.query() -> connection.release() code f... |
57,832,193 | The footer disappears when trying to get the "back to top" to the right-hand side just above the footer. I want to try to get the button just above the footer.
Before I implemented the "back to top" button I was also having difficulty with it not being aligned correctly, as it not covering the left-side of the page on... | 2019/09/07 | [
"https://Stackoverflow.com/questions/57832193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12028650/"
] | Using strongly typed datasets would make parts of this easier (Actually, they nearly always make all work with datatable and dataset easier; I would use them by default)
I would perform the following steps:
* Add a DataSet to your project
* Add a table to it (open it in the visual designer, right click the surface, a... | You can use DataTable.NewRow() method to have a reference to the new row.
```
var rowNew = dt.NewRow()
...
dt.AddRow(rowNew);
```
Prefer using strong typed DataTable if the schema is not generated at runtime.
Also you can find an existing row using:
```
int found = -1;
for (int index = 0; i < dt.Count; index++)
{
... |
57,832,193 | The footer disappears when trying to get the "back to top" to the right-hand side just above the footer. I want to try to get the button just above the footer.
Before I implemented the "back to top" button I was also having difficulty with it not being aligned correctly, as it not covering the left-side of the page on... | 2019/09/07 | [
"https://Stackoverflow.com/questions/57832193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12028650/"
] | Using strongly typed datasets would make parts of this easier (Actually, they nearly always make all work with datatable and dataset easier; I would use them by default)
I would perform the following steps:
* Add a DataSet to your project
* Add a table to it (open it in the visual designer, right click the surface, a... | You can loop the whole datagridview rows and check if there is existing row with same new row product code, if yes update the columns you want of this row. This is not tested but something like this:
```
string prodCode = txtProductCode.Text;
decimal qty = Convert.ToInt32(txtQty.Text);
decimal price = Conv... |
185,728 | I wrote a function in python to count the number of 1-bits in a sorted bit array. I'm basically using binary search but the code seems unnecessarily long and awkward. I did test it for several different cases and got the correct output but am looking to write a cleaner code if possible.
Note: I want to use a binary-se... | 2018/01/22 | [
"https://codereview.stackexchange.com/questions/185728",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/78739/"
] | I agree with your assessment of the code being *unnecessarily long and awkward*. It looks like the root cause is an opportunistic optimization.
The bad news is that most of the secondary tests (like `arr[mid - 1] == 0` and `arr[mid - 1] == 1`) are bound to fail, so not only they contribute to awkwardness of the code -... | You can't get much simpler than:
```
sum(arr)
```
This has the benefit of working even if the array isn't sorted. |
185,728 | I wrote a function in python to count the number of 1-bits in a sorted bit array. I'm basically using binary search but the code seems unnecessarily long and awkward. I did test it for several different cases and got the correct output but am looking to write a cleaner code if possible.
Note: I want to use a binary-se... | 2018/01/22 | [
"https://codereview.stackexchange.com/questions/185728",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/78739/"
] | This removes the learning part of this (if your goal is to try to learn to implement a binary search in this context), but I contend the most pythonic solution would be to use [`bisect.bisect_right`](https://docs.python.org/3/library/bisect.html#bisect.bisect_right). It gives you the rightmost insertion point for a val... | You can't get much simpler than:
```
sum(arr)
```
This has the benefit of working even if the array isn't sorted. |
185,728 | I wrote a function in python to count the number of 1-bits in a sorted bit array. I'm basically using binary search but the code seems unnecessarily long and awkward. I did test it for several different cases and got the correct output but am looking to write a cleaner code if possible.
Note: I want to use a binary-se... | 2018/01/22 | [
"https://codereview.stackexchange.com/questions/185728",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/78739/"
] | I agree with your assessment of the code being *unnecessarily long and awkward*. It looks like the root cause is an opportunistic optimization.
The bad news is that most of the secondary tests (like `arr[mid - 1] == 0` and `arr[mid - 1] == 1`) are bound to fail, so not only they contribute to awkwardness of the code -... | This removes the learning part of this (if your goal is to try to learn to implement a binary search in this context), but I contend the most pythonic solution would be to use [`bisect.bisect_right`](https://docs.python.org/3/library/bisect.html#bisect.bisect_right). It gives you the rightmost insertion point for a val... |
46,339 | I'm running F17 and inside of `yum.repos.d`. I see multiple repos listed like `adobe-linux-1386.repo`, `fedora.repo`, `google-chrome.repo`, etc. When I `yum install` are some files being downloaded from multiple different repos or all from one? | 2012/08/26 | [
"https://unix.stackexchange.com/questions/46339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/22122/"
] | Most packages would be downloaded from fedora.repo. Adobe packages would be downloaded from adobe-linux-i386.repo. Google Chrome packages would be downloaded from google-chrome.repo | Also depends on whether a repo is disabled or enabled. |
46,339 | I'm running F17 and inside of `yum.repos.d`. I see multiple repos listed like `adobe-linux-1386.repo`, `fedora.repo`, `google-chrome.repo`, etc. When I `yum install` are some files being downloaded from multiple different repos or all from one? | 2012/08/26 | [
"https://unix.stackexchange.com/questions/46339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/22122/"
] | Most of the repositories specify a `mirrorlist` in their configuration file. When present, `yum` will select one or more of the mirrors provided by the list. Repos that don't have mirrors will have `baseurl` instead of `mirrorlist`.
When downloading multiple packages, yum can download from multiple sites in parallel, ... | Most packages would be downloaded from fedora.repo. Adobe packages would be downloaded from adobe-linux-i386.repo. Google Chrome packages would be downloaded from google-chrome.repo |
46,339 | I'm running F17 and inside of `yum.repos.d`. I see multiple repos listed like `adobe-linux-1386.repo`, `fedora.repo`, `google-chrome.repo`, etc. When I `yum install` are some files being downloaded from multiple different repos or all from one? | 2012/08/26 | [
"https://unix.stackexchange.com/questions/46339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/22122/"
] | Most packages would be downloaded from fedora.repo. Adobe packages would be downloaded from adobe-linux-i386.repo. Google Chrome packages would be downloaded from google-chrome.repo | Normally the contents of repository do not have the same rpms (like in your example). If you had "conflicting" rpms you can use yum\_priorities to choose which one to use first.
But in the end a single rpm will be downloaded from a single (mirror)-server that is mentioned in a single repository (directly or via mirror... |
46,339 | I'm running F17 and inside of `yum.repos.d`. I see multiple repos listed like `adobe-linux-1386.repo`, `fedora.repo`, `google-chrome.repo`, etc. When I `yum install` are some files being downloaded from multiple different repos or all from one? | 2012/08/26 | [
"https://unix.stackexchange.com/questions/46339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/22122/"
] | Most of the repositories specify a `mirrorlist` in their configuration file. When present, `yum` will select one or more of the mirrors provided by the list. Repos that don't have mirrors will have `baseurl` instead of `mirrorlist`.
When downloading multiple packages, yum can download from multiple sites in parallel, ... | Also depends on whether a repo is disabled or enabled. |
46,339 | I'm running F17 and inside of `yum.repos.d`. I see multiple repos listed like `adobe-linux-1386.repo`, `fedora.repo`, `google-chrome.repo`, etc. When I `yum install` are some files being downloaded from multiple different repos or all from one? | 2012/08/26 | [
"https://unix.stackexchange.com/questions/46339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/22122/"
] | Most of the repositories specify a `mirrorlist` in their configuration file. When present, `yum` will select one or more of the mirrors provided by the list. Repos that don't have mirrors will have `baseurl` instead of `mirrorlist`.
When downloading multiple packages, yum can download from multiple sites in parallel, ... | Normally the contents of repository do not have the same rpms (like in your example). If you had "conflicting" rpms you can use yum\_priorities to choose which one to use first.
But in the end a single rpm will be downloaded from a single (mirror)-server that is mentioned in a single repository (directly or via mirror... |
35,045,808 | The problem I am facing is that, given a list and a guard condition, I must verify if every element in the list passes the guard condition.
If even one of the elements fails the guard check, then the function should return `false`. If all of them pass the guard check, then the function should return `true`. The restri... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35045808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5588032/"
] | You should use [all](https://docs.python.org/2/library/functions.html#all):
```
def todos_lista(lista, guarda):
return all(guarda(x) for x in lista)
```
Or in a more functional way:
```
def todos_lista(lista, guarda):
return all(map(guarda, lista))
```
For example for range 0 to 9 (`range(10)`):
```
>>> ... | `any` will do the job as well:
```
def todos_lista(lista, guarda):
return not any(not guarda(x) for x in lista)
``` |
10,972,246 | I've built a site <http://ucemeche.weebly.com> , Now I want to transfer it on other server. <http://Weebly.com> provides a function to download whole site in zip format that I've done.
But problem is when I am browsing that downloaded site the slide shows, photo gallery etc are not working in as working in live site. P... | 2012/06/10 | [
"https://Stackoverflow.com/questions/10972246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447820/"
] | Check the paths of the javascripts. You might be missing some scripts or you do not include them properly.
Check the error console in your browser. Most likely it will show you what's wrong. | You simply have to change the paths to the images in the html file
the paths will be something like:
```
"2\/1\/2\/5\/56254238\/3375189.png"
```
change them to:
```
"..\/folder name where your files are\/uploads\/2\/1\/2\/5\/56254238\/3375189.png"
``` |
10,972,246 | I've built a site <http://ucemeche.weebly.com> , Now I want to transfer it on other server. <http://Weebly.com> provides a function to download whole site in zip format that I've done.
But problem is when I am browsing that downloaded site the slide shows, photo gallery etc are not working in as working in live site. P... | 2012/06/10 | [
"https://Stackoverflow.com/questions/10972246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1447820/"
] | Check the paths of the javascripts. You might be missing some scripts or you do not include them properly.
Check the error console in your browser. Most likely it will show you what's wrong. | This was three years ago, so perhaps this is a late answer. There is a hosted file slideshow-jq.js. In it, there is a function largeURL(photo).
Copy that slideshow-jq.js into the root of your zip, and edit the file:
`url = '/uploads/' + url.replace(/^\/uploads\//, '');`
Remove the leading / in front of uploads.
No... |
38,448,193 | I tried doing this in python, but I get an error:
```
import numpy as np
array_to_filter = np.array([1,2,3,4,5])
equal_array = np.array([1,2,5,5,5])
array_to_filter[equal_array]
```
and this results in:
```
IndexError: index 5 is out of bounds for axis 0 with size 5
```
What gives? I thought I was doing the right... | 2016/07/19 | [
"https://Stackoverflow.com/questions/38448193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4054573/"
] | The regex: <http://regexr.com/3dr56>
Will match any nodes that consist of say the following:
`<div>hello world</div>`
Provided that the parameters passed to the function:
```js
function removeNode(str, nodeName) {
var pattern = '<'+nodeName+'>[\\s\\w]+<\/'+nodeName+'>';
var regex = new RegExp(pattern, 'gi')... | For what it's worth here's a solution done using only jQuery.
You could do something similar with a server side XML parser
**Data used for search and replace:**
```
// selector = jQuery selector, final = replacement element
var tags = [{
selector: 'emphasis[Type="Italic"]',
final: '<i>'
}, {
... |
21,344,684 | I've been wrestling with this for several days and have extensively dug through StackOverflow and various other sites. I'm literally drawing a blank. I'm trying to get a single result back from my stored procedure.
Here's my stored procedure:
```
ALTER PROC [dbo].[myHelper_Simulate]
@CCOID nvarchar(100), @RVal n... | 2014/01/25 | [
"https://Stackoverflow.com/questions/21344684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693895/"
] | [SP return values](http://technet.microsoft.com/en-us/library/ms174998.aspx) are integers and are meant for error code. The correct way is to use `OUTPUT` parameter. You are assigning it correctly in the SP, you don't need the return statements.
In your C# code check the value after execution. Use `ExecuteNonQuery` as... | try
```
private void btnSimulate_MouseClick(object sender, EventArgs e) {
using (SqlConnection con = svrConn) {
using (SqlCommand cmd = new SqlCommand("myHelper_Simulate", con)) {
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@CCOID", SqlDbType.VarChar).Value = txtDUserCCOID.Tex... |
21,344,684 | I've been wrestling with this for several days and have extensively dug through StackOverflow and various other sites. I'm literally drawing a blank. I'm trying to get a single result back from my stored procedure.
Here's my stored procedure:
```
ALTER PROC [dbo].[myHelper_Simulate]
@CCOID nvarchar(100), @RVal n... | 2014/01/25 | [
"https://Stackoverflow.com/questions/21344684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/693895/"
] | Don't need the return parameters or output parameters. ExecuteScalar returns the first column of the first row of your result set. So just select the text you want to return, like so...
```
IF @UserID > 0
BEGIN
INSERT [Audit] ([GUID], Created, UserID, ActionType, Action, Level)
VALUES (... | try
```
private void btnSimulate_MouseClick(object sender, EventArgs e) {
using (SqlConnection con = svrConn) {
using (SqlCommand cmd = new SqlCommand("myHelper_Simulate", con)) {
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@CCOID", SqlDbType.VarChar).Value = txtDUserCCOID.Tex... |
61,015,445 | I'm using [custom-elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) aka web-components within [Preact](https://preactjs.com/). The problem is that Typescript complains about elements not being defined in `JSX.IntrinsicElements` - in this case a `check-box` element:
```html
<d... | 2020/04/03 | [
"https://Stackoverflow.com/questions/61015445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7664765/"
] | Okay I managed to solve it using [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation):
```
declare module 'preact/src/jsx' {
namespace JSXInternal {
// We're extending the IntrinsicElements interface which holds a kv-list of
// available ... | With typescript 4.2.3 and preact 10.5.13, here is what works to define a custom tag name with attributes:
```
declare module 'preact' {
namespace JSX {
interface IntrinsicElements {
'overlay-trigger': OverlayTriggerAttributes;
}
}
}
interface OverlayTriggerAttributes extends preact... |
61,015,445 | I'm using [custom-elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) aka web-components within [Preact](https://preactjs.com/). The problem is that Typescript complains about elements not being defined in `JSX.IntrinsicElements` - in this case a `check-box` element:
```html
<d... | 2020/04/03 | [
"https://Stackoverflow.com/questions/61015445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7664765/"
] | Okay I managed to solve it using [module augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation):
```
declare module 'preact/src/jsx' {
namespace JSXInternal {
// We're extending the IntrinsicElements interface which holds a kv-list of
// available ... | There is a better way to do this without manually binding events.
You can use `@lit-labs/react`'s `createComponent` to wrap web component to React Component.
```js
import * as React from "react";
import { createComponent } from "@lit-labs/react";
import Slrange from "@shoelace-style/shoelace/dist/components/range/ra... |
61,015,445 | I'm using [custom-elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) aka web-components within [Preact](https://preactjs.com/). The problem is that Typescript complains about elements not being defined in `JSX.IntrinsicElements` - in this case a `check-box` element:
```html
<d... | 2020/04/03 | [
"https://Stackoverflow.com/questions/61015445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7664765/"
] | Here are the correct attributes to use, otherwise you will get an error when passing `key` in for example.
```js
declare global {
namespace JSX {
interface IntrinsicElements {
'xx-element1': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; // Normal web component
'xx-element2'... | With typescript 4.2.3 and preact 10.5.13, here is what works to define a custom tag name with attributes:
```
declare module 'preact' {
namespace JSX {
interface IntrinsicElements {
'overlay-trigger': OverlayTriggerAttributes;
}
}
}
interface OverlayTriggerAttributes extends preact... |
61,015,445 | I'm using [custom-elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) aka web-components within [Preact](https://preactjs.com/). The problem is that Typescript complains about elements not being defined in `JSX.IntrinsicElements` - in this case a `check-box` element:
```html
<d... | 2020/04/03 | [
"https://Stackoverflow.com/questions/61015445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7664765/"
] | Here are the correct attributes to use, otherwise you will get an error when passing `key` in for example.
```js
declare global {
namespace JSX {
interface IntrinsicElements {
'xx-element1': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>; // Normal web component
'xx-element2'... | There is a better way to do this without manually binding events.
You can use `@lit-labs/react`'s `createComponent` to wrap web component to React Component.
```js
import * as React from "react";
import { createComponent } from "@lit-labs/react";
import Slrange from "@shoelace-style/shoelace/dist/components/range/ra... |
61,015,445 | I'm using [custom-elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) aka web-components within [Preact](https://preactjs.com/). The problem is that Typescript complains about elements not being defined in `JSX.IntrinsicElements` - in this case a `check-box` element:
```html
<d... | 2020/04/03 | [
"https://Stackoverflow.com/questions/61015445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7664765/"
] | With typescript 4.2.3 and preact 10.5.13, here is what works to define a custom tag name with attributes:
```
declare module 'preact' {
namespace JSX {
interface IntrinsicElements {
'overlay-trigger': OverlayTriggerAttributes;
}
}
}
interface OverlayTriggerAttributes extends preact... | There is a better way to do this without manually binding events.
You can use `@lit-labs/react`'s `createComponent` to wrap web component to React Component.
```js
import * as React from "react";
import { createComponent } from "@lit-labs/react";
import Slrange from "@shoelace-style/shoelace/dist/components/range/ra... |
1,668,531 | What are some key bindings that aren't included? | 2009/11/03 | [
"https://Stackoverflow.com/questions/1668531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/178019/"
] | You can find the complete list of limitations in MonoTouch at [Xamarin](http://docs.xamarin.com/ios/about/limitations).
A short list of .NET features not available in MonoTouch:
* The Dynamic Language Runtime (DLR)
* Generic Virtual Methods
* P/Invokes in Generic Types
* Value types as Dictionary Keys
* System.Refle... | Here is a link of the assemblies that it ships with: <http://docs.xamarin.com/ios/about/assemblies>
Here is a summary of the .Net framework assemblies:
>
> **mscorlib.dll**
>
> *Silverlight, plus several .NET 4.0 types*
>
>
> **System.dll**
>
> *Silverlight, plus types from the following namespaces:*
>
> ... |
1,668,531 | What are some key bindings that aren't included? | 2009/11/03 | [
"https://Stackoverflow.com/questions/1668531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/178019/"
] | You can find the complete list of limitations in MonoTouch at [Xamarin](http://docs.xamarin.com/ios/about/limitations).
A short list of .NET features not available in MonoTouch:
* The Dynamic Language Runtime (DLR)
* Generic Virtual Methods
* P/Invokes in Generic Types
* Value types as Dictionary Keys
* System.Refle... | One thing to also mention is you cannot reference .NET assemblies that haven't been built/compiled using the .NET MonoTouch configuration.
So if you have a favourite .NET 2.0 library you will need to re-import the source into a new MonoTouch project, compile it, and then reference it. There may be an easier way of doi... |
1,668,531 | What are some key bindings that aren't included? | 2009/11/03 | [
"https://Stackoverflow.com/questions/1668531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/178019/"
] | Here is a link of the assemblies that it ships with: <http://docs.xamarin.com/ios/about/assemblies>
Here is a summary of the .Net framework assemblies:
>
> **mscorlib.dll**
>
> *Silverlight, plus several .NET 4.0 types*
>
>
> **System.dll**
>
> *Silverlight, plus types from the following namespaces:*
>
> ... | One thing to also mention is you cannot reference .NET assemblies that haven't been built/compiled using the .NET MonoTouch configuration.
So if you have a favourite .NET 2.0 library you will need to re-import the source into a new MonoTouch project, compile it, and then reference it. There may be an easier way of doi... |
67,344,024 | ```py
@app.route('/')
def index():
return render_template("home.html")
```
My folder structure looks like this
```
tree-/
-static/
-styles.css
-templates/
-home.html
-app.py
```
I get
**Not Found**
The requested URL was not found on the server. If you entered the URL manually please chec... | 2021/05/01 | [
"https://Stackoverflow.com/questions/67344024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15778393/"
] | Use conditional aggregation with a `having` clause:
```
select customer_id
from t
where location in ('Santa Clara', 'Milpitas')
group by customer_id
having max(store_entry) filter (where location = 'Santa Clara') >
min(store_entry) filter (where location = 'Milpitas');
```
Your statement is that the customer ... | ```
SELECT DISTINCT Customer_ID
FROM table t1
JOIN table t2 USING (Customer_ID)
WHERE t1.Location = 'Santa Clara'
AND t2.Location = 'Milpitas'
AND t1.Store_Entry > t2.Store_Entry
``` |
67,344,024 | ```py
@app.route('/')
def index():
return render_template("home.html")
```
My folder structure looks like this
```
tree-/
-static/
-styles.css
-templates/
-home.html
-app.py
```
I get
**Not Found**
The requested URL was not found on the server. If you entered the URL manually please chec... | 2021/05/01 | [
"https://Stackoverflow.com/questions/67344024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15778393/"
] | ```
SELECT DISTINCT Customer_ID
FROM table t1
JOIN table t2 USING (Customer_ID)
WHERE t1.Location = 'Santa Clara'
AND t2.Location = 'Milpitas'
AND t1.Store_Entry > t2.Store_Entry
``` | Query For mySQL 8.0
```
WITH cte AS (
SELECT *, LEAD(region) OVER (PARTITION BY customer_id ORDER BY customer_id, store_entry) AS next_region
FROM tour_tab
)
SELECT customer_id
FROM cte
WHERE region=5 AND next_region=2 /* 'Santa Clara' AND 'Milpitas' */
``` |
67,344,024 | ```py
@app.route('/')
def index():
return render_template("home.html")
```
My folder structure looks like this
```
tree-/
-static/
-styles.css
-templates/
-home.html
-app.py
```
I get
**Not Found**
The requested URL was not found on the server. If you entered the URL manually please chec... | 2021/05/01 | [
"https://Stackoverflow.com/questions/67344024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15778393/"
] | Use conditional aggregation with a `having` clause:
```
select customer_id
from t
where location in ('Santa Clara', 'Milpitas')
group by customer_id
having max(store_entry) filter (where location = 'Santa Clara') >
min(store_entry) filter (where location = 'Milpitas');
```
Your statement is that the customer ... | Query For mySQL 8.0
```
WITH cte AS (
SELECT *, LEAD(region) OVER (PARTITION BY customer_id ORDER BY customer_id, store_entry) AS next_region
FROM tour_tab
)
SELECT customer_id
FROM cte
WHERE region=5 AND next_region=2 /* 'Santa Clara' AND 'Milpitas' */
``` |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | You can use tuples which are hashable and [`collections.Counter`](https://docs.python.org/2/library/collections.html#collections.Counter):
```
>>> multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
>>> multituples = [tuple(l) for l in multilist]
>>> from collections import Counter
>>> tc = Counter(multituples)
>>> ... | ---
You can try like this,
```
>>> multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
>>> c = [multilist.count(l) for l in multilist]
>>> for ind, l in enumerate(multilist):
... print( "%s: count %d times" % (str(l), c[ind]))
...
[1, 2]: count 1 times
[3, 4, 5]: count 2 times
[3, 4, 5]: count 2 times
[5, 6]: co... |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | If you want to guarantee that the order of the unique items is the same as in the original list, you could do something like:
```
>>> class Seen(set):
... def __contains__(self, item):
... res = super(Seen, self).__contains__(item)
... self.add(item)
... return res
...
>>> seen = Seen()
>>>... | As @ReutSharabani suggested, you can use tuples as dictionary keys, and then convert back to lists for display purposes. The code below doesn't reply on `collections` (not that there's anything wrong with that).
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
histogram = {}
for x in multilist:
xt = tuple... |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | If you want to guarantee that the order of the unique items is the same as in the original list, you could do something like:
```
>>> class Seen(set):
... def __contains__(self, item):
... res = super(Seen, self).__contains__(item)
... self.add(item)
... return res
...
>>> seen = Seen()
>>>... | ---
You can try like this,
```
>>> multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
>>> c = [multilist.count(l) for l in multilist]
>>> for ind, l in enumerate(multilist):
... print( "%s: count %d times" % (str(l), c[ind]))
...
[1, 2]: count 1 times
[3, 4, 5]: count 2 times
[3, 4, 5]: count 2 times
[5, 6]: co... |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | How about using repr( alist) to convert it to its text string representation?
```
from collections import defaultdict
d = defaultdict(int)
for e in multilist: d[ repr(e)] += 1
for k,v in d.items(): print "{0}: count {1} times".format( k,v)
``` | You can use a dictionary for this
```
count_data = {}
for my_list in multilist:
count_data.setdefault(tuple(my_list), 0)
count_data[tuple(my_list)] += 1
``` |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | You can use tuples which are hashable and [`collections.Counter`](https://docs.python.org/2/library/collections.html#collections.Counter):
```
>>> multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
>>> multituples = [tuple(l) for l in multilist]
>>> from collections import Counter
>>> tc = Counter(multituples)
>>> ... | How about using repr( alist) to convert it to its text string representation?
```
from collections import defaultdict
d = defaultdict(int)
for e in multilist: d[ repr(e)] += 1
for k,v in d.items(): print "{0}: count {1} times".format( k,v)
``` |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | ---
You can try like this,
```
>>> multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
>>> c = [multilist.count(l) for l in multilist]
>>> for ind, l in enumerate(multilist):
... print( "%s: count %d times" % (str(l), c[ind]))
...
[1, 2]: count 1 times
[3, 4, 5]: count 2 times
[3, 4, 5]: count 2 times
[5, 6]: co... | You can use a dictionary for this
```
count_data = {}
for my_list in multilist:
count_data.setdefault(tuple(my_list), 0)
count_data[tuple(my_list)] += 1
``` |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | As @ReutSharabani suggested, you can use tuples as dictionary keys, and then convert back to lists for display purposes. The code below doesn't reply on `collections` (not that there's anything wrong with that).
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
histogram = {}
for x in multilist:
xt = tuple... | You can use a dictionary for this
```
count_data = {}
for my_list in multilist:
count_data.setdefault(tuple(my_list), 0)
count_data[tuple(my_list)] += 1
``` |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | If you want to guarantee that the order of the unique items is the same as in the original list, you could do something like:
```
>>> class Seen(set):
... def __contains__(self, item):
... res = super(Seen, self).__contains__(item)
... self.add(item)
... return res
...
>>> seen = Seen()
>>>... | You can use a dictionary for this
```
count_data = {}
for my_list in multilist:
count_data.setdefault(tuple(my_list), 0)
count_data[tuple(my_list)] += 1
``` |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | You can use tuples which are hashable and [`collections.Counter`](https://docs.python.org/2/library/collections.html#collections.Counter):
```
>>> multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
>>> multituples = [tuple(l) for l in multilist]
>>> from collections import Counter
>>> tc = Counter(multituples)
>>> ... | As @ReutSharabani suggested, you can use tuples as dictionary keys, and then convert back to lists for display purposes. The code below doesn't reply on `collections` (not that there's anything wrong with that).
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
histogram = {}
for x in multilist:
xt = tuple... |
32,250,035 | I have a multi-dimensional list as like below
```
multilist = [[1,2],[3,4,5],[3,4,5],[5,6],[5,6],[5,6]]
```
How can I get below results fast:
```
[1,2]: count 1 times
[3,4,5]: count 2 times
[5,6]: count 3 times
```
and also get the unique multi-dimensional list (remove duplicates) :
```
multi_list = [[1,2],[3,4,... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32250035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4737273/"
] | If you want to guarantee that the order of the unique items is the same as in the original list, you could do something like:
```
>>> class Seen(set):
... def __contains__(self, item):
... res = super(Seen, self).__contains__(item)
... self.add(item)
... return res
...
>>> seen = Seen()
>>>... | How about using repr( alist) to convert it to its text string representation?
```
from collections import defaultdict
d = defaultdict(int)
for e in multilist: d[ repr(e)] += 1
for k,v in d.items(): print "{0}: count {1} times".format( k,v)
``` |
34,493,008 | I need to use all the classes in one project in another. I tried adding the references, clicked on the project tab but I can't see the `.cs` or `.sln` files or any other files, just the exe in the debug folder and the `.vshost` file and the manifest file.
What file do I need to reference in the project? | 2015/12/28 | [
"https://Stackoverflow.com/questions/34493008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5717987/"
] | File > Open > Project/Solution > Add to Solution (A little checkbox in the file dialog) then click the .sln you want | Right mouse click on the project that needs a reference to another project --> Add Reference --> Click the checkbox(es) next to each project you wish to refer.
[](https://i.stack.imgur.com/vzMDO.png)
Once you have added your reference you will... |
34,493,008 | I need to use all the classes in one project in another. I tried adding the references, clicked on the project tab but I can't see the `.cs` or `.sln` files or any other files, just the exe in the debug folder and the `.vshost` file and the manifest file.
What file do I need to reference in the project? | 2015/12/28 | [
"https://Stackoverflow.com/questions/34493008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5717987/"
] | File > Open > Project/Solution > Add to Solution (A little checkbox in the file dialog) then click the .sln you want | You need to elaborate you question - Well why would you want to have redundant classes in two projects better build a class library and reference the dll in both the projects. If at all you need to include the classes from one project to another you simply need to copy the .cs file to other project and then select proj... |
34,493,008 | I need to use all the classes in one project in another. I tried adding the references, clicked on the project tab but I can't see the `.cs` or `.sln` files or any other files, just the exe in the debug folder and the `.vshost` file and the manifest file.
What file do I need to reference in the project? | 2015/12/28 | [
"https://Stackoverflow.com/questions/34493008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5717987/"
] | Right mouse click on the project that needs a reference to another project --> Add Reference --> Click the checkbox(es) next to each project you wish to refer.
[](https://i.stack.imgur.com/vzMDO.png)
Once you have added your reference you will... | You need to elaborate you question - Well why would you want to have redundant classes in two projects better build a class library and reference the dll in both the projects. If at all you need to include the classes from one project to another you simply need to copy the .cs file to other project and then select proj... |
24,377,354 | I'm struggling to understand what this code does
```
ldi r20, 80
loop: asr r20
brsh loop
nop
```
What is this code doing and how many clock cycles does this code take to execute? | 2014/06/24 | [
"https://Stackoverflow.com/questions/24377354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3603183/"
] | I routinely have
```
static Action<object> o = s => Console.WriteLine(s);
```
in my code which makes debug output so much less noisy. That way I can call Console's static Writeline() much easier. Would that help? | In C#? Not possible. Because it's a full OOP programming language and it was designed to work with objects you can't use functions outside the scope of an object. When calling static methods you have to specify the class where that static method lives...
```
Class.StaticMethod();
```
you can only use the short-hand ... |
24,377,354 | I'm struggling to understand what this code does
```
ldi r20, 80
loop: asr r20
brsh loop
nop
```
What is this code doing and how many clock cycles does this code take to execute? | 2014/06/24 | [
"https://Stackoverflow.com/questions/24377354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3603183/"
] | If you're looking to define a globally-scoped procedure then the short answer is no, you can't do this in c#. No global functions, procedures or objects.
In C# everything apart from namespaces and types (class, struct, enum, interface) must be defined inside a type. Static members (fields, properties and methods) can ... | In C#? Not possible. Because it's a full OOP programming language and it was designed to work with objects you can't use functions outside the scope of an object. When calling static methods you have to specify the class where that static method lives...
```
Class.StaticMethod();
```
you can only use the short-hand ... |
24,377,354 | I'm struggling to understand what this code does
```
ldi r20, 80
loop: asr r20
brsh loop
nop
```
What is this code doing and how many clock cycles does this code take to execute? | 2014/06/24 | [
"https://Stackoverflow.com/questions/24377354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3603183/"
] | using static yournamespace.yourclassname;
then call the static class method without class name;
Example:
Class1.cs
```
namespace WindowsFormsApplication1
{
class Utils
{
public static void Hello()
{
System.Diagnostics.Debug.WriteLine("Hello world!");
}
}
}
```
Form1... | In C#? Not possible. Because it's a full OOP programming language and it was designed to work with objects you can't use functions outside the scope of an object. When calling static methods you have to specify the class where that static method lives...
```
Class.StaticMethod();
```
you can only use the short-hand ... |
24,377,354 | I'm struggling to understand what this code does
```
ldi r20, 80
loop: asr r20
brsh loop
nop
```
What is this code doing and how many clock cycles does this code take to execute? | 2014/06/24 | [
"https://Stackoverflow.com/questions/24377354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3603183/"
] | using static yournamespace.yourclassname;
then call the static class method without class name;
Example:
Class1.cs
```
namespace WindowsFormsApplication1
{
class Utils
{
public static void Hello()
{
System.Diagnostics.Debug.WriteLine("Hello world!");
}
}
}
```
Form1... | I routinely have
```
static Action<object> o = s => Console.WriteLine(s);
```
in my code which makes debug output so much less noisy. That way I can call Console's static Writeline() much easier. Would that help? |
24,377,354 | I'm struggling to understand what this code does
```
ldi r20, 80
loop: asr r20
brsh loop
nop
```
What is this code doing and how many clock cycles does this code take to execute? | 2014/06/24 | [
"https://Stackoverflow.com/questions/24377354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3603183/"
] | using static yournamespace.yourclassname;
then call the static class method without class name;
Example:
Class1.cs
```
namespace WindowsFormsApplication1
{
class Utils
{
public static void Hello()
{
System.Diagnostics.Debug.WriteLine("Hello world!");
}
}
}
```
Form1... | If you're looking to define a globally-scoped procedure then the short answer is no, you can't do this in c#. No global functions, procedures or objects.
In C# everything apart from namespaces and types (class, struct, enum, interface) must be defined inside a type. Static members (fields, properties and methods) can ... |
58,106,488 | Say I have a `Dockerfile` that will run a Ruby on Rails app:
```
FROM ruby:2.5.1
# - apt-get update, install nodejs, yarn, bundler, etc...
# - run yarn install, bundle install, etc...
# - create working directory and copy files
# ....
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
```
From my understan... | 2019/09/25 | [
"https://Stackoverflow.com/questions/58106488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2490003/"
] | You have to capture the event in your callback and get the value from it
```
sendData = e => {
this.props.parentCallback(e.target.value)
}
```
And change `onClick` to `onChange` | You can add a onChange attribute to the input field , this will handle the typing as an event.
```
const handleChange = ( event ) => {
console.log(event.target.value)
}
<input onChange={handleChange} type="text" name="name" id="myTextInput" />
``` |
58,106,488 | Say I have a `Dockerfile` that will run a Ruby on Rails app:
```
FROM ruby:2.5.1
# - apt-get update, install nodejs, yarn, bundler, etc...
# - run yarn install, bundle install, etc...
# - create working directory and copy files
# ....
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
```
From my understan... | 2019/09/25 | [
"https://Stackoverflow.com/questions/58106488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2490003/"
] | You have to capture the event in your callback and get the value from it
```
sendData = e => {
this.props.parentCallback(e.target.value)
}
```
And change `onClick` to `onChange` | you should make the `handleChange()` function in `ChangeState` class and get the value.
***for example:***
```js
class ChangeState extends React.Component {
state = {value: ''};
handleChange = (e) => {
this.setState({value: e.target.value});
}
sendData = () => {
this.props.pare... |
2,864,016 | I have some troubles with ssl using httpclient on android i am trying to access self signed certificate in details i want my app to trust all certificates ( i will use ssl only for data encryption). First i tried using this guide <http://hc.apache.org/httpclient-3.x/sslguide.html> on Desktop is working fine but on andr... | 2010/05/19 | [
"https://Stackoverflow.com/questions/2864016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184601/"
] | If you happen to look at the code of DefaultHttpClient, it looks something like this:
```
@Override
protected ClientConnectionManager createClientConnectionManager() {
SchemeRegistry registry = new SchemeRegistry();
registry.register(
new Scheme("http", PlainSocketFactory.getSock... | The key idea is to use a customized SSLSocketFactory implementing LayeredSocketFactory. The customized socket doesn't need to HostNameVerifier.
```
private static final class TrustAllSSLSocketFactory implements
LayeredSocketFactory {
private static final TrustAllSSLSocketFactory DEFAULT_FACTORY = new TrustAll... |
2,864,016 | I have some troubles with ssl using httpclient on android i am trying to access self signed certificate in details i want my app to trust all certificates ( i will use ssl only for data encryption). First i tried using this guide <http://hc.apache.org/httpclient-3.x/sslguide.html> on Desktop is working fine but on andr... | 2010/05/19 | [
"https://Stackoverflow.com/questions/2864016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184601/"
] | If you happen to look at the code of DefaultHttpClient, it looks something like this:
```
@Override
protected ClientConnectionManager createClientConnectionManager() {
SchemeRegistry registry = new SchemeRegistry();
registry.register(
new Scheme("http", PlainSocketFactory.getSock... | Rather than accepting all certificates, I recommend this solution: [Trusting all certificates using HttpClient over HTTPS](https://stackoverflow.com/questions/2642777/trusting-all-certificates-using-httpclient-over-https/6378872#6378872) |
4,987,429 | I'm trying to make an array of hashes. This is my code. The $1, $2, etc are matched from a regular expression and I've checked they exist.
**Update:** Fixed my initial issue, but now I'm having the problem that my array is not growing beyond a size of 1 when I push items onto it...
**Update 2:** It is a scope issue, ... | 2011/02/13 | [
"https://Stackoverflow.com/questions/4987429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/113705/"
] | You are pushing `$rule`, which does not exist. You meant to push a reference to `%rule`:
```
push @ACLs, \%rule;
```
Always start your programs with `use strict; use warnings;`. That would have stopped you from trying to push `$rule`.
**Update:** In Perl, an array can only contain scalars. The way complex data stru... | ```
my %rule = [...]
push @ACLs, $rule;
```
These two lines refer to two separate variables: a hash and a scalar. They are not the same.
It depends on what you're waning to do, but there are two solutions:
```
push @ACLs, \%rule;
```
would push a reference into the array.
```
push @ACLs, %rule;
```
would push... |
4,987,429 | I'm trying to make an array of hashes. This is my code. The $1, $2, etc are matched from a regular expression and I've checked they exist.
**Update:** Fixed my initial issue, but now I'm having the problem that my array is not growing beyond a size of 1 when I push items onto it...
**Update 2:** It is a scope issue, ... | 2011/02/13 | [
"https://Stackoverflow.com/questions/4987429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/113705/"
] | You are pushing `$rule`, which does not exist. You meant to push a reference to `%rule`:
```
push @ACLs, \%rule;
```
Always start your programs with `use strict; use warnings;`. That would have stopped you from trying to push `$rule`.
**Update:** In Perl, an array can only contain scalars. The way complex data stru... | You’re clearing `@ACLs` each time through the loop. Your `my` is misplaced. |
507,894 | Is it safe if my server will create a SSH key pair for my client?
Scenario: I(server admin) will create a ssh key pair and put public key into authorized\_keys and give the private key to client so he can access my sftp server. | 2019/03/22 | [
"https://unix.stackexchange.com/questions/507894",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/343037/"
] | Quick $0.02 because I've got to get ready for work:
Assuming this server isn't protecting actual banks or national security-level secrecy, you're fine.
About the only potential risk I can imagine from this is if a hostile third party intercepted enough of those private keys and the exact time they were generated, the... | To allow access vith ssh/scp/sftp you can use public/private key pair. (\*)
I you generate and install such pair you will controll who will access a specific part of your server (in your case sftp directory).
If you have two or more customer/partner, be sure to generate one key per partner.
This way customer1 will a... |
507,894 | Is it safe if my server will create a SSH key pair for my client?
Scenario: I(server admin) will create a ssh key pair and put public key into authorized\_keys and give the private key to client so he can access my sftp server. | 2019/03/22 | [
"https://unix.stackexchange.com/questions/507894",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/343037/"
] | Your customer should be **generating their own keys** and **securing them with a passphrase**, then giving you their **public key** to store on the server you manage and that they need to access. **Their private key should never be given to anyone and it should be encrypted** (i.e. secured with a passphrase). | To allow access vith ssh/scp/sftp you can use public/private key pair. (\*)
I you generate and install such pair you will controll who will access a specific part of your server (in your case sftp directory).
If you have two or more customer/partner, be sure to generate one key per partner.
This way customer1 will a... |
55,093,954 | I am new to Spring and Spring Boot and am working through a book that is full of missing information.
I have a taco class:
```
public class Taco {
...
@Size(min=1, message="You must choose at least 1 ingredient")
private List<Ingredient> ingredients;
...
}
```
As you can see `ingredients` is of t... | 2019/03/11 | [
"https://Stackoverflow.com/questions/55093954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9949924/"
] | I met the same problem, what we need here is a converter.
```
package tacos.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;
import tacos.Ingredient;
import tacos.data.IngredientRepository... | An optimisation of Ian's answer above:
Fetch the ingredients in the constructor of the converter.
```
package com.joeseff.xlabs.chtp01_1.tacos.converter;
import com.joeseff.xlabs.chtp01_1.tacos.model.Ingredient;
import com.joeseff.xlabs.chtp01_1.tacos.respository.jdbc.IngredientRepository;
import org.springframework... |
7,921,457 | hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert new data, i submit a... | 2011/10/27 | [
"https://Stackoverflow.com/questions/7921457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998967/"
] | You're allocating a huge array in stack:
```
int prime[2000000]={};
```
Four bytes times two million equals eight megabytes, which is often the maximum stack size. Allocating more than that results in segmentation fault.
You should allocate the array in heap, instead:
```
int *prime;
prime = malloc(2000000 * sizeo... | Here is my implementation.
```
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int* sieve(int n) {
int* A = calloc(n, sizeof(int));
for(int i = 2; i < (int) sqrt(n); i++) {
if (!A[i]) {
for (int j = i*i; j < n; j+=i) {
A[j] = 1;
}
}
}
return A;
}
```
I benchmarked it for... |
7,921,457 | hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert new data, i submit a... | 2011/10/27 | [
"https://Stackoverflow.com/questions/7921457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998967/"
] | You're allocating a huge array in stack:
```
int prime[2000000]={};
```
Four bytes times two million equals eight megabytes, which is often the maximum stack size. Allocating more than that results in segmentation fault.
You should allocate the array in heap, instead:
```
int *prime;
prime = malloc(2000000 * sizeo... | Here was my implementation (Java)
much simpler in that you really only need one array, just start for loops at 2.
edit: @cheesehead 's solution was probably better, i just read the description of the sieve and thought it would be a good thought exercise.
```
// set max;
int max = 100000000;
// log... |
7,921,457 | hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert new data, i submit a... | 2011/10/27 | [
"https://Stackoverflow.com/questions/7921457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998967/"
] | You're allocating a huge array in stack:
```
int prime[2000000]={};
```
Four bytes times two million equals eight megabytes, which is often the maximum stack size. Allocating more than that results in segmentation fault.
You should allocate the array in heap, instead:
```
int *prime;
prime = malloc(2000000 * sizeo... | **Simple implementation of Sieve of Eratosthenes**
**Approach:**
I have created a boolean vector of size n+1(say n=9 then 0 to 9)that holds true at all places. Now, *for i=2* mark all the places that are *multiple of 2 as **false***(like 4,6 and 8 when n=9). For *i=3*, mark all the places that are *multiple of 3 as **... |
7,921,457 | hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert new data, i submit a... | 2011/10/27 | [
"https://Stackoverflow.com/questions/7921457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998967/"
] | Here is my implementation.
```
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int* sieve(int n) {
int* A = calloc(n, sizeof(int));
for(int i = 2; i < (int) sqrt(n); i++) {
if (!A[i]) {
for (int j = i*i; j < n; j+=i) {
A[j] = 1;
}
}
}
return A;
}
```
I benchmarked it for... | Here was my implementation (Java)
much simpler in that you really only need one array, just start for loops at 2.
edit: @cheesehead 's solution was probably better, i just read the description of the sieve and thought it would be a good thought exercise.
```
// set max;
int max = 100000000;
// log... |
7,921,457 | hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert new data, i submit a... | 2011/10/27 | [
"https://Stackoverflow.com/questions/7921457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998967/"
] | Here is my implementation.
```
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int* sieve(int n) {
int* A = calloc(n, sizeof(int));
for(int i = 2; i < (int) sqrt(n); i++) {
if (!A[i]) {
for (int j = i*i; j < n; j+=i) {
A[j] = 1;
}
}
}
return A;
}
```
I benchmarked it for... | **Simple implementation of Sieve of Eratosthenes**
**Approach:**
I have created a boolean vector of size n+1(say n=9 then 0 to 9)that holds true at all places. Now, *for i=2* mark all the places that are *multiple of 2 as **false***(like 4,6 and 8 when n=9). For *i=3*, mark all the places that are *multiple of 3 as **... |
7,921,457 | hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert new data, i submit a... | 2011/10/27 | [
"https://Stackoverflow.com/questions/7921457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998967/"
] | Here was my implementation (Java)
much simpler in that you really only need one array, just start for loops at 2.
edit: @cheesehead 's solution was probably better, i just read the description of the sieve and thought it would be a good thought exercise.
```
// set max;
int max = 100000000;
// log... | **Simple implementation of Sieve of Eratosthenes**
**Approach:**
I have created a boolean vector of size n+1(say n=9 then 0 to 9)that holds true at all places. Now, *for i=2* mark all the places that are *multiple of 2 as **false***(like 4,6 and 8 when n=9). For *i=3*, mark all the places that are *multiple of 3 as **... |
58,889,280 | How to run Ruta scripts from command line?
I tried this but not sure if this is right command.
`javac DataExtraction.ruta`
Error : `error: Class names, 'DataExtraction.ruta', are only accepted if annotation processing is explicitly requested` | 2019/11/16 | [
"https://Stackoverflow.com/questions/58889280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5894701/"
] | You are taking the wrong argument from the function parameter and should remove the `return` from `else` statement:
Correct code will be:
```py
import os
def files():
files = os.listdir()
file_found_flag = False
for file in files:
if file.lower().endswith('.jpg'):
name= Dict['jpg']... | You can cleanly do it like this
```
EXT_IMAGES = ['.png', '.jpg', '.jpeg', '.bmp', '.svg']
EXT_VIDEOS = ['.mp4', '.mkv', '.webm', '.mpeg', '.flv', '.m4a', '.f4v', '.f4a', '.m4b', '.m4r', '.f4b', '.mov', '.avi', '.wmv']
EXT_AUDIOS = ['.mp3', '.wav', '.raw', '.wma']
EXT_EXCEL = ['.xlsx']
def check_files():
files = ... |
58,889,280 | How to run Ruta scripts from command line?
I tried this but not sure if this is right command.
`javac DataExtraction.ruta`
Error : `error: Class names, 'DataExtraction.ruta', are only accepted if annotation processing is explicitly requested` | 2019/11/16 | [
"https://Stackoverflow.com/questions/58889280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5894701/"
] | You are taking the wrong argument from the function parameter and should remove the `return` from `else` statement:
Correct code will be:
```py
import os
def files():
files = os.listdir()
file_found_flag = False
for file in files:
if file.lower().endswith('.jpg'):
name= Dict['jpg']... | A few of things I noticed that might be wrong in your code:
1. file is a builtin in Python. You might want to change your variable name to something other than file.
```
for f in files:
if f.lower().endswith('.jpg'):
name= Dict['jpg']
name(f)
elif f.lower().endswith('.pdf'):
e= Dict['p... |
81,929 | I have acquired a lot of nice blue and green equipments ~lvl 20. I have no use for these since my class can't equip them. Should I just npc these or salvage them? What is the most profitable way? | 2012/08/28 | [
"https://gaming.stackexchange.com/questions/81929",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/27998/"
] | The most profitable way to get rid of rare equipment is often the Black Lion Trading Post. For common equipment, the trade price is not even high enough to account for the cost to post the item. In those cases, it is more profitable to just sell them to a merchant.
I would just sell them to a merchant unless you reall... | Most common equipment is better off salvaged than sold. Even if you're not going to do crafting, you can usually sell the components you salvage in the TP for more than what you can sell the original item for. For 'green' items and above, better to sell them to the merchant or TP. You can check the prices in the TP whe... |
81,929 | I have acquired a lot of nice blue and green equipments ~lvl 20. I have no use for these since my class can't equip them. Should I just npc these or salvage them? What is the most profitable way? | 2012/08/28 | [
"https://gaming.stackexchange.com/questions/81929",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/27998/"
] | The most profitable way to get rid of rare equipment is often the Black Lion Trading Post. For common equipment, the trade price is not even high enough to account for the cost to post the item. In those cases, it is more profitable to just sell them to a merchant.
I would just sell them to a merchant unless you reall... | It really depends also on what you are aiming at, for example Legendary weapons require different behavior, but basically that's what I do:
76+ rare/exotic weapons: save for throwing in Mystic Forge for legendary precursor
68+ rare/exotic weapons/armors: salvage with Black Lion Kit for Globes of Ectoplasm (to craft n... |
34,479,693 | *I am new to StackOverflow so please correct me if there is a better way to post a question which is a specific case of an existing question.*
Alberto Barrera answered
[How does one seed the random number generator in Swift?](https://stackoverflow.com/questions/25895081/how-does-one-seed-the-random-number-generator-i... | 2015/12/27 | [
"https://Stackoverflow.com/questions/34479693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5646134/"
] | `srand` is working as expected. If you change value each time in `let time = UInt32(NSDate().timeIntervalSinceReferenceDate)` instead of `NSDate().timeIntervalSinceReferenceDate` with any number, it will output random numbers.
Maybe this is a caching issue, it just doesn't see any changes in code and doesn't send it f... | I don't know what is going on but today it is totally working. So I guess the question is answered:
```
srand(UInt32(NSDate().timeIntervalSinceReferenceDate))
```
works fine.
(I think something must have changed. It was behaving the same way (generating the same number with repeated attempts) on two different comp... |
34,479,693 | *I am new to StackOverflow so please correct me if there is a better way to post a question which is a specific case of an existing question.*
Alberto Barrera answered
[How does one seed the random number generator in Swift?](https://stackoverflow.com/questions/25895081/how-does-one-seed-the-random-number-generator-i... | 2015/12/27 | [
"https://Stackoverflow.com/questions/34479693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5646134/"
] | This was an issue with the way we implemented server-side caching in the Sandbox; non-deterministic code would continually return the same answer even though it should not have. We've disabled it for now, and you should be getting different results with each run. We're currently working on better mechanisms to ensure t... | `srand` is working as expected. If you change value each time in `let time = UInt32(NSDate().timeIntervalSinceReferenceDate)` instead of `NSDate().timeIntervalSinceReferenceDate` with any number, it will output random numbers.
Maybe this is a caching issue, it just doesn't see any changes in code and doesn't send it f... |
34,479,693 | *I am new to StackOverflow so please correct me if there is a better way to post a question which is a specific case of an existing question.*
Alberto Barrera answered
[How does one seed the random number generator in Swift?](https://stackoverflow.com/questions/25895081/how-does-one-seed-the-random-number-generator-i... | 2015/12/27 | [
"https://Stackoverflow.com/questions/34479693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5646134/"
] | This was an issue with the way we implemented server-side caching in the Sandbox; non-deterministic code would continually return the same answer even though it should not have. We've disabled it for now, and you should be getting different results with each run. We're currently working on better mechanisms to ensure t... | I don't know what is going on but today it is totally working. So I guess the question is answered:
```
srand(UInt32(NSDate().timeIntervalSinceReferenceDate))
```
works fine.
(I think something must have changed. It was behaving the same way (generating the same number with repeated attempts) on two different comp... |
56,955,320 | I have a JSON file which contains text like this
```
.....wax, and voila!\u00c2\u00a0At the moment you can't use our ...
```
My simple question is how CONVERT (not remove) these \u codes to spaces, apostrophes and e.t.c...?
**Input:** a text file with `.....wax, and voila!\u00c2\u00a0At the moment you can't use ou... | 2019/07/09 | [
"https://Stackoverflow.com/questions/56955320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11506172/"
] | I have made this crude UTF-8 unmangler, which appears to solve your messed-up encoding situation:
```
import codecs
import re
import json
def unmangle_utf8(match):
escaped = match.group(0) # '\\u00e2\\u0082\\u00ac'
hexstr = escaped.replace(r'\u00', '') # 'e282ac'
buffer = codecs.dec... | The hacky approach is to remove the outer layer of encoding:
```py
import re
# Assume export is a bytes-like object
export = re.sub(b'\\\u00([89a-f][0-9a-f])', lambda m: bytes.fromhex(m.group(1).decode()), export, flags=re.IGNORECASE)
```
This matches the escaped UTF-8 bytes and replaces them with actual UTF-8 bytes... |
56,955,320 | I have a JSON file which contains text like this
```
.....wax, and voila!\u00c2\u00a0At the moment you can't use our ...
```
My simple question is how CONVERT (not remove) these \u codes to spaces, apostrophes and e.t.c...?
**Input:** a text file with `.....wax, and voila!\u00c2\u00a0At the moment you can't use ou... | 2019/07/09 | [
"https://Stackoverflow.com/questions/56955320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11506172/"
] | The hacky approach is to remove the outer layer of encoding:
```py
import re
# Assume export is a bytes-like object
export = re.sub(b'\\\u00([89a-f][0-9a-f])', lambda m: bytes.fromhex(m.group(1).decode()), export, flags=re.IGNORECASE)
```
This matches the escaped UTF-8 bytes and replaces them with actual UTF-8 bytes... | As you try to write this in a file named `TEST.json`, I will assume that this string is a part of a larger json string.
Let me use an full example:
```
js = '''{"a": "and voila!\\u00c2\\u00a0At the moment you can't use our"}'''
print(js)
{"a": "and voila!\u00c2\u00a0At the moment you can't use our"}
```
I would fi... |
56,955,320 | I have a JSON file which contains text like this
```
.....wax, and voila!\u00c2\u00a0At the moment you can't use our ...
```
My simple question is how CONVERT (not remove) these \u codes to spaces, apostrophes and e.t.c...?
**Input:** a text file with `.....wax, and voila!\u00c2\u00a0At the moment you can't use ou... | 2019/07/09 | [
"https://Stackoverflow.com/questions/56955320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11506172/"
] | I have made this crude UTF-8 unmangler, which appears to solve your messed-up encoding situation:
```
import codecs
import re
import json
def unmangle_utf8(match):
escaped = match.group(0) # '\\u00e2\\u0082\\u00ac'
hexstr = escaped.replace(r'\u00', '') # 'e282ac'
buffer = codecs.dec... | As you try to write this in a file named `TEST.json`, I will assume that this string is a part of a larger json string.
Let me use an full example:
```
js = '''{"a": "and voila!\\u00c2\\u00a0At the moment you can't use our"}'''
print(js)
{"a": "and voila!\u00c2\u00a0At the moment you can't use our"}
```
I would fi... |
2,209,575 | I have a puzzling problem -- it seems like it should be so easy to do but somehow it is not working. I have an object called Player. The Manager class has four instances of Player:
```
@interface Manager
{
Player *p1, *p2, *mCurrentPlayer, *mCurrentOpponent;
}
// @property...
```
The Manager object has initPla... | 2010/02/05 | [
"https://Stackoverflow.com/questions/2209575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/237668/"
] | Without knowing how your accessors are set up, it will be difficult to troubleshoot the code as-is. That being said, here is how your accessors and code *should* be set up:
>
> **Manager.h**
>
>
>
```
@interface Manager
{
Player *p1, *p2, *mCurrentPlayer, *mCurrentOpponent;
}
@property (nonatomic, retain) Pl... | It turns out the problem was somewhere unrelated in the code and I misread the symptoms of the problem! But just for the sake of discussion, why is it necessary to have @property on multiple lines, and to use a temp variable to swap the players (as per e.James answer)? |
800,831 | How do I take inverse Laplace transform of $\frac{-2s+3}{s^2-2s+2}$?
I have checked my transform table and there is not a suitable case for this expression. | 2014/05/18 | [
"https://math.stackexchange.com/questions/800831",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/141312/"
] | To perform the inverse Laplace transform you need to complete the square at the denominator,
$$ s^2-2s+2=(s-1)^2+1$$
so you rewrite your expression as
$$\frac{-2s+3}{(s-1)^2+1}= -2 \frac{(s-1)}{(s-1)^2+1}+\frac{(3-2)}{(s-1)^2+1}$$
now these expressions are standard on tables "exponentially decaying
sine/cosine wave... | You may want to try this (slighlty) different approach:
Let $F(s)$ be the function to be inverse-Laplace transformed. Then, $F(s)$ admits the following partial fraction decomposition:
$$F(s) = \frac{A\_1}{s-s\_1} + \frac{A\_2}{s-s\_2},$$ where $s\_1 = 1-i$, $s\_2 = \overline{s}\_1 = 1+i$, are the complex roots of the... |
13,695 | I have been working for this couple of investors for around 18 months. The set up is, these two people will buy small online businesses and I will run these businesses from a single office. Currently I have 5 businesses to manage on my own.
Around a year ago, my boss decided to come up with a forfeit scheme, every tim... | 2013/08/07 | [
"https://workplace.stackexchange.com/questions/13695",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/10218/"
] | >
> Is it OK what my boss is doing?
>
>
>
It's not appropriate for a boss to humiliate a worker - in private or in public.
And if it's at the point where you feel concerned about being at work, then it's clearly NOT OK.
Tell your boss "No" next time, and mean it. Don't let your boss guilt you into doing somethi... | Ask your boss to show you where in your agreement, you must be perfect? Are you being paid a perfect salary? Does your employment agreement perfectly fit with local labor laws?
When he asks how you are going to pay him back for mistakes, tell him you're not. Now, what does he plan on doing about it? Continuing to both... |
13,695 | I have been working for this couple of investors for around 18 months. The set up is, these two people will buy small online businesses and I will run these businesses from a single office. Currently I have 5 businesses to manage on my own.
Around a year ago, my boss decided to come up with a forfeit scheme, every tim... | 2013/08/07 | [
"https://workplace.stackexchange.com/questions/13695",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/10218/"
] | Ask your boss to show you where in your agreement, you must be perfect? Are you being paid a perfect salary? Does your employment agreement perfectly fit with local labor laws?
When he asks how you are going to pay him back for mistakes, tell him you're not. Now, what does he plan on doing about it? Continuing to both... | It seems to be a very toxic situation and i think there are concerns on your well-being here.
There are some key questions that you need to think about -
1. Firstly you should but a stop to complying with his humiliating requests and make him aware of the toll it is taking on your ability to work there and your mor... |
13,695 | I have been working for this couple of investors for around 18 months. The set up is, these two people will buy small online businesses and I will run these businesses from a single office. Currently I have 5 businesses to manage on my own.
Around a year ago, my boss decided to come up with a forfeit scheme, every tim... | 2013/08/07 | [
"https://workplace.stackexchange.com/questions/13695",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/10218/"
] | >
> Is it OK what my boss is doing?
>
>
>
It's not appropriate for a boss to humiliate a worker - in private or in public.
And if it's at the point where you feel concerned about being at work, then it's clearly NOT OK.
Tell your boss "No" next time, and mean it. Don't let your boss guilt you into doing somethi... | It seems to be a very toxic situation and i think there are concerns on your well-being here.
There are some key questions that you need to think about -
1. Firstly you should but a stop to complying with his humiliating requests and make him aware of the toll it is taking on your ability to work there and your mor... |
41,829 | The answer to this is likely "It is not possible.", and from what I know about filesystems and storage, I would say the same thing. But, I thought I would try the great wisdom of SuperUser:
I'm looking for a NAS device that will serve the same content over USB and via SMB.
I have a device (let's call it the reader) w... | 2009/09/15 | [
"https://superuser.com/questions/41829",
"https://superuser.com",
"https://superuser.com/users/9588/"
] | Basically, if I read you correctly, you want a Network Attached Storage device that allows you to access the data stored on it via USB and via an SMB network share simultaneously.
To muse a bit more with you, I think it is possible. It may not actually exist out in the world (yet), but it is possible to build somethin... | I've accepted sheepsimulator's answer. But I thought I would post my own just to get this out there. I've thought about this some more, and here's the only way I can imagine this working:
Have a disk enclosure that has both a USB port and an Ethernet port. There's a bit of firmware in the enclosure the runs a webserve... |
41,829 | The answer to this is likely "It is not possible.", and from what I know about filesystems and storage, I would say the same thing. But, I thought I would try the great wisdom of SuperUser:
I'm looking for a NAS device that will serve the same content over USB and via SMB.
I have a device (let's call it the reader) w... | 2009/09/15 | [
"https://superuser.com/questions/41829",
"https://superuser.com",
"https://superuser.com/users/9588/"
] | Basically, if I read you correctly, you want a Network Attached Storage device that allows you to access the data stored on it via USB and via an SMB network share simultaneously.
To muse a bit more with you, I think it is possible. It may not actually exist out in the world (yet), but it is possible to build somethin... | I dont know if you ever solved this, but have a look at this, I just ordered one, had a similar requirement to you, I want to carry a pc around with me and thats it, and need to be able to easily share the data on it like a drive , such as AV progs or Hirens disc etc with other pc's
<http://cgi.ebay.co.uk/USB-Go-Link-... |
41,829 | The answer to this is likely "It is not possible.", and from what I know about filesystems and storage, I would say the same thing. But, I thought I would try the great wisdom of SuperUser:
I'm looking for a NAS device that will serve the same content over USB and via SMB.
I have a device (let's call it the reader) w... | 2009/09/15 | [
"https://superuser.com/questions/41829",
"https://superuser.com",
"https://superuser.com/users/9588/"
] | Basically, if I read you correctly, you want a Network Attached Storage device that allows you to access the data stored on it via USB and via an SMB network share simultaneously.
To muse a bit more with you, I think it is possible. It may not actually exist out in the world (yet), but it is possible to build somethin... | It is not possiblwe. USB disk file-systems are managed by a host computer which is aware of blocks, allocations, which files are open, where they are, etc. It is just a block device.
A NAS on the other hand maintains internal awareness of all of these factors and they won’t match the awareness of the computer that has... |
41,829 | The answer to this is likely "It is not possible.", and from what I know about filesystems and storage, I would say the same thing. But, I thought I would try the great wisdom of SuperUser:
I'm looking for a NAS device that will serve the same content over USB and via SMB.
I have a device (let's call it the reader) w... | 2009/09/15 | [
"https://superuser.com/questions/41829",
"https://superuser.com",
"https://superuser.com/users/9588/"
] | I dont know if you ever solved this, but have a look at this, I just ordered one, had a similar requirement to you, I want to carry a pc around with me and thats it, and need to be able to easily share the data on it like a drive , such as AV progs or Hirens disc etc with other pc's
<http://cgi.ebay.co.uk/USB-Go-Link-... | I've accepted sheepsimulator's answer. But I thought I would post my own just to get this out there. I've thought about this some more, and here's the only way I can imagine this working:
Have a disk enclosure that has both a USB port and an Ethernet port. There's a bit of firmware in the enclosure the runs a webserve... |
41,829 | The answer to this is likely "It is not possible.", and from what I know about filesystems and storage, I would say the same thing. But, I thought I would try the great wisdom of SuperUser:
I'm looking for a NAS device that will serve the same content over USB and via SMB.
I have a device (let's call it the reader) w... | 2009/09/15 | [
"https://superuser.com/questions/41829",
"https://superuser.com",
"https://superuser.com/users/9588/"
] | I dont know if you ever solved this, but have a look at this, I just ordered one, had a similar requirement to you, I want to carry a pc around with me and thats it, and need to be able to easily share the data on it like a drive , such as AV progs or Hirens disc etc with other pc's
<http://cgi.ebay.co.uk/USB-Go-Link-... | It is not possiblwe. USB disk file-systems are managed by a host computer which is aware of blocks, allocations, which files are open, where they are, etc. It is just a block device.
A NAS on the other hand maintains internal awareness of all of these factors and they won’t match the awareness of the computer that has... |
1,959,140 | If I am given two 3-D points of a cube,how do I find the volume of that Cube?where $(x\_1, y\_1, z\_1)$ is the co-ordinate of one corner and $(x\_2, y\_2, z\_2)$ is the co-ordinate of the opposite corner. | 2016/10/08 | [
"https://math.stackexchange.com/questions/1959140",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/374055/"
] | We can solve the system in the following way (though I'm not sure if it is "reasonable") :
We have
$$\sqrt y+\sqrt z-\sqrt x=\frac{a}{\sqrt x}\tag1$$
$$\sqrt z+\sqrt x-\sqrt y=\frac{b}{\sqrt y}\tag2$$
$$\sqrt x+\sqrt y-\sqrt z=\frac{c}{\sqrt z}\tag3$$
From $(1)$,
$$\sqrt z=\sqrt x-\sqrt y+\frac{a}{\sqrt x}\tag4$$
Fro... | Here are some ideas which, with some hindsight, save you the long computations.
Notice that your system of equations is cyclic in the variables (x,y,z) and (a,b,c). I.e. the next equation follows from the previous one by shifting all variables by one position ($x \to y$ and simultaneoulsy $a\to b$ etc.), where the las... |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Well, if you don't use SSL, you will always be at a higher risk for someone trying to sniff your passwords. You probably just need to evaluate the risk factor of your site.
Also remember that even having SSL does not guarentee that your data is safe. It is really all in how you code it to make sure you provide the ex... | Plain HTTP is vulnerable to sniffing. If you don't want to buy SSL certificates, you can use self-signed certificates and ask your clients to trust that certificate to circumvent the warning shown by the browser (as your authenticated users are just a few known admins, this approach makes perfect sense). |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | In the scenario you describe regular users would be exposed to session hijacking and all their information would also be transferred "in the clear". Unless you use a trusted CA the administrators might be exposed to a Man-in-the-middle attack.
Instead of a self-signed cert you might want to consider using a certificat... | Plain HTTP is vulnerable to sniffing. If you don't want to buy SSL certificates, you can use self-signed certificates and ask your clients to trust that certificate to circumvent the warning shown by the browser (as your authenticated users are just a few known admins, this approach makes perfect sense). |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Well, if you don't use SSL, you will always be at a higher risk for someone trying to sniff your passwords. You probably just need to evaluate the risk factor of your site.
Also remember that even having SSL does not guarentee that your data is safe. It is really all in how you code it to make sure you provide the ex... | In the scenario you describe regular users would be exposed to session hijacking and all their information would also be transferred "in the clear". Unless you use a trusted CA the administrators might be exposed to a Man-in-the-middle attack.
Instead of a self-signed cert you might want to consider using a certificat... |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Since only your admins will be using the secure session, just use a self-signed certificate. It's not the best user experience, but it's better to keep that information secure. | In the scenario you describe regular users would be exposed to session hijacking and all their information would also be transferred "in the clear". Unless you use a trusted CA the administrators might be exposed to a Man-in-the-middle attack.
Instead of a self-signed cert you might want to consider using a certificat... |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Since only your admins will be using the secure session, just use a self-signed certificate. It's not the best user experience, but it's better to keep that information secure. | Use HTTPS with a free certificate. [StartCom](http://cert.startcom.org/) is free, and included in by Firefox browsers; since only your administrators will be logging in, they can easily import the CA if they want to use IE.
Don't skimp on security. Anecdotally, I have seen websites that sound similar to yours defaced ... |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Since only your admins will be using the secure session, just use a self-signed certificate. It's not the best user experience, but it's better to keep that information secure. | Plain HTTP is vulnerable to sniffing. If you don't want to buy SSL certificates, you can use self-signed certificates and ask your clients to trust that certificate to circumvent the warning shown by the browser (as your authenticated users are just a few known admins, this approach makes perfect sense). |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Use HTTPS with a free certificate. [StartCom](http://cert.startcom.org/) is free, and included in by Firefox browsers; since only your administrators will be logging in, they can easily import the CA if they want to use IE.
Don't skimp on security. Anecdotally, I have seen websites that sound similar to yours defaced ... | Realistically, it's much more likely that one of the computers used to access the website will be compromised by a keylogger than the HTTP connection will be sniffed. |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Well, if you don't use SSL, you will always be at a higher risk for someone trying to sniff your passwords. You probably just need to evaluate the risk factor of your site.
Also remember that even having SSL does not guarentee that your data is safe. It is really all in how you code it to make sure you provide the ex... | Use HTTPS with a free certificate. [StartCom](http://cert.startcom.org/) is free, and included in by Firefox browsers; since only your administrators will be logging in, they can easily import the CA if they want to use IE.
Don't skimp on security. Anecdotally, I have seen websites that sound similar to yours defaced ... |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Since only your admins will be using the secure session, just use a self-signed certificate. It's not the best user experience, but it's better to keep that information secure. | Realistically, it's much more likely that one of the computers used to access the website will be compromised by a keylogger than the HTTP connection will be sniffed. |
878,520 | I'm working on a small website for a local church. The site needs to allow administrators to edit content and post new events/updates. The only "secure" information managed by the site will be the admins' login info and a church directory with phone numbers and addresses.
How at risk would I be if I were to go without... | 2009/05/18 | [
"https://Stackoverflow.com/questions/878520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/108893/"
] | Use HTTPS with a free certificate. [StartCom](http://cert.startcom.org/) is free, and included in by Firefox browsers; since only your administrators will be logging in, they can easily import the CA if they want to use IE.
Don't skimp on security. Anecdotally, I have seen websites that sound similar to yours defaced ... | Plain HTTP is vulnerable to sniffing. If you don't want to buy SSL certificates, you can use self-signed certificates and ask your clients to trust that certificate to circumvent the warning shown by the browser (as your authenticated users are just a few known admins, this approach makes perfect sense). |
226,735 | I am looking at establish a circuit allowing to detect when one or two wire are cut such as a tamper system. When the wire are cut it should signal this a GPIO.
I suppose I need to use a transistor connected to GPIO but I have a bit some difficulty to see how. | 2016/04/06 | [
"https://electronics.stackexchange.com/questions/226735",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/104309/"
] | 
[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fA8UqT.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
*Figure 1. GPIO normally pulled low by tamper loop. Cutting loop causes GPIO to be pulled high by R1.*
C1... | An alternative to detecting change in voltage on the GPIO pin would be to use a dedicated [current loop](https://en.wikipedia.org/wiki/Current_loop) controller. There exists many [4–20mA](https://electronics.stackexchange.com/tags/4-20ma/info) control circuits that will have a indicator pin for when there is no current... |
226,735 | I am looking at establish a circuit allowing to detect when one or two wire are cut such as a tamper system. When the wire are cut it should signal this a GPIO.
I suppose I need to use a transistor connected to GPIO but I have a bit some difficulty to see how. | 2016/04/06 | [
"https://electronics.stackexchange.com/questions/226735",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/104309/"
] | 
[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fA8UqT.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
*Figure 1. GPIO normally pulled low by tamper loop. Cutting loop causes GPIO to be pulled high by R1.*
C1... | Pull up the GPIO externally to HIGH. Configure a cheap uC to trigger an interrupt when the pin value changes from HIGH->LOW.When you enter the ISR,you'l know that your circuit was tampered/cut.
If you want to go a little further,you could use an [Event Monitor](http://www.nxp.com/documents/data_sheet/PCF2127.pdf) to c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.