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
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
As I see it, closing a question **strictly** because the asker admits (or implies) the use of an illegal copy, is a misuse of close votes. There are two major problems that arise from this, "Piracy == Close" policy. The first has been demonstrated by Sterno, who re-asked the question that sparked this whole debate. I...
One of the founding principles of the network is to focus not on people, but on information. It's why we disallow discussion, why votes are focused on posts and not people, and a host of other components we have enabled to improve the quality of our Q&A above all. A great question asked for stupid reasons (though this ...
7,546
![enter image description here](https://i.stack.imgur.com/z3v19.jpg) There's been a lot of talk recently about what it means to support piracy and pirated games. A very recent example is [this question](https://gaming.stackexchange.com/questions/127918/why-cant-i-harvest-blood-for-discerning-the-transmundane), in whic...
2013/08/19
[ "https://gaming.meta.stackexchange.com/questions/7546", "https://gaming.meta.stackexchange.com", "https://gaming.meta.stackexchange.com/users/3062/" ]
As I see it, closing a question **strictly** because the asker admits (or implies) the use of an illegal copy, is a misuse of close votes. There are two major problems that arise from this, "Piracy == Close" policy. The first has been demonstrated by Sterno, who re-asked the question that sparked this whole debate. I...
In general, the pirated version of a game really is a different game from the "public" one. * The public version gets updates, the pirated usually doesn't. * The public version integrates with Steam, Origin and pals, the pirated thinks it does but it doesn't. * The public version passes any internal anti-piracy checks...
64,141
I have an app that has tiny tiny writing that I need to read and I can't take a hundred screenshots to zoom in to read each one and the developer has yet to fix it but I was wondering if there was a way to have a magnifying thingy on top of this app and move it around the screen to enlarge whatever I can't read in real...
2014/02/23
[ "https://android.stackexchange.com/questions/64141", "https://android.stackexchange.com", "https://android.stackexchange.com/users/32491/" ]
If your Android version is 4.1 (Jelly Bean) or greater, you can find magnification gestures under your system settings. 1. Go to *Settings* 2. *Accessibility* 3. *Magnification Gestures* Info: * [Magnification Gestures](http://www.abilitynet.org.uk/mcmw/magnification-gestures-android-jelly-bean-4-2-2/) * [Usage](ht...
It may/may not solve OP's problem depending on the OP's resources, but it could be helpful for the other android users for other alternatives. You could record the screen of your mobile using a screen recording app and view it on a large computer/tv screen to view the text clearly. Alternatively, you could also use an...
24,094,256
I wanna know if php can remotely store when the user is logged in such as date and ipaddress, maybe use "COOKIES" or a database, I don't know and I'm not sure. Btw, my question means that if last time I logged on was "4/5/2014 from 108.25.1.123" it would echo * **Last Login: 4/5/2014 from 108.25.1.123** *ignore the...
2014/06/07
[ "https://Stackoverflow.com/questions/24094256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3672268/" ]
[`String#gsub`](http://ruby-doc.org/core/String.html#method-i-gsub) accepts an optional block: return value of the block is used as replacement string: ``` melody.gsub(/[CDFGA]#/) { |x| x[0].downcase } # => "f g a B |a g f |a B c d |c B a |f f |f f |ffggaaBB|a g f " ```
You can use hash too. ``` melody.gsub(/[CDFGA]#/, {'C#' => 'c', 'D#' => 'd', 'F#' => 'f', 'G#' => 'g', 'A#' => 'a'}) ```
4,248,162
With additional parameters that: \begin{align} \ r^2 &= x\_j x\_j \\ \end{align} and \begin{align} \ \frac{\partial x\_i}{\partial x\_j} = \delta\_{ij}\\ \end{align} So, what I managed to figure so far is that: \begin{align} \nabla ^2 r^n &= \nabla \cdot (\nabla r^n ) \\ &=\nabla \cdot (nr^{n-1} \frac{\partial r}{\pa...
2021/09/12
[ "https://math.stackexchange.com/questions/4248162", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
In your solution, I believe you should have written: $$P(r) = (r-1)Q(r) + k$$ With that adjustment, the solution works perfectly. To generalize, you could try to show: $$(x-y) \mid (P(x)-P(y))$$ (To do this, you could start out by showing it for $P(x)=x^n$, and then generalize it to all polynomials). Once you do this, ...
Suppose $P(n)=0$ for some integer $n$. Then $x-n$ is a factor of $P(x)$, and we can write $$P(x)=(x-n)Q(x)$$ for some polynomial $Q(x)$ with integer coefficients. Putting $x=0$ gives $$-nQ(0)=P(0)$$ so $n$ must be odd because $P(0)$ is odd. And putting $x=1$ gives $$(1-n)Q(1)=P(1)$$ so $n-1$ must be odd because $P(1)$ ...
41,420
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier. I am getting a "404 Not Found Error The resource requested could not be found on this server!" getting this on every page except `index.php` and also not able to login into the admin panel. I already cle...
2014/10/26
[ "https://magento.stackexchange.com/questions/41420", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/15652/" ]
It sounds like a behavior which can happen if you do not have the ".htaccess" file by Magento or if the ".htaccess" file is messed up. Please try adding or replacing the current file with the default ".htaccess" file from Magento.
This most likely is a file ownership issue. You probably upload the Magento files as another user and the web server user can't access the files. You have to change ownership so the webserver user owns the files. First, you need to find out what user your webserver runs under. If your running Ubuntu, it's usually www...
41,420
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier. I am getting a "404 Not Found Error The resource requested could not be found on this server!" getting this on every page except `index.php` and also not able to login into the admin panel. I already cle...
2014/10/26
[ "https://magento.stackexchange.com/questions/41420", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/15652/" ]
This most likely is a file ownership issue. You probably upload the Magento files as another user and the web server user can't access the files. You have to change ownership so the webserver user owns the files. First, you need to find out what user your webserver runs under. If your running Ubuntu, it's usually www...
Thanks after spending hours looking for a permission or apache issue, the simple fact that copying magento files from a Nautilus window into apache www is not correct. There is a "hidden" `.htaccess` file that you cannot see. So either do a manual copy of the `.htaccess` file or extract directly into the `www/html/mag...
41,420
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier. I am getting a "404 Not Found Error The resource requested could not be found on this server!" getting this on every page except `index.php` and also not able to login into the admin panel. I already cle...
2014/10/26
[ "https://magento.stackexchange.com/questions/41420", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/15652/" ]
It sounds like a behavior which can happen if you do not have the ".htaccess" file by Magento or if the ".htaccess" file is messed up. Please try adding or replacing the current file with the default ".htaccess" file from Magento.
For the temporary solution I would suggest you the following step to perform 1. Go to **System ->Configuration** 2. On left hand side select **General -> Web** and under that you will find the **Search Engines Optimization** tab Use Web Server Rewrites => No I think your server does not having rewrite\_module enable...
41,420
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier. I am getting a "404 Not Found Error The resource requested could not be found on this server!" getting this on every page except `index.php` and also not able to login into the admin panel. I already cle...
2014/10/26
[ "https://magento.stackexchange.com/questions/41420", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/15652/" ]
For the temporary solution I would suggest you the following step to perform 1. Go to **System ->Configuration** 2. On left hand side select **General -> Web** and under that you will find the **Search Engines Optimization** tab Use Web Server Rewrites => No I think your server does not having rewrite\_module enable...
Thanks after spending hours looking for a permission or apache issue, the simple fact that copying magento files from a Nautilus window into apache www is not correct. There is a "hidden" `.htaccess` file that you cannot see. So either do a manual copy of the `.htaccess` file or extract directly into the `www/html/mag...
41,420
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier. I am getting a "404 Not Found Error The resource requested could not be found on this server!" getting this on every page except `index.php` and also not able to login into the admin panel. I already cle...
2014/10/26
[ "https://magento.stackexchange.com/questions/41420", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/15652/" ]
It sounds like a behavior which can happen if you do not have the ".htaccess" file by Magento or if the ".htaccess" file is messed up. Please try adding or replacing the current file with the default ".htaccess" file from Magento.
Thanks after spending hours looking for a permission or apache issue, the simple fact that copying magento files from a Nautilus window into apache www is not correct. There is a "hidden" `.htaccess` file that you cannot see. So either do a manual copy of the `.htaccess` file or extract directly into the `www/html/mag...
41,420
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier. I am getting a "404 Not Found Error The resource requested could not be found on this server!" getting this on every page except `index.php` and also not able to login into the admin panel. I already cle...
2014/10/26
[ "https://magento.stackexchange.com/questions/41420", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/15652/" ]
It sounds like a behavior which can happen if you do not have the ".htaccess" file by Magento or if the ".htaccess" file is messed up. Please try adding or replacing the current file with the default ".htaccess" file from Magento.
the solution for 404 errors on magento 1.9 was to 1-reindex data and 2-flush cache storage
41,420
Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier. I am getting a "404 Not Found Error The resource requested could not be found on this server!" getting this on every page except `index.php` and also not able to login into the admin panel. I already cle...
2014/10/26
[ "https://magento.stackexchange.com/questions/41420", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/15652/" ]
the solution for 404 errors on magento 1.9 was to 1-reindex data and 2-flush cache storage
Thanks after spending hours looking for a permission or apache issue, the simple fact that copying magento files from a Nautilus window into apache www is not correct. There is a "hidden" `.htaccess` file that you cannot see. So either do a manual copy of the `.htaccess` file or extract directly into the `www/html/mag...
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
The rule that you quote is only valid if a is a constant.
The rule that you have given is for $\textit{constant}$ $a$, while the base of your function is a $\textit{function}$. So the rule does not apply here. To fix this, let $f(x) = (x^2 + 1)^{\sin(x)}$ and consider $\ln(f(x))$. Differentiate the new function, while also utilizing a nice property of exponents inside logar...
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
The rule that you quote is only valid if a is a constant.
Start with $$f(x)=e^{\ln(x^2+1)\sin(x)}$$ The chain rule gives $$f'(x)=e^{\ln(x^2+1)\sin(x)}\times (\ln(x^2+1)\sin(x))'=(x^2+1)^{\sin(x)}(\ln(x^2+1)\sin(x))'$$ Take it from here.
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
I will assume that this is not homework and go ahead to give a full solution. As others have said, your rule only works for constant $a$. Following the hint in danielson's answer and setting $y=f(x)$, you have $$\log y=\sin x\log\left(1+x^2\right)$$ and differentiating both sides with respect to $x$ and using the chai...
The rule that you quote is only valid if a is a constant.
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
The rule that you quote is only valid if a is a constant.
The rule is $$\frac d{dx}u(x)^{v(x)}=v(x)u(x)^{v(x)-1}\frac{du}{dx}+u(x)^{v(x)}(\ln u(x))\frac{dv}{dx}.$$ You can derive this by the method of [logarithmic differentiation](https://en.wikipedia.org/wiki/Logarithmic_differentiation#Composite_exponent). It is a special case of the two-variable chain rule: $$\frac{dw}{dx}...
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
I will assume that this is not homework and go ahead to give a full solution. As others have said, your rule only works for constant $a$. Following the hint in danielson's answer and setting $y=f(x)$, you have $$\log y=\sin x\log\left(1+x^2\right)$$ and differentiating both sides with respect to $x$ and using the chai...
The rule that you have given is for $\textit{constant}$ $a$, while the base of your function is a $\textit{function}$. So the rule does not apply here. To fix this, let $f(x) = (x^2 + 1)^{\sin(x)}$ and consider $\ln(f(x))$. Differentiate the new function, while also utilizing a nice property of exponents inside logar...
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
The rule that you have given is for $\textit{constant}$ $a$, while the base of your function is a $\textit{function}$. So the rule does not apply here. To fix this, let $f(x) = (x^2 + 1)^{\sin(x)}$ and consider $\ln(f(x))$. Differentiate the new function, while also utilizing a nice property of exponents inside logar...
The rule is $$\frac d{dx}u(x)^{v(x)}=v(x)u(x)^{v(x)-1}\frac{du}{dx}+u(x)^{v(x)}(\ln u(x))\frac{dv}{dx}.$$ You can derive this by the method of [logarithmic differentiation](https://en.wikipedia.org/wiki/Logarithmic_differentiation#Composite_exponent). It is a special case of the two-variable chain rule: $$\frac{dw}{dx}...
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
I will assume that this is not homework and go ahead to give a full solution. As others have said, your rule only works for constant $a$. Following the hint in danielson's answer and setting $y=f(x)$, you have $$\log y=\sin x\log\left(1+x^2\right)$$ and differentiating both sides with respect to $x$ and using the chai...
Start with $$f(x)=e^{\ln(x^2+1)\sin(x)}$$ The chain rule gives $$f'(x)=e^{\ln(x^2+1)\sin(x)}\times (\ln(x^2+1)\sin(x))'=(x^2+1)^{\sin(x)}(\ln(x^2+1)\sin(x))'$$ Take it from here.
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
Start with $$f(x)=e^{\ln(x^2+1)\sin(x)}$$ The chain rule gives $$f'(x)=e^{\ln(x^2+1)\sin(x)}\times (\ln(x^2+1)\sin(x))'=(x^2+1)^{\sin(x)}(\ln(x^2+1)\sin(x))'$$ Take it from here.
The rule is $$\frac d{dx}u(x)^{v(x)}=v(x)u(x)^{v(x)-1}\frac{du}{dx}+u(x)^{v(x)}(\ln u(x))\frac{dv}{dx}.$$ You can derive this by the method of [logarithmic differentiation](https://en.wikipedia.org/wiki/Logarithmic_differentiation#Composite_exponent). It is a special case of the two-variable chain rule: $$\frac{dw}{dx}...
1,546,379
We all know this rule: > > $\text{If } y = a^{f(x)} \text{ then } y' = a^{f(x)} \: f'(x)\ln a$ > > > In my book there is the example: Find $\frac{d}{dx}\left((x^{2} + 1)^{\sin x}\right)$ According to the rule, my answer is: $(x^{2} + 1)^{\sin x} \cdot \cos x \cdot \ln(x^{2} + 1)$ But the answer of the book wa...
2015/11/25
[ "https://math.stackexchange.com/questions/1546379", "https://math.stackexchange.com", "https://math.stackexchange.com/users/283145/" ]
I will assume that this is not homework and go ahead to give a full solution. As others have said, your rule only works for constant $a$. Following the hint in danielson's answer and setting $y=f(x)$, you have $$\log y=\sin x\log\left(1+x^2\right)$$ and differentiating both sides with respect to $x$ and using the chai...
The rule is $$\frac d{dx}u(x)^{v(x)}=v(x)u(x)^{v(x)-1}\frac{du}{dx}+u(x)^{v(x)}(\ln u(x))\frac{dv}{dx}.$$ You can derive this by the method of [logarithmic differentiation](https://en.wikipedia.org/wiki/Logarithmic_differentiation#Composite_exponent). It is a special case of the two-variable chain rule: $$\frac{dw}{dx}...
6,256,222
I'm using eclipse and it keeps putting out the error message > > txt cannot be resolved or is not a field > > > And I have this xml ``` <EditText android:id="@+id/txt" android:layout_width="fill_parent" android:layout_height="wrap_content" /> ``` I have this in the java file ``` setCont...
2011/06/06
[ "https://Stackoverflow.com/questions/6256222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614460/" ]
Try cleaning and rebuilding your project; sometimes the builder just gets confused.
As @Ted Hopp suggested, try cleaning you project and rebuild. If it doesn't help, check the Problems view to see what Eclipse doesn't like and hence failed to compile your resources. R.java doesn't get rebuilt even with only one issue with one of your resources. I had encountered this exact problem before, and it took ...
6,256,222
I'm using eclipse and it keeps putting out the error message > > txt cannot be resolved or is not a field > > > And I have this xml ``` <EditText android:id="@+id/txt" android:layout_width="fill_parent" android:layout_height="wrap_content" /> ``` I have this in the java file ``` setCont...
2011/06/06
[ "https://Stackoverflow.com/questions/6256222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614460/" ]
Try cleaning and rebuilding your project; sometimes the builder just gets confused.
Well Hello all, i was having a similar issue. I fixed it by saving the XML file!! and then pressing ctrl+space bar and it showed everything Regards Jawad Hussain
6,256,222
I'm using eclipse and it keeps putting out the error message > > txt cannot be resolved or is not a field > > > And I have this xml ``` <EditText android:id="@+id/txt" android:layout_width="fill_parent" android:layout_height="wrap_content" /> ``` I have this in the java file ``` setCont...
2011/06/06
[ "https://Stackoverflow.com/questions/6256222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614460/" ]
As @Ted Hopp suggested, try cleaning you project and rebuild. If it doesn't help, check the Problems view to see what Eclipse doesn't like and hence failed to compile your resources. R.java doesn't get rebuilt even with only one issue with one of your resources. I had encountered this exact problem before, and it took ...
Well Hello all, i was having a similar issue. I fixed it by saving the XML file!! and then pressing ctrl+space bar and it showed everything Regards Jawad Hussain
29,760,186
I am testing my rails application using RSpec, and am testing the controller. Specifically, I am trying to render my `jobs.json.jbuilder` view file. **My Controller** ``` class CustomersController < ApplicationController before_action :authenticate_member! before_action :set_customer def jobs @jobs = @custom...
2015/04/20
[ "https://Stackoverflow.com/questions/29760186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4459026/" ]
Fixed the problem by using this syntax: ``` describe "GET job" do it 'renders the jobs view' do get 'jobs', { id: @customer.id, format: :json } expect(response).to render_template("customers/jobs") end end ```
It's a very late answer, but, for those who are still coming to this question... For rendering `json.jbuilder` by default you should put it on routes.rb in this case... ```rb resources :costumers, defaults: { format: :json }, only: [...] do get 'job', to: 'costumers#job' end ```
29,760,186
I am testing my rails application using RSpec, and am testing the controller. Specifically, I am trying to render my `jobs.json.jbuilder` view file. **My Controller** ``` class CustomersController < ApplicationController before_action :authenticate_member! before_action :set_customer def jobs @jobs = @custom...
2015/04/20
[ "https://Stackoverflow.com/questions/29760186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4459026/" ]
Fixed the problem by using this syntax: ``` describe "GET job" do it 'renders the jobs view' do get 'jobs', { id: @customer.id, format: :json } expect(response).to render_template("customers/jobs") end end ```
worth noting that adding ``` config.render_views = true ``` to the RSpec.configure in the rails\_helper is also needed as per [stackoverflow answer](https://stackoverflow.com/questions/58741194/rails-json-jbuilder-api-with-rspec-actionviewmissingtemplate)
65,501,094
Im trying to create a ling of the special character "=" Output I want ``` Name==================== Horace Horsecollar 56.00 12.50 700.00 210.00 10 480.00 Eleven Thirty 34.00 12.50 425.00 127.50 10 287.50 Victoria Elven 34.00 12.50 425.00 127.50 10 287.50 ``` but the output here is f...
2020/12/30
[ "https://Stackoverflow.com/questions/65501094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10485812/" ]
You can use this regex: ``` @"(?<=_)\d+(?=\.\w+)|(?<!_\d+)(?=\.\w+)" ``` **Explanation**: `(?<=_)` look behind for an underscore `\d+` match one or more digits `(?=\.\w+)` look ahead for a dot followed by one more word characters (the extension) `|` OR `(?<!_\d+)` look behind for NOT an underscore followed by o...
Use ```cs (?<![^\W_])\d+(?=\.\w+$) ``` See [proof](https://regex101.com/r/VzYnZG/1) **Explanation** ``` -------------------------------------------------------------------------------- (?<! look behind to see if there is not: -------------------------------------------------------------------...
65,501,094
Im trying to create a ling of the special character "=" Output I want ``` Name==================== Horace Horsecollar 56.00 12.50 700.00 210.00 10 480.00 Eleven Thirty 34.00 12.50 425.00 127.50 10 287.50 Victoria Elven 34.00 12.50 425.00 127.50 10 287.50 ``` but the output here is f...
2020/12/30
[ "https://Stackoverflow.com/questions/65501094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10485812/" ]
You can use this regex: ``` @"(?<=_)\d+(?=\.\w+)|(?<!_\d+)(?=\.\w+)" ``` **Explanation**: `(?<=_)` look behind for an underscore `\d+` match one or more digits `(?=\.\w+)` look ahead for a dot followed by one more word characters (the extension) `|` OR `(?<!_\d+)` look behind for NOT an underscore followed by o...
if using .NET why not just use the Regex \d+ and do regex.Matches(..).LastOrDefault();
65,501,094
Im trying to create a ling of the special character "=" Output I want ``` Name==================== Horace Horsecollar 56.00 12.50 700.00 210.00 10 480.00 Eleven Thirty 34.00 12.50 425.00 127.50 10 287.50 Victoria Elven 34.00 12.50 425.00 127.50 10 287.50 ``` but the output here is f...
2020/12/30
[ "https://Stackoverflow.com/questions/65501094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10485812/" ]
Another option is to use a single set of positive lookarounds ``` (?<=_[^\W\d_]\d+_?)\d*(?=\.\w+$) ``` **Explanation** * `(?<=` Positive lookbehind, assert what is directly to the left is + `_[^\W\d_]\d+_?` Match `_`, a word char except digits or \_ and 1+ digits followed by an optional `_` * `)` Close lookbehind ...
Use ```cs (?<![^\W_])\d+(?=\.\w+$) ``` See [proof](https://regex101.com/r/VzYnZG/1) **Explanation** ``` -------------------------------------------------------------------------------- (?<! look behind to see if there is not: -------------------------------------------------------------------...
65,501,094
Im trying to create a ling of the special character "=" Output I want ``` Name==================== Horace Horsecollar 56.00 12.50 700.00 210.00 10 480.00 Eleven Thirty 34.00 12.50 425.00 127.50 10 287.50 Victoria Elven 34.00 12.50 425.00 127.50 10 287.50 ``` but the output here is f...
2020/12/30
[ "https://Stackoverflow.com/questions/65501094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10485812/" ]
Another option is to use a single set of positive lookarounds ``` (?<=_[^\W\d_]\d+_?)\d*(?=\.\w+$) ``` **Explanation** * `(?<=` Positive lookbehind, assert what is directly to the left is + `_[^\W\d_]\d+_?` Match `_`, a word char except digits or \_ and 1+ digits followed by an optional `_` * `)` Close lookbehind ...
if using .NET why not just use the Regex \d+ and do regex.Matches(..).LastOrDefault();
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
you can do it by loop also. compare the array elements and json object name and than increase the total of that corresponding json object. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Ban...
1. Create a `Map` out of `newlst` whose keys represent they **fruit name** and values represent the **fruit count**. 2. Loop over `lst` and check if the current fruit is in the `Map` then increment count otherwise leave as is. ```js let lst = [{ name: "Apple", total: 4 }, { name: "Mango", total: 9 }, { name: "Orange",...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
You can loop through the *lst* and update the *total* by counting the fruits in the *newlst* using `filter()` ```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pinea...
1. Create a `Map` out of `newlst` whose keys represent they **fruit name** and values represent the **fruit count**. 2. Loop over `lst` and check if the current fruit is in the `Map` then increment count otherwise leave as is. ```js let lst = [{ name: "Apple", total: 4 }, { name: "Mango", total: 9 }, { name: "Orange",...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
you can do it by loop also. compare the array elements and json object name and than increase the total of that corresponding json object. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Ban...
You can use `Map` to create a keyValue pair and update all the existing values in an efficient way. ```js Const dict = new Map() lst.forEach(item => dict.set(item.name, item)) ``` When you receive the new array ```js newlst.forEach(item => { if(!dict.has(item)) { // true if you receive a new element not present ...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
You can loop through the *lst* and update the *total* by counting the fruits in the *newlst* using `filter()` ```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pinea...
We can `map` through the `list` and filter out items in the `newList` based on the item being mapped in the `list`. The length of the filter output will give us the number of occurrences of the item in the `newList` and based on that we can derive the `total` logic. ```js const list = [{name: 'Apple', total: 4}, {name...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
You can loop through the *lst* and update the *total* by counting the fruits in the *newlst* using `filter()` ```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pinea...
```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 }, { name: 'test', total: 1 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pineapple","Passion"]; lst.map(el=>{ newlst.indexOf(el.name)>-1 ? el.total=el.total...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
You can loop through the *lst* and update the *total* by counting the fruits in the *newlst* using `filter()` ```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pinea...
Why do you use `let` instead of `const`? you shouldn't You could do it like this ``` lst.map(({ name, total }) => ({ name, total: total + newlst.filter((x) => x === name).length })) ``` ```js const lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passio...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
you can do it by loop also. compare the array elements and json object name and than increase the total of that corresponding json object. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Ban...
```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 }, { name: 'test', total: 1 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pineapple","Passion"]; lst.map(el=>{ newlst.indexOf(el.name)>-1 ? el.total=el.total...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
you can do it by loop also. compare the array elements and json object name and than increase the total of that corresponding json object. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Ban...
Why do you use `let` instead of `const`? you shouldn't You could do it like this ``` lst.map(({ name, total }) => ({ name, total: total + newlst.filter((x) => x === name).length })) ``` ```js const lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passio...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
You can loop through the *lst* and update the *total* by counting the fruits in the *newlst* using `filter()` ```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pinea...
You can use `Map` to create a keyValue pair and update all the existing values in an efficient way. ```js Const dict = new Map() lst.forEach(item => dict.set(item.name, item)) ``` When you receive the new array ```js newlst.forEach(item => { if(!dict.has(item)) { // true if you receive a new element not present ...
67,042,385
I have this lst, which has the name and total available. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ] ``` Now there is a new list json which I receive from an api, that only has names of the items, I changed to an arra...
2021/04/11
[ "https://Stackoverflow.com/questions/67042385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15233070/" ]
you can do it by loop also. compare the array elements and json object name and than increase the total of that corresponding json object. ``` let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Ban...
You can loop through the *lst* and update the *total* by counting the fruits in the *newlst* using `filter()` ```js let lst = [ { name: 'Apple', total: 4 }, { name: 'Mango', total: 9 }, { name: 'Orange', total: 6 }, { name: 'Passion', total: 2 } ]; let newlst = ["Apple","Orange","Banana","Mango","Apple","Pinea...
39,115,249
I know double should not be compared by == operator directly, but how about if I define an initial value as 0.0?eg: ``` double a=0.0; double b= . . . ``` If a is not modified, does a\*b==0 always true?
2016/08/24
[ "https://Stackoverflow.com/questions/39115249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5263291/" ]
``` if (!inputGuardian1.getText().toString().matches("")){ Log.i("Putting text", "in sp"); if(sharedPreferences != null){ sharedPreferences.edit().putString("Guardian 1", guardian1).apply(); Log.i("Putting text", "passed"); }else{ sharedPreferences = ...
After all the editings, you need to call this, editor.commit(); please go to this website <http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/>
39,115,249
I know double should not be compared by == operator directly, but how about if I define an initial value as 0.0?eg: ``` double a=0.0; double b= . . . ``` If a is not modified, does a\*b==0 always true?
2016/08/24
[ "https://Stackoverflow.com/questions/39115249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5263291/" ]
``` if (!inputGuardian1.getText().toString().matches("")){ Log.i("Putting text", "in sp"); if(sharedPreferences != null){ sharedPreferences.edit().putString("Guardian 1", guardian1).apply(); Log.i("Putting text", "passed"); }else{ sharedPreferences = ...
Because you have to do sharedPreferences like this: ``` SharedPreferences sharedPref = getSharedPreferences( getString(R.string.preference_file_key), Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPref.edit(); ``` and then `editor.putString(`... and then `editor.apply()`
39,115,249
I know double should not be compared by == operator directly, but how about if I define an initial value as 0.0?eg: ``` double a=0.0; double b= . . . ``` If a is not modified, does a\*b==0 always true?
2016/08/24
[ "https://Stackoverflow.com/questions/39115249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5263291/" ]
``` if (!inputGuardian1.getText().toString().matches("")){ Log.i("Putting text", "in sp"); if(sharedPreferences != null){ sharedPreferences.edit().putString("Guardian 1", guardian1).apply(); Log.i("Putting text", "passed"); }else{ sharedPreferences = ...
Your `SharedPreferences` object is not initialised, so please initialise it like if you are doing in activity then do like this ``` SharedPreferences.Editor editor = getSharedPreferences("YouKeyName", MODE_PRIVATE).edit(); editor.putString("Guardian 1", "Hi"); editor.commit(); ``` if you are doing in Fragment then...
39,115,249
I know double should not be compared by == operator directly, but how about if I define an initial value as 0.0?eg: ``` double a=0.0; double b= . . . ``` If a is not modified, does a\*b==0 always true?
2016/08/24
[ "https://Stackoverflow.com/questions/39115249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5263291/" ]
``` if (!inputGuardian1.getText().toString().matches("")){ Log.i("Putting text", "in sp"); if(sharedPreferences != null){ sharedPreferences.edit().putString("Guardian 1", guardian1).apply(); Log.i("Putting text", "passed"); }else{ sharedPreferences = ...
``` SharedPreferences sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE); sharedpreferences.edit().putString("key", "value").commit(); ```
7,079,383
I've got some SQL that's working when I want to look for particular pages that have the particular schemes assigned to it (all through the scheme\_assignment): ``` Page.find_by_sql(" SELECT pages.id FROM pages INNER JOIN scheme_assignments ON (scheme_assignments.schemable_type = 'Page' AND ...
2011/08/16
[ "https://Stackoverflow.com/questions/7079383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61018/" ]
``` Page.joins("INNER JOIN scheme_assignments ON (scheme_assignments.schemable_type = 'Page' AND scheme_assignments.schemable_id = pages.sid) INNER JOIN schemes ON (schemes.sid = scheme_assignments.scheme_id AND schemes.sid IN (4,6,7))"). select("DISTINCT pages.*"); ```
[Rails Guides](http://guides.rubyonrails.org/active_record_querying.html#joining-tables) When you have an association set up, Rails knows what kind of join to use. I think (haven't tried it though) it should work this way: ``` Page.select("pages.id").joins("INNER JOIN scheme_assignments ON (scheme_assignments.schemab...
7,675,284
I have: ``` cdef class BaseClass(): def __cinit__(self,char* name): print "BaseClass __cinit__()" #... def __dealloc__(): print "BaseClass __dealloc__()" #... cdef class DerClass(BaseClass): def __cinit__(self,char...
2011/10/06
[ "https://Stackoverflow.com/questions/7675284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/982233/" ]
The above answer may not pose quite the best solution. Reading the section "Initialisation methods: \_\_cinit\_\_() and \_\_init\_\_()" of the link above gives this information: > > If your extension type has a base type, the `__cinit__()` method of the base type is automatically called before your `__cinit__()` meth...
Well, you are right that you should see the **cinit** method called on your parent class. It says so right here in the docs. <http://docs.cython.org/src/userguide/special_methods.html> Here is what I tried using: ``` cdef class BaseClass: def __cinit__(self,char* name): print "BaseClass __cinit__()" ...
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
Yes, there is a bug in the code. *[Code Complete](https://rads.stackoverflow.com/amzn/click/com/0735619670)* > > Assertions check for conditions that > should never occur. [...] > > > If an > assertion is fired for an anomalous > condition, the corrective action is > not merely to handle an error > graceful...
If assert fails there is a bug in either the caller or callee. Why else would there be an assertion?
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
Yes, there is a bug in the code. *[Code Complete](https://rads.stackoverflow.com/amzn/click/com/0735619670)* > > Assertions check for conditions that > should never occur. [...] > > > If an > assertion is fired for an anomalous > condition, the corrective action is > not merely to handle an error > graceful...
If you are trying to be logically inclusive about all the possibilities, remember that electronic circuitry is known to be affected by radiation from space. If the right photon/particle hits in just the right place at just the right time, it can cause an otherwise logically impossible state transition. The probability...
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
That's a good question. My feeling is, if the assert fails due to your code, then it is a bug. The assertion is an expected behaviour/result of your code, so an assertion failure will be a failure of your code.
No. An assertion failure means something happened that the original programmer did not intend or expect to occur. This can indicate: * A bug in your code (you are simply calling the method incorrectly) * A bug in the Assertion (the original programmer has been too zealous and is complaining about you doing something ...
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
Yes, there is a bug in the code. *[Code Complete](https://rads.stackoverflow.com/amzn/click/com/0735619670)* > > Assertions check for conditions that > should never occur. [...] > > > If an > assertion is fired for an anomalous > condition, the corrective action is > not merely to handle an error > graceful...
I can think of one case that wouldn't really class as a bug: An assert placed to check for something external that normally should be there. You're hunting something nutty that occurs on one machine and you want to know if a certain factor is responsible. A real world example (although from before the era of asserts)...
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
That's a good question. My feeling is, if the assert fails due to your code, then it is a bug. The assertion is an expected behaviour/result of your code, so an assertion failure will be a failure of your code.
If you are trying to be logically inclusive about all the possibilities, remember that electronic circuitry is known to be affected by radiation from space. If the right photon/particle hits in just the right place at just the right time, it can cause an otherwise logically impossible state transition. The probability...
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
If you are using assertions you're following [Bertrand Meyer's Design by Contract](http://en.wikipedia.org/wiki/Design_by_contract) philosophy. It's a programming error - the contract (assertion) you have specified is not being followed by the client (caller).
No. An assertion failure means something happened that the original programmer did not intend or expect to occur. This can indicate: * A bug in your code (you are simply calling the method incorrectly) * A bug in the Assertion (the original programmer has been too zealous and is complaining about you doing something ...
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
That's a good question. My feeling is, if the assert fails due to your code, then it is a bug. The assertion is an expected behaviour/result of your code, so an assertion failure will be a failure of your code.
If you are using assertions you're following [Bertrand Meyer's Design by Contract](http://en.wikipedia.org/wiki/Design_by_contract) philosophy. It's a programming error - the contract (assertion) you have specified is not being followed by the client (caller).
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
That's a good question. My feeling is, if the assert fails due to your code, then it is a bug. The assertion is an expected behaviour/result of your code, so an assertion failure will be a failure of your code.
I can think of one case that wouldn't really class as a bug: An assert placed to check for something external that normally should be there. You're hunting something nutty that occurs on one machine and you want to know if a certain factor is responsible. A real world example (although from before the era of asserts)...
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
If assert fails there is a bug in either the caller or callee. Why else would there be an assertion?
That's a good question. My feeling is, if the assert fails due to your code, then it is a bug. The assertion is an expected behaviour/result of your code, so an assertion failure will be a failure of your code.
2,877,916
I've always followed the logic: if assert fails, then there is a bug. Root cause could either be: * Assert itself is invalid (bug) * There is a programming error (bug) * (no other options) I.E. Are there any other conclusions one could come to? Are there cases where an assert would fail and there is no bug?
2010/05/20
[ "https://Stackoverflow.com/questions/2877916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/126494/" ]
Yes, there is a bug in the code. *[Code Complete](https://rads.stackoverflow.com/amzn/click/com/0735619670)* > > Assertions check for conditions that > should never occur. [...] > > > If an > assertion is fired for an anomalous > condition, the corrective action is > not merely to handle an error > graceful...
No. An assertion failure means something happened that the original programmer did not intend or expect to occur. This can indicate: * A bug in your code (you are simply calling the method incorrectly) * A bug in the Assertion (the original programmer has been too zealous and is complaining about you doing something ...
16,929,753
Suppose I have the path directory `pathname`. I can print all the files in that directory by doing ``` glob.glob('*') ``` but that doesn't print out the files in the subdirectories (such as `dir/file1.txt`) Is it possible to print out all files in this directory as well as all subdirectories?
2013/06/05
[ "https://Stackoverflow.com/questions/16929753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1798675/" ]
It's only a little more difficult using `os.walk` ``` import os for dirpath, dirnames, filenames in os.walk('.'): for f in filenames: print os.path.join(dirpath, f) ``` You can also express this as a generator expression ``` for filename in (os.path.join(dp, f) for dp, dn, fn in os.walk('.') for f in fn...
``` import os top = 'F:/some/path/' for root, dirs, files in os.walk(top, topdown=False): for name in files: print name ```
16,929,753
Suppose I have the path directory `pathname`. I can print all the files in that directory by doing ``` glob.glob('*') ``` but that doesn't print out the files in the subdirectories (such as `dir/file1.txt`) Is it possible to print out all files in this directory as well as all subdirectories?
2013/06/05
[ "https://Stackoverflow.com/questions/16929753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1798675/" ]
It's only a little more difficult using `os.walk` ``` import os for dirpath, dirnames, filenames in os.walk('.'): for f in filenames: print os.path.join(dirpath, f) ``` You can also express this as a generator expression ``` for filename in (os.path.join(dp, f) for dp, dn, fn in os.walk('.') for f in fn...
You want to use os.walk. Example: ``` for (dirname, subs, files) in os.walk('.'): print('[' + dirname + ']') for fname in files: print(os.path.join(dirname, fname)) ``` See [here for more info](http://docs.python.org/3.3/library/os.html#files-and-directories)
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
C (gcc) under bash shell on x86, 230 bytes, 8 exit codes ======================================================== Newlines added to aid readability. Comments ignored in score. ```bash main(int c, char **v){ int p[2]; switch(atoi(v[1])-128){ case 2:__asm("UD2"); /* SIGILL: x86 undefined instruction */ case 5:__...
Python 2, 13 Bytes, 2 exit codes ================================ ``` 1/(input()-1) ``` If you enter 0, it tries to print `1/-1` which is -1 which is perfectly fine thus exit code 0. If you enter 1, you get `1/0` which raises a `ZeroDivisionError` in which there is an exit code of 1. With my IDE, there is only 0 and...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
Perl, 108 bytes, 256 exit codes =============================== This program (ab)uses [Test::More](http://search.cpan.org/~exodist/Test-Simple-1.302075/lib/Test/More.pm#EXIT_CODES) module. It tries to open file named `""` *n* times where *n* is given as command line argument. It fails every time, and each invocation i...
Python 2, 13 Bytes, 2 exit codes ================================ ``` 1/(input()-1) ``` If you enter 0, it tries to print `1/-1` which is -1 which is perfectly fine thus exit code 0. If you enter 1, you get `1/0` which raises a `ZeroDivisionError` in which there is an exit code of 1. With my IDE, there is only 0 and...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
INTERCAL (C-INTERCAL), 15 codes, 313 + 2 = 315 bytes ==================================================== ``` PLEASE WRITE IN .1 (8) PLEASE CREATE .1 A PLEASE A PLEASE COME FROM #2$!1/#1' DO X (123) DO (123) NEXT DO COME FROM (222) (222) DO STASH .2 (240) DO ,1 <- #0 ...
[Perl 6](https://perl6.org), 57 bytes, 256 exit codes ===================================================== ```perl6 use Test;plan $_=@*ARGS[0];ok try {open ""} for ^($_%255) ``` [Try it](https://tio.run/nexus/perl6#bVHLTgJBELzPV5SI4RHklcABsokmEENi1Cx4MkoWaNgJy84yM@tKCD@jRz/BcOGH@ATsJb4OHrurqruqOzuEAx2H2L0jIh00cU7IH...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
Unix Shell (+ncurses +BSD utilities), ~~36~~, 26 bytes, 256 exit codes ====================================================================== **Golfed** ```bash jot -bu0 $[252+$1]|tput -S ``` > > If the -S option is used, tput checks for errors from each line, and if any errors are found, will set the exit code to...
C90 (gcc), 256 exit codes, ~~28~~ ~~27~~ 18 bytes ================================================= ```c main(){getchar();} ``` I'm not sure if this is clever or cheaty, but I don't think it violates the rules as written: it technically doesn't use `exit`, `return`, or any error throwing mechanism, but simply relies...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
Excel VBA, ~~414~~ 514 533 + 3 Bytes, 14 exit codes =================================================== Takes input as a `Conditional Compilation Argument`, `n=[input value]` and produces that number's associated error code. ```vb Sub e() Dim a As Application, b As Byte, s As String, v(), x Set a=Application #If n=3...
Node.js (ES6), 77 bytes, 2 exit codes ===================================== ``` require('readline').createInterface({input:process.stdin}).prompt("",i=>i&&x) ```
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
[Python 3](https://docs.python.org/3/), 15 bytes, 2 exit codes ============================================================== Obviously, this is longer than the [Python 2 solution](https://codegolf.stackexchange.com/a/107203/60919), because in Python 3 we can't take a literal input without calling `eval`. However, we ...
ZX81 BASIC >255 exit codes - 52 bytes (listing) =============================================== ``` 1 INPUT N 2 GOTO 1+(2*(N>0 AND N <=255)) 3 PRINT "EXIT CODE ";N 4 RAND USR N ``` Technically, `N` could be any 24 bit floating point number within the range, but we'll assume integers here. Line 2 is equivalent to `IF...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
Scala, 19 bytes, 2 exit codes ============================= `if(args(0)=="1")1/0` `1/(args(0).toInt-1)` The JVM supports only 1 and 0 as exit codes if you don't call `System.exit`. The first program tries to calculate `1/0` if the first argument is `1`, which will crash the JVM with an exit code of 1. If the argume...
[Jelly](https://github.com/DennisMitchell/jelly), 4 exit codes, 18 bytes ======================================================================== ``` ߀ 2* Ṁ¹Ŀ RÇĿỌḊ?R ``` Supports exit codes **0**, **1**, **137** (killed), and **139** (segmentation fault). [Try it online!](https://tio.run/nexus/jelly#ASMA3P//w5/ig...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
Unix Shell (+ncurses +BSD utilities), ~~36~~, 26 bytes, 256 exit codes ====================================================================== **Golfed** ```bash jot -bu0 $[252+$1]|tput -S ``` > > If the -S option is used, tput checks for errors from each line, and if any errors are found, will set the exit code to...
Perl, 108 bytes, 256 exit codes =============================== This program (ab)uses [Test::More](http://search.cpan.org/~exodist/Test-Simple-1.302075/lib/Test/More.pm#EXIT_CODES) module. It tries to open file named `""` *n* times where *n* is given as command line argument. It fails every time, and each invocation i...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
Bash 4.2 + extras, 24 exit codes ================================ ```bash grep \#$1$ $0|sed 's:#.*::;s:T:tcc -run -<<<main=:;s:C:curl -L x.org/! :'|sh;exit man#1 C-#2 C/#3 sed#4 C-x/#5 C_#6 C0#7 man /#16 C-f#22 C-o/#23 C-L3#35 C--capath /#60 C--max-filesize 1#63 C--cacert /#77 timeout 1e-9 w#124 /#126 -#127 T6\;#132 T...
Turtlèd, 4 bytes, 2 exit codes ============================== I don't know if there are any ways to get more exit codes... are there even any more ways in the interpreter language I found a few four length answers ``` ' ?; ``` [Try it online!](https://tio.run/nexus/turtled#@6@uYG/9/78hAA "Turtlèd – TIO Nexus") ``...
107,193
Inspired by [this default for IO](http://meta.codegolf.stackexchange.com/a/5330/44713). The Task -------- Write a program that, given an input integer `x` between 0 and 255, crashes with exit code `x`. Restrictions ------------ * You may not call anything which is intended directly for exit code output (`System.exi...
2017/01/18
[ "https://codegolf.stackexchange.com/questions/107193", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/44713/" ]
Bash 4.2 + extras, 24 exit codes ================================ ```bash grep \#$1$ $0|sed 's:#.*::;s:T:tcc -run -<<<main=:;s:C:curl -L x.org/! :'|sh;exit man#1 C-#2 C/#3 sed#4 C-x/#5 C_#6 C0#7 man /#16 C-f#22 C-o/#23 C-L3#35 C--capath /#60 C--max-filesize 1#63 C--cacert /#77 timeout 1e-9 w#124 /#126 -#127 T6\;#132 T...
ZX81 BASIC >255 exit codes - 52 bytes (listing) =============================================== ``` 1 INPUT N 2 GOTO 1+(2*(N>0 AND N <=255)) 3 PRINT "EXIT CODE ";N 4 RAND USR N ``` Technically, `N` could be any 24 bit floating point number within the range, but we'll assume integers here. Line 2 is equivalent to `IF...
30,308,844
I'm trying to get all the sessions of an event and then count of all the attendees who have subscribed to that event (session\_attendee table). **My Schema** 5 Tables *Event -> day -> session* *attendee* *session\_attendee* ``` +------------------------------+ | attendee | +-------------------...
2015/05/18
[ "https://Stackoverflow.com/questions/30308844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Add this to your POST body ``` "includeStats":true ``` For example, ``` [ { "statement": "MATCH (from_user:User),(to_user:User) WHERE from_user.id = '522fed61e4b0a1f88d599ae0' AND to_user.id = '52b9f410e4b03902bd21629e' MATCH from_user-[r]->to_user DELETE r", "parameters": {}, "includeStats": true ...
Have you tried to set the database to retrieve the "graph" and also the removed item? It will mark the node as "removed" on the metadata of the node. You should add that information on the POST request on the following parameter resultDataContents. The request JSON must contains this: ``` resultDataContents: ["grap...
46,454,363
I have Component A and It has 2 child components C1 and C2. Into the C1 component, there is a function with which one is getting data from a source same in C2. For C1 ```js <template> </template> <script> export default { url = 'abc.com'; name: 'c', data () { return { users:'', }}, method...
2017/09/27
[ "https://Stackoverflow.com/questions/46454363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1878394/" ]
There are plenty ways of achieving your goal. * you could just give every child component a "ref=..." and access them directly from parent. (assuming A is a child of D) * you can commit the answer of the http requests to the state * you can emit an event upwards to the parent component with the data as parameter and s...
You could adapt the pattern I described here [Vue.js edit variables in dynamic components](https://stackoverflow.com/questions/46429966/vue-js-edit-variables-in-dynamic-components/46430278#46430278) Just pass the objects you want to share as props from the parent. Then, as the children emit updated data, let the paren...
46,254,206
I am learnig c++. I see that you usually use integers to store a value, and if we want to represent that there is no value, then we use -1. For instance, the return from searching the index of a string in a vector that doesn't contain the string would be -1. In Javascript is easy: you just declare it false. I often run...
2017/09/16
[ "https://Stackoverflow.com/questions/46254206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3455699/" ]
In **C++17** there is an optional type, which is called std::optional. But I think you miss one thing. C++ is on the one hand an extremely modern programming language, offering many of the ideas other modern languages offer. On the other hand it was and is still designed with efficiency in mind, both efficiency of the...
First of all, function return types in C++ are defined during compilation which is why you can't do something like this ``` // ... if (found) return index; else return false; ``` There are several ways to work around this. You have to choose according to your application. The first one to consider, is the on...
20,638,086
Want to start off by saying I have tried [this method](https://stackoverflow.com/questions/4457506/css-how-to-set-the-table-column-width-constant-regardless-of-the-amount-of-text) with no success, it could be because I am doing it wrong idk... So I have a 7 column table and my issue is that my 2nd column (TX4200) does...
2013/12/17
[ "https://Stackoverflow.com/questions/20638086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1887101/" ]
You likely want to look at setting either the `overflow` to `hidden` or `word-wrap` to `break-word` in conjunction with the `max-width` for the cells in question depending on the kind of behaviour you want.
There you go: <http://jsfiddle.net/8Xy24/2/> I just added a `td` width: ``` td { width:50px; } ```
12,298,073
I'm using **Multiple Select with Groups** and **Multiple Select** from <http://harvesthq.github.com/chosen/> Does anyone know how to get the values of the submitted data using php? `$_POST['countries'];` does not work and only returns one of the selected items (not an array) And here is the select tag name/id etc `...
2012/09/06
[ "https://Stackoverflow.com/questions/12298073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384889/" ]
When you are posting multiple values using a `<select>` you need to name it a way, it looks like an `array`. ``` <select name="countries[]"> </select> ``` This should be the way. And upon `POST`, the variable should be accessible as: ``` $_POST['countries'] = array( [0] => 'India' , // First selected value [1] ...
Check these links: <http://www.onlinetools.org/tricks/using_multiple_select.php> and [How to get multiple selected values of select box in php?](https://stackoverflow.com/questions/2407284/how-to-get-multiple-selected-values-of-select-box-in-php) The select name should have square brackets at it's end, so it would be ...
172,667
I started work in a new company three months ago as a Jr PM and after a month of shadowing/training I got my first project assigned. I'm leading a team of six people. Overall everything is fine except with this one senior Architect, let's call him John, who is also 20 years older than me. The team is divided into thre...
2021/05/20
[ "https://workplace.stackexchange.com/questions/172667", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/46491/" ]
So as a PM I see you having three problems. 1. Modification to deliverable details without you being informed. Let them know what was decided is fine but the way it was decided negatively impacts you. Follow up with how you expect changes to deliverables to be processed in the future, confirm with the person receiving...
> > I told John that I was fine that the team communicate internally and I encourage team work, but I need to be in the loop for any decision in order to be able to keep track and make sure everything is according to the plan > > > This is very reasonable. Good job. I don't think John complained. > > (delivering...
39,345,005
I have contenteditable div on which i have file drop and copy-paste image event. By using the color:transparent i am able to hide the blinking cursor on chrome browser. but in IE i came to know "The color of the text cursor in an input on IE is always the inverse of the background color". Source:[How do I change the co...
2016/09/06
[ "https://Stackoverflow.com/questions/39345005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6799456/" ]
You can do it in CSS with: ``` caret-color: transparent ``` Doesn't work in IE though. Here is [browser support chart](https://caniuse.com/#feat=css-caret-color).
Assuming you mean changing the caret cursor, otherwise known as the text cursor; there are solutions available, although support for IE is rather limited. Perhaps, if not already, you might find this of some use: [Hide textfield blinking cursor](https://stackoverflow.com/questions/3671141/hide-textfield-blinking-curso...
39,345,005
I have contenteditable div on which i have file drop and copy-paste image event. By using the color:transparent i am able to hide the blinking cursor on chrome browser. but in IE i came to know "The color of the text cursor in an input on IE is always the inverse of the background color". Source:[How do I change the co...
2016/09/06
[ "https://Stackoverflow.com/questions/39345005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6799456/" ]
You can do this for IE with this hack: ``` color: transparent; text-shadow: 0 0 0 #333333; ``` You can replace the color (`#333333`) with whatever text color you need.
Assuming you mean changing the caret cursor, otherwise known as the text cursor; there are solutions available, although support for IE is rather limited. Perhaps, if not already, you might find this of some use: [Hide textfield blinking cursor](https://stackoverflow.com/questions/3671141/hide-textfield-blinking-curso...
39,345,005
I have contenteditable div on which i have file drop and copy-paste image event. By using the color:transparent i am able to hide the blinking cursor on chrome browser. but in IE i came to know "The color of the text cursor in an input on IE is always the inverse of the background color". Source:[How do I change the co...
2016/09/06
[ "https://Stackoverflow.com/questions/39345005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6799456/" ]
You can do it in CSS with: ``` caret-color: transparent ``` Doesn't work in IE though. Here is [browser support chart](https://caniuse.com/#feat=css-caret-color).
You can do this for IE with this hack: ``` color: transparent; text-shadow: 0 0 0 #333333; ``` You can replace the color (`#333333`) with whatever text color you need.
39,130,722
I'm trying to get two bytes in from an SPI sensor and concatenate them (not add them or bitwise OR them). What I have: 11111 and 1111100. What I want: 0001111101111100 (8060 in decimal). When I Serial.print(firstByte, BIN) my two bytes, Arduino seems to remove the leading 0's (probably because there is some kind of c...
2016/08/24
[ "https://Stackoverflow.com/questions/39130722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6753573/" ]
``` #include <iostream> // only for debug output int main() { // example how to concatenate two 8 bit values into 16 bit value uint8_t b1 = 0b11111, b2 = 0b1111100; uint16_t r = (b1<<8) | b2; // debug output, the value is already composed in 16b "r" variable std::cout << int(b1) << " " << int(b2)...
If you need one 16bit wide variable, you can use for example bit shifting. Something like: ``` uint16_t result = SPI.transfer(...); result <<= 8; result |= SPI.transfer(...); ```
39,130,722
I'm trying to get two bytes in from an SPI sensor and concatenate them (not add them or bitwise OR them). What I have: 11111 and 1111100. What I want: 0001111101111100 (8060 in decimal). When I Serial.print(firstByte, BIN) my two bytes, Arduino seems to remove the leading 0's (probably because there is some kind of c...
2016/08/24
[ "https://Stackoverflow.com/questions/39130722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6753573/" ]
``` #include <iostream> // only for debug output int main() { // example how to concatenate two 8 bit values into 16 bit value uint8_t b1 = 0b11111, b2 = 0b1111100; uint16_t r = (b1<<8) | b2; // debug output, the value is already composed in 16b "r" variable std::cout << int(b1) << " " << int(b2)...
I just wanted to point out for anyone else that encounters this. Arduino is fully C++. A few people in this thread mentioned it is not C or C++, which is wrong. The Arduino IDE passes the code through a pre-process to do a few things for you before handing it off to the C++ compiler. If you are familiar with C++, you c...
52,668,281
Good day to all, i've to do a query that sums some columns together. ``` $sqlannoprima = "SELECT fascia_prezzo,data,giorno, SUM (a1,a2,a3,a4,a5,a6,a7,a8) as atot, SUM (g1,g2,g3,g4,g5,g6,gtesi,gg) as gtot, SUM (f1,f2,f,3,f4) as ftot, SUM (lt1,lt2,lt3,lt4,ltg) as lttot, FROM giorni WHERE STR_TO_DATE...
2018/10/05
[ "https://Stackoverflow.com/questions/52668281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10052138/" ]
You need to remove the last `,` after `lttot` in your sql Also,you had better use `(INTERVAL 1 YEAR)` instead of `INTERVAL 1 YEAR` directly ``` $sqlannoprima = "SELECT fascia_prezzo,data,giorno, SUM (a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8) as atot, SUM (g1 + g2 + g3 + g4 + g5 + g6 + gtesi + gg) as gtot, SUM...
``` SELECT fascia_prezzo,data,giorno,SUM(a1) as a1,SUM(a2) as a2,SUM(a3) as a3,SUM(a4) as a4,SUM(a4) as a4,SUM(a5) as a5,SUM(a6) as a6,SUM(a7) as a7,SUM(a8) as a8,(SUM(a1) + SUM(a2) + SUM(a3) + SUM(a4) + SUM(a5) + SUM(a6) + SUM(a7) + SUM(a8)) as atot FROM giorni WHERE STR_TO_DATE(giorno, '%d/%m/%Y') BETWEEN STR_TO_DATE...
52,668,281
Good day to all, i've to do a query that sums some columns together. ``` $sqlannoprima = "SELECT fascia_prezzo,data,giorno, SUM (a1,a2,a3,a4,a5,a6,a7,a8) as atot, SUM (g1,g2,g3,g4,g5,g6,gtesi,gg) as gtot, SUM (f1,f2,f,3,f4) as ftot, SUM (lt1,lt2,lt3,lt4,ltg) as lttot, FROM giorni WHERE STR_TO_DATE...
2018/10/05
[ "https://Stackoverflow.com/questions/52668281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10052138/" ]
[`SUM()`](https://dev.mysql.com/doc/refman/8.0/en/group-by-functions.html#function_sum) is an aggregate function, it sums *rows*, to sum *columns* use `+`, e.g. : ``` (f1 + f2 + f3 + f4) as ftot ``` or ``` SUM(f1 + f2 + f3 + f4) as ftot ``` if you want to sum on rows and columns
``` SELECT fascia_prezzo,data,giorno,SUM(a1) as a1,SUM(a2) as a2,SUM(a3) as a3,SUM(a4) as a4,SUM(a4) as a4,SUM(a5) as a5,SUM(a6) as a6,SUM(a7) as a7,SUM(a8) as a8,(SUM(a1) + SUM(a2) + SUM(a3) + SUM(a4) + SUM(a5) + SUM(a6) + SUM(a7) + SUM(a8)) as atot FROM giorni WHERE STR_TO_DATE(giorno, '%d/%m/%Y') BETWEEN STR_TO_DATE...
27,929,232
I know how to add integers, just can't manage to do for char[] type, please help . The code below is for integer which does works, but how to compare in case of char ? ``` void insert (int a) { node *newnode= new node; newnode->data= a; if ( isempty() ) { root= newnode; } else { ...
2015/01/13
[ "https://Stackoverflow.com/questions/27929232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4450227/" ]
You should only have to change the type of the `data` field in your nodes: `char data;` If you want to have a data field that is more than one character, you should use `std::string`: `std::string data;` To make the BST more generic, consider using templates to define that data type. ``` template <class Data...
That's not answer but you have memory leak. When in tree there is already that int you don't delete "newnode" where you have ``` else if(temp->data==a) temp=NULL; ``` there should be ``` else if(temp->data==a) { temp=NULL; delete newnode; } ``` or y...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
Your understanding of the different uses of "subway' are correct. In the UK it means a passage (usually walkway) beneath something, often a street. However with internationally marketed entertainment a different dynamic often comes into play. Whereas British audiences would mostly have understood the meaning of Americ...
I cannot account for *The Saint*, but as a native of England I would find it very strange to hear another of my countryfolk refer the London Underground system as the *subway*. It would almost always be referred to as *the Underground* or *the Tube*. > > Take the *underground* for two stops, but be quick as *the tube...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
I cannot account for *The Saint*, but as a native of England I would find it very strange to hear another of my countryfolk refer the London Underground system as the *subway*. It would almost always be referred to as *the Underground* or *the Tube*. > > Take the *underground* for two stops, but be quick as *the tube...
As a term **subway** applies to many passages that occur beneath ("sub") street-level. The Oxford English Dictionary lists three usages that all have the general sense of a tunnel *under* something else: > > 1 a. Chiefly British. An underground tunnel providing access to sewers and other subterranean public utilities...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
I cannot account for *The Saint*, but as a native of England I would find it very strange to hear another of my countryfolk refer the London Underground system as the *subway*. It would almost always be referred to as *the Underground* or *the Tube*. > > Take the *underground* for two stops, but be quick as *the tube...
There is some confusion here between proper and improper nouns here. "metro" is widely used in Britain is a similar sense the USA to refer an urban railway or train service with frequent trains and stops. "subway" is likely to be understood in it's American sense (metro with a significant underground section) if there ...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
Your understanding of the different uses of "subway' are correct. In the UK it means a passage (usually walkway) beneath something, often a street. However with internationally marketed entertainment a different dynamic often comes into play. Whereas British audiences would mostly have understood the meaning of Americ...
As a term **subway** applies to many passages that occur beneath ("sub") street-level. The Oxford English Dictionary lists three usages that all have the general sense of a tunnel *under* something else: > > 1 a. Chiefly British. An underground tunnel providing access to sewers and other subterranean public utilities...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
Your understanding of the different uses of "subway' are correct. In the UK it means a passage (usually walkway) beneath something, often a street. However with internationally marketed entertainment a different dynamic often comes into play. Whereas British audiences would mostly have understood the meaning of Americ...
The author of the Saint novels, while not being American did live in the states for most of the period that he was producing the books, so it is possible that the particular usage you have picked up bled into the author's vocabulary during that time. Leslie Charteris was born in Singapore to a Chinese father and Engli...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
Your understanding of the different uses of "subway' are correct. In the UK it means a passage (usually walkway) beneath something, often a street. However with internationally marketed entertainment a different dynamic often comes into play. Whereas British audiences would mostly have understood the meaning of Americ...
There is some confusion here between proper and improper nouns here. "metro" is widely used in Britain is a similar sense the USA to refer an urban railway or train service with frequent trains and stops. "subway" is likely to be understood in it's American sense (metro with a significant underground section) if there ...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
The author of the Saint novels, while not being American did live in the states for most of the period that he was producing the books, so it is possible that the particular usage you have picked up bled into the author's vocabulary during that time. Leslie Charteris was born in Singapore to a Chinese father and Engli...
As a term **subway** applies to many passages that occur beneath ("sub") street-level. The Oxford English Dictionary lists three usages that all have the general sense of a tunnel *under* something else: > > 1 a. Chiefly British. An underground tunnel providing access to sewers and other subterranean public utilities...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
As a term **subway** applies to many passages that occur beneath ("sub") street-level. The Oxford English Dictionary lists three usages that all have the general sense of a tunnel *under* something else: > > 1 a. Chiefly British. An underground tunnel providing access to sewers and other subterranean public utilities...
There is some confusion here between proper and improper nouns here. "metro" is widely used in Britain is a similar sense the USA to refer an urban railway or train service with frequent trains and stops. "subway" is likely to be understood in it's American sense (metro with a significant underground section) if there ...
500,649
Here in America, I was taught in the mid-60s by disc jockeys playing the Petula Clark song that in the UK "subway" means a pedestrian tunnel beneath a street, not an urban rail transit system. But on today's rerun of "The Saint", an episode set in London, a character with a British accent says to Mr. Templar, "She comm...
2019/06/03
[ "https://english.stackexchange.com/questions/500649", "https://english.stackexchange.com", "https://english.stackexchange.com/users/350481/" ]
The author of the Saint novels, while not being American did live in the states for most of the period that he was producing the books, so it is possible that the particular usage you have picked up bled into the author's vocabulary during that time. Leslie Charteris was born in Singapore to a Chinese father and Engli...
There is some confusion here between proper and improper nouns here. "metro" is widely used in Britain is a similar sense the USA to refer an urban railway or train service with frequent trains and stops. "subway" is likely to be understood in it's American sense (metro with a significant underground section) if there ...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
**JSFiddle - [DEMO](http://jsfiddle.net/L3eyfsrc/)** ``` img { max-width:100%; top: 50%; position: relative; transform: translateY(-50%); } #slika { height: 126px; width: 111px; text-align: center; border: 1px #000 solid; } ```
You can do it by adding a margin of 50% and then a top of -(imageheight/2) ``` img{ max-width:100%; vertical-align: middle; margin-top:50%; position:relative; top:-37px; } #slika { float: left; height: 126px; width: 111px; text-align: center; border:1px solid red; } ``` fiddle here: <http://jsf...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
You can do it by adding a margin of 50% and then a top of -(imageheight/2) ``` img{ max-width:100%; vertical-align: middle; margin-top:50%; position:relative; top:-37px; } #slika { float: left; height: 126px; width: 111px; text-align: center; border:1px solid red; } ``` fiddle here: <http://jsf...
instead of positioning it with hard-coded properties (which would change depending on the image) or using the transform property which wont work in older browsers you can simply wrap the image in a `p` and set the `line-height` to match the height of the box ``` p{ line-height: 126px; margin: 0; padding: 0; } ``` ...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
You can do it by adding a margin of 50% and then a top of -(imageheight/2) ``` img{ max-width:100%; vertical-align: middle; margin-top:50%; position:relative; top:-37px; } #slika { float: left; height: 126px; width: 111px; text-align: center; border:1px solid red; } ``` fiddle here: <http://jsf...
A solution I've often used is adding an empty span element next to the image, with ``` #slika span { display: inline-block; height: 100%; vertical-align: middle; } ``` The idea is that vertical-align is relative to its siblings, therefore a lone element has nothing to work with. The upside of this method...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
**JSFiddle - [DEMO](http://jsfiddle.net/L3eyfsrc/)** ``` img { max-width:100%; top: 50%; position: relative; transform: translateY(-50%); } #slika { height: 126px; width: 111px; text-align: center; border: 1px #000 solid; } ```
Here is my soluton for your problem using the common table - table-cell way: I wrapped you image in a new div: ``` <div id="slika"> <div class="img-wrapper"> <img ....> </div> </div> ``` and altered the CSS: ``` img{ max-width:100%; } .img-wrapper{ display: table-cell; vertical-align: m...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
**JSFiddle - [DEMO](http://jsfiddle.net/L3eyfsrc/)** ``` img { max-width:100%; top: 50%; position: relative; transform: translateY(-50%); } #slika { height: 126px; width: 111px; text-align: center; border: 1px #000 solid; } ```
instead of positioning it with hard-coded properties (which would change depending on the image) or using the transform property which wont work in older browsers you can simply wrap the image in a `p` and set the `line-height` to match the height of the box ``` p{ line-height: 126px; margin: 0; padding: 0; } ``` ...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
**JSFiddle - [DEMO](http://jsfiddle.net/L3eyfsrc/)** ``` img { max-width:100%; top: 50%; position: relative; transform: translateY(-50%); } #slika { height: 126px; width: 111px; text-align: center; border: 1px #000 solid; } ```
A solution I've often used is adding an empty span element next to the image, with ``` #slika span { display: inline-block; height: 100%; vertical-align: middle; } ``` The idea is that vertical-align is relative to its siblings, therefore a lone element has nothing to work with. The upside of this method...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
Here is my soluton for your problem using the common table - table-cell way: I wrapped you image in a new div: ``` <div id="slika"> <div class="img-wrapper"> <img ....> </div> </div> ``` and altered the CSS: ``` img{ max-width:100%; } .img-wrapper{ display: table-cell; vertical-align: m...
instead of positioning it with hard-coded properties (which would change depending on the image) or using the transform property which wont work in older browsers you can simply wrap the image in a `p` and set the `line-height` to match the height of the box ``` p{ line-height: 126px; margin: 0; padding: 0; } ``` ...
26,262,080
I am trying to align image inside DIV horizontally and vertically. Problem is that I tried several methods and none of them worked for me. This is code that I am using: CSS ``` img{ max-width:100%; vertical-align: middle; } #slika { float: center; height: 126px; width: 111px; text-align: center; } ``` HTM...
2014/10/08
[ "https://Stackoverflow.com/questions/26262080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429355/" ]
Here is my soluton for your problem using the common table - table-cell way: I wrapped you image in a new div: ``` <div id="slika"> <div class="img-wrapper"> <img ....> </div> </div> ``` and altered the CSS: ``` img{ max-width:100%; } .img-wrapper{ display: table-cell; vertical-align: m...
A solution I've often used is adding an empty span element next to the image, with ``` #slika span { display: inline-block; height: 100%; vertical-align: middle; } ``` The idea is that vertical-align is relative to its siblings, therefore a lone element has nothing to work with. The upside of this method...
947,653
How do I download Google Chrome on Ubuntu 17.04? I hit download on the Google website, and in my files it shows up as a package called google-chrome-stable\_current\_amd64.deb When I click on it, it brings up google-chrome-stable from Ubuntu software, and nothing happens when I hit install. (I have tried restarting m...
2017/08/19
[ "https://askubuntu.com/questions/947653", "https://askubuntu.com", "https://askubuntu.com/users/724678/" ]
What I typically do is go to the Ubuntu Store and get Gdebi Package Installer. This makes everything easier for what you want. After that, I take the package you downloaded, right click and tell it to open with Gdebi. After that I hit "install" and let the magic happen. The good thing about this method is later if you ...
Since your method doesn't work, here is an alternative method to install Google Chrome. Save the .deb file in the Downloads folder, then Press Ctrl+Alt+T to open the terminal and type ``` cd ~/Downloads sudo dpkg -i google-chrome-stable_current_amd64.deb ``` After typing your admin password, then type ``` sudo ap...