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 |
|---|---|---|---|---|---|
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | **In the RAW+JPEG workflow, JPEG is what you shoot for. RAW is the safety net.**
The primary benefit or JPEG is not smaller files (that's the second), it is that **JPEGs are actually images**. Images have advantages over RAW files, already mentioned by others: quick preview, ready to email, no processing required, etc... | Usually people do store in both formats to save their time (as they think), in case if JPEG is ok.
But I prefer to store only in RAW. All pictures without any problems (WB, expo, contrast, etc..) I convert in batch processing, in one-two clicks. The benefits are:
* I don't need to spend some time on filtering "JPEG o... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | My understanding is that the convention of RAW+JPEG started early in pro digital photography (like Sports Illustrated at a bowl game) when computers were slower than they are today and RAW file tools more cumbersome to use. The idea would be that Photo Editors would look through the JPEG files to find the shots they ne... | I've suggested RAW+JPEG to photographers who are fairly new to digital photography and are ambivalent about switching to a raw workflow, because they don't have raw-capable tools or are worried about the effort involved. I point out that they can keep using the JPEGs like they always have, but the raw files will be the... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | I am an amateur photographer going semi-pro and even though I still only use RAW I have come across a few occasions where RAW+JPEG was needed (or at least would be a great convenience):
* **ready to email files** (like @rowland-shaw wrote) - some times you need to get your photos out there as fast as possible
* ***lit... | There's a couple of benefits that spring to mind, especially for portraiture work:
* Speed of generating proofs - if a client is only going to pick 5% of shots for final use, there's little point in going through and white balancing everything, and then batch processing them to JPEG for the client to peruse.
* Instant... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | **In the RAW+JPEG workflow, JPEG is what you shoot for. RAW is the safety net.**
The primary benefit or JPEG is not smaller files (that's the second), it is that **JPEGs are actually images**. Images have advantages over RAW files, already mentioned by others: quick preview, ready to email, no processing required, etc... | I've suggested RAW+JPEG to photographers who are fairly new to digital photography and are ambivalent about switching to a raw workflow, because they don't have raw-capable tools or are worried about the effort involved. I point out that they can keep using the JPEGs like they always have, but the raw files will be the... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | I am an amateur photographer going semi-pro and even though I still only use RAW I have come across a few occasions where RAW+JPEG was needed (or at least would be a great convenience):
* **ready to email files** (like @rowland-shaw wrote) - some times you need to get your photos out there as fast as possible
* ***lit... | Depending on your camera, there might be a good reason to shoot JPEG + RAW even if your workflow is RAW-only: **accurate on-camera previews**.
Some cameras work like this (IIRC, I have seen this behaviour at least on Canon PowerShot S95):
* If you shoot RAW-only, the camera will store a *low-resolution* preview JPEG ... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | I shoot JPEG + RAW when I use my older cameras with bad displays such as the 1Ds mk II. The display of that camera is almost useless (but the image quality is great) and I need another way of quickly confirm that focus is correct etc. I use a WiFi enabled memory card to transfer the JPEG:s to my tablet for quick review... | I don't know the actual reason for JPEG/RAW mode, but it's the mode I use most of the time.
Occasionally somebody asks me for a particular photo, and it's easier, faster, and more convenient to give them the JPEG than to load it on my laptop and edit in LightRoom or Capture One.
RAW + JPEG is also nice because someti... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | Depending on your camera, there might be a good reason to shoot JPEG + RAW even if your workflow is RAW-only: **accurate on-camera previews**.
Some cameras work like this (IIRC, I have seen this behaviour at least on Canon PowerShot S95):
* If you shoot RAW-only, the camera will store a *low-resolution* preview JPEG ... | **In-camera .jpg produces more accurate colors.** At least, that is my experience, especially with artificial lighting.
For an example where post-production converters failed, see [here](https://photo.stackexchange.com/questions/29785/what-software-raw-converter-can-convert-from-raf-to-jpg-replicating-the-fujif).
Not... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | I shoot JPEG + RAW because my camera produces *really good JPEG output*. It has flexible control over tone curves, color, and contrast. I'm not usually interested in producing HDR-compressed images — in fact, I often prefer a high contrast look which reduces dynamic range. If I get the exposure and other settings right... | As a professional photographer I rarely need the jpeg files so I only turn them on when needed. When I do need them it is because I need a fast edit and raw files require a bit more processing time and CPU power than the average laptop can handle.
For instance I went to photograph a luncheon for a company where there ... |
10,312 | DSLRs often have the ability to store both a JPEG and a raw file.
Given that the [primary benefit of in-camera JPEG over raw](https://photo.stackexchange.com/questions/15/what-are-the-pros-and-cons-when-shooting-in-raw-vs-jpeg/115#115) is the smaller filesize, and that JPEG+raw is going to store even more data than ra... | 2011/03/29 | [
"https://photo.stackexchange.com/questions/10312",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/378/"
] | My understanding is that the convention of RAW+JPEG started early in pro digital photography (like Sports Illustrated at a bowl game) when computers were slower than they are today and RAW file tools more cumbersome to use. The idea would be that Photo Editors would look through the JPEG files to find the shots they ne... | As a professional photographer I rarely need the jpeg files so I only turn them on when needed. When I do need them it is because I need a fast edit and raw files require a bit more processing time and CPU power than the average laptop can handle.
For instance I went to photograph a luncheon for a company where there ... |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | Did you check the whitepaper on the website?
[SQL Server 2008 Overview.](http://www.microsoft.com/sqlserver/2008/en/us/overview.aspx)
I cannot recall off the top of my head, but it atleast has a nice database to object linking functionality. They have geospatial types too, if you need to use those. | HotAdd CPU. <http://msdn.microsoft.com/en-us/library/bb964703.aspx> |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | There's a great article on the new T-SQL features [here](http://msdn.microsoft.com/en-us/library/cc721270.aspx) (by SQL guru Itzik Ben-Gan). It covers
* Declaring and initializing variables
* Compound assignment operators
* Table value constructor support through the VALUES clause
* Enhancements to the CONVERT functio... | HotAdd CPU. <http://msdn.microsoft.com/en-us/library/bb964703.aspx> |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | Filestream blob storage is the biggest bonus to me | Sparse indexing for those with lots of NULLs. Also the DATETIME2 data type that a lot of people have been waiting for 0001-01-01 through 9999-12-31. |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | Did you check the whitepaper on the website?
[SQL Server 2008 Overview.](http://www.microsoft.com/sqlserver/2008/en/us/overview.aspx)
I cannot recall off the top of my head, but it atleast has a nice database to object linking functionality. They have geospatial types too, if you need to use those. | [white paper on SQL Server 2008](http://download.microsoft.com/download/6/9/d/69d1fea7-5b42-437a-b3ba-a4ad13e34ef6/SQL2008_ProductOverview.docx)
This should cover most of the new features. I noticed the new date time data types and new security features. |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | Filestream blob storage is the biggest bonus to me | [white paper on SQL Server 2008](http://download.microsoft.com/download/6/9/d/69d1fea7-5b42-437a-b3ba-a4ad13e34ef6/SQL2008_ProductOverview.docx)
This should cover most of the new features. I noticed the new date time data types and new security features. |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | * New separate types for Date and Time, instead of just Datetime
* New geographic types for lattitude/longitude
* Change Data Capture is pretty neat if you're doing anything where auditing is important
* Configuration Servers, for maintaining multiple databases.
That's what caught my attention at the Heroes Happen Her... | HotAdd CPU. <http://msdn.microsoft.com/en-us/library/bb964703.aspx> |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | * New separate types for Date and Time, instead of just Datetime
* New geographic types for lattitude/longitude
* Change Data Capture is pretty neat if you're doing anything where auditing is important
* Configuration Servers, for maintaining multiple databases.
That's what caught my attention at the Heroes Happen Her... | [white paper on SQL Server 2008](http://download.microsoft.com/download/6/9/d/69d1fea7-5b42-437a-b3ba-a4ad13e34ef6/SQL2008_ProductOverview.docx)
This should cover most of the new features. I noticed the new date time data types and new security features. |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | Filestream blob storage is the biggest bonus to me | HotAdd CPU. <http://msdn.microsoft.com/en-us/library/bb964703.aspx> |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | Did you check the whitepaper on the website?
[SQL Server 2008 Overview.](http://www.microsoft.com/sqlserver/2008/en/us/overview.aspx)
I cannot recall off the top of my head, but it atleast has a nice database to object linking functionality. They have geospatial types too, if you need to use those. | Page compressiong sounds really nice to me. Haven't used it yet, though.
<http://sqlblog.com/blogs/linchi_shea/archive/2008/05/11/sql-server-2008-page-compression-compression-ratios-from-real-world-databases.aspx> |
75,487 | I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports... | 2008/09/16 | [
"https://Stackoverflow.com/questions/75487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | * New separate types for Date and Time, instead of just Datetime
* New geographic types for lattitude/longitude
* Change Data Capture is pretty neat if you're doing anything where auditing is important
* Configuration Servers, for maintaining multiple databases.
That's what caught my attention at the Heroes Happen Her... | Page compressiong sounds really nice to me. Haven't used it yet, though.
<http://sqlblog.com/blogs/linchi_shea/archive/2008/05/11/sql-server-2008-page-compression-compression-ratios-from-real-world-databases.aspx> |
38,793,179 | Take a look at this image:
[](https://i.stack.imgur.com/rCtoY.png)
As you can see the 2 end links break out of the anchor container.
This is only happening on an iPad (using simulator to test).
On the desktop it behaves as it should by breaking the... | 2016/08/05 | [
"https://Stackoverflow.com/questions/38793179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2040509/"
] | Flexbox is relatively new, and browsers may have implemented it a little diferently from each other.
You may be missing the `-webkit-`prefix, as it looks like safari did need it on some versions.
```
display: -webkit-inline-flex;
display: inline-flex;
-webkit-align-items: stretch;
align-items: stretch;
```
Or, maybe... | Must specify Width in `nav-section__item`
```
.nav-section__item {
padding: 0 20px;
word-wrap: break-all;
width: 20%;
}
```
Live [Demo](https://jsfiddle.net/patelsumit5192/9eo77L4z/) |
38,793,179 | Take a look at this image:
[](https://i.stack.imgur.com/rCtoY.png)
As you can see the 2 end links break out of the anchor container.
This is only happening on an iPad (using simulator to test).
On the desktop it behaves as it should by breaking the... | 2016/08/05 | [
"https://Stackoverflow.com/questions/38793179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2040509/"
] | Flexbox is relatively new, and browsers may have implemented it a little diferently from each other.
You may be missing the `-webkit-`prefix, as it looks like safari did need it on some versions.
```
display: -webkit-inline-flex;
display: inline-flex;
-webkit-align-items: stretch;
align-items: stretch;
```
Or, maybe... | In my experience with safari and flexbox it often helps to just add
```
display: flex;
flex-shrink: 0;
```
to the container which is too small. That should guarantee that the container is atleast the size of its contained element. |
1,020,354 | Complete newbie here. I have installed Ubuntu and love it, but the screen brighness is far too low. I cannot use the computer in the daytime. I have insalled Ubuntu single boot in an intel iMac with rEFInd.
Forgive me if I give too litle information; happy to post outputs of any commands.
Some facts so far:
The sli... | 2018/03/29 | [
"https://askubuntu.com/questions/1020354",
"https://askubuntu.com",
"https://askubuntu.com/users/812787/"
] | I had the same issue as you.
Resolved it by changing BootOrder using `efibootmgr` from within Ubuntu.
Before
======
```
# sudo efibootmgr
BootCurrent: 0000
Timeout: 5 seconds
BootOrder: 0000,0080
Boot0000* ubuntu
Boot0080* Mac OS X
Boot0081* Recovery OS
Boot0082*
BootFFFF*
```
Change order
============
```
# s... | I experienced this. What worked for me was to re install rEFInd every time I installed a new OS. You may do so by launching a terminal inside the recovery mode and navigating to the rEFInd folder (usually on an external dev) where the installation file is, then you can run the installation file. Good luck. |
1,020,354 | Complete newbie here. I have installed Ubuntu and love it, but the screen brighness is far too low. I cannot use the computer in the daytime. I have insalled Ubuntu single boot in an intel iMac with rEFInd.
Forgive me if I give too litle information; happy to post outputs of any commands.
Some facts so far:
The sli... | 2018/03/29 | [
"https://askubuntu.com/questions/1020354",
"https://askubuntu.com",
"https://askubuntu.com/users/812787/"
] | I had the same issue as you.
Resolved it by changing BootOrder using `efibootmgr` from within Ubuntu.
Before
======
```
# sudo efibootmgr
BootCurrent: 0000
Timeout: 5 seconds
BootOrder: 0000,0080
Boot0000* ubuntu
Boot0080* Mac OS X
Boot0081* Recovery OS
Boot0082*
BootFFFF*
```
Change order
============
```
# s... | I had the same symptom (rEFInd worked at first then stopped working) on a Macbook Pro 13" retina (mid-2014). Running OS X Catalina and Mint 19.3, I installed rEFInd from within OS X after both were already working.
In my case rEFInd appeared after installation and let me pick each system one time, thereafter the syste... |
63,071,474 | I have table tbl\_Survey:
```
SurveyID 1 2 3 4
7 4 4 4 4
8 3 3 3 3
9 2 2 2 2
```
My goal is to transfer table headers - 1 2 3 4 into rows, as the following:
```
enter
SurveyID Ouestion Rating
7 1 4
7 2 ... | 2020/07/24 | [
"https://Stackoverflow.com/questions/63071474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9307721/"
] | How about this:
```
DECLARE @T TABLE (SurveyID int, q1 int, q2 int, q3 int, q4 int)
INSERT @T (SurveyID, q1, q2, q3, q4)
VALUES (7,4,4,4,4), (8,3,3,3,3), (9, 2, 2, 2, 2)
SELECT SurveyID, REPLACE(Question,'q','') as Question, Rating
FROM @T UNPIVOT (Rating FOR Question in (q1, q2, q3, q4)) as UPV
``` | Same approach. Just make sure you use a global temporary table as a temp table will not be visible in the scope of the EXEC statement. This should work with any column name and any number of columns.
```
IF OBJECT_ID('tempdb..##T') IS NOT NULL DROP TABLE ##T
CREATE TABLE ##T (SurveyID int, xxxxx int, yyyyy int, zzzzzz... |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | There is no method like getElementByClassName. But getElementsByClassName (note the "s"). simply get the first element from array.
```
var helloBtn = document.getElementsByClassName("hello-btn")[0];
```
should work as intended. | Try JQuery .bind() method, I used at several places
<https://api.jquery.com/bind/> |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | The function is called `getElementsByClassName`. It can return multiple results and if you want to attach a handler to all of the returned results, you need to iterate over them:
```html
<a href="#"class="hello-btn">Google</a>
<a href="#"class="hello-btn">Microsoft</a>
<a href="#"class="hello-btn">Facebook</a>
<a href... | There is no method like getElementByClassName. But getElementsByClassName (note the "s"). simply get the first element from array.
```
var helloBtn = document.getElementsByClassName("hello-btn")[0];
```
should work as intended. |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | There is no method like getElementByClassName. But getElementsByClassName (note the "s"). simply get the first element from array.
```
var helloBtn = document.getElementsByClassName("hello-btn")[0];
```
should work as intended. | As the class name can be used by multiple tags. `document.getElementsByClassName` returns an Array.
**If you want to allow click to all buttons having the same class name.**
Example: <https://jsfiddle.net/pLtjo5hn/>
```
var helloBtn = document.getElementsByClassName('hello-btn');
for(var i = 0; i < helloBtn.leng... |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | The function is called `getElementsByClassName`. It can return multiple results and if you want to attach a handler to all of the returned results, you need to iterate over them:
```html
<a href="#"class="hello-btn">Google</a>
<a href="#"class="hello-btn">Microsoft</a>
<a href="#"class="hello-btn">Facebook</a>
<a href... | Try JQuery .bind() method, I used at several places
<https://api.jquery.com/bind/> |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | Have you tried with `const helloBtn = document.querySelector(".hello-btn");` or `querySelectorAll`?
```js
// Use const instead var
const helloBtn = document.querySelector(".hello-btn");
helloBtn.addEventListener("click", () => {
console.log("Btn clicked");
});
const interval = window.setInterval(() => {
helloBtn... | Try JQuery .bind() method, I used at several places
<https://api.jquery.com/bind/> |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | The function is called `getElementsByClassName`. It can return multiple results and if you want to attach a handler to all of the returned results, you need to iterate over them:
```html
<a href="#"class="hello-btn">Google</a>
<a href="#"class="hello-btn">Microsoft</a>
<a href="#"class="hello-btn">Facebook</a>
<a href... | Have you tried with `const helloBtn = document.querySelector(".hello-btn");` or `querySelectorAll`?
```js
// Use const instead var
const helloBtn = document.querySelector(".hello-btn");
helloBtn.addEventListener("click", () => {
console.log("Btn clicked");
});
const interval = window.setInterval(() => {
helloBtn... |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | The function is called `getElementsByClassName`. It can return multiple results and if you want to attach a handler to all of the returned results, you need to iterate over them:
```html
<a href="#"class="hello-btn">Google</a>
<a href="#"class="hello-btn">Microsoft</a>
<a href="#"class="hello-btn">Facebook</a>
<a href... | As the class name can be used by multiple tags. `document.getElementsByClassName` returns an Array.
**If you want to allow click to all buttons having the same class name.**
Example: <https://jsfiddle.net/pLtjo5hn/>
```
var helloBtn = document.getElementsByClassName('hello-btn');
for(var i = 0; i < helloBtn.leng... |
73,809,949 | Ive got the state: const [isPressed, setIsPressed] = useState(false)
Then I want to pass the setIsPressed when navigating to another sreen, which i wrote:
On the from Screen:
onPress{() => navigation.navigate('Map', {setIsPressed})}
On the to Screen:
onPress={() => {navigation.navigate('DM'); setIsPressed(true);}}
How... | 2022/09/22 | [
"https://Stackoverflow.com/questions/73809949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19323592/"
] | Have you tried with `const helloBtn = document.querySelector(".hello-btn");` or `querySelectorAll`?
```js
// Use const instead var
const helloBtn = document.querySelector(".hello-btn");
helloBtn.addEventListener("click", () => {
console.log("Btn clicked");
});
const interval = window.setInterval(() => {
helloBtn... | As the class name can be used by multiple tags. `document.getElementsByClassName` returns an Array.
**If you want to allow click to all buttons having the same class name.**
Example: <https://jsfiddle.net/pLtjo5hn/>
```
var helloBtn = document.getElementsByClassName('hello-btn');
for(var i = 0; i < helloBtn.leng... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | Since it wasn't mentioned, you can use the XML data type.
```
BEGIN
DECLARE @xml XML
SELECT @xml = '<n>1</n><n>2</n><n>3</n>'
SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n)
IF 1 IN (SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n))
PRINT('Yep')
IF 4 NOT IN (SELECT t.n.value('.','int') FROM @x... | You can't pass a string of values to the stored procedure. The most obvious answer would be to make your whole sql query string dynamic, the two links should take you through the various other alternatives that are available -
<http://www.sommarskog.se/arrays-in-sql.html>
[Parameterize an SQL IN clause](https://stack... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | That's because your `select` statement is the equivalent of:
```
SELECT u.*, p.*
FROM tbl_Users u
INNER JOIN tbl_Bunker b ON u.BunkerId = b.Bunker
WHERE u.UserId IN ('555, 3695, 8787')
```
You're basically searching to see if `UserId` is a string that literally matches `'555, 3695, 8787'`, which is not what you... | You can't pass a string of values to the stored procedure. The most obvious answer would be to make your whole sql query string dynamic, the two links should take you through the various other alternatives that are available -
<http://www.sommarskog.se/arrays-in-sql.html>
[Parameterize an SQL IN clause](https://stack... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | Shark explained it better than I was going to. If I remember right you can do this, but it's been a long time since I had to do what you are after so I might be wrong.
```
EXEC('SELECT u.*, p.*
FROM tbl_Users u
INNER JOIN tbl_Bunker b ON u.BunkerId = b.Bunker
WHERE u.UserId IN (' + @m_UserIdList + '... | Since it wasn't mentioned, you can use the XML data type.
```
BEGIN
DECLARE @xml XML
SELECT @xml = '<n>1</n><n>2</n><n>3</n>'
SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n)
IF 1 IN (SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n))
PRINT('Yep')
IF 4 NOT IN (SELECT t.n.value('.','int') FROM @x... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | Yes, it is treating @m\_UserIdList as one single value and comparing that to u.UserId. You need to split out the values and test them separately. Oded beat me to the punch, but he is right -- you should use a table-valued param. Here is the link from Oded:
<http://www.sommarskog.se/arrays-in-sql-2008.html>
This site ... | You can't pass a string of values to the stored procedure. The most obvious answer would be to make your whole sql query string dynamic, the two links should take you through the various other alternatives that are available -
<http://www.sommarskog.se/arrays-in-sql.html>
[Parameterize an SQL IN clause](https://stack... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | Shark explained it better than I was going to. If I remember right you can do this, but it's been a long time since I had to do what you are after so I might be wrong.
```
EXEC('SELECT u.*, p.*
FROM tbl_Users u
INNER JOIN tbl_Bunker b ON u.BunkerId = b.Bunker
WHERE u.UserId IN (' + @m_UserIdList + '... | You can't pass a string of values to the stored procedure. The most obvious answer would be to make your whole sql query string dynamic, the two links should take you through the various other alternatives that are available -
<http://www.sommarskog.se/arrays-in-sql.html>
[Parameterize an SQL IN clause](https://stack... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | `@m_UserIdList` is a `VARCHAR(500)`, not a list of values, so this will not work. You can try and parse the passed in string into a table (and there are plenty of ways of doing so - just search this site).
However, since you are using SQL Server 2008, you should take a look at [table valued parameters](http://msdn.mic... | You can't pass a string of values to the stored procedure. The most obvious answer would be to make your whole sql query string dynamic, the two links should take you through the various other alternatives that are available -
<http://www.sommarskog.se/arrays-in-sql.html>
[Parameterize an SQL IN clause](https://stack... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | That's because your `select` statement is the equivalent of:
```
SELECT u.*, p.*
FROM tbl_Users u
INNER JOIN tbl_Bunker b ON u.BunkerId = b.Bunker
WHERE u.UserId IN ('555, 3695, 8787')
```
You're basically searching to see if `UserId` is a string that literally matches `'555, 3695, 8787'`, which is not what you... | `@m_UserIdList` is a `VARCHAR(500)`, not a list of values, so this will not work. You can try and parse the passed in string into a table (and there are plenty of ways of doing so - just search this site).
However, since you are using SQL Server 2008, you should take a look at [table valued parameters](http://msdn.mic... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | That's because your `select` statement is the equivalent of:
```
SELECT u.*, p.*
FROM tbl_Users u
INNER JOIN tbl_Bunker b ON u.BunkerId = b.Bunker
WHERE u.UserId IN ('555, 3695, 8787')
```
You're basically searching to see if `UserId` is a string that literally matches `'555, 3695, 8787'`, which is not what you... | Since it wasn't mentioned, you can use the XML data type.
```
BEGIN
DECLARE @xml XML
SELECT @xml = '<n>1</n><n>2</n><n>3</n>'
SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n)
IF 1 IN (SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n))
PRINT('Yep')
IF 4 NOT IN (SELECT t.n.value('.','int') FROM @x... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | Yes, it is treating @m\_UserIdList as one single value and comparing that to u.UserId. You need to split out the values and test them separately. Oded beat me to the punch, but he is right -- you should use a table-valued param. Here is the link from Oded:
<http://www.sommarskog.se/arrays-in-sql-2008.html>
This site ... | Since it wasn't mentioned, you can use the XML data type.
```
BEGIN
DECLARE @xml XML
SELECT @xml = '<n>1</n><n>2</n><n>3</n>'
SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n)
IF 1 IN (SELECT t.n.value('.','int') FROM @xml.nodes('*') as t(n))
PRINT('Yep')
IF 4 NOT IN (SELECT t.n.value('.','int') FROM @x... |
8,326,303 | When I try this query it works:
```
SELECT *
FROM tbl_Users
WHERE UserId IN (555, 3695, 8787))
```
But when I put it in stored procedure it get value only if I pass one ID. If I pass more ID's
I got nothing returned from database:
```
CREATE PROCEDURE myStoredProcedure
@m_UserIdList varchar(500)
AS
SE... | 2011/11/30 | [
"https://Stackoverflow.com/questions/8326303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/480231/"
] | Shark explained it better than I was going to. If I remember right you can do this, but it's been a long time since I had to do what you are after so I might be wrong.
```
EXEC('SELECT u.*, p.*
FROM tbl_Users u
INNER JOIN tbl_Bunker b ON u.BunkerId = b.Bunker
WHERE u.UserId IN (' + @m_UserIdList + '... | `@m_UserIdList` is a `VARCHAR(500)`, not a list of values, so this will not work. You can try and parse the passed in string into a table (and there are plenty of ways of doing so - just search this site).
However, since you are using SQL Server 2008, you should take a look at [table valued parameters](http://msdn.mic... |
146,341 | What sort of fireproof liquid could be used by carbon-based life without causing harm to the organism? Whether it be absorbed from exterior sources or produced in the organism's body. I say organism due to the fact that is not an animal, it is most similar to plant life. The purpose of the fireproof liquid is to preven... | 2019/05/04 | [
"https://worldbuilding.stackexchange.com/questions/146341",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/64584/"
] | **Terminally oxidized things do not burn.**
By terminally oxidized I mean there is a base molecule and then oxidants stuck on to the point oxygen cannot find more room to stick itself on. Oxygen sticking itself onto things = burning.
1. Water. Hydrogen with 2 oxygens stuck on.
2. [Carbon tetrachloride](https://en.wi... | If you are aiming for a conventional fireproofing solution, Hoyle's answer is probably the best. Water is nonflammable, has an very high heat capacity, is abundant, and obviously nontoxic.
That said, humans contain a great deal of water and yet are still vulnerable to fire. If you want creatures that are much more res... |
146,341 | What sort of fireproof liquid could be used by carbon-based life without causing harm to the organism? Whether it be absorbed from exterior sources or produced in the organism's body. I say organism due to the fact that is not an animal, it is most similar to plant life. The purpose of the fireproof liquid is to preven... | 2019/05/04 | [
"https://worldbuilding.stackexchange.com/questions/146341",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/64584/"
] | **Water**
As has been stated, water is fireproof and extinguishes most flames (certain chemical fires can not be extinguished, even if submerged in water).
[](https://i.stack.imgur.com/dfiPR.jpg)
[Redwood trees famously use water to resist fire](htt... | If you are aiming for a conventional fireproofing solution, Hoyle's answer is probably the best. Water is nonflammable, has an very high heat capacity, is abundant, and obviously nontoxic.
That said, humans contain a great deal of water and yet are still vulnerable to fire. If you want creatures that are much more res... |
36,357,914 | Suppose I have following html code.
```
<div>
<label>Test1</label>
<input type="file">
<a href="#" class="selected-file"></a>
</div>
<div>
<label>Test2</label>
<input type="file">
<a href="#" class="selected-file"></a>
</div>
<div>
<label>Test3</label>
<input type="file">
<a href="#... | 2016/04/01 | [
"https://Stackoverflow.com/questions/36357914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It's a side-effect of a glibc feature, fixed in <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57060>:
```
// For the GNU C library pthread_self() is usable without linking to
// libpthread.so but returns 0, so we cannot use it in single-threaded
// programs, because this_thread::get_id() != thread::id{} must be true.
... | Standard does not actually define what the `this_thread::get_id` is going to return. All it says is:
>
> Returns: An object of type thread::id that **uniquely identifies the
> current thread of execution. No other thread of execution shall have
> this id and this thread of execution shall always have this id**. The... |
4,868,060 | I have:
```
CREATE OR REPLACE FUNCTION aktualizujIloscPodan() RETURNS TRIGGER AS
$BODY$
DECLARE
n integer;
sid integer;
BEGIN
sid=0;
IF (TG_OP='INSERT') THEN
sid = NEW."studentID";
ELSIF (TG_OP='DELETE') THEN
sid = OLD."studentID";
END IF;
n = COALESCE ((SELECT count("studentID") as c
FROM "Podania" WHER... | 2011/02/01 | [
"https://Stackoverflow.com/questions/4868060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/479599/"
] | You need to use `FOR EACH ROW`
```
CREATE TRIGGER triggerPodan AFTER INSERT OR DELETE
ON "Podania" FOR EACH ROW
EXECUTE PROCEDURE aktualizujIloscPodan();
``` | For the `delete` trigger only `OLD` record is defined and `NEW` is undefined. So, in the code, check if the trigger is running as `DELETE` or `INSERT` (variable `TG_OP`) and access the appropriate record.
Besides, you can go without counting here at all, like this:
```
CREATE OR REPLACE FUNCTION aktualizujIloscPodan(... |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | There is no such equivalent. The closest is the [Contains()](http://msdn.microsoft.com/en-us/library/bb352880.aspx) extension method of a collection.
Example:
```
var vals = new int[] {2, 96};
if(vals.Contains(iIntVar))
{
// some code
}
``` | You could write an extension method
```
public static bool In(this int value, int[] range)
{
return (value >= range[0] && value <= range[1]);
}
``` |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | I prefer a method like defined here: [Comparing a variable to multiple values](https://stackoverflow.com/questions/2356949/comparing-a-variable-to-multiple-values/2357002#2357002)
Here's the conversion of Chad's post:
```
public static bool In(this T obj, params T[] arr)
{
return arr.Contains(obj);
}
```
And us... | There is no such equivalent. The closest is the [Contains()](http://msdn.microsoft.com/en-us/library/bb352880.aspx) extension method of a collection.
Example:
```
var vals = new int[] {2, 96};
if(vals.Contains(iIntVar))
{
// some code
}
``` |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | In .Net, .Contains is the closest, but the syntax is the opposite of what you wrote.
You could write an extension method to be able to create a .In method
```
public static bool In<T>(this T obj, IEnumerable<T> arr)
{
return arr.Contains(obj);
}
```
And usage would be
```
if (42.In(new[] { 12, 42, 46, 74 }) )
... | You could write an extension method
```
public static bool In(this int value, int[] range)
{
return (value >= range[0] && value <= range[1]);
}
``` |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | I prefer a method like defined here: [Comparing a variable to multiple values](https://stackoverflow.com/questions/2356949/comparing-a-variable-to-multiple-values/2357002#2357002)
Here's the conversion of Chad's post:
```
public static bool In(this T obj, params T[] arr)
{
return arr.Contains(obj);
}
```
And us... | In .Net, .Contains is the closest, but the syntax is the opposite of what you wrote.
You could write an extension method to be able to create a .In method
```
public static bool In<T>(this T obj, IEnumerable<T> arr)
{
return arr.Contains(obj);
}
```
And usage would be
```
if (42.In(new[] { 12, 42, 46, 74 }) )
... |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | You can create this extension method:
```
public static class ExtensionMethods
{
public static bool InRange(this int val, int lower, int upper)
{
return val >= lower && val <= upper;
}
}
```
then you can do this:
```
int i = 56;
if (i.InRange(2, 96)) { /* ... */ }
``` | You could write an extension method
```
public static bool In(this int value, int[] range)
{
return (value >= range[0] && value <= range[1]);
}
``` |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | I prefer a method like defined here: [Comparing a variable to multiple values](https://stackoverflow.com/questions/2356949/comparing-a-variable-to-multiple-values/2357002#2357002)
Here's the conversion of Chad's post:
```
public static bool In(this T obj, params T[] arr)
{
return arr.Contains(obj);
}
```
And us... | You can create this extension method:
```
public static class ExtensionMethods
{
public static bool InRange(this int val, int lower, int upper)
{
return val >= lower && val <= upper;
}
}
```
then you can do this:
```
int i = 56;
if (i.InRange(2, 96)) { /* ... */ }
``` |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | I prefer a method like defined here: [Comparing a variable to multiple values](https://stackoverflow.com/questions/2356949/comparing-a-variable-to-multiple-values/2357002#2357002)
Here's the conversion of Chad's post:
```
public static bool In(this T obj, params T[] arr)
{
return arr.Contains(obj);
}
```
And us... | You could write an extension method
```
public static bool In(this int value, int[] range)
{
return (value >= range[0] && value <= range[1]);
}
``` |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | To expand upon what Mason Wheeler wrote in a comment, this would be HashSet<T>.Contains (under .NET 3.5).
```
int i = 96;
var set = new HashSet<int> { 2, 96 };
if (set.Contains(i))
{
Console.WriteLine("Found!");
}
``` | You could write an extension method
```
public static bool In(this int value, int[] range)
{
return (value >= range[0] && value <= range[1]);
}
``` |
2,357,096 | What is the equivalent in C# for Delphi's in syntax, like:
```
if (iIntVar in [2,96]) then
begin
//some code
end;
```
Thanks | 2010/03/01 | [
"https://Stackoverflow.com/questions/2357096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91617/"
] | I prefer a method like defined here: [Comparing a variable to multiple values](https://stackoverflow.com/questions/2356949/comparing-a-variable-to-multiple-values/2357002#2357002)
Here's the conversion of Chad's post:
```
public static bool In(this T obj, params T[] arr)
{
return arr.Contains(obj);
}
```
And us... | To expand upon what Mason Wheeler wrote in a comment, this would be HashSet<T>.Contains (under .NET 3.5).
```
int i = 96;
var set = new HashSet<int> { 2, 96 };
if (set.Contains(i))
{
Console.WriteLine("Found!");
}
``` |
22,357,776 | I have a `profile.php` page with a variable `uid?=12` and i have a language bar on that is on a separate page called `lang.inc.php`:
Profile Page:
```
<div class="langbar">
<?php include 'inc/lang.inc.php'; ?>
</div>
```
lang.inc.php
```
<center>
<a class="flag_USA" title="English" href="<?php echo basena... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22357776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3411624/"
] | >
> Isn't placing the clean up code in the destructor more or less safer than using another method to do the trick?
>
>
>
The problem here is that while ExitThread (and other functions like it) is a perfect API for **C**, with C++ code, it breaks stack unwinding.
The correct solution for C++ is to make sure you d... | destructors are guaranteed to be called when an object is destroyed however thread clean up can require a tad more than just object destruction. Generally speaking cleanup methods are added when you need to handle releasing of shared resources, dealing with ancient libraries, etc.
Specifically you're dealing with the ... |
22,357,776 | I have a `profile.php` page with a variable `uid?=12` and i have a language bar on that is on a separate page called `lang.inc.php`:
Profile Page:
```
<div class="langbar">
<?php include 'inc/lang.inc.php'; ?>
</div>
```
lang.inc.php
```
<center>
<a class="flag_USA" title="English" href="<?php echo basena... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22357776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3411624/"
] | The only advantage to moving initialization out of the constructor, and for removing cleanup out of the destructor is when you've got a base class framework where you want to reliably call virtual methods during these stages.
Since the vtable is changing during construction/destruction calls to virtual functions don't... | >
> Isn't placing the clean up code in the destructor more or less safer than using another method to do the trick?
>
>
>
The problem here is that while ExitThread (and other functions like it) is a perfect API for **C**, with C++ code, it breaks stack unwinding.
The correct solution for C++ is to make sure you d... |
22,357,776 | I have a `profile.php` page with a variable `uid?=12` and i have a language bar on that is on a separate page called `lang.inc.php`:
Profile Page:
```
<div class="langbar">
<?php include 'inc/lang.inc.php'; ?>
</div>
```
lang.inc.php
```
<center>
<a class="flag_USA" title="English" href="<?php echo basena... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22357776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3411624/"
] | >
> Isn't placing the clean up code in the destructor more or less safer than using another method to do the trick?
>
>
>
The problem here is that while ExitThread (and other functions like it) is a perfect API for **C**, with C++ code, it breaks stack unwinding.
The correct solution for C++ is to make sure you d... | With such approach you'll need to call Shutdown in all cases where the object should be destroyed - each time when it leaves the scope. In the case of exceptions (if they are used) you'll cannot call it. Destructor will be called automatically in these cases.
"I can certainly call the destructor as well" - calling the... |
22,357,776 | I have a `profile.php` page with a variable `uid?=12` and i have a language bar on that is on a separate page called `lang.inc.php`:
Profile Page:
```
<div class="langbar">
<?php include 'inc/lang.inc.php'; ?>
</div>
```
lang.inc.php
```
<center>
<a class="flag_USA" title="English" href="<?php echo basena... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22357776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3411624/"
] | The only advantage to moving initialization out of the constructor, and for removing cleanup out of the destructor is when you've got a base class framework where you want to reliably call virtual methods during these stages.
Since the vtable is changing during construction/destruction calls to virtual functions don't... | destructors are guaranteed to be called when an object is destroyed however thread clean up can require a tad more than just object destruction. Generally speaking cleanup methods are added when you need to handle releasing of shared resources, dealing with ancient libraries, etc.
Specifically you're dealing with the ... |
22,357,776 | I have a `profile.php` page with a variable `uid?=12` and i have a language bar on that is on a separate page called `lang.inc.php`:
Profile Page:
```
<div class="langbar">
<?php include 'inc/lang.inc.php'; ?>
</div>
```
lang.inc.php
```
<center>
<a class="flag_USA" title="English" href="<?php echo basena... | 2014/03/12 | [
"https://Stackoverflow.com/questions/22357776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3411624/"
] | The only advantage to moving initialization out of the constructor, and for removing cleanup out of the destructor is when you've got a base class framework where you want to reliably call virtual methods during these stages.
Since the vtable is changing during construction/destruction calls to virtual functions don't... | With such approach you'll need to call Shutdown in all cases where the object should be destroyed - each time when it leaves the scope. In the case of exceptions (if they are used) you'll cannot call it. Destructor will be called automatically in these cases.
"I can certainly call the destructor as well" - calling the... |
8,921,225 | Whenever I use `HttpConnection` Class in `Java ME`, `Android` or in `BlackBerry`, I uses `DataInputStream`/`DataOutputStream` class for reading & writing datas over remote server. However there are other class like `InputStream`/`OutputStream` which can be use for same purpose. I saw Question regarding `InputStream`/`O... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8921225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996493/"
] | `DataInputStream`/`DataOutputStream` is an `InputStream`/`Outputstream`. `InputStream` and `OutputStream` are the most generic IO streams you can use and they are the base class of all streams in Java. You can read and write raw bytes only with them. `DataInputStream` writes formatted binary data. Instead of just simpl... | **DataOutputStream** makes sure the data is formatted in a platform independent way
**OutputStream** only if you transfer raw binary data.
**DataOutputStream**-This is the big benefit.
There is no significant performance difference between both. |
8,921,225 | Whenever I use `HttpConnection` Class in `Java ME`, `Android` or in `BlackBerry`, I uses `DataInputStream`/`DataOutputStream` class for reading & writing datas over remote server. However there are other class like `InputStream`/`OutputStream` which can be use for same purpose. I saw Question regarding `InputStream`/`O... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8921225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996493/"
] | `DataInputStream`/`DataOutputStream` is an `InputStream`/`Outputstream`. `InputStream` and `OutputStream` are the most generic IO streams you can use and they are the base class of all streams in Java. You can read and write raw bytes only with them. `DataInputStream` writes formatted binary data. Instead of just simpl... | **DataOutputStream** can only handle basic types.
It can only read/write **primtive types** and **Strings**.DataInput/OutputStream performs generally better because its much simpler.
**ObjectInput/OutputStream** can read/write any **object type** was well as **primitives**. It is less efficient but much easier to us... |
8,921,225 | Whenever I use `HttpConnection` Class in `Java ME`, `Android` or in `BlackBerry`, I uses `DataInputStream`/`DataOutputStream` class for reading & writing datas over remote server. However there are other class like `InputStream`/`OutputStream` which can be use for same purpose. I saw Question regarding `InputStream`/`O... | 2012/01/19 | [
"https://Stackoverflow.com/questions/8921225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/996493/"
] | **DataOutputStream** can only handle basic types.
It can only read/write **primtive types** and **Strings**.DataInput/OutputStream performs generally better because its much simpler.
**ObjectInput/OutputStream** can read/write any **object type** was well as **primitives**. It is less efficient but much easier to us... | **DataOutputStream** makes sure the data is formatted in a platform independent way
**OutputStream** only if you transfer raw binary data.
**DataOutputStream**-This is the big benefit.
There is no significant performance difference between both. |
42,810,814 | **XAML Designer** design view shows
**An Exception was thrown**
**ArgumentNullException: Value cannot be null.**
**Parameter name: key**
StackTrace (see after photo)
**InnerException: None**
I have been struggling for few days on the following issue, which prevents me from using **XAML Designe**r's design view o... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/378115/"
] | Setting **IsDesignTimeCreatable=True** on **MainWindows.xaml** did the trick, although it requires special care implementing view model's parameters-less constructor, checking whether code is running in design-time or not.
[According to Microsoft](https://msdn.microsoft.com/en-us/library/ff602277%28v=vs.95%29.aspx?f=2... | Another solution is simply to remove the "d:DataContext" attribute which will disable Datacontext related autocomplete.
I had to use this solution since the "IsDesignTimeCreatable" attribute, suggested by Julio, did not worked for me :/ |
42,810,814 | **XAML Designer** design view shows
**An Exception was thrown**
**ArgumentNullException: Value cannot be null.**
**Parameter name: key**
StackTrace (see after photo)
**InnerException: None**
I have been struggling for few days on the following issue, which prevents me from using **XAML Designe**r's design view o... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/378115/"
] | Setting **IsDesignTimeCreatable=True** on **MainWindows.xaml** did the trick, although it requires special care implementing view model's parameters-less constructor, checking whether code is running in design-time or not.
[According to Microsoft](https://msdn.microsoft.com/en-us/library/ff602277%28v=vs.95%29.aspx?f=2... | Fixed this issue with the following:
1. increased the Designwidth
2. Revert Designwidth back to original.
FYI I am using Visual Studio 2019. |
42,810,814 | **XAML Designer** design view shows
**An Exception was thrown**
**ArgumentNullException: Value cannot be null.**
**Parameter name: key**
StackTrace (see after photo)
**InnerException: None**
I have been struggling for few days on the following issue, which prevents me from using **XAML Designe**r's design view o... | 2017/03/15 | [
"https://Stackoverflow.com/questions/42810814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/378115/"
] | Fixed this issue with the following:
1. increased the Designwidth
2. Revert Designwidth back to original.
FYI I am using Visual Studio 2019. | Another solution is simply to remove the "d:DataContext" attribute which will disable Datacontext related autocomplete.
I had to use this solution since the "IsDesignTimeCreatable" attribute, suggested by Julio, did not worked for me :/ |
26,299,664 | For some reason the pathFor function is not working when I have vars in my path. I have it working for a different controller and route but not this one. I'm not sure why and trying to better understand how the pathFor function works.
My route
```
this.route('topPublicLinks', {
path: '/:permalinkUser/:perma... | 2014/10/10 | [
"https://Stackoverflow.com/questions/26299664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1178416/"
] | Unless the pathFor helper exists within a data context that specifies what the path vars should be, you have to pass them into the helper as parameters. For example, you would have to say something like
```
{{pathFor 'topPublicLinks' permalinkUser=someUser permalink=somePermalink linksLimit=someLimit}}
```
You coul... | In my controller in the data return I wasn't returning anything permalinkUser and permalink was null
```
path: '/:permalinkUser/:permalink/top/:linksLimit?',
```
Once I added the data function and returned permalinkUser and permalink it worked
```
data: function() {
return {
permalinkUser: Top... |
189,998 | I'm always trying to find new methods on development. So I looked into some websites and analyzed their ways of presentation.
1. Returning part of the page using AJAX
Normally I will use an array to return values, for example:
```
//GET User details
$user_id = $_POST['user_id'];
$user_details = $this->get_user(... | 2013/03/10 | [
"https://softwareengineering.stackexchange.com/questions/189998",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/36025/"
] | I don't necessarily agree entirely with Tom's answer so I'm going to give my opinion.
Generally, you should avoid returning XHTML and instead return JSON, transforming the result into the DOM using JavaScript and your framework of choice.
There are some situations such as returning very large amounts of data where th... | It's always better to return JSON rather than HTML in your AJAX result. By returning HTML you're letting your presentation layer leak into your data layer.
Generally speaking you should use AJAX rather than iFrames since its a neater solution and allows bookmarking (if you set it up). There are some use cases where iF... |
93,050 | I'm developing a shop system and using this method to store the customers with their respective orders:
```
try
{
$connection = new PDO("mysql:host={$HOST};dbname={$DB_NAME}", $USERNAME, $PASS);
}
$connection->beginTransaction();
$sql = "INSERT INTO orders (customer_id, customer_name, order_value, order_date)
... | 2015/06/09 | [
"https://codereview.stackexchange.com/questions/93050",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/75342/"
] | As others pointed out in comments (and as usual), an iterative solution can be better. But you said you want to practice recursion, so I guess you want to stick with that.
This code:
>
>
> ```
> int(ceil(len(lis))/2)
>
> ```
>
>
Is exactly the same as:
```
len(lis) // 2
```
Because, there's no point taking t... | Since we can assume without loss of generality that the missing number is not on the ends of the list, let's assume that the numbers are: `a, a+1, ..., a+k-1, a+k+1, ..., a+n`. Therefore, only `a+k` is missing from the list (but of course, we don't know what that is yet!).
For a range of integers `a, a+1, ..., b` with... |
40,721,417 | I am trying to replicate the example of [this](http://blaze.pydata.org/blog/2015/09/08/reddit-comments/) page about castra, dask and reddit comments, and I get the above error when I run the
>
> dd.from\_castra(data,columns)
>
>
>
My castra file took some hours to be created but it is clean and exactly as the tu... | 2016/11/21 | [
"https://Stackoverflow.com/questions/40721417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7189501/"
] | What don't you understand about the message? You have an aggregation query with no `GROUP BY`. Hence, *all* columns must be the arguments to aggregation functions.
I suspect that you intend:
```
SELECT @Total = CAST(SUM(WorkedTimeInMinutes * KayakoValue) AS FLOAT)/60
FROM [VDBSERVER2012\SQLEXPRESS2014].PlaterITDB.dbo... | You should use 'KayakoValue' in aggregate function like sum,count, . . . or in group by at the end .
`SELECT @Total = ((CAST(SUM(WorkedTimeInMinutes) AS FLOAT)/60) * KayakoValue)
FROM [VDBSERVER2012\SQLEXPRESS2014].PlaterITDB.dbo.KayakoTimeEntries
INNER JOIN ClientContract ON ClientId = @ClientId AND Workdate BETWEEN ... |
17,985,122 | Let's say I made an integer wrapper class in Python, like Java has. Most of the methods would be pretty trivial. But the **\_\_ eq \_\_** overload (the equality test) poses a fun puzzle: consider the following method
```
def __eq__( self, other ):
return self.value == int(other)
```
**Implementation details:**
... | 2013/08/01 | [
"https://Stackoverflow.com/questions/17985122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2329988/"
] | If I interpreted your requirements correctly, this should do it:
```
>>> class Integer:
... def __init__(self, val=0):
... self.val = int(val)
... def __eq__(self, other):
... return self.val == other
...
>>> Integer(1) == 1.1
False
>>> Integer(1.2) == Integer(1.3)
True
>>> Integer(4) == Integer(7)
False
... | If I understand you correctly the issue here is that the value you compare against might be a float, rather than an int, that, in return, would get truncated to an equal int, if compared against.
If that is the case how about checking, if the compared value has a remainder when divided by the comparing value and react... |
13,256 | I was asked to today about the available plans (in Israel) to install photo-voltaic receptors on the roof and sell the energy. This is a legitimate plan and there are several companies that do this. The claim is that the initial investment is repaid after roughly 5 years which sounds too optimistic to me. I want to car... | 2011/08/07 | [
"https://physics.stackexchange.com/questions/13256",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/3677/"
] | It will vary a lot by site, and on the particular PV technology being proposed.
So, you need to know:
* is it monocrystalline silicon, is it CdTe thin-film, or something else?
* what's the efficiency of the inverter?
* what's the guarantee on the kit (5 years, 10 years, 20 years)?
Using @Martin Beckett's figure of 2... | For the middle east, typically around 2000 KWh/m^2/year
A good place to start is wiki page for [insolation](http://en.wikipedia.org/wiki/Insolation) (technical term for sunlight arriving) |
20,094,023 | I am trying to send the `&` symbol to the server in an XML body but only received a blank.
I tried HTML code to send this also but in vain. | 2013/11/20 | [
"https://Stackoverflow.com/questions/20094023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1308160/"
] | ```
public class TestImageView extends ImageView implements OnGestureListener{
public TestImageView(Context context) {
super(context);
// TODO Auto-generated constructor stub
setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, M... | Yes you can do it. Have a class extends ImageView and implements OnGestureListener. |
65,825,843 | I have below data set obtained after group by dept and loc.
dept id loc count
100 a 2
300 c 1
I need out put like below
deptid loc
100 a
100 a
300 c
please help | 2021/01/21 | [
"https://Stackoverflow.com/questions/65825843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14253761/"
] | **Partial answer**
As far as I see you already have a column `Time_Of_Day` and a column `item`.
So, assuming a dummy dataframe with the same columns:
```
In[]: df = pd.DataFrame({'Time_Of_Day': ['breakfast', 'breakfast', 'breakfast', 'lunch', 'lunch', 'lunch'], 'item': ['coffee', 'coffee', 'bread', 'pastry', 'pastry... | First, note that the time ranges you defined do not cover the full domain. Second, here is a way to do this without reaching for `pandas` and without having to store the entire underlying data in memory. Adjust formatting of the output to taste.
```py
import heapq
import sys
sales = {}
class Sale:
@staticmethod
... |
22,907,529 | With the older version of telerik, we had a snippet of code to find the number of childnodes as given below
```
function onUploadSelect(ev) {
var numberOfFiles;
if (ev.target.childNodes[1] != undefined && ev.target.childNodes[1] != null) {
numberOfFiles = ev.target.childNodes[1].childNodes.length;
}
if ((numberOfF... | 2014/04/07 | [
"https://Stackoverflow.com/questions/22907529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/972480/"
] | You have to do POST request (or DELETE to be precise) towards server where your perl script runs.
e.g.
After you get a variable set (let's say you are using jquery):
```
$.ajax({
type: "POST",
url: url, // where your script lives
data: {'a' : a},
success: function(data) {
console.log(data);
}
dataT... | Sample scenario:
1. JS working on Your Client PC. Users selected some id.
2. JS sends selected id to server side Perl CGI script.
3. Perl parses GET request get id.
4. Perl checks if id is number not some string to hack your server.
5. Perl executes delete in MySQL.
Resourses:
JS send GET request with Param:
[HTTP GE... |
56,953,255 | I have tried to put it above the MainActivity and(i know that) it doesnt fit there; build error:"The GenerateJavaStub task failed", But I dont know how to do it
```
[Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = true)]
[Application(UsesCleartextTraffic = true)]
public class MainActivit... | 2019/07/09 | [
"https://Stackoverflow.com/questions/56953255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11674638/"
] | You can see the different kepmaps for the caret movement in the IntelliJ IDE by going to `File->Settings->Keymap`, where in the seach bar you type `Move Caret`.
[](https://i.stack.imgur.com/Tkniy.png)
In your case you can use `Ctrl+Up` to move the Ca... | In a code block, you can use "Code block start" and "Code block end" actions (Cmd-Alt-[, Cmd-Alt-] in the default Mac keymap, Ctrl-[ and Ctrl-] in the default keymap on other operating systems).
This shortcut doesn't work in the import block, but normally this is not needed because the standard way to work with impor... |
65,268,605 | I have an app, where user types his text which could contain links(by the link I mean only links started with https...). Than this input turns into a text so the user could read it. However I want links in this text work as actual links. I have only a text as a string and want all non-link text to stay as a text. If yo... | 2020/12/12 | [
"https://Stackoverflow.com/questions/65268605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13906474/"
] | It can looks like this
<https://snack.expo.io/@webspaceteam/juicy-cookie>
```
import * as React from 'react';
import {
Text,
View,
StyleSheet,
TouchableOpacity,
Linking,
} from 'react-native';
import Constants from 'expo-constants';
// You can import from local files
import AssetExample from './components/A... | Use `getSelection()` within a function that is called in an event listener. See notes info in code.
```js
const article = document.getElementById("article");
// event listener that uses mouseup on a handlerFunction
article.addEventListener('mouseup', handlerFunction, false);
// Mouse up event handler function
functi... |
19,848,826 | Migrating code from Javascript API 2 to 3. I have a list of locations which i need to plot in the form of a driving directions. This was done in v2 using the following code
```
directions = new GDirections(map);
directions.loadFromWaypoints(waypoints, {preserveViewport: true});
```
Here is my attempt at converting... | 2013/11/07 | [
"https://Stackoverflow.com/questions/19848826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2453831/"
] | One possible work around (particularly for a lightly used site) is to use multiple DirectionsService requests.
* [example 1 (addresses)](http://www.geocodezip.com/v3_directions_multipleWayPts_CustomMrkrs_busRoute.html)
* [example 2 (coordinates)](http://www.geocodezip.com/v3_directions_multipleWayPts_CustomMrkrsB.html... | Use Should need to Use array concept like these...
```
directionsService[i].route({
'origin': start,
'destination': end
'waypoints': waypts,
'travelMode': 'DRIVING'
},
... |
19,848,826 | Migrating code from Javascript API 2 to 3. I have a list of locations which i need to plot in the form of a driving directions. This was done in v2 using the following code
```
directions = new GDirections(map);
directions.loadFromWaypoints(waypoints, {preserveViewport: true});
```
Here is my attempt at converting... | 2013/11/07 | [
"https://Stackoverflow.com/questions/19848826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2453831/"
] | One possible work around (particularly for a lightly used site) is to use multiple DirectionsService requests.
* [example 1 (addresses)](http://www.geocodezip.com/v3_directions_multipleWayPts_CustomMrkrs_busRoute.html)
* [example 2 (coordinates)](http://www.geocodezip.com/v3_directions_multipleWayPts_CustomMrkrsB.html... | As others said, it's imposable to do it using Google's JavaScript API. However, Google does allow up to 23 waypoints with a server-side request. So using PHP and JavaScript, I was able to make a workaround.
What you have to do is get the "waypoint order" from the server side request and then have JavaScript give you d... |
19,848,826 | Migrating code from Javascript API 2 to 3. I have a list of locations which i need to plot in the form of a driving directions. This was done in v2 using the following code
```
directions = new GDirections(map);
directions.loadFromWaypoints(waypoints, {preserveViewport: true});
```
Here is my attempt at converting... | 2013/11/07 | [
"https://Stackoverflow.com/questions/19848826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2453831/"
] | Use Should need to Use array concept like these...
```
directionsService[i].route({
'origin': start,
'destination': end
'waypoints': waypts,
'travelMode': 'DRIVING'
},
... | As others said, it's imposable to do it using Google's JavaScript API. However, Google does allow up to 23 waypoints with a server-side request. So using PHP and JavaScript, I was able to make a workaround.
What you have to do is get the "waypoint order" from the server side request and then have JavaScript give you d... |
9,384,746 | Is there a way to realize tabs in Multimarkdown syntax?
My Goal is something like:
* Item:-----------tab------->Value
* An other item:---tab--->Value
* And one item more:--->Value
I could realize that by a [table](https://stackoverflow.com/a/4058964/641514), but this would be an overhead. I'd love it to stay a list. | 2012/02/21 | [
"https://Stackoverflow.com/questions/9384746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/641514/"
] | You can type "tab" characters wherever you like. But there is no concept of alignment outside of a table since there is no way to know whether the resulting output will be displayed in a monospace or variable-width font. And since Markdown/MultiMarkdown eat unnecessary whitespace, the extra spaces would be stripped fro... | >
> but are trying to force it into a format that wasn't designed for that purpose.
>
>
>
If you go back to typewriters the purpose of tabstops original where tables ;)
It is really a pity that elastic tabstops and .tsv text files (instead .csv with comma or semicolon as separator depending on region) are not com... |
20,600,514 | When I try to test installing my app in the Firefox OS simulator and phone I get "Download stopped" error and the application does not get installed even though the application successfully passes the Firefox validator.
See package manifest.
```
{
"name": "FriendFinder GPS",
"package_path" : "http://wormholes... | 2013/12/15 | [
"https://Stackoverflow.com/questions/20600514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3089243/"
] | Without using JavaScript, the only way I could think of doing this off the top of my head is by explicitly setting the `height` property of `.item` to a certain amount of `px`, together with `height: 100%;` on `.portfolioItem`
EDIT:
As such: <http://jsfiddle.net/3HP5A/> | exactly how it is.
```
.portfolioItem {
display: inline-block;
position: relative;
width:40%;
height:100%;
}
``` |
38,183 | I've heard claims ranging from *"higher-quality lenses only make a noticeable difference for scientific applications and super-huge prints,"* to *"even the difference between high-quality and uber-high-quality lenses can be seen with the naked eye on 6x10 prints"*
Before I sell my house so I can take amazing pictures ... | 2013/04/17 | [
"https://photo.stackexchange.com/questions/38183",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4848/"
] | Sure; this is exactly what what <http://photozone.de> does in lens reviews. The sample images aren't always exactly the same but show similar subjects, but the technical analysis is all done for each lens on the same camera (for each brand).
For example, the sample images for Pentax's [70mm DA Limited](http://www.phot... | The only relatively comprehensive comparison I know of is [The Digital Picture](http://www.the-digital-picture.com/Reviews/ISO-12233-Sample-Crops.aspx?Lens=787&Sample=0&FLI=0&API=0&LensComp=119&CameraComp=453&SampleComp=0&FLIComp=0&APIComp=1). They are limited to mostly (only?) Canon, and use only one photo, a test cha... |
38,183 | I've heard claims ranging from *"higher-quality lenses only make a noticeable difference for scientific applications and super-huge prints,"* to *"even the difference between high-quality and uber-high-quality lenses can be seen with the naked eye on 6x10 prints"*
Before I sell my house so I can take amazing pictures ... | 2013/04/17 | [
"https://photo.stackexchange.com/questions/38183",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4848/"
] | Sure; this is exactly what what <http://photozone.de> does in lens reviews. The sample images aren't always exactly the same but show similar subjects, but the technical analysis is all done for each lens on the same camera (for each brand).
For example, the sample images for Pentax's [70mm DA Limited](http://www.phot... | I'm not sure you'll find one site that compares all lenses with one realistic scene, but a few lens review sites I've found interesting in the past include
* [Ken Rockwell's Camera and Lens Reviews](http://www.kenrockwell.com/tech/reviews.htm) Has reviews of high-end Canon and Nikon lenses, and he's not afraid to tell... |
38,183 | I've heard claims ranging from *"higher-quality lenses only make a noticeable difference for scientific applications and super-huge prints,"* to *"even the difference between high-quality and uber-high-quality lenses can be seen with the naked eye on 6x10 prints"*
Before I sell my house so I can take amazing pictures ... | 2013/04/17 | [
"https://photo.stackexchange.com/questions/38183",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4848/"
] | Sometimes I think I could sit and play with [The Digital Picture](http://www.the-digital-picture.com/Reviews/ISO-12233-Sample-Crops.aspx) all day staring and lens quality comparisons, along with different camera backs. It's a highly useful site. | The only relatively comprehensive comparison I know of is [The Digital Picture](http://www.the-digital-picture.com/Reviews/ISO-12233-Sample-Crops.aspx?Lens=787&Sample=0&FLI=0&API=0&LensComp=119&CameraComp=453&SampleComp=0&FLIComp=0&APIComp=1). They are limited to mostly (only?) Canon, and use only one photo, a test cha... |
38,183 | I've heard claims ranging from *"higher-quality lenses only make a noticeable difference for scientific applications and super-huge prints,"* to *"even the difference between high-quality and uber-high-quality lenses can be seen with the naked eye on 6x10 prints"*
Before I sell my house so I can take amazing pictures ... | 2013/04/17 | [
"https://photo.stackexchange.com/questions/38183",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/4848/"
] | Sometimes I think I could sit and play with [The Digital Picture](http://www.the-digital-picture.com/Reviews/ISO-12233-Sample-Crops.aspx) all day staring and lens quality comparisons, along with different camera backs. It's a highly useful site. | I'm not sure you'll find one site that compares all lenses with one realistic scene, but a few lens review sites I've found interesting in the past include
* [Ken Rockwell's Camera and Lens Reviews](http://www.kenrockwell.com/tech/reviews.htm) Has reviews of high-end Canon and Nikon lenses, and he's not afraid to tell... |
50,036,792 | I looking for a regex that returns true if string include characters or only 5 digits or include a string for php
tried this `^\D{0,5}$`
but it's not working
for examples:
```
12345 - return true
1234455667&&&% . - true
123456 -false
1234 - true
FFGF - true
empty string - true
``` | 2018/04/26 | [
"https://Stackoverflow.com/questions/50036792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9050897/"
] | If I understood you correctly. You want `true` if any of the following is true:
* contains no more than 5 digits
* empty string
* contains at least non-digit
We can use `|` to separate these three conditions.
```
^(?:\d{0,5}|.*?\D.*)$
```
Note that the empty string case is also matched by `\d{0,5}` | PHP code ([test online](https://3v4l.org/ZQVXb)):
```
$str = '1234';
if (preg_match('~^(?(?=\d+$)\d{1,5}|.*)$~', $str)) {
// true
}
```
If you are telling digits shouldn't be 5 or more you should build paths for them. One way is using conditional construct which PCRE has a support for `(?()...)`:
```
^(?(?=\d+$... |
50,036,792 | I looking for a regex that returns true if string include characters or only 5 digits or include a string for php
tried this `^\D{0,5}$`
but it's not working
for examples:
```
12345 - return true
1234455667&&&% . - true
123456 -false
1234 - true
FFGF - true
empty string - true
``` | 2018/04/26 | [
"https://Stackoverflow.com/questions/50036792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9050897/"
] | If I understood you correctly. You want `true` if any of the following is true:
* contains no more than 5 digits
* empty string
* contains at least non-digit
We can use `|` to separate these three conditions.
```
^(?:\d{0,5}|.*?\D.*)$
```
Note that the empty string case is also matched by `\d{0,5}` | You may match a string that consists of 1 to 4 digits, or is empty, or is not all digits:
```
if (preg_match('~^(\d{1,5}|(?!\d+$).*)$~', $v)) {
return true;
}
```
See the [regex demo](https://regex101.com/r/BjJ0mk/1). Details:
* `^` - start of string
* `(` - start of a grouping construct matching...
+ `\d{1,5}... |
26,308,254 | I'm trying to write a BOOL value to a column in PFInstallation but get crashes nonstop:
```
- (IBAction)pushSwitch:(id)sender {
NSUserDefaults *pushlocationStatus = [NSUserDefaults standardUserDefaults];
if (self.pushSwitch.on) {
[pushlocationStatus setBool:YES forKey:@"pushlocationStatus"];
PFQuery *query ... | 2014/10/10 | [
"https://Stackoverflow.com/questions/26308254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2353523/"
] | Okay. For anyone else having the same issues there is a work around to writing directly to your Installation class, which i never doubted was a problem, I still haven't figured out how to query the class directly, but for now to work around an issue to writing to your Installation class is simple... just don't query it... | I believe this
```
PFQuery *query = [PFInstallation query];
[query whereKey:@"objectId" equalTo:[PFInstallation currentInstallation].objectId];
[query getFirstObjectInBackgroundWithBlock:^(PFObject *pushlocationObject, NSError *error) {
```
Can be replaced by
```
[[PFInstallation currentInstallation] fetchInBackgro... |
66,762,465 | I'm learning about scope in Python 3, and this example has me confused. Comparing behaviors of a list variable and a string variable when called inside a function:
```
foo1 = []
foo2 = ''
def f():
foo1.append(3)
global foo2
foo2 += 'c'
print('foo1-in-f:',foo1)
print('foo2-in-f:',foo2)
print('foo1-... | 2021/03/23 | [
"https://Stackoverflow.com/questions/66762465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14812551/"
] | In a Python function, all variable references are **assumed to be global** unless named locally. All new objects are **created in local scope** and there are restrictions on transferring or modifying objects to another scope.
You can do:
```
a=1
def f(): return a+1 # unnamed integer object created and returned
... | You need to know how variable scopes work in Python. Python does not require you to declare variables, but assumes that a variable assigned in the body of a function is local. You can see this reflected by the compiler in the generated bytecode:
```py
foo1 = []
foo2 = ''
def f():
foo1.append(3)
foo2 += 'c'
fr... |
15,376 | I suspect that my site is penalized by Google.
Is there a way to check if it's true?
EDIT:
Webmaster Tools don't show any messages. Sometimes there are warnings about inaccessible (404, Soft 404s) pages on the site that come and go, and couple of warnings about duplicate page titles (in online documentation for my so... | 2011/06/15 | [
"https://webmasters.stackexchange.com/questions/15376",
"https://webmasters.stackexchange.com",
"https://webmasters.stackexchange.com/users/2545/"
] | Google will contact webmasters through their [Webmasters Tools](https://www.google.com/webmasters/tools/home?hl=en) page to let them know there is an issue with their site. If you don't already have an account sign up for one and see if a message is there for you. | Ok, I did read some other sites and I think I got the answer for my question.
If someone else is interested, following links have helped me:
* [How to Handle a Google Penalty](http://moz.com/blog/how-to-handle-a-google-penalty-and-an-example-from-the-field-of-real-estate) (contains good flowchart)
* [10 Ways to Diagn... |
65,927,153 | I want to exclude values when calculating the mean with apply(x,1,mean):
```
#Example data:
df <- data.frame(A1 = c(0,1,2,3,4,2,NA,5,6),
A2 = c(5,0,0,4,NA,5,3,2,1),
A3 = c(0,0,1,2,4,5,3,4,3),
B1 = c(9,9,9,9,9,9,9,9,9))
#I am using grep, because I need to use speci... | 2021/01/27 | [
"https://Stackoverflow.com/questions/65927153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11139903/"
] | Use a lamdba function and then it would be easier
```
aind <- grep("A", names(df))
apply(df[aind], 1, function(x) mean(x[x !=0], na.rm = TRUE))
```
---
Or use the vectorized `rowMeans` after `replace`ing the 0 to `NA` which would be faster
```
rowMeans(replace(df[aind], df[aind] == 0, NA), na.rm = TRUE)
```
If w... | Try this:
```r
df[df == 0] <- NA
```
and then your code:
```r
df$MEANA <- apply(df[,grep("A", colnames(df))],1,mean, na.rm = TRUE)
``` |
65,927,153 | I want to exclude values when calculating the mean with apply(x,1,mean):
```
#Example data:
df <- data.frame(A1 = c(0,1,2,3,4,2,NA,5,6),
A2 = c(5,0,0,4,NA,5,3,2,1),
A3 = c(0,0,1,2,4,5,3,4,3),
B1 = c(9,9,9,9,9,9,9,9,9))
#I am using grep, because I need to use speci... | 2021/01/27 | [
"https://Stackoverflow.com/questions/65927153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11139903/"
] | Use a lamdba function and then it would be easier
```
aind <- grep("A", names(df))
apply(df[aind], 1, function(x) mean(x[x !=0], na.rm = TRUE))
```
---
Or use the vectorized `rowMeans` after `replace`ing the 0 to `NA` which would be faster
```
rowMeans(replace(df[aind], df[aind] == 0, NA), na.rm = TRUE)
```
If w... | ```
library(dplyr)
df %>%
rowwise() %>%
mutate(MeanA = c_across(starts_with('A')) %>% na_if(0) %>% mean(na.rm = TRUE))
# # A tibble: 9 x 5
# # Rowwise:
# A1 A2 A3 B1 MeanA
# <dbl> <dbl> <dbl> <dbl> <dbl>
# 1 0 5 0 9 5
# 2 1 0 0 9 1
# 3 2 0 1 ... |
46,942,713 | I created a logo in `Adobe Illustrator`, exported it as `SVG` and imported it to Android Studio through `Asset Studio`.
When the vector is painted big, it is resized correctly (image 1), but when it's small (image 2), something goes wrong.
[](https://i.stack.imgur.c... | 2017/10/25 | [
"https://Stackoverflow.com/questions/46942713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7373404/"
] | After researching the [Loopback MySQL docs](https://loopback.io/doc/en/lb2/MySQL-connector.html) I have found out that you can use additional parameters supported by node-mysql, that's located [here](https://github.com/mysqljs/mysql).
At the Connection options I found `socketPath`. So that's actually the parameter for... | This is my working datasource mysql setup:
```
"voipnow": { //should equal the name param
"host": "localhost",
"port": 3306,
"database": "databasename",
"username": "root",
"password": "root",
"name": "voipnow",
"connector": "mysql",
"namingStrategy": "underscore"
},
```
The `name` ... |
193,747 | Came across an Adafruit interview with the one and only Paul Horowitz and he said something interesting. [Part of interview thats related to this question](https://youtu.be/iCI3B5eT9NA?t=26m45s)
He said in more or less words that the capacitance of a line disappears when the cable is terminated.
Why does adding resi... | 2015/10/06 | [
"https://electronics.stackexchange.com/questions/193747",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9409/"
] | It depends what you mean by 'capacitance'. If you mean two conductors separated by dielectric, then of course it doesn't.
However, if you mean 'behaves like capacitor', then yes it does.
a) If you take (for instance) a high value resistor from a power supply, and connect it to a capacitor, then the voltage will start... | The [distributed] capacitance is said to disappear in the sense that there are no standing waves when a transmission line is terminated in a resistor that equals the characteristic impedance of the line. In that case, V and I along the line look like in the 1st (or 2nd) graph[s] below, i.e. they are always in phase. Th... |
193,747 | Came across an Adafruit interview with the one and only Paul Horowitz and he said something interesting. [Part of interview thats related to this question](https://youtu.be/iCI3B5eT9NA?t=26m45s)
He said in more or less words that the capacitance of a line disappears when the cable is terminated.
Why does adding resi... | 2015/10/06 | [
"https://electronics.stackexchange.com/questions/193747",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9409/"
] | It depends what you mean by 'capacitance'. If you mean two conductors separated by dielectric, then of course it doesn't.
However, if you mean 'behaves like capacitor', then yes it does.
a) If you take (for instance) a high value resistor from a power supply, and connect it to a capacitor, then the voltage will start... | Yes, a line becomes resistive when properly terminated provided the operating frequency is above ~1 MHz and below a few GHz.
In truth it is the inductance and capacitance that together look like a near-perfect, real ohmic resistor when the line is terminated. It's fairly simple to prove from the equation of character... |
193,747 | Came across an Adafruit interview with the one and only Paul Horowitz and he said something interesting. [Part of interview thats related to this question](https://youtu.be/iCI3B5eT9NA?t=26m45s)
He said in more or less words that the capacitance of a line disappears when the cable is terminated.
Why does adding resi... | 2015/10/06 | [
"https://electronics.stackexchange.com/questions/193747",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/9409/"
] | Yes, a line becomes resistive when properly terminated provided the operating frequency is above ~1 MHz and below a few GHz.
In truth it is the inductance and capacitance that together look like a near-perfect, real ohmic resistor when the line is terminated. It's fairly simple to prove from the equation of character... | The [distributed] capacitance is said to disappear in the sense that there are no standing waves when a transmission line is terminated in a resistor that equals the characteristic impedance of the line. In that case, V and I along the line look like in the 1st (or 2nd) graph[s] below, i.e. they are always in phase. Th... |
17,678,913 | I haven't done C++ in at least 7 years and am suddenly knee deep in a C++ project. I would like some guidance with the following:
I have a class called Animal, and I have 3 classes that inherit from Animal: Cat, Dog and Bird. I have created a list object and am using it to store type Animal.
This list can contain Cat... | 2013/07/16 | [
"https://Stackoverflow.com/questions/17678913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030185/"
] | You almost certainly don't want to know. What you should do is declare as virtual appropriate methods to interact with these animals.
If you need to operate on them specifically, you can either use the visitor pattern to pass a visitor object or function the right data in each concrete class. If you insist on having t... | ```
Dog* dog = dynamic_cast<Dog*>(myAnimalPointer);
if (dog == NULL)
{
// This animal is not a dog.
}
``` |
17,678,913 | I haven't done C++ in at least 7 years and am suddenly knee deep in a C++ project. I would like some guidance with the following:
I have a class called Animal, and I have 3 classes that inherit from Animal: Cat, Dog and Bird. I have created a list object and am using it to store type Animal.
This list can contain Cat... | 2013/07/16 | [
"https://Stackoverflow.com/questions/17678913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030185/"
] | You almost certainly don't want to know. What you should do is declare as virtual appropriate methods to interact with these animals.
If you need to operate on them specifically, you can either use the visitor pattern to pass a visitor object or function the right data in each concrete class. If you insist on having t... | Implement a function name() in each subclass. |
17,678,913 | I haven't done C++ in at least 7 years and am suddenly knee deep in a C++ project. I would like some guidance with the following:
I have a class called Animal, and I have 3 classes that inherit from Animal: Cat, Dog and Bird. I have created a list object and am using it to store type Animal.
This list can contain Cat... | 2013/07/16 | [
"https://Stackoverflow.com/questions/17678913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030185/"
] | Depending on the concrete code `typeid` returns different things. Additionally `name()` can return anything (including making the first letter uppercase or removing \*), it is only for debuging. Now I have a few different posible answers what `typeid(animal).name()` can return.
Version 1 `animal` is a class name:
```... | Implement a function name() in each subclass. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.