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
655,797
I have the following definition: Let ($X$,$\mathcal{T}$) and ($X'$, $\mathcal{T'}$) be topological spaces. A surjection $q: X \longrightarrow X'$ is a quotient mapping if $$U'\in \mathcal{T'} \Longleftrightarrow q^{-1}\left( U'\right) \in \mathcal{T} \quad \text{i.e. if } \mathcal{T'}=\{ U' \subset X' : q^{-1}\left( ...
2014/01/29
[ "https://math.stackexchange.com/questions/655797", "https://math.stackexchange.com", "https://math.stackexchange.com/users/122136/" ]
Consider $\mathbb{R}$ with the standard topology. On $\mathbb{R}$, consider the equivalence relation $$x\sim y \iff (x = y \lor \{x,y\} \subset \mathbb{Z}),$$ and let $(X',\mathcal{T}')$ the quotient space $\mathbb{R}/{\sim}$. By definition, $\pi \colon \mathbb{R}\to X';\; x \mapsto [x]\_\sim$ is a quotient map, but ...
Let $X$ be a Hausdorff space, and let $a,b$ be a pair of distinct points. Stipulate that $\{b\}$ is not open. Define $f:X\to X\setminus\{b\}$ by $f(z)=z$ if $z\ne b$ and $f(b)=a$. There is a unique topology we may assign the codomain such that $f$ is a quotient map, let's endow that topology on $X\setminus\{b\}$. The...
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
[jDownloader](http://www.jdownloader.org/) does the thing.
[Aria2c](http://aria2.sourceforge.net) is pretty good. Just installed on Fedora 16 and downloading files with no issues.
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
[Aria2c](http://aria2.sourceforge.net) is pretty good. Just installed on Fedora 16 and downloading files with no issues.
xdman from sourceforge ---- best multisegment downloader with firefox integration
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
[Aria2c](http://aria2.sourceforge.net) is pretty good. Just installed on Fedora 16 and downloading files with no issues.
JDownloader from jdownloader.org It's indicated for sites like rapidshare.com, especially if you have a premium account (you will be automatically be logged in and download at full speed)
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
[jDownloader](http://www.jdownloader.org/) does the thing.
A general tool is `aria2`, but it will not support things like rapidshare, only normal downloads. For sites with hoops for you to jump through, you will need a specialized tool. Also, segmented downloads may not work anyway because they typically restrict you to one active download session per ip address -- you'd need ...
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
[jDownloader](http://www.jdownloader.org/) does the thing.
xdman from sourceforge ---- best multisegment downloader with firefox integration
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
[Aria2c](http://aria2.sourceforge.net) is pretty good. Just installed on Fedora 16 and downloading files with no issues.
A general tool is `aria2`, but it will not support things like rapidshare, only normal downloads. For sites with hoops for you to jump through, you will need a specialized tool. Also, segmented downloads may not work anyway because they typically restrict you to one active download session per ip address -- you'd need ...
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
Have you tried the Firefox plugin DownThemAll? Also, Opera has similar functionality built-in, with very powerful URL grepping from the Links page.
JDownloader from jdownloader.org It's indicated for sites like rapidshare.com, especially if you have a premium account (you will be automatically be logged in and download at full speed)
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
[jDownloader](http://www.jdownloader.org/) does the thing.
JDownloader from jdownloader.org It's indicated for sites like rapidshare.com, especially if you have a premium account (you will be automatically be logged in and download at full speed)
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
Have you tried the Firefox plugin DownThemAll? Also, Opera has similar functionality built-in, with very powerful URL grepping from the Links page.
WebDownloade for X seems to do the work. edit: it doesnt work for rapidshare :(
169,589
Does someone knows a good multithread downloads manager for linux? I am using Lucid Lynx, I use to use multiget but it hasn't been updated since 2007. I'd like it to support login for sites like rapidshare, something like FlashGet in win. By multithread I dont only mean multiple downloads but like FlashGet "Jets" fea...
2010/07/29
[ "https://superuser.com/questions/169589", "https://superuser.com", "https://superuser.com/users/40705/" ]
For segmented download use [axel](http://axel.alioth.debian.org/). Of course it will not work for rapidshare-like services (sessions per IP).
WebDownloade for X seems to do the work. edit: it doesnt work for rapidshare :(
5,208,979
I am trying to understand how far I can go with PHP5's closures/callbacks, but I am currently trapped in a glass case of "why doesn't this work". In the following example, I understand that the use of `$this` in a callback (especially when the scope changes) isn't going to work, it's just there to show you how I hope ...
2011/03/06
[ "https://Stackoverflow.com/questions/5208979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/164237/" ]
In php, `call_user_func` can accept a two-element array to call a method on a class. So if you do this: ``` $this->customer->when_enters(array($this,'greet_customer')); ``` it will do what you want. Another alternative on PHP 5.3.0 or greater is to use a closure along with a local copy of `$this`: ``` $this_copy=$t...
I have some good news, and some bad news. The good news is that the next major release of PHP (5.4?) will permit anonymous functions to be properties of a class, and be callable without jumping through hoops, *and* [will allow you to reference `$this` by binding the function to a specific context](http://wiki.php.net/...
1,362,694
I should probably not ask a generic question with a specific example, but I have a hard time translating some basic commands from the PowerShell console to reusable functions and custom cmdlets. Is there a definitive guide to the syntax of PowerShell somewhere, with gotchas, hints and tips? For instance, I'm trying to...
2009/09/01
[ "https://Stackoverflow.com/questions/1362694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18865/" ]
As far as guides go, the best book out there is [Windows PowerShell in Action](http://www.manning.com/payette2/) by Bruce Payette. There is a second edition due in February but you can get early access to the electronic draft. There are also a couple of free books out there. [Mastering PowerShell](http://powershell.com...
Regarding the Map() error, sometimes with WMI you need to drop back and instead do $objServerHost.psbase.Invoke("Map"). Other than that, I've got a [few sample PowerShell scripts](http://winterdom.com/2009/03/biztalkpowershellscripts) for BizTalk administration you might find useful as guides.
24,764,054
I'm working on a time card system where a user can enter a time against a single unit or a 'run' of units. I have already created the time entry portion, where a user can enter time against a 'run' and it will create separate rows for each unit specified as being part of that 'run'. It also divides the time they enter...
2014/07/15
[ "https://Stackoverflow.com/questions/24764054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3841473/" ]
Last question first: yes, as the docs indicate. The `SessionMap` is a thin facade that implements the `Map` interface and allows direct access to some underlying implementations (e.g., `invalidate`). First question: meh between the last two, the first does something slightly different. `clear` just removes entries, ...
`SessionMap#invalidate()` will call `HttpSession#invalidate()` if it is associated with an `HttpSession` and clears the internal map and removes the session association as well, so I'd use that. The only other difference asside from api independence seems to be that `SessionMap` provides an `entrySet()` method for all...
24,764,054
I'm working on a time card system where a user can enter a time against a single unit or a 'run' of units. I have already created the time entry portion, where a user can enter time against a 'run' and it will create separate rows for each unit specified as being part of that 'run'. It also divides the time they enter...
2014/07/15
[ "https://Stackoverflow.com/questions/24764054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3841473/" ]
Last question first: yes, as the docs indicate. The `SessionMap` is a thin facade that implements the `Map` interface and allows direct access to some underlying implementations (e.g., `invalidate`). First question: meh between the last two, the first does something slightly different. `clear` just removes entries, ...
use this code for better results ``` HttpSession session = request.getSession(false); if (session != null) { session.invalidate(); } ```
24,764,054
I'm working on a time card system where a user can enter a time against a single unit or a 'run' of units. I have already created the time entry portion, where a user can enter time against a 'run' and it will create separate rows for each unit specified as being part of that 'run'. It also divides the time they enter...
2014/07/15
[ "https://Stackoverflow.com/questions/24764054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3841473/" ]
`SessionMap#invalidate()` will call `HttpSession#invalidate()` if it is associated with an `HttpSession` and clears the internal map and removes the session association as well, so I'd use that. The only other difference asside from api independence seems to be that `SessionMap` provides an `entrySet()` method for all...
use this code for better results ``` HttpSession session = request.getSession(false); if (session != null) { session.invalidate(); } ```
67,914,773
PS E:\React Native\contacts> npm i @react-navigation/native npm WARN jscodeshift@0.11.0 requires a peer of @babel/preset-env@^7.1.6 but none is installed. You must install peer dependencies yourself. npm WARN react-native@0.64.2 requires a peer of react@17.0.1 but none is installed. You must install peer dependencies y...
2021/06/10
[ "https://Stackoverflow.com/questions/67914773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13673484/" ]
The reason behind this is that npm deprecated [auto-installing of peerDependencies] since npm@3, so required peer dependencies like babel-core and webpack must be listed explicitly in your `package.json.` All that you need to do is to install babel-core. <https://github.com/npm/npm/issues/6565>
I solved this error. **just run the command as globally** ``` npm install -g @react-navigation/native ``` May be it shows some warnings but still your package will be installed
67,914,773
PS E:\React Native\contacts> npm i @react-navigation/native npm WARN jscodeshift@0.11.0 requires a peer of @babel/preset-env@^7.1.6 but none is installed. You must install peer dependencies yourself. npm WARN react-native@0.64.2 requires a peer of react@17.0.1 but none is installed. You must install peer dependencies y...
2021/06/10
[ "https://Stackoverflow.com/questions/67914773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13673484/" ]
I think there is running android emulator, try to close all of android related consoles and retry the installation.
I solved this error. **just run the command as globally** ``` npm install -g @react-navigation/native ``` May be it shows some warnings but still your package will be installed
67,914,773
PS E:\React Native\contacts> npm i @react-navigation/native npm WARN jscodeshift@0.11.0 requires a peer of @babel/preset-env@^7.1.6 but none is installed. You must install peer dependencies yourself. npm WARN react-native@0.64.2 requires a peer of react@17.0.1 but none is installed. You must install peer dependencies y...
2021/06/10
[ "https://Stackoverflow.com/questions/67914773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13673484/" ]
the solution of error to install NPM navigation dependencies packages: choose one of these! 1: upgrade @react-native-community/masked-view to the latest package which is accepting by react@16 and react@17. 2: downgrade your root project's react version to 16 I hope this is helpful.
I solved this error. **just run the command as globally** ``` npm install -g @react-navigation/native ``` May be it shows some warnings but still your package will be installed
44,999,614
I have a system using Akka which currently handles incoming streaming data over message queues. When a record arrives then it is processed, mq is acked and record is passed on for further handling within the system. Now I would like to add support for using DBs as input. What would be a way to go for the input sour...
2017/07/09
[ "https://Stackoverflow.com/questions/44999614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6686713/" ]
**Slick Library** [Slick streaming](http://slick.lightbend.com/doc/3.2.0/dbio.html#streaming) is how this is usually done. Extending the slick documentation a bit to include akka streams: ``` //SELECT Name from Coffees val q = for (c <- coffees) yield c.name val action = q.result type Name = String val databaseP...
I find Alpakka documentation to be excellent and a much easier way to work with reactive-streams than than the Java Publisher interface. The Alpakka project is an open source initiative to implement stream-aware, reactive, integration pipelines for Java and Scala. It is built on top of Akka Streams, and has been desi...
908,398
Due to the generic `code` name, the Numix team have decide not to use the `code.desktop` icon provided by the VS Code package. So it's icon is configured as a common text editor by default. How to fix it?
2017/04/24
[ "https://askubuntu.com/questions/908398", "https://askubuntu.com", "https://askubuntu.com/users/85081/" ]
Looks like that the Numix team has provided [an alternative icon](https://github.com/numixproject/numix-core/issues/2964) with the name of `vscode.desktop`, in order to fix it we need to: 1. Copy and rename the default `code.desktop` to the local user directory: `cp /usr/share/applications/code.desktop ~/.local/share...
Here's a one liner that will achieve what these guys are saying for you. I've aliased this in bash because I have to execute this every FREAKING time vscode updates... ``` sudo sed -i "s/Icon=code/Icon=vscode/g" /usr/share/applications/code.desktop ```
908,398
Due to the generic `code` name, the Numix team have decide not to use the `code.desktop` icon provided by the VS Code package. So it's icon is configured as a common text editor by default. How to fix it?
2017/04/24
[ "https://askubuntu.com/questions/908398", "https://askubuntu.com", "https://askubuntu.com/users/85081/" ]
Looks like that the Numix team has provided [an alternative icon](https://github.com/numixproject/numix-core/issues/2964) with the name of `vscode.desktop`, in order to fix it we need to: 1. Copy and rename the default `code.desktop` to the local user directory: `cp /usr/share/applications/code.desktop ~/.local/share...
If you're absolutely sure Visual Studio Code will be the only 'code' executable, just copying the vscode.svg icon seems to be a better solution as it'll also theme the icon if you launch vscode via terminal command: code. ``` sudo ln -s visualstudiocode.svg /usr/share/icons/Numix-Circle/48/apps/code.svg sudo dpkg-re...
908,398
Due to the generic `code` name, the Numix team have decide not to use the `code.desktop` icon provided by the VS Code package. So it's icon is configured as a common text editor by default. How to fix it?
2017/04/24
[ "https://askubuntu.com/questions/908398", "https://askubuntu.com", "https://askubuntu.com/users/85081/" ]
Looks like that the Numix team has provided [an alternative icon](https://github.com/numixproject/numix-core/issues/2964) with the name of `vscode.desktop`, in order to fix it we need to: 1. Copy and rename the default `code.desktop` to the local user directory: `cp /usr/share/applications/code.desktop ~/.local/share...
This little script should do the job. Since a copy is placed in `.local/share`, it shouldn't be changed when apt upgrades. (Here the Numix-Icon-Circle is choosen.) ``` #!/bin/bash # Description: change the vs-code icon to the specific numix icon cp /usr/share/applications/code.desktop ~/.local/share/applications/code...
908,398
Due to the generic `code` name, the Numix team have decide not to use the `code.desktop` icon provided by the VS Code package. So it's icon is configured as a common text editor by default. How to fix it?
2017/04/24
[ "https://askubuntu.com/questions/908398", "https://askubuntu.com", "https://askubuntu.com/users/85081/" ]
Looks like that the Numix team has provided [an alternative icon](https://github.com/numixproject/numix-core/issues/2964) with the name of `vscode.desktop`, in order to fix it we need to: 1. Copy and rename the default `code.desktop` to the local user directory: `cp /usr/share/applications/code.desktop ~/.local/share...
go to : ``` sudo nano /usr/share/applications/code.desktop ``` and change ``` Icon=vscode ``` to ``` Icon=/usr/share/pixmaps/com.visualstudio.code.png ```
908,398
Due to the generic `code` name, the Numix team have decide not to use the `code.desktop` icon provided by the VS Code package. So it's icon is configured as a common text editor by default. How to fix it?
2017/04/24
[ "https://askubuntu.com/questions/908398", "https://askubuntu.com", "https://askubuntu.com/users/85081/" ]
Here's a one liner that will achieve what these guys are saying for you. I've aliased this in bash because I have to execute this every FREAKING time vscode updates... ``` sudo sed -i "s/Icon=code/Icon=vscode/g" /usr/share/applications/code.desktop ```
If you're absolutely sure Visual Studio Code will be the only 'code' executable, just copying the vscode.svg icon seems to be a better solution as it'll also theme the icon if you launch vscode via terminal command: code. ``` sudo ln -s visualstudiocode.svg /usr/share/icons/Numix-Circle/48/apps/code.svg sudo dpkg-re...
908,398
Due to the generic `code` name, the Numix team have decide not to use the `code.desktop` icon provided by the VS Code package. So it's icon is configured as a common text editor by default. How to fix it?
2017/04/24
[ "https://askubuntu.com/questions/908398", "https://askubuntu.com", "https://askubuntu.com/users/85081/" ]
Here's a one liner that will achieve what these guys are saying for you. I've aliased this in bash because I have to execute this every FREAKING time vscode updates... ``` sudo sed -i "s/Icon=code/Icon=vscode/g" /usr/share/applications/code.desktop ```
This little script should do the job. Since a copy is placed in `.local/share`, it shouldn't be changed when apt upgrades. (Here the Numix-Icon-Circle is choosen.) ``` #!/bin/bash # Description: change the vs-code icon to the specific numix icon cp /usr/share/applications/code.desktop ~/.local/share/applications/code...
908,398
Due to the generic `code` name, the Numix team have decide not to use the `code.desktop` icon provided by the VS Code package. So it's icon is configured as a common text editor by default. How to fix it?
2017/04/24
[ "https://askubuntu.com/questions/908398", "https://askubuntu.com", "https://askubuntu.com/users/85081/" ]
Here's a one liner that will achieve what these guys are saying for you. I've aliased this in bash because I have to execute this every FREAKING time vscode updates... ``` sudo sed -i "s/Icon=code/Icon=vscode/g" /usr/share/applications/code.desktop ```
go to : ``` sudo nano /usr/share/applications/code.desktop ``` and change ``` Icon=vscode ``` to ``` Icon=/usr/share/pixmaps/com.visualstudio.code.png ```
91,274
I saw the common cold statted up in the Dragonstar Player's Companion from Fantasy Flight Games. How would the common cold affect player characters in D&D 5e? I was thinking it would be -1 to str and dex to represent basic aches and pains.
2016/12/05
[ "https://rpg.stackexchange.com/questions/91274", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
I think that the common cold should be kind of trivial to adventurers whose constitutions are likely several standard deviations above the mean. In the context of D&D diseases, getting a cold seems more like an annoyance than anything else. If you want, though, you could use the exhaustion mechanic (PHB291), which is...
Given the overall "heroic" tone of modern D&D (doesn't even account for reasonable maiming due to battle wounds, infection from same, etc.), I'd be strongly inclined to leave out piddly stuff like colds, indigestion (unless specific to Plot), corns, bunions, and ingrown toenails, and so forth. Heroes should have heroic...
91,274
I saw the common cold statted up in the Dragonstar Player's Companion from Fantasy Flight Games. How would the common cold affect player characters in D&D 5e? I was thinking it would be -1 to str and dex to represent basic aches and pains.
2016/12/05
[ "https://rpg.stackexchange.com/questions/91274", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
Given the overall "heroic" tone of modern D&D (doesn't even account for reasonable maiming due to battle wounds, infection from same, etc.), I'd be strongly inclined to leave out piddly stuff like colds, indigestion (unless specific to Plot), corns, bunions, and ingrown toenails, and so forth. Heroes should have heroic...
We tested the following as an experiment, but not extensively because we decided it wasn't worth it. Still, it worked, so I offer it for people who would think that this could be fun enough to work into the regular flow. --- Imagine how it might affect verbal components of spellcasting. I imagine that losing precisio...
91,274
I saw the common cold statted up in the Dragonstar Player's Companion from Fantasy Flight Games. How would the common cold affect player characters in D&D 5e? I was thinking it would be -1 to str and dex to represent basic aches and pains.
2016/12/05
[ "https://rpg.stackexchange.com/questions/91274", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
Given the overall "heroic" tone of modern D&D (doesn't even account for reasonable maiming due to battle wounds, infection from same, etc.), I'd be strongly inclined to leave out piddly stuff like colds, indigestion (unless specific to Plot), corns, bunions, and ingrown toenails, and so forth. Heroes should have heroic...
Take a page from an existing Published Adventure: "Out of the Abyss" Out of the Abyss (OotA) has this disease called Grackle-lung. It involves: * Suffering gradually increasing levels of exhaustion * Needing to succeed in a Constitution Check to be able to successfully cast any spell with a Verbal component and to t...
91,274
I saw the common cold statted up in the Dragonstar Player's Companion from Fantasy Flight Games. How would the common cold affect player characters in D&D 5e? I was thinking it would be -1 to str and dex to represent basic aches and pains.
2016/12/05
[ "https://rpg.stackexchange.com/questions/91274", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
I think that the common cold should be kind of trivial to adventurers whose constitutions are likely several standard deviations above the mean. In the context of D&D diseases, getting a cold seems more like an annoyance than anything else. If you want, though, you could use the exhaustion mechanic (PHB291), which is...
We tested the following as an experiment, but not extensively because we decided it wasn't worth it. Still, it worked, so I offer it for people who would think that this could be fun enough to work into the regular flow. --- Imagine how it might affect verbal components of spellcasting. I imagine that losing precisio...
91,274
I saw the common cold statted up in the Dragonstar Player's Companion from Fantasy Flight Games. How would the common cold affect player characters in D&D 5e? I was thinking it would be -1 to str and dex to represent basic aches and pains.
2016/12/05
[ "https://rpg.stackexchange.com/questions/91274", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
I think that the common cold should be kind of trivial to adventurers whose constitutions are likely several standard deviations above the mean. In the context of D&D diseases, getting a cold seems more like an annoyance than anything else. If you want, though, you could use the exhaustion mechanic (PHB291), which is...
Take a page from an existing Published Adventure: "Out of the Abyss" Out of the Abyss (OotA) has this disease called Grackle-lung. It involves: * Suffering gradually increasing levels of exhaustion * Needing to succeed in a Constitution Check to be able to successfully cast any spell with a Verbal component and to t...
91,274
I saw the common cold statted up in the Dragonstar Player's Companion from Fantasy Flight Games. How would the common cold affect player characters in D&D 5e? I was thinking it would be -1 to str and dex to represent basic aches and pains.
2016/12/05
[ "https://rpg.stackexchange.com/questions/91274", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/30985/" ]
Take a page from an existing Published Adventure: "Out of the Abyss" Out of the Abyss (OotA) has this disease called Grackle-lung. It involves: * Suffering gradually increasing levels of exhaustion * Needing to succeed in a Constitution Check to be able to successfully cast any spell with a Verbal component and to t...
We tested the following as an experiment, but not extensively because we decided it wasn't worth it. Still, it worked, so I offer it for people who would think that this could be fun enough to work into the regular flow. --- Imagine how it might affect verbal components of spellcasting. I imagine that losing precisio...
23,326,712
I wrote this small c++ program to implement tic-tac-toe. However, I run into a small problem that prevents me from terminating the game when it is over. ``` int main(){ bool a= true; while (a){ int x,y,x1,y1; std::cout<<"player 1 move"<<'\n'; std::cin>>y>>x; player1(x,y); ...
2014/04/27
[ "https://Stackoverflow.com/questions/23326712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3444882/" ]
The `break` statement will exit a loop.
You can use a `break` statement. That said, they are usually discouraged because it makes more difficult understanding the code later. I would stick with putting the second move loigc in an `else` branch.
3,526,015
In my research involving quantum field theory and computing correlation functions in perturbation theory, I encountered the following integral that seems pretty hard to solve: $$f(x)=\int\_{0}^{\infty}\frac{dz}{z(z^2+1)}\text{arcsinh}^2(z)J\_0(xz)$$ I wonder if anyone has any insights towards a solution. A series exp...
2020/01/28
[ "https://math.stackexchange.com/questions/3526015", "https://math.stackexchange.com", "https://math.stackexchange.com/users/535606/" ]
Consider the contour representation $$arcsinh^2(z)=\int\limits\_{c-i\infty }^{c+i\infty }{\frac{{{\pi }^{3/2}}\Gamma \left( -\tfrac{1}{2}s \right){{z}^{-s}}}{2s\Gamma \left( \tfrac{1}{2}-\tfrac{1}{2}s \right)\sin \left( \tfrac{1}{2}\pi s \right)}ds}$$ where we choose $-1<c<0$ so the contour encircles all poles on the ...
*Not elegant at all since using brute force.* Computing numerically the integrals, it seems that a good (totally empirical) approximation could be $$\log(f(x))=a-b\, x^c$$ Based of $40$ equally spaced data points between $0.5$ and $20.0$, a quick and dirty nolinear regression gives $$\begin{array}{clclclclc} \text{} ...
15,106
I am in this, rather friendly, situation: I have a complex projective space $\mathbb{P}^n$, and there i have a (possibly non-smooth) hypersurface $S$ defined by one irreducible polynomial $P$ of degree $d$. What i want is to get information about the existence or not of linear subvarieties of $S$, and their maximal d...
2010/02/12
[ "https://mathoverflow.net/questions/15106", "https://mathoverflow.net", "https://mathoverflow.net/users/3465/" ]
I think the key word you are looking for is Fano schemes of $S$. See this [note](http://www.math.sunysb.edu/~jstarr/papers/appendix3.pdf) by Jason Starr for a reference. For example, if $S$ is smooth and non-degenerate, it can not contain a linear subspace of dimension bigger than half $dim \ S$. A very interesting r...
I agree with Hailong, you want to look at Fano schemes. [Here](http://arxiv.org/abs/alg-geom/9611033)'s an article by Debarre and Manivel. It's very good, and I've gotten a lot out of it despite note knowing much French.
5,697,302
I am trying to ultimately use php's `shell_exec` function to create new Linux users. I am, however, running into problems even with the debugging. Here is my code ``` <?PHP function adduser($username,$password,$server){ try{ //3 debug statements $output=shell_exec("pwd"); echo $output; ...
2011/04/17
[ "https://Stackoverflow.com/questions/5697302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/654789/" ]
a) This is true, if the class defines *other* constructors - thereby suppressing generation of a default constructor. ``` struct Foo { Foo(int n) : mem(n) {} int mem; }; ``` This class can't be value-initialized. b) If the class has *no* constructors defined, value-initialization will simply value-initialize al...
``` #include <vector> #include <string> class fooz { private: string s; int n; public: fooz(string& str, int num) { s=str; n=num; } ~fooz(){} void gets(string& str) {str=s;} void getn(int& num) {num=n;} }; vector<class fooz> vfDialp...
15,150,706
I have the following dropdown list which **correctly shows the options but** when I select an item and submit the form it runs into the following error : ``` 'select', field 'list', name 'name': The requested list key 'listnames' could not be resolved as a collection/array/map/enumeration/iterator type. Example: pe...
2013/03/01
[ "https://Stackoverflow.com/questions/15150706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2041551/" ]
**STEP 1** :make sure that getter and setter for `listnames` are done properly **STEP 2** :make sure that you have done the declaration and initialization for `listnames` List properly **UPDATE 2** Sample Example ***struts.xml*** ``` <action name="getText" class="commonpackage.ReportsCommonClass" method="getText"> ...
Provide getter setter for name in your action class. As your select tag name is name `<s:select name="name">` when you submit your form it will search for the property name in your action class. This may be the problem in your case
15,150,706
I have the following dropdown list which **correctly shows the options but** when I select an item and submit the form it runs into the following error : ``` 'select', field 'list', name 'name': The requested list key 'listnames' could not be resolved as a collection/array/map/enumeration/iterator type. Example: pe...
2013/03/01
[ "https://Stackoverflow.com/questions/15150706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2041551/" ]
change your select tag like this ``` <s:form method="POST" action="addNames"> <s:select name="myclass.name" label="Names" list="listnames" /> </s:form> ``` **Edit:** **Problem:** I guess you are hitting jsp directly hence there is n...
Provide getter setter for name in your action class. As your select tag name is name `<s:select name="name">` when you submit your form it will search for the property name in your action class. This may be the problem in your case
176,076
Not sure how to do this, I want to silo structure my site and I have created a category and put all my posts under that category. I want to now create a page that has the same slug as the category and have that take priority over the category slug when going to that URL. Whats the easiest way to do this?
2015/01/26
[ "https://wordpress.stackexchange.com/questions/176076", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/66602/" ]
It isn't too clear what's your actual *reason* for doing this, so it's hard to guess the perfect solution. On top of my head it's likely you would probably do well to create or modify category template. This will give you control over page source for that precise category. If you want to do this *literally* as you pu...
As Rarst noted, the easy option would be to modify your category.php file (if you have one) **If you do not have a category.php template\_**, you can make one by copying your archive.php file or your index.php file with the name category.php **If you want this only for one category**, you can create a custom category...
582,198
Release group LOL does an excellent job at encoding their releases on The Vampire Diaries (on other shows like How I Met Your Mother the bitrate is higher, so doesn't seem this effective). About 200 MB each ~45mins MP4 file, amazing quality considering. I just wonder what settings and what software they use. I've t...
2013/04/12
[ "https://superuser.com/questions/582198", "https://superuser.com", "https://superuser.com/users/216650/" ]
The guidelines for encoding (pirated) video are called "scene guides". They are signed by various release groups who will make sure their videos comply to the guide, LOL being one of these groups. You can find a list of scene guides [scenerules.org](https://scenerules.org/). The standard you're looking for is—if I'm n...
Can't speak to the release group you mentioned since you didn't post the mediainfo. But here's a guide to making compact encodes, which means striking a good quality/size balance. You should start with HandBrake and the best available source. In the **Source** section, select a short but difficult to encode segment (w...
582,198
Release group LOL does an excellent job at encoding their releases on The Vampire Diaries (on other shows like How I Met Your Mother the bitrate is higher, so doesn't seem this effective). About 200 MB each ~45mins MP4 file, amazing quality considering. I just wonder what settings and what software they use. I've t...
2013/04/12
[ "https://superuser.com/questions/582198", "https://superuser.com", "https://superuser.com/users/216650/" ]
The guidelines for encoding (pirated) video are called "scene guides". They are signed by various release groups who will make sure their videos comply to the guide, LOL being one of these groups. You can find a list of scene guides [scenerules.org](https://scenerules.org/). The standard you're looking for is—if I'm n...
[FFmpeg TV](https://github.com/zurfyx/ffmpeg-tv) ================================================ Based on [slhck](https://superuser.com/a/582327/259331) answer I built this simple Python solution to call the right `ffmpeg` parameters. Based on the latest [scenerules 2016 TV standards](https://scenerules.org/t.html?id...
567,535
I read that a page which runs under an https connection cannot share an InProc Session (based on cookies) with another page (or the same for that matter) running under regular http. My site is running on Server 2003, IIS 6 and .Net 2.0. After some experiments it appears that a page which stores data in session while b...
2009/02/19
[ "https://Stackoverflow.com/questions/567535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2133/" ]
From [MSDN](http://msdn.microsoft.com/en-us/library/aa302426.aspx): > > When a user moves back and forth > between secure and public areas, the > ASP.NET-generated session cookie (or > URL if you have enabled cookie-less > session state) moves with them in > plaintext, but the authentication > cookie is never p...
Searching for the problem doesn't turn up much chatter about it so far, still looking. *Edit*: okay finding some stuff now. Right it seems that it will work fine if both sets of pages are in the same application/website. So I'd go ahead and carry on, feeling reassured.
567,535
I read that a page which runs under an https connection cannot share an InProc Session (based on cookies) with another page (or the same for that matter) running under regular http. My site is running on Server 2003, IIS 6 and .Net 2.0. After some experiments it appears that a page which stores data in session while b...
2009/02/19
[ "https://Stackoverflow.com/questions/567535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2133/" ]
*IIS setting In the IIS properties window, under the ASP tab –> Session Properties, there is a setting for “New ID on Secure Connections”* I fixed this intermittent issue for myself by setting this to false.
Searching for the problem doesn't turn up much chatter about it so far, still looking. *Edit*: okay finding some stuff now. Right it seems that it will work fine if both sets of pages are in the same application/website. So I'd go ahead and carry on, feeling reassured.
567,535
I read that a page which runs under an https connection cannot share an InProc Session (based on cookies) with another page (or the same for that matter) running under regular http. My site is running on Server 2003, IIS 6 and .Net 2.0. After some experiments it appears that a page which stores data in session while b...
2009/02/19
[ "https://Stackoverflow.com/questions/567535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2133/" ]
From [MSDN](http://msdn.microsoft.com/en-us/library/aa302426.aspx): > > When a user moves back and forth > between secure and public areas, the > ASP.NET-generated session cookie (or > URL if you have enabled cookie-less > session state) moves with them in > plaintext, but the authentication > cookie is never p...
*IIS setting In the IIS properties window, under the ASP tab –> Session Properties, there is a setting for “New ID on Secure Connections”* I fixed this intermittent issue for myself by setting this to false.
567,535
I read that a page which runs under an https connection cannot share an InProc Session (based on cookies) with another page (or the same for that matter) running under regular http. My site is running on Server 2003, IIS 6 and .Net 2.0. After some experiments it appears that a page which stores data in session while b...
2009/02/19
[ "https://Stackoverflow.com/questions/567535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2133/" ]
From [MSDN](http://msdn.microsoft.com/en-us/library/aa302426.aspx): > > When a user moves back and forth > between secure and public areas, the > ASP.NET-generated session cookie (or > URL if you have enabled cookie-less > session state) moves with them in > plaintext, but the authentication > cookie is never p...
If any of the above solution does not work try this. I have cracked this out after doing research of a couple of days. ``` app.UseCookieAuthentication(new CookieAuthenticationOptions { ... ... CookieSecure = CookieSecureOption.Never }); ```
567,535
I read that a page which runs under an https connection cannot share an InProc Session (based on cookies) with another page (or the same for that matter) running under regular http. My site is running on Server 2003, IIS 6 and .Net 2.0. After some experiments it appears that a page which stores data in session while b...
2009/02/19
[ "https://Stackoverflow.com/questions/567535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2133/" ]
*IIS setting In the IIS properties window, under the ASP tab –> Session Properties, there is a setting for “New ID on Secure Connections”* I fixed this intermittent issue for myself by setting this to false.
If any of the above solution does not work try this. I have cracked this out after doing research of a couple of days. ``` app.UseCookieAuthentication(new CookieAuthenticationOptions { ... ... CookieSecure = CookieSecureOption.Never }); ```
35,413,543
I am trying to write a tcp socket based server. In python documentation I read, that `recv` on closed socket should raise error. But when a client closes the socket, the server can still `recv` on this socket and gets empty string. Can I assume then, that if `recv` returns empty string on a blocking socket, that this c...
2016/02/15
[ "https://Stackoverflow.com/questions/35413543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5228292/" ]
You have to check if you have received data from the client. If the data variable is empty, you can assume that there isn't a connection, because the client has closed the socket or something was wrong between them. Good examples are in <https://docs.python.org/2/library/socket.html#example> or if you are using python3...
You must handle IOError exceptions by codes. ``` except IOError as io_error: if io_error.errno == <YOUR CODE>: do something ``` See: <https://docs.python.org/2/library/errno.html#module-errno> for get codes
509,235
Given a meromorphic function $f:\mathbb C\to\mathbb C$ and a smooth curve $\gamma:[a,b]\to\Gamma\subset\mathbb C$ with $\gamma(a)\neq\gamma(b)$, I am tempted to think the fundamental theorem of calculus yields $$\int\_a^b\underbrace{f'(\gamma(t))\gamma'(t)\,dt}\_{=df} = f(\gamma(t))\Big|\_{t=a}^b (\*)$$ independently...
2013/09/29
[ "https://math.stackexchange.com/questions/509235", "https://math.stackexchange.com", "https://math.stackexchange.com/users/163/" ]
The definition of the span of a set $S$, denoted by $\operatorname{span}(S)$, is the set of *all* finite linear combinations of the elements of $S$. In your case of $S\_1$, we therefore have that $\operatorname{span}\{(0,1)\} = c \cdot (0,1) = (0,c)$ for scalars $c \in \mathbb{R}$. The scalar can be anything — $c = 1...
$S\_1$ is a line, connecting the origin to the given point $[0,1]$, and $S\_2$ is the *same* line, because it already contains $[0,2]$, too. ${\rm span\,}(v)=\{\lambda\,v\,\mid\,\lambda\in\Bbb R\}$. So, $[0,0]$ and $[0,2]$ both are in ${\rm span\,}([0,1])$.
60,729
How about we create a new status, **Archived**. A moderator could **Archive** a question. This would allow rep from the question to still be counted, and a special search '**isarchived**' could be used to find it, but it wouldn't come up in normal searches, and would be marked so that Google wouldn't use them for sear...
2010/08/12
[ "https://meta.stackexchange.com/questions/60729", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/13295/" ]
I completely agree with @devinb that this shouldn't apply to Stack Overflow. However, based on your latest edit, I think that having such a feature for meta-sites may, in fact, be a good idea. The Gmail archiving model can be applied here, such as for old bugs and feature-requests that are [status-completed]. There sh...
I believe it should apply to Stack Overflow. Just because a question is no longer valid, does it mean that people who put time into it should lose reputation points because it's deleted? There are two different issues here: 1) The content 2) the time and effort put in by people, which is rewarded with reputation. Jus...
60,729
How about we create a new status, **Archived**. A moderator could **Archive** a question. This would allow rep from the question to still be counted, and a special search '**isarchived**' could be used to find it, but it wouldn't come up in normal searches, and would be marked so that Google wouldn't use them for sear...
2010/08/12
[ "https://meta.stackexchange.com/questions/60729", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/13295/" ]
I completely agree with @devinb that this shouldn't apply to Stack Overflow. However, based on your latest edit, I think that having such a feature for meta-sites may, in fact, be a good idea. The Gmail archiving model can be applied here, such as for old bugs and feature-requests that are [status-completed]. There sh...
A counter can be added, so that users can set that the specific question is old thus helping the moderators identify easily which questions should be archived.
60,729
How about we create a new status, **Archived**. A moderator could **Archive** a question. This would allow rep from the question to still be counted, and a special search '**isarchived**' could be used to find it, but it wouldn't come up in normal searches, and would be marked so that Google wouldn't use them for sear...
2010/08/12
[ "https://meta.stackexchange.com/questions/60729", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/13295/" ]
I believe it should apply to Stack Overflow. Just because a question is no longer valid, does it mean that people who put time into it should lose reputation points because it's deleted? There are two different issues here: 1) The content 2) the time and effort put in by people, which is rewarded with reputation. Jus...
A counter can be added, so that users can set that the specific question is old thus helping the moderators identify easily which questions should be archived.
51,725,641
I wasted 3 hours searching for the right syntax. How can i get the value of "prop\_id" in javascript. view - ``` <input type="hidden" name="prop_id" value="<?=$prop_id_inserted?>"> ``` javascript ``` function upload_docu_by_type(prop_id, input, filetype) { var fd = new FormData(); var fileInputs = $("." + input)...
2018/08/07
[ "https://Stackoverflow.com/questions/51725641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10109690/" ]
You are missing the the position of the `'Value'` within each group. We can create it with `groupby.cumcount` ``` df.set_index( ['group_id', df.groupby('group_id').cumcount() + 1] ).Value.unstack().add_prefix('Value_').reset_index() group_id Value_1 Value_2 Value_3 0 1 23 28 32 1 ...
Use `groupby` with `cumcount` to fill in your `'value_'` records, and then use `.pivot_table` on the result: ``` df['val_grp'] = 'value_' + (df.groupby('group_id').cumcount() + 1).astype(str) pvt = df.pivot_table(index='group_id', columns='val_grp', values='Value') print(pvt) ``` Prints: ``` val_grp value_1 va...
12,002
I've been thinking about investing in local real estate lately, and there's an unusual (to me) practice here of funding some of the city provided infrastructure (water, roads and lighting I guess) by a special property tax for 20 years. I'm curious what, if anything, happens to property value as that date approaches. ...
2011/11/10
[ "https://money.stackexchange.com/questions/12002", "https://money.stackexchange.com", "https://money.stackexchange.com/users/2410/" ]
ATM surcharges exist based on the preference of the ATM owner, not the country where it sits. I believe that any country *could* have these ATMs if the owner so desired.
> > Do ATMs impose an extra surcharge for withdrawals? > > > In France, that depends on whether the ATM is owned by a French bank. <https://wise.com/us/blog/atms-in-france>: > > French banks don’t charge foreigners any fees to use ATMs. Privately-owned ATMs, on the other hand, do charge expensive fees and shoul...
4,884,167
What is the best way to measure speed of functions and classes? For every function there are various solutions and I'd like to know how to measure running speed and optimize my shared classes with the best solution possible. Also how do you measure SQL speed, for example differences between stored procedures, selects...
2011/02/03
[ "https://Stackoverflow.com/questions/4884167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453771/" ]
You have two options. **Use [`System.Diagnostics.Stopwatch`](http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx) for specific methods.** This is a high resolution timer in .NET which you can use for specific parts of your code. **Use a profiler if you need to measure performance for your entir...
You're best off using a profiler. The problem with measuring wallclock execution time (such as done by the `Stopwatch` class) is that it is influenced by many factors far out of your control. To mention just a few such factors, there's network and other I/O latency, and operating system scheduler decisions which influe...
4,884,167
What is the best way to measure speed of functions and classes? For every function there are various solutions and I'd like to know how to measure running speed and optimize my shared classes with the best solution possible. Also how do you measure SQL speed, for example differences between stored procedures, selects...
2011/02/03
[ "https://Stackoverflow.com/questions/4884167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453771/" ]
You have two options. **Use [`System.Diagnostics.Stopwatch`](http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx) for specific methods.** This is a high resolution timer in .NET which you can use for specific parts of your code. **Use a profiler if you need to measure performance for your entir...
It's best not to confuse the goals of measuring and optimizing. They are different tasks. Measuring, while good for quantifying the results of fixing something, is poor at telling you what to fix. On the subject of measuring, if I want to make a presentation of how fast something is, I want a controlled environment an...
4,884,167
What is the best way to measure speed of functions and classes? For every function there are various solutions and I'd like to know how to measure running speed and optimize my shared classes with the best solution possible. Also how do you measure SQL speed, for example differences between stored procedures, selects...
2011/02/03
[ "https://Stackoverflow.com/questions/4884167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/453771/" ]
You're best off using a profiler. The problem with measuring wallclock execution time (such as done by the `Stopwatch` class) is that it is influenced by many factors far out of your control. To mention just a few such factors, there's network and other I/O latency, and operating system scheduler decisions which influe...
It's best not to confuse the goals of measuring and optimizing. They are different tasks. Measuring, while good for quantifying the results of fixing something, is poor at telling you what to fix. On the subject of measuring, if I want to make a presentation of how fast something is, I want a controlled environment an...
29,451,702
I'm still wrapping my head around Kubernetes and how that's supposed to work. Currently, I'm struggling to understand how to model something like a PostgreSQL cluster with streaming replication, scaling out and automatic failover/failback (`pgpool-II`, `repmgr`, pick your poison). My main problem with the approach is ...
2015/04/04
[ "https://Stackoverflow.com/questions/29451702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6460/" ]
There's an example in OpenShift: <https://github.com/openshift/postgresql/tree/master/examples/replica> The principle is the same in pure Kube (it's not using anything truly OpenShift specific, and you can use the images in plain docker)
Kubernetes's statefulset is a good base for setting up the stateful service. You will still need some work to configure the correct membership among PostgreSQL replicas. Kubernetes has one example for it. <http://blog.kubernetes.io/2017/02/postgresql-clusters-kubernetes-statefulsets.html>
29,451,702
I'm still wrapping my head around Kubernetes and how that's supposed to work. Currently, I'm struggling to understand how to model something like a PostgreSQL cluster with streaming replication, scaling out and automatic failover/failback (`pgpool-II`, `repmgr`, pick your poison). My main problem with the approach is ...
2015/04/04
[ "https://Stackoverflow.com/questions/29451702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6460/" ]
There's an example in OpenShift: <https://github.com/openshift/postgresql/tree/master/examples/replica> The principle is the same in pure Kube (it's not using anything truly OpenShift specific, and you can use the images in plain docker)
You can give [PostDock](https://github.com/paunin/PostDock) a try, either with docker-compose or Kubernetes. Currently I have tried it in our project with docker-compose, with the schema as shown below: ``` pgmaster (primary node1) --| |- pgslave1 (node2) --| | |- pgslave2 (node3) --|----pgpool (master_slav...
29,451,702
I'm still wrapping my head around Kubernetes and how that's supposed to work. Currently, I'm struggling to understand how to model something like a PostgreSQL cluster with streaming replication, scaling out and automatic failover/failback (`pgpool-II`, `repmgr`, pick your poison). My main problem with the approach is ...
2015/04/04
[ "https://Stackoverflow.com/questions/29451702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6460/" ]
There's an example in OpenShift: <https://github.com/openshift/postgresql/tree/master/examples/replica> The principle is the same in pure Kube (it's not using anything truly OpenShift specific, and you can use the images in plain docker)
You can look at one of the below postgresql open-source tools 1 Crunchy data postgresql 2. Patroni postgresql .
29,451,702
I'm still wrapping my head around Kubernetes and how that's supposed to work. Currently, I'm struggling to understand how to model something like a PostgreSQL cluster with streaming replication, scaling out and automatic failover/failback (`pgpool-II`, `repmgr`, pick your poison). My main problem with the approach is ...
2015/04/04
[ "https://Stackoverflow.com/questions/29451702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6460/" ]
You can give [PostDock](https://github.com/paunin/PostDock) a try, either with docker-compose or Kubernetes. Currently I have tried it in our project with docker-compose, with the schema as shown below: ``` pgmaster (primary node1) --| |- pgslave1 (node2) --| | |- pgslave2 (node3) --|----pgpool (master_slav...
Kubernetes's statefulset is a good base for setting up the stateful service. You will still need some work to configure the correct membership among PostgreSQL replicas. Kubernetes has one example for it. <http://blog.kubernetes.io/2017/02/postgresql-clusters-kubernetes-statefulsets.html>
29,451,702
I'm still wrapping my head around Kubernetes and how that's supposed to work. Currently, I'm struggling to understand how to model something like a PostgreSQL cluster with streaming replication, scaling out and automatic failover/failback (`pgpool-II`, `repmgr`, pick your poison). My main problem with the approach is ...
2015/04/04
[ "https://Stackoverflow.com/questions/29451702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6460/" ]
You can give [PostDock](https://github.com/paunin/PostDock) a try, either with docker-compose or Kubernetes. Currently I have tried it in our project with docker-compose, with the schema as shown below: ``` pgmaster (primary node1) --| |- pgslave1 (node2) --| | |- pgslave2 (node3) --|----pgpool (master_slav...
You can look at one of the below postgresql open-source tools 1 Crunchy data postgresql 2. Patroni postgresql .
37,360
As stated in [Dropbox FAQ](https://www.dropbox.com/help/288/en): > > Camera Upload tries to be smart about not uploading the same photos > and videos more than once. It will not re-upload these files even if > you move, rename, or delete them from the Camera Uploads folder. > > > So, how can I clear this "cache...
2013/01/02
[ "https://webapps.stackexchange.com/questions/37360", "https://webapps.stackexchange.com", "https://webapps.stackexchange.com/users/-1/" ]
I'm using the android app and I just go to the "Camera Uploads" folder and select "Upload here" from the menu. You then get asked to select "Photos and videos" or "Other files". Select "Photos and videos". Choose the photo you want to upload and select Upload. If the file exists, it will ask if you want to replace ...
Try to delete the photos from the trash bin after deleting them from your photo uploads folder and, after this, re-upload the photos. If still not possible, use a different file name and when it's about hundreds of photos use something like a "bulk rename utility."
37,360
As stated in [Dropbox FAQ](https://www.dropbox.com/help/288/en): > > Camera Upload tries to be smart about not uploading the same photos > and videos more than once. It will not re-upload these files even if > you move, rename, or delete them from the Camera Uploads folder. > > > So, how can I clear this "cache...
2013/01/02
[ "https://webapps.stackexchange.com/questions/37360", "https://webapps.stackexchange.com", "https://webapps.stackexchange.com/users/-1/" ]
I don't think Dropbox will let you do that. The Camera Uploads is also how they keep track of how much you have uploaded. They give more space to you the more you upload. If you could reset that counter then you could max out your space very quickly, something I am sure they have thought about.
Try to delete the photos from the trash bin after deleting them from your photo uploads folder and, after this, re-upload the photos. If still not possible, use a different file name and when it's about hundreds of photos use something like a "bulk rename utility."
2,755,030
I am trying to use the new facebook api and it requires libcurl PHP. I used ``` sudo apt-get install php5-curl sudo apachectl -k restart ``` And it didn't work. I get the same error and the phpinfo() page says nothing about libcurl. The source of this problem is probably that I built some of the tools from source...
2010/05/02
[ "https://Stackoverflow.com/questions/2755030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/226773/" ]
I like Craig Larman's [Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development (3rd Edition)](https://rads.stackoverflow.com/amzn/click/com/0131489062). Most PHP programmers would do well to learn habits like design patterns and GRASP. You could also "keep it in the ...
I've had The [*Object-Oriented Thought Process*](http://www.informit.com/store/product.aspx?isbn=9780672326110&rll=1) on my wishlist for a few months, but I haven't got my hands on it yet. The reviews and snippets I've seen are positive, though. You'd need to supplement it with language-specific details from the PHP re...
2,755,030
I am trying to use the new facebook api and it requires libcurl PHP. I used ``` sudo apt-get install php5-curl sudo apachectl -k restart ``` And it didn't work. I get the same error and the phpinfo() page says nothing about libcurl. The source of this problem is probably that I built some of the tools from source...
2010/05/02
[ "https://Stackoverflow.com/questions/2755030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/226773/" ]
I like Craig Larman's [Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development (3rd Edition)](https://rads.stackoverflow.com/amzn/click/com/0131489062). Most PHP programmers would do well to learn habits like design patterns and GRASP. You could also "keep it in the ...
If you are really interested into architecture, not just basic design of small pieces, look at the Patternoriented software architecture series. Domain driven design might be also a good books for you.
2,619,275
I understand that the dimension of $\mathcal L(V,W)$ is dim$(V)$dim$(W)$ because there is an isomorphism with $\mathbb F^{m,n}$ where $m=$ dim$(V)$ and $n=$ dim$(W)$. This means that there is a basis for $\mathcal L(V,W)$ with dim$(V)$dim$(W)$ elements, right? What's a possible basis?
2018/01/24
[ "https://math.stackexchange.com/questions/2619275", "https://math.stackexchange.com", "https://math.stackexchange.com/users/521143/" ]
Once you've chosen a basis $(u\_i)\_{1\le i\le\dim V}$ for $V$ and a basis $(v\_j)\_{1\le j\le\dim W}$ for $W$, a basis for $\mathcal L(V,W)$ is made up of the linear maps $\bigl(\varepsilon\_{ij}\bigr)\_{\substack{1\le i\le\dim V,\\[0.5ex] 1\le j\le\dim W}}$ defined by $$\begin{cases}\varepsilon\_{ij}(u\_i)=v\_j,\\[0....
Yes. And the vector basis are matrices $E\_{i,j}$ such that the $i-j$ th entry is 1 and the others 0: $$ \begin{pmatrix} 0 & 0 & \cdots & 0 &\cdots & 0\\ 0 & 0 & \cdots & 0 &\cdots & 0 \\ \vdots & \vdots &\ddots & \vdots &\ddots & \vdots\\ 0 & 0 & \cdots & 1 & \cdots 0\\ \vdots & \vdots &\ddots & \vdots &\ddots & \vdo...
35,458,975
I have 4 "chosen" multi-select boxes. `Group -> Class -> Category -> Subcategory` When an option is selected from `Group`, it will populate `Class` with the relevant options (via ajax/json). This is working great. However, I need to extend this to the following: If `0`, or more than `1` options are selected from gr...
2016/02/17
[ "https://Stackoverflow.com/questions/35458975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5579365/" ]
If you use classes instead of IDs you can use document.QuerySelectorAll() to get all the divs with that class and then show or hide as necessary. Something like below would hide all divs with an edit-slider class and reveal (assuming they were already hidden) all divs with a history-slider class. ``` (function()...
First, consider using `class` instead of `id` to set multiple elements with the same attribute and value. Then, use the following script: ``` <script type="text/javascript"> document.querySelectorAll('div.history-slider').forEach(item => { item.addEventListener("click", myFunction); }); function myFunction()...
63,397,532
different microservices are connecting to single hazelcast cluster because of that if cache is corrupted due to any of them whole cluster is needed to be restarted which affects other services , Is there anyway to prevent this ?
2020/08/13
[ "https://Stackoverflow.com/questions/63397532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10867348/" ]
If you have multiple instances of multiple services, then you could set them up to use different storage containers in the cluster. Ie. * Instance 1 of service A uses [IMap](https://docs.hazelcast.org/docs/4.0.2/javadoc/com/hazelcast/map/IMap.html) named "A" * Instance 2 of service A uses [IMap](https://docs.hazelcas...
If your microservice primarily performs READ operations against the Maps, you could consider using the Near Cache feature. <https://docs.hazelcast.org/docs/4.0.2/manual/html-single/index.html#near-cache> The near cache will give you two benefits. 1. Data Get on the Map will be a lot faster as it is pulling from the ...
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
From what you said, I'm assuming you're using an option like this when you run Bitcoin Core (bitcoin-qt): ``` -datadir=D:\BitCoinData ``` (if not, you should do something like that to specify that the blockchain will be on your 1TB HDD; otherwise, it's only the small client, and not the large and oft-updated blockch...
You can simply create a folder in %appdata% called 'Bitcoin' and place the bootstrap.dat file right in there, or start Bitcoin, close it, and the folder will be there :) Once you have copied bootstrap.dat you can open Bitcoin (again). After completing, Bitcoin will rename bootstrap.dat to bootstrap.dat.old at which po...
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
You can simply create a folder in %appdata% called 'Bitcoin' and place the bootstrap.dat file right in there, or start Bitcoin, close it, and the folder will be there :) Once you have copied bootstrap.dat you can open Bitcoin (again). After completing, Bitcoin will rename bootstrap.dat to bootstrap.dat.old at which po...
Yes, confirmed - copy to `C:\%userprofile%\Appdata\Bitcoin\` Relaunch the Bitcoin client. In bottom left, it will say "importing blocks from disk..."
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
At this writing the bitcoin core wallet prompts you where to save the blockchain data; you can copy bootstrap.dat into that directory and it will load it from there.
You can simply create a folder in %appdata% called 'Bitcoin' and place the bootstrap.dat file right in there, or start Bitcoin, close it, and the folder will be there :) Once you have copied bootstrap.dat you can open Bitcoin (again). After completing, Bitcoin will rename bootstrap.dat to bootstrap.dat.old at which po...
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
From what you said, I'm assuming you're using an option like this when you run Bitcoin Core (bitcoin-qt): ``` -datadir=D:\BitCoinData ``` (if not, you should do something like that to specify that the blockchain will be on your 1TB HDD; otherwise, it's only the small client, and not the large and oft-updated blockch...
Yes, confirmed - copy to `C:\%userprofile%\Appdata\Bitcoin\` Relaunch the Bitcoin client. In bottom left, it will say "importing blocks from disk..."
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
From what you said, I'm assuming you're using an option like this when you run Bitcoin Core (bitcoin-qt): ``` -datadir=D:\BitCoinData ``` (if not, you should do something like that to specify that the blockchain will be on your 1TB HDD; otherwise, it's only the small client, and not the large and oft-updated blockch...
i didn't have to place the bootstrap file anywhere specific -- instead, i indicated it with the `loadblock` option: ``` \path\to\bitcoin-core\bitcoin-qt.exe --loadblock=\path\to\bootstrap.dat ```
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
From what you said, I'm assuming you're using an option like this when you run Bitcoin Core (bitcoin-qt): ``` -datadir=D:\BitCoinData ``` (if not, you should do something like that to specify that the blockchain will be on your 1TB HDD; otherwise, it's only the small client, and not the large and oft-updated blockch...
At this writing the bitcoin core wallet prompts you where to save the blockchain data; you can copy bootstrap.dat into that directory and it will load it from there.
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
i didn't have to place the bootstrap file anywhere specific -- instead, i indicated it with the `loadblock` option: ``` \path\to\bitcoin-core\bitcoin-qt.exe --loadblock=\path\to\bootstrap.dat ```
Yes, confirmed - copy to `C:\%userprofile%\Appdata\Bitcoin\` Relaunch the Bitcoin client. In bottom left, it will say "importing blocks from disk..."
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
At this writing the bitcoin core wallet prompts you where to save the blockchain data; you can copy bootstrap.dat into that directory and it will load it from there.
Yes, confirmed - copy to `C:\%userprofile%\Appdata\Bitcoin\` Relaunch the Bitcoin client. In bottom left, it will say "importing blocks from disk..."
30,051
I'm sure this has been asked many times before, but I've recently gotten into the whole cryptocurrency thing starting with Dogecoin, and I now want to use Bitcoin as well. I am on Windows 7. I found out the hard way that downloading the blockchain through bitcoin-qt takes forever, so I went to <https://bitcoin.org/bin/...
2014/08/14
[ "https://bitcoin.stackexchange.com/questions/30051", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/18986/" ]
At this writing the bitcoin core wallet prompts you where to save the blockchain data; you can copy bootstrap.dat into that directory and it will load it from there.
i didn't have to place the bootstrap file anywhere specific -- instead, i indicated it with the `loadblock` option: ``` \path\to\bitcoin-core\bitcoin-qt.exe --loadblock=\path\to\bootstrap.dat ```
2,915
How can I assign a user group to a user when it's created through the front end? EDIT: So a few more details. I see there are some great answers if you want to put all users in one group, but unfortunately that's not the case. I have different forms for different groups. Ideally I would like to have checkboxes on the ...
2014/10/04
[ "https://craftcms.stackexchange.com/questions/2915", "https://craftcms.stackexchange.com", "https://craftcms.stackexchange.com/users/858/" ]
Under Settings > Users > Settings Tab there is an option to `allow public registration` and `Default User Group` with a drop down that lets you select a user group. If you need more flexibility, you could also write a simple plugin with an `init` function defined in the primary plugin class that listens to the `saveUs...
To have a new user automatically assigned to a user group, there are two easy ways to do it. --- **(1) If the user registers through a front-end form:** You can pre-set their user group by going to Settings > Users > Settings, and selecting the "Allow public registration?" checkbox. This will reveal a dropdown menu,...
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
dirkGentley's answer: > > Yes, most compilers are likely to > optimize out the memory read should a[ > i ] > > > Sometimes the compiler will not optimize the code when it is dealing with a pointer that "may be aliased". In your case Nick, if you are giving "a" as a function parameter, function(int \* a), then t...
You say "If I were writing the code above in assembler..." so I assume you know assembly language. My advice: Have a look at the compiler output on critical sections of code, see what's really going on.
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
Write it for readability first. Personally, I find that all the subscripting hurts my eyes, so I'd probably write it more like: ``` for (i=0; i < a_len; i++) { int val = a[i]; /* or whatever type */ int result = 0; /* default result */ if (val == 0) { result = f1(val); } else if (val % 2 ==...
Optimization hint ----------------- I would probable first look at having `var` as a pointer instead i local vaiable to probable be better. then you dont use double storing of the variable as well ``` int* var;//Int or whatever type a[] is for (i=0; i < a_len; i++) { val = &a[i]; if (*val == 0) { f1(v...
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
dirkGentley's answer: > > Yes, most compilers are likely to > optimize out the memory read should a[ > i ] > > > Sometimes the compiler will not optimize the code when it is dealing with a pointer that "may be aliased". In your case Nick, if you are giving "a" as a function parameter, function(int \* a), then t...
Optimization hint ----------------- I would probable first look at having `var` as a pointer instead i local vaiable to probable be better. then you dont use double storing of the variable as well ``` int* var;//Int or whatever type a[] is for (i=0; i < a_len; i++) { val = &a[i]; if (*val == 0) { f1(v...
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
The functions `f1` and `f2` seems to share the same signature. How differently do they behave? Do you really need the check outside? Or, can you embed the logic in one function? If you have a `if-else` ladder instead of only two such functions, try to use an array of function pointers instead. Use the value of `a[ i ]...
An array in C is essentially a pointer. local variables are cheap. I find the first example a tad more simple to read because im not questioning what "val" is for. if "val" and "a" had better names I would venture to say the second example would improve readability.
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
Write it for readability first. Personally, I find that all the subscripting hurts my eyes, so I'd probably write it more like: ``` for (i=0; i < a_len; i++) { int val = a[i]; /* or whatever type */ int result = 0; /* default result */ if (val == 0) { result = f1(val); } else if (val % 2 ==...
1. Don't optimise unless you know you have to 2. Your compiler will probably do the right thing 3. I find the latter version easier to read 4. (marginal) it's easier to isolate the latter version from side effects in a multi-threaded program
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
Both versions generate exactly the same code in GCC, as long as -O or higher is turned on. So my suggestion is to do whichever way you like better (I prefer without the local variable).
An array in C is essentially a pointer. local variables are cheap. I find the first example a tad more simple to read because im not questioning what "val" is for. if "val" and "a" had better names I would venture to say the second example would improve readability.
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
Write it for readability first. Personally, I find that all the subscripting hurts my eyes, so I'd probably write it more like: ``` for (i=0; i < a_len; i++) { int val = a[i]; /* or whatever type */ int result = 0; /* default result */ if (val == 0) { result = f1(val); } else if (val % 2 ==...
You say "If I were writing the code above in assembler..." so I assume you know assembly language. My advice: Have a look at the compiler output on critical sections of code, see what's really going on.
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
You say "If I were writing the code above in assembler..." so I assume you know assembly language. My advice: Have a look at the compiler output on critical sections of code, see what's really going on.
Optimization hint ----------------- I would probable first look at having `var` as a pointer instead i local vaiable to probable be better. then you dont use double storing of the variable as well ``` int* var;//Int or whatever type a[] is for (i=0; i < a_len; i++) { val = &a[i]; if (*val == 0) { f1(v...
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
Both versions generate exactly the same code in GCC, as long as -O or higher is turned on. So my suggestion is to do whichever way you like better (I prefer without the local variable).
1. Don't optimise unless you know you have to 2. Your compiler will probably do the right thing 3. I find the latter version easier to read 4. (marginal) it's easier to isolate the latter version from side effects in a multi-threaded program
662,748
I'm writing some optimized C code that basically runs through an array and does something to each element. What it does depends on the current value of the element so something like: ``` for (i=0; i < a_len; i++) { if (a[i] == 0) { a[i] = f1(a[i]); } else if (a[i] % 2 == 0) { a[i] = f2(a[i]); ...
2009/03/19
[ "https://Stackoverflow.com/questions/662748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
Write it for readability first. Personally, I find that all the subscripting hurts my eyes, so I'd probably write it more like: ``` for (i=0; i < a_len; i++) { int val = a[i]; /* or whatever type */ int result = 0; /* default result */ if (val == 0) { result = f1(val); } else if (val % 2 ==...
An array in C is essentially a pointer. local variables are cheap. I find the first example a tad more simple to read because im not questioning what "val" is for. if "val" and "a" had better names I would venture to say the second example would improve readability.
14,507,987
I have this **file.php** file that is doing a ``` SELECT 'NAME' FROM users WHERE CONDITION ``` I would like to keep track of the rows that have been served for every call. so I'd like to keep a counter for each row. What is the most efficient way in **PHP** to update a counter for every row that was fetched?
2013/01/24
[ "https://Stackoverflow.com/questions/14507987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/817527/" ]
you need to add an extra column for view/fetch count ``` SELECT ...., views+1 as view FROM table_name WHERE .... UPDATE table_name SET views = views + 1 WHERE ...; ``` you can put it in a `Transaction`
You could always add a `fetched_at` column to that table, then update that if/when you fetch records: ``` UPDATE users SET fetched_at=UTC_TIMESTAMP() WHERE ...condition... ``` Then fetch as you would normally. You would apply an identical condition to both cases. Keep in mind that if you're using `JOIN` this might b...
16,180,536
I am very new to the world of programming and just decided to try and take it up in the last few weeks. I have learned most of what I know(which is not much) so far from a book I bought on java programming. So the problem may be basic, but I have no clue. Anyways. I just installed Eclipse 4.2.2 and I tried to make a ...
2013/04/23
[ "https://Stackoverflow.com/questions/16180536", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2309509/" ]
Move your imports before your class. ``` import static java.lang.System.out; import java.util.Scanner; public class countto {..} ```
If you press control-shift-o that is the shortcut for 'optimize imports' and eclipse will try to properly set up your imports for you. Even if this does work, it is NEVER a substitute for properly understanding how to use the import statement, knowing what to import and why. :-) If this does fix your problem, your next...
48,383,233
I am trying to install MongoDb 3.6.2 community in passive mode. I do not want to include MongoCompass. I cannot seem to find an option in the documentation for this.
2018/01/22
[ "https://Stackoverflow.com/questions/48383233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9251867/" ]
This is what is making margin: ``` .site-header-cart .widget_shopping_cart .woocommerce-mini-cart__empty-message { margin: 1.41575em; } ``` Location: `https://store.ashenglowgaming.com/wp-content/cache/jch-optimize/b0effbedde43bc37217434081fca7177_2.css` To make them black remove margin and add padding instead:...
You can use this: ``` #masthead * { background: black; } ```
48,383,233
I am trying to install MongoDb 3.6.2 community in passive mode. I do not want to include MongoCompass. I cannot seem to find an option in the documentation for this.
2018/01/22
[ "https://Stackoverflow.com/questions/48383233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9251867/" ]
This is what is making margin: ``` .site-header-cart .widget_shopping_cart .woocommerce-mini-cart__empty-message { margin: 1.41575em; } ``` Location: `https://store.ashenglowgaming.com/wp-content/cache/jch-optimize/b0effbedde43bc37217434081fca7177_2.css` To make them black remove margin and add padding instead:...
A quick solution is to edit your html by adding the attribute `style="margin:0px;background:black;"`. an other solution is to add `!important` tag to your css ! ``` #site-header-cart > li:nth-child(2){ background: black !important; padding: 0 !important; margin: 0 !important; } .site-header-cart * { ...
48,383,233
I am trying to install MongoDb 3.6.2 community in passive mode. I do not want to include MongoCompass. I cannot seem to find an option in the documentation for this.
2018/01/22
[ "https://Stackoverflow.com/questions/48383233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9251867/" ]
You have this class in your CSS : ``` @media screen and (min-width: 768px) .site-header-cart .widget_shopping_cart, .main-navigation ul.menu ul.sub-menu, .main-navigation ul.nav-menu ul.children { background-color: #f0f0f0; } ``` This explicitly tells your cart to be of color `f0f0f0`. Remove it, and it become...
You can use this: ``` #masthead * { background: black; } ```
48,383,233
I am trying to install MongoDb 3.6.2 community in passive mode. I do not want to include MongoCompass. I cannot seem to find an option in the documentation for this.
2018/01/22
[ "https://Stackoverflow.com/questions/48383233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9251867/" ]
You have this class in your CSS : ``` @media screen and (min-width: 768px) .site-header-cart .widget_shopping_cart, .main-navigation ul.menu ul.sub-menu, .main-navigation ul.nav-menu ul.children { background-color: #f0f0f0; } ``` This explicitly tells your cart to be of color `f0f0f0`. Remove it, and it become...
A quick solution is to edit your html by adding the attribute `style="margin:0px;background:black;"`. an other solution is to add `!important` tag to your css ! ``` #site-header-cart > li:nth-child(2){ background: black !important; padding: 0 !important; margin: 0 !important; } .site-header-cart * { ...
35,654,832
I have an array of arrays: ``` [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ] ``` I want to find the index (row and column) of the items with value `1`. How can I do this? I need these values so that I can manipulate the cells at either side of the `1`s. I looked at `find.index` method, but I'm not sure.
2016/02/26
[ "https://Stackoverflow.com/questions/35654832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5897451/" ]
``` a = [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ].flatten a.each.with_index.select{|e, _| e == 1}.map{|_, i| i.divmod(4)} # => [[1, 1], [2, 3]] ``` To be interpreted as (row 1, column 1) and (row 2, column 3).
Ruby has a very flexible, functional style `Enumerable` module which is included in many of the standard collections (Arrays, Hashes, Sets). You can find the documentation [at ruby-doc.org](http://ruby-doc.org/core-2.3.0/Enumerable.html). A nice one-liner to solve this in max #rows \* 2 #columns time would be the fol...
35,654,832
I have an array of arrays: ``` [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ] ``` I want to find the index (row and column) of the items with value `1`. How can I do this? I need these values so that I can manipulate the cells at either side of the `1`s. I looked at `find.index` method, but I'm not sure.
2016/02/26
[ "https://Stackoverflow.com/questions/35654832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5897451/" ]
``` a = [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ].flatten a.each.with_index.select{|e, _| e == 1}.map{|_, i| i.divmod(4)} # => [[1, 1], [2, 3]] ``` To be interpreted as (row 1, column 1) and (row 2, column 3).
``` z = [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ] ``` First, let's find the matching rows: ``` rows = z.each_with_index.select { |row, index| row.include? 1}.map(&:last) # => [1, 2] ``` And then for each row let's find the index of the matching `1`: ``` cols = rows.map {|row| z[row].each_with_index.s...
35,654,832
I have an array of arrays: ``` [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ] ``` I want to find the index (row and column) of the items with value `1`. How can I do this? I need these values so that I can manipulate the cells at either side of the `1`s. I looked at `find.index` method, but I'm not sure.
2016/02/26
[ "https://Stackoverflow.com/questions/35654832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5897451/" ]
``` a = [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ].flatten a.each.with_index.select{|e, _| e == 1}.map{|_, i| i.divmod(4)} # => [[1, 1], [2, 3]] ``` To be interpreted as (row 1, column 1) and (row 2, column 3).
Consider using the [Matrix](http://ruby-doc.org/stdlib-2.0.0/libdoc/matrix/rdoc/Matrix.html) class. ``` require 'matrix' arr = [ [0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0] ] target = 1 Matrix[*arr].each_with_index.with_object([]) { |(e,row,col),a| a << [row,col] if e==target } #=> [[1, 1...
35,654,832
I have an array of arrays: ``` [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ] ``` I want to find the index (row and column) of the items with value `1`. How can I do this? I need these values so that I can manipulate the cells at either side of the `1`s. I looked at `find.index` method, but I'm not sure.
2016/02/26
[ "https://Stackoverflow.com/questions/35654832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5897451/" ]
Not that fancy, but you could use two loops: ``` ary = [ [0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0] ] result = [] ary.each_with_index do |row, i| row.each_with_index do |value, j| result << [i, j] if value == 1 end end result #=> [[1, 1], [2, 3]] ```
Ruby has a very flexible, functional style `Enumerable` module which is included in many of the standard collections (Arrays, Hashes, Sets). You can find the documentation [at ruby-doc.org](http://ruby-doc.org/core-2.3.0/Enumerable.html). A nice one-liner to solve this in max #rows \* 2 #columns time would be the fol...
35,654,832
I have an array of arrays: ``` [ [0,0,0,0], [0,1,0,0], [0,0,0,1], [0,0,0,0] ] ``` I want to find the index (row and column) of the items with value `1`. How can I do this? I need these values so that I can manipulate the cells at either side of the `1`s. I looked at `find.index` method, but I'm not sure.
2016/02/26
[ "https://Stackoverflow.com/questions/35654832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5897451/" ]
Consider using the [Matrix](http://ruby-doc.org/stdlib-2.0.0/libdoc/matrix/rdoc/Matrix.html) class. ``` require 'matrix' arr = [ [0, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1], [0, 0, 0, 0] ] target = 1 Matrix[*arr].each_with_index.with_object([]) { |(e,row,col),a| a << [row,col] if e==target } #=> [[1, 1...
Ruby has a very flexible, functional style `Enumerable` module which is included in many of the standard collections (Arrays, Hashes, Sets). You can find the documentation [at ruby-doc.org](http://ruby-doc.org/core-2.3.0/Enumerable.html). A nice one-liner to solve this in max #rows \* 2 #columns time would be the fol...