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 |
|---|---|---|---|---|---|
473,745 | I would like to arrange the following three diagrams
```
\[
\begin{tikzcd}
Z\arrow[dr, "h", dashed]\arrow[drr, "g", bend left]\\
& X\arrow[r, "f"] & Y
\end{tikzcd}
\]
\[
\begin{tikzcd}
pZ\arrow[dr, "w", dashed]\arrow[drr, "pg", bend left]\\
& I\arrow[r, "u"] &... | 2019/02/07 | [
"https://tex.stackexchange.com/questions/473745",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/181028/"
] | I would like to argue that it is much easier if you put things in one diagram. That way you have full and easy control over all dimensions. For instance, I added `[3em] after`&`to make the gap between the left and the right two diagrams a bit larger. And, of course,`\mathbb{E}`and`\mathbb{B}` are automatically aligned ... | Here there is another proposal using `xy` package used to draw a `commutative-diagrams` to obtain your same image.
In this case I have used the ambient `minipage` to have the same structure of the your picture.
[](https://i.stack.imgur.com/Vsoes.png... |
64,586,933 | I'm simply trying to run some of the tests in the example folder under Integration and it will not run on Chrome. Runs on Electron and Edge but refuses to run on Chrome and throwing the attached error after unsuccessfully trying.
My version of Chrome is Version 86.0.4240.111 (Official Build) (64-bit)
Current Cypress ... | 2020/10/29 | [
"https://Stackoverflow.com/questions/64586933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7671653/"
] | Since you would like to reset the counter only when `.reset` class applied, so just remove the `counter-reset: num;` in `body` will do :) | What's happening is that for each level you get a new counter called num when you 'declare it' with some CSS. As body is a higher level than all the divs a new num is created when you 'declare it' in the divs level - you are not seeing the body level's one, you've created a new counter called num when you do a counter ... |
68,087,007 | I have make a nav bar using tailwind css in next.js it is responsive and working fine.
[](https://i.stack.imgur.com/yTCbs.png)
[](https://i.stack.imgur.com/rdXhL.png)
[
You can try to use these tailwind classes `transition-all max-h-screen max-h-0`. | Try this,
I used Tailwind Responsive Design way in official [Doc](https://tailwindcss.com/docs/responsive-design).
so you can adjust `sm:` or `md:` in the `className`
```
import { useState } from "react";
import { MenuAlt1Icon } from "@heroicons/react/outline";
export default function Header() {
const [isOpen, se... |
68,087,007 | I have make a nav bar using tailwind css in next.js it is responsive and working fine.
[](https://i.stack.imgur.com/yTCbs.png)
[](https://i.stack.imgur.com/rdXhL.png)
[
You can try to use these tailwind classes `transition-all max-h-screen max-h-0`. | Now don't be like me. By applying the class md:hidden to the navbar and hamburger you don't have to check if it clicked again to show the ul or navlinks. What you should instead do is add a negative -translate-x-full to make it display off screen and when the hamburger is clicked add a translate-x-0 to make it show by ... |
58,341,818 | I created my VM instance in Google cloud with no problems: 2 CPUs and 8GB RAM. However, I would like to increase it to 96CPU's and 138GB RAM. However, I am receiving the error message I can't have more than 24 CPU is my area (I tried all the areas and all say the same). On top of that, I also tried to create 24 CPU's i... | 2019/10/11 | [
"https://Stackoverflow.com/questions/58341818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | There is a cores quota. You might want to increase it.
>
> CPU quota refers to the total number of virtual CPUs across all of
> your VM instances in a region. CPU quotas apply to running instances
> and instance reservations. Both normal and preemptible instances
> consume this quota.
>
>
> To protect Compute En... | There's no affordable cloud hardware that has such specs, and Google wouldn't be providing such anyway. I guess if you found some "cloud" provider with modern big iron NUMA, you'd get that, but still it would be NUMA so shuttling data between the CPUs would incur overhead, and you'd be paying out the nose. You'll simpl... |
352,031 | From what I had read sometime back, it seems `iwconfig` is deprecated and the current methods is -
```
$ sudo ifconfig wlan0 up
```
and
```
$ sudo ifconfig wlan0 down
```
But couldn't find anything which tells the status of the wifi and know which mode it is on, which AP it is attached to, how much data is being... | 2017/03/17 | [
"https://unix.stackexchange.com/questions/352031",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/50490/"
] | The current (in 2017) methods are:
1. `ip` for all network interfaces, including setting up and down:
```
ip link set wlan0 up
ip link set wlan0 down
ip help
ip link help
ip addr help
```
2. `iw` for wireless extensions (needs to be called as root):
```
iw dev
iw phy
iw wlan0 scan
iw wlan0 station dump
iw help
```... | The [`net-tools`](https://wiki.linuxfoundation.org/networking/net-tools) program is deprecated and the `iproute2` has been used to replace it :
```
program obsoleted by
arp ip neigh
ifconfig ip addr
ipmaddr ip maddr
iptunnel ip tunnel
route ip route
nameif ifrename
mii-tool ethtool
... |
21,955,917 | I want to create these 3 tables in my MySQL database:
```
CREATE TABLE categories (
category_id SMALLINT NOT NULL AUTO_INCREMENT,
category VARCHAR(255) NOT NULL UNIQUE,
description TINYTEXT NOT NULL,
PRIMARY KEY (category_id)
);
CREATE TABLE product (
product_id SMALLINT NOT NULL AUTO_INCREMENT,
... | 2014/02/22 | [
"https://Stackoverflow.com/questions/21955917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2442740/"
] | IE doesn't support the data protocol. Per the [documentation](http://msdn.microsoft.com/en-us/library/cc848897%28v=vs.85%29.aspx), the only supported elements/attributes are the following:
```
object (images only)
img
input type=image
link
CSS declarations that accept a URL, such as background, backgroundImage, and so... | This is an old post but if someone comes across this on a Google search the solution is that you need to have a URL or API endpoint that will return your pdf data, then you put the address to that in your object's data attribute.
```
<object data="/api/pdf"
```
If your pdf is generated by information on the page the... |
49,663 | I have a site (D7) where I need to have HTML entities in the title like the copyright, trade mark signs with the subscript tags. Like:
**Product name®**
The solution at the node level is simple using the page.tpl.php:
```
<?php print html_entity_decode($title); ?>
```
But in a view no matter how I try to format th... | 2012/11/05 | [
"https://drupal.stackexchange.com/questions/49663",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/8010/"
] | This can be achieved using templates:
In case of a view page, the template used will be page--.tpl.php. Ex: If the path to the page is awards then the page template file is page--awards.tpl.php. The title can be edited as required in the template file.
In case of a block, the title can be edited using the block.tpl.ph... | I had the same problem, and I solved it, but I think my method is not perfect.
I created another filed, called "title2", text field with "Full HTML". Make Title2 = title, and view it in views, it will be html\_entity\_decoded.
Sorry for my n00b english. |
49,663 | I have a site (D7) where I need to have HTML entities in the title like the copyright, trade mark signs with the subscript tags. Like:
**Product name®**
The solution at the node level is simple using the page.tpl.php:
```
<?php print html_entity_decode($title); ?>
```
But in a view no matter how I try to format th... | 2012/11/05 | [
"https://drupal.stackexchange.com/questions/49663",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/8010/"
] | Yes! You need to add the attribute `'html' => true`. This is a link property in Drupal 7. If you render any link in Drupal 7 and want to add some extra HTML inside it you need to set `array('html'=>true)`. | I had the same problem, and I solved it, but I think my method is not perfect.
I created another filed, called "title2", text field with "Full HTML". Make Title2 = title, and view it in views, it will be html\_entity\_decoded.
Sorry for my n00b english. |
49,663 | I have a site (D7) where I need to have HTML entities in the title like the copyright, trade mark signs with the subscript tags. Like:
**Product name®**
The solution at the node level is simple using the page.tpl.php:
```
<?php print html_entity_decode($title); ?>
```
But in a view no matter how I try to format th... | 2012/11/05 | [
"https://drupal.stackexchange.com/questions/49663",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/8010/"
] | Yes! You need to add the attribute `'html' => true`. This is a link property in Drupal 7. If you render any link in Drupal 7 and want to add some extra HTML inside it you need to set `array('html'=>true)`. | This can be achieved using templates:
In case of a view page, the template used will be page--.tpl.php. Ex: If the path to the page is awards then the page template file is page--awards.tpl.php. The title can be edited as required in the template file.
In case of a block, the title can be edited using the block.tpl.ph... |
6,567,744 | I'm bit confused with how MessageContract Attribute works in WCF.
When I put the MessageContract the proxy shows two parameters instead of 1.
e.g.
```
GetResultResponse GetOperation(GetResultRequest request)
[MessageContract]
public class GetResultRequest
{
[MessageHeader]
public Header Header { get; set; }
... | 2011/07/04 | [
"https://Stackoverflow.com/questions/6567744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/656348/"
] | That is default behavior. When you generate proxy it doesn't create message contracts by default. You can turn this on in [advanced configuration](http://msdn.microsoft.com/en-us/library/bb514724.aspx) in *Add Service reference* (by checking *Always generate message contracts*) or by `/messageContract` switch in [svcut... | Unless you have the specific requirement to mark the header with the MessageHeader attribute, try to change the class attribute to Datacontract and your properties to DataMember attributes and see if the behaviour changes. As far as I know, unless you implement a custom serializer you cannot influence how svcutil will ... |
136,062 | The highlighted portions are my calculations. I am unsure whether i am going in the right direction or my sig figs are off. Am I supposed to use only 3 sig figs or what the calculator shows?
volume delivered=(final volume from trial 1) – (initial volume from trial 1)
7.50 mL – 0.00 mL = 7.50 mL
mass water=(mass beak... | 2020/07/03 | [
"https://chemistry.stackexchange.com/questions/136062",
"https://chemistry.stackexchange.com",
"https://chemistry.stackexchange.com/users/95558/"
] | Oscar has already explained that your calculations are fine. I see a serious practical problem though. I guess this is a lab experiment for teaching the concept of calibrating a pipette.
I am not aware of any typical 10 mL graduated pipette which can read volumes like 0.03 mL. Are you sure it is a pipet not a (micro)b... | They look right to me except for the percent error calculation. You should render
Precent error = (Measured - theoreticel)/(theoretical) ×100%
Here that would be positive, but you have a negative number so it looks like you turned the formula around. |
15,509,167 | I need two different regex. The first one is to match the last two digits of a year, for instance if I have "2010" I would like to obtain "10". I tried doing something like
```
\d{2}\Z
```
but it didn't work.
The second one is two obtain the first three letters of various names and surnames separated by "and".
For i... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15509167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2149400/"
] | Do you really need a regex, or will this do?
```
>>> def AbbreviateAuthors(names):
... return ''.join(i.split()[-1][:3] for i in names.split(' and '))
>>> AbbreviateAuthors('John Smith and Paul Anthony Doe and Chris Burns')
34: 'SmiDoeBur'
>>> AbbreviateAuthors('John Smith and Paul Anthony Doe')
35: 'SmiDoe'
>>> A... | Here is a way to get the last two digits:
```
"/\d{2}$/" -> "2010" -> 10
```
<http://rubular.com/r/IgVeKXucJ0>
And to get the first three letters of surnames from the string you have:
```
"/\s(\w{,3})\w*($|\sand)/" -> "John Smith and Paul Anthony Doe" -> 1. Smi 2. Doe
```
<http://rubular.com/r/f8OXDB9pDq>, obv... |
3,239,468 | Define
\begin{equation}
A = \begin{pmatrix} \frac{1}{2} &\frac{1}{2} & 0\\ 0& \frac{3}{4} & \frac{1}{4}\\ 0& \frac{1}{4} & \frac{3}{4} \end{pmatrix}.
\end{equation}
Note that the sum of the dimensions of the eigenspaces of $A$ is only two. $A$ is thus not diagonalizable. How can we compute $A^n$? | 2019/05/25 | [
"https://math.stackexchange.com/questions/3239468",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/631742/"
] | Here is a different way using a rather classical trick, converting the issue into a binomial expansion. Indeed, we can write :
$$A=\frac12(I+B) \ \text{where} \ B:=\begin{pmatrix}0&1&0 \\0&1/2&1/2\\0&1/2&1/2\end{pmatrix}$$
where matrix $B$ has the following particularity
$$B^n=C \ \text{for all} \ n>1 \ \text{where}... | Note that your matrix $A$ has the generalized eigenvectors
\begin{equation}v\_1=\begin{pmatrix}1 \\ 0 \\ 0\end{pmatrix}, v\_2=\begin{pmatrix}0 \\ 2 \\ -2\end{pmatrix}, v\_3=\begin{pmatrix}0\\ 0 \\ 1\end{pmatrix}.\end{equation}
Thus, by Jordan decomposition, $A=\big(v\_1,v\_2,v\_3\big)J\big(v\_1,v\_2,v\_3\big)^{-1}$, ... |
20,622,414 | I have a website where users each have their own profile page. Here they can upload a single image that acts as their avatar. This is the only image users can upload to the server across the whole site. There is no archive so it can be overwritten if a user wishes to update their avatar.
I have never had to do anythin... | 2013/12/16 | [
"https://Stackoverflow.com/questions/20622414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273902/"
] | I would recommend storing the images on something like Amazon S3. Depending on how many pictures you're storing, serving images can really take a tow on your web server. S3 is scalable and with multi-zone deployments through CloudFront (Amazon's version of a CDN), you can really speed up this part of your service. | I've been using base64 to store them within an SQL database. No need to manage files. It works well for relatively low resolution options.
How about not storing them as images at all?
You could leverage an external placeholder for each user, you could cache a random image from lorempixel.com: `http://lorempixel.com/10... |
20,622,414 | I have a website where users each have their own profile page. Here they can upload a single image that acts as their avatar. This is the only image users can upload to the server across the whole site. There is no archive so it can be overwritten if a user wishes to update their avatar.
I have never had to do anythin... | 2013/12/16 | [
"https://Stackoverflow.com/questions/20622414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273902/"
] | I would recommend storing the images on something like Amazon S3. Depending on how many pictures you're storing, serving images can really take a tow on your web server. S3 is scalable and with multi-zone deployments through CloudFront (Amazon's version of a CDN), you can really speed up this part of your service. | It's good idea to not overload single directory. Very often you can see that images are stored in hierarchy of folders according to theirs first few letters. An example of this is
```
b5dcv5.jpg -> /b/5/b5dcv5.jpg
bsgb0g.jpg -> /b/s/bsgb0g.jpg
a5dcbt.jpg -> /a/5/a5dcbt.jpg
```
and so on. I thing you got the principl... |
20,622,414 | I have a website where users each have their own profile page. Here they can upload a single image that acts as their avatar. This is the only image users can upload to the server across the whole site. There is no archive so it can be overwritten if a user wishes to update their avatar.
I have never had to do anythin... | 2013/12/16 | [
"https://Stackoverflow.com/questions/20622414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273902/"
] | It's good idea to not overload single directory. Very often you can see that images are stored in hierarchy of folders according to theirs first few letters. An example of this is
```
b5dcv5.jpg -> /b/5/b5dcv5.jpg
bsgb0g.jpg -> /b/s/bsgb0g.jpg
a5dcbt.jpg -> /a/5/a5dcbt.jpg
```
and so on. I thing you got the principl... | I've been using base64 to store them within an SQL database. No need to manage files. It works well for relatively low resolution options.
How about not storing them as images at all?
You could leverage an external placeholder for each user, you could cache a random image from lorempixel.com: `http://lorempixel.com/10... |
15,599,983 | So here is my code and while simply is not checking the condition, but the if condition is working. I dont have slightest idea what the heck is going on, because it all seems to me ok.
```
import java.lang.Integer;
public class Wielomian
{
public double [] mnozniki;
public int max;
Wielomian(... | 2013/03/24 | [
"https://Stackoverflow.com/questions/15599983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1267757/"
] | ```
((ciag.charAt(iteration))!='-')||((ciag.charAt(iteration))!='+'))
```
is always true, this is a classic mistake (coming from the confusion of "not x or y" actually meaning "not (x or y)" but most newbies code as "(not x) or (not y)", use && instead or put the negation outside the OR
```
((ciag.charAt(iteration))... | I think the problem is here :
`while(((ciag.charAt(iteration))!='-')||((ciag.charAt(iteration))!='+'))`
Try using this instead :
```
while(((ciag.charAt(iteration))!='-')&&((ciag.charAt(iteration))!='+'))
```
As you have not specified the exact problem, I am not sure about the answer. But try and check. |
15,599,983 | So here is my code and while simply is not checking the condition, but the if condition is working. I dont have slightest idea what the heck is going on, because it all seems to me ok.
```
import java.lang.Integer;
public class Wielomian
{
public double [] mnozniki;
public int max;
Wielomian(... | 2013/03/24 | [
"https://Stackoverflow.com/questions/15599983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1267757/"
] | ```
((ciag.charAt(iteration))!='-')||((ciag.charAt(iteration))!='+'))
```
is always true, this is a classic mistake (coming from the confusion of "not x or y" actually meaning "not (x or y)" but most newbies code as "(not x) or (not y)", use && instead or put the negation outside the OR
```
((ciag.charAt(iteration))... | ```
while ( A != 1 || A != 2) {
//Do Something
}
```
The while loop will only end if `A == 1 && A == 2`, which can never be true. |
929,809 | I am developing an ASP .Net MVC application and on my dev machine, the application runs as expected and, more importantly, the images mentioned in the CSS file are displaying correctly too.
However, when I publish this application to a testing server, the web app runs fine, but the images are not shown.
If I modify t... | 2009/05/30 | [
"https://Stackoverflow.com/questions/929809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/114805/"
] | The URLs are not correct, likely due to the fact that you are publishing in a subfolder and so they are no longer at the root of the server. I usually use `Url.Content( "~/Content/Images/..." )` to build the url instead of hard-coding it. That way it will take into account the routes when building the path.
Example:
... | Possible relative paths are wrong...Possible that they are wrong for CSS file itself. You can use FireBug to see if CSS loaded correctly, then you can examine image request, often in such situations you will see red(error) items. This could help to localize problem. |
929,809 | I am developing an ASP .Net MVC application and on my dev machine, the application runs as expected and, more importantly, the images mentioned in the CSS file are displaying correctly too.
However, when I publish this application to a testing server, the web app runs fine, but the images are not shown.
If I modify t... | 2009/05/30 | [
"https://Stackoverflow.com/questions/929809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/114805/"
] | The URLs are not correct, likely due to the fact that you are publishing in a subfolder and so they are no longer at the root of the server. I usually use `Url.Content( "~/Content/Images/..." )` to build the url instead of hard-coding it. That way it will take into account the routes when building the path.
Example:
... | I had the same issue, but I found the reason why it was forcing authentication on the Contents folder.
When a user is not logged in yet, they are classified as Anonymous Authentication. In IIS7 (which is what I am using, guessing it is the same in IIS6) you need to open the authentication window in features view. Then... |
929,809 | I am developing an ASP .Net MVC application and on my dev machine, the application runs as expected and, more importantly, the images mentioned in the CSS file are displaying correctly too.
However, when I publish this application to a testing server, the web app runs fine, but the images are not shown.
If I modify t... | 2009/05/30 | [
"https://Stackoverflow.com/questions/929809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/114805/"
] | I had the same issue, but I found the reason why it was forcing authentication on the Contents folder.
When a user is not logged in yet, they are classified as Anonymous Authentication. In IIS7 (which is what I am using, guessing it is the same in IIS6) you need to open the authentication window in features view. Then... | Possible relative paths are wrong...Possible that they are wrong for CSS file itself. You can use FireBug to see if CSS loaded correctly, then you can examine image request, often in such situations you will see red(error) items. This could help to localize problem. |
23,815,819 | Hello guys am working on a window application in vb.net Am trying to code an array that can add only 8 best subjects grades from the 10 subjects done by a student. the ten subject grades are displayed as labels and also the TOTAL of best eight subject grades is displayed as a label. Any one to help me. am new in progra... | 2014/05/22 | [
"https://Stackoverflow.com/questions/23815819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3666449/"
] | As others have suggested, use a strongly-typed collection rather than `ArrayList`. You probably want grades to be `Integer` rather than `String`. It probably won't matter for single-digit grades, but might sort oddly otherwise.
If you change your `gradeList` variable into a `List(Of Integer)` and turn on `Option Stric... | Sorting numbers as strings leads to problems. For example if you add somewhere `10` in your grades and sort the array list, like this:
```
Dim gradeList As New ArrayList()
gradeList.Add("7")
gradeList.Add("1")
gradeList.Add("3")
gradeList.Add("8")
gradeList.Add("10") '! watch out
' sort string
gradeList.Sort()
' outpu... |
61,188,939 | I'm studying ReactJS and Firebase. My code works fine but when I decided to add another field to my database using the form from my site it shows me an error that it's not defined. I tried to hard-code the values but `name_comment` doesn't change the values in my database at firebase. My code is shown below and the scr... | 2020/04/13 | [
"https://Stackoverflow.com/questions/61188939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9615990/"
] | I have solved this issue. I changed `const [comment, setComment] = useState('')` to `const [name_comment, setComment] = useState('')` | You're not giving a name for `name` and `nameComment`, and it seems that `nameComment` is not defined.
One simple fix is to specify hard-coded values:
```
firebase
.firestore()
.collection('names')
.add({
name: 'value of name',
name_comment: 'value of comment',
name_rating: parseIn... |
61,188,939 | I'm studying ReactJS and Firebase. My code works fine but when I decided to add another field to my database using the form from my site it shows me an error that it's not defined. I tried to hard-code the values but `name_comment` doesn't change the values in my database at firebase. My code is shown below and the scr... | 2020/04/13 | [
"https://Stackoverflow.com/questions/61188939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9615990/"
] | I have solved this issue. I changed `const [comment, setComment] = useState('')` to `const [name_comment, setComment] = useState('')` | as in the Frank's answer name\_comment is not defined it seems.
```
const [name_comment, setNameComment] = useState("")
.....
function onSubmit(e){
e.preventDefault()
firebase
.firestore()
.collection('names')
.add({
name,
name_comment,
name_rating: parseInt(rating),
})
.th... |
14,290,490 | I'm sending an ajax request to the server on user's input to an `<input>` element, like this:
```
$('#my-input').bind("input", function(event){
// here's the ajax request
});
```
What bothers me is that it send unnecessarily many requests on **every** user's keyup, meaning that if the user types very fast, there ... | 2013/01/12 | [
"https://Stackoverflow.com/questions/14290490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/616855/"
] | You can use [throttle](http://documentcloud.github.com/underscore/#throttle) function in underscore library. As its documentation says:
>
> Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, will only actually call the original function at most once per every wait mill... | You could just use the setTimeout function. Every so often, see if the text hasn't changed, and if it hasn't, then process accordingly.
```
setTimeout(function() {
// Do something after 1 second
}, 1000);
``` |
14,290,490 | I'm sending an ajax request to the server on user's input to an `<input>` element, like this:
```
$('#my-input').bind("input", function(event){
// here's the ajax request
});
```
What bothers me is that it send unnecessarily many requests on **every** user's keyup, meaning that if the user types very fast, there ... | 2013/01/12 | [
"https://Stackoverflow.com/questions/14290490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/616855/"
] | You can use [throttle](http://documentcloud.github.com/underscore/#throttle) function in underscore library. As its documentation says:
>
> Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, will only actually call the original function at most once per every wait mill... | You can set async: false in your ajax request so it will process second ajax call only after completion of first ajax request. |
14,290,490 | I'm sending an ajax request to the server on user's input to an `<input>` element, like this:
```
$('#my-input').bind("input", function(event){
// here's the ajax request
});
```
What bothers me is that it send unnecessarily many requests on **every** user's keyup, meaning that if the user types very fast, there ... | 2013/01/12 | [
"https://Stackoverflow.com/questions/14290490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/616855/"
] | You can use [throttle](http://documentcloud.github.com/underscore/#throttle) function in underscore library. As its documentation says:
>
> Creates and returns a new, throttled version of the passed function, that, when invoked repeatedly, will only actually call the original function at most once per every wait mill... | I'd go with [@HuiZeng's answer](https://stackoverflow.com/a/14290516/1177441), but just in case you want a slightly modified version.
Steps
1. Listen to keydown using a setTimeout that you can clear.
2. When it fires, check if you have a previous request in queue, if so abort it and fire a new one
Example:
```
var ... |
14,290,490 | I'm sending an ajax request to the server on user's input to an `<input>` element, like this:
```
$('#my-input').bind("input", function(event){
// here's the ajax request
});
```
What bothers me is that it send unnecessarily many requests on **every** user's keyup, meaning that if the user types very fast, there ... | 2013/01/12 | [
"https://Stackoverflow.com/questions/14290490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/616855/"
] | You could just use the setTimeout function. Every so often, see if the text hasn't changed, and if it hasn't, then process accordingly.
```
setTimeout(function() {
// Do something after 1 second
}, 1000);
``` | You can set async: false in your ajax request so it will process second ajax call only after completion of first ajax request. |
14,290,490 | I'm sending an ajax request to the server on user's input to an `<input>` element, like this:
```
$('#my-input').bind("input", function(event){
// here's the ajax request
});
```
What bothers me is that it send unnecessarily many requests on **every** user's keyup, meaning that if the user types very fast, there ... | 2013/01/12 | [
"https://Stackoverflow.com/questions/14290490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/616855/"
] | You could just use the setTimeout function. Every so often, see if the text hasn't changed, and if it hasn't, then process accordingly.
```
setTimeout(function() {
// Do something after 1 second
}, 1000);
``` | I'd go with [@HuiZeng's answer](https://stackoverflow.com/a/14290516/1177441), but just in case you want a slightly modified version.
Steps
1. Listen to keydown using a setTimeout that you can clear.
2. When it fires, check if you have a previous request in queue, if so abort it and fire a new one
Example:
```
var ... |
211,387 | I stubbornly tried to create an Orbit slide show based on zurb foundation 6 framework.
I followed all the steps on the instruction page:[Orbit Slide Show](http://foundation.zurb.com/sites/docs/orbit.html).
I added everything needed for this type of slide show and included below CSS and Java Script classes in theme li... | 2016/08/12 | [
"https://drupal.stackexchange.com/questions/211387",
"https://drupal.stackexchange.com",
"https://drupal.stackexchange.com/users/58388/"
] | The class implementing the block showing the theme logo, in [`SystemBrandingBlock::build()`](https://api.drupal.org/api/drupal/core%21modules%21system%21src%21Plugin%21Block%21SystemBrandingBlock.php/function/SystemBrandingBlock%3A%3Abuild/8.2.x) contains the following code.
```
$build['site_logo'] = array(
'#th... | In Drupal 8, [the site logo was moved in a block](https://www.drupal.org/node/2544012).
In block layout, you place a branding block in a region, which you then can configure to contain the logo, the site name and/or the slogan. You can place multiple branding blocks to use site branding elements in different regions. |
35,594,980 | yes , this is a study question. I've been banging my head on a wall over this. what I have so far...
```
words = []
5.times do
puts "Please enter a word:"
words << gets.chomp.upcase
end
puts "Here are your words:"
puts words.sort
```
start this video at 6:00
more info: <https://vimeo.com/125941774> | 2016/02/24 | [
"https://Stackoverflow.com/questions/35594980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5970283/"
] | ```
words = []
5.times do
puts "Please enter a word:"
words << gets.chomp # no .upcase here, upcase converts all letters
end
result = words.sort.map.with_index do |w, i|
w[0] = w[0].upcase if i.odd?
end
puts "Here are your words:"
puts result
``` | Capitalizing and Uppercasing Are Not Synonyms
---------------------------------------------
Capitalizing and uppercasing are two different things. Since your question asked about capitalizing (e.g. title-casing), you can construct your code around the following examples.
One example uses features from the latest MRI ... |
11,646,279 | I have no idea where to start diagnosing and fixing this:
```
$ bin/django celeryd -l DEBUG -v 3
-------------- celery@lucid32 v3.0.3 (Chiastic Slide)
---- **** -----
--- * *** * -- [Configuration]
-- * - **** --- . broker: django://localhost//
- ** ---------- . app: default:0x8b0aa4c (djcelery.loade... | 2012/07/25 | [
"https://Stackoverflow.com/questions/11646279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/263268/"
] | The ImportError is being raised from the subprocesses that billiard is creating when it forks. The ImportError is raised when those processes do not have billiard on their sys.path, which can happen in two cases that I know of right now.
The first, which is your case, happens because Django is mangling (and then un-ma... | Ok, well I got over the first hurdle. The naive approach worked: grep the entire source tree, including eggs, for "billiard.forking". Surprisingly, the only place that it appears is inside the forking module itself:
```
if getattr(sys, 'frozen', False):
return [sys.executable, '--billiard-fork']
else:
prog = '... |
60,860,646 | I´m doing a management page for a learning institute as a homework of programming languages subject, and I need to make an assistance database and its frontend.
I made a table with students IDs, names and a column with checkboxes that you checked if that student is present.
I want to count the number of present student... | 2020/03/26 | [
"https://Stackoverflow.com/questions/60860646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11279205/"
] | Since you want to know how the function should work, I did not focus on UI. I do not know whether you are using JQuery, so I coded it in JavaScript.
```js
function studCheck() {
let total = document.querySelectorAll('input[type="checkbox"]:checked').length;
document.getElementById("totalStudents").innerHTML = "... | Add an `onChange=handleCheckbox()` to your checkboxes
```
function handleCheckbox(){
var inputElems = document.getElementsByTagName("input"),
count = 0;
for (var i=0; i<inputElems.length; i++) {
if (inputElems[i].type === "checkbox" && inputElems[i].checked === true){
count... |
60,860,646 | I´m doing a management page for a learning institute as a homework of programming languages subject, and I need to make an assistance database and its frontend.
I made a table with students IDs, names and a column with checkboxes that you checked if that student is present.
I want to count the number of present student... | 2020/03/26 | [
"https://Stackoverflow.com/questions/60860646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11279205/"
] | Since you want to know how the function should work, I did not focus on UI. I do not know whether you are using JQuery, so I coded it in JavaScript.
```js
function studCheck() {
let total = document.querySelectorAll('input[type="checkbox"]:checked').length;
document.getElementById("totalStudents").innerHTML = "... | If you are doing it with pure JS+DOM, you need to add a `onchange` on each checkbox which calls a specified function in you JavaScript. This way, whenever the state of the checkbox changes (user clicks on it or uses keyboard to check it, whatever), your function is called.
The event will be passed to your function wit... |
55,545,578 | I have the following snippet of code. When I check how many rows the results array has, it prints out 1. But when I try to access the data within (firstname, lastname, username, etc.) it prints nothing out.
```
$username = mysqli_real_escape_string($db, $_POST['username']);
$password = mysqli_real_escape_string($db, $... | 2019/04/06 | [
"https://Stackoverflow.com/questions/55545578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5729690/"
] | You are calling a wrong variable `$result` instead of `$results` in your `mysqli_fetch_assoc` function. | may be this will work.
```
if (mysqli_num_rows($results) > 0) {
$session_user = mysqli_fetch_assoc($result);
$_SESSION['firstname'] = $session_user['firstname'];
$_SESSION['lastname'] = $session_user['lastname'];
echo $_SESSION['firstname']; // doesn't print anything
$_SESSION['username'] = $user... |
54,502 | I saw "acc" in my question votes where were supposed to be the number of votes. What does it mean? | 2010/06/21 | [
"https://meta.stackexchange.com/questions/54502",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/146353/"
] | It means the answer was accepted. | It sounds like you're viewing the alt text for an image that didn't load. Did you look at the HTML source? |
6,632,351 | I am using msync in my application on Linux 2.6 to ensure consistency in the event of a crash. I need to thoroughly test my usage of msync but the implementation seems to be flushing all the relevant pages for me. Is there a way to prevent automatic flushing of mmap'd pages onto the disk to expose erroneous usage of ms... | 2011/07/09 | [
"https://Stackoverflow.com/questions/6632351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/836336/"
] | With apologies to @samold, "swappiness" has nothing to do with this. Swappiness just affects how the kernel trades off swapping dirty anonymous pages versus evicting page cache pages when memory is low.
You need to play with the [Linux VM tunables controlling the pdflush task](http://www.westnet.com/~gsmith/content/li... | A few guesses:
You can fiddle with the *swappiness* of the system via the `/proc/sys/vm/swappiness` tunable:
```none
/proc/sys/vm/swappiness
The value in this file controls how aggressively the
kernel will swap memory pages. Higher values increase
agressiveness, lower values descreas... |
67,834,532 | I am trying to print all inputted number by the user using the code below but instead of printing all inputted numbers it only print the last number I inputted.
```
#include<stdio.h>
int display(int n, int a, int b)
{
printf("\n\nOrdered pairs are: ");
for(int j=0;j<n;j++)
{
printf("(%d,%d) ",a,b)... | 2021/06/04 | [
"https://Stackoverflow.com/questions/67834532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You don't have memory for storing more than 2 numbers (`x` and `y`) which are over-written during each iteration of the loop.
Perhaps you meant to use arrays, or dynamically allocated memory. This:
```
int x[100], y[100];
```
is one way, then you can store up to 100 numbers in each of the two arrays. Use array inde... | Actually you are changing the value stored in x and y again and again and so, the previous values get destroyed and only the last value is stored. So you can you arrays (which are more easier to use) or you can even use structure (I would prefer to use arrays). |
17,009,290 | I have a Form
```
<script type="text/javascript" src="result.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<form name="form" method="POST" id="form">
<input type="text" value="" id="htno" name="htno" Maxlength="12" style="width:165px;" class="bodytext"></input>
<input type="button" va... | 2013/06/09 | [
"https://Stackoverflow.com/questions/17009290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2442316/"
] | You should know that a form is submitted when the input type is submit.In your code change the type of button to submit.
just change the part
```
<input type="button" value="Submit" >
```
to
```
<input type="submit" value="Submit" >
```
and in your result.js remove this line
```
event.preventDefault();
``... | try changing your
```
$("#form").submit(function(event) {
event.preventDefault();
```
by
```
$(document).on('submit','#form',function(e) {
e.preventDefault();
```
alto, try to alert data |
17,009,290 | I have a Form
```
<script type="text/javascript" src="result.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<form name="form" method="POST" id="form">
<input type="text" value="" id="htno" name="htno" Maxlength="12" style="width:165px;" class="bodytext"></input>
<input type="button" va... | 2013/06/09 | [
"https://Stackoverflow.com/questions/17009290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2442316/"
] | You should know that a form is submitted when the input type is submit.In your code change the type of button to submit.
just change the part
```
<input type="button" value="Submit" >
```
to
```
<input type="submit" value="Submit" >
```
and in your result.js remove this line
```
event.preventDefault();
``... | The page you are trying to connect use temporary tokens. You cannot do what you are looking for. You are not allowed to do it. Ask owner of site for kind of API access, he could make you a good price... `{ this topic should be closed! }` |
429,416 | I made an image of my entire C:\ drive using EaseUS Todo Backup Free, before formatting and setting up a new Windows (7 Professional) system. I can mount that image read-only in Todo Backup and copy over a few files which I need, everything fine up to here.
Problem is, I need to access some of the files in C:\Users\dv... | 2012/05/27 | [
"https://superuser.com/questions/429416",
"https://superuser.com",
"https://superuser.com/users/136566/"
] | You can copy the folder in question to your local disk using robocopy.
Start an administrative command line window by typing `cmd` into the Start Menu and pressing Control-Shift-ENTER.
Assuming the volume is mounted as drive E, and that you are running as administrator, type the following command:
```
robocopy /e /b... | Have you tried [taking ownership of the folder](http://technet.microsoft.com/en-us/library/cc753659.aspx) using the security tab in properties of that folder?
>
> Easeus Note: We suggest you [mount the image file with the same Windows user](http://www.todo-backup.com/support/help/mount.htm) which you used to create t... |
9,896,997 | I have a problem. I have two tables with the same columns. I want to create a third table which will be have id's rows from these two tables where four chosen columns will be the same.
I resolved problem with comparing data null with isnull.
I wrote something like this:
```
WITH cteCandidates (City, Street, HouseN... | 2012/03/27 | [
"https://Stackoverflow.com/questions/9896997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1054790/"
] | This can only be explained by duplicates of (City, Street, HouseNumber, PostCode) columns. Intersect will return exactly `one` row for all duplicated data, but inner join will create `n*m` matching rows. Could you please verify that these four columns are unique in both Gymnasium and PrimarySchool? | The only thing that you are doing wrong is expecting the two queries to return the same number of rows.
In the first, you are replacing nulls with '999999', then comparing the resulting value. That makes all nulls equal to all other nulls (and the value '999999', though presumably that value doesn't occur).
In the se... |
64,102,690 | I have a dictionary of dictionaries where the keys of the inner dictionary represents bins of a histogram and the values represent the frequency. I want to calculate the mean bin and the std of the bins.
```
dict = {'Group 1' : {1 : 100, 2:300, 4:100, 5:50},
{'Group 2' : {1 : 50, 2: 300},
{'Group 3' : {4... | 2020/09/28 | [
"https://Stackoverflow.com/questions/64102690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11305480/"
] | Try to work with `ArrayList` collection.
1. First fill the ArrayList with values.
2. Then sort this collection, for example with util method `Collections.sort()`.
3. Finally, work on creating file. Write method for saving sorted collection value by value. | ```
List<String> numbers = IntStream.range(0, 10).map(x -> random.nextInt(100) * (random.nextBoolean() ? -1 : 1)).boxed()
.sorted(Collections.reverseOrder()).map(String::valueOf).collect(Collectors.toList());
Files.write(Paths.get("D://test.txt"), numbers);
```
Generates 10 random numbers, reverses, c... |
62,881,502 | I am in the middle of solving various puzzles. Once again, the thought occurred to me about simplification with use of functional programming.
The problem to solve is : *Given an array of integers arr, a lucky integer is an integer which has a frequency in the array equal to its value.
Return a lucky integer in the ar... | 2020/07/13 | [
"https://Stackoverflow.com/questions/62881502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10725006/"
] | Stream-based solution may look as follows:
```
static int findLucky(int[] arr) {
return Arrays.stream(arr)
.boxed() // convert to Integer
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting())) // group by number, count frequencies
.entrySet().stream()
... | >
> I find my solution here cumbersome and complex, is there an easier way to breakdown this problem? (perhaps using lambda's)
>
>
>
Try this using a stream approach. This also includes your request to use a Lambda.
```
Function<int[], Integer> findLucky = arr->IntStream.of(arr).boxed()
.collect(Collecto... |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | You can pass link\_to a block that contains the content you want to display. So instead of going with the `link_to(display, url, options={})` you get `link_to(url, option={}, &block)` where you can do.
```
<%= link_to index_by_dvp_domain_path do %>
<div style="background-image: url(<%= image_url '1.jpg'%>);width:340... | Please have a try with
```
<%= link_to raw('<div style="background-image:url(#{image_url '1.jpg'}%>);width:340px;"> This is a test</div>'),index_by_dvp_domain_path %>
``` |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | You can pass link\_to a block that contains the content you want to display. So instead of going with the `link_to(display, url, options={})` you get `link_to(url, option={}, &block)` where you can do.
```
<%= link_to index_by_dvp_domain_path do %>
<div style="background-image: url(<%= image_url '1.jpg'%>);width:340... | Best way to do it this is used following
```
<%= link_to index_by_dvp_domain_path do
content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jpg');width:340px;" )
end
%>
```
OR
```
<%= link_to content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jp... |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | You can pass link\_to a block that contains the content you want to display. So instead of going with the `link_to(display, url, options={})` you get `link_to(url, option={}, &block)` where you can do.
```
<%= link_to index_by_dvp_domain_path do %>
<div style="background-image: url(<%= image_url '1.jpg'%>);width:340... | Im so surprised to see that no one came up with the regular way of doing it in Rails.
```
<%= link_to image_tag("/images/1.jpg",:size => "340X340"),index_by_dvp_domain_path %>
``` |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | You can pass link\_to a block that contains the content you want to display. So instead of going with the `link_to(display, url, options={})` you get `link_to(url, option={}, &block)` where you can do.
```
<%= link_to index_by_dvp_domain_path do %>
<div style="background-image: url(<%= image_url '1.jpg'%>);width:340... | I think using Link\_to as below would be much more simpler even when you have a big block including multiple tags:
```
<%= link_to desired_path do %>
<div class="linkable">
<another div>
... some other tags
</another div>
</div>
<% end %>
```
and I recommend you to use a differen... |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | Best way to do it this is used following
```
<%= link_to index_by_dvp_domain_path do
content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jpg');width:340px;" )
end
%>
```
OR
```
<%= link_to content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jp... | Please have a try with
```
<%= link_to raw('<div style="background-image:url(#{image_url '1.jpg'}%>);width:340px;"> This is a test</div>'),index_by_dvp_domain_path %>
``` |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | Please have a try with
```
<%= link_to raw('<div style="background-image:url(#{image_url '1.jpg'}%>);width:340px;"> This is a test</div>'),index_by_dvp_domain_path %>
``` | Im so surprised to see that no one came up with the regular way of doing it in Rails.
```
<%= link_to image_tag("/images/1.jpg",:size => "340X340"),index_by_dvp_domain_path %>
``` |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | Best way to do it this is used following
```
<%= link_to index_by_dvp_domain_path do
content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jpg');width:340px;" )
end
%>
```
OR
```
<%= link_to content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jp... | Im so surprised to see that no one came up with the regular way of doing it in Rails.
```
<%= link_to image_tag("/images/1.jpg",:size => "340X340"),index_by_dvp_domain_path %>
``` |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | Best way to do it this is used following
```
<%= link_to index_by_dvp_domain_path do
content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jpg');width:340px;" )
end
%>
```
OR
```
<%= link_to content_tag(:div, 'This is a test',:style=>"background-image:url(#{image_url} '1.jp... | I think using Link\_to as below would be much more simpler even when you have a big block including multiple tags:
```
<%= link_to desired_path do %>
<div class="linkable">
<another div>
... some other tags
</another div>
</div>
<% end %>
```
and I recommend you to use a differen... |
18,076,785 | How can I query the Mac OS X keychain to retrieve only session items ?
When I try to get all items like this :
```
[SSKeychain accountsForService:nil];
```
A session item and a system item have exactly the same attributes for the keys : acct, cdat, class, crtr, labl, mdat, svce
How can y query the keychain to get ... | 2013/08/06 | [
"https://Stackoverflow.com/questions/18076785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/564672/"
] | I think using Link\_to as below would be much more simpler even when you have a big block including multiple tags:
```
<%= link_to desired_path do %>
<div class="linkable">
<another div>
... some other tags
</another div>
</div>
<% end %>
```
and I recommend you to use a differen... | Im so surprised to see that no one came up with the regular way of doing it in Rails.
```
<%= link_to image_tag("/images/1.jpg",:size => "340X340"),index_by_dvp_domain_path %>
``` |
54,064 | I'm using `todonotes` to make notes on my thesis. I'd like to be able to put some dot-points on a couple of the larger notes, like this:
```
\todo[inline]{
\begin{itemize}
\item blah blah blah
\end{itemize}
}
```
But I get this error message:
```
! Argument of \reserved@a has an extra }.
<inserted text>
... | 2012/05/02 | [
"https://tex.stackexchange.com/questions/54064",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/13192/"
] | You have to use the `caption` option:
```
\documentclass{article}
\usepackage{todonotes}
\begin{document}
\todo[inline,caption={}]{
\begin{itemize}
\item blah blah blah
\end{itemize}
}
\end{document}
```
As described on page 12 of the [manual](http://mirrors.ctan.org/macros/latex/contrib/todonotes/todonotes.... | The colon problem occurs if the `prependcaption` option is set in the package options.
If you remove this option, the set caption (or the colon, if the caption is empty) is no longer displayed on the left. |
327,474 | Please suggest some **hint** to test the convergence of the following series
$$\sum\_{n=1}^\infty (-1)^n(\sqrt{n+1}-\sqrt n)$$ | 2013/03/11 | [
"https://math.stackexchange.com/questions/327474",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/36242/"
] | Hint:
$$\sqrt{n+1}-\sqrt{n} = \frac{1}{\sqrt{n+1}+\sqrt{n}}$$ | We have
$$u\_n=(-1)^n(\sqrt{n+1}-\sqrt{n})=\frac{(-1)^n}{\sqrt{n+1}+\sqrt{n}}$$
So the sequence $(|u\_n|)\_n$ converges to $0$ and is monotone decreasing then by [Alternating series test](http://en.wikipedia.org/wiki/Alternating_series) the series $\sum\_n u\_n$ is convergent. |
8,365,907 | I'm new to Java, coming from a C/C++ background. I'm trying to write a music player app for Android and I am working on a library scanning function. I want to have a hierarchical database of the format Artist -> Album -> Song where Artist has a name and a group of Albums, an Album has a name, year, and group of Songs, ... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8365907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1078657/"
] | I think is a **Inheritance** funda, So make your classes hierarchy as like (use of inheritance), So **you have to make only one class which has all the derived propertied of its parent class**, and make a ArrayList of that class only, So you don't have to make nested ArrayList. (If I am not wrong or if then please expl... | create a custom class with getters and setters then create an arraylist as that datatype (your custom class)
```
List<customClass> foo = ArrayList<customClass>
```
same as the comment above but more info |
8,365,907 | I'm new to Java, coming from a C/C++ background. I'm trying to write a music player app for Android and I am working on a library scanning function. I want to have a hierarchical database of the format Artist -> Album -> Song where Artist has a name and a group of Albums, an Album has a name, year, and group of Songs, ... | 2011/12/03 | [
"https://Stackoverflow.com/questions/8365907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1078657/"
] | I think is a **Inheritance** funda, So make your classes hierarchy as like (use of inheritance), So **you have to make only one class which has all the derived propertied of its parent class**, and make a ArrayList of that class only, So you don't have to make nested ArrayList. (If I am not wrong or if then please expl... | All of the constructors should create (not just declare) the ArrayLists. Else they will be null. You can start them at a small size to save space. E.g
songs = new ArrayList(3); |
930,164 | I have 600 tiff files of aerial imagery (180MB each) on an external thumb drive. I need to transfer the tiff files from my desktop PC (Windows 7 pro) to a network attached storage (NAS) device attached to my virtual server (Windows Server 2008 R2 Standard). I have a 20 Mbps broadband connection on my desktop PC and a 1... | 2015/06/19 | [
"https://superuser.com/questions/930164",
"https://superuser.com",
"https://superuser.com/users/285852/"
] | I did it with USB, You can plug it into Your PC, copy files on it, after finished, add it to the virtual machine.
Pro: fast
Con: no direct connection
For more solutions read [this](https://superuser.com/questions/324355/how-to-copy-files-from-local-machine-to-remote-virtual-machine)
EDIT: if You have only 20 Mbps u... | As @oldmud0 suggested, TIFF is a very inefficient format - you might get traction by converting the files to PNG (which won't loose the quality but is way smaller), or by compressing the files using ZIP before transferring them.
Another solution (which will be slower, but does not involve tampering with the files) wou... |
930,164 | I have 600 tiff files of aerial imagery (180MB each) on an external thumb drive. I need to transfer the tiff files from my desktop PC (Windows 7 pro) to a network attached storage (NAS) device attached to my virtual server (Windows Server 2008 R2 Standard). I have a 20 Mbps broadband connection on my desktop PC and a 1... | 2015/06/19 | [
"https://superuser.com/questions/930164",
"https://superuser.com",
"https://superuser.com/users/285852/"
] | Since your NAS is located in a data center, you have very few options:
* You could compress the images into a significantly smaller format, such as JPEG (set to 100%), PNG, or even RAW. That would make your life much easier, especially when you have to download all that back onto your desktop.
* Put it all in a compre... | As @oldmud0 suggested, TIFF is a very inefficient format - you might get traction by converting the files to PNG (which won't loose the quality but is way smaller), or by compressing the files using ZIP before transferring them.
Another solution (which will be slower, but does not involve tampering with the files) wou... |
307,578 | I'm running a server using OpenVZ for a few websites. Nothing in HN except for sshd. A VM for Varnish, a VM for MySQL and a few VMs each for one website (running Apache/PHP). Now I'd like to secure this server, mostly from network attack (I think).
What I should do? I see that I should not install Selinux in HN. Insta... | 2011/09/02 | [
"https://serverfault.com/questions/307578",
"https://serverfault.com",
"https://serverfault.com/users/88934/"
] | Configuring firewall in the HW node is tricky as you have to consider all the traffic going through the node from/to your VPSs before enabling the firewall in HW node. You may need to do an audit and configure the firewall accordingly, if you are going to use one in the main node. Normally, DCs will use hardware firewa... | Keeping your HN's system up to date and correctly configuring its firewalling rules should suffice. I recommend using Shorewall instead of bare iptables because it's so much easier to read (and hence easier to keep well configured). There's [specific documentation](http://www.shorewall.net/OpenVZ.html) for configuring ... |
307,578 | I'm running a server using OpenVZ for a few websites. Nothing in HN except for sshd. A VM for Varnish, a VM for MySQL and a few VMs each for one website (running Apache/PHP). Now I'd like to secure this server, mostly from network attack (I think).
What I should do? I see that I should not install Selinux in HN. Insta... | 2011/09/02 | [
"https://serverfault.com/questions/307578",
"https://serverfault.com",
"https://serverfault.com/users/88934/"
] | Keeping your HN's system up to date and correctly configuring its firewalling rules should suffice. I recommend using Shorewall instead of bare iptables because it's so much easier to read (and hence easier to keep well configured). There's [specific documentation](http://www.shorewall.net/OpenVZ.html) for configuring ... | If using the standard venet automatic ip assigment of OpenVZ distributions (as proxmox) you need separate CSF / firewalls on host and virtual machines. This is, depending on your hosting or network config your venet IPs assigned to VMs are not necesarilly be protected.
We use Proxmox PVE and install separate CSF on hos... |
307,578 | I'm running a server using OpenVZ for a few websites. Nothing in HN except for sshd. A VM for Varnish, a VM for MySQL and a few VMs each for one website (running Apache/PHP). Now I'd like to secure this server, mostly from network attack (I think).
What I should do? I see that I should not install Selinux in HN. Insta... | 2011/09/02 | [
"https://serverfault.com/questions/307578",
"https://serverfault.com",
"https://serverfault.com/users/88934/"
] | Configuring firewall in the HW node is tricky as you have to consider all the traffic going through the node from/to your VPSs before enabling the firewall in HW node. You may need to do an audit and configure the firewall accordingly, if you are going to use one in the main node. Normally, DCs will use hardware firewa... | If using the standard venet automatic ip assigment of OpenVZ distributions (as proxmox) you need separate CSF / firewalls on host and virtual machines. This is, depending on your hosting or network config your venet IPs assigned to VMs are not necesarilly be protected.
We use Proxmox PVE and install separate CSF on hos... |
22,971,617 | I want to output this result at screen :
>
> 1
> 23
> 456
> 78910
>
>
>
>
how to do that??
I tried to write this code:
```
for (int line = 1; line <= 4; line++){
int num = line;
int i = 1;
for (int x = 1; x <= line; x++){
cout << num;
num = num + i;
}
cout << ... | 2014/04/09 | [
"https://Stackoverflow.com/questions/22971617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3365544/"
] | Create `num` outside the `for` loop and increment it after you write it out.
```
int num = 1;
for (int line = 1; line <= 4; line++){
for (int x = 1; x <= line; x++){
cout << num;
++num;
}
cout << endl;
}
``` | ```
int num = 1;
int i = 1;
for (int line = 1; line <= 4; line++){
for (int x = 1; x <= line; x++){
cout << num;
num = num + i;
}
cout << endl;
}
``` |
52,218,165 | Could you please help me convert this in to click event instead of hover
```css
<script>
$(document).ready(function () {
//Show then hide ddown menu on hover
$('.menuitem').hover(function () {
$(this).children('.navmain').slideDown(500);
}, function () {
$(this).children('.navmain').s... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52218165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10329475/"
] | your static library is a set of services, so it comes with a header file containing the protoype of the functions you want to expose to the outside. If you don't put a `main` symbol here, well, noone will put one for you fortunately.
(note that the filename isn't relevant, it's the *symbol* name which is relevant: `ma... | To answer your question it may be worthwile to understand what the basic meaning of compiling and linking a C program from source is, and how libraries come into play.
Compiling a *source file* creates an *object file* which you can imagine as "structured machine code". It is structured in that it contains *symbols* —... |
57,437,667 | I have an upload progress bar that works upon file input and when the bar reaches 100%, there is no error. But as I print the contents of the file in Spring Boot, I notice that the code within the for loop does not run. Here is the code. Please help and thank you!
JavaScript:
```
function upload(file) {
var formD... | 2019/08/09 | [
"https://Stackoverflow.com/questions/57437667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10183790/"
] | **Sample 1**
As mentioned in my comment, the first solution is to access the `update` property and invoke `push()` on it since you already defined `update` to contain an `Array` instance:
```
//starting loop
for ( i = 0; i < lastrow; i++){
APIPayloadObject.update.push({
id: loopRange[i][0],
name: loo... | This is a great use case for [Array.prototype.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
```js
// @param {sheetValues[][]} loopRange
function getPayload(loopRange) {
return JSON.stringify({
update: loopRange.map(function (row) {
return {id: row[0], nam... |
116,808 | Every email we send is causing qmail to send an email to log@servername.domain.com
How do I disable this?
Thank you,
Chance
EDIT:
I created `/var/qmail/alias/.qmail-log` containing `|exit 0`
Hope this helps! | 2010/02/25 | [
"https://serverfault.com/questions/116808",
"https://serverfault.com",
"https://serverfault.com/users/4541/"
] | There is caching taking place in SQL. Here is how to see it in SQL Server 2008 R2 and how to reset it. This is for a Windows user that is in an AD group and where the group has been added as a login in SQL. The user has not been added directly as a SQL login.
**connect with original username**
Connect to SQL as a use... | It's not cached on the SQL Server - you can see it in the system view:
```
SELECT name, sid FROM sys.server_principals;
```
You can update the name for the LOGIN by running the ALTER LOGIN statement, similar to:
```
ALTER LOGIN OldName WITH NAME = NewName;
```
Run the SELECT statement above to see the desired ch... |
5,425,128 | I have an ObservableCollection and a Datagrid.
What I do is:
```
datagrid.ItemsSource = observableCollection1;
```
And I need to make a binding to the observableCollection.Count attribute.
I tryed:
```
Tag="{Binding ObservableCollection.Count}"
Tag = "{Binding Count}"
Tag = "{Binding .Count}"
Tag = "{Bind... | 2011/03/24 | [
"https://Stackoverflow.com/questions/5425128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273119/"
] | Tags must be bound to strings. You should create a converter to cast it from a numeric value to string. If you only see 0 this is probably the resolution. This would be the first thing I would explore though you would expect it cast it using ToString().
See this for how to do it:
<http://forums.silverlight.net/forums... | What I do is take the selected item from the datagrid attribute SelectedItem and with that I don't have to put tags to buttons ;) |
5,425,128 | I have an ObservableCollection and a Datagrid.
What I do is:
```
datagrid.ItemsSource = observableCollection1;
```
And I need to make a binding to the observableCollection.Count attribute.
I tryed:
```
Tag="{Binding ObservableCollection.Count}"
Tag = "{Binding Count}"
Tag = "{Binding .Count}"
Tag = "{Bind... | 2011/03/24 | [
"https://Stackoverflow.com/questions/5425128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273119/"
] | ```
Tag="{Binding ItemsSource.Count, RelativeSource={RelativeSource Self}}"
``` | Tags must be bound to strings. You should create a converter to cast it from a numeric value to string. If you only see 0 this is probably the resolution. This would be the first thing I would explore though you would expect it cast it using ToString().
See this for how to do it:
<http://forums.silverlight.net/forums... |
5,425,128 | I have an ObservableCollection and a Datagrid.
What I do is:
```
datagrid.ItemsSource = observableCollection1;
```
And I need to make a binding to the observableCollection.Count attribute.
I tryed:
```
Tag="{Binding ObservableCollection.Count}"
Tag = "{Binding Count}"
Tag = "{Binding .Count}"
Tag = "{Bind... | 2011/03/24 | [
"https://Stackoverflow.com/questions/5425128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/273119/"
] | ```
Tag="{Binding ItemsSource.Count, RelativeSource={RelativeSource Self}}"
``` | What I do is take the selected item from the datagrid attribute SelectedItem and with that I don't have to put tags to buttons ;) |
25,343,487 | I have this code and I'm not able to create a new array for further use:
```
var request = require("request");
var cheerio = require("cheerio");
var pag = [];
request('http://www.tastez.ro/tv.php?query=sopcast', function(error, response, body) {
if (error) {
return console.error('upload failed:', error);
}
... | 2014/08/16 | [
"https://Stackoverflow.com/questions/25343487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2276955/"
] | Node.js is async, that means the scrape hasn't finished yet when you go to print out the array.
I'm not totally sure what your end goal is, but here is a way to do what you are trying with minimal changes:
```
var request = require("request");
var cheerio = require("cheerio");
var pag = [];
var scrape = function( ca... | Catalyst is right, the problem is that you are not waiting for the async request call to complete. Here is my solution:
```
function getLinks(callback){
request('http://www.tastez.ro/tv.php?query=sopcast', function(error, response, body) {
if (error) {
callback(new Error('upload failed:', error),null);
}
... |
12,505,130 | I have the following route:
```
resources :foods do
collection do
post :f01a
end
end
```
and controller:
```
def f01a
@user = User.find(params[:id])
@eat = Eat.find_by_user_id(@user)
@eat.toggle!(:f01)
redirect_to @user
end
```
and view:
```
<%= button_to "add f01a", send(:"f01a_foods_path", id: @user.id), ... | 2012/09/20 | [
"https://Stackoverflow.com/questions/12505130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1568666/"
] | First decorate the button with a class name specific to it:
```
<%= button_to "add f01a", send(:"f01a_foods_path", id: @user.id), class: "f01a btn btn-large btn-primary" %>
```
Then, put the following javascript in your application.js file and call it once the DOM is ready:
```
$('form .f01a').submit(function() { ... | Angelo Chrysoulakis suggested good way to resolve your problem.
Also, if you want, then you can use masking on whole page which show some processing or waiting message to your user so that your user doesn't do any changes or click on other part of page till your process complete.
Here is good article or lib to achive... |
27,158,266 | I have a Git-Enabled ASP.NET WebApp with one associated Azure WebJob. When I deploy this via Visual Studio everything is fine, but this is kinda hard in a Continuous Delivery Environment so I would like to publish the Web App and the WebJob via Git.
Via the Azure Tooling I associated my WebJob project and I got a "web... | 2014/11/26 | [
"https://Stackoverflow.com/questions/27158266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602449/"
] | Indeed, the problem is that the scenario is not yet well supported. Specifically, when publishing via git (or GitHub/Bitbucket), the `webjob-publish-settings.json` file is ignored.
One workaround is to publish once using VS just to get the scheduler created, and then use git afterwards.
Eventually, this scenario will... | Until there's a better supported mechanism for this from Azure, you could look into scripting this out using PowerShell. See: [Create a Scheduled Azure WebJob with PowerShell](https://stackoverflow.com/questions/25307232/create-a-scheduled-azure-webjob-with-powershell) |
27,158,266 | I have a Git-Enabled ASP.NET WebApp with one associated Azure WebJob. When I deploy this via Visual Studio everything is fine, but this is kinda hard in a Continuous Delivery Environment so I would like to publish the Web App and the WebJob via Git.
Via the Azure Tooling I associated my WebJob project and I got a "web... | 2014/11/26 | [
"https://Stackoverflow.com/questions/27158266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602449/"
] | There is finally a solution for deploying scheduled webjobs with git deployment.
[This](http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/#.VZWmh_lVhBc) blog has details.
The solution uses the kudu scheduler as opposed to the Azure scheduler so the Azure portal still shows the job as "On Demand" but it... | Indeed, the problem is that the scenario is not yet well supported. Specifically, when publishing via git (or GitHub/Bitbucket), the `webjob-publish-settings.json` file is ignored.
One workaround is to publish once using VS just to get the scheduler created, and then use git afterwards.
Eventually, this scenario will... |
27,158,266 | I have a Git-Enabled ASP.NET WebApp with one associated Azure WebJob. When I deploy this via Visual Studio everything is fine, but this is kinda hard in a Continuous Delivery Environment so I would like to publish the Web App and the WebJob via Git.
Via the Azure Tooling I associated my WebJob project and I got a "web... | 2014/11/26 | [
"https://Stackoverflow.com/questions/27158266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/602449/"
] | There is finally a solution for deploying scheduled webjobs with git deployment.
[This](http://blog.amitapple.com/post/2015/06/scheduling-azure-webjobs/#.VZWmh_lVhBc) blog has details.
The solution uses the kudu scheduler as opposed to the Azure scheduler so the Azure portal still shows the job as "On Demand" but it... | Until there's a better supported mechanism for this from Azure, you could look into scripting this out using PowerShell. See: [Create a Scheduled Azure WebJob with PowerShell](https://stackoverflow.com/questions/25307232/create-a-scheduled-azure-webjob-with-powershell) |
41,257,502 | I would like to backup a **single database** residing in a dbspace , while backup utilities in **Informix** such as `onbar` or `ontape` would provide whole system ,logs ,dbspaces backup only .Is there any way to do single database backup in **Informix** ? if there is then please tell me how to *backup* and *restore* a ... | 2016/12/21 | [
"https://Stackoverflow.com/questions/41257502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5917997/"
] | If you need backup you could put database in its own dbspace.
Then use "warm restore" only for that dbspace.
If you want to migrate database from instance to instance
you can use dbexport/dbimport or onunload/onload but be careful
and read the manuals first. There are some drawbacks connected with both utilities. | Simply put, Informix does not have a database level backup and restore option. As you mentioned, onbar and ontape allow you to do backups and restore for the entire Informix instance. Having said that, if you are interested in having redundancy for a single database (residing in a dbspace) you can achieve it by turning... |
41,257,502 | I would like to backup a **single database** residing in a dbspace , while backup utilities in **Informix** such as `onbar` or `ontape` would provide whole system ,logs ,dbspaces backup only .Is there any way to do single database backup in **Informix** ? if there is then please tell me how to *backup* and *restore* a ... | 2016/12/21 | [
"https://Stackoverflow.com/questions/41257502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5917997/"
] | If you need backup you could put database in its own dbspace.
Then use "warm restore" only for that dbspace.
If you want to migrate database from instance to instance
you can use dbexport/dbimport or onunload/onload but be careful
and read the manuals first. There are some drawbacks connected with both utilities. | you can use the multitenancy feature if you are running an ids12.10 version. There's a special flag -T to restore a database with onbar in a multitenancy environment. |
45,768,784 | This is `table1` in SQL Server:
```
Last Country colA colB colC
------------------------------------
1 ARG NA NA NA
2 NULL NA NA NA
3 CAM NA NA NA
4 NULL NA NA NA
5 NULL NA NA NA
```
This is my dataframe `DF` in R:
`... | 2017/08/19 | [
"https://Stackoverflow.com/questions/45768784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6123057/"
] | You can use the builtin `max` function and provide a matching key:
```
# The input to search over
l = [{'a':''}, {'a':'', 'b':''}, {'a':'','b':'','c':''}]
# Extract the keys we'd like to search for
t = set({'a': '', 'c': ''}.keys())
# Find the item in l that shares maximum number of keys with the requested item
match... | ```
>>> lst = [{'a':'a'},{'a':'a','b':'b'},{'a':'a','b':'b','c':'c'}]
>>> seen = {}
>>> [seen.update({key:value}) for dct in lst for key,value in dict(dct).items() if key not in seen.keys()]
>>> seen
```
**Output**
```
{'a': 'a', 'c': 'c', 'b': 'b'}
```
[check here](https://repl.it/KQ2j/0) |
13,985,946 | I have upgraded my phonegap version to 2.1 and lot of errors are showing.
On the github there is no section talking about google analytics for 2.1.
[GitHub](https://github.com/purplecabbage/phonegap-plugins/tree/master/iOS)
Any idea about how to make them work together | 2012/12/21 | [
"https://Stackoverflow.com/questions/13985946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1298402/"
] | If this is for iOS I recently put together [this](https://github.com/jelled/google-analytics-cordova-ios "https://github.com/jelled/google-analytics-cordova-ios") Git of the plugin code I used to get the latest Google Analytics working with Cordova 2.2.0. Note that the latest Google Analytics SDK uses different framewo... | in the [README](https://github.com/purplecabbage/phonegap-plugins/blob/master/iOS/GoogleAnalytics/README.md), it said:
>
> Make sure you are running Cordova(PhoneGap) 1.5.0
>
>
>
In short, the plugin does not support PhoneGap 2.1 . |
26,335,132 | I want to save **settings for my users** and some of them would be one out of a **predefined list**! Using <https://github.com/ledermann/rails-settings> ATM.
The setting for f.e. weight\_unit would be out of [:kg, :lb].
I don't really want to hardcode that stuff into controller or view code.
It's kind of a common f... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26335132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3274024/"
] | Usually, when I have to store some not important information which I don't care to query individually, I store them on a serialized column.
In your case you could create a new column in your users table (for example call it "settings").
After that you add to user model
```
serialize :settings, Hash
```
from this m... | Based on your question, it sounds like these are more configuration options that a particular user will choose from that may be quite static, rather than dynamic in nature in that the options can change over time. For example, I doubt you'll be adding various other `weight_units` other than `:kg` and `:lb`, but it's po... |
26,335,132 | I want to save **settings for my users** and some of them would be one out of a **predefined list**! Using <https://github.com/ledermann/rails-settings> ATM.
The setting for f.e. weight\_unit would be out of [:kg, :lb].
I don't really want to hardcode that stuff into controller or view code.
It's kind of a common f... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26335132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3274024/"
] | Usually, when I have to store some not important information which I don't care to query individually, I store them on a serialized column.
In your case you could create a new column in your users table (for example call it "settings").
After that you add to user model
```
serialize :settings, Hash
```
from this m... | If you are using PostgreSQL, I think you can watch to HStore with Rails 4 + this gem <https://github.com/devmynd/hstore_accessor> |
26,335,132 | I want to save **settings for my users** and some of them would be one out of a **predefined list**! Using <https://github.com/ledermann/rails-settings> ATM.
The setting for f.e. weight\_unit would be out of [:kg, :lb].
I don't really want to hardcode that stuff into controller or view code.
It's kind of a common f... | 2014/10/13 | [
"https://Stackoverflow.com/questions/26335132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3274024/"
] | Based on your question, it sounds like these are more configuration options that a particular user will choose from that may be quite static, rather than dynamic in nature in that the options can change over time. For example, I doubt you'll be adding various other `weight_units` other than `:kg` and `:lb`, but it's po... | If you are using PostgreSQL, I think you can watch to HStore with Rails 4 + this gem <https://github.com/devmynd/hstore_accessor> |
157,045 | When I restarted my Ubuntu workstation after a firefox crash, my taskbar disappeared. I'm referring to the bar at the bottom of the screen, where the currently-open programs are displayed. Also, I remember I could switch from one virtual screen to the next one there. At the very right, there was a button on it that wou... | 2012/06/28 | [
"https://askubuntu.com/questions/157045",
"https://askubuntu.com",
"https://askubuntu.com/users/50412/"
] | Its Easy, hold `Super+Alt+click` on the upper task bar and click add new panel. Then using the same key combinations select `add to panel` and then select the options you want such a workspace switcher, etc | I reached this in search of an answer and found a solution myself. Maybe it will help the others. In the meanwhile 16.04, there is a possible to do this using tweak-tools.
```
sudo apt-get install gnome-tweak-tool
sudo apt-get install unity-tweak-tool
```
Go to Extensions and activate : `Display a window list at th... |
87,596 | I am trying to better understand the bias and variance trade-off, and tried to create a R example. It attempts to calculate the bias and variance of smoothing splines with different parameters. However, I fear that bias and MSE calculations are incorrect (based on graph) and i fail to demonstrate that the MSE is equal ... | 2014/02/23 | [
"https://stats.stackexchange.com/questions/87596",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/36680/"
] | If I've understood the question correctly, the goal is to evaluate an estimator for $y$. If so, the problem is that you're counting the irreducible error twice. In mathematical notation, letting the estimate be denoted by $Z$, we have $$\begin{split}\textrm{MSE}(Z)
&= \mathbb{E} ((Z-y)^2 ) \\
&=\mathbb{E} ((Z-\mathbb{... | Based on my limited understanding, there are few things that can be noted from the last portion of your R code:
1. The simulation looks like a bootstrap but I am not sure that is correct.
2. The equation $\text{MSE} = \text{bias}^2 + \text{var(estimator)}$ holds in theory, but what we got here is only the estimated va... |
149,928 | I'm getting a lot of messages like these:
```
me@home:/etc/snmp$ tail /var/log/syslog
Jun 12 17:52:15 home nullmailer[1238]: Starting delivery: protocol: smtp host: mail. file: 1339502401.24665
Jun 12 17:52:15 home nullmailer[7086]: smtp: Failed: Connect failed
Jun 12 17:52:15 home nullmailer[1238]: Sending failed: H... | 2012/06/12 | [
"https://askubuntu.com/questions/149928",
"https://askubuntu.com",
"https://askubuntu.com/users/39633/"
] | To see the contents of one of the messages in the queue, try something like this: (obviously replacing the numeric filename with an actual one from your syslog)
```
$ sudo cat /var/spool/nullmailer/queue/1347323616.6506
```
Note that you have to use either `sudo` or be logged in as root due to permissions on the que... | Might be worth trying
```
sudo apt-get install php5-mcrypt
```
as all the messages being sent were php errors on my system and several other people have reported this as a problem. |
149,928 | I'm getting a lot of messages like these:
```
me@home:/etc/snmp$ tail /var/log/syslog
Jun 12 17:52:15 home nullmailer[1238]: Starting delivery: protocol: smtp host: mail. file: 1339502401.24665
Jun 12 17:52:15 home nullmailer[7086]: smtp: Failed: Connect failed
Jun 12 17:52:15 home nullmailer[1238]: Sending failed: H... | 2012/06/12 | [
"https://askubuntu.com/questions/149928",
"https://askubuntu.com",
"https://askubuntu.com/users/39633/"
] | To see the contents of one of the messages in the queue, try something like this: (obviously replacing the numeric filename with an actual one from your syslog)
```
$ sudo cat /var/spool/nullmailer/queue/1347323616.6506
```
Note that you have to use either `sudo` or be logged in as root due to permissions on the que... | You seem to have installed `nullmailer` but no possibility to sent the emails to on your mashine. All those mails are being tried to send on every startup. also if you restart nullmailer, you will generate those messages again:
```
sudo /etc/init.d/nullmailer restart
```
have a look in your mail queue:
```
sudo su
... |
149,928 | I'm getting a lot of messages like these:
```
me@home:/etc/snmp$ tail /var/log/syslog
Jun 12 17:52:15 home nullmailer[1238]: Starting delivery: protocol: smtp host: mail. file: 1339502401.24665
Jun 12 17:52:15 home nullmailer[7086]: smtp: Failed: Connect failed
Jun 12 17:52:15 home nullmailer[1238]: Sending failed: H... | 2012/06/12 | [
"https://askubuntu.com/questions/149928",
"https://askubuntu.com",
"https://askubuntu.com/users/39633/"
] | You seem to have installed `nullmailer` but no possibility to sent the emails to on your mashine. All those mails are being tried to send on every startup. also if you restart nullmailer, you will generate those messages again:
```
sudo /etc/init.d/nullmailer restart
```
have a look in your mail queue:
```
sudo su
... | Might be worth trying
```
sudo apt-get install php5-mcrypt
```
as all the messages being sent were php errors on my system and several other people have reported this as a problem. |
306,109 | Does anyone know how we can differenciate Order Status And Order State ? | 2020/03/04 | [
"https://magento.stackexchange.com/questions/306109",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/71016/"
] | The “order state” and “order status” are usually mixed up since their names and functions are quite similar.
* 1,Order Status. All orders have an order status that is associated with a stage in the order processing workflow
* 1,An order state is a position of an order in the curent processing flow.
* 2,Magento Order S... | The order status is just a label for the order state. It doesn't represent any logic or workflow.
You could even assign the "status" closed for pending payments.
If you have PayPal, CC and Checkmo as Payment options, you might want to assign different order statuses for each of those when there's a pending payment. ... |
306,109 | Does anyone know how we can differenciate Order Status And Order State ? | 2020/03/04 | [
"https://magento.stackexchange.com/questions/306109",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/71016/"
] | The `order state` and `order status` are usually mixed up since their names and functions are similar.
An order state is a position of an order in the current processing flow. Magento has the following pre-defines order states:
```
New
Pending Payment
Processing
Complete
Closed
Canceled
On Hold
Payment Review
```
E... | The order status is just a label for the order state. It doesn't represent any logic or workflow.
You could even assign the "status" closed for pending payments.
If you have PayPal, CC and Checkmo as Payment options, you might want to assign different order statuses for each of those when there's a pending payment. ... |
306,109 | Does anyone know how we can differenciate Order Status And Order State ? | 2020/03/04 | [
"https://magento.stackexchange.com/questions/306109",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/71016/"
] | The `order state` and `order status` are usually mixed up since their names and functions are similar.
An order state is a position of an order in the current processing flow. Magento has the following pre-defines order states:
```
New
Pending Payment
Processing
Complete
Closed
Canceled
On Hold
Payment Review
```
E... | The “order state” and “order status” are usually mixed up since their names and functions are quite similar.
* 1,Order Status. All orders have an order status that is associated with a stage in the order processing workflow
* 1,An order state is a position of an order in the curent processing flow.
* 2,Magento Order S... |
381,896 | This morning I had to restart my windows 7 computer due to a security patch. As it was restarting, all the icons on the desktop appeared, then turned white and then the original images started reappearing. This is a common phenomenon after a restart and I've seen it other times (such as when I minimize all my windows).... | 2012/01/24 | [
"https://superuser.com/questions/381896",
"https://superuser.com",
"https://superuser.com/users/95820/"
] | This seems like you may have a lot of start-up processes and services starting up all at the same time. This is both very CPU and memory-intensive. So when Explorer is initializing, it is sharing the load, and Explorer and the svchost services associated with it likely take up the most resources. A few things you could... | It's the intial load of your desktop by the OS, then a refresh. There could have been a process running in the background, and then terminated, which could have caused a refresh. |
381,896 | This morning I had to restart my windows 7 computer due to a security patch. As it was restarting, all the icons on the desktop appeared, then turned white and then the original images started reappearing. This is a common phenomenon after a restart and I've seen it other times (such as when I minimize all my windows).... | 2012/01/24 | [
"https://superuser.com/questions/381896",
"https://superuser.com",
"https://superuser.com/users/95820/"
] | Hate to say it, but these answers are all wrong. :)
To stop icons from refreshing, hit the START button, and in the box at the bottom, enter "msconfig". Click on msconfig.exe (which launches System Configuration), click on the "services" tab. Scroll down the list and deactivate the "Server" service. Click "ok" and reb... | It's the intial load of your desktop by the OS, then a refresh. There could have been a process running in the background, and then terminated, which could have caused a refresh. |
381,896 | This morning I had to restart my windows 7 computer due to a security patch. As it was restarting, all the icons on the desktop appeared, then turned white and then the original images started reappearing. This is a common phenomenon after a restart and I've seen it other times (such as when I minimize all my windows).... | 2012/01/24 | [
"https://superuser.com/questions/381896",
"https://superuser.com",
"https://superuser.com/users/95820/"
] | This seems like you may have a lot of start-up processes and services starting up all at the same time. This is both very CPU and memory-intensive. So when Explorer is initializing, it is sharing the load, and Explorer and the svchost services associated with it likely take up the most resources. A few things you could... | This is a common issue that you'll see with windows refreshing the desktop. You normally see this on slower machines that can't satisfy the resource requirements of "explorer.exe". While there are some minor fixes you can implement, they really don't do a whole lot to prevent this.
Is this behavior something relative... |
381,896 | This morning I had to restart my windows 7 computer due to a security patch. As it was restarting, all the icons on the desktop appeared, then turned white and then the original images started reappearing. This is a common phenomenon after a restart and I've seen it other times (such as when I minimize all my windows).... | 2012/01/24 | [
"https://superuser.com/questions/381896",
"https://superuser.com",
"https://superuser.com/users/95820/"
] | Hate to say it, but these answers are all wrong. :)
To stop icons from refreshing, hit the START button, and in the box at the bottom, enter "msconfig". Click on msconfig.exe (which launches System Configuration), click on the "services" tab. Scroll down the list and deactivate the "Server" service. Click "ok" and reb... | This seems like you may have a lot of start-up processes and services starting up all at the same time. This is both very CPU and memory-intensive. So when Explorer is initializing, it is sharing the load, and Explorer and the svchost services associated with it likely take up the most resources. A few things you could... |
381,896 | This morning I had to restart my windows 7 computer due to a security patch. As it was restarting, all the icons on the desktop appeared, then turned white and then the original images started reappearing. This is a common phenomenon after a restart and I've seen it other times (such as when I minimize all my windows).... | 2012/01/24 | [
"https://superuser.com/questions/381896",
"https://superuser.com",
"https://superuser.com/users/95820/"
] | Hate to say it, but these answers are all wrong. :)
To stop icons from refreshing, hit the START button, and in the box at the bottom, enter "msconfig". Click on msconfig.exe (which launches System Configuration), click on the "services" tab. Scroll down the list and deactivate the "Server" service. Click "ok" and reb... | This is a common issue that you'll see with windows refreshing the desktop. You normally see this on slower machines that can't satisfy the resource requirements of "explorer.exe". While there are some minor fixes you can implement, they really don't do a whole lot to prevent this.
Is this behavior something relative... |
175,049 | There is a website my company uses for personal data provided by a second party. In the password creation page it is possible to create a 30-character password, but attempting to login with this password throws an invalid password error. Using shorter passwords are possible.
Should my company be concerned? Is this ind... | 2017/12/07 | [
"https://security.stackexchange.com/questions/175049",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/165622/"
] | Obviously whoever built this was not very good at what they were doing and/or not really paying much attention to detail. When working with security critical things like authentication, that's not great.
Think of it like this: If you found that your electricity guy had accidentally installed the outlet sockets upside ... | I dont believe it is possible to draw conclusions about the whole system from this error.
I do think this is an issue that can be solved and should be solved.
It might be wise to do some research on the security, but I think you can't draw good conclusions with just this information. |
43,901,638 | *I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..*
So I have some black text on a red background.
When I click the text, I tell Java to change the text to white and background to blue, and it does.
When I ... | 2017/05/10 | [
"https://Stackoverflow.com/questions/43901638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7956460/"
] | One way to do it, is a `switch` statement with fall-through behavior:
```
switch (star.returnZones()) {
case 5: this.createPlanet(planet5, star); // fall-through
case 4: this.createPlanet(planet4, star); // fall-through
case 3: this.createPlanet(planet3, star); // fall-through
case 2: this.createPlanet... | There is another solution similar to the first part of the answer of @njzk2: It is `switch/case` with *fall through*:
```
int zones = star.returnZones();
switch (zones ) {
case 5:
createPlanet(planet5, star);
case 4:
createPlanet(planet4, star);
case 3:
createPlanet(planet3, star);
case 2:
createPl... |
43,901,638 | *I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..*
So I have some black text on a red background.
When I click the text, I tell Java to change the text to white and background to blue, and it does.
When I ... | 2017/05/10 | [
"https://Stackoverflow.com/questions/43901638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7956460/"
] | Start by removing the duplicates:
```
int zones = star.returnZones();
if (zones >= 1) {
createPlanet(planet1, star);
}
if (zones >= 2) {
createPlanet(planet2, star);
}
...
```
You can see that in the example where `zones == 2`, it does execute the 2 blocks, so you keep the same functionality.
Then, you can ... | Just a slight variation on the arrays answer:
```
List<Planet> planets = Arrays.asList(planet1, planet2, planet3 /*etc*/);
for (Planet p : planets.subList(0, start.returnZones()) {
createPlanet(p, star);
}
``` |
43,901,638 | *I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..*
So I have some black text on a red background.
When I click the text, I tell Java to change the text to white and background to blue, and it does.
When I ... | 2017/05/10 | [
"https://Stackoverflow.com/questions/43901638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7956460/"
] | Add the planet objects to an array, and then you can write:
```
Planet[] planets = {planet1, planet2, planet3, planet4, planet5};
for (int i = 0; i < star.returnZones(); i++) {
this.createPlanet(planets[i], star);
}
``` | The other answers are correct that repetitive work like this can be handled neatly with a loop.
With **Java 8** there is an another, arguably even neater, option - using the Stream API to declare the repetitive work in a functional style. You can get the entire thing done in a one-liner.
```
Arrays.asList(planet1, p... |
43,901,638 | *I only just started learning XML and Java code this week, thanks to Udacity's course... I'm barely halfway through but I felt like making my own pointless app..*
So I have some black text on a red background.
When I click the text, I tell Java to change the text to white and background to blue, and it does.
When I ... | 2017/05/10 | [
"https://Stackoverflow.com/questions/43901638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7956460/"
] | Start by removing the duplicates:
```
int zones = star.returnZones();
if (zones >= 1) {
createPlanet(planet1, star);
}
if (zones >= 2) {
createPlanet(planet2, star);
}
...
```
You can see that in the example where `zones == 2`, it does execute the 2 blocks, so you keep the same functionality.
Then, you can ... | The other answers are correct that repetitive work like this can be handled neatly with a loop.
With **Java 8** there is an another, arguably even neater, option - using the Stream API to declare the repetitive work in a functional style. You can get the entire thing done in a one-liner.
```
Arrays.asList(planet1, p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.