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 |
|---|---|---|---|---|---|
21,668,250 | I'm trying to make a program that will get the user input of a new file name, create the file, and write to it. It works but it will only write the first word of the string to the file. How can i get it to write the full string? thanks.
```
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <string>
u... | 2014/02/10 | [
"https://Stackoverflow.com/questions/21668250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3150762/"
] | According to [this post](https://stackoverflow.com/questions/5455802/how-to-read-a-complete-line-from-the-user-using-cin), you should consult [this reference](http://www.cplusplus.com/reference/fstream/fstream/) to use a method like getline().
Also, when you are writing out I recommend that you flush the output (cout.... | `cin<<w;` cin would stop consuming input character when it encounter whitespace tab and other unseeable characters.
you should probably use `std::getline()` instead.
take a look at this page for ref.
<http://en.cppreference.com/w/cpp/string/basic_string/getline>
Or you can use manipulator to not skip whitespace. |
31,870 | I'm trying to find undirected random graphs $G(V,E)$ with $|V|$ = $d^2$ for $d \in \mathbb{N}$ such that $\forall v \in V: deg(v) = d$.
For $d \in 2\mathbb{N} +1$ this trivially is impossible as no such graph exists: The number of incidences (connections between vertices and edges) is given by $|V|\cdot d = d^3 = 8k^3... | 2015/06/30 | [
"https://cstheory.stackexchange.com/questions/31870",
"https://cstheory.stackexchange.com",
"https://cstheory.stackexchange.com/users/1908/"
] | The standard simple way of generating random regular graphs is:
* while the degree < d
+ choose a random perfect matching from the edges still possible to add to the graph
+ If no matching is possible, restart the process.
The problem with this is that the higher edge degree you want, the more likely it is for the ... | Much progress was made recently in this area, see in particular this FOCS'19 paper:
```
Fast uniform generation of random graphs with given degree sequences
Andrii Arman, Pu Gao, Nicholas Wormald
```
and the [more extensive arxiv version](https://arxiv.org/abs/1905.03446).
This paper presents an $O(nd+d^4)$ time al... |
34,601,754 | JavaScrpt expert,
i want if the below script exist in my template coding then my page should redirect to example.com
```
<script>
$(document).ready(function(){
$("#wrapper").hide();
})
</script>
```
if the above script exist in my template, then it should redirect to example.com
**Attention:**... | 2016/01/04 | [
"https://Stackoverflow.com/questions/34601754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5741391/"
] | If you need this functionality somewhere after the bit of code you show, this would work:
```
var $wrapper=$("#wrapper");
if($wrapper.length>0 && !$wrapper.is(':visible')){
// #wrapper exists on the page but is not visible, redirect user
window.location.href = "http://example.com";
}
``` | What Taplar says is:
```
<script>
$(document).ready(function(){
// $("#wrapper").hide();
window.location.href = "http://example.com";
})
</script>
```
If you need this behaviour in another place in your code, then see DelightedD0D answer.
Very good point by DelightedD0D, I've fixed the c... |
15,369,589 | i use this script to compress all .txt and .cpi files into the backup folder in separated files with 7zip. After the files are zipped i delete the original files. However this script has a logical flaw. Lets say if the 7zip program fails to run, the files will also get deleted. How can i change the script so that it sh... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15369589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2120466/"
] | This is a partial solution to a partial question, but generally you would use:
`ORDER BY YEAR(TimeColumn), DATEPART(m, TimeColumn)` | Try this:
```
ORDER BY DatePart(y,time),DatePart(m,time)
``` |
15,369,589 | i use this script to compress all .txt and .cpi files into the backup folder in separated files with 7zip. After the files are zipped i delete the original files. However this script has a logical flaw. Lets say if the 7zip program fails to run, the files will also get deleted. How can i change the script so that it sh... | 2013/03/12 | [
"https://Stackoverflow.com/questions/15369589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2120466/"
] | This is a partial solution to a partial question, but generally you would use:
`ORDER BY YEAR(TimeColumn), DATEPART(m, TimeColumn)` | Repeating what has already been said
```
SELECT '01 jan 2012' AS Dt INTO #tempDates
UNION
SELECT '01 jun 2012'
UNION
SELECT '10 oct 2012'
UNION
SELECT '01 jan 2013'
--1
SELECT Dt
FROM #tempDates
ORDER BY DatePart(YY,Dt),DatePart(m,Dt)
--2
SELECT Dt
FROM #tempDates
ORDER BY YEAR(Dt), MONTH(Dt)
--3
SELECT Dt
FROM #te... |
82,435 | Is the full version of Quake II free now? If so, where can I find it - I don't see it available on ID's site, even in the Store section.
I see that there's a GPL source available. And I recall ID having made other's free as well. Is there an authoritative source? | 2012/09/03 | [
"https://gaming.stackexchange.com/questions/82435",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/16833/"
] | While id has [open-sourced the *engine*](https://github.com/id-Software/Quake-2), the game itself is not free (as in beer or speech).
>
> All of the Q2 data files remain copyrighted and licensed under the
> original terms, so you cannot redistribute data from the original game, but if
> you do a true total conve... | Quake 2's engine has been released as an open source product. The best proof of this I can find is the id Software [public git repository](https://github.com/id-Software). The actual game content however has not and you still need to buy a copy from steam if you want to play it.
The source code can also be found zippe... |
2,805,674 | I am experiencing problems creating a connection pool in glassfish v3,
just for reference i am using the Java EE glassfish bundle.
my enviroment vars are as follows
```
Url: jdbc:oracle:thin:@localhost:1521:xe
User: sys
Password : xxxxxxxx
```
which i think is all i need to make a connection. but i get the follow... | 2010/05/10 | [
"https://Stackoverflow.com/questions/2805674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337609/"
] | Copy the jdbc jar to $glassfish-v3/glassfish/domains/domain1/lib/ext/ and restart glassfish.
this should fix the problem. | it looks like the server doesn't have the jar that contains the class oracle.jdbc.pool.OracleDataSource on the classpath.
[there are a couple methods to do this](http://docs.sun.com/app/docs/doc/820-7692/ghatb?l=en&a=view).
The easiest way to get the class onto the classpath is to copy the jar that hold the class int... |
72,411,979 | I'm trying to style a group of images or paragraphs in a certain way,
```css
.products {
margin: 40px;
border-radius: 4px solid black;
}
```
```html
<div class="products"> <img src="images/bodybutter1.jpg" style="width 250px; height: 300px; border-radius: 15px;" alt="bodybutter"> <img src="images/bodybutter1.jpg"... | 2022/05/27 | [
"https://Stackoverflow.com/questions/72411979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19210232/"
] | You'll need to target the img tag inside the parent instead of targeting the parent div. See code below:
```
.products img {
margin: 40px;
border-radius: 4px solid black;
}
```
You can use this to reduce code duplication. | Note: The first property you have inline is missing the semicolon and breaking your code. Which may be why you are not seeing those styles applied to your image elements.
Because you are reusing the same style for every image you should remove those inline styles using the style attribute and use CSS to target those e... |
24,300 | In R, if I set.seed(), and then use the sample function to randomize a list, can I guarantee I won't generate the same permutation?
ie...
```
set.seed(25)
limit <- 3
myindex <- seq(0,limit)
for (x in seq(1,factorial(limit))) {
permutations <- sample(myindex)
print(permutations)
}
```
This produces
```
[1] ... | 2012/03/08 | [
"https://stats.stackexchange.com/questions/24300",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/7420/"
] | The question has many valid interpretations. The comments--especially the one indicating permutations of 15 or more elements are needed (15! = 1307674368000 is getting big)--suggest that what is wanted is a *relatively small* random sample, without replacement, of all n! = n\*(n-1)*(n-2)*...\*2\*1 permutations of 1:n. ... | I"m going to side step your first question a bit, and suggest that if your are dealing with relatively short vectors, you could simply generate all the permutations using `permn` and them randomly order *those* using `sample`:
```
x <- combinat:::permn(1:3)
> x[sample(factorial(3),factorial(3),replace = FALSE)]
[[1]]
... |
24,300 | In R, if I set.seed(), and then use the sample function to randomize a list, can I guarantee I won't generate the same permutation?
ie...
```
set.seed(25)
limit <- 3
myindex <- seq(0,limit)
for (x in seq(1,factorial(limit))) {
permutations <- sample(myindex)
print(permutations)
}
```
This produces
```
[1] ... | 2012/03/08 | [
"https://stats.stackexchange.com/questions/24300",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/7420/"
] | The question has many valid interpretations. The comments--especially the one indicating permutations of 15 or more elements are needed (15! = 1307674368000 is getting big)--suggest that what is wanted is a *relatively small* random sample, without replacement, of all n! = n\*(n-1)*(n-2)*...\*2\*1 permutations of 1:n. ... | Using `unique` in the right way ought to do the trick:
```
set.seed(2)
limit <- 3
myindex <- seq(0,limit)
endDim<-factorial(limit)
permutations<-sample(myindex)
while(is.null(dim(unique(permutations))) || dim(unique(permutations))[1]!=endDim) {
permutations <- rbind(permutations,sample(myindex))
}
# Resulting pe... |
43,950,988 | I am using ExtJS 6 version.
I have panel element and dynamically I am updating panel html as
```
panel.update("<img src=app/resources/first.jpg ></img>");
```
after updating html, image is not loading. I did `panel.updateLayout();` still image is not loading.
Please suggest | 2017/05/13 | [
"https://Stackoverflow.com/questions/43950988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373142/"
] | If you want the list of lines without the trailing new-line character you can use `str.splitlines()` method, which in this case you can read the file as string using `file_obj.read()` then use `splitlines()` over the whole string. Although, there is no need for such thing when the `open` function is already returned a ... | if you want to return a list of lines without `\n` and then print the length of this list:
```
def line_list(fname):
with open(fname) as file:
return file.read().splitlines()
word_list = line_list('dictionary.txt') # 1 word per line
print(len(word_list))
``` |
50,008,690 | I'm having some trouble implementing the boostrap/js/jquery date picker into my webpage. I am not sure if there is code I am missing or hwaat.
These are the includes in the head
```
<!-- Include Required Prerequisites -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<scrip... | 2018/04/24 | [
"https://Stackoverflow.com/questions/50008690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8569800/"
] | try
```
$("#datepicker").daterangepicker();
``` | It looks like you're selector in your javascript is wrong. In your html, you've defined datepicker as an id. In your javascript you're referencing it as a class. |
50,008,690 | I'm having some trouble implementing the boostrap/js/jquery date picker into my webpage. I am not sure if there is code I am missing or hwaat.
These are the includes in the head
```
<!-- Include Required Prerequisites -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/1/jquery.min.js"></script>
<scrip... | 2018/04/24 | [
"https://Stackoverflow.com/questions/50008690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8569800/"
] | try
```
$("#datepicker").daterangepicker();
``` | You are referencing your datepicker input via a classname `.datepicker` that it doesn't have. Either reference it via it's id, with `#datepicker` or add `class="datepicker"` to the input element. |
1,334,121 | I have several Ubuntu servers running on my Windows 2019 Hyper-V however I lost the ISO image. I downloaded `ubuntu-20.04.2-live-server-amd64.iso` and when I create a new VM it bombs every time:
[](https://i.stack.imgur.com/wRhUU.png)
What am I doing... | 2021/04/26 | [
"https://askubuntu.com/questions/1334121",
"https://askubuntu.com",
"https://askubuntu.com/users/1225018/"
] | Use the `numbered` when using `mv`
```
numbered, t
make numbered backups
```
[man mv](https://linux.die.net/man/1/mv)
`mv --backup=TYPE` with type being 1 of these:
* none, off never make backups (even if --backup is given)
* numbered, t make numbered backups
* existing, nil numbered if numbered backups exist, sim... | I would suggest using Thunar package manager, to rename and relocate files in bulk. You can install it with this command: `sudo apt-get install -y thunar` |
31,560,712 | I am digging for quite a while and I am wondering how do I open an HttpClient connection in Java (Android) and then close the socket(s) right away without getting CLOSE\_WAIT and TIME\_WAIT TCP statuses while I am checking network monitoring tools.
What I am doing is (Found this solution on stackoverflow site):
```
S... | 2015/07/22 | [
"https://Stackoverflow.com/questions/31560712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5142880/"
] | 1. If you want to write " #002s ", Why not write at once? May be the serial device cant identify the control code when you write each character.
```
void Test_Serial::writeDataToSerialPort()
{
QByteArray input = QString("#002s").toLocal8Bit();
serial->write(input);
}
```
2. And no need for this reading pa... | The issue ended up being that the `readyread` flag is only emitted if theirs data to read. However I was sending the data too quickly for the external device to receive it. This meant that some data was lost thus the device never recognised it as a valid command.
This meant that it was still waiting for the message t... |
1,387,296 | I am using `nl2br()` to convert `\n` characters to the `<br />` tag but I do not want more than one `<br />` tag at a time. For example, `Hello \n\n\n\n Everybody` should become `Hello <br /> Everybody`.
How can I do this? | 2009/09/07 | [
"https://Stackoverflow.com/questions/1387296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/169141/"
] | The most direct approach might be to first replace the multiple newlines with one using a simple regular expression:
```
nl2br(preg_replace("/\n+/", "\n", $input));
``` | I'd try replacing repeated newlines with single newlines using preg\_replace() first, then using nl2br to convert to HTML
tags. `nl2br(preg_replace('/\n+/', '\n', $the_string))` should do the trick (untested). |
1,387,296 | I am using `nl2br()` to convert `\n` characters to the `<br />` tag but I do not want more than one `<br />` tag at a time. For example, `Hello \n\n\n\n Everybody` should become `Hello <br /> Everybody`.
How can I do this? | 2009/09/07 | [
"https://Stackoverflow.com/questions/1387296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/169141/"
] | The most direct approach might be to first replace the multiple newlines with one using a simple regular expression:
```
nl2br(preg_replace("/\n+/", "\n", $input));
``` | If you have php 5.2.4+ you can use preg\_replace and the vertical whitespace character type `\v`
```
$str = preg_replace('/\v+/','<br>', $str);
``` |
1,387,296 | I am using `nl2br()` to convert `\n` characters to the `<br />` tag but I do not want more than one `<br />` tag at a time. For example, `Hello \n\n\n\n Everybody` should become `Hello <br /> Everybody`.
How can I do this? | 2009/09/07 | [
"https://Stackoverflow.com/questions/1387296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/169141/"
] | If you have php 5.2.4+ you can use preg\_replace and the vertical whitespace character type `\v`
```
$str = preg_replace('/\v+/','<br>', $str);
``` | I'd try replacing repeated newlines with single newlines using preg\_replace() first, then using nl2br to convert to HTML
tags. `nl2br(preg_replace('/\n+/', '\n', $the_string))` should do the trick (untested). |
48,497,134 | I have two DataFrames recommendations and movies. Columns rec1-rec3 in recommendations represent movie id from movies dataframe.
```
val recommendations: DataFrame = List(
(0, 1, 2, 3),
(1, 2, 3, 4),
(2, 1, 3, 4)).toDF("id", "rec1", "rec2", "rec3")
val movies = List(
(1, "the Lord of ... | 2018/01/29 | [
"https://Stackoverflow.com/questions/48497134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5123568/"
] | We can also use the functions `stack()` and `pivot()` to arrive at your expected output, joining the two dataframes only once.
```
// First rename 'id' column to 'ids' avoid duplicate names further downstream
val moviesRenamed = movies.withColumnRenamed("id", "ids")
recommendations.select($"id", expr("stack(3, 'rec1... | I figured it out. You should create aliases for your columns just like in SQL.
```
val joined = recommendation
.join(movies.select(col("id").as("id1"), 'name.as("n1")), 'id1 === recommendation.col("rec1"))
.join(movies.select(col("id").as("id2"), 'name.as("n2")), 'id2 === recommendation.col("rec2"))
.joi... |
31,979,254 | in my app Im trying to give the user points every time they create an event. I am setting up a PFQuery to retrieve the current score then saving the required points back to the class. My problem is that I can't update the score once it has been created so I need a way to "Update" the current score data with the added s... | 2015/08/13 | [
"https://Stackoverflow.com/questions/31979254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5002014/"
] | Since you already have the current user there's no reason to query it. However you should fetch it if needed to make sure you're working with the latest data. Once fetched set your score variable, add the 100 string and then save the updated score variable, like so:
```
if let currentUser = PFUser.currentUser() {
... | You need to query for the saved object and then just save like normal. It will update like so:
```
var query = PFQuery(className:"GameScore")
query.getObjectInBackgroundWithId("xWMyZEGZ") {
(gameScore: PFObject?, error: NSError?) -> Void in
if error != nil {
println(error)
} else if let gameScore = gameScore {
... |
25,670,647 | I have set my GAE web app with all the appropriate endpoints and deployed it locally on my ubuntu pc. I get connected to my home network, I found my computer's local IP, selected the correct port (8888 is the default for GAE web apps) tried to connect (from Chrome and my android device) but no luck. I get
`Google Chr... | 2014/09/04 | [
"https://Stackoverflow.com/questions/25670647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2583086/"
] | Make sure you set the --address=192.168.1.2 (for java) (--host=192.168.1.2 for python) flag when you startup the app | 192.168.1.2 is generally the router address, although it's possible you have set it as your local computer IP.
The --address flag will work as long as you have the correct LAN IP address, in your case, I think you got the wrong one.
If you are on Windows, go to your cmd and type ipconfig. Look for the field IPv4 Addr... |
355,367 | I have been using Ubuntu 11.10 on a VMWare for sometime now. I did a lot of customization on it (e.g. remove unity, install my applications etc.).
Last week I managed to get another laptop and installed Ubuntu 11.10 on it. I was wondering if it's possible ot make these two Ubuntu system identical, i.e. move everything... | 2012/01/31 | [
"https://serverfault.com/questions/355367",
"https://serverfault.com",
"https://serverfault.com/users/70984/"
] | You can get a list of all installed packages on machine A by running:
>
> `sudo dpkg --get-selections > packagelist.txt`.
>
>
>
On machine B, you can install all those packages by running:
>
> `sudo dpkg --set-selections < packagelist.txt`
>
>
> | 1. boot the laptop with LiveCD
2. Make the apropriate partitions
3. Rsync your files to the laptop, use -AHaXx --numeric-ids
4. mount the target system somewhere: / /boot /proc /dev /sys ...
5. chroot in it
6. grub it
7. done.:) |
355,367 | I have been using Ubuntu 11.10 on a VMWare for sometime now. I did a lot of customization on it (e.g. remove unity, install my applications etc.).
Last week I managed to get another laptop and installed Ubuntu 11.10 on it. I was wondering if it's possible ot make these two Ubuntu system identical, i.e. move everything... | 2012/01/31 | [
"https://serverfault.com/questions/355367",
"https://serverfault.com",
"https://serverfault.com/users/70984/"
] | You can get a list of all installed packages on machine A by running:
>
> `sudo dpkg --get-selections > packagelist.txt`.
>
>
>
On machine B, you can install all those packages by running:
>
> `sudo dpkg --set-selections < packagelist.txt`
>
>
> | You can try [clonezilla](http://clonezilla.org/). It supports several file systems. |
355,367 | I have been using Ubuntu 11.10 on a VMWare for sometime now. I did a lot of customization on it (e.g. remove unity, install my applications etc.).
Last week I managed to get another laptop and installed Ubuntu 11.10 on it. I was wondering if it's possible ot make these two Ubuntu system identical, i.e. move everything... | 2012/01/31 | [
"https://serverfault.com/questions/355367",
"https://serverfault.com",
"https://serverfault.com/users/70984/"
] | You can try [clonezilla](http://clonezilla.org/). It supports several file systems. | 1. boot the laptop with LiveCD
2. Make the apropriate partitions
3. Rsync your files to the laptop, use -AHaXx --numeric-ids
4. mount the target system somewhere: / /boot /proc /dev /sys ...
5. chroot in it
6. grub it
7. done.:) |
355,367 | I have been using Ubuntu 11.10 on a VMWare for sometime now. I did a lot of customization on it (e.g. remove unity, install my applications etc.).
Last week I managed to get another laptop and installed Ubuntu 11.10 on it. I was wondering if it's possible ot make these two Ubuntu system identical, i.e. move everything... | 2012/01/31 | [
"https://serverfault.com/questions/355367",
"https://serverfault.com",
"https://serverfault.com/users/70984/"
] | You may also be able to create a template of the original VM and move it over to the laptop.
<http://communities.vmware.com/servlet/JiveServlet/downloadBody/2664-102-1-2324/V2P.doc>
That document discusses V2P migration for linux.
I did this once but it was from a VM to a desktop with almost identical hardware. Th... | 1. boot the laptop with LiveCD
2. Make the apropriate partitions
3. Rsync your files to the laptop, use -AHaXx --numeric-ids
4. mount the target system somewhere: / /boot /proc /dev /sys ...
5. chroot in it
6. grub it
7. done.:) |
355,367 | I have been using Ubuntu 11.10 on a VMWare for sometime now. I did a lot of customization on it (e.g. remove unity, install my applications etc.).
Last week I managed to get another laptop and installed Ubuntu 11.10 on it. I was wondering if it's possible ot make these two Ubuntu system identical, i.e. move everything... | 2012/01/31 | [
"https://serverfault.com/questions/355367",
"https://serverfault.com",
"https://serverfault.com/users/70984/"
] | You may also be able to create a template of the original VM and move it over to the laptop.
<http://communities.vmware.com/servlet/JiveServlet/downloadBody/2664-102-1-2324/V2P.doc>
That document discusses V2P migration for linux.
I did this once but it was from a VM to a desktop with almost identical hardware. Th... | You can try [clonezilla](http://clonezilla.org/). It supports several file systems. |
13,930,049 | I was wondering if the following is possible to do and with hope someone could potentially help me.
I would like to create a 'download zip' feature but when the individual clicks to download then the button fetches images from my external domain and then bundles them into a zip and then downloads it for them.
I have ... | 2012/12/18 | [
"https://Stackoverflow.com/questions/13930049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1152045/"
] | ```
# define file array
$files = array(
'https://www.google.com/images/logo.png',
'https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Wikipedia-logo-en-big.png/220px-Wikipedia-logo-en-big.png',
);
# create new zip object
$zip = new ZipArchive();
# create a temp file & open it
$tmp_file = tempnam('.', '... | I hope I didn't understand wrong.
<http://php.net/manual/en/book.zip.php>
I haven't tried this, but it seems like what you're looking for.
```
<?php
$zip = new ZipArchive;
if ($zip->open('my_archive.zip') === TRUE) {
$zip->addFile($url, basename($url));
$zip->close();
echo 'ok';
} else {
echo 'fail... |
20,213,739 | I am trying to animate a footer section in a webpage, and found out that the jQuery `.animate()` method doesn't 'animate' when using percentages (apparently is a bug still not fixed as of jQuery 1.10.2?). So, as suggested by [another answer on SO](https://stackoverflow.com/questions/6877081/jquery-animate-and-property-... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20213739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077783/"
] | Just throwing out ideas there. The current setup looks like this
```
+------------+ +------------+
| CGI |----------->| Apache |
| Program |<-----------| Server |
+------------+ +------------+
```
How about something like this
```
+------------+ +------------+ +----... | You might also try to capture `TERM` signal and ignore it until you're done processing. |
20,213,739 | I am trying to animate a footer section in a webpage, and found out that the jQuery `.animate()` method doesn't 'animate' when using percentages (apparently is a bug still not fixed as of jQuery 1.10.2?). So, as suggested by [another answer on SO](https://stackoverflow.com/questions/6877081/jquery-animate-and-property-... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20213739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077783/"
] | Just throwing out ideas there. The current setup looks like this
```
+------------+ +------------+
| CGI |----------->| Apache |
| Program |<-----------| Server |
+------------+ +------------+
```
How about something like this
```
+------------+ +------------+ +----... | You might check out [FastCGI](https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html). It allows you to stick closely to the CGI programming model but decouples request lifetime from process lifetime. You could then do something like this:
```
while (FCGI_Accept() >= 0) {
// handle normal request
FCGI_Finish();... |
20,213,739 | I am trying to animate a footer section in a webpage, and found out that the jQuery `.animate()` method doesn't 'animate' when using percentages (apparently is a bug still not fixed as of jQuery 1.10.2?). So, as suggested by [another answer on SO](https://stackoverflow.com/questions/6877081/jquery-animate-and-property-... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20213739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077783/"
] | An option to consider is:
1. CGI program generates output to Apache.
2. Before closing standard output, it forks.
3. The parent process closes its standard output and then uses one of the emergency exit functions (`_exit()` or `_Exit()` or one of their relatives) to bail out. This avoids flushing the other I/O streams... | You might also try to capture `TERM` signal and ignore it until you're done processing. |
20,213,739 | I am trying to animate a footer section in a webpage, and found out that the jQuery `.animate()` method doesn't 'animate' when using percentages (apparently is a bug still not fixed as of jQuery 1.10.2?). So, as suggested by [another answer on SO](https://stackoverflow.com/questions/6877081/jquery-animate-and-property-... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20213739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077783/"
] | An option to consider is:
1. CGI program generates output to Apache.
2. Before closing standard output, it forks.
3. The parent process closes its standard output and then uses one of the emergency exit functions (`_exit()` or `_Exit()` or one of their relatives) to bail out. This avoids flushing the other I/O streams... | You might check out [FastCGI](https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html). It allows you to stick closely to the CGI programming model but decouples request lifetime from process lifetime. You could then do something like this:
```
while (FCGI_Accept() >= 0) {
// handle normal request
FCGI_Finish();... |
20,213,739 | I am trying to animate a footer section in a webpage, and found out that the jQuery `.animate()` method doesn't 'animate' when using percentages (apparently is a bug still not fixed as of jQuery 1.10.2?). So, as suggested by [another answer on SO](https://stackoverflow.com/questions/6877081/jquery-animate-and-property-... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20213739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077783/"
] | There is not a way to do this when using mod\_cgi and a single process. It's heavy on resources, but a generally accepted method of achieving this is called a double fork. It goes something like this:
```
pid_t kid, grandkid;
if ((kid = fork())) {
waitpid(kid, null, 0);
}
else if ((grandkid = fork())) {
exit(0... | You might also try to capture `TERM` signal and ignore it until you're done processing. |
20,213,739 | I am trying to animate a footer section in a webpage, and found out that the jQuery `.animate()` method doesn't 'animate' when using percentages (apparently is a bug still not fixed as of jQuery 1.10.2?). So, as suggested by [another answer on SO](https://stackoverflow.com/questions/6877081/jquery-animate-and-property-... | 2013/11/26 | [
"https://Stackoverflow.com/questions/20213739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1077783/"
] | There is not a way to do this when using mod\_cgi and a single process. It's heavy on resources, but a generally accepted method of achieving this is called a double fork. It goes something like this:
```
pid_t kid, grandkid;
if ((kid = fork())) {
waitpid(kid, null, 0);
}
else if ((grandkid = fork())) {
exit(0... | You might check out [FastCGI](https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html). It allows you to stick closely to the CGI programming model but decouples request lifetime from process lifetime. You could then do something like this:
```
while (FCGI_Accept() >= 0) {
// handle normal request
FCGI_Finish();... |
51,605,079 | I'm playing with co-routines, and they're often described as useful for pipelines. I found a lecture from Berkeley that was very helpful ( <http://wla.berkeley.edu/~cs61a/fa11/lectures/streams.html#coroutines> ), but there's one thing I'm having trouble with. In that lecture, there's a diagram where a pipeline forks, t... | 2018/07/31 | [
"https://Stackoverflow.com/questions/51605079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6454568/"
] | This isn't difficult if you "pull" through your pipeline rather than "push":
```
def producer1():
while True:
yield 0
def producer2():
while True:
yield 1
def combine(*producers):
while True:
for producer in producers:
val = next(producer)
print(s)
combine... | I think figured out how to do it. It works with trivial pipelines, anyhow. Here's my combine:
```
class combiner():
def __init__(self,n,ncr):
self.q = [ deque() for i in range(n)]
self.n = n
self.x = 0
self.ncr = ncr
@coroutine
def receiver(self,n):
while True:
... |
55,599,038 | I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

Basic code to get resul... | 2019/04/09 | [
"https://Stackoverflow.com/questions/55599038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260859/"
] | this will work at the most you cant show it on different columns having nulls:
```
select customer_id,name,LISTAGG(orderdate, ', ') WITHIN GROUP (ORDER BY orderdate)
from(select customerid, name, orderdate
from customer_table c inner join
order_table o
on c.customerid = o.customerid );
``` | Try this if you use MS SQL Server:
```
-- 1st, get the number of columns
declare @columnnumber int = 1
select @columnnumber = max(a.count)
from (
select c.cid,c.name, count(o.orderdate) as count
from
customer_table c
join order_table o
on c.cid = o.cid
group by c.cid,c.name)a
print @columnnumber
-- Compose the colu... |
55,599,038 | I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

Basic code to get resul... | 2019/04/09 | [
"https://Stackoverflow.com/questions/55599038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260859/"
] | Try this if you use MS SQL Server:
```
-- 1st, get the number of columns
declare @columnnumber int = 1
select @columnnumber = max(a.count)
from (
select c.cid,c.name, count(o.orderdate) as count
from
customer_table c
join order_table o
on c.cid = o.cid
group by c.cid,c.name)a
print @columnnumber
-- Compose the colu... | first create a view like this:
```
create view order_view as
select
count(*) over (partition by customerId order by orderDate) as ord,
CustomerId,
orderdate
from order_table
```
then you can use this query:
```
select c.customerid,
o1.orderdate,
o2.orderdate
o3.orderdate
.
.
.
o12.orderdate
from custom... |
55,599,038 | I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

Basic code to get resul... | 2019/04/09 | [
"https://Stackoverflow.com/questions/55599038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260859/"
] | this will work at the most you cant show it on different columns having nulls:
```
select customer_id,name,LISTAGG(orderdate, ', ') WITHIN GROUP (ORDER BY orderdate)
from(select customerid, name, orderdate
from customer_table c inner join
order_table o
on c.customerid = o.customerid );
``` | You can use the following because you're bound by the 12 order limit. If you expand to an unknown number of orders with no upper limit, then you would need to use dynamic SQL and even then it would be tricky, because you would also need to dynamically create unique column names.
This query batches by customer and sets... |
55,599,038 | I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

Basic code to get resul... | 2019/04/09 | [
"https://Stackoverflow.com/questions/55599038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260859/"
] | this will work at the most you cant show it on different columns having nulls:
```
select customer_id,name,LISTAGG(orderdate, ', ') WITHIN GROUP (ORDER BY orderdate)
from(select customerid, name, orderdate
from customer_table c inner join
order_table o
on c.customerid = o.customerid );
``` | first create a view like this:
```
create view order_view as
select
count(*) over (partition by customerId order by orderDate) as ord,
CustomerId,
orderdate
from order_table
```
then you can use this query:
```
select c.customerid,
o1.orderdate,
o2.orderdate
o3.orderdate
.
.
.
o12.orderdate
from custom... |
55,599,038 | I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

Basic code to get resul... | 2019/04/09 | [
"https://Stackoverflow.com/questions/55599038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260859/"
] | this will work at the most you cant show it on different columns having nulls:
```
select customer_id,name,LISTAGG(orderdate, ', ') WITHIN GROUP (ORDER BY orderdate)
from(select customerid, name, orderdate
from customer_table c inner join
order_table o
on c.customerid = o.customerid );
``` | Like others said, it's in principle impossible (in pure SQL) to generate this not knowing how many orders you have for a single customer.
I like @nikhil-sugandh's answer, it works great if you are OK with having all orders comma-separated in a single column.
If you insist on having multiple columns, you can build on ... |
55,599,038 | I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

Basic code to get resul... | 2019/04/09 | [
"https://Stackoverflow.com/questions/55599038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260859/"
] | You can use the following because you're bound by the 12 order limit. If you expand to an unknown number of orders with no upper limit, then you would need to use dynamic SQL and even then it would be tricky, because you would also need to dynamically create unique column names.
This query batches by customer and sets... | first create a view like this:
```
create view order_view as
select
count(*) over (partition by customerId order by orderDate) as ord,
CustomerId,
orderdate
from order_table
```
then you can use this query:
```
select c.customerid,
o1.orderdate,
o2.orderdate
o3.orderdate
.
.
.
o12.orderdate
from custom... |
55,599,038 | I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

Basic code to get resul... | 2019/04/09 | [
"https://Stackoverflow.com/questions/55599038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8260859/"
] | Like others said, it's in principle impossible (in pure SQL) to generate this not knowing how many orders you have for a single customer.
I like @nikhil-sugandh's answer, it works great if you are OK with having all orders comma-separated in a single column.
If you insist on having multiple columns, you can build on ... | first create a view like this:
```
create view order_view as
select
count(*) over (partition by customerId order by orderDate) as ord,
CustomerId,
orderdate
from order_table
```
then you can use this query:
```
select c.customerid,
o1.orderdate,
o2.orderdate
o3.orderdate
.
.
.
o12.orderdate
from custom... |
20,165,576 | I want to add 10 points to each of my students grades with PLSQL.
```
UPDATE AverageView SET AverageModifier = 10 WHERE COURSE_ID = 'INFO101' AND GROUP_ID = 101 AND SEMESTER = 'SUMER14';
```
So when I try to update the view, I want this trigger activated and I want to use INSTEAD OF UPDATE and modify the real tables... | 2013/11/23 | [
"https://Stackoverflow.com/questions/20165576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1352575/"
] | Try
```
CREATE OR REPLACE TRIGGER ChangeAverage
INSTEAD OF UPDATE ON AverageView
FOR EACH ROW
BEGIN
UPDATE INSCRIPTIONS SET grade = (:old.grade + 10) WHERE COURSE_ID = :NEW.COURSE_ID AND GROUP_ID = :NEW.GROUP_ID AND SEMESTER = :NEW.SEMESTER ;
END;
/
``` | Turns out that I had a constraint which was not updated and was keeping me from updating within certain parameters. I guess we can delete the question ! |
9,271,724 | I'm trying to create a function that will check to make sure all the input a user provided is numeric.
```
function wholeFormValid() {
var inp = document.getElementsByClassName('userInput');
//userInput is a class name i provide to all my non-hidden input fields.
//I have over 20 hidden values (I need to use ... | 2012/02/14 | [
"https://Stackoverflow.com/questions/9271724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/855127/"
] | Use this
```
var inp = document.getElementsByClassName('userInput');
var string= "justToInitializeThis";
for(var i=0; i < inp.length; i++) {
string = string + " " + inp[i].value;
}
alert(string);
```
Same for another loop too | ***Change:***
```
for(var m in inp) {
string = string + " " + inp.value;
}
```
***To:***
```
for(var m in inp) {
string = string + " " + inp[m].value;
}
```
>
> A for ... in loop iterates over the properties of an object
>
>
>
<https://developer.mozilla.org/en/JavaScript/Reference/Statements/for...in... |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | MS-Access doesn't support ROW\_NUMBER(). Use TOP 1:
```
SELECT TOP 1 *
FROM [MyTable]
ORDER BY [MyIdentityCOlumn]
```
If you need the 15th row - MS-Access has no simple, built-in, way to do this. You can simulate the rownumber by using reverse nested ordering to get this:
```
SELECT TOP 1 *
FROM (
SELECT TOP 15 *... | Though this is an old question, this has worked for me, but I've never tested its efficiency...
```
SELECT
(SELECT COUNT(t1.SourceID)
FROM [SourceTable] t1
WHERE t1.SourceID<t2.SourceID) AS RowID,
t2.field2,
t2.field3,
t2.field4,
t2.field5
FROM
SourceTable AS t2
ORDER BY
... |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | MS-Access doesn't support ROW\_NUMBER(). Use TOP 1:
```
SELECT TOP 1 *
FROM [MyTable]
ORDER BY [MyIdentityCOlumn]
```
If you need the 15th row - MS-Access has no simple, built-in, way to do this. You can simulate the rownumber by using reverse nested ordering to get this:
```
SELECT TOP 1 *
FROM (
SELECT TOP 15 *... | Another way to assign a row number in a query is to use the `DCount` function.
```
SELECT *, DCount("[ID]","[mytable]","[ID]<=" & [ID]) AS row_id
FROM [mytable]
WHERE row_id=15
``` |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | Another way to assign a row number in a query is to use the `DCount` function.
```
SELECT *, DCount("[ID]","[mytable]","[ID]<=" & [ID]) AS row_id
FROM [mytable]
WHERE row_id=15
``` | I needed the best *x* results of points per team.
Ranking does not solves this problem when there are results with equal points.
So I need a `recordnumber`
I made a VBA function in Access to create a `recordnumber` that resets on ID change.
You have to query this query with where `recordnumber <= x` to get the point... |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | Another way to assign a row number in a query is to use the `DCount` function.
```
SELECT *, DCount("[ID]","[mytable]","[ID]<=" & [ID]) AS row_id
FROM [mytable]
WHERE row_id=15
``` | Though this is an old question, this has worked for me, but I've never tested its efficiency...
```
SELECT
(SELECT COUNT(t1.SourceID)
FROM [SourceTable] t1
WHERE t1.SourceID<t2.SourceID) AS RowID,
t2.field2,
t2.field3,
t2.field4,
t2.field5
FROM
SourceTable AS t2
ORDER BY
... |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | I needed the best *x* results of points per team.
Ranking does not solves this problem when there are results with equal points.
So I need a `recordnumber`
I made a VBA function in Access to create a `recordnumber` that resets on ID change.
You have to query this query with where `recordnumber <= x` to get the point... | I might be late. Simply add a new field ID in the table with type AutoNumber. This will generate unique IDs and can utilize in Access too |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | Another way to assign a row number in a query is to use the `DCount` function.
```
SELECT *, DCount("[ID]","[mytable]","[ID]<=" & [ID]) AS row_id
FROM [mytable]
WHERE row_id=15
``` | I might be late. Simply add a new field ID in the table with type AutoNumber. This will generate unique IDs and can utilize in Access too |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | Though this is an old question, this has worked for me, but I've never tested its efficiency...
```
SELECT
(SELECT COUNT(t1.SourceID)
FROM [SourceTable] t1
WHERE t1.SourceID<t2.SourceID) AS RowID,
t2.field2,
t2.field3,
t2.field4,
t2.field5
FROM
SourceTable AS t2
ORDER BY
... | Thanks for your solutions above! DCount did the trick for me too!
I had to use a combination of date columns and a unique identifier for the sorting portion of it (as well as some additional conditions), so here is what I ended up doing:
1) I had to check if DateColumnA was null, then check if DateColumnB was null, t... |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | Another way to assign a row number in a query is to use the `DCount` function.
```
SELECT *, DCount("[ID]","[mytable]","[ID]<=" & [ID]) AS row_id
FROM [mytable]
WHERE row_id=15
``` | Thanks for your solutions above! DCount did the trick for me too!
I had to use a combination of date columns and a unique identifier for the sorting portion of it (as well as some additional conditions), so here is what I ended up doing:
1) I had to check if DateColumnA was null, then check if DateColumnB was null, t... |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | Another way to assign a row number in a query is to use the `DCount` function.
```
SELECT *, DCount("[ID]","[mytable]","[ID]<=" & [ID]) AS row_id
FROM [mytable]
WHERE row_id=15
``` | Since I am sorting alphabetically on a string field and NOT by ID, the Count(\*) and DCOUNT()
approaches didn't work for me. My solution was to write a function that returns the Row Number:
```
Option Compare Database
Option Explicit
Private Rst As Recordset
Public Function GetRowNum(ID As Long) As Long
If Rst Is ... |
17,279,320 | I always use this query in sql server to get Row number in a table:
```
SELECT *
FROM (SELECT *,
Row_number()
OVER(
ORDER BY [myidentitycolumn]) RowID
FROM mytable) sub
WHERE rowid = 15
```
Now I am working in Access 2010 and this seems to be not work... | 2013/06/24 | [
"https://Stackoverflow.com/questions/17279320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1901125/"
] | I needed the best *x* results of points per team.
Ranking does not solves this problem when there are results with equal points.
So I need a `recordnumber`
I made a VBA function in Access to create a `recordnumber` that resets on ID change.
You have to query this query with where `recordnumber <= x` to get the point... | Thanks for your solutions above! DCount did the trick for me too!
I had to use a combination of date columns and a unique identifier for the sorting portion of it (as well as some additional conditions), so here is what I ended up doing:
1) I had to check if DateColumnA was null, then check if DateColumnB was null, t... |
22,284,380 | I am new to reactive programming and confused about composing observables that have dependencies. Here is the scenario:
There are two observables **A**, **B**. Observable **A** depends on a value emitted by **B**. (Therefore A needs to observe B). Is there a way to create an Observable **C** that composes **A** and **B... | 2014/03/09 | [
"https://Stackoverflow.com/questions/22284380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3398673/"
] | You question is a bit vague on how A depends on B so I'll try to give a several examples of how to combine observables.
Example - **A** cannot be created without **B** - Use map()
```java
public class B {
public final int value;
public B(int value) {
this.value = value;
}
}
public class A {
p... | I am also new to reactive programming, and just put together some code that may be interesting for your case
>
> A needs to observe B
>
>
>
```
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.Test;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Func1;
impor... |
22,284,380 | I am new to reactive programming and confused about composing observables that have dependencies. Here is the scenario:
There are two observables **A**, **B**. Observable **A** depends on a value emitted by **B**. (Therefore A needs to observe B). Is there a way to create an Observable **C** that composes **A** and **B... | 2014/03/09 | [
"https://Stackoverflow.com/questions/22284380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3398673/"
] | You question is a bit vague on how A depends on B so I'll try to give a several examples of how to combine observables.
Example - **A** cannot be created without **B** - Use map()
```java
public class B {
public final int value;
public B(int value) {
this.value = value;
}
}
public class A {
p... | I think it depends on the kind of composition between A and B that you need to do and also on how A depends on B.
Does C compose A and B pair after pair (A1 combined with B1, A2 combined with B2, etc.) - then `zip` would be the function you want. But, in that case I wonder if you could not just do that work when you t... |
22,284,380 | I am new to reactive programming and confused about composing observables that have dependencies. Here is the scenario:
There are two observables **A**, **B**. Observable **A** depends on a value emitted by **B**. (Therefore A needs to observe B). Is there a way to create an Observable **C** that composes **A** and **B... | 2014/03/09 | [
"https://Stackoverflow.com/questions/22284380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3398673/"
] | You question is a bit vague on how A depends on B so I'll try to give a several examples of how to combine observables.
Example - **A** cannot be created without **B** - Use map()
```java
public class B {
public final int value;
public B(int value) {
this.value = value;
}
}
public class A {
p... | If you are looking for making async observables work I suggest have a quick look at this question [RxJava Fetching Observables In Parallel](https://stackoverflow.com/questions/26249030/rxjava-fetching-observables-in-parallel).
Ben (author of RxJava) helped clarify my doubts on the topic.
Hope this helps
anand |
53,153,288 | So basically what I want to be able to do is to be able to a single property name space that can be overridden by a child of that property's parent. The practical application here is maintaining a Model/View system. Where the views are derived from the same base view class, however some require a more complex model to ... | 2018/11/05 | [
"https://Stackoverflow.com/questions/53153288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2941307/"
] | Seems like you should make your `ParentManager`-class generic:
```
public class ChildManager : ParentManager<ChildPropertyType>
{
}
public class ParentManager<T> where T: ParentPropertyType
{
public T PropertyType { get; set; }
}
```
Now you don´t even need `virtual` and `override`, as the property has the ... | In C#, there is no way to override a method and change its return type to a descendant type. "Sad but true".
If I were you, I would reintroduce (using "new") the method / property to return the desired type. |
7,517,885 | I wanted to give all of the child's div elements a background-color of parent div. But, as I see, child divs' style overwrite parent's style even though child's did not have that property. For example,
```
<!-- Parent's div -->
<div style="background-color:#ADADAD;">
some codes here...
<!-- child's div -->
... | 2011/09/22 | [
"https://Stackoverflow.com/questions/7517885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893970/"
] | >
> But, as i see, chid divs' style overwrite parent's style even though child's did not have that property.
>
>
>
No, they just don't inherit the value by default, so they get whatever value they would otherwise have (which is usually `transparent`).
You can (in theory) get what you want with background-color: [... | Use the inherit property on the child div :
```
background:inherit
<div style="position:absolute;font-size:12px; left:600px;top:100px; background:inherit">
``` |
7,517,885 | I wanted to give all of the child's div elements a background-color of parent div. But, as I see, child divs' style overwrite parent's style even though child's did not have that property. For example,
```
<!-- Parent's div -->
<div style="background-color:#ADADAD;">
some codes here...
<!-- child's div -->
... | 2011/09/22 | [
"https://Stackoverflow.com/questions/7517885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893970/"
] | >
> But, as i see, chid divs' style overwrite parent's style even though child's did not have that property.
>
>
>
No, they just don't inherit the value by default, so they get whatever value they would otherwise have (which is usually `transparent`).
You can (in theory) get what you want with background-color: [... | Use css selectors like this to make the background of child div's inherit from their parent:
```
Parent's div
<div id="thisparticulardiv">
some codes here...
child's div
<div class="childrendiv">
again some codes...
</div></div>
```
CSS:
```
#thisparticulardiv {
background-color:#ADADAD;
...
}
#thisparticu... |
7,517,885 | I wanted to give all of the child's div elements a background-color of parent div. But, as I see, child divs' style overwrite parent's style even though child's did not have that property. For example,
```
<!-- Parent's div -->
<div style="background-color:#ADADAD;">
some codes here...
<!-- child's div -->
... | 2011/09/22 | [
"https://Stackoverflow.com/questions/7517885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893970/"
] | Use css selectors like this to make the background of child div's inherit from their parent:
```
Parent's div
<div id="thisparticulardiv">
some codes here...
child's div
<div class="childrendiv">
again some codes...
</div></div>
```
CSS:
```
#thisparticulardiv {
background-color:#ADADAD;
...
}
#thisparticu... | Use the inherit property on the child div :
```
background:inherit
<div style="position:absolute;font-size:12px; left:600px;top:100px; background:inherit">
``` |
422,681 | I'm trying to figure out how to integrate one command that updates multiple Aggregates in different contexts in a video game. The components/considerations for my particular design are DDD, CQRS, Ports and Adapters, Event-Driven Architecture, Aggregate+Event Sourcing, and Entity-Component-System. It's a lot to manage, ... | 2021/02/24 | [
"https://softwareengineering.stackexchange.com/questions/422681",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/161992/"
] | **This answer is based on the presumtion that this is not a hobby project:**
Probably that is not what you want to hear , but trying to go at the same time DDD, CQRS, Event Driven Architecture, Event sourcing sounds like a bit of big bite that will lead, either to nowhere, or to a very overengeneered system. If it is a... | There is good news, bad news, and more good news.
The good news is that this is a *solved* problem! You have found yourself in the exact space that every ATM in the world needs to navigate before dispensing money.
The bad news is that the infrastructure and complexity necessary to mediate this kind of distributed tra... |
422,681 | I'm trying to figure out how to integrate one command that updates multiple Aggregates in different contexts in a video game. The components/considerations for my particular design are DDD, CQRS, Ports and Adapters, Event-Driven Architecture, Aggregate+Event Sourcing, and Entity-Component-System. It's a lot to manage, ... | 2021/02/24 | [
"https://softwareengineering.stackexchange.com/questions/422681",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/161992/"
] | **This answer is based on the presumtion that this is not a hobby project:**
Probably that is not what you want to hear , but trying to go at the same time DDD, CQRS, Event Driven Architecture, Event sourcing sounds like a bit of big bite that will lead, either to nowhere, or to a very overengeneered system. If it is a... | Create a new entity called "Transaction" or "Purchase." Each instance of this entity records the event when a user requested and completed a purchase (Note that "requested" and "completed" are not the same thing).
The workflow goes like this:
1. User requests a purchase
2. System create a purchase record with an iden... |
22,556,020 | I am using `Gson` to parse data from Json String. Everything is working fine.
But now, Main `Json String` contains Inner Json String and I want that Inner `Json String`'s data. How to get it ?
**Check my `Json String`:**
```
[{"Question":"Are you inclined to:","QId":"2","Options":[{"Option":"Argue or debate issu... | 2014/03/21 | [
"https://Stackoverflow.com/questions/22556020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3234665/"
] | Write your class which include parameter which your JSON string contain so that you can directly parse your string into class object.
Your `PrimaryTest` class should contain following members :
```
public class PrimaryTest {
private String Question;
private int QId;
private List<Option> Options; ... | Hint an how the objects could be.
```
OptionClass{
String Option
int/long OptionId
}
QuestionClass{
String Question
int/long QId
Collection<OptionClass> Options
}
```
Note: This is not a java class. Design your class based on the hints. |
377,189 | I'm implementing my own simple database with disk storage, and I'm not sure how to go about modifying and deleting entries.
The problem is that as you delete a record from arbitrary position within a file, a "hole" is left there. As you insert a new entry, you may or may not be able to plug it into the hole. Modifyin... | 2018/08/20 | [
"https://softwareengineering.stackexchange.com/questions/377189",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/29016/"
] | The approach you describe is the same which is used, for instance, by SQL Server. With time, the data file grows, and you have to run a maintenance plan in order to [shrink it](https://docs.microsoft.com/en-us/sql/relational-databases/databases/shrink-a-database?view=sql-server-2017) by moving pages from the end of the... | >
> are there other approaches to database storage file management?
>
>
>
Don't *actually* delete records. Only *mark* them as deleted, then have your "DBMS" ignore the "marked" ones. Of course, this means that your tables get "fragmented", with lots of "holes" that you're constantly skipping over as you try to r... |
12,659,035 | How to get access to the custom named views instead of giving the same method name in Zend framework 2.0.
For Eg:
Under index action "return new ViewModel();" will call index.phtml but i want to call an another view here. | 2012/09/30 | [
"https://Stackoverflow.com/questions/12659035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1608722/"
] | Just call model view with view you want:
```
$model = new ViewModel();
$model->setTemplate('edit');
return $model;
```
More info: <http://framework.zend.com/manual/2.0/en/modules/zend.view.renderer.php-renderer.html> | Within your controller, you can use the `ViewModel`'s `setTemplate` method to change which script will be rendered:
```php
public function someAction()
{
// do stuff here
$viewModel = new ViewModel($anArrayOfVariablesForTheView);
$viewModel->setTemplate('application/view/arbitrary');
return $viewModel... |
38,562,968 | I know how to dismiss a keyboard, I use this extension:
```
extension UIViewController
{
func hideKeyboardWhenTappedAround()
{
let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "dismissKeyboard")
view.addGestureRecognizer(tap)
}
func dismissKeyboard()
{... | 2016/07/25 | [
"https://Stackoverflow.com/questions/38562968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5312361/"
] | Make a reference to this text field, like:
```
var navigationBarField : UITextField?
```
Then initialize it:
```
navigationBarField = UITextField(frame: CGRectMake(0,0,textfieldW,0.8*ram.navigationBarHeight) )
textField.borderStyle = UITextBorderStyle.RoundedRect
textField.center.y = centerView.center.y
centerView.... | Instead of declare instance you just need to call `endEditing` method of `navigationController's` `view` also like this
```
func dismissKeyboard()
{
navigationController?.view.endEditing(true)
view.endEditing(true)
}
``` |
3,459,990 | I have a program that fundamentally requires a lot of memory. However, for some reason java gives me an error when I try to set the max heap space above 1.5GB. That is, running
```
java -Xmx1582m [my program]
```
is okay, but
```
java -Xmx1583m [my program]
```
gives the error
```
Error occurred during initializ... | 2010/08/11 | [
"https://Stackoverflow.com/questions/3459990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298724/"
] | The likely case is that while your *operating system* is 64-bit, your JVM is not. Opening a command line and typing `java -version` will give you the verbose version information, which should indicate whether your installed JVM is a 32 or 64-bit build.
A 64-bit JVM should have no problem with the higher memory limits. | For heap space is used
```
-XX:MaxPermSize=64m
``` |
25,882,522 | How can I display result with continue serial number from MySql table using PHP pagination | 2014/09/17 | [
"https://Stackoverflow.com/questions/25882522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4048865/"
] | Try this. It's working for me
```
$pageno = $this->uri->segment(2); // ( $this->uri->segment(2) ) : this is for codeigniter
if(empty($pageno) || $pageno == 1){
$srno = 1;
}
else{
$temp = $pageno-1;
$new_temp = $temp.'1';
$srno = (int)$new_temp;
}
``` | **Try this functions will displays serial no of paginations in php.**
<http://code.stephenmorley.org/php/creating-pagination-links/>
**or**
<http://www.otallu.com/tutorials/simple-php-mysql-pagination/#sthash.7WPg1FdO.dpbs>
**or you can use**
```
function pagination($item_count, $limit, $cur_page, $link)
{
... |
73,271,313 | I need to develop a function whereby a type property gets appended to an array if it doesn't exist.
So the key will be of type and it should have a value of "dog".
Can someone kindly point out how I can iterate over the array to check if the key "type" exists and also provide guidance on how to append {type:"dog"} to... | 2022/08/07 | [
"https://Stackoverflow.com/questions/73271313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19364797/"
] | This is not a nested array
```js
function labelTheDogs(dogs) {
dogs.forEach(dog => {
if (!dog.type) {
dog.type = 'dog'
}
})
return dogs
}
const dogs = labelTheDogs(
[{
name: 'Obi'
},
{
name: 'Felix',
type: 'cat'
}
]
)
console.log(dogs)
``` | you can use the map function to do that
```js
const newArray = yourArray.map((element) => {
if(!element.type){
element.type = "dog";
}else {
return element
}
})
``` |
1,662,967 | In general, if $X$ is a random variable defined on a probability space $(Ω, Σ, P)$, then the expected value of $X$ is defined as
\begin{align}
\int\_\Omega X \, \mathrm{d}P = \int\_\Omega X(\omega) P(\mathrm{d}\omega)
\end{align}
Let $X\_1, X\_2, \dots$ be a sequence of independent random variables identically distri... | 2016/02/19 | [
"https://math.stackexchange.com/questions/1662967",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/148666/"
] | It's not correct.
The empirical measure isn't a measure on the sample space $\Omega$, it's a (random) measure on $\mathbb{R}$. Notationally, I think most people reserve letters like $P, P\_n$, etc, for measures on $\Omega$, using letters like $\mu, \nu$ for measures on other spaces.
So I'd call your empirical measure... | Let us formalize this a bit. Let $(\Omega\_0,\Sigma\_0,P\_0)$ be a probability space and take $X\_1,X\_2,\ldots$ be a sequence of independent random variables on $\Omega\_0$ with values in $\mathbb R,$ we consider the random measure $P\_n$ on $\mathbb R$ given by
$$P\_n=\frac{1}{n}\sum\limits\_{i=1}^n\delta\_{X\_i}$$
w... |
10,550,398 | Editing of controller or any js file of sencha touch application bield from Sencha Architect 2 are editable or not? | 2012/05/11 | [
"https://Stackoverflow.com/questions/10550398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/861521/"
] | Manually or via the UI?
Manually you add a controller and then in the designer view choose CODE
and then OVERWRITE.
The original is saved (look in the dir structure)
Next time open this screen, choose (in the first selector of code view) the VIEW OVERRIDE CODE
so that you see your latest work.
I work with intellij... | If you are using architect each time you save the project architect edits the code of all the files in the app folder & app.html & app.js so any manual edits you make on the actual file will always be overwritten...
This is actually displayed as comment in each file eg:
```
/*
* File: app/controller/MyController.js... |
50,905 | One channel of my split audio is cutting out when the cables are plugged into two devices.
I have a computer audio output that I have [this splitter](https://rads.stackoverflow.com/amzn/click/com/B000067RC4) connected to.
From the splitter I connect a cable to a standard headset.
Then I connect the other cable from ... | 2021/08/24 | [
"https://sound.stackexchange.com/questions/50905",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/34185/"
] | Guitar amp input impedance ≅ 1MΩ
Headset impedance ≅ 50 - 300Ω
Totally mis-matched.
However, this doesn't add up to what you're hearing. The amp should be the one suffering lack of signal, though it can make up the gain significantly.
Best guess, as your amp is mono, it is shorting one side of the stereo sign... | Welcome to Sound Design.
Your bass amp is mono. The 1/4" input jack is mono. When you plug in to the 1/4" jack it shorts out your right channel so you lose the sound in the right channel of your headset.
This amp also has a 3.5 mm (1/8") auxiliary jack which accepts a stereo connection. Use that instead of the 1/4" m... |
41,234,161 | Given two `numpy` arrays of `nx3` and `mx3`, what is an efficient way to determine the row indices (counter) wherein the rows are common in the two arrays. For instance I have the following solution, which is significantly slow for not even much larger arrays
```
def arrangment(arr1,arr2):
hits = []
for i in ... | 2016/12/20 | [
"https://Stackoverflow.com/questions/41234161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6345567/"
] | quick and dirty answer
```
(arr1[:, None] == arr2).all(-1).argmax(0)
array([3, 2, 6, 7])
```
---
Better answer
Takes care of chance a row in `arr2` doesn't match anything in `arr1`
```
t = (arr1[:, None] == arr2).all(-1)
np.where(t.any(0), t.argmax(0), np.nan)
array([ 3., 2., 6., 7.])
```
---
As pointed... | I had a similar [problem in the past](https://stackoverflow.com/questions/35234571/finding-a-set-of-indices-that-maps-the-rows-of-one-numpy-ndarray-to-another) and I came up with a fairly optimised solution for it.
First you need a generalisation of `numpy.unique` for multidimensional arrays, which for the sake of com... |
684,882 | Environment
-----------
Operating System: CentOS Linux 8
Virtual Machine running on VMWare Workstation 16 Pro on Windows 11 host.
Question
--------
I recently had an application lockup while using my VM and I had to power down the VM to recover. When I restarted the VM, I no longer had network access. In Gnome, I lo... | 2022/01/03 | [
"https://unix.stackexchange.com/questions/684882",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/96613/"
] | I was able to resolve my issue by suspending the virtual machine and resuming it. I can't quite explain what happened, but it would appear that VMWare changes the state of the network interfaces when suspending a VM and in my case, it wasn't resumed properly. I've had it happen a second time and the suspend/resume appr... | Did you clone your VM? I had also the same issue and the same solution worked. In my case I had cloned a VM from the existing Linux VM. Its better to do basic configuration of the Primary VM from which you will be cloning. The following article is a little old but addresses the same context.
<https://kb.vmware.com/s/ar... |
41,877,490 | I'm trying to get the create function to have the user selected values entered into the database. When the create button is pushed, no error is thrown but, the data is not populated. I'm pretty sure my frequency fields are causing the issue but have been unable to come with a solution.
There are two different types o... | 2017/01/26 | [
"https://Stackoverflow.com/questions/41877490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6104319/"
] | Assuming you want the first 10% of rows ordered by Value (desc), you can achieve that by using window functions:
```
select * from (
select ID, Value, COUNT(*) over (partition by ID) as countrows, ROW_NUMBER() over (partition by ID order by Value desc) as rowno from mytable) as innertab
where rowno <= floor(countrows*... | Alternatively you could use CROSS APPLY and specify TOP n PERCENT
```
SELECT x.*
FROM ( SELECT DISTINCT ID FROM tab ) a
CROSS APPLY ( SELECT TOP 10 PERCENT ID, Value FROM tab b WHERE b.ID = a.ID) x
```
TOP n PERCENT will produce at least one row. |
62,270 | I have read the comments from [this question](https://meta.stackexchange.com/questions/62191/questions-getting-closed-too-fast-within-hours-give-it-some-time-to-live) which gave me another proposal. So some people are 'annoyed' if some type of questions are on the front page. Is this a real problem? SO gets a lot of qu... | 2010/08/25 | [
"https://meta.stackexchange.com/questions/62270",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/134444/"
] | A closed question isn't moved off the front page, though, and can be bumped back onto it.
Consequently, [a negatively voted question is barred from the front page](https://meta.stackexchange.com/questions/62261/are-edited-questions-no-longer-bumped-to-the-front-page/62262#62262), so we already have a non-closing-base... | Your points are valid, but I think your proposed solution is wrong. Implementing a separate voting system might alleviate some of the symptoms, but doesn't address the real problem.
What we really need to do is educate users about what question closure really means. We should be more active in letting people know abou... |
62,270 | I have read the comments from [this question](https://meta.stackexchange.com/questions/62191/questions-getting-closed-too-fast-within-hours-give-it-some-time-to-live) which gave me another proposal. So some people are 'annoyed' if some type of questions are on the front page. Is this a real problem? SO gets a lot of qu... | 2010/08/25 | [
"https://meta.stackexchange.com/questions/62270",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/134444/"
] | Closing is not about whether or not a question is appropriate for the front page, it is about whether or not it is appropriate for the site at all.
A separate but related issue. If a *question* is not appropriate for the front page, then it is **not** appropriate for the site at all.
On Stack Overflow, all content ... | Your points are valid, but I think your proposed solution is wrong. Implementing a separate voting system might alleviate some of the symptoms, but doesn't address the real problem.
What we really need to do is educate users about what question closure really means. We should be more active in letting people know abou... |
43,880,219 | Probably very simple but got me stumped.
I have an overlay menu and some navigation links inside it. What I'd like to do is a simple "slide up" text effect, wherein the text seems to "rise up" from the baseline. It's a commonly seen effect, and I have achieved it playing with line-height and a super simple animation.
... | 2017/05/09 | [
"https://Stackoverflow.com/questions/43880219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7459478/"
] | You can use `animation-fill-mode: forwards` to maintain the end state of the animation. And then translate the starting state:
```
span{
transform: translate(0, 100%);
}
.reveal {
display: block;
animation: reveal 1.5s cubic-bezier(0.77, 0, 0.175, 1) 0.5s forwards;
}
``` | To start out with the initial animation at 0% you want to add that same setting to the span intially: li span{transform: translate(0, 100%);} |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | For example, there are important applications in the theory of finite Markov chains. Among other things, it implies that a Markov chain with strictly positive transition probabilities has a unique stationary distribution. | First of all, the conclusion is more interesting if you also try an example where the matrix entries are still real, but not positive. For example, if $A$ is the $2\times2$ rotation matrix
$$A=\pmatrix{\cos\theta&\sin\theta\\ -\sin\theta&\cos\theta}$$
then you can check that the eigenvectors are no longer real, and the... |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | First of all, the conclusion is more interesting if you also try an example where the matrix entries are still real, but not positive. For example, if $A$ is the $2\times2$ rotation matrix
$$A=\pmatrix{\cos\theta&\sin\theta\\ -\sin\theta&\cos\theta}$$
then you can check that the eigenvectors are no longer real, and the... | I'll add an answer from the world of symbolic dynamics and tiling theory.
If you have a substitution on some alphabet $\mathcal{A}=\{a\_1,\ldots,a\_k\}$, say something like the Fibonacci substitution $$\sigma\colon\begin{cases}a\mapsto ab\\ b\mapsto a\end{cases}$$ then you have an associated *transition matrix* $M\_{\... |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | The Perron-Frobenius theorem is used in Google's Pagerank. It's one of the things that make sure that the algorithm works. [Here](http://www.math.pku.edu.cn/teachers/yaoy/Fall2011/lecture07.pdf) it's explained why the the theorem is useful, you have a lot of information with easy explanations on Google. | To check the stability of dynamical systems, one can try to search for a real-valued positive function named [Lyapunov function](https://en.wikipedia.org/wiki/Lyapunov_function).
If the dynamical system is [LTI](https://en.wikipedia.org/wiki/Linear_time-invariant_theory), that is, of the format
$$ \dot{x}(t) = Ax(t) ... |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | The Perron-Frobenius theorem is used in Google's Pagerank. It's one of the things that make sure that the algorithm works. [Here](http://www.math.pku.edu.cn/teachers/yaoy/Fall2011/lecture07.pdf) it's explained why the the theorem is useful, you have a lot of information with easy explanations on Google. | I'll add an answer from the world of symbolic dynamics and tiling theory.
If you have a substitution on some alphabet $\mathcal{A}=\{a\_1,\ldots,a\_k\}$, say something like the Fibonacci substitution $$\sigma\colon\begin{cases}a\mapsto ab\\ b\mapsto a\end{cases}$$ then you have an associated *transition matrix* $M\_{\... |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | For example, there are important applications in the theory of finite Markov chains. Among other things, it implies that a Markov chain with strictly positive transition probabilities has a unique stationary distribution. | I'll add an answer from the world of symbolic dynamics and tiling theory.
If you have a substitution on some alphabet $\mathcal{A}=\{a\_1,\ldots,a\_k\}$, say something like the Fibonacci substitution $$\sigma\colon\begin{cases}a\mapsto ab\\ b\mapsto a\end{cases}$$ then you have an associated *transition matrix* $M\_{\... |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | The Perron-Frobenius theorem is used in Google's Pagerank. It's one of the things that make sure that the algorithm works. [Here](http://www.math.pku.edu.cn/teachers/yaoy/Fall2011/lecture07.pdf) it's explained why the the theorem is useful, you have a lot of information with easy explanations on Google. | One of the nice things about it is that for $v$ a vector with all positive entries, if we let $v\_k = A^k v$, then $\lim\_{k\to\infty} \frac{v^k}{|| v\_k ||}$ exists and is an eigen vector for the Perron-Frobenius eigen value. |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | For example, there are important applications in the theory of finite Markov chains. Among other things, it implies that a Markov chain with strictly positive transition probabilities has a unique stationary distribution. | One of the nice things about it is that for $v$ a vector with all positive entries, if we let $v\_k = A^k v$, then $\lim\_{k\to\infty} \frac{v^k}{|| v\_k ||}$ exists and is an eigen vector for the Perron-Frobenius eigen value. |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | I would like to add an engineering application. I am a researcher from a wireless communication background. One of the most fundamental problem in our area would be the so-called Power Control wherein a mobile tower transmitting individual data to the several mobiles has to minimize its own power consumption meanwhile ... | To check the stability of dynamical systems, one can try to search for a real-valued positive function named [Lyapunov function](https://en.wikipedia.org/wiki/Lyapunov_function).
If the dynamical system is [LTI](https://en.wikipedia.org/wiki/Linear_time-invariant_theory), that is, of the format
$$ \dot{x}(t) = Ax(t) ... |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | The Perron-Frobenius theorem is used in Google's Pagerank. It's one of the things that make sure that the algorithm works. [Here](http://www.math.pku.edu.cn/teachers/yaoy/Fall2011/lecture07.pdf) it's explained why the the theorem is useful, you have a lot of information with easy explanations on Google. | First of all, the conclusion is more interesting if you also try an example where the matrix entries are still real, but not positive. For example, if $A$ is the $2\times2$ rotation matrix
$$A=\pmatrix{\cos\theta&\sin\theta\\ -\sin\theta&\cos\theta}$$
then you can check that the eigenvectors are no longer real, and the... |
1,166,068 | The **Perron Frobenius theorem** states:
>
> Any square matrix $A$ with positive entries has a unique eigenvector with
> positive entries (up to a multiplication by a positive scalar), and
> the corresponding eigenvalue has multiplicity one and is strictly
> greater than the absolute value of any other eigenvalue.... | 2015/02/26 | [
"https://math.stackexchange.com/questions/1166068",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/105951/"
] | For example, there are important applications in the theory of finite Markov chains. Among other things, it implies that a Markov chain with strictly positive transition probabilities has a unique stationary distribution. | I would like to add an engineering application. I am a researcher from a wireless communication background. One of the most fundamental problem in our area would be the so-called Power Control wherein a mobile tower transmitting individual data to the several mobiles has to minimize its own power consumption meanwhile ... |
64,918,101 | My primary `nav li` elements shift downwards whenever I hover over them. I thought this was due to use of margin causing this, but I am still receiving this issue after removing margin use, and I'm not sure what it is. I know it's most likely something simple. Any help would be appreciated. Thank you.
```css
/*primary... | 2020/11/19 | [
"https://Stackoverflow.com/questions/64918101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14390214/"
] | This:
```
if [ "$1" == "" ]
```
should be changed to:
```
if [ -z "$1" ]
```
`-z` is true if the string is zero length.
`==` is used with `[[ ]]` while `=` is used with `[ ]`.
You can read more about bash string comparison in [How to Compare Strings in Bash](https://linuxize.com/post/how-to-compare-strings-in-b... | You can also check for...
```
pingit(){
ping -c1 ${1}
}
if [ ${#} -gt 0 ]
then
pingit ${1}
fi
```
...the number of arguments. Then you can source it without argument or use it with argument...
```
# . pingit.sh
# pingit localhost
PING localhost(localhost (::1)) 56 data bytes
64 bytes from localhost (::1): i... |
43,276,990 | I'm trying to write a code to do the following:
1. Using text-to-columns,the data should get divided in different columns.
The data in Cells A1-A8 is like this:
[](https://i.stack.imgur.com/uqIgn.png)
This data should appear in different columns. | 2017/04/07 | [
"https://Stackoverflow.com/questions/43276990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7832343/"
] | When you log in or log out from child component, emit 'login' or 'logout' event respectively.
```
<template>
<div id="app">
<router-view name='login' @login="login=true"></router-view>
<router-view name='header' @logout="login=false"></router-view>
<keep-alive v-if="login">
<router-view name='write... | I had similar problem and one simple solution I found was to force reload the web application via `location.reload()`, which clears the `keep-alive`.
You might also find this discussion interesting: <https://github.com/vuejs/vue/issues/6259> |
43,276,990 | I'm trying to write a code to do the following:
1. Using text-to-columns,the data should get divided in different columns.
The data in Cells A1-A8 is like this:
[](https://i.stack.imgur.com/uqIgn.png)
This data should appear in different columns. | 2017/04/07 | [
"https://Stackoverflow.com/questions/43276990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7832343/"
] | When you log in or log out from child component, emit 'login' or 'logout' event respectively.
```
<template>
<div id="app">
<router-view name='login' @login="login=true"></router-view>
<router-view name='header' @logout="login=false"></router-view>
<keep-alive v-if="login">
<router-view name='write... | There is a pretty easy way to do this. Thanks to @loomchild for the link.
You can define on routes a `meta` object. Define it in such a way for routes using keep-alive that you want to invalidate.
```
{
path: '/invalidate_me',
...
meta: {uuid: generateUUID()} // You'll need a method for th... |
6,360,499 | What does @propert(retain) do? it doesn't actually retain my object by my tests:
```
id obj = getObjectSomehow();
NSLog(@"%d", [obj retainCount]);
propertyWithRetain = obj;
NSLog(@"%d", [obj retainCount]);
// output:
// 1
// 1
```
How can I make a property that will really retain the object? | 2011/06/15 | [
"https://Stackoverflow.com/questions/6360499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/362589/"
] | You're not using your property there, that's why it's not retaining!
Try this :
```
id obj = getObjectSomehow();
NSLog(@"%d", [obj retainCount]);
self.propertyWithRetain = obj; // Note the self. :)
NSLog(@"%d", [obj retainCount]);
```
Using `self.` will use the property. Just using the variable name won't.
---
ED... | ```
propertyWithRetain = obj;
```
That just sets the ivar backing the property directly. When an @property is synthesized, if there is no instance variable declared, then one is generated automatically. The above is using that ivar directly.
```
self.propertyWithRetain = obj;
```
That would actually go through the... |
19,104 | When making a roll on Majesty to Awe people, is a Vampire permitted to make use of the +2 (or +4) social bonus for the merit of being exceptionally attractive? | 2012/11/29 | [
"https://rpg.stackexchange.com/questions/19104",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/5649/"
] | Yes.
----
Unless explicitly forbidden, Merits (like Striking Looks) do apply to Discipline rolls. | I've gone with the rule of thumb that effects can be stacked unless the rules explicitly say they don't. I don't see anything in the rules saying they don't. Logically it makes sense that beauty would play a role in successfully Awing someone. If I were running the game, I'd allow it. |
19,104 | When making a roll on Majesty to Awe people, is a Vampire permitted to make use of the +2 (or +4) social bonus for the merit of being exceptionally attractive? | 2012/11/29 | [
"https://rpg.stackexchange.com/questions/19104",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/5649/"
] | I've gone with the rule of thumb that effects can be stacked unless the rules explicitly say they don't. I don't see anything in the rules saying they don't. Logically it makes sense that beauty would play a role in successfully Awing someone. If I were running the game, I'd allow it. | Striking Looks explicitly does add to Majesty rolls, as I recall.
It's also a +1/+2 bonus, not a +2/+4. |
19,104 | When making a roll on Majesty to Awe people, is a Vampire permitted to make use of the +2 (or +4) social bonus for the merit of being exceptionally attractive? | 2012/11/29 | [
"https://rpg.stackexchange.com/questions/19104",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/5649/"
] | Yes.
----
Unless explicitly forbidden, Merits (like Striking Looks) do apply to Discipline rolls. | Striking Looks explicitly does add to Majesty rolls, as I recall.
It's also a +1/+2 bonus, not a +2/+4. |
12,866,808 | How do I use regex to convert
```
11111aA$xx1111xxdj$%%`
```
to
```
aA$xx1111xxdj$%%
```
So, in other words, I want to remove (or match) the FIRST grouping of `1`'s. | 2012/10/12 | [
"https://Stackoverflow.com/questions/12866808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140811/"
] | Depending on the language, you should have a way to replace a string by regex. In Java, you can do it like this:
```
String s = "11111aA$xx1111xxdj$%%";
String res = s.replaceAll("^1+", "");
```
The `^` "anchor" indicates that the beginning of the input must be matched. The `1+` means a sequence of one or more `1` c... | If you only want to replace consecutive "1"s at the beginning of the string, replace the following with an empty string:
```
^1+
```
If the consecutive "1"s won't necessarily be the first characters in the string (but you still only want to replace one group), replace the following with the contents of the first cap... |
12,866,808 | How do I use regex to convert
```
11111aA$xx1111xxdj$%%`
```
to
```
aA$xx1111xxdj$%%
```
So, in other words, I want to remove (or match) the FIRST grouping of `1`'s. | 2012/10/12 | [
"https://Stackoverflow.com/questions/12866808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140811/"
] | Depending on the language, you should have a way to replace a string by regex. In Java, you can do it like this:
```
String s = "11111aA$xx1111xxdj$%%";
String res = s.replaceAll("^1+", "");
```
The `^` "anchor" indicates that the beginning of the input must be matched. The `1+` means a sequence of one or more `1` c... | I'm not sure but you can try this
`[^1](\w*\d*\W)*` - match all as a single group except starting "1"(n) symbols |
12,866,808 | How do I use regex to convert
```
11111aA$xx1111xxdj$%%`
```
to
```
aA$xx1111xxdj$%%
```
So, in other words, I want to remove (or match) the FIRST grouping of `1`'s. | 2012/10/12 | [
"https://Stackoverflow.com/questions/12866808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140811/"
] | Depending on the language, you should have a way to replace a string by regex. In Java, you can do it like this:
```
String s = "11111aA$xx1111xxdj$%%";
String res = s.replaceAll("^1+", "");
```
The `^` "anchor" indicates that the beginning of the input must be matched. The `1+` means a sequence of one or more `1` c... | In Javascript
```
var str = '11111aA$xx1111xxdj$%%';
var patt = /^1+/g;
str = str.replace(patt,"");
``` |
12,866,808 | How do I use regex to convert
```
11111aA$xx1111xxdj$%%`
```
to
```
aA$xx1111xxdj$%%
```
So, in other words, I want to remove (or match) the FIRST grouping of `1`'s. | 2012/10/12 | [
"https://Stackoverflow.com/questions/12866808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140811/"
] | If this is the beginning, you can use this:
```
^[1]*
```
As far as replacing, it depends on the language. In powershell, I would do this:
```
[regex]::Replace("11111aA$xx1111xxdj$%%","^[1]*","")
```
This will return:
```
aA$xx1111xxdj$%%
``` | If you only want to replace consecutive "1"s at the beginning of the string, replace the following with an empty string:
```
^1+
```
If the consecutive "1"s won't necessarily be the first characters in the string (but you still only want to replace one group), replace the following with the contents of the first cap... |
12,866,808 | How do I use regex to convert
```
11111aA$xx1111xxdj$%%`
```
to
```
aA$xx1111xxdj$%%
```
So, in other words, I want to remove (or match) the FIRST grouping of `1`'s. | 2012/10/12 | [
"https://Stackoverflow.com/questions/12866808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140811/"
] | If this is the beginning, you can use this:
```
^[1]*
```
As far as replacing, it depends on the language. In powershell, I would do this:
```
[regex]::Replace("11111aA$xx1111xxdj$%%","^[1]*","")
```
This will return:
```
aA$xx1111xxdj$%%
``` | I'm not sure but you can try this
`[^1](\w*\d*\W)*` - match all as a single group except starting "1"(n) symbols |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.