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 |
|---|---|---|---|---|---|
2,015 | So this question... <https://serverfault.com/questions/45734/the-coolest-server-names>
It's horribly off topic. It's got a few votes to delete it right now because the community does not want it here (it's already been deleted once by the community).
I understand that it's being kept around for its historical signifi... | 2011/09/04 | [
"https://meta.serverfault.com/questions/2015",
"https://meta.serverfault.com",
"https://meta.serverfault.com/users/33118/"
] | Hear ye, hear ye, hear ye,
--------------------------
Three days have passed. Since then:
* 30% of our >10K users have voted to delete that question, independent of the vote going on here.
* 22 upvotes for sun-based disposal
* 4 upvotes for 'send it back from whence it came'
* Showers of hate upon 'Leave it'.
Based ... | I've certainly done my bit to try and get rid of that question, as well as similar ones, but the system is against us. If Jeff brought it back from the dead I'd love to hear his reasoning for doing so. The only reasoning I can think of is that it brings traffic due to Google and traffic translates to revenue and revenu... |
2,015 | So this question... <https://serverfault.com/questions/45734/the-coolest-server-names>
It's horribly off topic. It's got a few votes to delete it right now because the community does not want it here (it's already been deleted once by the community).
I understand that it's being kept around for its historical signifi... | 2011/09/04 | [
"https://meta.serverfault.com/questions/2015",
"https://meta.serverfault.com",
"https://meta.serverfault.com/users/33118/"
] | It needs to be burniated.
It adds nothing to the site. It was a "fun" question once upon a time *maybe* but we've moved on from that.
Perhaps it should be locked while its fate is being debated? | Leave it, just keep it locked down. |
115,769 | I have a 40 gallon (bladdered) pressure tank in the basement which keeps pressure to my office building, and a 2-inch 2 horsepower submersible pump in a dug well 450 feet away.
The pump is cycling waaay too fast, and the tank will hold pressure at 41 pounds to 43 pounds but not at 60 pounds at shut-off pressure. (The... | 2017/06/02 | [
"https://diy.stackexchange.com/questions/115769",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/70373/"
] | The bladder is there to flatten the pressure/volume curve so pressure doesn't change rapidly as water is pumped.
This allows for a longer duty cycle.
The expected symptom of a burst bladder is just as you describe. | It needs air.
Get hold of an air compressor and give it a charge. Be sure to be running water while charging, and the pump is off. Easy.
If you need to do this more than once a year there might be a problem with the bladder. |
9,482,602 | I'm working on a Google Chrome extension with a popup, in which I load a page from a node.js + express.js server. The page I load changes depending on the status of the `req.session.user` in this way:
```
app.get('/', function(req, res){
if(req.session.user){
res.render(__dirname + '/pages/base.jade', {});... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9482602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/617461/"
] | The problem is how you have set up your server - you're using the `cookieParser` and `session` middlewares twice:
```
var app = express.createServer(
express.logger(),
express.cookieParser(),
express.session({ secret: 'keyboard cat' })
);
app.use(express.cookieParser());
app.use(express.session({ secret: ... | Popup page probably reloads every time you open it. You should create a backgroundpage for your extension where you could store/manage sessions. Then you can communicate from popup to backgroundpage passing messages [docs](http://code.google.com/chrome/extensions/messaging.html). Using messaging you can send login data... |
19,270,638 | I am creating a BitSet with a fixed number of bits.
In this case the length of my String holding the binary representation is 508 characters long.
So I create BitSet the following way:
```
BitSet bs = new BitSet(binary.length());
// binary.length() = 508
```
But looking at the size of bs I always get a size of 512.... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19270638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/664010/"
] | The number of bits in the constructor is a sizing hint, not a limit on the number of bits allowed. The `size()` of a Bitset is effectively its current *capacity*, though the specification is rather more rubbery than that.
>
> So I can't rely on the size if I get passed another bitset? There may also be some bits app... | According to [the documentation](http://docs.oracle.com/javase/7/docs/api/java/util/BitSet.html), the actual size in memory is implementation dependent, so you can't really know for sure what `size()` you're going to get. You as a user shouldn't have to worry about it, though, because the `length()` of the BitSet is al... |
19,270,638 | I am creating a BitSet with a fixed number of bits.
In this case the length of my String holding the binary representation is 508 characters long.
So I create BitSet the following way:
```
BitSet bs = new BitSet(binary.length());
// binary.length() = 508
```
But looking at the size of bs I always get a size of 512.... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19270638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/664010/"
] | The number of bits in the constructor is a sizing hint, not a limit on the number of bits allowed. The `size()` of a Bitset is effectively its current *capacity*, though the specification is rather more rubbery than that.
>
> So I can't rely on the size if I get passed another bitset? There may also be some bits app... | That's just a hint for a collection (this applies to all collections I think) so it don't have to resize itself after adding elements. For instance, if you know that your collection will hold 100 elements at maximum, you can set it's size to 100 and no resize will be made which is better for performance. |
19,270,638 | I am creating a BitSet with a fixed number of bits.
In this case the length of my String holding the binary representation is 508 characters long.
So I create BitSet the following way:
```
BitSet bs = new BitSet(binary.length());
// binary.length() = 508
```
But looking at the size of bs I always get a size of 512.... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19270638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/664010/"
] | The number of bits in the constructor is a sizing hint, not a limit on the number of bits allowed. The `size()` of a Bitset is effectively its current *capacity*, though the specification is rather more rubbery than that.
>
> So I can't rely on the size if I get passed another bitset? There may also be some bits app... | The BitSet size will be set to the first multiple of 64 that is equal to or greater than the number you use for 'size'. If you specify a 'size' of 508, you will get a BitSet with an actual size of 512, which is the next highest multiple of 64. |
19,270,638 | I am creating a BitSet with a fixed number of bits.
In this case the length of my String holding the binary representation is 508 characters long.
So I create BitSet the following way:
```
BitSet bs = new BitSet(binary.length());
// binary.length() = 508
```
But looking at the size of bs I always get a size of 512.... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19270638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/664010/"
] | According to [the documentation](http://docs.oracle.com/javase/7/docs/api/java/util/BitSet.html), the actual size in memory is implementation dependent, so you can't really know for sure what `size()` you're going to get. You as a user shouldn't have to worry about it, though, because the `length()` of the BitSet is al... | That's just a hint for a collection (this applies to all collections I think) so it don't have to resize itself after adding elements. For instance, if you know that your collection will hold 100 elements at maximum, you can set it's size to 100 and no resize will be made which is better for performance. |
19,270,638 | I am creating a BitSet with a fixed number of bits.
In this case the length of my String holding the binary representation is 508 characters long.
So I create BitSet the following way:
```
BitSet bs = new BitSet(binary.length());
// binary.length() = 508
```
But looking at the size of bs I always get a size of 512.... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19270638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/664010/"
] | According to [the documentation](http://docs.oracle.com/javase/7/docs/api/java/util/BitSet.html), the actual size in memory is implementation dependent, so you can't really know for sure what `size()` you're going to get. You as a user shouldn't have to worry about it, though, because the `length()` of the BitSet is al... | The BitSet size will be set to the first multiple of 64 that is equal to or greater than the number you use for 'size'. If you specify a 'size' of 508, you will get a BitSet with an actual size of 512, which is the next highest multiple of 64. |
41,004,429 | hi guys this is my "login.php":
```
<?php
session_start();
// connect to database
if (isset($_POST['login_btn'])) {
$username =$_POST['username'];
$password =$_POST['password'];
$_SESSION['username'] = $_POST['username'];
$conn = oci_connect('insidedba', 'progetto16', 'localhost/XE');
if (!$conn) ... | 2016/12/06 | [
"https://Stackoverflow.com/questions/41004429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7160791/"
] | If it's stored in session you can.
```
session_start();
if(!empty($_SESSION['username'])) $username = $_SESSION['username'];
else $username = "guest";
``` | You need to use the `U.USERNAME=$_SESSION['username']` variable in your *myorder.php* file.
By the way, in the code you're showing you don't have a `$username` variable in *myorder.php*, I guess you had in the SQL query that you now have: `U.USERNAME='$prova'` |
65,915,932 | I tried to look in other solutions. But it didn't help me out. Kindly look into this.
my html code.
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning b... | 2021/01/27 | [
"https://Stackoverflow.com/questions/65915932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13533843/"
] | You are using `re_path` like it is `path`. `re_path` expects regex, it does not have path converters like `path`. You can either write a regex or switch to `path`.
Regex solution:
```
urlpatterns=[
re_path(r'delete/(?P<pk>\d+)/',views.delete_data,name="deletedata")
]
```
path solution:
```
from django.urls i... | Try this
In the template, you have used pk
change in the template or in view and url
```
urlpatterns=[
re_path('<int:pk>/',views.update_data,name="deletedata")
]
```
Or
```
<form action="{% url 'deletedata' id = st.id %}" method = "POST" class="d-inline"> {% csrf_token %}
<input type="submit" class="... |
65,915,932 | I tried to look in other solutions. But it didn't help me out. Kindly look into this.
my html code.
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning b... | 2021/01/27 | [
"https://Stackoverflow.com/questions/65915932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13533843/"
] | Try this
In the template, you have used pk
change in the template or in view and url
```
urlpatterns=[
re_path('<int:pk>/',views.update_data,name="deletedata")
]
```
Or
```
<form action="{% url 'deletedata' id = st.id %}" method = "POST" class="d-inline"> {% csrf_token %}
<input type="submit" class="... | {% url 'deletedata' pk = st.id %}
in thr URL just remove the spaces, bellow code it should work
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning b... |
65,915,932 | I tried to look in other solutions. But it didn't help me out. Kindly look into this.
my html code.
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning b... | 2021/01/27 | [
"https://Stackoverflow.com/questions/65915932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13533843/"
] | Try this
In the template, you have used pk
change in the template or in view and url
```
urlpatterns=[
re_path('<int:pk>/',views.update_data,name="deletedata")
]
```
Or
```
<form action="{% url 'deletedata' id = st.id %}" method = "POST" class="d-inline"> {% csrf_token %}
<input type="submit" class="... | You can also write it with one a tag
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning btn-sm">Edit</a>
<a href="{% url 'deletedata' pk=st.... |
65,915,932 | I tried to look in other solutions. But it didn't help me out. Kindly look into this.
my html code.
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning b... | 2021/01/27 | [
"https://Stackoverflow.com/questions/65915932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13533843/"
] | You are using `re_path` like it is `path`. `re_path` expects regex, it does not have path converters like `path`. You can either write a regex or switch to `path`.
Regex solution:
```
urlpatterns=[
re_path(r'delete/(?P<pk>\d+)/',views.delete_data,name="deletedata")
]
```
path solution:
```
from django.urls i... | {% url 'deletedata' pk = st.id %}
in thr URL just remove the spaces, bellow code it should work
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning b... |
65,915,932 | I tried to look in other solutions. But it didn't help me out. Kindly look into this.
my html code.
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning b... | 2021/01/27 | [
"https://Stackoverflow.com/questions/65915932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13533843/"
] | You are using `re_path` like it is `path`. `re_path` expects regex, it does not have path converters like `path`. You can either write a regex or switch to `path`.
Regex solution:
```
urlpatterns=[
re_path(r'delete/(?P<pk>\d+)/',views.delete_data,name="deletedata")
]
```
path solution:
```
from django.urls i... | You can also write it with one a tag
```
<tbody>
{% for st in stu %}
<tr>
<th scope="row">{{st.id}}</th>
<td>{{st.name}}</td>
<td>{{st.email}}</td>
<td>{{st.role}}</td>
<td>
<a href="{}" class="btn btn-warning btn-sm">Edit</a>
<a href="{% url 'deletedata' pk=st.... |
12,165,002 | You know how PHP's `isset()` can accept multiple (no limit either) arguments?
Like I can do:
```
isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc
```
How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?
How do they do it... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12165002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can use `func_get_args()`, it will return an array of arguments.
```
function work_with_arguments() {
echo implode(", ", func_get_args());
}
work_with_arguments("Hello", "World");
//Outputs: Hello, World
``` | Calling `[func\_get\_args()](http://php.net/manual/en/function.func-get-args.php)` inside of your function will return an array of the arguments passed to PHP. |
12,165,002 | You know how PHP's `isset()` can accept multiple (no limit either) arguments?
Like I can do:
```
isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc
```
How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?
How do they do it... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12165002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | [`func_get_args`](http://php.net/manual/en/function.func-get-args.php) will do what you want:
```
function infinite_parameters() {
foreach (func_get_args() as $param) {
echo "Param is $param" . PHP_EOL;
}
}
```
You can also use `func_get_arg` to get a specific parameter (it's zero-indexed):
```
func... | You can use `func_get_args()`, it will return an array of arguments.
```
function work_with_arguments() {
echo implode(", ", func_get_args());
}
work_with_arguments("Hello", "World");
//Outputs: Hello, World
``` |
12,165,002 | You know how PHP's `isset()` can accept multiple (no limit either) arguments?
Like I can do:
```
isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc
```
How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?
How do they do it... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12165002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Starting with PHP 5.6 you can use the token "**...**"
Example:
```
<?php
function sum(...$numbers) {
$acc = 0;
foreach ($numbers as $n) {
$acc += $n;
}
return $acc;
}
echo sum(1, 2, 3, 4);
?>
```
Source:
<http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list> | You can use `func_get_args()`, it will return an array of arguments.
```
function work_with_arguments() {
echo implode(", ", func_get_args());
}
work_with_arguments("Hello", "World");
//Outputs: Hello, World
``` |
12,165,002 | You know how PHP's `isset()` can accept multiple (no limit either) arguments?
Like I can do:
```
isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc
```
How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?
How do they do it... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12165002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | [`func_get_args`](http://php.net/manual/en/function.func-get-args.php) will do what you want:
```
function infinite_parameters() {
foreach (func_get_args() as $param) {
echo "Param is $param" . PHP_EOL;
}
}
```
You can also use `func_get_arg` to get a specific parameter (it's zero-indexed):
```
func... | Calling `[func\_get\_args()](http://php.net/manual/en/function.func-get-args.php)` inside of your function will return an array of the arguments passed to PHP. |
12,165,002 | You know how PHP's `isset()` can accept multiple (no limit either) arguments?
Like I can do:
```
isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc
```
How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?
How do they do it... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12165002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Starting with PHP 5.6 you can use the token "**...**"
Example:
```
<?php
function sum(...$numbers) {
$acc = 0;
foreach ($numbers as $n) {
$acc += $n;
}
return $acc;
}
echo sum(1, 2, 3, 4);
?>
```
Source:
<http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list> | Calling `[func\_get\_args()](http://php.net/manual/en/function.func-get-args.php)` inside of your function will return an array of the arguments passed to PHP. |
12,165,002 | You know how PHP's `isset()` can accept multiple (no limit either) arguments?
Like I can do:
```
isset($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11);
//etc etc
```
How would I be able to do that in my own function? How would I be able to work with infinity arguments passed?
How do they do it... | 2012/08/28 | [
"https://Stackoverflow.com/questions/12165002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | [`func_get_args`](http://php.net/manual/en/function.func-get-args.php) will do what you want:
```
function infinite_parameters() {
foreach (func_get_args() as $param) {
echo "Param is $param" . PHP_EOL;
}
}
```
You can also use `func_get_arg` to get a specific parameter (it's zero-indexed):
```
func... | Starting with PHP 5.6 you can use the token "**...**"
Example:
```
<?php
function sum(...$numbers) {
$acc = 0;
foreach ($numbers as $n) {
$acc += $n;
}
return $acc;
}
echo sum(1, 2, 3, 4);
?>
```
Source:
<http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list> |
75,277 | I've seen quite a few security camera examples and many have options for a duty schedule that activates the camera during certain specified days/hours to set up a routine. However I have fairly dynamic schedule and would like for my security cameras to turn on when our phones are not on the WiFi network. This would be ... | 2017/11/16 | [
"https://raspberrypi.stackexchange.com/questions/75277",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/54665/"
] | You'd need to know either the MAC or IP address of the phones you want to monitor but you could just `ping` or `arping` each one in turn and if none reply start your recording otherwise stop recording. Calling something like this from `cron` might do the trick:
```
#!/bin/bash
#
# Determine if we should be recording ... | Your question appears to be about ***activating*** and ***disabling*** the cameras when you are not able to connect to them directly when your phones are not on the same local subnet. So it seems to be about ***networking*** and access to control them, rather than the phones themselves that you reference. That's what I... |
58,655,207 | I'm currently trying to extend [a model](https://github.com/microsoft/MASS) that is based on FairSeq/PyTorch. During training I need to train two encoders: one with the target sample, and the original one with the source sample.
So the current forward function looks like this:
```
def forward(self, src_tokens=None, s... | 2019/11/01 | [
"https://Stackoverflow.com/questions/58655207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3128562/"
] | First of all you should **always use and define `forward`** not some other methods that you call on the `torch.nn.Module` instance.
**Definitely do not overload `eval()` as shown by [trsvchn](https://stackoverflow.com/a/58659193/10886420) as it's evaluation method defined by PyTorch ([see here](https://pytorch.org/do... | By default, calling `model()` invoke `forward` method which is train forward in your case, so you just need to define new method for your test/eval path inside your model class, smth like here:
Code:
```py
class FooBar(nn.Module):
"""Dummy Net for testing/debugging.
"""
def __init__(self):
super(... |
3,829,211 | I did some changes at my CoreData Model. So far, I added a attribute called 'language'. When my application is launched and I click on "Create new Customer" a instance variable Customer is created. This variable is created by:
```
Customer *newCustomer = [NSEntityDescription insertNewObjectForEntityForName:@"Customer"... | 2010/09/30 | [
"https://Stackoverflow.com/questions/3829211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455928/"
] | What I did to get around this problem was to add this
>
> [[NSFileManager defaultManager] removeItemAtURL:storeURL error:nil];
>
>
>
to my appDelegate in the persistentStoreCoordinator before adding the persistent store. This deletes the existing store that no longer is compatible with your data model. Remember t... | The answer is a bit tricky but this always works for me. This is for a **clean** installation of a new compatible .sqlite file, **not a migration**!
launch simulator, delete the app and the data (the popup after you delete the app).
quit simulator
open X-Code, after making any edits to your data model
delete the `{... |
11,678,794 | I have problem with dll file and have project which need this file System.Windows.Controls.dll for
```
listBox1.ItemsSource
```
error fix , and add reference with this dll to fix error.
Where i can find this dll file?
Is there any download link ? Share please !
Thanks !
In "Add Reference" it doesn't exist !
Solut... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11678794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1539124/"
] | Here are the steps:
1. Right click on `References` in the `Solutions Explorer` (Solutions explorer is on the right of your IDE)
2. Select `Add Reference`
3. In the window that opens, Select `Assemblies > Framework`
4. Check the `PresentationFramework` component box and click ok | This should be in the PresentationFramework.dll but that control is in the System.Windows.Controls namespace.
<http://msdn.microsoft.com/en-us/library/system.windows.controls.listbox.aspx>
You can add it by going to your project, Right clicking on References > Add Reference > .Net Tab > And selecting this DLL |
11,678,794 | I have problem with dll file and have project which need this file System.Windows.Controls.dll for
```
listBox1.ItemsSource
```
error fix , and add reference with this dll to fix error.
Where i can find this dll file?
Is there any download link ? Share please !
Thanks !
In "Add Reference" it doesn't exist !
Solut... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11678794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1539124/"
] | This should be in the PresentationFramework.dll but that control is in the System.Windows.Controls namespace.
<http://msdn.microsoft.com/en-us/library/system.windows.controls.listbox.aspx>
You can add it by going to your project, Right clicking on References > Add Reference > .Net Tab > And selecting this DLL | I was able to find the dll file by searching my computer for "System.Windows.Controls.dll". I found it under the following file location... "C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.dll"
Hope this helps! |
11,678,794 | I have problem with dll file and have project which need this file System.Windows.Controls.dll for
```
listBox1.ItemsSource
```
error fix , and add reference with this dll to fix error.
Where i can find this dll file?
Is there any download link ? Share please !
Thanks !
In "Add Reference" it doesn't exist !
Solut... | 2012/07/26 | [
"https://Stackoverflow.com/questions/11678794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1539124/"
] | Here are the steps:
1. Right click on `References` in the `Solutions Explorer` (Solutions explorer is on the right of your IDE)
2. Select `Add Reference`
3. In the window that opens, Select `Assemblies > Framework`
4. Check the `PresentationFramework` component box and click ok | I was able to find the dll file by searching my computer for "System.Windows.Controls.dll". I found it under the following file location... "C:\Program Files (x86)\Microsoft SDKs\Silverlight\v3.0\Libraries\Client\System.Windows.Controls.dll"
Hope this helps! |
9,525,464 | So I am figuring out how to set up some options for a class. 'options' is a hash. I want to
1) filter out options I don't want or need
2) set some instance variables to use elsewhere
3) and set up another hash with the processed options as @current\_options.
```
def initialize_options(options)
@whitelisted_optio... | 2012/03/01 | [
"https://Stackoverflow.com/questions/9525464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/697364/"
] | Your `@current_options` is initialized as an empty hash. When you filter the `options` passed as params, none of the keys will be present in `@current_options` so `n_options` will end up empty.
Then when you set up `@current_options` in the following lines, it will always grab the default values `(0, false, false)`, a... | 1. What is `@whitelisted_options` for?
2. What do you want to happen if `:destructive` is not a key in `options`? Do you want to have `:destructive => false`, or do you want `@current_options` to not mention `:destructive` at all? |
47,539,905 | I am very new to CSS and javascript, so take it easy on me.
I am trying to remove the class `disable-stream` from each of the div elements under the div class="stream-notifications". (See image, below)
I have tried the following in Tampermonkey, but it doesn't seem to work:
```
(function() {
'use strict';
disable-st... | 2017/11/28 | [
"https://Stackoverflow.com/questions/47539905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6632302/"
] | ```
var divs =document.getElementsByClassName("stream-notifications");
divs=Array.from(divs);
divs.forEach(function(div){
div.classList.remove('disable-stream');
});
``` | Use something like this using jQuery
```
$(".disable-stream div").removeClass("disable-stream");
```
[Plunker demo](https://plnkr.co/edit/hP4IyF64trUEjTmZpwBK?p=preview) |
47,539,905 | I am very new to CSS and javascript, so take it easy on me.
I am trying to remove the class `disable-stream` from each of the div elements under the div class="stream-notifications". (See image, below)
I have tried the following in Tampermonkey, but it doesn't seem to work:
```
(function() {
'use strict';
disable-st... | 2017/11/28 | [
"https://Stackoverflow.com/questions/47539905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6632302/"
] | That looks to be an AJAX-driven web page, so you need to use AJAX-aware techniques to deal with it. EG [waitForKeyElements](https://gist.github.com/2625891), or `MutationObserver`, or similar.
Here's **a complete script** that should work:
```
// ==UserScript==
// @name _Remove a select class from nodes
// @match... | Use something like this using jQuery
```
$(".disable-stream div").removeClass("disable-stream");
```
[Plunker demo](https://plnkr.co/edit/hP4IyF64trUEjTmZpwBK?p=preview) |
47,539,905 | I am very new to CSS and javascript, so take it easy on me.
I am trying to remove the class `disable-stream` from each of the div elements under the div class="stream-notifications". (See image, below)
I have tried the following in Tampermonkey, but it doesn't seem to work:
```
(function() {
'use strict';
disable-st... | 2017/11/28 | [
"https://Stackoverflow.com/questions/47539905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6632302/"
] | That looks to be an AJAX-driven web page, so you need to use AJAX-aware techniques to deal with it. EG [waitForKeyElements](https://gist.github.com/2625891), or `MutationObserver`, or similar.
Here's **a complete script** that should work:
```
// ==UserScript==
// @name _Remove a select class from nodes
// @match... | ```
var divs =document.getElementsByClassName("stream-notifications");
divs=Array.from(divs);
divs.forEach(function(div){
div.classList.remove('disable-stream');
});
``` |
13,769,762 | Our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially.
What I'm seeing in the code is that I cannot enter multi-choice mode mode unless I have something selected, and if I unselect that item, multi-choice mode exits (con... | 2012/12/07 | [
"https://Stackoverflow.com/questions/13769762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337455/"
] | It's very hacky, but I've done this by having an item selected, but making it look like it's not selected, by making the background temporarily transparent. When an item is then selected by the user, the secretly-selected item is deselected and the background restored to normal. Or, if it's the secretly-selected item w... | You just have to use :
```
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
``` |
13,769,762 | Our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially.
What I'm seeing in the code is that I cannot enter multi-choice mode mode unless I have something selected, and if I unselect that item, multi-choice mode exits (con... | 2012/12/07 | [
"https://Stackoverflow.com/questions/13769762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337455/"
] | Just call:
```
mListView.setItemChecked(-1, true);
```
ListView's actionMode will be started without selecting any list element.
Make sure you've properly set your ListView before call:
```
mListView.setMultiChoiceModeListener( ... )
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
or
mListView.setChoiceM... | You just have to use :
```
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
``` |
13,769,762 | Our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially.
What I'm seeing in the code is that I cannot enter multi-choice mode mode unless I have something selected, and if I unselect that item, multi-choice mode exits (con... | 2012/12/07 | [
"https://Stackoverflow.com/questions/13769762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337455/"
] | It's very hacky, but I've done this by having an item selected, but making it look like it's not selected, by making the background temporarily transparent. When an item is then selected by the user, the secretly-selected item is deselected and the background restored to normal. Or, if it's the secretly-selected item w... | If you want to change the action bar, call this from your activity:
>
> startActionMode(new ActionMode.Callback {
>
>
>
> ```
> @Override
> public boolean onCreateActionMode(ActionMode mode, Menu menu) {
> return false;
> }
>
> @Override
> public boolean onPrepareActionMode(ActionMode ... |
13,769,762 | Our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially.
What I'm seeing in the code is that I cannot enter multi-choice mode mode unless I have something selected, and if I unselect that item, multi-choice mode exits (con... | 2012/12/07 | [
"https://Stackoverflow.com/questions/13769762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337455/"
] | Just call:
```
mListView.setItemChecked(-1, true);
```
ListView's actionMode will be started without selecting any list element.
Make sure you've properly set your ListView before call:
```
mListView.setMultiChoiceModeListener( ... )
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
or
mListView.setChoiceM... | If you want to change the action bar, call this from your activity:
>
> startActionMode(new ActionMode.Callback {
>
>
>
> ```
> @Override
> public boolean onCreateActionMode(ActionMode mode, Menu menu) {
> return false;
> }
>
> @Override
> public boolean onPrepareActionMode(ActionMode ... |
13,769,762 | Our UX asks for a button to start multi-choice mode. this would do the same thing as long-pressing on an item, but would have nothing selected initially.
What I'm seeing in the code is that I cannot enter multi-choice mode mode unless I have something selected, and if I unselect that item, multi-choice mode exits (con... | 2012/12/07 | [
"https://Stackoverflow.com/questions/13769762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337455/"
] | It's very hacky, but I've done this by having an item selected, but making it look like it's not selected, by making the background temporarily transparent. When an item is then selected by the user, the secretly-selected item is deselected and the background restored to normal. Or, if it's the secretly-selected item w... | Just call:
```
mListView.setItemChecked(-1, true);
```
ListView's actionMode will be started without selecting any list element.
Make sure you've properly set your ListView before call:
```
mListView.setMultiChoiceModeListener( ... )
mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
or
mListView.setChoiceM... |
62,287,390 | I am working on a web application at the moment that has a an api at the top level domain (mydomain.com) and an SPA at subdomain (spa.mydomain.com). In the SPA I have added,
`axios.defaults.withCredentials = true`
To login in I run the following code,
```
axios.get('/sanctum/csrf-cookie').then(response => {
axi... | 2020/06/09 | [
"https://Stackoverflow.com/questions/62287390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57872/"
] | Turns out when our Azure DevOps instance was first set up, all our users set up Microsoft accounts with their company emails. Later when we finally stood up Azure AD but before we connected it to DevOps we added a new project and set the permissions for a few existing employees. For some reason the user permissions on ... | It sounds like you have multiple users in your azure ad tenant with the same UPN.
maybe you created a cloud account with the same UPN before sync'ing the on premise with azure ad connect? or something else of that nature.
try to go to graph explorer <https://developer.microsoft.com/en-us/graph/graph-explorer>
log in... |
62,287,390 | I am working on a web application at the moment that has a an api at the top level domain (mydomain.com) and an SPA at subdomain (spa.mydomain.com). In the SPA I have added,
`axios.defaults.withCredentials = true`
To login in I run the following code,
```
axios.get('/sanctum/csrf-cookie').then(response => {
axi... | 2020/06/09 | [
"https://Stackoverflow.com/questions/62287390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57872/"
] | Turns out when our Azure DevOps instance was first set up, all our users set up Microsoft accounts with their company emails. Later when we finally stood up Azure AD but before we connected it to DevOps we added a new project and set the permissions for a few existing employees. For some reason the user permissions on ... | According to [this doc](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/faq-azure-access?view=azure-devops#q-why-did-i-get-an-error-stating-that-my-organization-has-multiple-active-identities-with-the-same-upn):
>
> During the connect process, we map existing users to members of the Azure AD ten... |
31,079,002 | I have a solution with a C# project of 'library' and a project 'JavaScript' after that compiled it generates a .winmd file being taken to another project. But this project is built on x86 and I need to compile for x64, to run the application in order x64 get the following error:
```
'WWAHost.exe' (Script): Loaded 'Scr... | 2015/06/26 | [
"https://Stackoverflow.com/questions/31079002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It looks like you were making calls with no Access Token at all, to data that's publicly visible on Facebook.com
v1.0 of Facebook's Graph API was deprecated in April 2014 and scheduled for removal after 2015-04-30 - one of the changes between v1.0 and v2.0 was that in v2.0 all calls require an Access Token - the depre... | I finally realized that since May 1, it is **necessary** to create an app and then generate a token and use it in my JSON call URL.
So this:
```
$.getJSON('https://graph.facebook.com/616894958361877/photos?limit=100&callback=?
```
Became this:
```
$.getJSON('https://graph.facebook.com/616894958361877/photos?acce... |
31,079,002 | I have a solution with a C# project of 'library' and a project 'JavaScript' after that compiled it generates a .winmd file being taken to another project. But this project is built on x86 and I need to compile for x64, to run the application in order x64 get the following error:
```
'WWAHost.exe' (Script): Loaded 'Scr... | 2015/06/26 | [
"https://Stackoverflow.com/questions/31079002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It looks like you were making calls with no Access Token at all, to data that's publicly visible on Facebook.com
v1.0 of Facebook's Graph API was deprecated in April 2014 and scheduled for removal after 2015-04-30 - one of the changes between v1.0 and v2.0 was that in v2.0 all calls require an Access Token - the depre... | You need an App Access Token.
Go to <http://developers.facebook.com/apps/> and create an app for the client's Facebook page. When you're presented with the options, select the "Website" type of app. You can skip the configuration option using the "Skip and Create App ID" button in the top right corner.
Give it a Disp... |
334,167 | I am late game Alien Crossfire, attacking with gravitons aremed with [string disruptor](https://strategywiki.org/wiki/Sid_Meier%27s_Alpha_Centauri/Weapon#String_Disruptor).
Unfortunately, the others have gotten wise and are building everything [AAA](https://strategywiki.org/wiki/Sid_Meier%27s_Alpha_Centauri/Special_Ab... | 2018/06/24 | [
"https://gaming.stackexchange.com/questions/334167",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/92813/"
] | Psi attack/defense is orthogonal to conventional weapons. Its result depends on *Morale* levels of attacking/defending units.
If an attacker/defender is a *Mind Worm*, they have their own class, plus both faction's *Planet (Green)* scores/attitudes largely affect the outcome of the fight.
**Answer:** see what's your ... | If you have dominant weapons, mixing in hovertanks and even air-dropped infantry will let you continue leveraging those dominant weapons.
Psi-combat is mostly useful when facing technologically superior enemies that your weapons cannot defeat. Switching from overwhelming firepower to psi-attack will make you lose as m... |
43,377,941 | **Goal**: I aim to use t-SNE (t-distributed Stochastic Neighbor Embedding) in R for dimensionality reduction of my training data (with *N* observations and *K* variables, where *K>>N*) and subsequently aim to come up with the t-SNE representation for my test data.
**Example**: Suppose I aim to reduce the K variables ... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43377941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5634399/"
] | From the author himself (<https://lvdmaaten.github.io/tsne/>):
>
> Once I have a t-SNE map, how can I embed incoming test points in that
> map?
>
>
> t-SNE learns a non-parametric mapping, which means that it does not
> learn an explicit function that maps data from the input space to the
> map. Therefore, it is... | t-SNE fundamentally does not do what you want. t-SNE is designed only for visualizing a dataset in a low (2 or 3) dimension space. You give it all the data you want to visualize all at once. It is not a general purpose dimensionality reduction tool.
If you are trying to apply t-SNE to "new" data, you are probably not... |
43,377,941 | **Goal**: I aim to use t-SNE (t-distributed Stochastic Neighbor Embedding) in R for dimensionality reduction of my training data (with *N* observations and *K* variables, where *K>>N*) and subsequently aim to come up with the t-SNE representation for my test data.
**Example**: Suppose I aim to reduce the K variables ... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43377941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5634399/"
] | t-SNE does not really work this way:
The following is an expert from the t-SNE author's website (<https://lvdmaaten.github.io/tsne/>):
>
> Once I have a t-SNE map, how can I embed incoming test points in that
> map?
>
>
> t-SNE learns a non-parametric mapping, which means that it does not
> learn an explicit fu... | t-SNE fundamentally does not do what you want. t-SNE is designed only for visualizing a dataset in a low (2 or 3) dimension space. You give it all the data you want to visualize all at once. It is not a general purpose dimensionality reduction tool.
If you are trying to apply t-SNE to "new" data, you are probably not... |
43,377,941 | **Goal**: I aim to use t-SNE (t-distributed Stochastic Neighbor Embedding) in R for dimensionality reduction of my training data (with *N* observations and *K* variables, where *K>>N*) and subsequently aim to come up with the t-SNE representation for my test data.
**Example**: Suppose I aim to reduce the K variables ... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43377941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5634399/"
] | This the mail answer from the author (Jesse Krijthe) of the Rtsne package:
>
> Thank you for the very specific question. I had an earlier request for
> this and it is noted as an open issue on GitHub
> (<https://github.com/jkrijthe/Rtsne/issues/6>). The main reason I am
> hesitant to implement something like this ... | t-SNE fundamentally does not do what you want. t-SNE is designed only for visualizing a dataset in a low (2 or 3) dimension space. You give it all the data you want to visualize all at once. It is not a general purpose dimensionality reduction tool.
If you are trying to apply t-SNE to "new" data, you are probably not... |
43,377,941 | **Goal**: I aim to use t-SNE (t-distributed Stochastic Neighbor Embedding) in R for dimensionality reduction of my training data (with *N* observations and *K* variables, where *K>>N*) and subsequently aim to come up with the t-SNE representation for my test data.
**Example**: Suppose I aim to reduce the K variables ... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43377941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5634399/"
] | This the mail answer from the author (Jesse Krijthe) of the Rtsne package:
>
> Thank you for the very specific question. I had an earlier request for
> this and it is noted as an open issue on GitHub
> (<https://github.com/jkrijthe/Rtsne/issues/6>). The main reason I am
> hesitant to implement something like this ... | From the author himself (<https://lvdmaaten.github.io/tsne/>):
>
> Once I have a t-SNE map, how can I embed incoming test points in that
> map?
>
>
> t-SNE learns a non-parametric mapping, which means that it does not
> learn an explicit function that maps data from the input space to the
> map. Therefore, it is... |
43,377,941 | **Goal**: I aim to use t-SNE (t-distributed Stochastic Neighbor Embedding) in R for dimensionality reduction of my training data (with *N* observations and *K* variables, where *K>>N*) and subsequently aim to come up with the t-SNE representation for my test data.
**Example**: Suppose I aim to reduce the K variables ... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43377941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5634399/"
] | This the mail answer from the author (Jesse Krijthe) of the Rtsne package:
>
> Thank you for the very specific question. I had an earlier request for
> this and it is noted as an open issue on GitHub
> (<https://github.com/jkrijthe/Rtsne/issues/6>). The main reason I am
> hesitant to implement something like this ... | t-SNE does not really work this way:
The following is an expert from the t-SNE author's website (<https://lvdmaaten.github.io/tsne/>):
>
> Once I have a t-SNE map, how can I embed incoming test points in that
> map?
>
>
> t-SNE learns a non-parametric mapping, which means that it does not
> learn an explicit fu... |
62,380,246 | As the title says is there a way to programmatically render (into a DOM element) a component in angular?
For example, in React I can use `ReactDOM.render` to turn a component into a DOM element. I am wondering if it's possible to something similar in Angular? | 2020/06/15 | [
"https://Stackoverflow.com/questions/62380246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6009213/"
] | At first you'll need to have a template in your HTML file at the position where you'll want to place the dynamically loaded component.
```html
<ng-template #placeholder></ng-template>
```
In the component you can inject the `DynamicFactoryResolver` inside the constructor. Once you'll execute the `loadComponent()` fu... | If you want to render the angular component into a Dom element which is not compiled by angular, Then we can't obtain a ViewContainerRef. Then you can use Angular cdk portal and portal host concepts to achieve this.
Create portal host with any DOMElememt, injector, applicationRef, componentFactoryResolver.
Create porta... |
12,881 | No matter how I rearrange this, the increment compare always returns false....
I have even taken it out of the if, and put it in its own if:
```
int buttonFSM(button *ptrButton)
{
int i;
i = digitalRead(ptrButton->pin);
switch(ptrButton->buttonState)
{
case SW_UP:
if(i==0 && ++ptrButton-... | 2015/06/24 | [
"https://arduino.stackexchange.com/questions/12881",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/10817/"
] | Looks to me like the path where the if doesn't happen are getting you. You don't show what DBNC\_TICS is set to, but I'm assuming it's > 1.
ptrButton->debounceTics will never be greater than 1 because you always:
```
ptrButton->debounceTics = 0;
``` | The error is due to wrong expectations on operators precedence:
++ and -> have the same precedence, so they are evaluated left to right.
See <http://en.cppreference.com/w/c/language/operator_precedence> .
Overall, the lack of parenthesis makes the readability poor.
The code can be improved by dropping the switch and ... |
12,881 | No matter how I rearrange this, the increment compare always returns false....
I have even taken it out of the if, and put it in its own if:
```
int buttonFSM(button *ptrButton)
{
int i;
i = digitalRead(ptrButton->pin);
switch(ptrButton->buttonState)
{
case SW_UP:
if(i==0 && ++ptrButton-... | 2015/06/24 | [
"https://arduino.stackexchange.com/questions/12881",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/10817/"
] | Looks to me like the path where the if doesn't happen are getting you. You don't show what DBNC\_TICS is set to, but I'm assuming it's > 1.
ptrButton->debounceTics will never be greater than 1 because you always:
```
ptrButton->debounceTics = 0;
``` | ```C++
if(i==0 && ++ptrButton->debounceTics == DBNC_TICS) //swtich went down
{
ptrButton->buttonState = SW_DOWN;
ptrButton->debounceTics = 0;
return SW_TRANS_UD;
}
ptrButton->debounceTics = 0;
```
I'm going to agree with user3877595 but explain why, as his/her answer got a... |
64,999,490 | Hi I'm learning right now how to upload images to database, but I'm getting this error/notice.
```
</select>
<input type="text" name="nama" class="input-control" placeholder="Nama Produk" required>
<input type="text" name="harga" class="input-control" placeholder="Harga Produk" require... | 2020/11/25 | [
"https://Stackoverflow.com/questions/64999490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14704128/"
] | You need to add `enctype="multipart/form-data"` to your form
<https://www.php.net/manual/en/features.file-upload.post-method.php>
>
> **Note:**
> Be sure your file upload form has attribute
> enctype="multipart/form-data" otherwise the file upload will not work.
>
>
> | When you want to submit file from form you should put "enctype="multipart/form-data".
```
<form "enctype="multipart/form-data" ...>
</form>
```
Do you put it? |
21,657,910 | Can we change the color of the text based on the color of the background image? I have a background image which i have appended it to body. When you reload the page every time the background image gets changed. But i have my menus which are positioned on the image having text color as black. If the background image is ... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21657910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1999172/"
] | use switch case to handle
```
switch(backgroundimage){
case "black.jpg":
document.body.color = "white";
break;
case "white.jpg":
document.body.color = "black";
break;
case "green.jpg":
document.body.color = "gray";
break;
}
``` | If you know what will be the image that will be loaded you can create a dictionary with the image name and the css class that will be appended to the text for it. then on page load attach the class to the body classes.
If you dont know the image that will be loaded there are some solutions but they are not complete. l... |
2,274,695 | My colleague has been using "new function()" with a lower case "f" to define new objects in JavaScript. It seems to work well in all major browsers and it also seems to be fairly effective at hiding private variables. Here's an example:
```
var someObj = new function () {
var inner = 'some value';
... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2274695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188740/"
] | I've seen that technique before, it's valid, you are using a function expression as if it were a [Constructor Function](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function).
But IMHO, you can achieve the same with an auto-invoking function expression, I don't really see the point of using the... | Your code is just similar to the less weird construct
```
function Foo () {
var inner = 'some value';
this.foo = 'blah';
...
};
var someObj = new Foo;
``` |
2,274,695 | My colleague has been using "new function()" with a lower case "f" to define new objects in JavaScript. It seems to work well in all major browsers and it also seems to be fairly effective at hiding private variables. Here's an example:
```
var someObj = new function () {
var inner = 'some value';
... | 2010/02/16 | [
"https://Stackoverflow.com/questions/2274695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/188740/"
] | I've seen that technique before, it's valid, you are using a function expression as if it were a [Constructor Function](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function).
But IMHO, you can achieve the same with an auto-invoking function expression, I don't really see the point of using the... | To clarify some aspects and make Douglas Crockford's JSLint not to complain about your code here are some examples of instantiation:
```javascript
1. o = new Object(); // normal call of a constructor
2. o = new Object; // accepted call of a constructor
3. var someObj = new (function () {
var inner = 'some va... |
1,806,990 | Since nothing so far is working I started a new project with
```
python scrapy-ctl.py startproject Nu
```
I followed the tutorial exactly, and created the folders, and a new spider
```
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.... | 2009/11/27 | [
"https://Stackoverflow.com/questions/1806990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/215094/"
] | Please also check the version of scrapy. The latest version uses "name" instead of "domain\_name" attribute to uniquely identify a spider. | Have you included the spider in `SPIDER_MODULES` list in your scrapy\_settings.py?
It's not written in the tutorial anywhere that you should to this, but you do have to. |
1,806,990 | Since nothing so far is working I started a new project with
```
python scrapy-ctl.py startproject Nu
```
I followed the tutorial exactly, and created the folders, and a new spider
```
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.... | 2009/11/27 | [
"https://Stackoverflow.com/questions/1806990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/215094/"
] | Please also check the version of scrapy. The latest version uses "name" instead of "domain\_name" attribute to uniquely identify a spider. | I believe you have syntax errors there. The `name = hxs...` will not work because you don't get defined before the `hxs` object.
Try running `python yourproject/spiders/domain.py` to get syntax errors. |
1,806,990 | Since nothing so far is working I started a new project with
```
python scrapy-ctl.py startproject Nu
```
I followed the tutorial exactly, and created the folders, and a new spider
```
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.... | 2009/11/27 | [
"https://Stackoverflow.com/questions/1806990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/215094/"
] | Please also check the version of scrapy. The latest version uses "name" instead of "domain\_name" attribute to uniquely identify a spider. | These two lines look like they're causing trouble:
```
u = names.pop()
rules = (Rule(SgmlLinkExtractor(allow=(u, )), callback='parse_item'),)
```
* Only one rule will be followed each time the script is run. Consider creating a rule for each URL.
* You haven't created a `parse_item` callback, which means that the r... |
1,806,990 | Since nothing so far is working I started a new project with
```
python scrapy-ctl.py startproject Nu
```
I followed the tutorial exactly, and created the folders, and a new spider
```
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.... | 2009/11/27 | [
"https://Stackoverflow.com/questions/1806990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/215094/"
] | Please also check the version of scrapy. The latest version uses "name" instead of "domain\_name" attribute to uniquely identify a spider. | You are overriding the `parse` method, instead of implementing a new `parse_item` method. |
20,931,619 | I got nearly 10 functions in class having similar pattern like following function
```
SQLiteDatabase database = this.getWritableDatabase();
try {
//Some different code , all other code(try,catch,finally) is same in all functions
} catch (SQLiteException e) {
Log.e(this.getClass().getName... | 2014/01/05 | [
"https://Stackoverflow.com/questions/20931619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1033305/"
] | There are a number of frameworks out there that drastically simplify database interaction that you can use, but if you want to do things on your own, and are interested in the Java way to do things like this, here's the idea:
Make your "executor" like so:
```
public class Executor {
public static void runOperation(... | **To expand further on [Ray Toal's original answer](https://stackoverflow.com/a/20931708/1134080),** it is worth noting that using anonymous inner class will help avoid creating a separate class file for each operation. So the original class with 10 or so functions can remain the same way, except being refactored to us... |
32,580,318 | Please help me for How to convert data from {"rOjbectId":["abc","def",ghi","ghikk"]} to "["abc", "def", "ghi", "ghikk"] using ajax | 2015/09/15 | [
"https://Stackoverflow.com/questions/32580318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4003128/"
] | You can load a placeholder image, but then you must *load* that image (when you're already loading another image). If you load something like a spinner via a `GET` request, that should be ok since you can set cache headers from the server so the browser does not actually make any additional requests for that loading im... | you can use placeholder image, which is very light weight and use that in place of each image.
same time while loading page, you can load all the images in hidden div.
then on document ready you can replace all the images with jQuery.
e.g.
HTML
----
```
<img src="tiny_placeholder_image" alt="" data-src="original... |
32,580,318 | Please help me for How to convert data from {"rOjbectId":["abc","def",ghi","ghikk"]} to "["abc", "def", "ghi", "ghikk"] using ajax | 2015/09/15 | [
"https://Stackoverflow.com/questions/32580318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4003128/"
] | I found a good solution on GitHub. Just use the **CSS** code below:
```css
img[src=""],
img:not([src]) {
visibility: hidden;
}
```
Link: <https://github.com/wp-media/rocket-lazy-load/issues/60> | you can use placeholder image, which is very light weight and use that in place of each image.
same time while loading page, you can load all the images in hidden div.
then on document ready you can replace all the images with jQuery.
e.g.
HTML
----
```
<img src="tiny_placeholder_image" alt="" data-src="original... |
9,458,253 | Perhaps I am worrying over nothing. I desire for data members to closely follow the RAII idiom. How can I initialise a protected pointer member in an abstract base class to null?
I know it should be null, but wouldn't it be nicer to ensure that is universally understood?
Putting initialization code outside of the ini... | 2012/02/26 | [
"https://Stackoverflow.com/questions/9458253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/866333/"
] | I have had this problem in the past - and fixed it.
The images you're displaying are much too large. I love using html or css to resize my images (because who wants to do it manually), but the fact remains that most browsers will hiccup when moving them around. I'm not sure why.
With the exception of Opera, which us... | Performance in JavaScript is slow, as you're going through many layers of abstraction to get any work done, and many manipulations with objects on the screen are happening in the background. Performance cannot be guaranteed from system to system.
You'll find that with all jQuery animation, you will get a higher "frame... |
34,211,201 | I have a Python script that uploads a Database file to my website every 5 minutes. My website lets the user query the Database using PHP.
If a user tries to run a query while the database is being uploaded, they will get an error message
>
> PHP Warning: SQLite3::prepare(): Unable to prepare statement: 11, database ... | 2015/12/10 | [
"https://Stackoverflow.com/questions/34211201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2893712/"
] | First of all there is a weird thing with your implementation: you use a parameter `n` that you never use, but simply keep passing and you never modify.
Secondly the second recursive call is incorrect:
```
else:
m = y*power(y, x//2, n)
#Print statement only used as check
print(x, m)
return m*m
```
If... | here is my approach accornding to the c version of this problem it works with both positives and negatives exposents:
```
def power(a,b):
"""this function will raise a to the power b but recursivelly"""
#first of all we need to verify the input
if isinstance(a,(int,float)) and isinstance(b,int):
if a==0:
... |
38,921,847 | I want to remove the card from the `@hand` array if it has the same rank as the given input. I'm looping through the entire array, why doesn't it get rid of the last card? Any help is greatly appreciated!
Output:
```
2 of Clubs
2 of Spades
2 of Hearts
2 of Diamonds
3 of Clubs
3 of Spades
------------
2 of Clubs
2 of ... | 2016/08/12 | [
"https://Stackoverflow.com/questions/38921847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5140582/"
] | `remove_cards(value)` has an issue: one should not `delete` during iteration. The correct way would be to [`Array#reject!`](http://ruby-doc.org/core-2.3.1/Array.html#method-i-reject-21) cards from a hand:
```
def remove_cards(value)
@hands.reject! { |hand_card| hand_card.rank == value }
end
``` | Your issue is in this line
```
@hands.each_with_index do |hand_card, i|
```
You have an instance variable `@hand`, not `@hands` |
13,540,903 | TextView.setAllCaps() started as of API 14. What is its equivalent for older APIs (e.g. 13 and lowers)?
I cannot find such method on lower APIs. Is maybe setTransformationMethod() responsible for this on older APIs? If yes, how should I use it? `TextView.setTransformationMethod(new TransformationMethod() {...` is a bi... | 2012/11/24 | [
"https://Stackoverflow.com/questions/13540903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437039/"
] | Try this:
```
textView.setText(textToBeSet.toUpperCase());
``` | What about oldskool `strtoupper()`? |
13,540,903 | TextView.setAllCaps() started as of API 14. What is its equivalent for older APIs (e.g. 13 and lowers)?
I cannot find such method on lower APIs. Is maybe setTransformationMethod() responsible for this on older APIs? If yes, how should I use it? `TextView.setTransformationMethod(new TransformationMethod() {...` is a bi... | 2012/11/24 | [
"https://Stackoverflow.com/questions/13540903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437039/"
] | What about oldskool `strtoupper()`? | Bottom line is that `toUpperCase()` is the solution. I can't object that. If you prefer doing the `setAllCaps()` with `TransformationMethod`, take a look at my [answer](https://stackoverflow.com/a/24025691/557179). |
13,540,903 | TextView.setAllCaps() started as of API 14. What is its equivalent for older APIs (e.g. 13 and lowers)?
I cannot find such method on lower APIs. Is maybe setTransformationMethod() responsible for this on older APIs? If yes, how should I use it? `TextView.setTransformationMethod(new TransformationMethod() {...` is a bi... | 2012/11/24 | [
"https://Stackoverflow.com/questions/13540903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437039/"
] | Try this:
```
textView.setText(textToBeSet.toUpperCase());
``` | Bottom line is that `toUpperCase()` is the solution. I can't object that. If you prefer doing the `setAllCaps()` with `TransformationMethod`, take a look at my [answer](https://stackoverflow.com/a/24025691/557179). |
6,126,126 | If you declare an inheritance hierarchy where both the parent and child class have a static method of the same name and parameters\*, Visual Studio will raise warning [CS0108](http://msdn.microsoft.com/en-us/library/3s8070fc.aspx):
Example:
```
public class BaseClass
{
public static void DoSomething()
{
}... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6126126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/533907/"
] | Members of the SubClass will not be able to access the DoSomething from BaseClass without explicitly indicating the class name. So it is effectively "hidden" to members of SubClass, but still accessible.
For example:
```
public class SubClass : BaseClass
{
public static void DoSomething()
{
}
public ... | It's just a warning. The compiler just wants to make sure you intentionally used the same method name. |
6,126,126 | If you declare an inheritance hierarchy where both the parent and child class have a static method of the same name and parameters\*, Visual Studio will raise warning [CS0108](http://msdn.microsoft.com/en-us/library/3s8070fc.aspx):
Example:
```
public class BaseClass
{
public static void DoSomething()
{
}... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6126126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/533907/"
] | Members of the SubClass will not be able to access the DoSomething from BaseClass without explicitly indicating the class name. So it is effectively "hidden" to members of SubClass, but still accessible.
For example:
```
public class SubClass : BaseClass
{
public static void DoSomething()
{
}
public ... | >
> Why is this considered method hiding? Neither method is involved in the inheritance hierarchy and can only be invoked by using the class name.
>
>
>
That is not true. You can call DoSomething from any inherited class name:
```
public Class A
{
public static void C() {...}
}
public Class B: A
{
}
B.C()... |
6,126,126 | If you declare an inheritance hierarchy where both the parent and child class have a static method of the same name and parameters\*, Visual Studio will raise warning [CS0108](http://msdn.microsoft.com/en-us/library/3s8070fc.aspx):
Example:
```
public class BaseClass
{
public static void DoSomething()
{
}... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6126126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/533907/"
] | Members of the SubClass will not be able to access the DoSomething from BaseClass without explicitly indicating the class name. So it is effectively "hidden" to members of SubClass, but still accessible.
For example:
```
public class SubClass : BaseClass
{
public static void DoSomething()
{
}
public ... | Visual Studio, and Philippe, are saying it's a warning so your code will compile and run.
However, 'CodeNaked' nicely demonstrates why it is hidden. This code compiles without throwing errors or warnings. Thanks to 'CodeNaked'
```
public class BaseClass {
public virtual void DoSomething() {
}
}
public class ... |
6,126,126 | If you declare an inheritance hierarchy where both the parent and child class have a static method of the same name and parameters\*, Visual Studio will raise warning [CS0108](http://msdn.microsoft.com/en-us/library/3s8070fc.aspx):
Example:
```
public class BaseClass
{
public static void DoSomething()
{
}... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6126126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/533907/"
] | >
> Why is this considered method hiding? Neither method is involved in the inheritance hierarchy and can only be invoked by using the class name.
>
>
>
That is not true. You can call DoSomething from any inherited class name:
```
public Class A
{
public static void C() {...}
}
public Class B: A
{
}
B.C()... | It's just a warning. The compiler just wants to make sure you intentionally used the same method name. |
6,126,126 | If you declare an inheritance hierarchy where both the parent and child class have a static method of the same name and parameters\*, Visual Studio will raise warning [CS0108](http://msdn.microsoft.com/en-us/library/3s8070fc.aspx):
Example:
```
public class BaseClass
{
public static void DoSomething()
{
}... | 2011/05/25 | [
"https://Stackoverflow.com/questions/6126126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/533907/"
] | >
> Why is this considered method hiding? Neither method is involved in the inheritance hierarchy and can only be invoked by using the class name.
>
>
>
That is not true. You can call DoSomething from any inherited class name:
```
public Class A
{
public static void C() {...}
}
public Class B: A
{
}
B.C()... | Visual Studio, and Philippe, are saying it's a warning so your code will compile and run.
However, 'CodeNaked' nicely demonstrates why it is hidden. This code compiles without throwing errors or warnings. Thanks to 'CodeNaked'
```
public class BaseClass {
public virtual void DoSomething() {
}
}
public class ... |
14,847,913 | I try to implement the zoom in/out by spread/pinch gesture and the drag and drop functions on a Relative Layout.
This is the code of my OnPinchListener to handle the zoom effect.
The **mainView** is the RelativeLayout defined in the layout xml file.
I implement the touch listener in the **fakeview** which should be... | 2013/02/13 | [
"https://Stackoverflow.com/questions/14847913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2067294/"
] | you need to get the transformation matrix and use that to transform your original points.
so something like this (after you do the scaling):
```
Matrix m = view.getMatrix(); //gives you the transform matrix
m.mapPoints(newPoints, oldPoints); //transform the original points.
``` | This is how I solved it in my case (`getViewRect` should be called after view was laid out, for example through `view.post(Runnable)`, so `view.getWidth()/getHeight()` returns actual values):
```
public static Rect getViewRect(View view) {
Rect outRect = new Rect();
outRect.right = (int)(view.getWidth() * getS... |
3,851,022 | $A^{2}-2A=\begin{bmatrix}
5 & -6 \\
-4 & 2
\end{bmatrix}$
Can someone help me solve this? I've been trying to solve it for a while, but no matter what I try, the only information that I manage to get about A is that if $A=\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}$ then $c=\frac{2b}{3}$. Any help would be apprec... | 2020/10/04 | [
"https://math.stackexchange.com/questions/3851022",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/832188/"
] | Denote by $I$ the identity matrix. Then, completing squares you can write
$$A^2 - 2A = A^2 -2IA + I^2 -I^2 = (A-I)^2 -I^2.$$
Hence, your equation is equivalent to
$$(A-I)^2 = X + I$$
since $I^2 = I$. Denote by $Y=X+I$ the new matrix (which is known). You want to find $B$ such that
$B^2=Y.$
Here, I recommend to diagonal... | $$A^{2}-2A+I=\begin{bmatrix} 5 & -6 \\ -4 & 2 \end{bmatrix}+I \\
(A-I)^2=\begin{bmatrix} 6 & -6 \\ -4 & 3 \end{bmatrix} $$
We know that, if$$\begin{align}M&=PDP^{-1} \\ M^n&=PD^nP^{-1}\end{align}$$
Let $B=A-I$ then, $$B=\sqrt{\begin{bmatrix} 6 & -6 \\ -4 & 3 \end{bmatrix}}$$
Diagonalise $B^2$ as, $$\left(\begin{mat... |
3,851,022 | $A^{2}-2A=\begin{bmatrix}
5 & -6 \\
-4 & 2
\end{bmatrix}$
Can someone help me solve this? I've been trying to solve it for a while, but no matter what I try, the only information that I manage to get about A is that if $A=\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}$ then $c=\frac{2b}{3}$. Any help would be apprec... | 2020/10/04 | [
"https://math.stackexchange.com/questions/3851022",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/832188/"
] | Denote by $I$ the identity matrix. Then, completing squares you can write
$$A^2 - 2A = A^2 -2IA + I^2 -I^2 = (A-I)^2 -I^2.$$
Hence, your equation is equivalent to
$$(A-I)^2 = X + I$$
since $I^2 = I$. Denote by $Y=X+I$ the new matrix (which is known). You want to find $B$ such that
$B^2=Y.$
Here, I recommend to diagonal... | $\newcommand{\Tr}{\mathrm{Tr}\,}$
Let $Y=A-I$, $X=B+I$, $B$ for the rhs matrix. Then $\Tr X = 9$, $\det X=-6$, and we need to solve
$$Y^2=X$$
for $Y$. Write $\alpha=\Tr Y$, $\beta = \det Y$. Then
$$Y^2-\alpha Y + \beta I=0$$
or
$$\alpha Y = \beta I + X$$
so that finding allowed values of $\alpha$, $\beta$ solves the pr... |
68,767,520 | I have a discord bot that gets info from an API. The current issue I'm having is actually getting the information to be sent when the command is run.
```
const axios = require('axios');
axios.get('https://mcapi.us/server/status?ip=asean.my.to')
.then(response => {
console.log(response.data);
});
module.exports = {
... | 2021/08/13 | [
"https://Stackoverflow.com/questions/68767520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15076973/"
] | probably your page is refreshed, try to use preventDefault to prevent the refresh
```
$('#submit').click(function(event){
//your code here
event.preventDefault();
}
``` | You have a button with type `"submit"`.
```html
<input type="submit" id="submit" value="Save">
```
As the click-event occurs on this button, your form will be send to the server. You have no action attribute defined on your form, so it redirects after submit to the same URL.
As [Sterko](https://stackoverflow.com/us... |
238,163 | I have Echo's buried in code all over my notebook, I'd like a flag to turn them all on or off globally.
* Sure `Unprotect[Echo];Echo=Identity` would disable them, but then you can't re-enable them
* A solution that works for all the various types of Echos (EchoName, EchoEvaluation, ...) would be nice
* `QuietEcho` doe... | 2021/01/13 | [
"https://mathematica.stackexchange.com/questions/238163",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/403/"
] | [`Echo`](http://reference.wolfram.com/language/ref/Echo) has an autoload, so you need to make sure the symbol is autoloaded before you modify its values:
```
DisableEcho[] := (Unprotect[Echo]; Echo; Echo = #&; Protect[Echo];)
EnableEcho[] := (Unprotect[Echo]; Echo=.; Protect[Echo];)
```
Test:
```
DisableEcho[]
Ec... | I would recommend using `QuietEcho` rather than redefining `Echo`:
```
In[62]:= $Pre = QuietEcho;
In[63]:= Echo[3]
Out[63]= 3
```
This has the added benefit of disabling printing for all `Echo` functions, not just `Echo`. |
29,922,241 | Here is my Database: `bott_no_mgmt_data`
```
random_no ; company_id ; bottle_no ; date ; returned ; returned_to_stock ; username
30201 ; MY COMP ; 1 ; 2015-04-28 ; 10 ; NULL ; ANDREW
30202 ; MY COMP ; 2 ; 2015-04-28 ; 10 ; NULL ; ANDREW
3020... | 2015/04/28 | [
"https://Stackoverflow.com/questions/29922241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4842148/"
] | All joins should be written before Where clause as Daan mentions:
```
select yt.* from bott_no_mgmt_data yt
inner join(
select bottle_no, max(random_no) random_no
from bott_no_mgmt_data
WHERE username = 'ANDREW' group by bottle_no
)
ss on yt.bottle_no = ss.bottle_no and yt.random_no = ss.random_no
LEFT ... | A couple of things. You don't need that first inner join at all, it's pointless. Also, you said "I wish to compare them and only return those that match." - so that means you want INNER JOIN not LEFT JOIN.
```
SELECT MAX(random_no) AS random_no, company_id, yt.bottle_no, `date`, returned, username
FROM bott_no_mgmt_da... |
17,435,721 | I have a project with multiple modules say "Application A" and "Application B" modules (these are separate module with its own pom file but are not related to each other).
In the dev cycle, each of these modules have its own feature branch. Say,
```
Application A --- Master
\
- F... | 2013/07/02 | [
"https://Stackoverflow.com/questions/17435721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/710802/"
] | You can do this with a before update trigger. You would use such a trigger to assign the value of `offer_nr` based on the historical values. The key code would be:
```
new.offer_nr = (select coalesce(1+max(offer_nr), 1)
from offers o
where o.company_id = new.company_id
)
... | Don't make it this way.
Have autoincremented company ids as well as independent order ids.
That's how it works.
There is no such thing like "number" in database. Numbers appears only at the time of select. |
35,029,058 | HTML CODE
```
<select class="form-control" name="min_select[]">
<option value="15">15</option>
<option value="30">30</option>
</select>
```
JQuery Code
```
var val1[];
$('select[name="min_select[]"] option:selected').each(function() {
val1.push($(this).val());
});
```
when i run this c... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35029058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4089992/"
] | The declaration array syntax is in correct.Please check the below code
```
var val1=[];
$('select[name="min_select[]"] option:selected').each(function() {
val1.push($(this).val());
});
``` | You can try the following
**HTML**
```
<select class="form-control min-select" name="min_select[]">
<option value="15">15</option>
<option value="30">30</option>
</select>
```
**JQUERY**
```
var values = [];
$("select.min-select").each(function(i, sel){
var selectedVal = $(sel).val();
v... |
35,029,058 | HTML CODE
```
<select class="form-control" name="min_select[]">
<option value="15">15</option>
<option value="30">30</option>
</select>
```
JQuery Code
```
var val1[];
$('select[name="min_select[]"] option:selected').each(function() {
val1.push($(this).val());
});
```
when i run this c... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35029058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4089992/"
] | The declaration array syntax is in correct.Please check the below code
```
var val1=[];
$('select[name="min_select[]"] option:selected').each(function() {
val1.push($(this).val());
});
``` | To get the selected value, whether it is multiselect or single select, use jQuery [`.val()`](http://api.jquery.com/val/) method.
If it is a multiselect, it will return an array of the selected values.
See [jsfiddle for demo](https://jsfiddle.net/txk25c4c/). Check console log |
35,029,058 | HTML CODE
```
<select class="form-control" name="min_select[]">
<option value="15">15</option>
<option value="30">30</option>
</select>
```
JQuery Code
```
var val1[];
$('select[name="min_select[]"] option:selected').each(function() {
val1.push($(this).val());
});
```
when i run this c... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35029058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4089992/"
] | This will also work
```
var val1= $("select[name=\'min_select[]\']").map(function() {
return $(this).val();
}).toArray();
``` | You can try the following
**HTML**
```
<select class="form-control min-select" name="min_select[]">
<option value="15">15</option>
<option value="30">30</option>
</select>
```
**JQUERY**
```
var values = [];
$("select.min-select").each(function(i, sel){
var selectedVal = $(sel).val();
v... |
35,029,058 | HTML CODE
```
<select class="form-control" name="min_select[]">
<option value="15">15</option>
<option value="30">30</option>
</select>
```
JQuery Code
```
var val1[];
$('select[name="min_select[]"] option:selected').each(function() {
val1.push($(this).val());
});
```
when i run this c... | 2016/01/27 | [
"https://Stackoverflow.com/questions/35029058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4089992/"
] | This will also work
```
var val1= $("select[name=\'min_select[]\']").map(function() {
return $(this).val();
}).toArray();
``` | To get the selected value, whether it is multiselect or single select, use jQuery [`.val()`](http://api.jquery.com/val/) method.
If it is a multiselect, it will return an array of the selected values.
See [jsfiddle for demo](https://jsfiddle.net/txk25c4c/). Check console log |
28,808,099 | I am writing a script which will pick the last created file for the given process instance.
The command I use in my script is
```
CONSOLE_FILE=`ls -1 "$ABP_AJTUH_ROOT/console/*${INSTANCE}*" | tail -1`
```
but while the script is getting executed, the above command changes to
```
ls -1 '....../console/*ABP*'
```
... | 2015/03/02 | [
"https://Stackoverflow.com/questions/28808099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4623068/"
] | You cannot use double quotes around the wildcard, because that turns the asterisks into literal characters.
```
CONSOLE_FILE=`ls -1 "$ABP_AJTUH_ROOT"/console/*"$INSTANCE"* | tail -1`
```
should work, but see the caveats against <http://mywiki.wooledge.org/ParsingLs> and generally <http://mywiki.wooledge.org/BashPitf... | Try
```
CONSOLE_FILE=`eval ls -1 "$ABP_AJTUH_ROOT/console/*${INSTANCE}*" | tail -1`
```
Also, if you want the last created file, use `ls -1tr` |
60,744,543 | I'm trying to get the Download Folder to show on my file explorer. However on Android 9, when I use the getexternalstoragedirectory() method is showing self and emulated directories only and if I press "emulated" I cannot see more folders, it shows an empty folder.
So this is how I'm getting the path, it's working fin... | 2020/03/18 | [
"https://Stackoverflow.com/questions/60744543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10871734/"
] | This is because [dictionaries](https://docs.julialang.org/en/v1/base/collections/#Dictionaries-1) in Julia (`Dict`) are not ordered: each dictionary maintains a *set* of keys. The order in which one gets keys when one iterates on this set is not defined, and can vary as one inserts new entries. There are two things tha... | Try this:
```
fruits = Dict("Mangoes" => 5, "Pomegranates" => 4, "Apples" => 8);
for key in sort(collect(keys(fruits)))
println("$key => $(fruits[key])")
end
```
It gives this result:
```
Apples => 8
Mangoes => 5
Pomegranates => 4
``` |
5,803,170 | I have encountered a problem when trying to select data from a table in MySQL in Java by a text column that is in utf-8. The interesting thing is that with code in Python it works well, in Java it doesn't.
The table looks as follows:
```
CREATE TABLE `x` (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `text` varchar(... | 2011/04/27 | [
"https://Stackoverflow.com/questions/5803170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/429274/"
] | Okay, my bad. The database was wrongly built. It was built through the mysql client that by default is latin1 so in the database the data were encoded by utf8 twice.
The problem and the major difference between the two source codes is in that the Python code doesn't set the default charset (therefore it is latin1) whe... | Use PreparedStatement and set your search string as a positional parameter into that statement.
Read this tutorial about PreparedStatements -> <http://download.oracle.com/javase/tutorial/jdbc/basics/prepared.html>
Also, never create a String literal in Java code that contains non-ASCII characters.
If you want to pass... |
24,220,365 | I have this SQL server instance which is shared by several client-processes. I want queries to finish taking as little time as possible.
Say a call needs to read 1k to 10k records from this shared Sql Server. My natural choice would be to use ExecuteReaderAsync to take advantage of async benefits such as reusing threa... | 2014/06/14 | [
"https://Stackoverflow.com/questions/24220365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298622/"
] | Whether you use sync or async to call SQL Server makes no difference for the work that SQL Server does and for the CPU-bound work that ADO.NET does to serialize and deserialize request and response. So no matter what you chose the difference will be small.
Using async is not about saving CPU time. It is about saving m... | The difference between the async approach and the sync approach is that the async call will cause the compiler to generate a state machine, whereas the sync call will simply block while the work agains't the database is being done.
IRL, the best way to choose is to benchmark both approaches. As usr said, usually those... |
3,398,839 | I'm trying to prove this by induction, but something doesn't add up. I see a solution given [here](https://www.algebra.com/algebra/homework/word/misc/Miscellaneous_Word_Problems.faq.question.29292.html), but it is actually proving that the expression is **greater** than $2\sqrt{n}$. I'd appreciate some insight. | 2019/10/18 | [
"https://math.stackexchange.com/questions/3398839",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/209695/"
] | Base step: 1<2.
Inductive step: $$\sum\_{j=1}^{n+1}\frac1{\sqrt{j}} < 2\sqrt{n}+\frac1{\sqrt{n+1}}$$
So if we prove
$$2\sqrt{n}+\frac1{\sqrt{n+1}}<2\sqrt{n+1}$$
we are done. Indeed, that holds true: just square the left hand side sides to get
$$4n+2\frac{\sqrt{n}}{\sqrt{n+1}}+\frac1{n+1}<4n+3<4n+4$$
which is the squa... | Note that
$$ 2\sqrt{n+1}-2\sqrt n=2\cdot\frac{(\sqrt{n+1}-\sqrt{n})(\sqrt{n+1}+\sqrt{n})}{\sqrt{n+1}+\sqrt{n}}=2\cdot \frac{(n+1)-n}{\sqrt{n+1}+\sqrt{n}}<\frac 2{\sqrt n+\sqrt n}$$ |
32,969,687 | I have a scenario where I need to auto generate the value of a column if it is null.
Ex: `employeeDetails`:
```
empName empId empExtension
A 101 null
B 102 987
C 103 986
D 104 null
E 105 null
```
`employeeDepartment`:
```
deptName empId
HR 101
ADMIN 10... | 2015/10/06 | [
"https://Stackoverflow.com/questions/32969687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3622730/"
] | You should be able to do that with a CTE to grab [ROW\_NUMBER](https://msdn.microsoft.com/en-us/library/ms186734.aspx), and then [COALESCE](https://msdn.microsoft.com/en-us/library/ms190349.aspx) to only use that number where the value is NULL:
```
WITH cte AS(
SELECT empId, empExtension, ROW_NUMBER() OVER(ORDER BY ... | Just an idea, can you save result of that query into temp table
```
SELECT empdt.empId, empdprt.deptName, empdt.empExtension
INTO #TempEmployee
FROM employeeDetails empdt
LEFT JOIN employeeDepartment empdprt
ON empdt.empId = empdprt.empId
```
And after that just do the update of #TempEmployee? |
32,969,687 | I have a scenario where I need to auto generate the value of a column if it is null.
Ex: `employeeDetails`:
```
empName empId empExtension
A 101 null
B 102 987
C 103 986
D 104 null
E 105 null
```
`employeeDepartment`:
```
deptName empId
HR 101
ADMIN 10... | 2015/10/06 | [
"https://Stackoverflow.com/questions/32969687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3622730/"
] | If you just want to create a unique random 5 digit number for those `empExtension` column values are null, then
**Query**
```
;with cte as
(
select rn = row_number() over
(
order by empId
),*
from employeeDetails
)
select t1.empId,t2.deptName,
case when t1.empExtension is null
then t1.rn + (... | Just an idea, can you save result of that query into temp table
```
SELECT empdt.empId, empdprt.deptName, empdt.empExtension
INTO #TempEmployee
FROM employeeDetails empdt
LEFT JOIN employeeDepartment empdprt
ON empdt.empId = empdprt.empId
```
And after that just do the update of #TempEmployee? |
32,969,687 | I have a scenario where I need to auto generate the value of a column if it is null.
Ex: `employeeDetails`:
```
empName empId empExtension
A 101 null
B 102 987
C 103 986
D 104 null
E 105 null
```
`employeeDepartment`:
```
deptName empId
HR 101
ADMIN 10... | 2015/10/06 | [
"https://Stackoverflow.com/questions/32969687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3622730/"
] | ```
declare @rand int = (rand()* 12345);
SELECT empdt.empId, empdprt.deptName,
isnull(empdt.empExtension,row_number() over(order by empdt.empId)+@rand)
FROM employeeDetails empdt
LEFT JOIN employeeDepartment empdprt
ON empdt.empId = empdprt.empId
```
Incase the empExtension, get the row\_number + a ra... | Just an idea, can you save result of that query into temp table
```
SELECT empdt.empId, empdprt.deptName, empdt.empExtension
INTO #TempEmployee
FROM employeeDetails empdt
LEFT JOIN employeeDepartment empdprt
ON empdt.empId = empdprt.empId
```
And after that just do the update of #TempEmployee? |
32,969,687 | I have a scenario where I need to auto generate the value of a column if it is null.
Ex: `employeeDetails`:
```
empName empId empExtension
A 101 null
B 102 987
C 103 986
D 104 null
E 105 null
```
`employeeDepartment`:
```
deptName empId
HR 101
ADMIN 10... | 2015/10/06 | [
"https://Stackoverflow.com/questions/32969687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3622730/"
] | You should be able to do that with a CTE to grab [ROW\_NUMBER](https://msdn.microsoft.com/en-us/library/ms186734.aspx), and then [COALESCE](https://msdn.microsoft.com/en-us/library/ms190349.aspx) to only use that number where the value is NULL:
```
WITH cte AS(
SELECT empId, empExtension, ROW_NUMBER() OVER(ORDER BY ... | If you just want to create a unique random 5 digit number for those `empExtension` column values are null, then
**Query**
```
;with cte as
(
select rn = row_number() over
(
order by empId
),*
from employeeDetails
)
select t1.empId,t2.deptName,
case when t1.empExtension is null
then t1.rn + (... |
32,969,687 | I have a scenario where I need to auto generate the value of a column if it is null.
Ex: `employeeDetails`:
```
empName empId empExtension
A 101 null
B 102 987
C 103 986
D 104 null
E 105 null
```
`employeeDepartment`:
```
deptName empId
HR 101
ADMIN 10... | 2015/10/06 | [
"https://Stackoverflow.com/questions/32969687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3622730/"
] | You should be able to do that with a CTE to grab [ROW\_NUMBER](https://msdn.microsoft.com/en-us/library/ms186734.aspx), and then [COALESCE](https://msdn.microsoft.com/en-us/library/ms190349.aspx) to only use that number where the value is NULL:
```
WITH cte AS(
SELECT empId, empExtension, ROW_NUMBER() OVER(ORDER BY ... | ```
declare @rand int = (rand()* 12345);
SELECT empdt.empId, empdprt.deptName,
isnull(empdt.empExtension,row_number() over(order by empdt.empId)+@rand)
FROM employeeDetails empdt
LEFT JOIN employeeDepartment empdprt
ON empdt.empId = empdprt.empId
```
Incase the empExtension, get the row\_number + a ra... |
62,440,916 | I'm brand new to python 3 & my google searches have been unproductive. Is there a way to write this:
```
for x in range(10):
print(x)
```
as this:
```
print(x) for x in range(10)
```
I do not want to return a list as the `arr = [x for x in X]` list comprehension syntax does.
EDIT: I'm not actually in that s... | 2020/06/18 | [
"https://Stackoverflow.com/questions/62440916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4048592/"
] | No, there isn't. Unless you consider this a one liner:
```
for x in range(6): print(x)
```
but there's no reason to do that. | For your specific case to print a range of 6:
```py
print(*range(6), sep='\n')
```
This is not a for loop however @Boris is correct. |
62,440,916 | I'm brand new to python 3 & my google searches have been unproductive. Is there a way to write this:
```
for x in range(10):
print(x)
```
as this:
```
print(x) for x in range(10)
```
I do not want to return a list as the `arr = [x for x in X]` list comprehension syntax does.
EDIT: I'm not actually in that s... | 2020/06/18 | [
"https://Stackoverflow.com/questions/62440916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4048592/"
] | No, there isn't. Unless you consider this a one liner:
```
for x in range(6): print(x)
```
but there's no reason to do that. | Looks like you are looking for something like `map`. If the function you are calling returns `None`, then it won't be too expensive.
Map will return an iterator, so you are just trying to consume it.
One way is:
```py
list(map(print, range(6)))
```
Or using a zero length deque if you don't want the actual list ele... |
62,440,916 | I'm brand new to python 3 & my google searches have been unproductive. Is there a way to write this:
```
for x in range(10):
print(x)
```
as this:
```
print(x) for x in range(10)
```
I do not want to return a list as the `arr = [x for x in X]` list comprehension syntax does.
EDIT: I'm not actually in that s... | 2020/06/18 | [
"https://Stackoverflow.com/questions/62440916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4048592/"
] | No, there isn't. Unless you consider this a one liner:
```
for x in range(6): print(x)
```
but there's no reason to do that. | What you are looking for is a generator expression that returns a generator object.
```py
print(i for i in range(10)) #<generator object <genexpr> at 0x7f3a5baacdb0>
```
To see the values
```py
print(*(i for i in range(10))) # 0 1 2 3 4 5 6 7 8 9
```
Pros:
* Extremely Memory Efficient.
* Lazy Evaluation - genera... |
62,440,916 | I'm brand new to python 3 & my google searches have been unproductive. Is there a way to write this:
```
for x in range(10):
print(x)
```
as this:
```
print(x) for x in range(10)
```
I do not want to return a list as the `arr = [x for x in X]` list comprehension syntax does.
EDIT: I'm not actually in that s... | 2020/06/18 | [
"https://Stackoverflow.com/questions/62440916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4048592/"
] | Looks like you are looking for something like `map`. If the function you are calling returns `None`, then it won't be too expensive.
Map will return an iterator, so you are just trying to consume it.
One way is:
```py
list(map(print, range(6)))
```
Or using a zero length deque if you don't want the actual list ele... | For your specific case to print a range of 6:
```py
print(*range(6), sep='\n')
```
This is not a for loop however @Boris is correct. |
62,440,916 | I'm brand new to python 3 & my google searches have been unproductive. Is there a way to write this:
```
for x in range(10):
print(x)
```
as this:
```
print(x) for x in range(10)
```
I do not want to return a list as the `arr = [x for x in X]` list comprehension syntax does.
EDIT: I'm not actually in that s... | 2020/06/18 | [
"https://Stackoverflow.com/questions/62440916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4048592/"
] | Looks like you are looking for something like `map`. If the function you are calling returns `None`, then it won't be too expensive.
Map will return an iterator, so you are just trying to consume it.
One way is:
```py
list(map(print, range(6)))
```
Or using a zero length deque if you don't want the actual list ele... | What you are looking for is a generator expression that returns a generator object.
```py
print(i for i in range(10)) #<generator object <genexpr> at 0x7f3a5baacdb0>
```
To see the values
```py
print(*(i for i in range(10))) # 0 1 2 3 4 5 6 7 8 9
```
Pros:
* Extremely Memory Efficient.
* Lazy Evaluation - genera... |
37,455,599 | When I run my project on my iphone or in the simulator it works fine.
When I try to run it on an ipad I get the below error:
*file was built for arm64 which is not the architecture being linked (armv7)*
The devices it set to Universal.
Does anybody have an idea about what else I should check? | 2016/05/26 | [
"https://Stackoverflow.com/questions/37455599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5367540/"
] | Just in case somebody has the same problem as me. Some of my target projects had different iOS Deployment target and that is why the linking failed. After moving them all to the same the problem was solved. | I should have added armv6 for iPad 2. Done that and it works now |
2,315,242 | I'm just starting a new project on ASP.NET MVC and this will be the first project actually using this technology. As I created my new project with Visual Studio 2010, it created to my sql server a bunch of tables with "aspnet\_" prefix. Part of them deal with the built-in user accounts and permission support.
Now, I ... | 2010/02/23 | [
"https://Stackoverflow.com/questions/2315242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/266159/"
] | If you are choosing to use the Membership API for your site, then this [link](http://www.asp.net/(S(pdfrohu0ajmwt445fanvj2r3))/learn/security/tutorial-08-cs.aspx) has information regarding how to add extra information to a user.
I was faced with the same scenario recently and ended up ditching the membership functiona... | Using the membership system in asp.net has its advantages and drawbacks. It's easy to start, because you don't have to worry about validation, user registration, resetting passwords. (Be careful if you plan to modify the table structures, you will have to change them in the views/store procedures generated
**However t... |
2,315,242 | I'm just starting a new project on ASP.NET MVC and this will be the first project actually using this technology. As I created my new project with Visual Studio 2010, it created to my sql server a bunch of tables with "aspnet\_" prefix. Part of them deal with the built-in user accounts and permission support.
Now, I ... | 2010/02/23 | [
"https://Stackoverflow.com/questions/2315242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/266159/"
] | I would create [custom membership provider](http://www.15seconds.com/issue/050216.htm) and omit those `aspnet_x` tables completely. I've seen what happens when one `join`s these tables and custom ones with nhibernate mappings - pure nightmare. | Using the membership system in asp.net has its advantages and drawbacks. It's easy to start, because you don't have to worry about validation, user registration, resetting passwords. (Be careful if you plan to modify the table structures, you will have to change them in the views/store procedures generated
**However t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.