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 |
|---|---|---|---|---|---|
13,119,876 | I have a Camel route such as:
```
<route errorHandlerRef="myDeadLetterErrorHandler">
<from uri="activemq:queue:source"/>
<to uri="activemq:queue:destA">
<to uri="activemq:queue:destB">
<to uri="activemq:queue:destC">
</route>
```
When one endpoint fail, I set a redeliveryPolicy to retry to send the ... | 2012/10/29 | [
"https://Stackoverflow.com/questions/13119876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1652262/"
] | Change both script tag's type attribute to `type="text/javascript"` instead of `type="text/jscript"`
```
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
type="text/javascript" ></script>
<script type="text/javascript">
$(document).ready(function () {
alert('test');
... | error is here:
```
<script type="text/jscript">
```
It should be like this:
```
<script type="text/javascript">
``` |
13,119,876 | I have a Camel route such as:
```
<route errorHandlerRef="myDeadLetterErrorHandler">
<from uri="activemq:queue:source"/>
<to uri="activemq:queue:destA">
<to uri="activemq:queue:destB">
<to uri="activemq:queue:destC">
</route>
```
When one endpoint fail, I set a redeliveryPolicy to retry to send the ... | 2012/10/29 | [
"https://Stackoverflow.com/questions/13119876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1652262/"
] | Change both script tag's type attribute to `type="text/javascript"` instead of `type="text/jscript"`
```
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
type="text/javascript" ></script>
<script type="text/javascript">
$(document).ready(function () {
alert('test');
... | type="text/jscript" could be the problem. If you change that to type="text/javascript" it does seem to work. |
42,747,432 | I have input strings like this
>
> "CC", 5, "B7C15", "B4C8"
>
>
>
I split out this strings via `preg_split` method.
But when input string `$str = 'CC';`
method doesn't work.
My the code:
```
preg_split('/(\\d+)/', $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
```
I get the output result:
```
... | 2017/03/12 | [
"https://Stackoverflow.com/questions/42747432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5108806/"
] | A better Approach would be to use:
```
preg_match_all( '/(\d+)|([a-z])/i', $string, $matches );
print_r($matches);
``` | Provided you need any non-digit character sequence split into one char elements, you only need to add `(\D)` (a single non-digit char group) as alternative to your regex:
```
preg_split('/(\\d+)|(\D)/', $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
```
Demo: <https://regex101.com/r/zFHybU/1> |
42,747,432 | I have input strings like this
>
> "CC", 5, "B7C15", "B4C8"
>
>
>
I split out this strings via `preg_split` method.
But when input string `$str = 'CC';`
method doesn't work.
My the code:
```
preg_split('/(\\d+)/', $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
```
I get the output result:
```
... | 2017/03/12 | [
"https://Stackoverflow.com/questions/42747432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5108806/"
] | A better Approach would be to use:
```
preg_match_all( '/(\d+)|([a-z])/i', $string, $matches );
print_r($matches);
``` | The file format you're looking at is called CSV, and has many gotchas in parsing. Rather than writing your own parser with a regex, use existing tools.
If you're reading these from a file, use the [`fgetcsv`](http://php.net/manual/en/function.fgetcsv.php) function that is built in to PHP. |
42,747,432 | I have input strings like this
>
> "CC", 5, "B7C15", "B4C8"
>
>
>
I split out this strings via `preg_split` method.
But when input string `$str = 'CC';`
method doesn't work.
My the code:
```
preg_split('/(\\d+)/', $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
```
I get the output result:
```
... | 2017/03/12 | [
"https://Stackoverflow.com/questions/42747432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5108806/"
] | Provided you need any non-digit character sequence split into one char elements, you only need to add `(\D)` (a single non-digit char group) as alternative to your regex:
```
preg_split('/(\\d+)|(\D)/', $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
```
Demo: <https://regex101.com/r/zFHybU/1> | The file format you're looking at is called CSV, and has many gotchas in parsing. Rather than writing your own parser with a regex, use existing tools.
If you're reading these from a file, use the [`fgetcsv`](http://php.net/manual/en/function.fgetcsv.php) function that is built in to PHP. |
6,731,157 | I am having the following two urls that give me some nasty 404 errors that I would like to fix by adding some rewrite rules to apache and I must recongnize that I don't understand regular expressions enough to be able to write the correct rules.
### FIRST URL
```
http://www.example.com/fincas-rusticas/finca-rustica_e... | 2011/07/18 | [
"https://Stackoverflow.com/questions/6731157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115050/"
] | 1) Use this rule -- it will remove `function.strtotime` from end of URL (by using 301 Permanent Redirect) regardless of how deep that part is in URL (i.e. it will work for `example.com/something/function.strtotime` as well as `example.com/one/two/three/function.strtotime`).
```
RewriteEngine On
RewriteBase /
RewriteR... | For the first one you can do
```
RewriteRule fincas-rusticas/finca-rustica_en_alacant-alicante/lalacanti/alicante/function.strtotime fincas-rusticas/finca-rustica_en_alacant-alicante/lalacanti/alicante/ [L]
```
For the second one, I must assume that this URL is already rewritten to something, since the strict stand... |
53,662,214 | **Here is a column of my dataframe.**
[](https://i.stack.imgur.com/OkG4G.png)
I want to select for example for the first image 28g and delete (1 ONZ). **how can I do ?** | 2018/12/07 | [
"https://Stackoverflow.com/questions/53662214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10656554/"
] | Use `replace`:
```
df.serving_size.str.replace('\(.*','')
0 NaN
1 28g
2 28g
3 28g
4 35g
5 52g
Name: serving_size, dtype: object
``` | You can extract everything outside of the parentheses:
```
# original df
>>> df
serving_size
0 NaN
1 28 g (1 ONZ)
2 28 g (0.25 cup)
>>> df.serving_size.str.extract('(.*)\(.*\)')
0 NaN
1 28 g
2 28 g
Name: serving_size, dtype: object
``` |
53,662,214 | **Here is a column of my dataframe.**
[](https://i.stack.imgur.com/OkG4G.png)
I want to select for example for the first image 28g and delete (1 ONZ). **how can I do ?** | 2018/12/07 | [
"https://Stackoverflow.com/questions/53662214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10656554/"
] | Use `replace`:
```
df.serving_size.str.replace('\(.*','')
0 NaN
1 28g
2 28g
3 28g
4 35g
5 52g
Name: serving_size, dtype: object
``` | Using `split`
```
df.serving_size.str.split('(').str[0]
0 NaN
1 28g
2 28g
Name: serving_size, dtype: object
``` |
48,757,330 | I have a landoop kafka image running on a Pod on minikube k8 cluster on my mac. I have 2 different services to expose the port 8081 for schema registry and 9092 for broker. I have mapped the ports 8081 -> 30081 and 9092 -> 30092 in my NodePort services so that I can access it from outside the cluster.
But when I try t... | 2018/02/12 | [
"https://Stackoverflow.com/questions/48757330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7851030/"
] | Accessing a Kafka cluster from outside a container network is rather complicated if you cannot route directly from the outside to the pod.
When you first connect to a Kafka cluster you connect to a single broker and the broker returns the list of all brokers and partitions inside the Kafka cluster. The Kafka client th... | You need to set the advertised listeners for Kafka. For the landoop docker images this can be set via the environment flag
`-e ADV_HOST=192.168.99.100` |
9,492,617 | For example I am looking for a way to search every spot in a list to see where an object is located. Some example psuedocode could go:
```
for every column in current row:
if column is the first one:
do this
if column in the last one:
do that
else:
find the previous row a... | 2012/02/29 | [
"https://Stackoverflow.com/questions/9492617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220097/"
] | `asura = Sony Internet TV`
`eagle = Sony Internet TV Blu-ray Disc Player`
`ka = Logitech Revue`
You'll also find these designations in `android.os.Build` as BOARD, DEVICE, and HARDWARE in addition to the Market. | adding to Paul's answer:
`cosmo = LG Google TV` |
9,492,617 | For example I am looking for a way to search every spot in a list to see where an object is located. Some example psuedocode could go:
```
for every column in current row:
if column is the first one:
do this
if column in the last one:
do that
else:
find the previous row a... | 2012/02/29 | [
"https://Stackoverflow.com/questions/9492617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220097/"
] | `asura = Sony Internet TV`
`eagle = Sony Internet TV Blu-ray Disc Player`
`ka = Logitech Revue`
You'll also find these designations in `android.os.Build` as BOARD, DEVICE, and HARDWARE in addition to the Market. | NSGZS7 = [Sony](http://store.sony.com/webapp/wcs/stores/servlet/ProductDisplay?catalogId=10551&storeId=10151&langId=-1&productId=8198552921666462151) 2nd Generation Set Top Box (non-Blue-Ray)
VAP430 = [Vizio](http://www.vizio.com/streamplayer/overview) Stream player
`Berlin = Marvell ARMADA 1500` (I think this is a r... |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | scofflaw : –noun
1.
a person who flouts the law, especially one who fails to pay fines owed.
2.
a person who flouts rules, conventions, or accepted practices.
<http://dictionary.reference.com/browse/scofflaw> | How about *Rebel*? Rebels resist convention. |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | For one-worders, I like @Robusto's "self-important" and @Nick's "presumptuous."
I'll add "inconsiderate," since I don't see that it's been added yet.
I've also described people with similar tendencies as "having an unjustified sense of entitlement," though I usually leave out "unjustified."
"scofflaw" is a fine wor... | He's a *loose cannon*:
>
> an unpredictable or uncontrolled
> person who is likely to cause
> unintentional damage.
>
>
>
-New Oxford American
>
> a person whose reckless behavior
> endangers the efforts or welfare of
> others.
>
>
>
-Dictionary.com
(My initial answer was going to be *[maverick](http:/... |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | He's a *loose cannon*:
>
> an unpredictable or uncontrolled
> person who is likely to cause
> unintentional damage.
>
>
>
-New Oxford American
>
> a person whose reckless behavior
> endangers the efforts or welfare of
> others.
>
>
>
-Dictionary.com
(My initial answer was going to be *[maverick](http:/... | May be a bit extreme but: *psychopath* or *megalomaniac* |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | What—nobody thought of "pompous"? [From Webster](http://www.merriam-webster.com/dictionary/pompous):
>
> pompous - having or exhibiting self-importance : arrogant
>
>
> | May be a bit extreme but: *psychopath* or *megalomaniac* |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | For one-worders, I like @Robusto's "self-important" and @Nick's "presumptuous."
I'll add "inconsiderate," since I don't see that it's been added yet.
I've also described people with similar tendencies as "having an unjustified sense of entitlement," though I usually leave out "unjustified."
"scofflaw" is a fine wor... | Perhaps **solipsist** might work here? |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | Insensitive? Insensible? Callous, as in "callous disregard"? | What about just *selfish*? He certainly seems so. |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | What about *misfit* since you said 'rules doesn't apply to him'? | I kind of like "self-important gadfly", but that's just me. "Gadfly" can have positive connotations when not qualified. |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | You can use *egocentric*, or *egocentristic*. | What about just *selfish*? He certainly seems so. |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | He's a *loose cannon*:
>
> an unpredictable or uncontrolled
> person who is likely to cause
> unintentional damage.
>
>
>
-New Oxford American
>
> a person whose reckless behavior
> endangers the efforts or welfare of
> others.
>
>
>
-Dictionary.com
(My initial answer was going to be *[maverick](http:/... | How about *prima donna*, one who thinks the rules apply to others and not them. |
16,850 | I'm trying to write a letter to the editor of my local paper about their report of a man who doesn't think the rules apply to him. Is there a word for this? He's a bit of an egoist, demanding to speak at city council meetings after the public hearing portion of the meeting has been closed. | 2011/03/18 | [
"https://english.stackexchange.com/questions/16850",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/3546/"
] | Deluded, entitled, overgrown spoilt brat. | Perhaps **solipsist** might work here? |
58,846,346 | I receive the below error which complains about the `Collections.sort();` line:
>
> Exception in thread "main" java.lang.Error: Unresolved compilation problem:
> The method sort(List) in the type Collections is not applicable for the arguments ()
>
>
>
Here's my code:
```
import java.util.*;
/*
* To change t... | 2019/11/13 | [
"https://Stackoverflow.com/questions/58846346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12369407/"
] | Use a `List` instead of a `Queue` (because it's `Collections.sort(List, Comparator)`). And don't use raw-types!
```
List<Modules> allModules = new LinkedList<>();
```
Then change
```
allModules.remove();
```
to
```
allModules.remove(0);
```
Finally, call `Collections.sort` and display the result like
```
Syst... | >
> The method sort(List) in the type Collections is not applicable for the arguments ()
>
>
>
The error tells you that you need to pass a `List` argument to `Collections.sort()`, but you are not passing any arguments. |
4,281,158 | I have a requirement to use AND/OR operator to hibernate detached criteria queries.
I want to emulate SQL eqivalent to:
```
Select * from myTable where city in ( X, Y ) OR city in (A,B);
```
// Note i need to use multiple 'In' here
How to create citeria query to use 'OR' operator.
Something like
```
DetachedCri... | 2010/11/25 | [
"https://Stackoverflow.com/questions/4281158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/520685/"
] | Use `Restrictions.conjunction()` and `Restrictions.disjunction()` to create the hierarchy of conditions.
Look [here - section 15.2](http://docs.jboss.org/hibernate/core/3.3/reference/en/html/querycriteria.html) and [here](http://www.java2s.com/Tutorial/Java/0350__Hibernate/RestrictionsDisjunction.htm)
---
EDIT:
I s... | Do the following steps:
Step-1.0: Create Query Criteria
```
Criteria myQueryCrit = session.createCriteria(XYZ.class, "xyz");
```
Step-2.0: For Handling OR conditions of Query:
2.1) First you need to create Disjunction object, say, myQueryDisjunc.
```
Disjunction myQueryDisjunc = Restrictions.disjunction();
```
... |
49,162,190 | My website cannot go live!
```
The following is my web server setup.
1. Rogers modem – Hitron CODA-4582
2. Port Forwarding
Application Name Public Private Protocol Local IP Address
HTTP 80 – 80 800 – 800 TCP 192.168.0.201
HTTPS 443 – 443 883 – 883 ... | 2018/03/07 | [
"https://Stackoverflow.com/questions/49162190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4974570/"
] | You can use `Match` to locate the column, and `Index` to return that column, and pass it to `Countif`
```
=COUNTIF(INDEX(1:1048576,,MATCH("Business",1:1,0)),"test")
``` | You can use `INDIRECT` to convert a string to a Range. So, `=COUNTIF(INDIRECT("E:E"),"test")` evaluates to `=COUNTIF(E:E,"test")`:
```
=COUNTIF(INDIRECT(SUBSTITUTE(ADDRESS(1,MATCH("Business",A:E,0),4),"1","")&":"&SUBSTITUTE(ADDRESS(1,MATCH("Business",A:E,0),4),"1","")),"test")
``` |
72,923,184 | I'm interested in how `List.init` and other library functions are implemented in OCaml. Where can I see the implementations? I checked this official link: <https://v2.ocaml.org/api/List.html> and only found the function signatures. | 2022/07/09 | [
"https://Stackoverflow.com/questions/72923184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18201731/"
] | OCaml, including its standard library, is entirely open source and at time of writing hosted on GitHub here: <https://github.com/ocaml/ocaml/>
The `List.init` function (located [here](https://github.com/ocaml/ocaml/blob/af13e29e0499d479035b064d9d70d9614e76a4fe/stdlib/list.ml#L62-L82)) is split across a couple utility ... | You can always read the implementation in the sources: <https://github.com/ocaml/ocaml/blob/trunk/stdlib/list.ml> |
72,923,184 | I'm interested in how `List.init` and other library functions are implemented in OCaml. Where can I see the implementations? I checked this official link: <https://v2.ocaml.org/api/List.html> and only found the function signatures. | 2022/07/09 | [
"https://Stackoverflow.com/questions/72923184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18201731/"
] | If you have an OCaml source release, you can find the standard library implementation in the `stdlib` directory. The list implementation is `stdlib/list.ml`.
Here is `List.init`:
```
let rec init_tailrec_aux acc i n f =
if i >= n then acc
else init_tailrec_aux (f i :: acc) (i+1) n f
let rec init_aux i n f =
if... | You can always read the implementation in the sources: <https://github.com/ocaml/ocaml/blob/trunk/stdlib/list.ml> |
72,923,184 | I'm interested in how `List.init` and other library functions are implemented in OCaml. Where can I see the implementations? I checked this official link: <https://v2.ocaml.org/api/List.html> and only found the function signatures. | 2022/07/09 | [
"https://Stackoverflow.com/questions/72923184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18201731/"
] | OCaml, including its standard library, is entirely open source and at time of writing hosted on GitHub here: <https://github.com/ocaml/ocaml/>
The `List.init` function (located [here](https://github.com/ocaml/ocaml/blob/af13e29e0499d479035b064d9d70d9614e76a4fe/stdlib/list.ml#L62-L82)) is split across a couple utility ... | If you have an OCaml source release, you can find the standard library implementation in the `stdlib` directory. The list implementation is `stdlib/list.ml`.
Here is `List.init`:
```
let rec init_tailrec_aux acc i n f =
if i >= n then acc
else init_tailrec_aux (f i :: acc) (i+1) n f
let rec init_aux i n f =
if... |
197,266 | Since I switched to Ubuntu 12.04 I'd only missed one thing.
A program which could launch typewriter sounds while typing. For instance, in Windows I used this: <http://www.colorpilot.com/soundpilot.html> for a long time.
I learned then that this writing program: <http://gottcode.org/focuswriter/> had the sounds but on... | 2012/10/06 | [
"https://askubuntu.com/questions/197266",
"https://askubuntu.com",
"https://askubuntu.com/users/107053/"
] | There are some implementations to play a sound for every keypress, one of them is "[keypress](https://github.com/chrelad/keypress)" on Github.com, made by Github user "[chrelad](https://github.com/chrelad)". It's a fork of [linux-typewriter](https://github.com/colszowka/linux-typewriter).
Instructions on how to set it... | Have you ever used IncrediMail? You probably like its old but lovely typewriter sound effects when writing. But this sound effects can’t appear in Gmail or other text editing tools. Tiper, to eliminate this regret for you.
Copyright: appnee.com/tiper/#ixzz2GVXpQR7s
Under Creative Commons License: Attribution Non-Co... |
197,266 | Since I switched to Ubuntu 12.04 I'd only missed one thing.
A program which could launch typewriter sounds while typing. For instance, in Windows I used this: <http://www.colorpilot.com/soundpilot.html> for a long time.
I learned then that this writing program: <http://gottcode.org/focuswriter/> had the sounds but on... | 2012/10/06 | [
"https://askubuntu.com/questions/197266",
"https://askubuntu.com",
"https://askubuntu.com/users/107053/"
] | There are some implementations to play a sound for every keypress, one of them is "[keypress](https://github.com/chrelad/keypress)" on Github.com, made by Github user "[chrelad](https://github.com/chrelad)". It's a fork of [linux-typewriter](https://github.com/colszowka/linux-typewriter).
Instructions on how to set it... | Try this one: <https://github.com/aitjcize/Qwertickle>
This is exactly what you want. |
4,672,684 | For example, this is the code that I am using:
```
String commandString = "UPDATE Members SET UserName = @newName , AdminLevel = @userLevel WHERE UserID = @userid";
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlconnectionstring"].ConnectionString))
{
SqlCommand cmd = new ... | 2011/01/12 | [
"https://Stackoverflow.com/questions/4672684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147454/"
] | That code looks fine. Parameterisation is the way to go, as opposed to concatenating user-supplied values in an adhoc SQL statement which can open you up to sql injection attacks. This can also help with execution plan reuse.
The only thing I'd add, is I prefer to explicitly define the datatype and sizes of the parame... | It's safe against SQL injection because it's parameterized. Other security concerns, such as ensuring that @userid is not spoofed, are separate security concerns that should be dealt with in other layers of your application. |
4,672,684 | For example, this is the code that I am using:
```
String commandString = "UPDATE Members SET UserName = @newName , AdminLevel = @userLevel WHERE UserID = @userid";
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlconnectionstring"].ConnectionString))
{
SqlCommand cmd = new ... | 2011/01/12 | [
"https://Stackoverflow.com/questions/4672684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/147454/"
] | That code looks fine. Parameterisation is the way to go, as opposed to concatenating user-supplied values in an adhoc SQL statement which can open you up to sql injection attacks. This can also help with execution plan reuse.
The only thing I'd add, is I prefer to explicitly define the datatype and sizes of the parame... | That's still a static query string. It's not really "dynamic" sql until you also build parts of the string on the fly — something like this:
```
var sql = "SELECT columns FROM Table WHERE 1=1";
if (!string.IsNullOrEmpty(txtName.Text)) sql += " AND Name LIKE '%' + @Name + '%'";
if (!string.IsNullOrEmpty(txtDesc.Text)) ... |
33,580 | I have written a class to calculate business hours for Case age in business hours. The class works great my issue is when trying to write decent test code for the class.
In following testing best practices, I want to create all my own test data and not rely on existing data (seeAllDate=true). I would assume that in or... | 2014/04/24 | [
"https://salesforce.stackexchange.com/questions/33580",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/3277/"
] | You don't need to use @SeeAllData=true to be able to access the existing BusinessHours, as this is organization data rather than user data. This isn't that well documented - the concept is covered at :
<https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_testing_data_access.htm>
but BusinessHours isn't... | 1. You can get coverage and test your scenarios implementing the **StubProvider** (<https://developer.salesforce.com/docs/atlas.en-us.224.0.apexcode.meta/apexcode/apex_testing_stub_api.htm>).
2. Working with Salesforce DX and loading metadata, **BusinessHours** from source, you can test various scenarios that way (Busi... |
55,191 | I was trying to setup my new Raspberry Pi 3 (Model B). I do have a wireless mouse and monitor but no keyboard so I decided to go for a headless-ish setup. Here's what I did:
1. I installed the latest version of NOOBS on my SD card and inserted into the Pi.
2. I connected my Pi to the monitor and powered it up.
3. I cl... | 2016/09/19 | [
"https://raspberrypi.stackexchange.com/questions/55191",
"https://raspberrypi.stackexchange.com",
"https://raspberrypi.stackexchange.com/users/53710/"
] | I don't think using `arp` this way is definitive. You are just looking at a cache on the Mac. A better tool in this context would be `nmap`.
If that address doesn't respond to pings and you haven't done something unusual to the pi, it is not the pi's address and probably doesn't really belong to anything, hence you g... | tl;dr: Use a different ip address
---------------------------------
I know this is an old question but [goldilocks answer](https://raspberrypi.stackexchange.com/a/55195) above recently helped me. It's quite long so I want to extract the part that helped me:
>
> *If you configured it to use a static address it will n... |
34,792,586 | I have a column with numbers and I want to calculate the average of all non-zero numbers preceding a zero. E.g.: If I have a column called Units, I would expect the Average column to get populated if I write the formula.
```
Units Average
32 32
33 32
31 32
0 0
0 0
1 2
2 2
3 2... | 2016/01/14 | [
"https://Stackoverflow.com/questions/34792586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2816461/"
] | You can do this quite simply with formulas if you just use a single helper column, as follows [assumes that your data is in column A starting at A2, your helper column is in column B starting at B2, and your results will be in column C starting at C2]:
Helper column [Put in B2 and drag down]:
```
=IF(A2=0, "", IF(A1=... | Not quite as simple and short as I would have whished for but, nonetheless, here it is:
```
Option Base 1
Function myavg(r As Range)
Dim i%, i0%, j%, n%, ia, a, oa()
ia = r
n = UBound(ia, 1) ' get number of rows
ReDim oa(n, 1) ' prepare an output array with same no of rows
a = 0: i0 = 0 ' ... |
34,792,586 | I have a column with numbers and I want to calculate the average of all non-zero numbers preceding a zero. E.g.: If I have a column called Units, I would expect the Average column to get populated if I write the formula.
```
Units Average
32 32
33 32
31 32
0 0
0 0
1 2
2 2
3 2... | 2016/01/14 | [
"https://Stackoverflow.com/questions/34792586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2816461/"
] | You can do this quite simply with formulas if you just use a single helper column, as follows [assumes that your data is in column A starting at A2, your helper column is in column B starting at B2, and your results will be in column C starting at C2]:
Helper column [Put in B2 and drag down]:
```
=IF(A2=0, "", IF(A1=... | Just to show a completely different approach:
```
Public Function special_average(rng As Range)
If rng.Value = 0 Then special_average = "": Exit Function
Dim i As Long, lower_rng As Range, str As String
Set lower_rng = rng
If rng.Row > 1 Then str = rng.Offset(-1, 0).Text
While str <> "0" And Len(str) > 0 An... |
61,502,196 | I recently upgraded my project to Laravel 7 from 5.6.
The upgrade itself worked out without any issues and the project is in a usable state. Now I want to add authentication to the project so that API Users can register and login.
Registering a user and login works, but as soon as I use the "auth" middleware I get thi... | 2020/04/29 | [
"https://Stackoverflow.com/questions/61502196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13318540/"
] | Seems like there is no other way , these are the Extensions I am using currently
```
fun NavController.isFragmentInBackStack(destinationId: Int) =
try {
getBackStackEntry(destinationId)
true
} catch (e: Exception) {
false
}
```
and
```
fun Fragment.isFragmentInBackStack(destinati... | Yes, it seems to be the only way for today
```
try {
getBackStackEntry(resId)
} catch (ignored: Throwable) {
}
``` |
61,502,196 | I recently upgraded my project to Laravel 7 from 5.6.
The upgrade itself worked out without any issues and the project is in a usable state. Now I want to add authentication to the project so that API Users can register and login.
Registering a user and login works, but as soon as I use the "auth" middleware I get thi... | 2020/04/29 | [
"https://Stackoverflow.com/questions/61502196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13318540/"
] | Seems like there is no other way , these are the Extensions I am using currently
```
fun NavController.isFragmentInBackStack(destinationId: Int) =
try {
getBackStackEntry(destinationId)
true
} catch (e: Exception) {
false
}
```
and
```
fun Fragment.isFragmentInBackStack(destinati... | A simple extension function:
```
fun NavController.isFragmentRemovedFromBackStack(destinationId: Int) =
try {
getBackStackEntry(destinationId)
false
} catch (e: Exception) {
true
}
``` |
61,502,196 | I recently upgraded my project to Laravel 7 from 5.6.
The upgrade itself worked out without any issues and the project is in a usable state. Now I want to add authentication to the project so that API Users can register and login.
Registering a user and login works, but as soon as I use the "auth" middleware I get thi... | 2020/04/29 | [
"https://Stackoverflow.com/questions/61502196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13318540/"
] | Seems like there is no other way , these are the Extensions I am using currently
```
fun NavController.isFragmentInBackStack(destinationId: Int) =
try {
getBackStackEntry(destinationId)
true
} catch (e: Exception) {
false
}
```
and
```
fun Fragment.isFragmentInBackStack(destinati... | To check if any fragment exists on stack or if the fragment is first I'm using this function:
```
if (findNavController(R.id.nav_host).previousBackStackEntry?.id != null)
//Fragment exists in back stack
else
//No fragment exists in back stack
``` |
56,390,825 | We have 2 images that we fetched from JSON:
1.Mask image [ name starts with **mask\_** ]
2.Car image [ name starts with other than **mask\_** ]
[](https://i.stack.imgur.com/99HlW.png)
**Requirement** :
`onclick` Mask image , i want to display fi... | 2019/05/31 | [
"https://Stackoverflow.com/questions/56390825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You may try with the following approach. The main part is that each row is transformed into 12-row table, with additional `Increase` column and appropriate `WHERE` clause.
Input:
```
CREATE TABLE #SampleData(
ID VARCHAR(10),
val1 INT,
val2 INT,
val3 INT,
val4 INT,
val5 INT,
val6 INT,
val7 INT,... | If I understood correctly what you were aiming for, you can to that using a select case like this:
```
select result.Id,
-- result.resulttext
LEN(replace(substring(result.resulttext,1, charindex('0', result.resulttext)-1), '1', '')) as finaltesult
from
(select ID,
case when S.val1 <= S.val2 ... |
3,551,946 | I'm kind of new to the Java world, and I need to debug a restful Javax Web Service application.
Some pages raise exceptions, and they are logged correctly, but I would like to have the URL of the page that called the code, inside of my logs, as well as the stacktrace.
GET and POST information would be vital too.
Is... | 2010/08/23 | [
"https://Stackoverflow.com/questions/3551946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18879/"
] | Since you want this in your error logs along with (or close to) the stacktrace,
you probably need a [`Filter`](http://java.sun.com/products/servlet/Filters.html).
Implement the `doFilter()` method to check and log the calling URL for each request. I've given some sample code below.
Once you get access to the [`Htt... | Yes... use [AccessLogValve](http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Access_Log_Valve).
For example, in `c:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\server.xml`, put something like the following into your `<Host>` element:
```
<Valve className="org.apache.catalina.valves.AccessLogV... |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | Use `...array` for the values of an array.
```js
let growthArr = [{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}];
let parentArr = [{
id: 'low',
color: '#fafafa'
}, {
id: 'med-low',
color: '#B62721'
}, {
id: 'med',
color... | All you need for this is the handy [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)
```js
const
growthArr = getGrowthArr(),
parentArr = getParentArr();
growthArr.push(...parentArr);
console.log(growthArr);
function getGrowthArr() {
return [{
name: '... |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | Use `...array` for the values of an array.
```js
let growthArr = [{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}];
let parentArr = [{
id: 'low',
color: '#fafafa'
}, {
id: 'med-low',
color: '#B62721'
}, {
id: 'med',
color... | ```
You have to use **concat** instead of push
```
```js
let growthArr = [
{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}
]
let parentArr = [
{
id: 'low',
color:... |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | Use `...array` for the values of an array.
```js
let growthArr = [{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}];
let parentArr = [{
id: 'low',
color: '#fafafa'
}, {
id: 'med-low',
color: '#B62721'
}, {
id: 'med',
color... | Use array concat() method. So the syntax would be
```
parentArr.concat(growthArr);
``` |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | Use the `...` syntax with `.push()`
```
growthArr.push(...parentArr)
```
---
This works because `.push()` takes any number of arguments, and pushes them all into the targeted array.
***Note:*** This mutates the original array without creating a new one and overwriting it. This can be important if there are other r... | Use array concat() method. So the syntax would be
```
parentArr.concat(growthArr);
``` |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | Use `...array` for the values of an array.
```js
let growthArr = [{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}];
let parentArr = [{
id: 'low',
color: '#fafafa'
}, {
id: 'med-low',
color: '#B62721'
}, {
id: 'med',
color... | This can also be done with destructuring in es6 while creating a new array:
```
const combined = [...growthArr, ...parentArr];
``` |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | `concat` is what you want to use.
```js
let growthArr = [{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}]
let parentArr = [{
id: 'low',
color: '#fafafa'
}, {
id: 'med-low',
color: '#B62721'
}, {
id: 'med',
... | Try this `.concat`. `parentArr.concat(growthArr)` |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | Use `parentArr.concat(growthArr)`.
JS can be as simple as that! | All you need for this is the handy [spread syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)
```js
const
growthArr = getGrowthArr(),
parentArr = getParentArr();
growthArr.push(...parentArr);
console.log(growthArr);
function getGrowthArr() {
return [{
name: '... |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | `concat` is what you want to use.
```js
let growthArr = [{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}]
let parentArr = [{
id: 'low',
color: '#fafafa'
}, {
id: 'med-low',
color: '#B62721'
}, {
id: 'med',
... | ```
You have to use **concat** instead of push
```
```js
let growthArr = [
{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}
]
let parentArr = [
{
id: 'low',
color:... |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | Use the `...` syntax with `.push()`
```
growthArr.push(...parentArr)
```
---
This works because `.push()` takes any number of arguments, and pushes them all into the targeted array.
***Note:*** This mutates the original array without creating a new one and overwriting it. This can be important if there are other r... | This can also be done with destructuring in es6 while creating a new array:
```
const combined = [...growthArr, ...parentArr];
``` |
62,560,978 | I'm attempting to combine my two array, but move only the object.
I have an array called `parentArr` that I am attempting to combine with `growthArr`. When using the `.push()` method it is returning `parentArr` as an array inside of `growthArr`. I am attempting to combine the objects from `parentArr` and not have it n... | 2020/06/24 | [
"https://Stackoverflow.com/questions/62560978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13386015/"
] | ```
You have to use **concat** instead of push
```
```js
let growthArr = [
{
name: 'online stores',
parent: 'high'
}, {
name: 'retail stores',
parent: 'low'
}, {
name: 'walk in',
parent: 'high'
}
]
let parentArr = [
{
id: 'low',
color:... | This can also be done with destructuring in es6 while creating a new array:
```
const combined = [...growthArr, ...parentArr];
``` |
2,511,610 | How to use in jQuery data from window.open
```
w = window.open("http://google.com",
'test_window',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=1');
browser = w.document;
// execute commands in browser
$(browser).ready(function(){
alert($('input', browser).attr('name')... | 2010/03/24 | [
"https://Stackoverflow.com/questions/2511610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I found the solution to this issue and posted it here:
<http://forums.asp.net/t/1554406.aspx>
This post had the answer I was looking for: <http://lionsden.co.il/codeden/?p=137&cpage=1#comment-143>
>
> **What is Page\_BlockSubmit**
>
>
> When the user clicks on a button causing a full post back, after running Page\_... | I was having the same problem, though all I have is a Textbox using a RangeValidator, along with a submit button. When the user entered a number outside the range and clicked Submit, the invalid-number message came up. If they changed the number to a valid one and clicked Submit again, the message went away, but the on... |
8,310,227 | I'm trying to create an object in javascript with PHP. This is my script:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a){
$i++;
echo '{"value":"'.$a['genre'].'", "name":"'.$a['nam... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8310227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/954930/"
] | You forgot to close the `.ready()` method and the anonymous function inside of it.
Try this:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a)
{
$i++... | Your function is not closed properly:
```
}
}
?>
];
}); // <--- add this
</script>
``` |
8,310,227 | I'm trying to create an object in javascript with PHP. This is my script:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a){
$i++;
echo '{"value":"'.$a['genre'].'", "name":"'.$a['nam... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8310227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/954930/"
] | You forgot to close the `.ready()` method and the anonymous function inside of it.
Try this:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a)
{
$i++... | This:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a)
{
echo '{"value":"'.$a['genre'].'", "name":"'.$a['name'].'"}';
if($i < $last)
... |
8,310,227 | I'm trying to create an object in javascript with PHP. This is my script:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a){
$i++;
echo '{"value":"'.$a['genre'].'", "name":"'.$a['nam... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8310227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/954930/"
] | As the comment says you should consider using (php function)json\_encode instead, which will turn...
```
php:
$a = array(
array("gender"=> "male", "name"=> "Bob"),
array("gender"=> "female", "name"=> "Annie")
);
Into json:
[
{gender:"male", name:"Bob"},
{gender:"female", name:"Annie"}
]
```
Echoing json\... | Your function is not closed properly:
```
}
}
?>
];
}); // <--- add this
</script>
``` |
8,310,227 | I'm trying to create an object in javascript with PHP. This is my script:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a){
$i++;
echo '{"value":"'.$a['genre'].'", "name":"'.$a['nam... | 2011/11/29 | [
"https://Stackoverflow.com/questions/8310227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/954930/"
] | As the comment says you should consider using (php function)json\_encode instead, which will turn...
```
php:
$a = array(
array("gender"=> "male", "name"=> "Bob"),
array("gender"=> "female", "name"=> "Annie")
);
Into json:
[
{gender:"male", name:"Bob"},
{gender:"female", name:"Annie"}
]
```
Echoing json\... | This:
```
<script>
$(document).ready(function(){
var genres = [
<?php
$last = count($userGenres) - 1;
$i = 0;
foreach($userGenres as $a)
{
echo '{"value":"'.$a['genre'].'", "name":"'.$a['name'].'"}';
if($i < $last)
... |
14,904,923 | I've done my best to bring this down to a minimal working example, but please excuse the wall of code at the bottom. I've got a set of paths, in this particular case they spell the word "DOG". I'd like to scale them to fit in a box *without preserving aspect ratio*.
For example, with a suitable definition of `DOG` I ge... | 2013/02/15 | [
"https://Stackoverflow.com/questions/14904923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/249341/"
] | Use scale in the [`transform`](http://www.w3.org/TR/SVG/coords.html#TransformAttribute) attribute in an outer `<g>` container.
```
transform="scale(x, y)"
```
With a little JavaScript, you can find the dimensions about an arbitrary path:
```
var box = path.getBBox();
var eleWidth = box.width, eleHeight = box.height... | You could also use [`ViewBox`](http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) together with [`preserveAspectRatio="none"`](http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute) for a result that, in my opinion, almost always gives me the desired result. That way you don't have to do calculations to... |
7,734,113 | I've spent a while trying to get this to work however I've had little luck.
I have the following XML:
```
<message>
<buckets>
<bucket>
<channels>
<channel>Test A</channel>
<channel>Test B</channel>
</channels>
<messageText>This is sample text</messageText>
</bucket>
<... | 2011/10/12 | [
"https://Stackoverflow.com/questions/7734113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394491/"
] | Try this:
```
import javax.xml.bind.JAXBContext;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
public class JaxbStuff {
public static voi... | typically, jaxb uses wrapper objects around lists. so, you would have a Buckets class which has `List<Bucket> getBuckets()`, and you would have a Channels class with `List<Channel> getChannels()`. i believe there are extra annotations you can use to avoid the extra wrapper classes, but they are not frequently used (at ... |
29,833,721 | I have this list of dictionaries:
```
list_of_ds = [
{'a': [1, 2], 'b': [4, 5], 'c': [6, 7]},
{'a': [4], 'b': [56], 'c': [46]},
{'a': [92], 'b': [65], 'c': [43]}
]
```
and I want this as output:
```
{'a': [1, 2, 4, 92], 'b': [4, 5, 56, 65], 'c': [6, 7, 46, 43]}
```
Until now ...
I tried
```
d_of_ds ... | 2015/04/23 | [
"https://Stackoverflow.com/questions/29833721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1668293/"
] | Using `reduce` is not a good idea in this case.Also your lambda function has a wrong logic at all, because you are trying to update the whole of dictionaries together, not their elements see the following :
```
>>> a={'a':[1,2], 'b':[4,5],'c':[6,7]}
>>> a.update({'a':[4], 'b':[56],'c':[46]})
>>> a
{'a': [4], 'c': [46]... | Not-so-efficient but pretty [`reduce`](https://docs.python.org/3/library/functools.html#functools.reduce) solution:
```
def f(x, y):
return {k: x.get(k, []) + y.get(k, []) for k in set(x).union(y)}
from functools import reduce
reduce(f, list_of_ds) # {'b': [4, 5, 56, 65], 'a': [1, 2, 4, 92], 'c': [6, 7, 46, 43]}
... |
29,833,721 | I have this list of dictionaries:
```
list_of_ds = [
{'a': [1, 2], 'b': [4, 5], 'c': [6, 7]},
{'a': [4], 'b': [56], 'c': [46]},
{'a': [92], 'b': [65], 'c': [43]}
]
```
and I want this as output:
```
{'a': [1, 2, 4, 92], 'b': [4, 5, 56, 65], 'c': [6, 7, 46, 43]}
```
Until now ...
I tried
```
d_of_ds ... | 2015/04/23 | [
"https://Stackoverflow.com/questions/29833721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1668293/"
] | Using `reduce` is not a good idea in this case.Also your lambda function has a wrong logic at all, because you are trying to update the whole of dictionaries together, not their elements see the following :
```
>>> a={'a':[1,2], 'b':[4,5],'c':[6,7]}
>>> a.update({'a':[4], 'b':[56],'c':[46]})
>>> a
{'a': [4], 'c': [46]... | without importing any library
```
>>> new_dict = {}
>>> new_dict
{}
>>> for dct in list_of_ds:
for key,val in dct.items():
if key not in new_dict.keys(): new_dict[key] = val
else: new_dict[key].extend(val)
>>> new_dict
{'a': [1, 2, 4, 92], 'c': [6, 7, 46, 43], 'b': [4, 5, 56, 65]}
``... |
29,833,721 | I have this list of dictionaries:
```
list_of_ds = [
{'a': [1, 2], 'b': [4, 5], 'c': [6, 7]},
{'a': [4], 'b': [56], 'c': [46]},
{'a': [92], 'b': [65], 'c': [43]}
]
```
and I want this as output:
```
{'a': [1, 2, 4, 92], 'b': [4, 5, 56, 65], 'c': [6, 7, 46, 43]}
```
Until now ...
I tried
```
d_of_ds ... | 2015/04/23 | [
"https://Stackoverflow.com/questions/29833721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1668293/"
] | Not-so-efficient but pretty [`reduce`](https://docs.python.org/3/library/functools.html#functools.reduce) solution:
```
def f(x, y):
return {k: x.get(k, []) + y.get(k, []) for k in set(x).union(y)}
from functools import reduce
reduce(f, list_of_ds) # {'b': [4, 5, 56, 65], 'a': [1, 2, 4, 92], 'c': [6, 7, 46, 43]}
... | without importing any library
```
>>> new_dict = {}
>>> new_dict
{}
>>> for dct in list_of_ds:
for key,val in dct.items():
if key not in new_dict.keys(): new_dict[key] = val
else: new_dict[key].extend(val)
>>> new_dict
{'a': [1, 2, 4, 92], 'c': [6, 7, 46, 43], 'b': [4, 5, 56, 65]}
``... |
17,628,788 | I try this:
```
<script type="text/javascript">
$(document).ready(function() {
$(".fb-like").attr('data-href',encodeURIComponent(location.href));
});
</script>
<div class="fb-like" data-href="" data-send="false" data-width="450" data-show-faces="false" data-font="verdana"></div>
```
But data-href is empt... | 2013/07/13 | [
"https://Stackoverflow.com/questions/17628788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2571593/"
] | I haven't checked the syntax. Also I don't know if your query works or not but here's my try.
```
//unwind
DBObject unwind = new BasicDBObject("$unwind", "$scorearray");
// Now the $group operation
DBObject groupFields = new BasicDBObject("player", "$player");
groupFields.put("v... | You can use this library:
<https://github.com/EqualExperts/mongo-shell-like-query>
With this library you can use query string like:
>
> db.users.aggregate([{'$match':{'salary' : {$gte:'from#Long',$lte:'to#Long'}}}, { $group: {\_id:'$role', 'age': {$sum: '$age' } } }, { '$sort': { 'age': -1 } }, { '$limit': 5 }])
>
>... |
38,213,942 | I'm trying to do a simple GET request using QNetworkReply but finished() never get's called, here is my code
```
QtTest::QtTest(QWidget *parent):QWidget(parent){
ui.setupUi(this);
auto network_access_manager = new QNetworkAccessManager(this);
auto reply = network_access_manager->get(QNetworkRequest(QUrl("http:/... | 2016/07/05 | [
"https://Stackoverflow.com/questions/38213942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6553768/"
] | Verify if you are declaring download\_finished() as a slot.
```
class QtTest : public QObject
{
Q_OBJECT
public:
QtTest(QObject *parent = 0);
private slots:
void download_finished();
};
``` | change your definition of download\_finished to include the reply;
The signal is; finished(QNetworkReply \*reply) so
```
QtTest::download_finished(QNetworkReply *reply)
{
.... etc
```
Make sure to include the parameter in the connect statement. |
33,914,774 | I start a fragment from activity, and this is when I want the orientation to change to landascape, but as soon as the app is back to the activity, I want the orientation to be dependent on the sensor. So far, I do it this way in my fragment:
```
getActivity().setRequestedOrientation(
ActivityInfo.SCREE... | 2015/11/25 | [
"https://Stackoverflow.com/questions/33914774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What you are actually doing in the `fragment` is setting the `orientation` of the `Activity` containing it. `getActivity()...`. So what you need to do is reset the orientation of the activity once the fragment is detached from the activity. You can, for example, override the `onDetach()` for your fragment and call the:... | The Best way is to use this code where you are going back to the activity. Because it will shift orientation to what user had set to its device.
```
yourActivityReference.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
```
if you donot want to use this then you can use
```
yourActivityReference.setR... |
4,471,231 | How do I get the coordinates of a WM\_NCHITTEST message in C# code?
I'd love to get the fastest way, because performance is a requirement. | 2010/12/17 | [
"https://Stackoverflow.com/questions/4471231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485098/"
] | From MSDN:
>
> **wParam**
>
> This parameter is not used.
>
>
> **lParam**
>
> The low-order word specifies
> the x-coordinate of the cursor. The
> coordinate is relative to the
> upper-left corner of the screen.
>
> The high-order word specifies the
> y-coordinate of the cursor. The
> coordinate ... | Up until this morning, I'd have agreed 100% with Thomas Levesques answer, I pulled the same information from msdn and the code (seemingly) worked perfectly. However, there's one case where this will bite you, it took me three hours to find the reason this afternoon.
The symptom I had was that, on one of my development... |
4,471,231 | How do I get the coordinates of a WM\_NCHITTEST message in C# code?
I'd love to get the fastest way, because performance is a requirement. | 2010/12/17 | [
"https://Stackoverflow.com/questions/4471231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485098/"
] | From MSDN:
>
> **wParam**
>
> This parameter is not used.
>
>
> **lParam**
>
> The low-order word specifies
> the x-coordinate of the cursor. The
> coordinate is relative to the
> upper-left corner of the screen.
>
> The high-order word specifies the
> y-coordinate of the cursor. The
> coordinate ... | I know this question was already answered and all but...
```
Point p = new Point(m.LParam.ToInt32());
```
System.Drawing.Point now has a constructor specifically designed to accept this exact value. Strictly speaking, I think this is probably the **easiest** way.
To be perfectly honest, I have no idea if this const... |
4,471,231 | How do I get the coordinates of a WM\_NCHITTEST message in C# code?
I'd love to get the fastest way, because performance is a requirement. | 2010/12/17 | [
"https://Stackoverflow.com/questions/4471231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/485098/"
] | Up until this morning, I'd have agreed 100% with Thomas Levesques answer, I pulled the same information from msdn and the code (seemingly) worked perfectly. However, there's one case where this will bite you, it took me three hours to find the reason this afternoon.
The symptom I had was that, on one of my development... | I know this question was already answered and all but...
```
Point p = new Point(m.LParam.ToInt32());
```
System.Drawing.Point now has a constructor specifically designed to accept this exact value. Strictly speaking, I think this is probably the **easiest** way.
To be perfectly honest, I have no idea if this const... |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | On this UPS, the 24v 40mmx40mmx10mm DC cooling fans were defective after a few months use, if you listen you can hear a grinding, screaching sound emmiting from the fan, the fan drag sends a error code to the CPU warning that the unit is under overload.
This fan cools the regulators just behind the fan. Replace the 2... | I was able to get my APC xs 900 fixed by removing the fan and cutting away the decal to expose the bearing and giving it a shot of WD-40 while it was running. I actually felt the fan RPM double with the oil. I reinstalled the fan and my unit was back in operation! |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | On this UPS, the 24v 40mmx40mmx10mm DC cooling fans were defective after a few months use, if you listen you can hear a grinding, screaching sound emmiting from the fan, the fan drag sends a error code to the CPU warning that the unit is under overload.
This fan cools the regulators just behind the fan. Replace the 2... | Replace the 40mm 24v fan and your problems will be over. Snip the wires, twist, solder, shrink tubing. It works like magic. I would never have believed that the fan could cause the overload problems. But... it does. I bought mine in a local electronics shop, but they are also available on ebay. Remember, that fan is 10... |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | On this UPS, the 24v 40mmx40mmx10mm DC cooling fans were defective after a few months use, if you listen you can hear a grinding, screaching sound emmiting from the fan, the fan drag sends a error code to the CPU warning that the unit is under overload.
This fan cools the regulators just behind the fan. Replace the 2... | It sounds to me like it is either dead / old battery or a general malfunction.
One thing about APC UPSs... Their price, you generally pay more, but they are generally brilliant quality and come with good support. You may want to email them and see what they say. |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | Replace the 40mm 24v fan and your problems will be over. Snip the wires, twist, solder, shrink tubing. It works like magic. I would never have believed that the fan could cause the overload problems. But... it does. I bought mine in a local electronics shop, but they are also available on ebay. Remember, that fan is 10... | It sounds to me like it is either dead / old battery or a general malfunction.
One thing about APC UPSs... Their price, you generally pay more, but they are generally brilliant quality and come with good support. You may want to email them and see what they say. |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | On this UPS, the 24v 40mmx40mmx10mm DC cooling fans were defective after a few months use, if you listen you can hear a grinding, screaching sound emmiting from the fan, the fan drag sends a error code to the CPU warning that the unit is under overload.
This fan cools the regulators just behind the fan. Replace the 2... | According to the [manual](http://www.apcmedia.com/salestools/ASTE-6Z7V73_R0_EN.pdf) if it happens every 5 hours, then the battery need change.
You don't describe what indicators light up though. |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | I had a MOSFET failure on my APC RS-1000 with the same observations as yours:
Overload light and constant alarm even when nothing was wired on the outputs.
They changed the board (rather the entire unit) and retained the batteries which were still functional.
Uh, I had some hard time working this out with the A... | On this UPS, the 24v 40mmx40mmx10mm DC cooling fans were defective after a few months use, if you listen you can hear a grinding, screaching sound emmiting from the fan, the fan drag sends a error code to the CPU warning that the unit is under overload.
This fan cools the regulators just behind the fan. Replace the 2... |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | I had a MOSFET failure on my APC RS-1000 with the same observations as yours:
Overload light and constant alarm even when nothing was wired on the outputs.
They changed the board (rather the entire unit) and retained the batteries which were still functional.
Uh, I had some hard time working this out with the A... | I was able to get my APC xs 900 fixed by removing the fan and cutting away the decal to expose the bearing and giving it a shot of WD-40 while it was running. I actually felt the fan RPM double with the oil. I reinstalled the fan and my unit was back in operation! |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | I had a MOSFET failure on my APC RS-1000 with the same observations as yours:
Overload light and constant alarm even when nothing was wired on the outputs.
They changed the board (rather the entire unit) and retained the batteries which were still functional.
Uh, I had some hard time working this out with the A... | It sounds to me like it is either dead / old battery or a general malfunction.
One thing about APC UPSs... Their price, you generally pay more, but they are generally brilliant quality and come with good support. You may want to email them and see what they say. |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | I had a MOSFET failure on my APC RS-1000 with the same observations as yours:
Overload light and constant alarm even when nothing was wired on the outputs.
They changed the board (rather the entire unit) and retained the batteries which were still functional.
Uh, I had some hard time working this out with the A... | Replace the 40mm 24v fan and your problems will be over. Snip the wires, twist, solder, shrink tubing. It works like magic. I would never have believed that the fan could cause the overload problems. But... it does. I bought mine in a local electronics shop, but they are also available on ebay. Remember, that fan is 10... |
79,340 | I have a Back-UPS XS 900 on a standalone Debian server that seems to randomly start sounding a constant overload alarm, **even with nothing plugged in**. The alarm continues to sound until I manually turn the unit off. Additionally, nothing seems to be logged when the alarm starts to sound.
Here is the output from `ap... | 2009/12/06 | [
"https://superuser.com/questions/79340",
"https://superuser.com",
"https://superuser.com/users/3221/"
] | I was able to get my APC xs 900 fixed by removing the fan and cutting away the decal to expose the bearing and giving it a shot of WD-40 while it was running. I actually felt the fan RPM double with the oil. I reinstalled the fan and my unit was back in operation! | It sounds to me like it is either dead / old battery or a general malfunction.
One thing about APC UPSs... Their price, you generally pay more, but they are generally brilliant quality and come with good support. You may want to email them and see what they say. |
2,199,228 | Would I solve for $ab^x = kx+m$ ? I am lost to how to solve it
This equation is what I need help on: $7\cdot 8^x +3 = 9x+2$
Im puzzled to how to solve this. | 2017/03/23 | [
"https://math.stackexchange.com/questions/2199228",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/374798/"
] | $\require{begingroup} \begingroup$
$\def\e{\mathrm{e}}\def\W{\operatorname{W}}\def\Wp{\operatorname{W\_0}}\def\Wm{\operatorname{W\_{-1}}}$
\begin{align}
ab^x &= kx+m
\tag{1}\label{1}
\end{align}
There is absolutely no need for any numerical methods in this case,
since the Lambert $\W$ function was specifically inve... | Yes indeed, plotting the linear function and the exponential function (or making a spreadsheet table) will show you clearly that there is no point of intersection. And if there were a point of intersection for such a pair of functions (with different coefficients), then you would generally need to solve for it numerica... |
983,042 | I've got a line in my bash script like this:
```
echo "`some_command`"
```
Now, `some_command` executes for around 1-2mins and it keeps printing alerts/messages in that interval.
Problem is when I execute my bash script, the script has no output for 1-2mins and then directly displays the output after complete execu... | 2017/12/04 | [
"https://askubuntu.com/questions/983042",
"https://askubuntu.com",
"https://askubuntu.com/users/285501/"
] | Taken from [Bash - Update terminal title by running a second command · U&L](https://stackoverflow.com/a/7110386/6164712) and slightly changed:
```none
trap 'echo -ne "\033]2;$(history 1 | sed "s/^[0-9 ]* \+//")\007"' DEBUG
```
This (ab)uses the `DEBUG` signal as a trigger to update the title with the last entry from... | The terminal window title could be changed by changing of the value of the variable [`$PS1`](https://www.gnu.org/software/bash/manual/bash.html#Shell-Variables) - the primary prompt string. [[1]](https://askubuntu.com/a/702773/566421) [[2]](https://askubuntu.com/a/774543/566421). We could combine this solution with the... |
30,239,705 | I'm trying to learn some advanced techniques. I have the following
query that executes monthly disenrollment information as of '(Date)'
with `union all`s.
Is there a shorter way of doing this? Executing this take a long
time.
Thanks!
```
select left((datename(mm, me.StateDisenrollDate)),3) as ReportedMonth,
me.State... | 2015/05/14 | [
"https://Stackoverflow.com/questions/30239705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3703170/"
] | You got the same column list and the same joins, just different WHERE-conditions, so simply combine them using `OR`:
```
SELECT LEFT((datename(mm, me.StateDisenrollDate)),3) AS ReportedMonth,
me.StateDisenrollDate,
me.ReinstatementDate,
me.MemberID,
dis.DRI_Name,
CASE
WHEN me.ReinstatementDate IS NULL THEN 'Disenr... | You say you are trying to separate into each month of the year, but you aren't doing any aggregations or calculations at all, just listing out a set of results.
You could just combine your where clauses into one (and change the where to check that the month and year parts of the two dates are the same)?
```
select le... |
18,925,808 | Im working on converting an existing site to a RWD but have been struggling with the header image. Following this tutorial (among others on the www) <http://alistapart.com/article/fluid-images>
I can't get the header image on this (or any) page to respond appropriately when scaling to below 480px
<http://www.your-adre... | 2013/09/20 | [
"https://Stackoverflow.com/questions/18925808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | There's at least two places where you have fixed widths
```
#Header a.header-home-link
```
and
```
#PageWrapper
```
Both a width of 960px and no max-width set - therefore your page is never going to get any smaller in width than 960px - if the browser window is any smaller, you'll just get a horizontal scrollbar ... | Take a look on your CSS #Header, your header image is a background!!! Your header block doesn't contain any `<img>`, there is nothing to scale. Try CSS3 rule `background-size` instead or insert it into the header block with `<img>`.
**CSS from your site** <http://www.your-adrenaline-fix.com/dirt-bikes-for-sale.html>:
... |
266,583 | In my last post [PostgreSQL: How to get a weekly average over a year including 'gap' weeks per animal from years of data?](https://dba.stackexchange.com/questions/259806/postgresql-how-to-get-a-weekly-average-over-a-year-including-gap-weeks-per-an) with the fiddle <http://sqlfiddle.com/#!17/0bff3/1>
I got a weekly coun... | 2020/05/06 | [
"https://dba.stackexchange.com/questions/266583",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/197864/"
] | One thing I can think of, is to generate a [date range](https://www.postgresql.org/docs/current/rangetypes.html) from the input date that splits the month into three parts. It's quite easy to keep the first two parts constant and have the third one vary:
```
create function get_first(p_input date)
returns daterange
... | I do not want to change my question above
From my example set ...
```
(... ),
('dog',1,'1865-05-24'),
('dog',11,'1869-05-02'),
('dog',1,'1869-05-06'),
('dog',1,'1869-05-12'),
('cat',1,'1870-01-01'),
('dog',2,'1872-06-06'),
('dog',1,'1876-04-24'),
('dog',1,'1882-05-01'),
('dog',1,'... |
36,745,900 | I am currentlly in the process of writing a Cake build script to build a number of ASP.NET MVC sites.
At the moment I am unable to see an option to pass arguments to MSBuild to produce the \_PublishedWebsites folder for deployment.
I believe the arguments that I need to pass are:
```
/p:OutDir=$(build.stagingDirec... | 2016/04/20 | [
"https://Stackoverflow.com/questions/36745900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6230560/"
] | The following example should set the correct MSBuild properties when building your website solution from Cake.
```
MSBuild("./src/Website.sln", new MSBuildSettings()
.WithProperty("OutDir", "$(build.stagingDirectory)")
.WithProperty("DeployOnBuild", "true")
.WithProperty("WebPublishMethod", "Package")
.WithPro... | For FileSystem publish it can be done this way:
```
MSBuild(/**project path**/, settings =>
settings.SetConfiguration(/**configuration**/)
.WithProperty("DeployTarget", "WebPublish")
.WithProperty("DeployOnBuild", /**boolean**/)
.WithProperty("PackageAsSingleFile", /**boolean**/)
.WithProperty("Web... |
64,713,063 | i'm working on a project requiring cmake. i'd like to add some custom rules to my makefile, but can't quite get my head around how to do it.
both c source files and header files are in the same directory. also in this same directory are a number of `.def` files, which are the sources for some of the header files #incl... | 2020/11/06 | [
"https://Stackoverflow.com/questions/64713063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1481193/"
] | It's not an issue but it's recommended to split your app routes. Let's say you have an AppModule that contains 3 big modules. It's better having the main app-routing.module and a route module for each big module then having it in the same app-routing.module.
remove artists/:artistID, create artists.routes.ts, import i... | **Hey, what you suggested isn't an issue**. You could also map an array of routes:
```
const artistPaths: string[] = ['artist', 'artists/:artistID'];
const artistRoutes: Route[] = artistPaths.map((path) => ({path, loadChildren: () => null}));
```
Then either:
1. Push this into the routes array:
```
routes.push(art... |
10,261,816 | I want to use multiple labels in my form. I am using the following code:
```
Label[] lblLeftUp = new Label[12];
for (int i = 0; i < 12; i++)
{
lblLeftUp[i] = new Label();
lblLeftUp[i].Location = new Point((100 + (20 * i)), 100);
lblLeftUp[i].Text = Convert.ToString(i + 1);
this.Controls.Add(lblLeftU... | 2012/04/21 | [
"https://Stackoverflow.com/questions/10261816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/807158/"
] | The labels are blocking eachother. So try this:
```
lblLeftUp[i].AutoSize = true;
``` | This happen because of `lblLeftUp[i].Location = new Point((100 + (20 * i)), 100);`.
How you can see, you set the wrong location for the following labels. Infact *20* isn't enough. So my recommendation is to set the location dipending on the size of the labels. So if you want the labels oredered in horizontal. Try this:... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The Eastern Han dynasty was an empire that was founded in 25 A.D. and can be considered as a recreation of the Western Han dynasty. The founder of the Eastern Han dynasty: Emperor Guangwu was a descendant of Emperor Jin of the Western Han dynasty. The Western Han dynasty was dissolved by Wang Mang who created the Xin d... | The state Qin conquered and unified all the warring states of China, and formed the first Chinese Empire in 221 BC befoe falling in about 207 BC. The Qin statea nd governmentwas totally destoryed, and various rebel groups ruled different parts of China.
One could claim that Han Dyanasty China from 202 BC to 220 AD was... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The Eastern Han dynasty was an empire that was founded in 25 A.D. and can be considered as a recreation of the Western Han dynasty. The founder of the Eastern Han dynasty: Emperor Guangwu was a descendant of Emperor Jin of the Western Han dynasty. The Western Han dynasty was dissolved by Wang Mang who created the Xin d... | The [Second Turkic Empire](https://en.m.wikipedia.org/wiki/Second_Turkic_Khaganate) was founded in 682 CE, about 50 years after the end of the [First (Eastern) Turkic Empire](https://en.m.wikipedia.org/wiki/First_Turkic_Khaganate).
The [German Reich](https://en.wikipedia.org/wiki/German_Reich)
was founded in 1871, abo... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The Eastern Han dynasty was an empire that was founded in 25 A.D. and can be considered as a recreation of the Western Han dynasty. The founder of the Eastern Han dynasty: Emperor Guangwu was a descendant of Emperor Jin of the Western Han dynasty. The Western Han dynasty was dissolved by Wang Mang who created the Xin d... | The **[Ottoman Sultanate](https://en.wikipedia.org/wiki/Ottoman_Empire)** was established sometime around 1300-1330 (the periodization is complicated because it evolved out of an existing, expanding beylik under [Osman I Ghazi](https://en.wikipedia.org/wiki/Osman_I); it's not clear when exactly they first started claim... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The Eastern Roman Empire (Byzantine Empire) fractured into several states after the Fourth Crusade.
[](https://i.stack.imgur.com/1UWkV.jpg)
Map of the aftermath of the Fourth Crusade from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Lat... | The state Qin conquered and unified all the warring states of China, and formed the first Chinese Empire in 221 BC befoe falling in about 207 BC. The Qin statea nd governmentwas totally destoryed, and various rebel groups ruled different parts of China.
One could claim that Han Dyanasty China from 202 BC to 220 AD was... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The Eastern Roman Empire (Byzantine Empire) fractured into several states after the Fourth Crusade.
[](https://i.stack.imgur.com/1UWkV.jpg)
Map of the aftermath of the Fourth Crusade from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Lat... | The [Second Turkic Empire](https://en.m.wikipedia.org/wiki/Second_Turkic_Khaganate) was founded in 682 CE, about 50 years after the end of the [First (Eastern) Turkic Empire](https://en.m.wikipedia.org/wiki/First_Turkic_Khaganate).
The [German Reich](https://en.wikipedia.org/wiki/German_Reich)
was founded in 1871, abo... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The Eastern Roman Empire (Byzantine Empire) fractured into several states after the Fourth Crusade.
[](https://i.stack.imgur.com/1UWkV.jpg)
Map of the aftermath of the Fourth Crusade from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Lat... | The **[Ottoman Sultanate](https://en.wikipedia.org/wiki/Ottoman_Empire)** was established sometime around 1300-1330 (the periodization is complicated because it evolved out of an existing, expanding beylik under [Osman I Ghazi](https://en.wikipedia.org/wiki/Osman_I); it's not clear when exactly they first started claim... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The state Qin conquered and unified all the warring states of China, and formed the first Chinese Empire in 221 BC befoe falling in about 207 BC. The Qin statea nd governmentwas totally destoryed, and various rebel groups ruled different parts of China.
One could claim that Han Dyanasty China from 202 BC to 220 AD was... | The [Second Turkic Empire](https://en.m.wikipedia.org/wiki/Second_Turkic_Khaganate) was founded in 682 CE, about 50 years after the end of the [First (Eastern) Turkic Empire](https://en.m.wikipedia.org/wiki/First_Turkic_Khaganate).
The [German Reich](https://en.wikipedia.org/wiki/German_Reich)
was founded in 1871, abo... |
68,444 | This is all horribly nebulous, and I understand it.
But are there any examples in history, when any existing empire had dissolved and was afterwards recreated to more or less the same territory it occupied during its peak for any meaningful period of time (let's say 50+ years)?
I welcome suggestions about how to make... | 2022/03/02 | [
"https://history.stackexchange.com/questions/68444",
"https://history.stackexchange.com",
"https://history.stackexchange.com/users/27293/"
] | The **[Ottoman Sultanate](https://en.wikipedia.org/wiki/Ottoman_Empire)** was established sometime around 1300-1330 (the periodization is complicated because it evolved out of an existing, expanding beylik under [Osman I Ghazi](https://en.wikipedia.org/wiki/Osman_I); it's not clear when exactly they first started claim... | The [Second Turkic Empire](https://en.m.wikipedia.org/wiki/Second_Turkic_Khaganate) was founded in 682 CE, about 50 years after the end of the [First (Eastern) Turkic Empire](https://en.m.wikipedia.org/wiki/First_Turkic_Khaganate).
The [German Reich](https://en.wikipedia.org/wiki/German_Reich)
was founded in 1871, abo... |
49,630,582 | I have two same schema tables :-
```
Table A : vendorname,branch,amount,region (partitioned by year,month,day)
Table B : vendorname,branch,amount,region (partitioned by year,month,day)
```
data in table A :
```
john,c1,112,us
john,c2,113,uk
john,c3,199,aus
```
data in table B:
```
john,c1,112,us
john,c2,113,... | 2018/04/03 | [
"https://Stackoverflow.com/questions/49630582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9591086/"
] | Solving it without loops and locks
----------------------------------
A simple implementation may look like this:
```
const Max = 8
var index int64
func Inc() int64 {
value := atomic.AddInt64(&index, 1)
if value < Max {
return value // We're done
}
// Must normalize, optionally reset:
v... | I assume your goal is to never let `index` has value equal or greater than `Max`. This can be solved using CAS (Compare-And-Swap) loop:
```
const Max = 8
var index int32
func add() int32 {
var next int32;
for {
prev := atomic.LoadInt32(&index)
next = prev + 1;
if next >= Max {
... |
3,654,342 | can you help me why it returns error.
part of code /publications/deleteItem/' + valueClicked works ok, i checked (proper item is properly deleted).
```
var valueClicked = 123456;
$.ajax({
type: "post",
url: '/publications/deleteItem/' + valueClicked, // 100% works!
success: function(xml) {
alert(... | 2010/09/06 | [
"https://Stackoverflow.com/questions/3654342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/198003/"
] | There's nothing wrong with this jQuery code. The server simply didn't return a HTTP 2nn or 3nn response, but a 4nn or 5nn response. This will cause the error handler being invoked instead of the success handler.
You can use [Firebug](http://getfirebug.com)'s [*Net*](http://getfirebug.com/network) panel to check the re... | Since you are trying to create a REST interface you should test direct calls for what do you want to do in the first place.
Let's imagine you domain is: <http://www.mydomain.com>
Try to call <http://www.mydomain.com/publications/deleteItem/123456> and see what is returned from the server. The most probably your serve... |
3,654,342 | can you help me why it returns error.
part of code /publications/deleteItem/' + valueClicked works ok, i checked (proper item is properly deleted).
```
var valueClicked = 123456;
$.ajax({
type: "post",
url: '/publications/deleteItem/' + valueClicked, // 100% works!
success: function(xml) {
alert(... | 2010/09/06 | [
"https://Stackoverflow.com/questions/3654342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/198003/"
] | open up the net panel in firebug and look at the response codes. successful response codes are 2xx or 3xx.
also try changing the success and error callbacks as follows and report back what you get.
```
success:function(data, status, xml) {
alert(status);
},
error:function(data, status, xml) {
alert(status);
... | Since you are trying to create a REST interface you should test direct calls for what do you want to do in the first place.
Let's imagine you domain is: <http://www.mydomain.com>
Try to call <http://www.mydomain.com/publications/deleteItem/123456> and see what is returned from the server. The most probably your serve... |
12,119,171 | I am designing a software in Python and I was getting little curious about whether there is any time differences when popping out items from a dictionary of very small lengths and when popping out items from a dictionary of very large length or it is same in all cases. | 2012/08/25 | [
"https://Stackoverflow.com/questions/12119171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1599825/"
] | You can easily answer this question for yourself using the `timeit` module. But the entire point of a dictionary is near-instant access to any desired element by key, so I would not *expect* to have a large difference between the two scenarios. | Check out this article on Python [TimeComplexity](http://wiki.python.org/moin/TimeComplexity):
>
> The Average Case times listed for dict objects assume that the hash
> function for the objects is sufficiently robust to make collisions
> uncommon. The Average Case assumes the keys used in parameters are
> selected... |
14,486,407 | I'm having a little understanding my programmers' reasoning regarding a password reset feature. Can somebody please tell me which of the following is more secure, or if they are equal?
Option 1: The user is sent an email with the following:
```
Url: http://mysite/reset/user%mail.com
CODE: 57583
```
The user is the... | 2013/01/23 | [
"https://Stackoverflow.com/questions/14486407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2004888/"
] | You must create Properties in your model
```
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
```
instead of
```
public class Person
{
public string Name;
public int Age;
}
```
ASP.net MVC only binds properties. | Why is your model an `object` in the `Get` method? That may be what's confusing the model binder. That also looks like why it throws an exception on page load when you change them to `EditorFor`s
Try strong typing it:
```
[HttpGet]
public ActionResult Index()
{
Person model = new Person {Name = "foo", Age = 44};
... |
5,685,169 | I have been banging my head against a Haskell space leak (of the stack overflow kind, naturally) for a few straight days. It's frustrating because I'm attempting to mimic the BFS algorithm straight from CLR, which is not naturally recursive. NB: I have enabled BangPatterns and I have put a bang in front of every possib... | 2011/04/16 | [
"https://Stackoverflow.com/questions/5685169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/710948/"
] | That looks much easier to understand. (You can still shrink the code by 1/2, though.)
Now, the nature of the space leak becomes apparent. Namely, the one thing that is never evaluated is the *depth*. It will pile up to a big expression `1+1+...`. You can remove all the bang patterns and add a single one at
```
enqueu... | First of all, if would be very helpful if you could provide some simple test case (in the form of code) which demonstrates how this thing stack overflows.
Without it I, personally, can only speculate on the subject of reason for that.
As a speculation: is `IS.fold` strict enough? Well, for example the following simple... |
45,115,027 | I am using [qrcode.js](https://davidshimjs.github.io/qrcodejs/) for generating qrcode. I want to generate random QR code every time I click into add new tab instead of add new qr code. I created a code for a random number but when I try to add onclick function it add new not to random it.
JSFIDDLE: <https://jsfiddle.n... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45115027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8017838/"
] | Try adding `$('#qrcode').html('');` as the first item in the `.click(function(){}`
Like this:
```
$('#lithird').click(function(){
$('#qrcode').html(''); // <---Add this, which should clear it out on the next click
var qrcode = new QRCode("qrcode");
function makeCode () {
function ... | You were missing a function `transfer_new` defined in your `onclick` that was causing a JavaScript error.
```js
function transfer_new() {
$('#qrcode').html('');
}
$('#lithird').click(function() {
var qrcode = new QRCode("qrcode");
function makeCode() {
function randomNumber(len) {
... |
45,115,027 | I am using [qrcode.js](https://davidshimjs.github.io/qrcodejs/) for generating qrcode. I want to generate random QR code every time I click into add new tab instead of add new qr code. I created a code for a random number but when I try to add onclick function it add new not to random it.
JSFIDDLE: <https://jsfiddle.n... | 2017/07/15 | [
"https://Stackoverflow.com/questions/45115027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8017838/"
] | Try adding `$('#qrcode').html('');` as the first item in the `.click(function(){}`
Like this:
```
$('#lithird').click(function(){
$('#qrcode').html(''); // <---Add this, which should clear it out on the next click
var qrcode = new QRCode("qrcode");
function makeCode () {
function ... | Just clear the content before generating new
```js
function randomNumber(len) {
var randomNumber;
var n = '';
for (var count = 0; count < len; count++) {
randomNumber = Math.floor(Math.random() * 10);
n += randomNumber.toString();
}
return n;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.