qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
452,046 | Why the closure $\mathbb{Q}$ is not itself? Since each ball around $q \in \mathbb{Q}$ contains a point in $\mathbb{Q}$ and a point in $\mathbb{R} \setminus \mathbb{Q}$. | 2013/07/25 | [
"https://math.stackexchange.com/questions/452046",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/83036/"
] | If the other player plays properly, zero. The game is known to be a draw. If you want to assume random play by both sides, you could make a tree and calculate it. There are only two responses to a center opening-a corner or a side, but then more branches to the tree after that because the symmetry is broken. | It is always random. Depending on the skill of the player, it may be 0/100 or 100/0. Putting the X in the middle doesn't necessarily mean that you will have a higher chance of winning. In fact I've seen my fair share of people who put their X (if they go first) in the corner or on the sides. |
53,306,827 | How can I split a 2D array by a grouping variable, and return a list of arrays please (also the order is important).
To show expected outcome, the equivalent in R can be done as
```
> (A = matrix(c("a", "b", "a", "c", "b", "d"), nr=3, byrow=TRUE)) # input
[,1] [,2]
[1,] "a" "b"
[2,] "a" "c"
[3,] "b" "d"
> ... | 2018/11/14 | [
"https://Stackoverflow.com/questions/53306827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2957945/"
] | ### You can use pandas:
```
import pandas as pd
import numpy as np
a = np.array([["a", "b"], ["a", "c"], ["b", "d"]])
listofdfs = {}
for n,g in pd.DataFrame(a).groupby(0):
listofdfs[n] = g
listofdfs['a'].values
```
Output:
```
array([['a', 'b'],
['a', 'c']], dtype=object)
```
And,
```
listofdfs['b'... | If I understand your question, you can do simple slicing, as in:
```
a = np.array([["a", "b"], ["a", "c"], ["b", "d"]])
x,y=a[:2,:],a[2,:]
x
array([['a', 'b'],
['a', 'c']], dtype='<U1')
y
array(['b', 'd'], dtype='<U1')
``` |
220,054 | Before transaction commit , every dml operation will modify innodb page which will flush to disk and generate undo log , so when the undo log write and fsync to disk to ensure rollback ? | 2018/10/14 | [
"https://dba.stackexchange.com/questions/220054",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/153761/"
] | * Make data changes to the blocks in the buffer\_pool, but do not write them to disk.
* Put changes to secondary indexes (eg for `INSERT`) into the Change Buffer for later processing. Again, no write to disk (yet).
* Write and fsync the undo log file *if* `innodb_flush_log_at_trx_commit = 1` (else this write/fsync is d... | That is up to your system configuration. See for example:
* [mysql innodb\_flush\_log\_at\_trx\_commit clarification](https://dba.stackexchange.com/q/44119)
* [Is it dangerous to use transaction log flush delay](https://stackoverflow.com/q/14989286)
* [`innodb_flush_log_at_trx_commit`](https://dev.mysql.com/doc/refman... |
495,929 | I would like to install Xubuntu. I have a 2 Gb USB stick and it works fine every time I try Xubuntu in live mode.
My plan is to install it on an SD card with 32 Gb capacity.
I do not want to do partitioning on my current hard disk, I am not the only user of the computer. We have no external or portable hard disk.
... | 2014/07/10 | [
"https://askubuntu.com/questions/495929",
"https://askubuntu.com",
"https://askubuntu.com/users/304162/"
] | Yes. This can be done provided you proceed with caution. The grub bootloader doesn't have to be installed on the same drive as your Windows installation. I do similar things with USB sticks often. If your BIOS supports booting from SDcard it's a standard installation, if not, there's a tutorial on how to do exactly wha... | That is not a very good idea.. Once you install any version of Ubuntu or Xubuntu, it creates and manages the GRUB loader, which stores all the information about the booting point of both Windows and your current distro. If anything should go wrong, you might have to repair Windows for recovering the bootloader for Wind... |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[
2. Install Subversion JavaHL Native Library Adapter (required)
And it works now.
P/S: Eclipse Indigo | The above problem arises with custom eclipse installation and due to updated version of subclipse.
You have to install the older version of subclipse manually.
For this i have done as following:
Under Help menu click "Install New Software..."
Select "<http://subclipse.tigris.org/update_1.6.x>" from the drop down men... |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[
2. Install Subversion JavaHL Native Library Adapter (required)
And it works now.
P/S: Eclipse Indigo | I have a similar problem with Subclipse 1.8. Due to licenses limitations, SVN client aren't bundled with SVN any more. So I find the message "Unable to load default SVN Client".
My solutions is to install SVN client. It can't be easier. Go to Eclispe Marketplace, type Subclipse and click to install Subclipse again, s... |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[
Build id: 20180405-1200
I solved this problem as follows
1) Install Subversive - SVN Team Provider 4.0.5 from [marketplace](http://marketplace.eclipse.org/content/subversive-svn-team-provider)
2) **Team -> SVN -> SVN Connectors** and set *... |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[, you might run into problems finding the library even after configuring the library path in eclipse.ini. To fix the entire problem, you might need to add this setting to the file as well:
``... |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[. |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[
2. Install Subversion JavaHL Native Library Adapter (required)
And it works now.
P/S: Eclipse Indigo | Eclipse Java EE IDE for Web Developers.
Version: Oxygen.3a Release (4.7.3a)
Build id: 20180405-1200
I solved this problem as follows
1) Install Subversive - SVN Team Provider 4.0.5 from [marketplace](http://marketplace.eclipse.org/content/subversive-svn-team-provider)
2) **Team -> SVN -> SVN Connectors** and set *... |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[, you might run into problems finding the library even after configuring the library path in eclipse.ini. To fix the entire problem, you might need to add this setting to the file as well:
``... |
5,620,681 | I am constantly getting this error when working with eclispe and the subclipse plugin:
```
Unable to load default SVN Client
```
I have already installed both the SVNKit and the JavaHL provider, but it can't be found in the preferences:
[. | Eclipse Java EE IDE for Web Developers.
Version: Oxygen.3a Release (4.7.3a)
Build id: 20180405-1200
I solved this problem as follows
1) Install Subversive - SVN Team Provider 4.0.5 from [marketplace](http://marketplace.eclipse.org/content/subversive-svn-team-provider)
2) **Team -> SVN -> SVN Connectors** and set *... |
30,504,980 | I am adding divs within a container div. I want to show the index of the child div on the left. How can I do this?
```js
$('#btn').on('click', function() {
$('#container').append('<div class="section">' + $(this).index('.container') + ' B</div>');
});
```
```html
<script src="https://ajax.googleapis.com/ajax/li... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30504980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064292/"
] | As you are appending the element will have index one length than the total elements with class section.
**[Live Demo](http://jsfiddle.net/Lmw8tmy8/)**
```
$('#btn').on('click', function() {
index = $('#container > .section').length - 1
$('#container').append('<div class="section">' +index + ' B</div>');
})... | `$(this).index('.container')` will try to find the index of clicked button in container object. Which does not exists due to which it return `-1`.
You need to use length of number of elements in container as index value here:
```
$('#container > .section').length;
```
**Demo:**
```js
$('#btn').on('click', functio... |
30,504,980 | I am adding divs within a container div. I want to show the index of the child div on the left. How can I do this?
```js
$('#btn').on('click', function() {
$('#container').append('<div class="section">' + $(this).index('.container') + ' B</div>');
});
```
```html
<script src="https://ajax.googleapis.com/ajax/li... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30504980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064292/"
] | The problem is `$(this).index('.container')`, in your handler `this` refers to the button which is not a member of the `.container` selector so it will return `-1`
So one solution is to add a new `div` then find its index, I think you want the index based on the div's with class `section`
```js
$('#btn').on('click',... | `$(this).index('.container')` will try to find the index of clicked button in container object. Which does not exists due to which it return `-1`.
You need to use length of number of elements in container as index value here:
```
$('#container > .section').length;
```
**Demo:**
```js
$('#btn').on('click', functio... |
30,504,980 | I am adding divs within a container div. I want to show the index of the child div on the left. How can I do this?
```js
$('#btn').on('click', function() {
$('#container').append('<div class="section">' + $(this).index('.container') + ' B</div>');
});
```
```html
<script src="https://ajax.googleapis.com/ajax/li... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30504980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064292/"
] | The problem is `$(this).index('.container')`, in your handler `this` refers to the button which is not a member of the `.container` selector so it will return `-1`
So one solution is to add a new `div` then find its index, I think you want the index based on the div's with class `section`
```js
$('#btn').on('click',... | As you are appending the element will have index one length than the total elements with class section.
**[Live Demo](http://jsfiddle.net/Lmw8tmy8/)**
```
$('#btn').on('click', function() {
index = $('#container > .section').length - 1
$('#container').append('<div class="section">' +index + ' B</div>');
})... |
30,504,980 | I am adding divs within a container div. I want to show the index of the child div on the left. How can I do this?
```js
$('#btn').on('click', function() {
$('#container').append('<div class="section">' + $(this).index('.container') + ' B</div>');
});
```
```html
<script src="https://ajax.googleapis.com/ajax/li... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30504980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064292/"
] | As you are appending the element will have index one length than the total elements with class section.
**[Live Demo](http://jsfiddle.net/Lmw8tmy8/)**
```
$('#btn').on('click', function() {
index = $('#container > .section').length - 1
$('#container').append('<div class="section">' +index + ' B</div>');
})... | You can just get the `length` of `children()` of the container, like so:
```
$('#btn').on('click', function() {
var $container = $('#container');
var newDiv = '<div class="section">' + $container.children().length + ' B</div>';
$container.append(newDiv);
});
``` |
30,504,980 | I am adding divs within a container div. I want to show the index of the child div on the left. How can I do this?
```js
$('#btn').on('click', function() {
$('#container').append('<div class="section">' + $(this).index('.container') + ' B</div>');
});
```
```html
<script src="https://ajax.googleapis.com/ajax/li... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30504980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2064292/"
] | The problem is `$(this).index('.container')`, in your handler `this` refers to the button which is not a member of the `.container` selector so it will return `-1`
So one solution is to add a new `div` then find its index, I think you want the index based on the div's with class `section`
```js
$('#btn').on('click',... | You can just get the `length` of `children()` of the container, like so:
```
$('#btn').on('click', function() {
var $container = $('#container');
var newDiv = '<div class="section">' + $container.children().length + ' B</div>';
$container.append(newDiv);
});
``` |
11,752,503 | The following tests are all passing *except* the "it { should be\_valid }" lines in 'describe "sent treatings" do' and 'describe "received treatings" do'
```
require 'spec_helper'
describe Treating do
let(:requestee) { FactoryGirl.create(:user) }
let(:requestor) { FactoryGirl.create(:user) }
before { @receive... | 2012/08/01 | [
"https://Stackoverflow.com/questions/11752503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1258078/"
] | This is happening due to error in serialization (Json/XML). The problem is you are directly trying to transmit your Models over the wire. As an example, see this:
```
public class Casino
{
public int ID { get; set; }
public string Name { get; set; }
public virtual City City { get; set; }
}
public class S... | I had same problem in ASP.Net Core Web Api and made it working with this solution:
Add Microsoft.AspNetCore.Mvc.NewtonsoftJson nuget package to web api project.
and in Startup.cs class in ConfigureServices method add this code:
```
services.AddControllersWithViews().AddNewtonsoftJson(options =>
options.SerializerSet... |
54,146,236 | I have created Mobile application in **React native**.
My problem is that whenever i open my app from launcher icon and minimize for sometime **(eg: 10 minutes)** then if i re-open my application from recent apps or else on clicking launcher icon again it should restart the application as it opening for the first time... | 2019/01/11 | [
"https://Stackoverflow.com/questions/54146236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5737881/"
] | To give it in milliseconds
```
SELECT
ID
,SUM(datediff(ms,cast('0:0' as time),TEMPO)) AS RESULT
FROM #TEMP_USER
GROUP BY ID;
```
or for formatted over 24 hours, you could try
```
CREATE TABLE #TEMP_USER(
ID INT,
TEMPO TIME(7)
)
INSERT INTO #TEMP_USER
VALUES
(1, '01:59:37.5100000')
,(... | Take a difference as numeric & do the `sum()` :
```
SELECT CAST(DATEADD(MS, SUM(DATEDIFF(MS, 0, TEMPO)), 0) AS TIME(0))
FROM #TEMP_USER;
``` |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | I would say `static block` is just syntactic sugar. There is nothing you could do with `static` block and not with anything else.
To re-use some examples posted here.
This piece of code could be re-written without using `static` initialiser.
Method #1: With `static`
```
private static final HashMap<String, String> ... | static block is used for any technology to initialize static data member in dynamic way,or we can say for the dynamic initialization of static data member static block is being used..Because for non static data member initialization we have constructor but we do not have any place where we can dynamically initialize st... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | If your static variables need to be set at runtime then a `static {...}` block is very helpful.
For example, if you need to set the static member to a value which is stored in a config file or database.
Also useful when you want to add values to a static `Map` member as you can't add these values in the initial memb... | static block is used for any technology to initialize static data member in dynamic way,or we can say for the dynamic initialization of static data member static block is being used..Because for non static data member initialization we have constructor but we do not have any place where we can dynamically initialize st... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | It's also useful when you actually don't want to assign the value to anything, such as loading some class *only once* during runtime.
E.g.
```
static {
try {
Class.forName("com.example.jdbc.Driver");
} catch (ClassNotFoundException e) {
throw new ExceptionInInitializerError("Cannot load JDBC d... | So you have a static field (it's also called "class variable" because it belongs to the class rather than to an instance of the class; in other words it's associated with the class rather than with any object) and you want to initialize it. So if you do NOT want to create an instance of this class and you want to manip... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | It is a common misconception to think that a static block has only access to static fields. For this I would like to show below piece of code that I quite often use in real-life projects (copied partially from [another answer](https://stackoverflow.com/a/12659023/744133) in a slightly different context):
```
public en... | If your static variables need to be set at runtime then a `static {...}` block is very helpful.
For example, if you need to set the static member to a value which is stored in a config file or database.
Also useful when you want to add values to a static `Map` member as you can't add these values in the initial memb... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | There are a few actual reasons that it is required to exist:
1. initializing `static final` members whose initialization might throw an exception
2. initializing `static final` members with calculated values
People tend to use `static {}` blocks as a convenient way to initialize things that the class depends on withi... | static block is used for any technology to initialize static data member in dynamic way,or we can say for the dynamic initialization of static data member static block is being used..Because for non static data member initialization we have constructor but we do not have any place where we can dynamically initialize st... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | Here's an example:
```
private static final HashMap<String, String> MAP = new HashMap<String, String>();
static {
MAP.put("banana", "honey");
MAP.put("peanut butter", "jelly");
MAP.put("rice", "beans");
}
```
The code in the "static" section(s) will be executed at class load time, before any instan... | It's also useful when you actually don't want to assign the value to anything, such as loading some class *only once* during runtime.
E.g.
```
static {
try {
Class.forName("com.example.jdbc.Driver");
} catch (ClassNotFoundException e) {
throw new ExceptionInInitializerError("Cannot load JDBC d... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | I would say `static block` is just syntactic sugar. There is nothing you could do with `static` block and not with anything else.
To re-use some examples posted here.
This piece of code could be re-written without using `static` initialiser.
Method #1: With `static`
```
private static final HashMap<String, String> ... | It is a common misconception to think that a static block has only access to static fields. For this I would like to show below piece of code that I quite often use in real-life projects (copied partially from [another answer](https://stackoverflow.com/a/12659023/744133) in a slightly different context):
```
public en... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | Here's an example:
```
private static final HashMap<String, String> MAP = new HashMap<String, String>();
static {
MAP.put("banana", "honey");
MAP.put("peanut butter", "jelly");
MAP.put("rice", "beans");
}
```
The code in the "static" section(s) will be executed at class load time, before any instan... | I would say `static block` is just syntactic sugar. There is nothing you could do with `static` block and not with anything else.
To re-use some examples posted here.
This piece of code could be re-written without using `static` initialiser.
Method #1: With `static`
```
private static final HashMap<String, String> ... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | The *non-static block:*
```
{
// Do Something...
}
```
Gets called **every time** an instance of the class is constructed. The *static block* only gets called **once**, when the class itself is initialized, no matter how many objects of that type you create.
Example:
```
public class Test {
static{
... | Here's an example:
```
private static final HashMap<String, String> MAP = new HashMap<String, String>();
static {
MAP.put("banana", "honey");
MAP.put("peanut butter", "jelly");
MAP.put("rice", "beans");
}
```
The code in the "static" section(s) will be executed at class load time, before any instan... |
2,420,389 | As far as I understood the "static initialization block" is used to set values of static field if it cannot be done in one line.
But I do not understand why we need a special block for that. For example we declare a field as static (without a value assignment). And then write several lines of the code which generate ... | 2010/03/10 | [
"https://Stackoverflow.com/questions/2420389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245549/"
] | As supplementary, like @Pointy said
>
> The code in the "static" section(s) will be executed at class load
> time, before any instances of the class are constructed (and before
> any static methods are called from elsewhere).
>
>
>
It's supposed to add `System.loadLibrary("I_am_native_library")` into static blo... | static block is used for any technology to initialize static data member in dynamic way,or we can say for the dynamic initialization of static data member static block is being used..Because for non static data member initialization we have constructor but we do not have any place where we can dynamically initialize st... |
70,409,624 | I have data of sensors coming anytime. I want to group them by sensors and calculate the average over X minutes or hours. I tried to do my own but did not work. You can check the fiddle [here][1].
In short, I have to show sensors wise moving average data against X minutes or hours.
[1]: <http://sqlfiddle.com/#!17/e310... | 2021/12/19 | [
"https://Stackoverflow.com/questions/70409624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/275002/"
] | It's unclear to me what output you are after, but maybe you are looking for a `range` condition for the window function:
```
select r.sensor_id,
r.reading,
r."timestamp",
AVG(r.reading) OVER (partition by r.sensor_id
ORDER BY r."timestamp"
... | Instead of the group by clause, you need the partition clause. Try if this works.
```
Select sensor_id,
reading,
date_trunc('hour', "timestamp") AS sensor_reading_hour,
AVG(reading) OVER(PARTITION BY sensor_id ORDER BY date_trunc('hour', "timestamp")) as avg_reading
from sensor_readings
``` |
37,926,869 | I'm working on an app Witch has a list of places (added by the user) and a map view with a button to add the users curent location. the app works to this point. When the user taps on a place in the tableView the app should go to the mapView and show the place on the map with a pin . but when I do that the app crashes a... | 2016/06/20 | [
"https://Stackoverflow.com/questions/37926869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5212043/"
] | This is a possible solution to this problem, however it may or may not be appropriate.
**Only appears after pasting**
Potentially if you want it to only appear in the pasted text (rather than when it's highlighted) you could make the font take up no space, so it can be hidden between the other text e.g.
```css
div {... | This answer is just a demonstration of the solution discussed in the comments of DBS' answer. Selecting the text will not indicate to you that you've selected any more than "This is visible", but pasting it into Notepad will show everything. Seems perfect for small ARGs or internet-based puzzles.
```css
div {
color... |
187,297 | I am looking to implement access controls through CA-signed public ssh keys, as described in the article [Scalable and secure access with SSH](https://code.facebook.com/posts/365787980419535/scalable-and-secure-access-with-ssh/).
I am trying to conceive how our security team will manage this on the CA side. One thing ... | 2018/06/07 | [
"https://security.stackexchange.com/questions/187297",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/18170/"
] | Use an old version of pyjwt (0.4.3) where this exception wasn't implemented yet.
```
pip install pyjwt==0.4.3
``` | When running your program, it reports the line that throws the exception:
```
File "/some-path/site-packages/jwt/algorithms.py", line 151, in prepare_key
'The specified key is an asymmetric key or x509 certificate and'
jwt.exceptions.InvalidKeyError: The specified key is an asymmetric key or x509 certificate and... |
187,297 | I am looking to implement access controls through CA-signed public ssh keys, as described in the article [Scalable and secure access with SSH](https://code.facebook.com/posts/365787980419535/scalable-and-secure-access-with-ssh/).
I am trying to conceive how our security team will manage this on the CA side. One thing ... | 2018/06/07 | [
"https://security.stackexchange.com/questions/187297",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/18170/"
] | When running your program, it reports the line that throws the exception:
```
File "/some-path/site-packages/jwt/algorithms.py", line 151, in prepare_key
'The specified key is an asymmetric key or x509 certificate and'
jwt.exceptions.InvalidKeyError: The specified key is an asymmetric key or x509 certificate and... | Here's my hackish solution to get it working with later versions (i.e., pyjwt==2.2.0) without having to fork pyjwt and editing the base code.
```
# prepare an override method
def prepare_key(key):
return jwt.utils.force_bytes(key)
# override HS256's prepare key method to disable checking for asymmetric key words
... |
187,297 | I am looking to implement access controls through CA-signed public ssh keys, as described in the article [Scalable and secure access with SSH](https://code.facebook.com/posts/365787980419535/scalable-and-secure-access-with-ssh/).
I am trying to conceive how our security team will manage this on the CA side. One thing ... | 2018/06/07 | [
"https://security.stackexchange.com/questions/187297",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/18170/"
] | Use an old version of pyjwt (0.4.3) where this exception wasn't implemented yet.
```
pip install pyjwt==0.4.3
``` | I ended up going a little more custom route to exploit this vulnerability. The following code can work as a general template to generate the necessary token without using `jwt` library.
```
from codecs import encode, decode
import requests
import hashlib
import hmac
# read the assymetric key
with open('public.pem', '... |
187,297 | I am looking to implement access controls through CA-signed public ssh keys, as described in the article [Scalable and secure access with SSH](https://code.facebook.com/posts/365787980419535/scalable-and-secure-access-with-ssh/).
I am trying to conceive how our security team will manage this on the CA side. One thing ... | 2018/06/07 | [
"https://security.stackexchange.com/questions/187297",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/18170/"
] | Use an old version of pyjwt (0.4.3) where this exception wasn't implemented yet.
```
pip install pyjwt==0.4.3
``` | Here's my hackish solution to get it working with later versions (i.e., pyjwt==2.2.0) without having to fork pyjwt and editing the base code.
```
# prepare an override method
def prepare_key(key):
return jwt.utils.force_bytes(key)
# override HS256's prepare key method to disable checking for asymmetric key words
... |
187,297 | I am looking to implement access controls through CA-signed public ssh keys, as described in the article [Scalable and secure access with SSH](https://code.facebook.com/posts/365787980419535/scalable-and-secure-access-with-ssh/).
I am trying to conceive how our security team will manage this on the CA side. One thing ... | 2018/06/07 | [
"https://security.stackexchange.com/questions/187297",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/18170/"
] | I ended up going a little more custom route to exploit this vulnerability. The following code can work as a general template to generate the necessary token without using `jwt` library.
```
from codecs import encode, decode
import requests
import hashlib
import hmac
# read the assymetric key
with open('public.pem', '... | Here's my hackish solution to get it working with later versions (i.e., pyjwt==2.2.0) without having to fork pyjwt and editing the base code.
```
# prepare an override method
def prepare_key(key):
return jwt.utils.force_bytes(key)
# override HS256's prepare key method to disable checking for asymmetric key words
... |
32,700,242 | I have a script that can rotate an object by touch or mouse on it but I want to rotate the object when mouse goes over the corner of the object only. How can I do this?
The code I'm using is
```
private float baseAngle = 0.0f;
void OnMouseDown(){
Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
... | 2015/09/21 | [
"https://Stackoverflow.com/questions/32700242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1715266/"
] | Okay, so your action is coming from a button, that button is within a table view cell, the question is: what's the indexPath of that table view cell.
The easiest way is:
1. get the location of the button within the table view;
2. ask for the index path at that position.
E.g.
```
@IBAction func checkOffTask(sender: ... | Okay, this is a workaround I have used before.
Doesn't look pretty but does the job:
```
UIButton *likeButton = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)likeButton.superview.superview;
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
```
Just find the correct superview for the b... |
11,867,493 | I have SSIS package which pulls the data from Excel(.xls) file and load the same into a SQL table. Durign design time, I am able to map the source Excel file properly and able to run the package.. But, When I replace the source file with anyother excel file in the directory location with the same name(which has same fo... | 2012/08/08 | [
"https://Stackoverflow.com/questions/11867493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1418178/"
] | SDL Tridion does not store version information on Published items, so that indeed isn't available through the GUI or the API.
There are basically two ways for you to "guess" this information:
1. Use the API to find the version of the item at the time it was Published
2. Query the database for this information
The se... | In addition to the other options mentioned, you could:
1. Implement some events system code that responds to the events that are triggered when a component is saved, and when it is successfully published
2. In your templates, dynamically add metadata to the component presentation as it is published, making the versio... |
152,801 | I have read about significant figures in my chemistry and physics books, but none of them pointed out the significance of the significant figures.
Searching the Internet I found two possible answers: Some people are saying that it is to denote the accuracy and others are saying that it is to denote the precision of ... | 2021/06/11 | [
"https://chemistry.stackexchange.com/questions/152801",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/81086/"
] | You are absolutely correct in that there are several kind of uncertainties (often called errors). These are referred to as systematic and statistical errors and the difference between them can be conveniently be described in terms of a target with a distribution of shots. The distribution of the shots with respect to t... | A number itself doesn't inherently precision or accuracy. It is the representation of a measurement: the output of a measuring instrument. That instrument is what has precision and accuracy. We accept the number representing an instrument's output on the basis that we trust the calibration and quality of the instrument... |
152,801 | I have read about significant figures in my chemistry and physics books, but none of them pointed out the significance of the significant figures.
Searching the Internet I found two possible answers: Some people are saying that it is to denote the accuracy and others are saying that it is to denote the precision of ... | 2021/06/11 | [
"https://chemistry.stackexchange.com/questions/152801",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/81086/"
] | Once upon a time, calculations were done on paper and on slide rules. It would take considerable effort to carry 10 digits in a calculation instead of 3 (which is what most slide rules are capable of). Then, students started using calculators, and would just copy the result they got, with 10 or more digits. Science tea... | A number itself doesn't inherently precision or accuracy. It is the representation of a measurement: the output of a measuring instrument. That instrument is what has precision and accuracy. We accept the number representing an instrument's output on the basis that we trust the calibration and quality of the instrument... |
152,801 | I have read about significant figures in my chemistry and physics books, but none of them pointed out the significance of the significant figures.
Searching the Internet I found two possible answers: Some people are saying that it is to denote the accuracy and others are saying that it is to denote the precision of ... | 2021/06/11 | [
"https://chemistry.stackexchange.com/questions/152801",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/81086/"
] | 1. While estimating uncertainty can be quite involved, the purpose of significant figures is quite simple: They are a shorthand method of communicating the uncertainty of a measurement from those who are in a position to be able to estimate the uncertainty (those who made the measurement) to those who need to know the ... | A number itself doesn't inherently precision or accuracy. It is the representation of a measurement: the output of a measuring instrument. That instrument is what has precision and accuracy. We accept the number representing an instrument's output on the basis that we trust the calibration and quality of the instrument... |
3,106,865 | I'm working on a Rails application that uses prawn to generate PDF's. Long story short, we want to be able to digitally sign generated PDF's. Im not sure where to start reading up exactly. Just wanted to ask if anybody else has been able to accomplish this before, and if so, what kind of resources I should be using to ... | 2010/06/24 | [
"https://Stackoverflow.com/questions/3106865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/278451/"
] | I'd suggest you to take a look at <https://github.com/joseicosta/odf-report>.
It's a gem for generating ODF, but they can easily be converted to PDF, plus it supports templates. | Though this question has answer and quite old, I would like to add relevant link for information sake.
[MrWater](https://stackoverflow.com/users/1461972/mrwater) has shared his code to [Insert digital signature into existing pdf file](https://stackoverflow.com/questions/12078006/insert-digital-signature-into-existing... |
34,596,565 | I have the below function that loops through two lists and prints out a selection of vegetables and then fruits.
```
def Selection():
print("VEGETABLES FOR THE WEEK:\n")
for veg in veg_selection:
print(veg.upper())
print("\n")
print("FRUITS FOR THE WEEK:\n")
for fruit in fruit_selection:
... | 2016/01/04 | [
"https://Stackoverflow.com/questions/34596565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3244770/"
] | One of solutions would be to store all itermediate strings to container and [join](https://docs.python.org/2/library/string.html#string.join) them afterwards. Quoting docs:
>
> `string.join(words[, sep])` Concatenate a list or tuple of words with intervening occurrences of sep. The default value for sep is a single s... | Probably the simplest way to do it is to just add an extra step appending the text to your variable wherever you need to. See below:
```
def Selection():
output_text = "VEGETABLES FOR THE WEEK:\n"
print("VEGETABLES FOR THE WEEK:\n")
for veg in veg_selection:
output_text += veg
print(veg.upp... |
34,596,565 | I have the below function that loops through two lists and prints out a selection of vegetables and then fruits.
```
def Selection():
print("VEGETABLES FOR THE WEEK:\n")
for veg in veg_selection:
print(veg.upper())
print("\n")
print("FRUITS FOR THE WEEK:\n")
for fruit in fruit_selection:
... | 2016/01/04 | [
"https://Stackoverflow.com/questions/34596565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3244770/"
] | One of solutions would be to store all itermediate strings to container and [join](https://docs.python.org/2/library/string.html#string.join) them afterwards. Quoting docs:
>
> `string.join(words[, sep])` Concatenate a list or tuple of words with intervening occurrences of sep. The default value for sep is a single s... | You can just concatenate to a single string variable like so:
```
def Selection():
output = "VEGETABLES FOR THE WEEK:\n"
for veg in veg_selection:
output += veg.upper() + "\n"
output += "\nFRUITS FOR THE WEEK:\n"
for fruit in fruit_selection:
output += fruit.upper() + "\n"
```
You can... |
34,596,565 | I have the below function that loops through two lists and prints out a selection of vegetables and then fruits.
```
def Selection():
print("VEGETABLES FOR THE WEEK:\n")
for veg in veg_selection:
print(veg.upper())
print("\n")
print("FRUITS FOR THE WEEK:\n")
for fruit in fruit_selection:
... | 2016/01/04 | [
"https://Stackoverflow.com/questions/34596565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3244770/"
] | One of solutions would be to store all itermediate strings to container and [join](https://docs.python.org/2/library/string.html#string.join) them afterwards. Quoting docs:
>
> `string.join(words[, sep])` Concatenate a list or tuple of words with intervening occurrences of sep. The default value for sep is a single s... | Turn your function into generator:
```
def Selection():
yield "VEGETABLES FOR THE WEEK:\n"
for veg in veg_selection:
yield veg.upper()
yield "\n"
yield "FRUITS FOR THE WEEK:\n"
for fruit in fruit_selection:
yield fruit.upper()
```
Then, turning into a string is trivial:
```
'\n'.... |
60,485,470 | I hope you're all doing well.
I have a problem about navigation graphs. You can see the structure in the image below;
[](https://i.stack.imgur.com/aTgS1.jpg)
So we have 2 different navigation graphs; `navigation_A` and `navigation_B`.
I need to nav... | 2020/03/02 | [
"https://Stackoverflow.com/questions/60485470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10039864/"
] | Your navigation graph structure breaks the recommended navigation pattern!
But for your needs, I have a way to workaround.
Method 1:
First, FragmentY and FragmentZ need to have their own deeplinks.
```xml
<fragment
android:id="@+id/fragY"
android:name=".FragmentY"
tools:layout="@layout/frag_y">... | When you use nested navigation graph the inner graph should not know anything about the outside graph. In this case graph\_B should not know about the existence of a FragmentY or FragmentZ. What you should do is deliver a result from your graph\_B to whomever launched it. Then at that point decide whether to go Fragmen... |
176,883 | In my writing, a goddess is removed from her position as a god and reduced to a human. ([See my question on writing.SE](https://writing.stackexchange.com/questions/51231/how-would-a-god-like-character-react-to-losing-their-godhood/51256#51256)) At the moment of the loss of power huge amounts of energy would be released... | 2020/05/21 | [
"https://worldbuilding.stackexchange.com/questions/176883",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/75338/"
] | **Matter and power, more specifically a Guardian golem.**
Her power, without intervention, is likely going to manifest itself as different kinds of energy, especially light, heat and in a way, sound (aka a gigantic explosion). Your wonderful goddess however, while still under control of such power, could condensate it... | **Hey look! Half the moon is gone!**
[](https://i.stack.imgur.com/sT8M6m.jpg)\*\*
You want a big explosion that doesn't cause any collateral damage? Simple -- take the largest inanimate object you can find and make aim the explosion at that. Traditi... |
43,179,959 | I want to get some info from `cmus-remote` if `cmus` is running
```
#!/bin/zsh
pgrep cmus>& /dev/null
if [ $? -eq 0 ]; then
title=$(cmus-remote -Q | grep tag | grep title | sed 's/tag title //')
artist=$(cmus-remote -Q | grep tag | grep " artist " | sed 's/tag artist //')
album=$(cmus-remote -Q | grep tag | gre... | 2017/04/03 | [
"https://Stackoverflow.com/questions/43179959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7807417/"
] | The actual problem that you seem to be having is that your pgrep is returning a hit while you're not expecting it to.
```
pgrep cmus>& /dev/null
if [ $? -eq 0 ]; then
//statements here are not evaluated if pgrep\'s exit status is not equal to 0
```
Your pgrep exit code = zero. but it is probably not an exact match... | ```
pgrep cmus>& /dev/null
if [ $? -eq 0 ]; then
title=$(cmus-remote -Q | grep tag | grep title | sed 's/tag title //') > /dev/null 2>&1
artist=$(cmus-remote -Q | grep tag | grep " artist " | sed 's/tag artist //') > /dev/null 2>&1
album=$(cmus-remote -Q | grep tag | grep " album " | sed 's/tag album //') > /dev/... |
43,179,959 | I want to get some info from `cmus-remote` if `cmus` is running
```
#!/bin/zsh
pgrep cmus>& /dev/null
if [ $? -eq 0 ]; then
title=$(cmus-remote -Q | grep tag | grep title | sed 's/tag title //')
artist=$(cmus-remote -Q | grep tag | grep " artist " | sed 's/tag artist //')
album=$(cmus-remote -Q | grep tag | gre... | 2017/04/03 | [
"https://Stackoverflow.com/questions/43179959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7807417/"
] | The actual problem that you seem to be having is that your pgrep is returning a hit while you're not expecting it to.
```
pgrep cmus>& /dev/null
if [ $? -eq 0 ]; then
//statements here are not evaluated if pgrep\'s exit status is not equal to 0
```
Your pgrep exit code = zero. but it is probably not an exact match... | The best authority on whether `cmus` is running and whether `cmus-remote` can retrieve any information is `cmus-remote`. As such you could just replace `pgrep cmus` with `cmus-remote` as this will exit with return code 1, if `cmus`:
```sh
cmus-remote >& /dev/null
if [ $? -eq 0 ]; then
# stuff
fi
```
---
Alternat... |
26,658,657 | I would like to run and debug the polymer-tutorial ( <https://www.polymer-project.org/docs/start/getting-the-code.html> ) in the DartEditor but the code is not setup to do so. I am a beginner with DartEditor and Polymere. Can somebody help or provide a git repository? I had not much luck to get it working
Thx J | 2014/10/30 | [
"https://Stackoverflow.com/questions/26658657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1082824/"
] | As luck would have it, I recently ported that tutorial to Dart. In this Github repo, you'll find the starter files and a series of HTML files detailing the steps to take to complete it. It is slightly changed from the original tutorial, but it's very close.
<https://github.com/montyr75/polymer_social_media_tutorial> | The repo you linked to is Polymer.js code (js for JavaScript), DartEditor is for Dart there is not much you can do with this code in DartEditor. |
21,655,887 | Consider the ajax request :
```
var idNumber = $("#Field_1").val();
var servletUrl = "someURL"; // some url goes here
$.ajax({
url: servletUrl,
type: 'POST',
cache: false,
data: { },
success: function(data){
alert(data);
window.location = "./replyToYou.html";
}
, error: ... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21655887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779111/"
] | To use [sed](http://www.gnu.org/software/sed/):
```
sed -e '1s:#!/bin/bash:#!/usr/bin/custom_shell:' yourfile.py
```
This will write the placement to the standard output. To save over the file with the replaced text instead, use the `-i` flag:
```
sed -i '' -e '1s:#!/bin/bash:#!/usr/bin/custom_shell:' yourfile.py
... | You don't need to use `sed` and `subprocess` at all.
```
import os
replacement, shebang_line = "#!/usr/bin/custom_shell\n", ""
with open("InputFile.txt") as input_file, open("tempFile.txt") as output_file:
# Find the first non-empty line (which is assumed to be the shebang line)
while not shebang_line:
... |
21,655,887 | Consider the ajax request :
```
var idNumber = $("#Field_1").val();
var servletUrl = "someURL"; // some url goes here
$.ajax({
url: servletUrl,
type: 'POST',
cache: false,
data: { },
success: function(data){
alert(data);
window.location = "./replyToYou.html";
}
, error: ... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21655887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779111/"
] | To use [sed](http://www.gnu.org/software/sed/):
```
sed -e '1s:#!/bin/bash:#!/usr/bin/custom_shell:' yourfile.py
```
This will write the placement to the standard output. To save over the file with the replaced text instead, use the `-i` flag:
```
sed -i '' -e '1s:#!/bin/bash:#!/usr/bin/custom_shell:' yourfile.py
... | Why not just use python to open the file, make the change and write it back to the file? Unless your files are too huge to hold in memory.
```
for i in files_to_change:
with open(i,'rw') as f:
lines = f.readlines()
lines[lines.index("#!/bin/bash\n")] = "#!/usr/bin/custom_shell"
f.seek(0)
... |
21,655,887 | Consider the ajax request :
```
var idNumber = $("#Field_1").val();
var servletUrl = "someURL"; // some url goes here
$.ajax({
url: servletUrl,
type: 'POST',
cache: false,
data: { },
success: function(data){
alert(data);
window.location = "./replyToYou.html";
}
, error: ... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21655887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/779111/"
] | To use [sed](http://www.gnu.org/software/sed/):
```
sed -e '1s:#!/bin/bash:#!/usr/bin/custom_shell:' yourfile.py
```
This will write the placement to the standard output. To save over the file with the replaced text instead, use the `-i` flag:
```
sed -i '' -e '1s:#!/bin/bash:#!/usr/bin/custom_shell:' yourfile.py
... | The best way is to modify files **in place**
```
import fileinput
for line in fileinput.FileInput("your_file_name", inplace=True):
print("#!/usr/bin/custom_shell")
break
``` |
1,421,144 | In old CPANs, when you run it first time, it asked you for the continent/country your're in, and then gave you a way to choose mirror.
Now it doesn't ask this question! I can of course find mirror manually, and put it in urllist, but the geographical browsing in CPAN was really handy, but I can't seem to be able to ge... | 2009/09/14 | [
"https://Stackoverflow.com/questions/1421144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try entering `o conf init urllist` into the CPAN shell. This gives me the geographical menu you are looking for. (I've got cpan script version 1.9; CPAN.pm version 1.9402; perl, v5.10.0 built for i486-linux-gnu-thread-multi) | According to the [documentation](http://search.cpan.org/~andk/CPAN-1.9402/lib/CPAN.pm#15), you have to set this manually. A list of mirrors is avaliable [here](http://www.cpan.org/SITES.html) |
20,684,048 | Using fancyBox v2 and jQuery Cookie plugins.
Code:
```
var check_cookie = $.cookie('the_cookie');
if(check_cookie == null){
$.cookie('the_cookie', 'the_value');
$("#hidden_link").fancybox().trigger('click');
}
```
It works. But I want, when I close site or browser and come back, display fancybox again. Tried this b... | 2013/12/19 | [
"https://Stackoverflow.com/questions/20684048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3099199/"
] | set time frame to cookie while assigning, lets say for 30 mins
```
var check_cookie = $.cookie('the_cookie');
if(check_cookie == null){
$.cookie('the_cookie', 'the_value', { expires: 30 * 60 * 1000 });
$("#hidden_link").fancybox().trigger('click');
}
```
refer below link for ref..
[How to expire a cookie in 30 minu... | It's a simple syntax error. `onComplete` is an API option of fancybox, therefore it goes inside the fancybox function like
```
var check_cookie = $.cookie('the_cookie');
if (check_cookie == null) {
$("#hidden_link").fancybox({
'onComplete': function () {
$.cookie('the_cookie', 'the_value');
... |
13,149,760 | I'd like to use some wp8-specific apis but I don't want to drop support for wp7 in my app.
In particular, I'd like to do the following:
```
if(isWindowsPhone8OrNewer)
{
var sp = new SpeechSynthesizer();
sp.SpeakTextAsync("test");
}
```
What is the best way to access the wp8 api and not hav... | 2012/10/31 | [
"https://Stackoverflow.com/questions/13149760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/418957/"
] | The answer to the question is simple: Simply don't upgrade your app to using the WP8, and you'll be free to continue maintaining your WP7 app using the WP8 SDK in VS2012.
If you want to split up your application, and start utilizing the new UI features such as the native LongListSelector, you would want to separate yo... | There is a nice project for accessing some WP8 API from your WP7 project, if you are running on WP8 device:
<http://mangopollo.codeplex.com/>
If you want to use other new WP8 features, you have to upgrade your project to WP8. |
61,158,931 | I need to convert an avr assembly program to hex manually. I know I should use the instruction opcode but I don't know how to use it. For example, the syntax of the `LDI` instruction is :
```
LDI Rd,K
```
And the opcode is : `1110 kkkk dddd kkkk`
So for those `kkkk` should I add them together? If so the result will... | 2020/04/11 | [
"https://Stackoverflow.com/questions/61158931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13287565/"
] | Alright, let's look how this is done.
First, get an instruction table. I found this one as the first hit in a simple web search by "avr instruction table":
[AVR Instruction Set Manual @ Microchip](http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-0856-AVR-Instruction-Set-Manual.pdf)
`LDI Rd, K` with `d` as the r... | >
> And the opcode is : 1110 kkkk dddd kkkk
>
>
> So those kkkk should i add them together ?
>
>
>
Because the documentation doesn't say, then the right approach is to use the most obvious encoding, which is to say place the low 4 bits of 8-bit K in the later kkkk and the upper 4-bits in the earlier kkkk.
Howev... |
96,399 | Basically, I suck at cooking steak. I like med rare but not sure how to cook it right. Let's take my latest failure, 4 6oz top sirloin on center cuts. I let them get to room temp, and heated my clean cast iron on my. Electric stove to between the middle and high heat. I put them on and maybe 3 to 4 min flipped it. A fe... | 2019/02/18 | [
"https://cooking.stackexchange.com/questions/96399",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/72927/"
] | I would suggest two options, but first, when taking the temperature of a steak, insert the probe through the side of the steak. Aim halfway up, and have the end of the probe as close to the center as possible. The probe should be level, rather than angled. This might allow you to be more accurate. You don't need to tak... | I would stop taking the temps, and just focus on timing. The temps seem to be throwing you off. Stick to 3-4 mins per side, and rest for 5-10 mins.
You don't mention how thick it is, so moderate a little for thickness changes, but seldom have an issue with a cast-iron pan that's been left on med-high for a while for t... |
2,623,599 | All,
I am running into an issue using JTextArea and JScrollPane. For some reason the scroll pane appears to not recognize the last line in the document, and will only scroll down to the line before it. The scroll bar does not even change to a state where I can slide it until the lines in the document are two greater t... | 2010/04/12 | [
"https://Stackoverflow.com/questions/2623599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/185994/"
] | The problem is `textArea.setPreferredSize(new Dimension(500, 100));`
Remove that. Set the perferredSize of the scrollpane or the size of your frame instead | Is this a solution? I didn't test it, so please don't kill me.
```
scroller.getVerticalScrollBar().setValue(pane.getVerticalScrollBar().getMaximum());
``` |
12,217,448 | ```
String strFileContent="";
Log.e(TAG, "Error loading image file names333");
StringBuilder contents = new StringBuilder();///
for (int i = 0; i < x.length; i++) {
///strFileContent += ""+x[i]+",";
contents.append(x[i]);///
contents.append(System.getProperty("line.separator"));... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12217448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638936/"
] | If the only reason to do this is to draw the resulting polygon, why not use the GPU to do the work for you - you're using OpenGL after all. So instead of messing about working out how to construct the intersection, do the following:-
```
Set Z values of Polygon A and Polygon B to some constant
Set Z test to no testin... | Not a complete implementation, but:
1. Write a routine to find the intersection point of two line segments, `intersect_segment`
```
bool segments_intersect(
point_t a0, point_t a1,
point_t b0, point_t b1,
/*out*/ point_t* intersection
)
```
2. Write a point in quad routine, `point_in_quad`
```
bool poin... |
12,217,448 | ```
String strFileContent="";
Log.e(TAG, "Error loading image file names333");
StringBuilder contents = new StringBuilder();///
for (int i = 0; i < x.length; i++) {
///strFileContent += ""+x[i]+",";
contents.append(x[i]);///
contents.append(System.getProperty("line.separator"));... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12217448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638936/"
] | If the only reason to do this is to draw the resulting polygon, why not use the GPU to do the work for you - you're using OpenGL after all. So instead of messing about working out how to construct the intersection, do the following:-
```
Set Z values of Polygon A and Polygon B to some constant
Set Z test to no testin... | * Are the quads guaranteed to be non-self-intersecting?
* Are the quads guaranteed to be convex?
If they are convex, then I believe that any intersection will result in a single polygon with at most eight vertices. If they may not be convex, you can end up with two separated polygons as the intersection.
Assuming con... |
12,217,448 | ```
String strFileContent="";
Log.e(TAG, "Error loading image file names333");
StringBuilder contents = new StringBuilder();///
for (int i = 0; i < x.length; i++) {
///strFileContent += ""+x[i]+",";
contents.append(x[i]);///
contents.append(System.getProperty("line.separator"));... | 2012/08/31 | [
"https://Stackoverflow.com/questions/12217448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638936/"
] | If the only reason to do this is to draw the resulting polygon, why not use the GPU to do the work for you - you're using OpenGL after all. So instead of messing about working out how to construct the intersection, do the following:-
```
Set Z values of Polygon A and Polygon B to some constant
Set Z test to no testin... | For convex polygons I'd recommend:
1: Check the fact of intersection with the [separation axes method](http://www.geometrictools.com/Documentation/MethodOfSeparatingAxes.pdf) (fast)
2: Find intersection with algorithm from [O'Rourke book (C code available)](http://cs.smith.edu/~orourke/books/compgeom.html) |
13,848,124 | I have a store page listing what fashion brands they are selling. But I'm not sure what microdata schema to use. I'm using the schema from [schema.org](http://schema.org).
Basically the list looks like this:
```
<span itemscope itemtype="http://schema.org/Store">
// Store info here
<ul id="brandList">
<li id="77... | 2012/12/12 | [
"https://Stackoverflow.com/questions/13848124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91612/"
] | A brand is an ORGANIZATION, not a product, therefore is not covered by the realm of a product schema. | It really depends on the kind of stores you intend to list; for brick & mortar locations, use the [store microdata schema](http://schema.org/Store); if, on the other hand, what you are listing are brands you sell on your own store, you'd probably be better off with the [brand schema](http://schema.org/Brand) instead. |
57,533,016 | Im trying to link a css file to my html file in android, but when I check the style, it is not being loaded and applied.
I have the css and html files in the same folder, and I have tried with absolute and relative paths, with apostrophes and quotes, but nothing works.
I have tested by providing a link to a styleshee... | 2019/08/17 | [
"https://Stackoverflow.com/questions/57533016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11806527/"
] | I don't think a left join is necessary for this scenario. You should be able to inner join on all of the tables because an inner join will indicate the presence of an assistant and rule out any possibility of getting an author without an assistant. You should be able to write something like this:
```
query = from(p in... | This might be an overkill in this particular case, but it’s always easier to decouple such queries into [subqueries](https://hexdocs.pm/ecto/Ecto.Query.html?#subquery/2).
```
authors_with_assistants =
from a in Author, where: not is_nil(a.assistant_id)
```
or
```
authors_with_assistants =
from a in Author,
l... |
6,132,223 | I have been attempting to scrape and eventually parse some data(specifically availabilities and price) from hostels.com, for example <http://www.hostels.com/hosteldetails.php/HostelNumber.11890>. The problem is, once you select the number of nights and select "book now" nothing is passed through the URL string(its all ... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6132223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/577880/"
] | I'm really into [Node.js](http://nodejs.org/) atm (server-side javascript, in case you're not familiar), so that's what I'm recommending. What's awesome about using it to scrape sites is you can use jQuery or whatever your favorite JS framework is to do all the work of parsing for the info you want! See the following r... | I've found Celerity (http://celerity.rubyforge.org), a JRuby library that uses HTMLUnit under the hood, to be a very robust solution for "data acquisition via the Web".
Celerity being Ruby, I found, was much faster to develop with in comparison to full blown Java (HTMLUnit). Also, due to Celerity's "wrapping" of HTML... |
6,132,223 | I have been attempting to scrape and eventually parse some data(specifically availabilities and price) from hostels.com, for example <http://www.hostels.com/hosteldetails.php/HostelNumber.11890>. The problem is, once you select the number of nights and select "book now" nothing is passed through the URL string(its all ... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6132223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/577880/"
] | The page you are referring to does not seem to be using AJAX. Instead what you are referring to as AJAX is a POST request (as opposed to stuff passed in the url, which is a GET request). I suggest you read up on difference between them. Try to understand what going on, it is more important than relying on some third-pa... | I've found Celerity (http://celerity.rubyforge.org), a JRuby library that uses HTMLUnit under the hood, to be a very robust solution for "data acquisition via the Web".
Celerity being Ruby, I found, was much faster to develop with in comparison to full blown Java (HTMLUnit). Also, due to Celerity's "wrapping" of HTML... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Okay. Ignoring the 'tomcat' bit and coding to the servlet, your best bet is to create mocks for the response and request objects, and then tell it what you expect out of it.
So for a standard empty doPost, and using [EasyMock](http://www.easymock.org), you'll have
```
public void testPost() {
mockRequest = createM... | Updated Feb 2018: [OpenBrace Limited has closed down](https://closingbraces.net/openbrace/), and its ObMimic product is no longer supported.
If you want a newer alternative to ServletUnit for JUnit testing of Servlets, you might find my company's [ObMimic](http://www.openbrace.com) library useful. It's available for f... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | The Spring Framework has nice ready made mock objects for several classes out of the Servlet API:
<http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/mock/web/package-summary.html> | Updated Feb 2018: [OpenBrace Limited has closed down](https://closingbraces.net/openbrace/), and its ObMimic product is no longer supported.
If you want a newer alternative to ServletUnit for JUnit testing of Servlets, you might find my company's [ObMimic](http://www.openbrace.com) library useful. It's available for f... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Okay. Ignoring the 'tomcat' bit and coding to the servlet, your best bet is to create mocks for the response and request objects, and then tell it what you expect out of it.
So for a standard empty doPost, and using [EasyMock](http://www.easymock.org), you'll have
```
public void testPost() {
mockRequest = createM... | Separate the parts of that code that deal with HTTP requests and response from the parts that do business logic or data-base manipulation. In most cases this will produce a three tier architecture, with a data-layer (for the data-base/persistence), service-layer (for the business logic) and a presentation-layer (for th... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | The Spring Framework has nice ready made mock objects for several classes out of the Servlet API:
<http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/mock/web/package-summary.html> | For "in-container" testing, have a look at [Cactus](http://jakarta.apache.org/cactus/)
If you want to be able to test without a running container you can either simulate its components with your own mockobjects (e.g. with [EasyMock](http://www.easymock.org)) or you could try [MockRunner](http://mockrunner.sourceforge.... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Check out [ServletUnit](http://httpunit.sourceforge.net/doc/servletunit-intro.html), which is part of HttpUnit. In a nutshell, ServletUnit provides a library of mocks and utilities you can use in ordinary JUnit tests to mock out a servlet container and other servlet-related objects like request and response objects. Th... | For "in-container" testing, have a look at [Cactus](http://jakarta.apache.org/cactus/)
If you want to be able to test without a running container you can either simulate its components with your own mockobjects (e.g. with [EasyMock](http://www.easymock.org)) or you could try [MockRunner](http://mockrunner.sourceforge.... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Check out [ServletUnit](http://httpunit.sourceforge.net/doc/servletunit-intro.html), which is part of HttpUnit. In a nutshell, ServletUnit provides a library of mocks and utilities you can use in ordinary JUnit tests to mock out a servlet container and other servlet-related objects like request and response objects. Th... | Separate the parts of that code that deal with HTTP requests and response from the parts that do business logic or data-base manipulation. In most cases this will produce a three tier architecture, with a data-layer (for the data-base/persistence), service-layer (for the business logic) and a presentation-layer (for th... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Separate the parts of that code that deal with HTTP requests and response from the parts that do business logic or data-base manipulation. In most cases this will produce a three tier architecture, with a data-layer (for the data-base/persistence), service-layer (for the business logic) and a presentation-layer (for th... | Updated Feb 2018: [OpenBrace Limited has closed down](https://closingbraces.net/openbrace/), and its ObMimic product is no longer supported.
If you want a newer alternative to ServletUnit for JUnit testing of Servlets, you might find my company's [ObMimic](http://www.openbrace.com) library useful. It's available for f... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Check out [ServletUnit](http://httpunit.sourceforge.net/doc/servletunit-intro.html), which is part of HttpUnit. In a nutshell, ServletUnit provides a library of mocks and utilities you can use in ordinary JUnit tests to mock out a servlet container and other servlet-related objects like request and response objects. Th... | Okay. Ignoring the 'tomcat' bit and coding to the servlet, your best bet is to create mocks for the response and request objects, and then tell it what you expect out of it.
So for a standard empty doPost, and using [EasyMock](http://www.easymock.org), you'll have
```
public void testPost() {
mockRequest = createM... |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Check out [ServletUnit](http://httpunit.sourceforge.net/doc/servletunit-intro.html), which is part of HttpUnit. In a nutshell, ServletUnit provides a library of mocks and utilities you can use in ordinary JUnit tests to mock out a servlet container and other servlet-related objects like request and response objects. Th... | The Spring Framework has nice ready made mock objects for several classes out of the Servlet API:
<http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/mock/web/package-summary.html> |
53,532 | I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f... | 2008/09/10 | [
"https://Stackoverflow.com/questions/53532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1702/"
] | Separate the parts of that code that deal with HTTP requests and response from the parts that do business logic or data-base manipulation. In most cases this will produce a three tier architecture, with a data-layer (for the data-base/persistence), service-layer (for the business logic) and a presentation-layer (for th... | For "in-container" testing, have a look at [Cactus](http://jakarta.apache.org/cactus/)
If you want to be able to test without a running container you can either simulate its components with your own mockobjects (e.g. with [EasyMock](http://www.easymock.org)) or you could try [MockRunner](http://mockrunner.sourceforge.... |
32,064,719 | Here is my sample data:
```
id uniqueId ReceiveStampUtc
11648370 78CE8447-FFDE-E411-80CB-8CDCD4AED928 4/9/2015
11648370 07E18941-7FFA-E411-80D8-8CDCD4AF21E4 5/14/2015
11648370 E37BCA7E-4608-E511-80DC-8CDCD4AF21E4 6/1/2015
11648370 2D10940C-EE0D-E511-80DC-8CDCD... | 2015/08/18 | [
"https://Stackoverflow.com/questions/32064719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3206610/"
] | Antionio:
CSS:
```
.thumbnail-item {
/* delete the line that was here for inheriting the display * /
height: 10px;
max-width: 5px;
}
```
HTML:
```
<tr class="thumbnail-item white">...</tr>
<tr class="thumbnail-item grey">...</tr>
```
etc, etc.
You were adding the "thumbnail-item" css reference to the `<td>`tag... | In your Jquery code, use the class of your td.hover function and try with the below code.
```
$(".thumbnail-item").hover(function() {
//Write your js code what you have written for hover pdf image
});
```
It would be better for us to understand if you post your jquery code as well. |
55,078,560 | I have three tables:
books:
```
{id, title, status}
{1, SuperHero, false}
{2, Hobbit, true}
{3, Marvel, true}
```
tags:
```
{id, name}
{1, Drama}
{2, Comedy}
{3, Triller}
```
books\_tags:
```
{book_id, tag_id}
{1, 1}
{1, 2}
{2, 2}
```
Every book can have or not many unique for it tags.
1)What is the right wa... | 2019/03/09 | [
"https://Stackoverflow.com/questions/55078560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10188661/"
] | No, they are not in fact the same thing. There are multiple differences, but the most obvious is that the `join` will filter out any unmatching rows. The correlated subquery will return all rows in the first table.
There are other differences as well. The `sum()`s will not be the same if there are duplicate `productid... | First query:
```
select a.productid, sum(b.qty)
from table1 a
inner join table2 b on b.productid = a.productid
group by a.productid
```
It won't return row if there is no corresponding value in table2.
Second query is like `LEFT JOIN`:
```
select a.productid
,(select sum(b.qty) from table2 b where b.productid = a... |
55,078,560 | I have three tables:
books:
```
{id, title, status}
{1, SuperHero, false}
{2, Hobbit, true}
{3, Marvel, true}
```
tags:
```
{id, name}
{1, Drama}
{2, Comedy}
{3, Triller}
```
books\_tags:
```
{book_id, tag_id}
{1, 1}
{1, 2}
{2, 2}
```
Every book can have or not many unique for it tags.
1)What is the right wa... | 2019/03/09 | [
"https://Stackoverflow.com/questions/55078560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10188661/"
] | No, they are not in fact the same thing. There are multiple differences, but the most obvious is that the `join` will filter out any unmatching rows. The correlated subquery will return all rows in the first table.
There are other differences as well. The `sum()`s will not be the same if there are duplicate `productid... | Keep performance in mind... inner join is much faster than subselect. A subselect loops through all matching results, so complexity is N x M... causing poor performance. Joins have a better performance in most cases.
See <https://www.essentialsql.com/subquery-versus-inner-join/> |
55,078,560 | I have three tables:
books:
```
{id, title, status}
{1, SuperHero, false}
{2, Hobbit, true}
{3, Marvel, true}
```
tags:
```
{id, name}
{1, Drama}
{2, Comedy}
{3, Triller}
```
books\_tags:
```
{book_id, tag_id}
{1, 1}
{1, 2}
{2, 2}
```
Every book can have or not many unique for it tags.
1)What is the right wa... | 2019/03/09 | [
"https://Stackoverflow.com/questions/55078560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10188661/"
] | First query:
```
select a.productid, sum(b.qty)
from table1 a
inner join table2 b on b.productid = a.productid
group by a.productid
```
It won't return row if there is no corresponding value in table2.
Second query is like `LEFT JOIN`:
```
select a.productid
,(select sum(b.qty) from table2 b where b.productid = a... | Keep performance in mind... inner join is much faster than subselect. A subselect loops through all matching results, so complexity is N x M... causing poor performance. Joins have a better performance in most cases.
See <https://www.essentialsql.com/subquery-versus-inner-join/> |
8,645,085 | We have a job which processes a set of items around 100,000 to compute and update various attributes of those items. When we run on Quad core Xenon server, the program takes about 40 hours finish executing. 40 hours is huge and we have necessity of finishing this job within 5 hours. All the application logic is optimiz... | 2011/12/27 | [
"https://Stackoverflow.com/questions/8645085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186148/"
] | [NGrid](http://ngrid.sourceforge.net/) looks like it might fit what you're after. It doesn't appear to be very well supported (last commit was 3 years ago), but it might provide a good starting point. | Have a look at [BOINC](https://boinc.berkeley.edu/). It's been successfully used to harvest spare CPU time for years. I've only used it as a client, not had to develop for it. But I can say the user experience is pretty goof.
[Word Community Grid](https://secure.worldcommunitygrid.org/index.jsp) use it for various res... |
29,937,517 | We're currently using Capifony and the [ec2-capify](https://github.com/forward/capify-ec2) plugin to do rolling deployments of our code to a set of instances behind an ELB. We also use CloudFront to manage static assets, which we version with a query string (e.g. ?v1 or ?v2).
We've stumbled across a rare issue regardi... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29937517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/483197/"
] | I think proper deployment strategy in your case would be to first deploy instances that are able to serve both v1 and v2 assets (but still serving v1), and then doing another rolling deployment to switch to v2.
Also there is 'sticky sessions' available on ELB (<http://docs.aws.amazon.com/ElasticLoadBalancing/latest/De... | When Cloudfront gets a 404 from your origin (presumably because it has yet to receive the new build), it caches that 404 for 5 minutes. You can alter that behavior by creating a new "Custom Error Response" for your distribution. The custom response lets you set a very low TTL, so that Cloudfront will passing through to... |
29,937,517 | We're currently using Capifony and the [ec2-capify](https://github.com/forward/capify-ec2) plugin to do rolling deployments of our code to a set of instances behind an ELB. We also use CloudFront to manage static assets, which we version with a query string (e.g. ?v1 or ?v2).
We've stumbled across a rare issue regardi... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29937517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/483197/"
] | The approach we opted for was to broadly abandon our existing asset deployment pipeline. In the "old" way, we opted for an `asset.css?v=<version>` model, where CloudFront was pointed at an origin which was served by multiple instances.
The way we resolved it was to move to a hash name asset model and S3 based origin. ... | I think proper deployment strategy in your case would be to first deploy instances that are able to serve both v1 and v2 assets (but still serving v1), and then doing another rolling deployment to switch to v2.
Also there is 'sticky sessions' available on ELB (<http://docs.aws.amazon.com/ElasticLoadBalancing/latest/De... |
29,937,517 | We're currently using Capifony and the [ec2-capify](https://github.com/forward/capify-ec2) plugin to do rolling deployments of our code to a set of instances behind an ELB. We also use CloudFront to manage static assets, which we version with a query string (e.g. ?v1 or ?v2).
We've stumbled across a rare issue regardi... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29937517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/483197/"
] | The approach we opted for was to broadly abandon our existing asset deployment pipeline. In the "old" way, we opted for an `asset.css?v=<version>` model, where CloudFront was pointed at an origin which was served by multiple instances.
The way we resolved it was to move to a hash name asset model and S3 based origin. ... | When Cloudfront gets a 404 from your origin (presumably because it has yet to receive the new build), it caches that 404 for 5 minutes. You can alter that behavior by creating a new "Custom Error Response" for your distribution. The custom response lets you set a very low TTL, so that Cloudfront will passing through to... |
55,165,707 | It is just a funny question. Not a real code for production.
I do not want to fix it. I just want to understand this strange behavior.
I have the code that should print "1" in each line. Actually, it is false. I get the strange result like "11111111" in one line.
```
class Scratch
{
public static void main( String[]... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2650905/"
] | Curiously tried to work on your code, feeling Daredevilish today..
If you add a `System.out.println(2);` in `catch` you can see that the result now shows that the 1 are being printed in single lines, its the ones from catch and the ones triggering the error which ignore the cursor move from `println`
```
static void... | ```
public class Test {
static int count = 0; //counter
public static void main( String[] args )
{
method();
}
static void method()
{
try
{
if (count < 10) //Stop code after 10 runs
{
System.out.println(1);
count++; //increments count
method()... |
55,165,707 | It is just a funny question. Not a real code for production.
I do not want to fix it. I just want to understand this strange behavior.
I have the code that should print "1" in each line. Actually, it is false. I get the strange result like "11111111" in one line.
```
class Scratch
{
public static void main( String[]... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2650905/"
] | While, as @khelwood said in [a comment](https://stackoverflow.com/questions/55165707/why-multiple-calls-of-system-out-println-prints-values-in-single-line/55166343#comment97071030_55165707), you shouldn’t have any specific expectations to a program that ignores repeated `StackOverflowError`s. About anything may go wron... | ```
public class Test {
static int count = 0; //counter
public static void main( String[] args )
{
method();
}
static void method()
{
try
{
if (count < 10) //Stop code after 10 runs
{
System.out.println(1);
count++; //increments count
method()... |
55,165,707 | It is just a funny question. Not a real code for production.
I do not want to fix it. I just want to understand this strange behavior.
I have the code that should print "1" in each line. Actually, it is false. I get the strange result like "11111111" in one line.
```
class Scratch
{
public static void main( String[]... | 2019/03/14 | [
"https://Stackoverflow.com/questions/55165707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2650905/"
] | While, as @khelwood said in [a comment](https://stackoverflow.com/questions/55165707/why-multiple-calls-of-system-out-println-prints-values-in-single-line/55166343#comment97071030_55165707), you shouldn’t have any specific expectations to a program that ignores repeated `StackOverflowError`s. About anything may go wron... | Curiously tried to work on your code, feeling Daredevilish today..
If you add a `System.out.println(2);` in `catch` you can see that the result now shows that the 1 are being printed in single lines, its the ones from catch and the ones triggering the error which ignore the cursor move from `println`
```
static void... |
8,624,425 | I would like to get number of likes of specified URL.
```
/http://graph.facebook.com/http://www.example.com
```
However, there is a problem if URL looks like:
```
/http://www.example.com/page.php?param1=aaa¶m2=bbb
```
Then Facebook treats it like:
```
/http://www.example.com/page.php
```
I tried to use url... | 2011/12/24 | [
"https://Stackoverflow.com/questions/8624425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/992159/"
] | I believe you are referring to a hyper link
`<a href="group?id=123">My Group</a>`
you will most likely need to change the url and stuff, but basically it's just a link. | I would recommend googling "Getting Started with ASP.Net" OR "first asp.net site", you will find a barrage of sites and resources dedicated to the framework.
I guess I would recommend starting here and then going from there: <http://www.asp.net/get-started> |
6,148,114 | I have an `activity` that constantly (several times per second) sends `byte[]` data to a `service` via AIDL. The `service` forwards these messages using a `message`-`bundle`\* to a network thread's `handler`. The network thread also constantly receives data, which it sends to the `service`'s `handler` as `message`-`bun... | 2011/05/27 | [
"https://Stackoverflow.com/questions/6148114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/524332/"
] | Are those byte arrays that big that you really need to worry about? Without knowing anything of your app, I would guess that the bottleneck in the app you're describing will be in the network handler, rather than the messaging between the Service and the Activity. Unless you're leaking the Bundles somewhere, the GC sho... | I often use pools on embedded stuff for almost exactly this reason - to provide some 'flow control', (if the pool is empty, a thread has to wait on it until a message is released from somewhere else), and to prevent runaway malloc/new depleting what little heap I have. Managing the pool is easier if each pooled message... |
257,604 | Currently, I have a problem about the Buck-Boost converter. The schematic of my Buck-Boost converter can be seen as below:
[](https://i.stack.imgur.com/ErTNx.jpg)
I used the Hall Effect transducers, LV25-P and LA25-NP, to measure the inpu... | 2016/09/13 | [
"https://electronics.stackexchange.com/questions/257604",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/123559/"
] | First of all, you should be sure that you measure correctly. Your probe has ground antenna effect, you can read the "[Measuring Output Ripple and Switching Transients in Switching Regulators](http://www.analog.com/media/en/technical-documentation/application-notes/AN-1144.pdf)" application note, for more detail.
Secon... | Your Spikes appear to be starting at IGBT turn on .In your set up the inductor current is quite high at turn on .Most convertors are set up this way so it would be blasphemous of me to say that this is wrong .This continious mode setup needs a fast diode as m derecik said .Also you must slow down the gate turn on of th... |
688,182 | According to Einstein, weight will be the same as here in earth in a rocket going at 1G far from gravity fields. If we propulse an object here it will feel two forces, F=mg and F=ma of the thrust, but in space it will only feel the force of thrust, so how can two forces equal one? how can weight be the same? | 2022/01/12 | [
"https://physics.stackexchange.com/questions/688182",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/-1/"
] | The equivalence principle concludes that the gravitational force you experience here on earth, in a *stationary* frame of reference (you are standing still with respect to the earth’s surface) is equal to the force you would feel if you were in a uniformly accelerated frame of reference in space, where the acceleration... | I think there's some confusion as to what the two cases are. The actual two cases:
1. A weight here on Earth (no rocket), $F = mg$
2. A weight on a rocket (far from Earth, i.e. no gravity) under going acceleration, $F = ma$
If the acceleration of the rocket is the same as the gravitation acceleration of the Earth's g... |
688,182 | According to Einstein, weight will be the same as here in earth in a rocket going at 1G far from gravity fields. If we propulse an object here it will feel two forces, F=mg and F=ma of the thrust, but in space it will only feel the force of thrust, so how can two forces equal one? how can weight be the same? | 2022/01/12 | [
"https://physics.stackexchange.com/questions/688182",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/-1/"
] | Forget g's and accelerations and forces for a moment, and simply imagine the following scenario. Really do close your eyes and imagine it.
You go inside an elevator and shut the door. The power goes out so you cannot change floors. You can jump, do push-ups, toss a tennis ball, any experiment you can think of. (And the... | I think there's some confusion as to what the two cases are. The actual two cases:
1. A weight here on Earth (no rocket), $F = mg$
2. A weight on a rocket (far from Earth, i.e. no gravity) under going acceleration, $F = ma$
If the acceleration of the rocket is the same as the gravitation acceleration of the Earth's g... |
20,497 | I'm looking for help on a project where I will be placing sensor data in 3D space using augmented reality. Most solutions I have found for finding position with an IMU involve the magnetometer, but for my implementation that will not work because I am measuring magnetic fields so the magnetometer value will definitely ... | 2020/04/16 | [
"https://robotics.stackexchange.com/questions/20497",
"https://robotics.stackexchange.com",
"https://robotics.stackexchange.com/users/26173/"
] | The short answer is that it's possible, but tricky.
To estimate position you integrate accelerometer readings over time to get linear velocity estimates, and then integrate the velocities to get position estimates.
The downside of this double integration is that either initial readings must be very accurate, or sophi... | We developed this for pipeline inspections and used this to map a pipeline. We found magnetism not to be very reliable and did it without. It works, but you have accumulative errors that can be significant. In our case you will try to find reference points and make corrections for these accordingly. And with a pipeline... |
65,302,159 | I am fairly new to Python and I know values called in a function are only there inside the function. I am trying to have a battle between a player and a boss in a small text game I am writing; however, It just keeps populating the same information each time the function is called. I feel like I am missing something. An... | 2020/12/15 | [
"https://Stackoverflow.com/questions/65302159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14828637/"
] | To log object-level events you have to enable logging [data events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html) for S3 in CloudTrail's trail. If you don't have a trail already, you have to [create one](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cl... | You can send object level events to Event Bridge from S3 by capturing these object events and making sure that you have S3 notifications from S3 to Event Bridge enabled on the bucket level, or you can capture these events through CloudTrail API logging. If you want to capture events for a few buckets, then the first me... |
13,735,886 | In a function of my program I am trying to load data from a file into this struct array:
```
/* database struct */
typedef struct node {
char name[MAX];
char address[MAX];
long int number;
}record_type;
record_type record[100];
```
The function is as follows:
```
/* load database from dis... | 2012/12/06 | [
"https://Stackoverflow.com/questions/13735886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1261628/"
] | `scanf("%s"...` parses a whitespace delimited string in your input, so if you have spaces in the strings you want to parse, it won't work.
While you could use regexes to get what you want, since you use fixed strings as your markers, you could instead use `strstr` to pull out your strings:
```
while(fgets(line, sizeo... | First of all, you might want to take another look at <http://www.cplusplus.com/reference/cstdio/fgets/>. Here you will see that the *str* argument is a pointer to a buffer (which you provided correctly) and then *num* is the amount of bytes you want to read **max**, which you did **not** provide correctly.
The problem... |
32,576 | I'm starting investigating the properties of the fractionally integrated brownian motion, yet I'm not able to figure out what kind of distribution should an increment of a fBM process follow, conditioned on the previous observations...
For example, when studying an ARMA(1,1) model whose variance follows a GARCH(1,1), ... | 2017/02/21 | [
"https://quant.stackexchange.com/questions/32576",
"https://quant.stackexchange.com",
"https://quant.stackexchange.com/users/16045/"
] | The average return scales linearly with the time period, i.e. $R\_N = N R\_1$, while the standard deviation scales with the square root, i.e. $\sigma\_N = \sqrt{N}\sigma\_1$. As the period becomes really small, $\sqrt{N}$ becomes much bigger than $N$. | it is because "R-bar" over 1 day is a very tiny number , virtually zero |
480,894 | I'm looking for a program to copy stdin to stdout while showing control characters (like `cat -v`) and without waiting for an EOF (the input is from a `tail -f`). I have GNU|Linux; the `cat` that's installed ignores the `-u` flag. | 2012/09/28 | [
"https://superuser.com/questions/480894",
"https://superuser.com",
"https://superuser.com/users/144700/"
] | GNU `cat` ignores `-u` because its output is **always unbuffered**. So, when you ask for unbuffered output with `-u`, you get it (but you also get it even when you don't ask for it).
GNU `tail` has the same, always-unbuffered behaviour.
To prove this, in one shell I did:
```
while :; do echo -ne "hello\t"; sleep 1;d... | BSD `cat`'s `-u` option disabled output buffering. From `man cat`:
```
-u Disable output buffering.
``` |
52,779,150 | I have a menu and a content area which displays content based on the selected item in the menu. Since the user is allowed to change the structure of the main menu, I decided that everything will be on page /home/index and will have a guid assigned to the content which needs to be shown. I started with the idea to intro... | 2018/10/12 | [
"https://Stackoverflow.com/questions/52779150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8505847/"
] | View components, just like child actions before them in ASP.NET MVC do not support POSTs. You need a full fledged action to handle the form post, which will need to return a full view. Essentially, you just need to think about it more abstractly.
A view component is just ultimately a means of dumping some HTML into th... | Kindly refer to the following link:
```
https://andrewlock.net/an-introduction-to-viewcomponents-a-login-status-view-component/
```
it might be of help
```
public class LoginStatusViewComponent : ViewComponent
{
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly UserManager<Ap... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.