qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
26,354 | Does anyone know how to print a barcode to the Intermec PB20 bluetooth printer from a Windows Compact Framework application? We are currently using the Intermec LinePrinter API but have been unable to find a way to print a barcode.
| 2008/08/25 | [
"https://Stackoverflow.com/questions/26354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620435/"
] | Thank you all for your thoughts. Printing directly to the serial port is likely the most flexible method. In this case we didn't want to replicate all of the work that was already built into the Intermec dll for handling the port, printer errors, etc. We were able to get this working by sending the printer the appropri... | Thank you for your answer. There are free fonts available -- However, the PB20 is a handheld printer with a few built-in fonts. It has the capability to print barcodes and can be manipulated directly via the serial port. Intermec provides a .Net CF API to make printing "easy", and it is using this API that we have been... |
26,354 | Does anyone know how to print a barcode to the Intermec PB20 bluetooth printer from a Windows Compact Framework application? We are currently using the Intermec LinePrinter API but have been unable to find a way to print a barcode.
| 2008/08/25 | [
"https://Stackoverflow.com/questions/26354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620435/"
] | Thank you all for your thoughts. Printing directly to the serial port is likely the most flexible method. In this case we didn't want to replicate all of the work that was already built into the Intermec dll for handling the port, printer errors, etc. We were able to get this working by sending the printer the appropri... | Ditch all API's and use a serial port API directly.
Talk the printers language and you can get decent results.
Every other approach leads to frustration.
Not so pretty, but that is the way my old factory worked.
4k print jobs per day, and none ever missed. |
26,354 | Does anyone know how to print a barcode to the Intermec PB20 bluetooth printer from a Windows Compact Framework application? We are currently using the Intermec LinePrinter API but have been unable to find a way to print a barcode.
| 2008/08/25 | [
"https://Stackoverflow.com/questions/26354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620435/"
] | Thank you all for your thoughts. Printing directly to the serial port is likely the most flexible method. In this case we didn't want to replicate all of the work that was already built into the Intermec dll for handling the port, printer errors, etc. We were able to get this working by sending the printer the appropri... | [Free 3 of 9](http://www.squaregear.net/fonts/free3of9.shtml)
>
> This is 3 of 9 (sometimes called "code
> 39"), a widely used barcode standard
> that includes capital letters,
> numbers, and several symbols. This is
> not the barcode for UPC's (universal
> price codes) found on products at the
> store. However... |
18,784,950 | Here I have a code that must return me a reviews... so I have an array with `reviews[i]`
I try with `places.reviews[0].text` but I get only first reviews, I want to get it 5 if there is 5, if there is 3 I want to get 3 reviews...
But how I can increment i... how to write a code to get me all reviews from array `revie... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18784950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2761178/"
] | ```
var contentStr = "";
for(var i=0;i<place.reviews.length;i++){
contentStr += place.reviews[i].text;
}
``` | If you wish to get each review then you need to loop through the array in your javascript.
using jQuery (which you have tagged) you can do
```
$("#MyArray").each(function(i){
//logic to do what you want with the results here.
}
``` |
18,784,950 | Here I have a code that must return me a reviews... so I have an array with `reviews[i]`
I try with `places.reviews[0].text` but I get only first reviews, I want to get it 5 if there is 5, if there is 3 I want to get 3 reviews...
But how I can increment i... how to write a code to get me all reviews from array `revie... | 2013/09/13 | [
"https://Stackoverflow.com/questions/18784950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2761178/"
] | ```
var contentStr = "";
for(var i=0;i<place.reviews.length;i++){
contentStr += place.reviews[i].text;
}
``` | What you need is some kind of a loop that increments the index.
How about a for-loop?
```
var contentStr = '';
for(var i = 0; i < place.reviews.length; i++){
contentStr += '<br>'+place.reviews[i].text;
}
```
And the same goes for ratings. |
27,847,044 | i'm trying to keep the UISearchBarDisplayController on top of UItableview in swift
i tried this code (which i convert from objectC to swift) but no luck:
```
override func scrollViewDidScroll(scrollView: UIScrollView) {
//
var searchBar: UISearchBar = (self.searchDisplayController?.searchBar)!
//... | 2015/01/08 | [
"https://Stackoverflow.com/questions/27847044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3940844/"
] | I'm going to assume you're working on windows with an iPhone that's iOS8 because that's where you currently can't run your app directly on a connected device.
What we did to "fix" this is creating a Development Provisioning Profile with the UDID's of our test devices and added this to config -> tools in the trigger.i... | This is possible but it depends on your os.
If your on a Mac you can deploy to both ios and android devices from forge, just connect them via usb and build, grated you need to make sure iTunes sees your devices etc.. there are guides on the trigger site
If you are on Windows, you are unfortunate out of luck right no... |
14,317,055 | You have a list of numbers and you want to filter out those numbers that contain unique digits, i.e. each digit may only occur once in the number.
Positive examples:
* 985
* 58293.6
* 0.1246
Negative examples:
* 9585 (5 occurs twice)
* 58293.666 (6 occurs three times)
* 0.12461 (1 occurs twice)
How would you do th... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14317055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1125413/"
] | Try:
```
def predicate(n):
s = repr(n)
return len(s) == len(set(s))
filtered_numbers = [ n for n in numbers if predicate(n) ]
```
or, if you prefer filter function:
```
filtered_numbers = filter(predicate, numbers)
```
or:
```
filtered_numbers = filter(lambda n: len(repr(n)) == len(set(repr(n))), numbers... | If you want a regex-based solution, consider the following regex :
```
(?![\d.]*([\d.])[\d.]*\1)^[\d.]+$
```
That is, match a sequence of digits and periods if there are no duplicate digits and there is not a duplicate decimal point.
Update (thanks @frb): the correct way to write this in Python is
```
re.match(r"(... |
14,317,055 | You have a list of numbers and you want to filter out those numbers that contain unique digits, i.e. each digit may only occur once in the number.
Positive examples:
* 985
* 58293.6
* 0.1246
Negative examples:
* 9585 (5 occurs twice)
* 58293.666 (6 occurs three times)
* 0.12461 (1 occurs twice)
How would you do th... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14317055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1125413/"
] | >
> Is there a way to do it without converting the integers to strings
> first and then convert them back?
>
>
>
Yes, you could use `divmod` to find the digits base 10, but this is not faster than the method you posted:
```
def uniques2(numbers):
for number in numbers:
seen = set()
quotient =... | Try:
```
def predicate(n):
s = repr(n)
return len(s) == len(set(s))
filtered_numbers = [ n for n in numbers if predicate(n) ]
```
or, if you prefer filter function:
```
filtered_numbers = filter(predicate, numbers)
```
or:
```
filtered_numbers = filter(lambda n: len(repr(n)) == len(set(repr(n))), numbers... |
14,317,055 | You have a list of numbers and you want to filter out those numbers that contain unique digits, i.e. each digit may only occur once in the number.
Positive examples:
* 985
* 58293.6
* 0.1246
Negative examples:
* 9585 (5 occurs twice)
* 58293.666 (6 occurs three times)
* 0.12461 (1 occurs twice)
How would you do th... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14317055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1125413/"
] | Try:
```
def predicate(n):
s = repr(n)
return len(s) == len(set(s))
filtered_numbers = [ n for n in numbers if predicate(n) ]
```
or, if you prefer filter function:
```
filtered_numbers = filter(predicate, numbers)
```
or:
```
filtered_numbers = filter(lambda n: len(repr(n)) == len(set(repr(n))), numbers... | Using collections.Counter:
```
from collections import Counter
def unique(seq):
return any(x > 1 for x in Counter(seq).values())
```
This will work for any sequence, not only strings.
And only now I noticed that you didn't want to convert to strings... not sure why, but I'll let the answer stay. |
14,317,055 | You have a list of numbers and you want to filter out those numbers that contain unique digits, i.e. each digit may only occur once in the number.
Positive examples:
* 985
* 58293.6
* 0.1246
Negative examples:
* 9585 (5 occurs twice)
* 58293.666 (6 occurs three times)
* 0.12461 (1 occurs twice)
How would you do th... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14317055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1125413/"
] | >
> Is there a way to do it without converting the integers to strings
> first and then convert them back?
>
>
>
Yes, you could use `divmod` to find the digits base 10, but this is not faster than the method you posted:
```
def uniques2(numbers):
for number in numbers:
seen = set()
quotient =... | If you want a regex-based solution, consider the following regex :
```
(?![\d.]*([\d.])[\d.]*\1)^[\d.]+$
```
That is, match a sequence of digits and periods if there are no duplicate digits and there is not a duplicate decimal point.
Update (thanks @frb): the correct way to write this in Python is
```
re.match(r"(... |
14,317,055 | You have a list of numbers and you want to filter out those numbers that contain unique digits, i.e. each digit may only occur once in the number.
Positive examples:
* 985
* 58293.6
* 0.1246
Negative examples:
* 9585 (5 occurs twice)
* 58293.666 (6 occurs three times)
* 0.12461 (1 occurs twice)
How would you do th... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14317055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1125413/"
] | If you want a regex-based solution, consider the following regex :
```
(?![\d.]*([\d.])[\d.]*\1)^[\d.]+$
```
That is, match a sequence of digits and periods if there are no duplicate digits and there is not a duplicate decimal point.
Update (thanks @frb): the correct way to write this in Python is
```
re.match(r"(... | Using collections.Counter:
```
from collections import Counter
def unique(seq):
return any(x > 1 for x in Counter(seq).values())
```
This will work for any sequence, not only strings.
And only now I noticed that you didn't want to convert to strings... not sure why, but I'll let the answer stay. |
14,317,055 | You have a list of numbers and you want to filter out those numbers that contain unique digits, i.e. each digit may only occur once in the number.
Positive examples:
* 985
* 58293.6
* 0.1246
Negative examples:
* 9585 (5 occurs twice)
* 58293.666 (6 occurs three times)
* 0.12461 (1 occurs twice)
How would you do th... | 2013/01/14 | [
"https://Stackoverflow.com/questions/14317055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1125413/"
] | >
> Is there a way to do it without converting the integers to strings
> first and then convert them back?
>
>
>
Yes, you could use `divmod` to find the digits base 10, but this is not faster than the method you posted:
```
def uniques2(numbers):
for number in numbers:
seen = set()
quotient =... | Using collections.Counter:
```
from collections import Counter
def unique(seq):
return any(x > 1 for x in Counter(seq).values())
```
This will work for any sequence, not only strings.
And only now I noticed that you didn't want to convert to strings... not sure why, but I'll let the answer stay. |
24,602,360 | Is it possible to work only on css, to set a dynamic height of the div to a proportion of full screen?
Would like to have something like the following example
```
.my_div {
width:100%;
height:90%;
}
``` | 2014/07/07 | [
"https://Stackoverflow.com/questions/24602360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3330523/"
] | <http://jsfiddle.net/xVXPk/15/>
Try this. ( always do float:right, float:left, center, clear:both ) -- note close your image tags.
```
<div id="header">
<div class="user-header">
<label class="user"></label>
<a class="" href="#">Logout</a>
</div>
<div class="logo">
... | You simply haven't done the math right. There is not enough space for the `div class="user-header"` to be positioned on the RH-side. See the [**JSFiddle with borders**](http://jsfiddle.net/xVXPk/9/).
**EDIT**: and you need to float:left the `div class="company-header"` as well: [**live demo**](http://jsbin.com/yibid/... |
24,602,360 | Is it possible to work only on css, to set a dynamic height of the div to a proportion of full screen?
Would like to have something like the following example
```
.my_div {
width:100%;
height:90%;
}
``` | 2014/07/07 | [
"https://Stackoverflow.com/questions/24602360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3330523/"
] | <http://jsfiddle.net/xVXPk/15/>
Try this. ( always do float:right, float:left, center, clear:both ) -- note close your image tags.
```
<div id="header">
<div class="user-header">
<label class="user"></label>
<a class="" href="#">Logout</a>
</div>
<div class="logo">
... | Add class to anchor: `<a class="logout" href="#">Logout</a>`
css:
```
#header {
position: relative;
}
.logout {
line-height: 58px; /* Same height as #header */
position: absolute;
top: 0;
right: 30px; /* Same padding-left of logo */
}
```
[DEMO](http://jsfiddle.net/xVXPk/19/) |
24,602,360 | Is it possible to work only on css, to set a dynamic height of the div to a proportion of full screen?
Would like to have something like the following example
```
.my_div {
width:100%;
height:90%;
}
``` | 2014/07/07 | [
"https://Stackoverflow.com/questions/24602360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3330523/"
] | You simply haven't done the math right. There is not enough space for the `div class="user-header"` to be positioned on the RH-side. See the [**JSFiddle with borders**](http://jsfiddle.net/xVXPk/9/).
**EDIT**: and you need to float:left the `div class="company-header"` as well: [**live demo**](http://jsbin.com/yibid/... | Add class to anchor: `<a class="logout" href="#">Logout</a>`
css:
```
#header {
position: relative;
}
.logout {
line-height: 58px; /* Same height as #header */
position: absolute;
top: 0;
right: 30px; /* Same padding-left of logo */
}
```
[DEMO](http://jsfiddle.net/xVXPk/19/) |
48,930,757 | ```
<table>
<tr> <td rowspan="2">1</td> <td>2</td> </tr>
<tr> <td rowspan="2">3</td> </tr>
<tr> <td>4</td> </tr>
</table>
```
seemingly only displays two rows:
[](https://i.stack.imgur.com/yC... | 2018/02/22 | [
"https://Stackoverflow.com/questions/48930757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1337200/"
] | You can add a height property to the row:
```html
<table border=1>
<tr>
<td rowspan="2">1</td>
<td>2</td>
</tr>
<tr style="height: 1.5em">
<td rowspan="2">3</td>
</tr>
<tr>
<td>4</td>
</tr>
</table>
``` | One suboptimal option could be to add an empty column:
```
<table>
<tr> <td rowspan="2">1</td> <td>2</td> <td class="void"></td> </tr>
<tr> <td rowspan="2">3</td> <td class="void"></td> </tr>
<tr> <td>4</td> <td class="void"></td> </tr>
</t... |
73,761,792 | I have a table which includes `salary` and `company_location`.
I was trying to calculate the mean salary of a country, its works:
```
wage = df.groupby('company_location').mean()['salary']
```
However, I have many with `company_location` which have less than 5 entries, I would like to exclude them from the report.
... | 2022/09/18 | [
"https://Stackoverflow.com/questions/73761792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20025108/"
] | `expanding.mean`
----------------
```
for c in ('a', 'b'):
m = df.filter(like=c).expanding(axis=1).mean().iloc[:, 1:]
df[m.columns.str.replace(r'(\d+)$', r'1_\1', regex=True)] = m
```
#### Result
```
a1 a2 a3 a4 b1 b2 b3 b4 a1_2 a1_3 a1_4 b1_2 b1_3 b1_4
0 1 4 6 10 15 40 ... | IIUC, you can reshape with `wide_to_long`, perform a `groupby.rolling`, then `unstack` and flatten the multiindex:
```
df.join(pd
.wide_to_long(df.reset_index(), stubnames=['a', 'b'], i='index', j='n')
.groupby(level='index').expanding().mean()
.loc[lambda d: d.index.get_level_values('n')>1]
.droplevel(0).... |
73,761,792 | I have a table which includes `salary` and `company_location`.
I was trying to calculate the mean salary of a country, its works:
```
wage = df.groupby('company_location').mean()['salary']
```
However, I have many with `company_location` which have less than 5 entries, I would like to exclude them from the report.
... | 2022/09/18 | [
"https://Stackoverflow.com/questions/73761792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20025108/"
] | `expanding.mean`
----------------
```
for c in ('a', 'b'):
m = df.filter(like=c).expanding(axis=1).mean().iloc[:, 1:]
df[m.columns.str.replace(r'(\d+)$', r'1_\1', regex=True)] = m
```
#### Result
```
a1 a2 a3 a4 b1 b2 b3 b4 a1_2 a1_3 a1_4 b1_2 b1_3 b1_4
0 1 4 6 10 15 40 ... | ```py
groups = df.groupby(lambda col: col[0], axis=1)
cummeans = (groups.cumsum(axis=1).div(groups.cumcount().add(1))
.filter(regex="[^1]$")
.rename(lambda col: re.sub(r"(\d+)$", r"1_\1", col), axis=1))
result = df.join(cummeans)
```
* get the groups determined by 1st character... |
8,951,607 | My Rails 3.1 app has two user models: User and Admin. I'm using Devise.
My routes.rb contains
```
root :to => "pages#welcome"
```
where users can login as a User or and Admin.
Once logged in, the root path should change. The root for Admins should be "admins#dashboard", the root for Users should be the current us... | 2012/01/21 | [
"https://Stackoverflow.com/questions/8951607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716294/"
] | You can use namespace for Admin users => 2 different roots.
Also take a look at the devise configuration file `devise.rb` it has some settings for managing scopes( User and Admin ). For example:
```
# ==> Scopes configuration
# Turn scoped views on. Before rendering "sessions/new", it will first check for
# "user... | pages#welcome<--- in this controller and action send params anonymous
Could you please try this in your application.rb
```
def after_sign_in_path_for(resource)
if params[:anonymous].eql?("1") // mean user
redirect_to user_root_path, :user_id => current_user.id
else // mean administration
redirect_to admin... |
8,951,607 | My Rails 3.1 app has two user models: User and Admin. I'm using Devise.
My routes.rb contains
```
root :to => "pages#welcome"
```
where users can login as a User or and Admin.
Once logged in, the root path should change. The root for Admins should be "admins#dashboard", the root for Users should be the current us... | 2012/01/21 | [
"https://Stackoverflow.com/questions/8951607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716294/"
] | After a bit of digging, and some pointers from Mikhail, I managed to answer this myself.
In my routes.rb file I added the following:
```
root :to => "pages#welcome"
```
to define the root for unauthenticated users.
```
authenticated :admin do
root :to => "dashboard#show"
end
```
to define the root for authen... | pages#welcome<--- in this controller and action send params anonymous
Could you please try this in your application.rb
```
def after_sign_in_path_for(resource)
if params[:anonymous].eql?("1") // mean user
redirect_to user_root_path, :user_id => current_user.id
else // mean administration
redirect_to admin... |
33,092,965 | I've been working on some code to implement an (edit: *unidirectional*) linked list in java. My main issue is coming about when it comes to finding and deleting nodes, that is, using Find(data) tells the user whether or not a node is present in the list; Delete(data) actually removes the node from the list after it is ... | 2015/10/13 | [
"https://Stackoverflow.com/questions/33092965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5438857/"
] | Swift is picky with casting, so wrap the numbers in NSTimeInterval
```
UIView.animateWithDuration(NSTimeInterval(highlightTime),
delay: NSTimeInterval(0.0),
options: [.CurveLinear, .AllowUserInteraction, .BeginFromCurrentState],
animations: {
button.backgroundColor = highlightColor
}, completio... | It seems like your highlightTime is defined as some other type not as Double, while defining the variable, simply define its type as,
```
let highlightTime: Double = 1.0
```
And, that should fix it. |
33,092,965 | I've been working on some code to implement an (edit: *unidirectional*) linked list in java. My main issue is coming about when it comes to finding and deleting nodes, that is, using Find(data) tells the user whether or not a node is present in the list; Delete(data) actually removes the node from the list after it is ... | 2015/10/13 | [
"https://Stackoverflow.com/questions/33092965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5438857/"
] | Swift is picky with casting, so wrap the numbers in NSTimeInterval
```
UIView.animateWithDuration(NSTimeInterval(highlightTime),
delay: NSTimeInterval(0.0),
options: [.CurveLinear, .AllowUserInteraction, .BeginFromCurrentState],
animations: {
button.backgroundColor = highlightColor
}, completio... | Thanks for the feedback, everyone.
After some time, I was able to figure it out.
I had previously declared the highlightTime variable as "highlightTime: Double", with no value assigned. I changed it to "highlightTime: NSTimeInterval" and it is working now. |
16,361,173 | I am using CKEditor (v3.6.4) and try to find out how to change the palettes for **Text Color** and **Background Color** separately.
I found `config.colorButton_colors` in the [docs](http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.colorButton_colors) which allows me to define the color palette. How... | 2013/05/03 | [
"https://Stackoverflow.com/questions/16361173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1066234/"
] | The best and easy way is, Include required plugin at the download time or link below
[Ckeditor Builder](http://ckeditor.com/builder) | You can't do that because the color palette is defined for the text color and background.
```
CKEDITOR.config.colorButton_colors =
'000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,' +
'B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,' +
'F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,' +
'FFA07A,FFA500,FF... |
16,361,173 | I am using CKEditor (v3.6.4) and try to find out how to change the palettes for **Text Color** and **Background Color** separately.
I found `config.colorButton_colors` in the [docs](http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.colorButton_colors) which allows me to define the color palette. How... | 2013/05/03 | [
"https://Stackoverflow.com/questions/16361173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1066234/"
] | Yes its actually possible. Just dont pick colors from the config but rather do the following in colorbutton/plugin.js:
```
var textColors = '1ABC9C,2ECC71,3498DB,9B59B6,4E5F70,F1C40F,' +
'16A085,27AE60,2980B9,8E44AD,2C3E50,F39C12,' +
'E67E22,E74C3C,ECF0F1,95A5A6... | You can't do that because the color palette is defined for the text color and background.
```
CKEDITOR.config.colorButton_colors =
'000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,' +
'B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,' +
'F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,' +
'FFA07A,FFA500,FF... |
21,960,759 | I've been trying to call a user defined JavaScript function on a jQuery element, and though I've seen several topics on here about it, I'm still having a bit of trouble applying their logics to my situation.
Here's what i've tried so far:
**Javscript & jQuery:**
```
$(document).ready(function() {
// JavaScript f... | 2014/02/22 | [
"https://Stackoverflow.com/questions/21960759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1183323/"
] | Based on the current available info, I believe you want something like this:
```
$(".mediaDesc").each(function () {
if ($(this).find("p").length == 0 || $(this).find("div").length == 0 || $(this).find("span").length == 0)
{
$(this).html(nl2br($(this).html()));
}
});
```
edit: fixed mis-use of `.c... | `.contains` is for searching text within the node. What you want is:
```
$('.mediaDesc').not(':has(p, div, span)').each(nl2br)
```
if you need to process the node and only call nl2br with `text` or `html` then do:
```
$('.mediaDesc').not(':has(p, div, span)').each(function(){
nl2br( $(this).html() )
})
``` |
55,065,877 | I want to create multiple projects with the same files but the files are going to be in different locations. I don't have idea how to be able to share same code with multiple projects that basically hasn't the same folder structure (something like I want to do git on subfolder and not on the root folder) so I don't nee... | 2019/03/08 | [
"https://Stackoverflow.com/questions/55065877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11171165/"
] | I think the most important point is consistency, which comes in a couple of flavours.
* PrimeFaces (PF) components have a lot of styling put on them (through the theme options). If you use PF components throughout your application, you'll get a consistent style. If you mix PF and JSF components this will look messy.
*... | Better choose one of them and develop all application using mainly one stack. Will be easy to support, easy update, easy bug fix.
Primefaces at the moment good choose. |
55,065,877 | I want to create multiple projects with the same files but the files are going to be in different locations. I don't have idea how to be able to share same code with multiple projects that basically hasn't the same folder structure (something like I want to do git on subfolder and not on the root folder) so I don't nee... | 2019/03/08 | [
"https://Stackoverflow.com/questions/55065877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11171165/"
] | In general, I'd say prefer them than JSF standard components, the reason is simple: CSS skinning. For example, even if `h:inputText` and `p:inputText` are exactly the same component, you might want to have the same CSS skinning for all JSF components (specially if you use a premium layout from PF)
But, I think there a... | Better choose one of them and develop all application using mainly one stack. Will be easy to support, easy update, easy bug fix.
Primefaces at the moment good choose. |
162,060 | I am a PhD math student, and I am wondering if I should study quantum mechanics while I don't have an undergrad background in physics.
[I posted this question in physics stackexchange](https://physics.stackexchange.com/q/30670/5878), but there doesn't seem to be many people interested in it there. In addition, I want ... | 2012/06/23 | [
"https://math.stackexchange.com/questions/162060",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/34339/"
] | This answer is quite late, so I'll make it general for those wondering about how to jump into QM with an undergraduate or higher background in math. A word of caution to mathematicians entering the physics realm: though there is a great overlap in material, the emphasis, pedagogy, and approach of a physicist can be qui... | Chemists and material scientists routinely get an exposure to QM without needing all the courses that a physicist takes. Math through multivar-calc/DiffyQs and first year physics is enough.
Take a look at the QM in a standard p-chem book (say Atkins). [http://www.amazon.com/Atkins-Physical-Chemistry-Peter-W/dp/019879... |
162,060 | I am a PhD math student, and I am wondering if I should study quantum mechanics while I don't have an undergrad background in physics.
[I posted this question in physics stackexchange](https://physics.stackexchange.com/q/30670/5878), but there doesn't seem to be many people interested in it there. In addition, I want ... | 2012/06/23 | [
"https://math.stackexchange.com/questions/162060",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/34339/"
] | This answer is quite late, so I'll make it general for those wondering about how to jump into QM with an undergraduate or higher background in math. A word of caution to mathematicians entering the physics realm: though there is a great overlap in material, the emphasis, pedagogy, and approach of a physicist can be qui... | I think Chris Isham's book would be right up your alley: [https://www.amazon.com/Lectures-Quantum-Theory-Mathematical-Foundations/dp/B01K0RJQT8/ref=pd\_sbs\_14\_1](https://rads.stackoverflow.com/amzn/click/B01K0RJQT8) |
162,060 | I am a PhD math student, and I am wondering if I should study quantum mechanics while I don't have an undergrad background in physics.
[I posted this question in physics stackexchange](https://physics.stackexchange.com/q/30670/5878), but there doesn't seem to be many people interested in it there. In addition, I want ... | 2012/06/23 | [
"https://math.stackexchange.com/questions/162060",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/34339/"
] | Chemists and material scientists routinely get an exposure to QM without needing all the courses that a physicist takes. Math through multivar-calc/DiffyQs and first year physics is enough.
Take a look at the QM in a standard p-chem book (say Atkins). [http://www.amazon.com/Atkins-Physical-Chemistry-Peter-W/dp/019879... | I think Chris Isham's book would be right up your alley: [https://www.amazon.com/Lectures-Quantum-Theory-Mathematical-Foundations/dp/B01K0RJQT8/ref=pd\_sbs\_14\_1](https://rads.stackoverflow.com/amzn/click/B01K0RJQT8) |
67,316,729 | I have a function works before using goroutine:
```
res, err := example(a , b)
if err != nil {
return Response{
ErrCode: 1,
ErrMsg:"error",
}
}
```
Response is a struct defined error info. When I use goroutine:
```
var wg sync.WaitGroup()
wg.Add(1)
go func(){
defer wg.Done()
res, err := example(a , b)... | 2021/04/29 | [
"https://Stackoverflow.com/questions/67316729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8940487/"
] | You need to use channel to achieve what you want:
```
func main() {
c := make(chan Response)
go func() {
res, err := example(a , b)
if err != nil {
c <- Response{
ErrCode: 1,
ErrMsg:"error",
}
}
}()
value := <-c
}
``` | The function you provide to span a go routine has no return in its signature. Go routines cannot return data. Running goroutine (asynchronously) and fetch return value from function are essentially contradictory actions. Simply put, goroutine cannot know where to return the data. Hence it doesnot allow it.
You can do ... |
11,013,212 | In the code below, Main function waits for Manual Reset Event (mre) to be set.
However, before **the waiting** starts, the sync object is already set to signaled state by other thread.
So, is it safe to wait for "already signaled sync objects"?
```
class Program
{
static void Main(string[] args)
{
Man... | 2012/06/13 | [
"https://Stackoverflow.com/questions/11013212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544433/"
] | Yes. If it's already signalled, there won't be any waiting done. That's fine.
In fact, if you look at the return value of `WaitOne(int)` you'll see that it returns `true` if it is already set (or gets set before the timeout), and `false` if it doesn't get set within your timeout value.
That distinction is sometimes i... | Yes it is, the code just goes on. |
24,047,555 | For the League of Legends API, I'm trying to get the players RankedSolo5x5. Successfully, I get that information for a player. But the array number will change depending on what players have & haven't played. So let's say RankedPremade5x5 has never been played. It won't appear in the array, thus making RankedSolo5x5 #4... | 2014/06/04 | [
"https://Stackoverflow.com/questions/24047555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1978872/"
] | You could fetch your array and check the playerStatSummaryType to see if it matches to RankedSolo5x5, and then get the wins.
```
foreach($games_types as $type) {
if($type->playerStatSummaryType == 'RankedSolo5x5') {
$solo_wins = $type->wins;
break;
}
}
```
Anyway, better nerf Irelia ! | ```
$winsRankedSolo5x5 = NULL;
foreach($soloSummonerRanked as $rank) {
if($rank->playerStatSummaryType == 'RankedSolo5x5') {
$winsRankedSolo5x5 = $rank->wins;
break;
}
}
```
basically you cycle through each element of the array looking for the one whose stat type is `RankedSolo5x5` and, when you find it,... |
50,127,387 | I have a file with 10m lines, with each line like this:
```
{ "_id" : ObjectId("567f972cad55ac0797baa773"), "id" : 357103 }
```
For each line, I need to do something with its `"id"` value.
So far I have:
```
listings.each.with_index do |line, idx|
# listing_id = JSON.parse(line).fetch("id") #>> invalid JSON erro... | 2018/05/02 | [
"https://Stackoverflow.com/questions/50127387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695182/"
] | You can use the `\s(\d+)\s` regex, no JSON parsing is required.
```
line.match(/\s(\d+)\s/)[1] #=> "357103"
``` | You could just match using splicing:
```
line[/(?<= )\d+/] = 357103
``` |
50,127,387 | I have a file with 10m lines, with each line like this:
```
{ "_id" : ObjectId("567f972cad55ac0797baa773"), "id" : 357103 }
```
For each line, I need to do something with its `"id"` value.
So far I have:
```
listings.each.with_index do |line, idx|
# listing_id = JSON.parse(line).fetch("id") #>> invalid JSON erro... | 2018/05/02 | [
"https://Stackoverflow.com/questions/50127387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695182/"
] | Splitting is faster than Regex here. With such a large file, it might make a noticeable difference.
Also, it looks like you need to escape those double quotes: `line.split("\"id\" : ")`
```
> puts Benchmark.measure{line.split("\"id\" : ").last.delete('}').delete(' ')}
0.000000 0.000000 0.000000 ( 0.000020)
> ... | You can use the `\s(\d+)\s` regex, no JSON parsing is required.
```
line.match(/\s(\d+)\s/)[1] #=> "357103"
``` |
50,127,387 | I have a file with 10m lines, with each line like this:
```
{ "_id" : ObjectId("567f972cad55ac0797baa773"), "id" : 357103 }
```
For each line, I need to do something with its `"id"` value.
So far I have:
```
listings.each.with_index do |line, idx|
# listing_id = JSON.parse(line).fetch("id") #>> invalid JSON erro... | 2018/05/02 | [
"https://Stackoverflow.com/questions/50127387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695182/"
] | Are the ids made up of all numbers? You can try using a regex that looks for a colon then a list of numbers.
```
Line.match(/"id " : [0-9]+/)
```
Looks for Id followed by any length of integers.
If it has letters and numbers then:
```
Line.match(/"id" :[[:alnum:]]+/)
``` | You could just match using splicing:
```
line[/(?<= )\d+/] = 357103
``` |
50,127,387 | I have a file with 10m lines, with each line like this:
```
{ "_id" : ObjectId("567f972cad55ac0797baa773"), "id" : 357103 }
```
For each line, I need to do something with its `"id"` value.
So far I have:
```
listings.each.with_index do |line, idx|
# listing_id = JSON.parse(line).fetch("id") #>> invalid JSON erro... | 2018/05/02 | [
"https://Stackoverflow.com/questions/50127387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695182/"
] | Splitting is faster than Regex here. With such a large file, it might make a noticeable difference.
Also, it looks like you need to escape those double quotes: `line.split("\"id\" : ")`
```
> puts Benchmark.measure{line.split("\"id\" : ").last.delete('}').delete(' ')}
0.000000 0.000000 0.000000 ( 0.000020)
> ... | Are the ids made up of all numbers? You can try using a regex that looks for a colon then a list of numbers.
```
Line.match(/"id " : [0-9]+/)
```
Looks for Id followed by any length of integers.
If it has letters and numbers then:
```
Line.match(/"id" :[[:alnum:]]+/)
``` |
50,127,387 | I have a file with 10m lines, with each line like this:
```
{ "_id" : ObjectId("567f972cad55ac0797baa773"), "id" : 357103 }
```
For each line, I need to do something with its `"id"` value.
So far I have:
```
listings.each.with_index do |line, idx|
# listing_id = JSON.parse(line).fetch("id") #>> invalid JSON erro... | 2018/05/02 | [
"https://Stackoverflow.com/questions/50127387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695182/"
] | Splitting is faster than Regex here. With such a large file, it might make a noticeable difference.
Also, it looks like you need to escape those double quotes: `line.split("\"id\" : ")`
```
> puts Benchmark.measure{line.split("\"id\" : ").last.delete('}').delete(' ')}
0.000000 0.000000 0.000000 ( 0.000020)
> ... | You could just match using splicing:
```
line[/(?<= )\d+/] = 357103
``` |
25,481,412 | I would like to merge few files based on first column
```
File 1:
1
10
100
1000
1001
10013
10018
1002
File 2:
100 TRUE
1001 TRUE
1041 TRUE
1099 TRUE
1213 TRUE
1227 TRUE
In this case the output would be:
1
10
100 ... | 2014/08/25 | [
"https://Stackoverflow.com/questions/25481412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3188922/"
] | Do you know the linux "join" command:
```
$ join -a 1 f1 f2
1
10
100 TRUE
1000
1001 TRUE
10013
10018
1002
``` | Hey I think I managed to do it (with a messy awk command), in case someone needs it here is the line:
```
awk 'NR==FNR{a[$0]=$0;next}{a[$1]=$0}END{for (i in a) print a[i]}' file1 file2
```
Yeah happy me! |
34,279,946 | I am trying to declare an array of `Set<String>` so I do not have to manage each sets separately. But things go wrong:
```
ArrayList<Set<String>> categories=new LinkedHashSet<>();
```
Here, Java says that type `Set<String>` is erroneous and then reports an error.
If this is wrong, then how can I make an array... | 2015/12/15 | [
"https://Stackoverflow.com/questions/34279946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1042952/"
] | You are initialising an ArrayList with LinkedHashSet object and hence the error:
```
ArrayList<Set<String>> categories=new LinkedHashSet<>();
```
change it to
```
ArrayList<Set<String>> categories=new ArrayList<>();
```
you need to use HashSet when you create a Set to be added into the list. Something like th... | You can do something like:
```
List<HashSet> list =new ArrayList<HashSet>();
HashSet<String> hs =new HashSet<String>();
hs.add(value1);
hs.add(value2);
list.add(hs);
```
You can use for or while loop to add values to set(hs) and then add the set to list. |
60,486,057 | I'm new to using git and was wondering how do I remove all cached `.exe` files from a git repository (I want to keep them in my working folder). The root folder has subfolders that also have the `.exe` files.
Will the following command work or do I have to do something else? I understand the -r is for removing director... | 2020/03/02 | [
"https://Stackoverflow.com/questions/60486057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12498994/"
] | This should do it (in an `sh` compatible shell):
```
find . -name '*.exe' -exec git rm --cached '{}' \;
```
Alternatively, less elegant but easier to compose:
```
ls -R | grep '.exe$' | xargs git rm --cached
```
The trouble with your `git rm -r` command is that it will only recurse into directories whose name end... | Escape the wildcard so Git sees it rather than your shell:
```
git rm -n --cached \*.exe
```
(then rerun without the `-n` if you like what you see) |
38,822,794 | The requirement was to make a custom notification since the android's default notification only allows for an image. So I went through on how to attach a custom UI for notification when expanded, the ready answer was to create a custom view and pass to the notification manager and allowed from API level 16. So I did on... | 2016/08/08 | [
"https://Stackoverflow.com/questions/38822794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4162800/"
] | Remove the 'View' you are using as a shadow in your layout(or Replace View with TextView) and it works fine. XML used for Remoteview should make use of Views which has `@android.widget.RemoteViews.RemoteView` annotation. Since a plain View does not has this annotation, you cannot use that in your xml. | You cannot put an EditText into a RemoteViews. RemoteViews is limited to a handful of possible widgets, for a Notification, I doubt that the AdapterView options, like ListView, will work either.[have a look here](https://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout). Hope this will help you a... |
613,131 | I've looked through some Semtech reference board schematics and found one strange thing: they put SAW filters both before and after the LNA. For example here is part from a Semtech reference board electrical schematic ([1](https://www.semtech.com/products/wireless-rf/lora-core/sx1302cfdxxxgw1) and [2](https://www.semte... | 2022/03/23 | [
"https://electronics.stackexchange.com/questions/613131",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/301295/"
] | You are correct in that a SAW filter (any filter for that matter, or any device in the more general case) before the first LNA will have an adverse affect on the noise figure of your system. So in that regard you want the filter after the LNA.
But with the filter after the LNA, there's the possibility that the LNA wil... | The performance of the SAW filters just out of band is good, with -60 dB notches ([datasheet](https://www.mouser.co.uk/datasheet/2/842/tdkc_s_a0001072893_1-2295533.pdf)) but the performance falls off well out of band (-35 dB @ ~400 MHz, -28 dB @ ~2 GHz). A second SAW filter improves the wide-band filtering. Putting it ... |
8,759,472 | I'm having an issue with retrieving an xml portion of a message using a vendor's api. As an example of what works:
getDestination(void\* message , void\* destination, void\* size)
```
vendordestinationtype_t dest;
getDestination(msg_p, &dest, 16);
printf("Received message. (Destination: %s).\n", dest.dest);
```
prod... | 2012/01/06 | [
"https://Stackoverflow.com/questions/8759472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1134471/"
] | But you can do this:
```
public interface IVector<T, TScalar>
where T : IVector<T, TScalar>
{
void Add(ref T addend);
}
public struct Vector3f : IVector<Vector3f, float>
{
public void Add(ref Vector3f addend)
{
}
}
```
However, this means you've got mutable structs, which you shouldn't. To have... | Others have noted a difficulty with your interface, which is that there isn't any way to cleanly identify classes which can operate mutually with other items of their own class; this difficulty stems in some measure from the fact that such classes violate the Liskov Substitution Principle; if a class accepts two object... |
31,136,011 | I use this code for create folder for users:
```
work_path = '/tmp/'
os.umask(0000)
for i in user:
if not os.path.exists(work_path + i):
try:
os.makedirs(work_path + i, 0777)
```
When I set work\_path = '/tmp/' - my code work perfect.
But when I type for mistake work\_path = '/tmp' I got ... | 2015/06/30 | [
"https://Stackoverflow.com/questions/31136011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2772584/"
] | Use [os.path.join](https://docs.python.org/2/library/os.path.html#os.path.join):
>
> Join one or more path components intelligently. The return value is the concatenation of path and any members of \*paths with exactly one directory separator (os.sep) following each non-empty part except the last, meaning that the re... | You can use just the expression
```
work_path[-1] == '/'
```
If it is true you have a backslash |
13,315,731 | I have an html page that has a textarea form and when the user types into that textarea and presses submit, php writes the content of that textarea to a txt file.
When I insert something like this into the textarea
```
line1 what's up
line2
line3
```
it ends up writing to the txt file as so
```
line1 what\'s up
l... | 2012/11/09 | [
"https://Stackoverflow.com/questions/13315731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/412082/"
] | If you are retrieving the data from a textbox the data actually looks like
```
line1 what's up\r\n
line2\r\n
line3
```
so adding an extra `\n` on the end will add an additional line.
As for the `\'` this usually with happens with magic\_quotes enabled.
Doing a quick search for "magic\_quotes" in your `phpinfo()` wi... | You've got [magic\_quotes](http://php.net/magic_quotes) enabled. Disable that, and/or upgrade to a newer PHP. magic\_quotes are of the devil and far more evil. |
13,315,731 | I have an html page that has a textarea form and when the user types into that textarea and presses submit, php writes the content of that textarea to a txt file.
When I insert something like this into the textarea
```
line1 what's up
line2
line3
```
it ends up writing to the txt file as so
```
line1 what\'s up
l... | 2012/11/09 | [
"https://Stackoverflow.com/questions/13315731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/412082/"
] | The extra newlines are likely caused by a difference in line endings between what's writing the file and what is reading the file.
Perhaps you can just use `"\n"` to end your lines.
The extra escape sequence for the single quote is magic quotes.
Consider this code:
```
<?php
ini_set('magic_quotes_gpc', 'off');
$c... | You've got [magic\_quotes](http://php.net/magic_quotes) enabled. Disable that, and/or upgrade to a newer PHP. magic\_quotes are of the devil and far more evil. |
13,315,731 | I have an html page that has a textarea form and when the user types into that textarea and presses submit, php writes the content of that textarea to a txt file.
When I insert something like this into the textarea
```
line1 what's up
line2
line3
```
it ends up writing to the txt file as so
```
line1 what\'s up
l... | 2012/11/09 | [
"https://Stackoverflow.com/questions/13315731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/412082/"
] | The extra newlines are likely caused by a difference in line endings between what's writing the file and what is reading the file.
Perhaps you can just use `"\n"` to end your lines.
The extra escape sequence for the single quote is magic quotes.
Consider this code:
```
<?php
ini_set('magic_quotes_gpc', 'off');
$c... | If you are retrieving the data from a textbox the data actually looks like
```
line1 what's up\r\n
line2\r\n
line3
```
so adding an extra `\n` on the end will add an additional line.
As for the `\'` this usually with happens with magic\_quotes enabled.
Doing a quick search for "magic\_quotes" in your `phpinfo()` wi... |
72,710,497 | let a number=153
how we will split these 3 numbers n1,n2,n3
I have tried by-:
```
let n = 153
let n1 = n % 10;
let n2 = ((n - n1) / 10) % 10;
let n3 = ((n - n1)/10)/10;
```
I am getting n1 & n2 correct but cannot find n3
please answer it | 2022/06/22 | [
"https://Stackoverflow.com/questions/72710497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19388478/"
] | I fixed this way:
```
moment.utc(date).tz("America/Bogota", true).format();
``` | It seems as though `.format` may be converting the date into local time.
The results I get with various time zones in moment
[](https://i.stack.imgur.com/2kSgN.png)
The date you provided converted from UTC to my local time
[ / 10) % 10;
let n3 = ((n - n1)/10)/10;
```
I am getting n1 & n2 correct but cannot find n3
please answer it | 2022/06/22 | [
"https://Stackoverflow.com/questions/72710497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19388478/"
] | I fixed this way:
```
moment.utc(date).tz("America/Bogota", true).format();
``` | I'd suggest perhaps using the moment.tz constructor with a format string. This way, we'll parse the input date as a local time.
```js
const date = "2022-01-18T00:00:00.000Z";
console.log(moment.tz(date, "YYYY-MM-DD[T]HH:mm:sss.SSS", "America/Bogota").format());
```
```css
.as-console-wrapper { max-height: 100% !impo... |
1,093,317 | I'm looking for a way to check if a server is support xmpp protocol, i.e. xmpp-server is running on this domain.
Maybe special DNS check or something like that? | 2009/07/07 | [
"https://Stackoverflow.com/questions/1093317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75815/"
] | Most XMPP servers should support at least one of these DNS SRV records:
* **\_xmpp-server.\_tcp**.`example.com`
* **\_xmpp-client.\_tcp**.`example.com`
Some servers may not have these records published, but most of those will not want to talk to the outside world. As an example, you can use "dig" on the command line ... | You can try IMtrends: <http://www.process-one.net/en/imtrends/> |
1,093,317 | I'm looking for a way to check if a server is support xmpp protocol, i.e. xmpp-server is running on this domain.
Maybe special DNS check or something like that? | 2009/07/07 | [
"https://Stackoverflow.com/questions/1093317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75815/"
] | Following Joe's explanation, I personally would check SRV records and fall back to a quick (short timeout) connect check on port 5269. Then cache the result. | You can try IMtrends: <http://www.process-one.net/en/imtrends/> |
1,093,317 | I'm looking for a way to check if a server is support xmpp protocol, i.e. xmpp-server is running on this domain.
Maybe special DNS check or something like that? | 2009/07/07 | [
"https://Stackoverflow.com/questions/1093317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75815/"
] | Most XMPP servers should support at least one of these DNS SRV records:
* **\_xmpp-server.\_tcp**.`example.com`
* **\_xmpp-client.\_tcp**.`example.com`
Some servers may not have these records published, but most of those will not want to talk to the outside world. As an example, you can use "dig" on the command line ... | Following Joe's explanation, I personally would check SRV records and fall back to a quick (short timeout) connect check on port 5269. Then cache the result. |
9,114,336 | Does anyone know if there is an alternative to using attributes on C# properties to map to XML nodes when using XmlSerializer?
My issue is that I have an object called `Article`, with some properties (e.g. ID, Title, Body) and I do not want to add attributes directly to it (used elsewhere, etc, etc)...so I created a p... | 2012/02/02 | [
"https://Stackoverflow.com/questions/9114336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/519495/"
] | There's a [constructor of the XmlSerializer](http://msdn.microsoft.com/en-us/library/bfaxz1a0.aspx) class that allows you to pass a [XmlAttributeOverrides](http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattributeoverrides.aspx) and thus alter the behavior at runtime.
Quote from the documentation:
... | You could implement [IXmlSerializable](http://msdn.microsoft.com/en-us/library/system.xml.serialization.ixmlserializable.aspx) directly. It requires some more code, but you will have full control without the need for attributes. |
1,050,367 | This is a school-related question, although not exactly homework.
I'm taking an algorithms course, currently working on Chapter 15 of [Cormen's Introduction to Algorithms](https://rads.stackoverflow.com/amzn/click/com/0262032937) book. I've been successful at finding plenty of online examples of most of the algorithms... | 2009/06/26 | [
"https://Stackoverflow.com/questions/1050367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67009/"
] | I think you'll have better luck if you search for examples/visualizations of the technique rather than the specific problem... i.e. search for Dynamic Programming.
There may be some decent tutorials on TopCoder "[dynamic programming site:topcoder.com](http://www.google.com/search?hl=en&rls=en&q=dynamic+programming+sit... | If you want the solution, I wrote one for practice. This is an example of dynamic programming. It means that your solution refrains from repetitive calculations. If a problem could be divided into subunits, and those subunits get repeated in some scenarios, then it is unnecessary to solve them more than once. In such c... |
5,378 | Quando eu digo por exemplo "Criar uma nova loja", o `nova` é considerado redundante?
Se eu estou a criar alguma coisa possivelmente será uma coisa nova, mas "Criar uma loja" parece que falta alguma coisa.
[](https://i.stack.imgur.com/4nhXW.png) | 2018/06/17 | [
"https://portuguese.stackexchange.com/questions/5378",
"https://portuguese.stackexchange.com",
"https://portuguese.stackexchange.com/users/3006/"
] | Ser ou não redundância frequentemente depende do contexto: até o famigerado "subir para cima" deixa de ser redundante num contexto em que "cima" significa um lugar específico (como um dado cômodo no andar de cima, ou um dado apartamento num prédio). Além disso, as pessoas têm diferentes níveis de tolerância a construçõ... | Não acho que seja redundante. Na verdade, vejo uma diferença semântica entre "criar uma loja" e "criar uma nova loja".
* "vamos criar uma loja" significa que ainda não criamos loja alguma, seja lá qual for o significado de loja no contexto; estabelecimento comercial, templo maçônico, etc. Vamos criar uma loja, não um ... |
1,044,977 | can someone please tell me what i need so that i can see the explorer view for a library in sharepoint? it works on one machine and not another. it sometimes works on a vista client but not xp. it works in internet explorer but does not work on another machine with the same settings.
please help. wss 3.0 on windows se... | 2009/06/25 | [
"https://Stackoverflow.com/questions/1044977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It requires WebDav to be enabled on the server part, and WebClient to be running at the client. WebClient is just a service, see [this technet entry](http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/844f5e01-4b9e-4dac-897e-2a0bb33f28af.mspx?mfr=true) for specific information on how to start it... | Make sure you have a site collection located at your web application root. This solved the problem in my case.
Problem : explorer view not working properly, except when :
* explorer view selected in a subfolder of the document library
* a network favorite pointing to the document library was created |
1,044,977 | can someone please tell me what i need so that i can see the explorer view for a library in sharepoint? it works on one machine and not another. it sometimes works on a vista client but not xp. it works in internet explorer but does not work on another machine with the same settings.
please help. wss 3.0 on windows se... | 2009/06/25 | [
"https://Stackoverflow.com/questions/1044977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It requires WebDav to be enabled on the server part, and WebClient to be running at the client. WebClient is just a service, see [this technet entry](http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/844f5e01-4b9e-4dac-897e-2a0bb33f28af.mspx?mfr=true) for specific information on how to start it... | I was trying to do a quick backup of a bunch of files, and the explorer view was not working. What finally worked was mapping a network drive to the sharepoint server, and then I was able to bulk copy and paste the folders/files to my backup server.
I don't know why MS makes so many things really difficult. But they ... |
1,044,977 | can someone please tell me what i need so that i can see the explorer view for a library in sharepoint? it works on one machine and not another. it sometimes works on a vista client but not xp. it works in internet explorer but does not work on another machine with the same settings.
please help. wss 3.0 on windows se... | 2009/06/25 | [
"https://Stackoverflow.com/questions/1044977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | SharePoint explorer view actually doesn't work in IE8 on Windows XP SP3. The issue only occurs if your using SSL, and I've not seen a good solution to make this work. Interestingly, it works fine in IE7. Now if your using any other web browser besides IE, there is no way to get explorer view to work currently.
Also, t... | Make sure you have a site collection located at your web application root. This solved the problem in my case.
Problem : explorer view not working properly, except when :
* explorer view selected in a subfolder of the document library
* a network favorite pointing to the document library was created |
1,044,977 | can someone please tell me what i need so that i can see the explorer view for a library in sharepoint? it works on one machine and not another. it sometimes works on a vista client but not xp. it works in internet explorer but does not work on another machine with the same settings.
please help. wss 3.0 on windows se... | 2009/06/25 | [
"https://Stackoverflow.com/questions/1044977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | SharePoint explorer view actually doesn't work in IE8 on Windows XP SP3. The issue only occurs if your using SSL, and I've not seen a good solution to make this work. Interestingly, it works fine in IE7. Now if your using any other web browser besides IE, there is no way to get explorer view to work currently.
Also, t... | I was trying to do a quick backup of a bunch of files, and the explorer view was not working. What finally worked was mapping a network drive to the sharepoint server, and then I was able to bulk copy and paste the folders/files to my backup server.
I don't know why MS makes so many things really difficult. But they ... |
57,078,086 | After reading some article from [here](https://learn.microsoft.com/en-us/azure/managed-applications/key-vault-access) and [here](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-keyvault-parameter) and [here](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-li... | 2019/07/17 | [
"https://Stackoverflow.com/questions/57078086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2107488/"
] | I think it's because your set you `ID` as a **String** instead of an **Integer**
```
{
events: [1, 2],
name: "My name"
}
```
And here `1` and `2` are the `IDs` of events you want to add. | Late reply. Hoping this might help someone!
Right now I am using Strapi v4.3.2 and was facing the same issue. I overcame this by overriding the default core controller for **create** as explained in [official docs](https://docs.strapi.io/developer-docs/latest/development/backend-customization/controllers.html#extendin... |
57,078,086 | After reading some article from [here](https://learn.microsoft.com/en-us/azure/managed-applications/key-vault-access) and [here](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-keyvault-parameter) and [here](https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-li... | 2019/07/17 | [
"https://Stackoverflow.com/questions/57078086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2107488/"
] | I think it's because your set you `ID` as a **String** instead of an **Integer**
```
{
events: [1, 2],
name: "My name"
}
```
And here `1` and `2` are the `IDs` of events you want to add. | This is (still? again?) a bug in Strapi, see: <https://github.com/strapi/strapi/issues/12238>
As a workaround you need to add the find-permission to the user / role who is performing the request for the related content type (you want to check first if this is a security issue for your scenario or not - alternatively yo... |
166,037 | I'm trying to include .eps figures in my .tex file (I'm using MiKTeX 2.9).
I need to include graphics in this particular way:
```
\usepackage{graphics} % or graphicx
...
\begin{figure}
\caption{\label{tha_label} ....}
\includegraphics{the_graphics.eps}
\end{figure}
```
But that way doesn't work, because it prod... | 2014/03/17 | [
"https://tex.stackexchange.com/questions/166037",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/48115/"
] | Have a look at the following example:
```
\documentclass{article}
\newcounter{testcount}
\newcommand{\modifyme}{%
\addtocounter{testcount}{1}
\ifnum\thetestcount<3%
Hello
\fi
\ifnum\thetestcount>2%
World
\fi
}
\newcommand{\resetme}{\setcounter{testcount}{0}}
\begin{document}
\modifyme
\modifyme
\modify... | I love using counters! Here only the expansion after the number specified in `\changedefinitionafter` is modified.
```
\documentclass{article}
\pagestyle{empty}% for cropping
\makeatletter
\newcount\count@foo
\newcount\nth@foo
\newcommand\changedefinitionafter[4]{
% #1: name of macro
% #2: exceptional occurenc... |
166,037 | I'm trying to include .eps figures in my .tex file (I'm using MiKTeX 2.9).
I need to include graphics in this particular way:
```
\usepackage{graphics} % or graphicx
...
\begin{figure}
\caption{\label{tha_label} ....}
\includegraphics{the_graphics.eps}
\end{figure}
```
But that way doesn't work, because it prod... | 2014/03/17 | [
"https://tex.stackexchange.com/questions/166037",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/48115/"
] | Have a look at the following example:
```
\documentclass{article}
\newcounter{testcount}
\newcommand{\modifyme}{%
\addtocounter{testcount}{1}
\ifnum\thetestcount<3%
Hello
\fi
\ifnum\thetestcount>2%
World
\fi
}
\newcommand{\resetme}{\setcounter{testcount}{0}}
\begin{document}
\modifyme
\modifyme
\modify... | No counter, but three macros for each command of this type:
```
\documentclass{article}
\makeatletter
\newcommand{\newchangingcommand}[4]{%
% #1 = macro name
% #2 = steps
% #3 = value until step #1
% #4 = value from step #1
\@namedef{\string#1@counter}{0}%
\@namedef{\string#1@limit}{#2}%
\def#1{%
%... |
3,984,961 | * The matrix is $n\times n$
* The nth row is $[n^1,n^2,n^3....n^n]$
---
I tried the first few examples:
$\begin{pmatrix}1\end{pmatrix}$ ,$\begin{pmatrix}1 & 1\\ 2 & 4\end{pmatrix}$,$\begin{pmatrix}1 & 1 & 1\\ 2 & 4 & 8\\3 & 9 & 27\end{pmatrix}$. They are obviously invertible.
But afterwards I got confused. Do I try ... | 2021/01/14 | [
"https://math.stackexchange.com/questions/3984961",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/536520/"
] | This matrix is related to the Vandermonde's matrix. It is always invertible because the determinant is always non-zero.
There's an easy procedure to compute the determinant of the Vandermonde matrix.
When calculating the determinant of your matrix, pull out a common multiplier $k$ from each row (where $k$ is the row ... | Given $1,...,n$, all of the polynomials of degree $n$ that has this numbers as roots are:
$p(x)=k(x-1)(x-2)...(x-n)=k(\tilde{a}\_0+\tilde{a}\_1x+...+\tilde{a}\_{n-1}x^{n-1}+\tilde{a}\_n x^n), k\neq 0$
So we are saying that the linear system
$$\begin{cases} a\_0+ja\_1+j^2a\_2+...+j^na\_n=0\end{cases} \forall j\in \{1,... |
17,850,443 | i want to change the rows to cloms based on the quarter.
**My sample table is as below**
```
Student name subject standard marks quarter
Harry Maths class1 19 q1
Harry Maths class1 19 q2
Harry Maths class1 19 q3
Harry Maths class1 19 q4
Harry science class1 18 q1
Harry science c... | 2013/07/25 | [
"https://Stackoverflow.com/questions/17850443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2617315/"
] | ScrewDefaultButtons creates a wrapper HTML element around the actual `input` element. Therefore, you can't rely on `this` being the neccessary `input` element when using it inside the `click` event handler. Instead, you'll have to find the `input` element first. You can accomplish this by doing something like this:
``... | Try replacing `$( '.todo-checkbox' ).click( function () {` with `$(document).on("click", '.todo-checkbox', function {` (assuming you have jQuery 1.7+):
```
$(document).on('click', '.todo-checkbox', function {
var confirmed = confirm( ctdl.CONFIRMATION_CHECK );
if ( confirmed == false ) return false;
... |
86,167 | Do people who sing with lots of power have a smaller vocal range? I have heard that if one sings with power, eg like an opera singer, you will get a smakler range. I feel that the more power I use the harder it is to sing higher.
Is there anything ti this? | 2019/06/24 | [
"https://music.stackexchange.com/questions/86167",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/-1/"
] | This question is confusing me. Who among us thinks Whitney Houston or Mariah Carey or Luciano Pavarotti lacks power or extended range in their voices. There are certainly singers with power, but limited range, but I know of no evidence linking one with the other. With study, voices can be developed, power developed and... | No they don't. This is a bizarre claim, and if the person who made it has evidence - let's hear it! |
86,167 | Do people who sing with lots of power have a smaller vocal range? I have heard that if one sings with power, eg like an opera singer, you will get a smakler range. I feel that the more power I use the harder it is to sing higher.
Is there anything ti this? | 2019/06/24 | [
"https://music.stackexchange.com/questions/86167",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/-1/"
] | It's always hard to define such words as "power"... But if you mean with it, that they can sing stronger, louder tones, I would say definitely that the range isn't affected by the fact with how much 'power' you sing.
If you sing louder, with much pressure, you may be running out of breath sooner, because you use more ... | No they don't. This is a bizarre claim, and if the person who made it has evidence - let's hear it! |
86,167 | Do people who sing with lots of power have a smaller vocal range? I have heard that if one sings with power, eg like an opera singer, you will get a smakler range. I feel that the more power I use the harder it is to sing higher.
Is there anything ti this? | 2019/06/24 | [
"https://music.stackexchange.com/questions/86167",
"https://music.stackexchange.com",
"https://music.stackexchange.com/users/-1/"
] | Based on my listening experience as well as first-hand singing, I would say there's no correlation between "limited range" and "power".
On the contrary, it's common for some singers to need to appeal to increased air pressure to reach the upper end of their vocal range (think of songs you can remember in which the si... | No they don't. This is a bizarre claim, and if the person who made it has evidence - let's hear it! |
17,265,644 | IS it possible to show certain content with css based on the width of the parent div? I was thinking something along the lines of media queries but I don't want the whole device width just the width of the parent div.
I can do it with jQuery [see fiddle](http://jsfiddle.net/aaronk85/dFB2s/) (change the < to > to see d... | 2013/06/23 | [
"https://Stackoverflow.com/questions/17265644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/737114/"
] | Your `.width` will never accept IF, because you set `width` in css to `200px`
If you want to see it dynamic you shoud:
* Replace `width` to `max-width` in CSS
* Add `.resize` event
**code**:
```
$(window).resize(function () {
var w = $('#parent').width();
console.log('width: ', w);
if (w < 200) {
... | This what do you want? [DEMO](http://jsfiddle.net/dFB2s/2/). **This is a solution using only CSS.**
If you set the `width` literally, you won't able to leave to browser adjust the size automatically.
I changed a bit the markup with the object to make the example more easy:
```
<div class="parent">
<div class="ch... |
4,293,583 | I am not a php guy, so I have a small question for all the php devs out there.
I am building a java application which calls a php webservice. The php web service has a login method which takes user\_auth and application\_name as parameters. user\_auth is an array which has three strings username, password and version... | 2010/11/27 | [
"https://Stackoverflow.com/questions/4293583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420556/"
] | You can any of these formats
```
$user = array('user_auth' =>
array('username' => 'will'),
array('password' => '18218139eec55d83cf82679934e5cd75'),
array('version' => '1.0'),
);
var_dump(serialize($user)); // use unserialize to decode
var_dump(json_encode($user)); // use json_decode to decode
```
You an... | This looks like JSON (passing PHP arrays in a URL would not make much sense), but you need to use double quotes (`"`) instead of single quotes (`'`), using your second example. |
33,852,514 | I have a function named `record_list()` which helps me echo fetched query from database every time I refresh/visit a page. I tried to use this function by echoing it twice but unfortunately all my DOM elements after the script get hidden and I can't use the following divisions/lists in my HTML. But if I call it once it... | 2015/11/22 | [
"https://Stackoverflow.com/questions/33852514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3254749/"
] | This is because you have to use `include("configuration.php");` not `include_once("configuration.php");` If you `include_once`, it will only work when the first instance of this configuration file is included in the script somewhere.
I would suggest making a class to wrap your connection saving it to a singleton state... | This happens because you close connection with `$mysqli->close();` every time function is executed but, as @Rasclatt suggested, you open connection only once with `include_once` directive. You may replace `include_once` with include or try @Rasclatt OOP approach but if you don't want to dive into OOP for some reason I ... |
53,806,479 | I have a seemingly simple problem for which I am struggling to find a solution. I have a list of ~3,000 tweet ID's for which I wish to get the number of retweets, likes and the number of followers of the user.
To do this I have written the following code:
```
def chunks(l, n):
# For item i in a range that is a le... | 2018/12/16 | [
"https://Stackoverflow.com/questions/53806479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8776518/"
] | The [tweepy API](http://docs.tweepy.org/en/v3.5.0/api.html#tweepy-api-twitter-api-wrapper) has a `wait_on_rate_limit` parameter which is set to `False` by default.
Another example for handling rate limit using cursors is provided in the [tweepy docs](http://docs.tweepy.org/en/v3.5.0/api.html#tweepy-api-twitter-api-wra... | ```
def chunks(l, n):
# For item i in a range that is a length of l,
for i in range(0, len(l), n):
# Create an index range for l of n items:
yield l[i:i+n]
tweets = []
id = list(chunks(listOfTwitterIDs, 100))
for each in id:
# try to get get # of retweets
try:
tweets.append(api.... |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | They are calculated by `print.boot` and not stored in the `boot` object. Look at `getAnywhere(print.boot)` for the details.
You can either calculate these values yourself or use `capture.output`.
For your example:
```
#original:
output$t0
#bias:
mean(output$t)-output$t0
#se:
sd(output$t)
``` | Extracting se using `capture.output`
```
library(stringr)
x <- capture.output(output) # store the output as text
x <- str_extract(x ,"^t1.*$") # grab the line that starts with t1
x <- x[!is.na(x)] # remove all the lines we don't need
se <- as.numeric(unlist(str_extract_all(x, '[0-9.]+$'))) # extract the final value (... |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | They are calculated by `print.boot` and not stored in the `boot` object. Look at `getAnywhere(print.boot)` for the details.
You can either calculate these values yourself or use `capture.output`.
For your example:
```
#original:
output$t0
#bias:
mean(output$t)-output$t0
#se:
sd(output$t)
``` | You can extract the standard errors by using summary:
```
se <- summary(output)$bootSE
``` |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | They are calculated by `print.boot` and not stored in the `boot` object. Look at `getAnywhere(print.boot)` for the details.
You can either calculate these values yourself or use `capture.output`.
For your example:
```
#original:
output$t0
#bias:
mean(output$t)-output$t0
#se:
sd(output$t)
``` | This command seems to work:
```
apply(output$t,2,sd)[1]
``` |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | They are calculated by `print.boot` and not stored in the `boot` object. Look at `getAnywhere(print.boot)` for the details.
You can either calculate these values yourself or use `capture.output`.
For your example:
```
#original:
output$t0
#bias:
mean(output$t)-output$t0
#se:
sd(output$t)
``` | ```
output_tab <- t(rbind(
# this grabs the original coefficients
output$t0,
# bootstrapped coefficients' standard errors
apply(output$t, 2, function(x) sd(x, ra.rm = TRUE))
))
output_tab
# [,1] [,2]
#[1,] 22.53281 0.4106622
``` |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | You can extract the standard errors by using summary:
```
se <- summary(output)$bootSE
``` | Extracting se using `capture.output`
```
library(stringr)
x <- capture.output(output) # store the output as text
x <- str_extract(x ,"^t1.*$") # grab the line that starts with t1
x <- x[!is.na(x)] # remove all the lines we don't need
se <- as.numeric(unlist(str_extract_all(x, '[0-9.]+$'))) # extract the final value (... |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | This command seems to work:
```
apply(output$t,2,sd)[1]
``` | Extracting se using `capture.output`
```
library(stringr)
x <- capture.output(output) # store the output as text
x <- str_extract(x ,"^t1.*$") # grab the line that starts with t1
x <- x[!is.na(x)] # remove all the lines we don't need
se <- as.numeric(unlist(str_extract_all(x, '[0-9.]+$'))) # extract the final value (... |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | ```
output_tab <- t(rbind(
# this grabs the original coefficients
output$t0,
# bootstrapped coefficients' standard errors
apply(output$t, 2, function(x) sd(x, ra.rm = TRUE))
))
output_tab
# [,1] [,2]
#[1,] 22.53281 0.4106622
``` | Extracting se using `capture.output`
```
library(stringr)
x <- capture.output(output) # store the output as text
x <- str_extract(x ,"^t1.*$") # grab the line that starts with t1
x <- x[!is.na(x)] # remove all the lines we don't need
se <- as.numeric(unlist(str_extract_all(x, '[0-9.]+$'))) # extract the final value (... |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | This command seems to work:
```
apply(output$t,2,sd)[1]
``` | You can extract the standard errors by using summary:
```
se <- summary(output)$bootSE
``` |
19,963,512 | Consider the following bootstrap:
```
library(MASS)
library(boot)
# c)
set.seed(1)
boot.fn= function(data, index) mean(data[index])
output=boot(Boston$medv, boot.fn, 1000)
```
If we run `print(output)`, we get
```
Call:
boot(data = Boston$medv, statistic = boot.fn, R = 1000)
Bootstrap Statistics :
original ... | 2013/11/13 | [
"https://Stackoverflow.com/questions/19963512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391161/"
] | This command seems to work:
```
apply(output$t,2,sd)[1]
``` | ```
output_tab <- t(rbind(
# this grabs the original coefficients
output$t0,
# bootstrapped coefficients' standard errors
apply(output$t, 2, function(x) sd(x, ra.rm = TRUE))
))
output_tab
# [,1] [,2]
#[1,] 22.53281 0.4106622
``` |
22,881,370 | For this test:
```
describe "can translate" do
let(:from){592}
it @from do
expect(Translator.three_digits(from)).to eq 'five hundred ninety two'
end
end
```
I need to refer to `from` as `@from` when using it in the `it` statement but as just `from` when using it in the `expect` test. In each case trying t... | 2014/04/05 | [
"https://Stackoverflow.com/questions/22881370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631619/"
] | Why not simply use [DoubleStream#summaryStatistics](http://docs.oracle.com/javase/8/docs/api/java/util/stream/DoubleStream.html#summaryStatistics--) or apply a similar pattern?
You could even extend the class to add custom methods, say a variance, skewness and kurtosis for example:
```
/**
* Algorithms derived from:... | Replace the *String* parameter of the method *statistic* with a *function type*, that takes a *DoubleStream* and returns the aggregate.
```
private static double statistic(List<Double> numbers,
ToDoubleFunction<DoubleStream> function) {
return function.applyAsDouble(
numbers... |
2,875,783 | Does the following series coverge or diverge?
$$\sum\_{n=2}^{\infty} \frac{1}{(\log n)^{\log\log n}}$$
My attempts : I know that $\log(\log n) > 2$
So $\displaystyle\sum\_{n=2}^{\infty}\frac{1}{(\log n)^{\log\log n}}\le\sum\_{n=2}^{\infty} \frac{1}{(\log n)^{2}}\le\sum\frac{1}{n^2}$
so the given series converges.
... | 2018/08/08 | [
"https://math.stackexchange.com/questions/2875783",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/557708/"
] | It's incorrect. We don't have $\log n \ge n$.
Instead, $(\log n)^{\log \log n} = \exp((\log \log n)^2) \le \exp(((\log n)^{1/2})^2) = n$ for $n \ge N\_0$, so $$\sum\_{n=2}^\infty \frac 1 {(\log n)^{\log \log n}} \ge C + \sum\_{n=N\_0}^\infty \frac 1 n = \infty$$
---
Implicit result used: $\log x \le x^\varepsilon$ f... | The series is divergent. Note that $a\_n= \frac{1}{(\log n)^{\log\log n}}=\exp(-(\log\log n)^2)$ is positive and decreasing and, by [Cauchy condensation test](https://en.wikipedia.org/wiki/Cauchy_condensation_test), the convergence of the given series is equivalent to the convergence of
$$\sum\_{n=2}^\infty 2^n\exp(-(\... |
61,786,584 | New to coding.
How do I remove the redundant color box next to the highlighted(colored) item in VSCode?
I like to keep 'Colorize' and remove the unknown and redundant extension.
Here are the extensions I have installed.
[Enabled Extensions Screenshot](https://i.stack.imgur.com/noySV.png)
Here is the issue screenshot... | 2020/05/13 | [
"https://Stackoverflow.com/questions/61786584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7633606/"
] | Add this lines in your settings.json by pressing ctrl+shift+p and pressing Open Settings (JSON)
```
"css.colorDecorators.enable": false,
"scss.colorDecorators.enable": false,
"less.colorDecorators.enable": false,
``` | As of VS Code v1.49 (August 2020), this is the setting:
```
"editor.colorDecorators": false
``` |
21,551,937 | An annoying problem many chemists are faced with is to convert CAS registry numbers of chemical compounds (stored in some commercial database that is not readily accessible) to Pubchem identifiers (openly available). Pubchem kind of supports conversion between the two, but only through their manual web interface, and n... | 2014/02/04 | [
"https://Stackoverflow.com/questions/21551937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1887645/"
] | This how the Ruby code does it, translated to R, uses `RCurl` and `XML`:
```
> xmlresponse = xmlParse( getURL("http://www.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=pccompound&retmax=100&term=64318-79-2") )
```
and here's how to extract the Id nodes:
```
> sapply(xpathSApply(xmlresponse, "//Id"), function(n){xm... | I think you should still be able to convert CAS numbers to PubChem ID's using the PUG where instead of the name of the compound you enter the CAS number. Of course this might not be as specific if the CAS numbers overlap. I haven't tested it.
An example with aspirin
<https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/... |
58,937,442 | I'm trying to receive push notification with data payload when app is in background/closed. But when parsing intent from onCreate/onNewIntent there are no extras data received.
Push request body is following:
```
{
"data": {
"body": "here is body",
"title": "Title",
"type": "LOGIN",
"intercomMessage":... | 2019/11/19 | [
"https://Stackoverflow.com/questions/58937442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1778879/"
] | Already found, what causes that: this conbination of flags in receiving activity.
```
android:configChanges="orientation"
android:hardwareAccelerated="false"
android:clearTaskOnLaunch="true"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true"
... | Just try the following JSON
```
{
"data": {
"body": "here is body",
"title": "Title",
"type": "LOGIN",
"intercomMessage": "test"
},
"to": "#push_token",
"priority": "high",
}
```
`notification` tag is not required |
58,937,442 | I'm trying to receive push notification with data payload when app is in background/closed. But when parsing intent from onCreate/onNewIntent there are no extras data received.
Push request body is following:
```
{
"data": {
"body": "here is body",
"title": "Title",
"type": "LOGIN",
"intercomMessage":... | 2019/11/19 | [
"https://Stackoverflow.com/questions/58937442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1778879/"
] | * Messages with both notification and data payload, when received in the background. In this case, the notification is delivered to the device’s system tray, and the data payload is delivered in the extras of the intent of your launcher Activity.
* You should use data payload to received data in onMessageReceived() and... | Just try the following JSON
```
{
"data": {
"body": "here is body",
"title": "Title",
"type": "LOGIN",
"intercomMessage": "test"
},
"to": "#push_token",
"priority": "high",
}
```
`notification` tag is not required |
58,937,442 | I'm trying to receive push notification with data payload when app is in background/closed. But when parsing intent from onCreate/onNewIntent there are no extras data received.
Push request body is following:
```
{
"data": {
"body": "here is body",
"title": "Title",
"type": "LOGIN",
"intercomMessage":... | 2019/11/19 | [
"https://Stackoverflow.com/questions/58937442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1778879/"
] | Already found, what causes that: this conbination of flags in receiving activity.
```
android:configChanges="orientation"
android:hardwareAccelerated="false"
android:clearTaskOnLaunch="true"
android:launchMode="singleTask"
android:alwaysRetainTaskState="true"
... | You need to add the notification code within your MyFirebaseMessagingService class which u will create which will be extended from FirebaseMessagingService |
58,937,442 | I'm trying to receive push notification with data payload when app is in background/closed. But when parsing intent from onCreate/onNewIntent there are no extras data received.
Push request body is following:
```
{
"data": {
"body": "here is body",
"title": "Title",
"type": "LOGIN",
"intercomMessage":... | 2019/11/19 | [
"https://Stackoverflow.com/questions/58937442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1778879/"
] | * Messages with both notification and data payload, when received in the background. In this case, the notification is delivered to the device’s system tray, and the data payload is delivered in the extras of the intent of your launcher Activity.
* You should use data payload to received data in onMessageReceived() and... | You need to add the notification code within your MyFirebaseMessagingService class which u will create which will be extended from FirebaseMessagingService |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | You should use following cmd to detect **Ubuntu** release name:
```
export UBUNTU_RELEASE=$(lsb_release -sc || cat /etc/*-release|grep -oP 'CODENAME=\K\w+$'|head -1)
```
For Ubuntu docker images I am using following cmds when I need to add multiverse to apt.source.lists and haven't duplicate lines:
```
RUN export... | If you don't want to do any action on the image you mat try to figure out winch os it base on the firsts layers .
for finding the layers just type
```
docker inspect <image name>
```
then see the layer section.
then you can make a list of each layer belong to which base image |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | The Filesystem Hierarchy Standard has a [standard definition for `/etc/os-release`](https://www.freedesktop.org/software/systemd/man/os-release.html), which should be available on most distributions:
>
> The /etc/os-release and /usr/lib/os-release files contain operating system identification data.
>
>
> The basic ... | You could use /etc/issue file for Debian/Ubuntu:
```
root@ubuntu_container:/# cat /etc/issue
Ubuntu 14.04.3 LTS \n \l
```
or /etc/redhat-release for CentOS/Red Hat/Fedora:
```
[root@fedora_container /]# cat /etc/redhat-release
Fedora release 23 (Twenty Three)
[root@centos_container /]# cat /etc/redhat-release
Ce... |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | The Filesystem Hierarchy Standard has a [standard definition for `/etc/os-release`](https://www.freedesktop.org/software/systemd/man/os-release.html), which should be available on most distributions:
>
> The /etc/os-release and /usr/lib/os-release files contain operating system identification data.
>
>
> The basic ... | Most answers give us OS release, but the question is also concern docker.
I'm lazy, especially when I have more than 20 images, so:
`docker image ls | perl -lane 'print "docker run --rm $F[0]:$F[1] cat /etc/os-release" unless /REPOSITORY/' | sh | grep PRETTY`
And most images have results:
```
> PRETTY_NAME="Ubuntu ... |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | Expanding on [@morxa's answer and comment](https://stackoverflow.com/a/35690567/325418), some `sh` doesn't have `source` defined. In such case we can use
```
grep NAME /etc/*-release
```
to be able to see what the OS is. Usually the `PRETTY_NAME` can tell the whole name:
```
PRETTY_NAME="Ubuntu 20.04 LTS"
``` | You should use following cmd to detect **Ubuntu** release name:
```
export UBUNTU_RELEASE=$(lsb_release -sc || cat /etc/*-release|grep -oP 'CODENAME=\K\w+$'|head -1)
```
For Ubuntu docker images I am using following cmds when I need to add multiverse to apt.source.lists and haven't duplicate lines:
```
RUN export... |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | Most answers give us OS release, but the question is also concern docker.
I'm lazy, especially when I have more than 20 images, so:
`docker image ls | perl -lane 'print "docker run --rm $F[0]:$F[1] cat /etc/os-release" unless /REPOSITORY/' | sh | grep PRETTY`
And most images have results:
```
> PRETTY_NAME="Ubuntu ... | If you don't want to do any action on the image you mat try to figure out winch os it base on the firsts layers .
for finding the layers just type
```
docker inspect <image name>
```
then see the layer section.
then you can make a list of each layer belong to which base image |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | The Filesystem Hierarchy Standard has a [standard definition for `/etc/os-release`](https://www.freedesktop.org/software/systemd/man/os-release.html), which should be available on most distributions:
>
> The /etc/os-release and /usr/lib/os-release files contain operating system identification data.
>
>
> The basic ... | You should use following cmd to detect **Ubuntu** release name:
```
export UBUNTU_RELEASE=$(lsb_release -sc || cat /etc/*-release|grep -oP 'CODENAME=\K\w+$'|head -1)
```
For Ubuntu docker images I am using following cmds when I need to add multiverse to apt.source.lists and haven't duplicate lines:
```
RUN export... |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | You could use /etc/issue file for Debian/Ubuntu:
```
root@ubuntu_container:/# cat /etc/issue
Ubuntu 14.04.3 LTS \n \l
```
or /etc/redhat-release for CentOS/Red Hat/Fedora:
```
[root@fedora_container /]# cat /etc/redhat-release
Fedora release 23 (Twenty Three)
[root@centos_container /]# cat /etc/redhat-release
Ce... | If you don't want to do any action on the image you mat try to figure out winch os it base on the firsts layers .
for finding the layers just type
```
docker inspect <image name>
```
then see the layer section.
then you can make a list of each layer belong to which base image |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | Expanding on [@morxa's answer and comment](https://stackoverflow.com/a/35690567/325418), some `sh` doesn't have `source` defined. In such case we can use
```
grep NAME /etc/*-release
```
to be able to see what the OS is. Usually the `PRETTY_NAME` can tell the whole name:
```
PRETTY_NAME="Ubuntu 20.04 LTS"
``` | If you don't want to do any action on the image you mat try to figure out winch os it base on the firsts layers .
for finding the layers just type
```
docker inspect <image name>
```
then see the layer section.
then you can make a list of each layer belong to which base image |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | The Filesystem Hierarchy Standard has a [standard definition for `/etc/os-release`](https://www.freedesktop.org/software/systemd/man/os-release.html), which should be available on most distributions:
>
> The /etc/os-release and /usr/lib/os-release files contain operating system identification data.
>
>
> The basic ... | If you don't want to do any action on the image you mat try to figure out winch os it base on the firsts layers .
for finding the layers just type
```
docker inspect <image name>
```
then see the layer section.
then you can make a list of each layer belong to which base image |
35,689,453 | I am creating SQL Server database (not server) project for our existing database using VS2015 and SSDT (the latest version I think). I ran into a compile error saying :
>
> Error SQL71501: User: [xxxxx] has an unresolved reference to Login
> [xxxxxx].
>
>
>
I came across [this](https://social.msdn.microsoft.com/... | 2016/02/28 | [
"https://Stackoverflow.com/questions/35689453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216975/"
] | You could use /etc/issue file for Debian/Ubuntu:
```
root@ubuntu_container:/# cat /etc/issue
Ubuntu 14.04.3 LTS \n \l
```
or /etc/redhat-release for CentOS/Red Hat/Fedora:
```
[root@fedora_container /]# cat /etc/redhat-release
Fedora release 23 (Twenty Three)
[root@centos_container /]# cat /etc/redhat-release
Ce... | You should use following cmd to detect **Ubuntu** release name:
```
export UBUNTU_RELEASE=$(lsb_release -sc || cat /etc/*-release|grep -oP 'CODENAME=\K\w+$'|head -1)
```
For Ubuntu docker images I am using following cmds when I need to add multiverse to apt.source.lists and haven't duplicate lines:
```
RUN export... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.