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 |
|---|---|---|---|---|---|
61,827,733 | Hello Stack Overflow community, I wanted to get the row number of the first element that meets the condition specified in the query. I am making the queries using Postgresql and I send them from Python.
Here is an outline of what I want:
```
+--------+---------------+
|name |country |
|--------|-------------... | 2020/05/15 | [
"https://Stackoverflow.com/questions/61827733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12913664/"
] | Just posting an answer to help anybody who stumbles upon this in the future. As @Shawn said in his comment above, running the ANALYZE command was key to fixing this problem for me. Even though there are covering indexes, SQLITE doesn't always use them without the ANALYZE run. | First, I would write the query as:
```
FROM Dates JOIN
A
ON A.Date_c1 = Dates.Date_cal1 JOIN
B
ON B.Date_c1 = A.Date_c1 AND
B.Object_Id = A.Object_Id JOIN
C
ON C.Date_c2 = Dates.Date_cal2 AND C.Object_Id = A.Object_Id
WHERE A.Object_Id = 14
```
I would suggest indexes on:
* `A(... |
50,187,924 | Need to auto crop text(signature)from an images(sample image:[Image1](https://i.stack.imgur.com/wGN1o.png) )and Need to change background color of cropped image.
Need to achieve this using Imagemagick.
Is it any possible way to achieve these ?
I am using version ImageMagick 7.0.7-28
[williamson image](https://i.stac... | 2018/05/05 | [
"https://Stackoverflow.com/questions/50187924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9713588/"
] | if you are using anaconda:
```
$ conda install pyqt
```
tnx for:
<https://stackoverflow.com/a/56544875/13510675> | I had the same issue and solved it uninstalling the *libqt5x11extras5l* library:
```
sudo apt-get remove libqt5x11extras5l
``` |
51,599,205 | I'm new and hopefully someone can help me!
I have to delete emails which are older than x months and have `subject:test` Im getting crazy with powershell, here is the problem:
```
$time = (Get-Date).AddDays(33).ToShortDateString()
$Varible = "test"
$Search = [scriptblock]::create("{received<=$($till) AND subject:$Va... | 2018/07/30 | [
"https://Stackoverflow.com/questions/51599205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10154804/"
] | We can send response only once from lambda to alexa. So please try designing your code in below mentioned way.
```
Me: give me some information on Nutrino
Alexa: A neutrino is a fermion that interacts only via the weak subatomic force and gravity. Do you need more information?
Me: Yes
Alexa: The mass of the neutrino ... | A skill's response can only contain a single output speech and a single reprompt.
Both can be either a string or a SSML string.
See [here](https://developer.amazon.com/docs/custom-skills/request-and-response-json-reference.html) for details.
You can not include multiple Alexa speeches in one response.
You can also not ... |
67,740,117 | I'm implementing Stripe integration in Ionic 5 app.
I'm calling ***redirectToCheckout*** method from '@stripe/stripe-js'. It opens checkout process in external browser. Everything is fine, but I need back user to app when checkout will be finished.
How can I do that?
How to setup *success\_url*, to make it redirect ... | 2021/05/28 | [
"https://Stackoverflow.com/questions/67740117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1227950/"
] | You need to [set up a custom URL scheme in your Ionic app](https://ionicframework.com/docs/native/deeplinks/) (like `my-app://`) and then redirect to that URL after Checkout is complete.
Note that Stripe Checkout Sessions require `success_url` to be a valid internet-routable URL, so you'll need to point `success_url` ... | You can use <https://ionicframework.com/docs/native/in-app-browser> to open stripe checkout page so that checkout page will open in InApp browser and after subscription creation you can emit value using socket.io and after getting emmitted value close your InApp browser. |
1,845,355 | This question is language independent.
I have an application that handles requests in a loop. During this loop for each request multiple actions are taken. These actions are sitting inside try / catch / log blocks.
I am now extending this to notify administrators of severe errors via email.
This is all very easy, ... | 2009/12/04 | [
"https://Stackoverflow.com/questions/1845355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41543/"
] | Extend scenario 2 to keep a record of which entries in the application log didn't get sent via email, and periodically poll this log for unsent entries and try to resend them - eventually the smtp service will be available again. (You might want to stop any resent errors from going back in the resend queue tho...) | I would suggest the "win-win" way would be to have a server admin who actually *administrates* the server, rather than one who is entirely unreachable when his mail server is down, and doesn't bother to check up on it afterwards to see if he missed any notifications. |
11,898,125 | i want to know what is wrong in this code
```
<canvas>
<view y="50" width="100%" height="300" bgcolor="blue" onmousedown="res.apply()" onmouseup="res.remove()">
<resizestate name="res"/>
<dragstate name="drg"/>
<text width="100%" bgcolor="gray" onmousedown="parent.drg.apply()" onmouseup="p... | 2012/08/10 | [
"https://Stackoverflow.com/questions/11898125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/358435/"
] | It looks like the <html> tag functionality is broken in the SWF10 runtime of OpenLaszlo 5.0 (trunk) for some Webkit based browser (Chrome and Safari), but there are other problems as well. I've modified the code a bit to do some testing:
```
<canvas>
<button text="OpenLaszlo" onclick="ht.setAttribute('src', 'http://... | I've been developing in OpenLaszlo since 2006 and my personal experience with trying to use the OpenLaszlo <html> tag under the SWF run-time is that half of the pages I load into it work, half of them don't. I've come across situations where even simple web pages from Google will not work, it is a pretty unstable class... |
50,394,204 | I want to transform nested hashes into multidimensional arrays recursivley.
This is my current code:
```
def deep_to_a(hash)
return hash.to_a.each {|k, v|
if k.is_a?(Hash) then
hash[k.to_a] = hash.delete(k)
deep_to_a(k)
elsif v.is_a?(Hash) then
hash[k] = hash[k].to_a
if hash[k].any?... | 2018/05/17 | [
"https://Stackoverflow.com/questions/50394204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9696243/"
] | A destructive function is hard to debug.
In this case, `map` is better than `each` + destructive assignment.
The result of `hash.to_a` is an array, so your iteration `|k, v|` is incorrect.
```
def deep_to_a(hash)
hash.map do |v|
if v.is_a?(Hash) or v.is_a?(Array) then
deep_to_a(v)
else
v
end... | ```
def deep_to_a(h)
h.map { |k,v| [k, Hash === v ? deep_to_a(v) : v] }
end
deep_to_a({11=>{12=>13, 14=>15}, 16=>17})
#=> [[11, [[12, 13], [14, 15]]], [16, 17]]
``` |
25,335,289 | I have a view that takes data from JSON, uses that data to populate a list of buttons (with basic information about the data) and then upon clicking the button, I want another panel to be populated with the data bound to the data in the button.
```
<div ng-controller="QueueCtrl">
<ul class="list-unstyled" ng-repe... | 2014/08/15 | [
"https://Stackoverflow.com/questions/25335289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1236467/"
] | Your click event is never getting called because the `li` is hidden by your `focusout` event before it can be triggered.
You could set a timeout to allow for the click to be registered:
```
$("input").focusout(function () {
setTimeout(function () {
$(".abc").find("li").hide()
}, 100)
});
```
[**demo... | How about setting (short) time out on blur (focus out)?
Like this:
```
$("input").on("keyup",function(){
$(".abc li").show();
});
$(".abc li").on("click",function(){
alert("123");
});
$("input").focusout(function(){
setTimeout(function(){$(".abc").find("li").hide();}, 150);//i set 150 just as example
});
``... |
233 | we are looking in to getting at least one additional moderator at this site, to serve as a [moderator pro-tem](http://blog.stackoverflow.com/2010/07/moderator-pro-tempore/). What do the duties of a moderator include? To quote from the blog post, they:
>
> A Moderator is the site’s representative to the Network.
>
> ... | 2011/11/21 | [
"https://graphicdesign.meta.stackexchange.com/questions/233",
"https://graphicdesign.meta.stackexchange.com",
"https://graphicdesign.meta.stackexchange.com/users/69/"
] | [Alan Gilbertson](https://graphicdesign.stackexchange.com/users/1286)
=====================================================================
[](https://graphicdesign.stackexchange.com/users/1286)
* Demonstrated experience in Graphic Design... | With Alan i would like to suggest name of :
[DA01](https://graphicdesign.stackexchange.com/users/306/da01)
==============================================================
[](https://graphicdesign.stackexchange.com/users/306)
---
[Lauren-Ipsum](https... |
24,631,639 | I am facing a problem regarding designing my app with datagram socket. My app needs to communicate with different servers using udp connections. now I am not sure which of the following will be good. Is there any advantage of any of the following ( by performance or by other measures ). or is there any better option?
... | 2014/07/08 | [
"https://Stackoverflow.com/questions/24631639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/603742/"
] | Unless you are we are talking about 100000 of connections, I would create single socket per thread. It speeds up application and guarantee the thread safety of sockets and that receaved data wont get mixed up.
The most important is however, that if one channel will fail or latency will get high, it will have no influe... | My opinion is you can create a single socket to because creating more socket will bring down your app. |
70,968,352 | I've a sidebar which is positioned `sticky` but in some cases larger than the height of the screen.
If the sidebar is in fact larger as the screen height, I don't want it to stick on the top. It should scroll down with the content of the page.
I'm using Bootstraps `sticky-top` class for that.
It has the following at... | 2022/02/03 | [
"https://Stackoverflow.com/questions/70968352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1788961/"
] | Not sure if this is what you want, but maybe using the `calc()` in your css could help you.
```css
.toc{
overflow-y: auto;
max-height: calc(100vh - 50px);
}
``` | For aside blocks that higher then window height you can use smartSticky script
Just add "data-smartsticky" atribute to your aside block
<https://www.npmjs.com/package/smartsticker>
Parent block of sticky block must be height 100%, or for flex - flex-grow:1 |
70,968,352 | I've a sidebar which is positioned `sticky` but in some cases larger than the height of the screen.
If the sidebar is in fact larger as the screen height, I don't want it to stick on the top. It should scroll down with the content of the page.
I'm using Bootstraps `sticky-top` class for that.
It has the following at... | 2022/02/03 | [
"https://Stackoverflow.com/questions/70968352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1788961/"
] | Hope this [pen](https://codepen.io/neptotech/full/RwjRjOZ) helps
----------------------------------------------------------------
### Some explanations:
* in js we use `.offsetHeight`&`.clientHeight` to get height we check weather this height(`493px`) + `50px` offset is more than screen height or not.
* When screen s... | For aside blocks that higher then window height you can use smartSticky script
Just add "data-smartsticky" atribute to your aside block
<https://www.npmjs.com/package/smartsticker>
Parent block of sticky block must be height 100%, or for flex - flex-grow:1 |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | I believe that *after* getting to know html and css, starting with Vanilla JS or with a framework are both the same thing to a new student that knows nothing, he'll be learning new things from the beginning so if you think learning a framework is more valuable than starting with Vanilla JS then go ahead start with a fr... | Yes
===
To make JS learn-able, you need to use a library to clean it up. For example doing a foreach of an object in JS has many problems. However using a library can make it much simpler.
No
==
Using a complex library will make learning more complex.
Conclusion
==========
Only use libraries that make it simpler, ... |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | I believe that *after* getting to know html and css, starting with Vanilla JS or with a framework are both the same thing to a new student that knows nothing, he'll be learning new things from the beginning so if you think learning a framework is more valuable than starting with Vanilla JS then go ahead start with a fr... | I will first let them be familiar with the web developer roadmap here <https://github.com/kamranahmedse/developer-roadmap>. They may feel overwhelmed by the information list there. But for college CS students I think it is important to know what it takes to be a qualified web developer.
I will also suggest them to che... |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | I believe that *after* getting to know html and css, starting with Vanilla JS or with a framework are both the same thing to a new student that knows nothing, he'll be learning new things from the beginning so if you think learning a framework is more valuable than starting with Vanilla JS then go ahead start with a fr... | You have to understand that the learning curve for learning a JS framework like `React` is more complex than simply learning **Vanilla JS**. Learning an arrow function for example is much easier than learning an arrow function plus functional components, state, props, hooks and third party Redux. However, if you are al... |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | As a general rule, everything has its benefits. The trick is finding the tool which has as many of the benefits you need, or want, with as few of the problems you want to avoid. The choice of which JavaScript framework, including none, is no different. Often the choice is made by the management, or dictated by the esta... | Yes
===
To make JS learn-able, you need to use a library to clean it up. For example doing a foreach of an object in JS has many problems. However using a library can make it much simpler.
No
==
Using a complex library will make learning more complex.
Conclusion
==========
Only use libraries that make it simpler, ... |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | As a general rule, everything has its benefits. The trick is finding the tool which has as many of the benefits you need, or want, with as few of the problems you want to avoid. The choice of which JavaScript framework, including none, is no different. Often the choice is made by the management, or dictated by the esta... | I will first let them be familiar with the web developer roadmap here <https://github.com/kamranahmedse/developer-roadmap>. They may feel overwhelmed by the information list there. But for college CS students I think it is important to know what it takes to be a qualified web developer.
I will also suggest them to che... |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | As a general rule, everything has its benefits. The trick is finding the tool which has as many of the benefits you need, or want, with as few of the problems you want to avoid. The choice of which JavaScript framework, including none, is no different. Often the choice is made by the management, or dictated by the esta... | You have to understand that the learning curve for learning a JS framework like `React` is more complex than simply learning **Vanilla JS**. Learning an arrow function for example is much easier than learning an arrow function plus functional components, state, props, hooks and third party Redux. However, if you are al... |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | I will first let them be familiar with the web developer roadmap here <https://github.com/kamranahmedse/developer-roadmap>. They may feel overwhelmed by the information list there. But for college CS students I think it is important to know what it takes to be a qualified web developer.
I will also suggest them to che... | Yes
===
To make JS learn-able, you need to use a library to clean it up. For example doing a foreach of an object in JS has many problems. However using a library can make it much simpler.
No
==
Using a complex library will make learning more complex.
Conclusion
==========
Only use libraries that make it simpler, ... |
5,813 | I'm serving as a tech lead for a student group's charity project. We're building a website which puts a bunch of homelessness resources in one place. There are two goals to the project: create a useful website, and let students learn as they build it.
The group is comprised of all levels of college CS student. Most ha... | 2019/07/16 | [
"https://cseducators.stackexchange.com/questions/5813",
"https://cseducators.stackexchange.com",
"https://cseducators.stackexchange.com/users/-1/"
] | You have to understand that the learning curve for learning a JS framework like `React` is more complex than simply learning **Vanilla JS**. Learning an arrow function for example is much easier than learning an arrow function plus functional components, state, props, hooks and third party Redux. However, if you are al... | Yes
===
To make JS learn-able, you need to use a library to clean it up. For example doing a foreach of an object in JS has many problems. However using a library can make it much simpler.
No
==
Using a complex library will make learning more complex.
Conclusion
==========
Only use libraries that make it simpler, ... |
17,480,802 | I would like to be sure I am using the most common naming convention. In the example below would it be more common for `deleteEntity` to be `deleteEntity` or `DeleteEntity`?
```
var factory = {
deleteEntity: function (entityType, entityId) {
var deferred = $q.defer();
EntityResource.deleteEntity({ ... | 2013/07/05 | [
"https://Stackoverflow.com/questions/17480802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1422604/"
] | It would be more common to be lowercase. It would still work, but generally capital Functions are reserved for constructors (i.e. used with the `new` keyword). | There are no set naming conventions that I know of as such. But as a Java developer, I will be happy to see variables and methods following lower Camel Casing like `deleteEntity`. But Dot net developers may be comfortable with Upper camel casing like "DeleteEntity". |
12,859,258 | I'm getting radar data as "tracks" and the track data indicates the number of UTC seconds since the last midnight, apparently. This is not the number of seconds since the 1st of jan 1970.
Now I want to convert that to date time, knowing that the clock on the computer could be slightly out of sync with the clock on the... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12859258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1741137/"
] | ```
// Function to extend truncated time, given the wall time and period, all
// in units of seconds.
//
// Example: Suppose the truncated period was one hour, and you were
// given a truncated time of 25 minutes after the hour. Then:
//
// o Actual time of 07:40:00 results in 07:25:00 (07:40 + -15)
// o Actual t... | If you can link against another lib, i'd suggest to use [boost::date\_time](http://www.boost.org/doc/libs/1_51_0/doc/html/date_time.html).
It seems you want to take current date in seconds from midnight (epoch) then add the radar time to it, then convert the sum back to a date time, and transform it into a string.
... |
12,859,258 | I'm getting radar data as "tracks" and the track data indicates the number of UTC seconds since the last midnight, apparently. This is not the number of seconds since the 1st of jan 1970.
Now I want to convert that to date time, knowing that the clock on the computer could be slightly out of sync with the clock on the... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12859258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1741137/"
] | ```
// Function to extend truncated time, given the wall time and period, all
// in units of seconds.
//
// Example: Suppose the truncated period was one hour, and you were
// given a truncated time of 25 minutes after the hour. Then:
//
// o Actual time of 07:40:00 results in 07:25:00 (07:40 + -15)
// o Actual t... | I had the exact same problem but I'm using C#. My implementation is included here if anyone needs the solution in C#. This does not incorporate any clock drift.
```
DateTime UTCTime = DateTime.UtcNow.Date.AddSeconds(secondSinceMidnightFromRadar);
``` |
57,728,953 | I have a button on an input element, but when I click the input it goes over the button


```css
.btn-search {
width: 200px;
padding: 10px;
border-radius: 50px;
position: fixed;
margin-left: -100px;
display: inline-block;
... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57728953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11962342/"
] | You need to set the `z-index` of the button. Just create an extra class for the button and set `z-index: 99`.
for example use css property:
```
button
{
z-index:99 !important;
}
``` | ```
.btn-search {
width: 200px;
padding: 10px;
border-radius: 50px;
position: fixed;
margin-left: -100px;
display: inline-block;
vertical-align: middle;
z-index:999 !important;
}
```
Use this with z-index of button some higher value, so that button will always shown above any other element. |
57,728,953 | I have a button on an input element, but when I click the input it goes over the button


```css
.btn-search {
width: 200px;
padding: 10px;
border-radius: 50px;
position: fixed;
margin-left: -100px;
display: inline-block;
... | 2019/08/30 | [
"https://Stackoverflow.com/questions/57728953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11962342/"
] | You need to set the `z-index` of the button. Just create an extra class for the button and set `z-index: 99`.
for example use css property:
```
button
{
z-index:99 !important;
}
``` | For Bootstrap 4:
I'm not sure why you added its own stylesheet if you're using Bootstrap
```html
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<div clas... |
902,414 | I have a crazy problem with my keyboard on Windows 7, that just appeared in the last few months. When I press the letters o, u, and h at the same time, a backslash \ ends up being inserted before the h. Actually if I tap all three simultaneously I just get uo\ or ou. This problem does not occur with any other combinati... | 2015/04/16 | [
"https://superuser.com/questions/902414",
"https://superuser.com",
"https://superuser.com/users/45400/"
] | This sounds like a "ghost key" or "phantom key" problem. Keyboard matrices usually have keys which share traces and they use {magic} to decide which keys have been pressed. Sometimes there is uncertainty when multiple keys are pressed and you wind up with certain keys locked out and in other cases phantom keypresses ap... | Sounds crazy, but faulty USB ports or dust and debris in the USB ports can cause the keyboard to malfunction. What you need to do is open your computer case and clean the USB port in which the keyboard is using. Also, try using a different USB port. Check if sticky keys are enabled through Control Panel (just search st... |
54,954,845 | How to convert this in Javascript from:
```
[
{
"label": "Purok I",
"y": "1"
},
{
"label": "Purok II",
"y": "1"
},
{
"label": "Purok III",
"y": "2"
}
]
```
to:
```
[
{
label: "Purok I",
y: 1
},
{
label: "Purok II",
y: 1
},
... | 2019/03/02 | [
"https://Stackoverflow.com/questions/54954845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10709282/"
] | `.gitignore` works for files not yet `add`ed, but not for files that are already tracked.
You may have to use `git filter-branch` to [remove those files from your Git local history](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_removing_file_every_commit).
After that, a force push is needed, because you... | .gitignore wont work for files or folders that are already pushed (inside a branch);
edit git ignore directly in repo, delete files, and then pull to local;
remove files in local |
13,807,343 | Problem specification:
I have a rectangular and uniformly spaced image of pixels with vertex coordinates (i,j), (i+1,j), (i, j+1), (i+1, j+1) [i=0,...,m-1; j=0,...,n-1] and a polygon P with vertex coordinates (x\_1,y\_1), ..., (x\_n, y\_n). Now I want to efficiently compute the percentage of every pixel overlapping wi... | 2012/12/10 | [
"https://Stackoverflow.com/questions/13807343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1892414/"
] | Doing the exact geometric analysis might not be too difficult.
Deal with those pixels that are partially covered by the polygon first: you can use a [technique from ray-tracing](http://www.cse.yorku.ca/~amana/research/grid.pdf) to quickly find all pixels that intersect with the polygon edges. You can then use the [Coh... | I would do
1a) Upsample when the pixel is partly overlapping:
but not the whole image, only the current pixel to be checked, or all pixels in the current scan line if that helps.
Than there is no memory argument.
speed? up to 16x16 i dont think that speed is an issue. |
21,790,017 | I want to capture a date on a SharePoint edit form.. then take that date and subtract that date from it to get a value for the number of days. Is this a complicated process or something simple? I'm not having much luck searching due to super secure (and unnecessary) security blocks. | 2014/02/14 | [
"https://Stackoverflow.com/questions/21790017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3299197/"
] | If I had to guess, you have a webpage that has been compromised (which is what I think you suspect), and is being used to generate all the messages. The webpage probably accepts a FROM and a TO, without any validation.
If you start seeing these come in, as a test, start shutting off websites, until you see the attack ... | Most likely your server is configured to act as an email relay server, which allows anyone to send email that is in transit to your server for your server to send on (relay). Spammers do this to cover up the original origination point of the email.
The fix is to configure your server not to be a relay server. More bac... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell) 7, 74 bytes
=================================================================================
```powershell
$args|%{switch($_){i{$x++}d{$x--}s{$x*=$x}o{+$x}}$x=1+$x-and$x-256?$x :0}
```
Link is to a slightly longer PS 6 solution, as TIO does not y... | [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 118 bytes
================================================================================
```powershell
$args[0]|% t*y|%{if($a-in@(-1,256)){$a=0}if($_-eq'i'){$a+=1}elseif($_-eq'd'){$a-=1}elseif($_-eq's'){$a=$a*$a}else{$a}}
```
[Try it online!](h... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [C (gcc)](https://gcc.gnu.org/), ~~92~~ 91 bytes
================================================
Thanks to ceilingcat for the -1.
Converts each operation into the range `[0,3]` to simplify the decoding process.
```c
a,b;f(char*s){for(a=0;b=*s++/2;a*=a-256&&~a)(b&=3)?--b?--b?printf("%i ",a):a--:(a*=a):a++;}
```
[T... | [AWK](https://www.gnu.org/software/gawk/manual/gawk.html), ~~55~~ ~~53~~ ~~52~~ 51 bytes
========================================================================================
Thanks to [user41805](https://codegolf.stackexchange.com/users/41805/user41805) for removing awk flags
Expects each operation to be on a sep... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [C (gcc)](https://gcc.gnu.org/), ~~92~~ 91 bytes
================================================
Thanks to ceilingcat for the -1.
Converts each operation into the range `[0,3]` to simplify the decoding process.
```c
a,b;f(char*s){for(a=0;b=*s++/2;a*=a-256&&~a)(b&=3)?--b?--b?printf("%i ",a):a--:(a*=a):a++;}
```
[T... | [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 118 bytes
================================================================================
```powershell
$args[0]|% t*y|%{if($a-in@(-1,256)){$a=0}if($_-eq'i'){$a+=1}elseif($_-eq'd'){$a-=1}elseif($_-eq's'){$a=$a*$a}else{$a}}
```
[Try it online!](h... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [Python 3](https://docs.python.org/3/), ~~120~~ 95 bytes
========================================================
```python
n=0
for x in input():
if n in(-1,256):n=0
if"o"==x:print(n)
else:n=[n+1,n-1,n*n][ord(x)%4^1]
```
[Try it online!](https://tio.run/##FYrLCsMgFAXX8SskUNAkhdrXQvBLQroyoRfKuaIG7NcbA7M5cyb885fxqB... | [Jelly](https://github.com/DennisMitchell/jelly), 25 24 bytes
=============================================================
```
:4ị⁾’‘;⁾Ṅ²¤j“-,⁹¤i¬×Ʋ”VZ
```
[Try it online!](https://tio.run/##y0rNyan8/9/K5OHu7keN@x41zHzUMMMayHq4s@XQpkNLsh41zNHVedS489CSzENrDk8/tulRw9ywqP///0cbGpjqKBgaohGGQMKAXG4sAA "Jelly – Try It On... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [J](http://jsoftware.com/), 64 58 bytes
=======================================
```
g=:]e.&256 _1|]
i=:g>:
d=:g<:
s=:g*:
o=:1!:2&2
f=:'0'".@|.@,]
```
[Try it online!](https://tio.run/##hU7BasMwDL37K7QeYjYUE7tJ1oq5hH3AfmCEHZY01Q51QbkM@u@Zzdok7LIngYSk956@pmnw1PYmc1UNH/baKvY0HEh1sbyQklieSAVP9oFc5tTRky70xjRX02A7jb2M3myB... | [Desmos](https://desmos.com/calculator) /w ticker, 269 bytes
============================================================
[try it online](https://www.desmos.com/calculator/z5xeeyfzb2)
Code in ticker:
```
\left\{I[n]=4:T,\ I[n]=3:v->\left\{v^2=256:-1,v^2\right\},I[n]=2:v->\left\{v-1=-1:0,v-1=256:0,v-1\right\},I[n]=1:... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [Python 3](https://docs.python.org/3/), ~~120~~ 95 bytes
========================================================
```python
n=0
for x in input():
if n in(-1,256):n=0
if"o"==x:print(n)
else:n=[n+1,n-1,n*n][ord(x)%4^1]
```
[Try it online!](https://tio.run/##FYrLCsMgFAXX8SskUNAkhdrXQvBLQroyoRfKuaIG7NcbA7M5cyb885fxqB... | [Ohm v2](https://github.com/nickbclifford/Ohm), 30 bytes
========================================================
```
ÝL}`7%5%›0s:_ΦD256â0>*
›
=
‹
²
```
[Try it online!](https://tio.run/##y8/INfr///Bcn9oEc1VT1UcNuwyKreLPLXMxMjU7vMjATosLKMRlCyR3ch3a9P9/ZnFxcX4mEgIA "Ohm v2 – Try It Online") |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [Red](http://www.red-lang.org), 106 bytes
=========================================
```
func[s][a: 0 parse s[any[(if a xor 256 < 1[a: 0])"i"(a: a + 1)|"d"(a: a - 1)|"s"(a: a * a)|"o"(print a)]]]
```
[Try it online!](https://tio.run/##hY/BCsIwEETv/YphT61SsIIeRPwIr2EPwTS4l6ZkFRT895rUWsWLjxz2hWFgYuuGY@sMF36HwV@7k1E2doc... | [Pip](https://github.com/dloscutoff/pip), 39 bytes
==================================================
```
Fca;V("U i&D SQ: P"^sAc)."i*:i!=256"
```
Takes the Deadfish program as a command-line argument. [Try it here!](https://replit.com/@dloscutoff/pip) Or, here's a 42-byte version in Pip Classic: [Try it online!]... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [convey](http://xn--wxa.land/convey/), ~~90~~ 76 bytes
======================================================
```
{"='i'
0+#<
^v"='d'
^-#<
^v"='s'
^*#+1
^.=<'o'
^>@`
^}",
*<<"=256
.="*.
0-1
```
[Try it online!](https://xn--wxa.land/convey/run.html#eyJjIjoiIHtcIj0naSdcbjArIzxcbl52XCI9J2QnXG5eLSM8XG5edlwiPSdzJ1xuXioj... | [Red](http://www.red-lang.org), 106 bytes
=========================================
```
func[s][a: 0 parse s[any[(if a xor 256 < 1[a: 0])"i"(a: a + 1)|"d"(a: a - 1)|"s"(a: a * a)|"o"(print a)]]]
```
[Try it online!](https://tio.run/##hY/BCsIwEETv/YphT61SsIIeRPwIr2EPwTS4l6ZkFRT895rUWsWLjxz2hWFgYuuGY@sMF36HwV@7k1E2doc... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | JavaScript (ES10), 66 bytes
===========================
Expects a list of codepoints.
```javascript
a=>a.flatMap(n=>n%5?p:(p=(p=[p-!!p,p+1,,p*p][n&3])-256&&p,[]),p=0)
```
[Try it online!](https://tio.run/##jZHdaoMwFMfvfYpUmMTtmDapOrcRxxi93BOIF0HrmuFM8Mhe3yUVYRS27pdzcSD8P@B8qC@FzajtlAymPc6dnJUsFet6Nb0pSwdZDjfZs32kVr... | [Vyxal](https://github.com/Vyxal/Vyxal) `O`, 19 bytes
=====================================================
```
0?(n`ḟ``ġ`ĿĖ:₈u"c[0
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyJPIiwiIiwiMD8obmDhuJ9gYMShYMS/xJY64oKIdVwiY1swIiwiIiwiZGlpc3Npc2RvIl0=)
This is really cheating, but whatever. Short dictionary... |
218,260 | [Sandbox](https://codegolf.meta.stackexchange.com/a/20666/80214), [Codidact](https://codegolf.codidact.com/posts/280612)
*A rewrite of [this question](https://codegolf.stackexchange.com/questions/16124/write-an-interactive-deadfish-interpreter) with a simpler input format and guidelines.*
Challenge
---------
Deadfis... | 2021/01/30 | [
"https://codegolf.stackexchange.com/questions/218260",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/80214/"
] | [Nim](http://nim-lang.org/), 104 bytes
======================================
```
var r=0
for c in stdin.readAll:
r=[r*r,r,r+1,r-1][28-c.ord div 4];r*=int (r xor 256)>0;if c=='o':echo r
```
[Try it online!](https://tio.run/##TYxBCoMwFAX3nuLtbK2KSluKkkLPIS4kUfrB5sOLSG@fZllmdgPj5RPjMRM0TbYqYSEeYXfiay6ze21bn6U4smCZuLQ... | [Arturo](https://github.com/arturo-lang/arturo), 80 bytes
=========================================================
```
$[p][r:0loop p'c[do[[r:r*r][print r][r:r+1][r:r-1]]\28-c/4if or? r<0r=256[r:0]]]
```
A function that takes an array of codepoints and prints numbers separated by newlines. |
51,474,075 | I'm following a tutorial on how to write a shellcode but I'm failing to understand what this pointer function casting is doing to the bytecode, could someone explain this to me?.
```
char code[] = "bytecode will go here!";
int main(int argc, char **argv)
{
int (*func)();
func = (int (*)()) code;
(int)(*func)(... | 2018/07/23 | [
"https://Stackoverflow.com/questions/51474075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10035164/"
] | With the given data structure an approach twice needs to [reduce](https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce) a list. Firstly the outer list structure that groups lists of account-items. Each of these lists firstly should be sorted by the time stamp (time property) of it'... | ```
let newArr = [];
grouped.forEach(function(elements){
let res = compareTime(elements)
if(res.length > 0)
newArr.push(res)
})
console.log(newArr)
function compareTime(value) {
let newArr = []
let existCheck = []
for(let i = 0; i < value.length; i ++) {
let iTime = Date.parse(value[i].... |
29,027,087 | 
I want to build a Qt5.2 Application in C++ with Visual Studio 2013. I apply the `QWidget::resize` function to set the size of the QWidget object in the image above to 1200\*800. But it seems that the QWidget object can't be that large(there are vertical and horizonta... | 2015/03/13 | [
"https://Stackoverflow.com/questions/29027087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3247139/"
] | You need to provide a minimal example of what's going on. We shouldn't have to guess.
All I can see is up to three widgets: the top level one, the `QScrollArea`, and whatever widget is inside of the scroll area. If that's the case, then the scroll area is not managed by a layout, and when you resize the top level widg... | Add your widget to QLayout:
```
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(widget);
mainWindow->setLayout(layout);
``` |
23,257,186 | I have a function that looks like
```
bigvalue_t do_bigadd (const bigvalue_t& left, const bigvalue_t& right) {
}
```
and it is being called here
```
bigint bigint::operator+ (const bigint& that) const {
bigint result;
result.big_value = do_bigadd(this->big_value, that.big_value);
}
```
I'm getting the fo... | 2014/04/23 | [
"https://Stackoverflow.com/questions/23257186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3345589/"
] | Your problem is that `do_bigadd` is not `const` (but `this` is `const` in `operator+`, and so you are trying to call a non-const member function of the const object `this`). You need to make `do_bigadd` const:
```
bigvalue_t do_bigadd (const bigvalue_t& left, const bigvalue_t& right) const {
}
```
If this in turn ca... | You say you have a function:
```
bigvalue_t do_bigadd (const bigvalue_t& left, const bigvalue_t& right) {
}
```
That is not true. You have a **member function**:
```
bigvalue_t bigint::do_bigadd (const bigvalue_t& left, const bigvalue_t& right) {
}
```
and you need to make that function either:
* a free (non-m... |
37,807,150 | I am trying to build an app using Ionic + Cordova. I want to show a map in my app.
I am using cordova google maps plugin for this and I am able to successfully render the map.
Now what I want to do is place a search box on top the map. The search should show place suggestions close to the user's current location when u... | 2016/06/14 | [
"https://Stackoverflow.com/questions/37807150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3340573/"
] | Using the stock google autocomplete is a problem if you're using the plugin, as the results are tacked onto the DOM, and can have unpredictable results visually.
I found that using the autocomplete service, and handle all the dropdown result parsing etc to be easier.
With ionic, you can use a plugin like <https://git... | You can do it this way (I use jQuery):
```
$("#query").on("blur", function () {
map.setClickable(true);
}).on("focus", function () {
map.setClickable(false);
}).on("keyup", function () {
event.stopPropagation();
event.preventDefault();
// sear... |
60,077,704 | I am trying to do this:
```
.withColumn("System", when($"SysID".split("-").length > 3, $"SysID".split("-").take(3)).otherwise(null))
```
But I get the following error:
error: value split is not a member of org.apache.spark.sql.ColumnName
What can I do to use the split function?
Thank you. | 2020/02/05 | [
"https://Stackoverflow.com/questions/60077704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2227484/"
] | This will select salary in the last row.
```
df['Salary'][-1]
``` | In pandas there exists a tail function:
```
>>> df = pd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion',
'monkey', 'parrot', 'shark', 'whale', 'zebra']})
>>> df.tail(1)
animal
8 zebra
```
(See: <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.tail.html... |
60,077,704 | I am trying to do this:
```
.withColumn("System", when($"SysID".split("-").length > 3, $"SysID".split("-").take(3)).otherwise(null))
```
But I get the following error:
error: value split is not a member of org.apache.spark.sql.ColumnName
What can I do to use the split function?
Thank you. | 2020/02/05 | [
"https://Stackoverflow.com/questions/60077704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2227484/"
] | First of all I would advise against using get\_value since it is/will be deprecated. (see: <https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.DataFrame.get_value.html> )
There are a couple of solutions:
```
df['Salary'].iloc[-1]
df.Salary.iloc[-1]
```
are synonymous. Iloc is the way to retrieve ... | In pandas there exists a tail function:
```
>>> df = pd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion',
'monkey', 'parrot', 'shark', 'whale', 'zebra']})
>>> df.tail(1)
animal
8 zebra
```
(See: <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.tail.html... |
60,077,704 | I am trying to do this:
```
.withColumn("System", when($"SysID".split("-").length > 3, $"SysID".split("-").take(3)).otherwise(null))
```
But I get the following error:
error: value split is not a member of org.apache.spark.sql.ColumnName
What can I do to use the split function?
Thank you. | 2020/02/05 | [
"https://Stackoverflow.com/questions/60077704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2227484/"
] | In pandas there exists a tail function:
```
>>> df = pd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion',
'monkey', 'parrot', 'shark', 'whale', 'zebra']})
>>> df.tail(1)
animal
8 zebra
```
(See: <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.tail.html... | You can also use [`take`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.take.html):
```
df['Salary'].take([-1])
``` |
60,077,704 | I am trying to do this:
```
.withColumn("System", when($"SysID".split("-").length > 3, $"SysID".split("-").take(3)).otherwise(null))
```
But I get the following error:
error: value split is not a member of org.apache.spark.sql.ColumnName
What can I do to use the split function?
Thank you. | 2020/02/05 | [
"https://Stackoverflow.com/questions/60077704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2227484/"
] | First of all I would advise against using get\_value since it is/will be deprecated. (see: <https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.DataFrame.get_value.html> )
There are a couple of solutions:
```
df['Salary'].iloc[-1]
df.Salary.iloc[-1]
```
are synonymous. Iloc is the way to retrieve ... | This will select salary in the last row.
```
df['Salary'][-1]
``` |
60,077,704 | I am trying to do this:
```
.withColumn("System", when($"SysID".split("-").length > 3, $"SysID".split("-").take(3)).otherwise(null))
```
But I get the following error:
error: value split is not a member of org.apache.spark.sql.ColumnName
What can I do to use the split function?
Thank you. | 2020/02/05 | [
"https://Stackoverflow.com/questions/60077704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2227484/"
] | This will select salary in the last row.
```
df['Salary'][-1]
``` | You can also use [`take`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.take.html):
```
df['Salary'].take([-1])
``` |
60,077,704 | I am trying to do this:
```
.withColumn("System", when($"SysID".split("-").length > 3, $"SysID".split("-").take(3)).otherwise(null))
```
But I get the following error:
error: value split is not a member of org.apache.spark.sql.ColumnName
What can I do to use the split function?
Thank you. | 2020/02/05 | [
"https://Stackoverflow.com/questions/60077704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2227484/"
] | First of all I would advise against using get\_value since it is/will be deprecated. (see: <https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.DataFrame.get_value.html> )
There are a couple of solutions:
```
df['Salary'].iloc[-1]
df.Salary.iloc[-1]
```
are synonymous. Iloc is the way to retrieve ... | You can also use [`take`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.take.html):
```
df['Salary'].take([-1])
``` |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | Short answer was given on the otherside.
Longer answer is that you can't: you will be missing request headers and POST bodies. | If only GET requests are needed and there is no session-tracking implemented via query parameters, then this is possible.
One question: do you want to do it this way because (1) you want to emulate real-world distribution of traffic among your pages or (2) there are too many pages to even consider building any sort of... |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | A quick scan on Google for this yielded an interesting blog entry with subsequent, useful comments are at <http://www.igvita.com/2008/09/30/load-testing-with-log-replay/>. A commenter also mentioned [Tsung by Process-One](http://tsung.erlang-projects.org/) that allows for recording sessions real-time, with the obvious ... | Short answer was given on the otherside.
Longer answer is that you can't: you will be missing request headers and POST bodies. |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | Been here lately. I figured that if I dumped tcp traffic with tcpdump I could rewrite the destination of the packages and then replay it to the new app servers. So I started out with something like this:
```
tcpdump -i eth1 dst -s 0 -w - port 80 | \
tcprewrite --mtu-trunc --infile=- --outfile=- \
--dstipmap=<source_ip... | Short answer was given on the otherside.
Longer answer is that you can't: you will be missing request headers and POST bodies. |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | A quick scan on Google for this yielded an interesting blog entry with subsequent, useful comments are at <http://www.igvita.com/2008/09/30/load-testing-with-log-replay/>. A commenter also mentioned [Tsung by Process-One](http://tsung.erlang-projects.org/) that allows for recording sessions real-time, with the obvious ... | If only GET requests are needed and there is no session-tracking implemented via query parameters, then this is possible.
One question: do you want to do it this way because (1) you want to emulate real-world distribution of traffic among your pages or (2) there are too many pages to even consider building any sort of... |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | Here's a simple perl way to record real http traffic and play it back:
<http://patrick.net/sprocket/rwt.html> | If only GET requests are needed and there is no session-tracking implemented via query parameters, then this is possible.
One question: do you want to do it this way because (1) you want to emulate real-world distribution of traffic among your pages or (2) there are too many pages to even consider building any sort of... |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | Been here lately. I figured that if I dumped tcp traffic with tcpdump I could rewrite the destination of the packages and then replay it to the new app servers. So I started out with something like this:
```
tcpdump -i eth1 dst -s 0 -w - port 80 | \
tcprewrite --mtu-trunc --infile=- --outfile=- \
--dstipmap=<source_ip... | If only GET requests are needed and there is no session-tracking implemented via query parameters, then this is possible.
One question: do you want to do it this way because (1) you want to emulate real-world distribution of traffic among your pages or (2) there are too many pages to even consider building any sort of... |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | A quick scan on Google for this yielded an interesting blog entry with subsequent, useful comments are at <http://www.igvita.com/2008/09/30/load-testing-with-log-replay/>. A commenter also mentioned [Tsung by Process-One](http://tsung.erlang-projects.org/) that allows for recording sessions real-time, with the obvious ... | Here's a simple perl way to record real http traffic and play it back:
<http://patrick.net/sprocket/rwt.html> |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | A quick scan on Google for this yielded an interesting blog entry with subsequent, useful comments are at <http://www.igvita.com/2008/09/30/load-testing-with-log-replay/>. A commenter also mentioned [Tsung by Process-One](http://tsung.erlang-projects.org/) that allows for recording sessions real-time, with the obvious ... | Been here lately. I figured that if I dumped tcp traffic with tcpdump I could rewrite the destination of the packages and then replay it to the new app servers. So I started out with something like this:
```
tcpdump -i eth1 dst -s 0 -w - port 80 | \
tcprewrite --mtu-trunc --infile=- --outfile=- \
--dstipmap=<source_ip... |
4,118,303 | Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?
If it matters, webapp is written in P... | 2010/11/07 | [
"https://Stackoverflow.com/questions/4118303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46058/"
] | Been here lately. I figured that if I dumped tcp traffic with tcpdump I could rewrite the destination of the packages and then replay it to the new app servers. So I started out with something like this:
```
tcpdump -i eth1 dst -s 0 -w - port 80 | \
tcprewrite --mtu-trunc --infile=- --outfile=- \
--dstipmap=<source_ip... | Here's a simple perl way to record real http traffic and play it back:
<http://patrick.net/sprocket/rwt.html> |
73,104,014 | **I have a list as follows:**
```
list = ['a climber stops to take a drink while climbing a snow covered mountain ', 'a man holding a cup on a snow mountain ', 'a man in a yellow suit is holding up a cup while standing in snow ']
```
**Required Output**
```
reference1 = ['a', 'climber', 'tops', 'to', 'take', 'a', '... | 2022/07/25 | [
"https://Stackoverflow.com/questions/73104014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9751211/"
] | You can use list comprehension with `split`:
```py
lst = ['a climber stops to take a drink while climbing a snow covered mountain ', 'a man holding a cup on a snow mountain ', 'a man in a yellow suit is holding up a cup while standing in snow ']
refs = [sentence.split() for sentence in lst]
print(refs)
# [['a', 'cli... | Loop through the array and keep pushing into a new one, when it hits `mountain` push it and break the loop. |
73,104,014 | **I have a list as follows:**
```
list = ['a climber stops to take a drink while climbing a snow covered mountain ', 'a man holding a cup on a snow mountain ', 'a man in a yellow suit is holding up a cup while standing in snow ']
```
**Required Output**
```
reference1 = ['a', 'climber', 'tops', 'to', 'take', 'a', '... | 2022/07/25 | [
"https://Stackoverflow.com/questions/73104014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9751211/"
] | You can use `map`
```
reference1, reference2, reference3 = map(str.split, lst)
```
Output
```
# reference1 ['a', 'climber', 'stops', 'to', 'take', 'a', 'drink', 'while', 'climbing', 'a', 'snow', 'covered', 'mountain']
# reference2 ['a', 'man', 'holding', 'a', 'cup', 'on', 'a', 'snow', 'mountain']
# reference3 ['a',... | Loop through the array and keep pushing into a new one, when it hits `mountain` push it and break the loop. |
73,104,014 | **I have a list as follows:**
```
list = ['a climber stops to take a drink while climbing a snow covered mountain ', 'a man holding a cup on a snow mountain ', 'a man in a yellow suit is holding up a cup while standing in snow ']
```
**Required Output**
```
reference1 = ['a', 'climber', 'tops', 'to', 'take', 'a', '... | 2022/07/25 | [
"https://Stackoverflow.com/questions/73104014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9751211/"
] | You can use list comprehension with `split`:
```py
lst = ['a climber stops to take a drink while climbing a snow covered mountain ', 'a man holding a cup on a snow mountain ', 'a man in a yellow suit is holding up a cup while standing in snow ']
refs = [sentence.split() for sentence in lst]
print(refs)
# [['a', 'cli... | You can use a for loop and split each string by spaces
```
refs = []
for i in lst:
refs.append(i.split())
ref1, ref2, ref3 = refs
print(ref1)
# ['a', 'climber', 'stops', 'to', 'take', 'a', 'drink', 'while', 'climbing', 'a', 'snow', 'covered', 'mountain']
print(ref2)
# ['a', 'man', 'holding', 'a', 'cup', 'on', 'a... |
73,104,014 | **I have a list as follows:**
```
list = ['a climber stops to take a drink while climbing a snow covered mountain ', 'a man holding a cup on a snow mountain ', 'a man in a yellow suit is holding up a cup while standing in snow ']
```
**Required Output**
```
reference1 = ['a', 'climber', 'tops', 'to', 'take', 'a', '... | 2022/07/25 | [
"https://Stackoverflow.com/questions/73104014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9751211/"
] | You can use `map`
```
reference1, reference2, reference3 = map(str.split, lst)
```
Output
```
# reference1 ['a', 'climber', 'stops', 'to', 'take', 'a', 'drink', 'while', 'climbing', 'a', 'snow', 'covered', 'mountain']
# reference2 ['a', 'man', 'holding', 'a', 'cup', 'on', 'a', 'snow', 'mountain']
# reference3 ['a',... | You can use a for loop and split each string by spaces
```
refs = []
for i in lst:
refs.append(i.split())
ref1, ref2, ref3 = refs
print(ref1)
# ['a', 'climber', 'stops', 'to', 'take', 'a', 'drink', 'while', 'climbing', 'a', 'snow', 'covered', 'mountain']
print(ref2)
# ['a', 'man', 'holding', 'a', 'cup', 'on', 'a... |
53,461,502 | my App component like as below:
```
class App extends Component {
clickHandler = () => {
console.log('click');
}
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person onClick={this.clickHandler}>Test2</Person>
</div>
);
}
}
```
... | 2018/11/24 | [
"https://Stackoverflow.com/questions/53461502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6746449/"
] | This should work. Why don't you want to write it this way? You ARE passing it as a prop...
```
<div onClick={props.onClick}>Test</div>
``` | ```
class Person extends Component {
render() {
return (
<div onClick={propes.onClick}>{props.children}</div>
)
}
}
``` |
53,461,502 | my App component like as below:
```
class App extends Component {
clickHandler = () => {
console.log('click');
}
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person onClick={this.clickHandler}>Test2</Person>
</div>
);
}
}
```
... | 2018/11/24 | [
"https://Stackoverflow.com/questions/53461502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6746449/"
] | Here is the complete solution...
Checkout: <https://codesandbox.io/s/vjp200rj3>
Modified render function in App.
```
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person clickHandler={this.clickHandler}>Test2</Person>
</div>
);
}
```
Mo... | ```
class Person extends Component {
render() {
return (
<div onClick={propes.onClick}>{props.children}</div>
)
}
}
``` |
53,461,502 | my App component like as below:
```
class App extends Component {
clickHandler = () => {
console.log('click');
}
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person onClick={this.clickHandler}>Test2</Person>
</div>
);
}
}
```
... | 2018/11/24 | [
"https://Stackoverflow.com/questions/53461502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6746449/"
] | This should work. Why don't you want to write it this way? You ARE passing it as a prop...
```
<div onClick={props.onClick}>Test</div>
``` | Here is the complete solution...
Checkout: <https://codesandbox.io/s/vjp200rj3>
Modified render function in App.
```
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person clickHandler={this.clickHandler}>Test2</Person>
</div>
);
}
```
Mo... |
53,461,502 | my App component like as below:
```
class App extends Component {
clickHandler = () => {
console.log('click');
}
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person onClick={this.clickHandler}>Test2</Person>
</div>
);
}
}
```
... | 2018/11/24 | [
"https://Stackoverflow.com/questions/53461502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6746449/"
] | This should work. Why don't you want to write it this way? You ARE passing it as a prop...
```
<div onClick={props.onClick}>Test</div>
``` | You need to pass `onClick` to the `<div>` in `Person`.
`onClick` is not a special prop that works everywhere in React - The only intrinsic props are `key` and `children`. Everything else needs to be wired up manually.
The reason your code doesn't work is because you're passing `onClick` to `Person`, but to the `Perso... |
53,461,502 | my App component like as below:
```
class App extends Component {
clickHandler = () => {
console.log('click');
}
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person onClick={this.clickHandler}>Test2</Person>
</div>
);
}
}
```
... | 2018/11/24 | [
"https://Stackoverflow.com/questions/53461502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6746449/"
] | Here is the complete solution...
Checkout: <https://codesandbox.io/s/vjp200rj3>
Modified render function in App.
```
render() {
return (
<div className="App">
<div onClick={this.clickHandler}>Test1</div>
<Person clickHandler={this.clickHandler}>Test2</Person>
</div>
);
}
```
Mo... | You need to pass `onClick` to the `<div>` in `Person`.
`onClick` is not a special prop that works everywhere in React - The only intrinsic props are `key` and `children`. Everything else needs to be wired up manually.
The reason your code doesn't work is because you're passing `onClick` to `Person`, but to the `Perso... |
61,029,607 | Im fighting a segfault error that I can't understand : I have a recursive function that expands on an array representing pixels : starting on an index, it exepands around the index to create groups of pixels by calling the same function left right up and down (aka index -1, index +1...). For debuging purposes, I have a... | 2020/04/04 | [
"https://Stackoverflow.com/questions/61029607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10632776/"
] | >
> What I dont get is, I end up with a segfault during the recursion at the recrusive call itself (I get the print that is just before the call, but not the one at function start).
>
>
>
That is an almost sure sign of stack exhaustion.
Run your program under debugger, and examine the *instruction* which causes s... | It seems the first boundary check in your code should be:
```
if( j >= sizeX * sizeY )
```
and not
```
if( j > sizeX * sizeY )
```
(As the last element of your array is array[size - 1] and not array[size]) |
104,522 | I recently ate at a Mexican restaurant with a delicious sauce. They were willing to sell it to me if I put in a special order, but they insisted it was so easy to make that I should just make it myself instead. I know the ingredients are jalapenos, habaneros, onions, and garlic. There is no water or anything else, just... | 2020/01/03 | [
"https://cooking.stackexchange.com/questions/104522",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/51763/"
] | If it is instant oatmeal, just add boiling water (ratio water to oats 2/1) and let it sit for 5 minutes. If it not instant, same ratio of water to oats, boil for 5 minutes while stirring, remove from heat, cover and let sit for 5 minutes.
I googled "how to cook oatmeal" and found several similiar ways. | Common "rolled" oats are flattened into fat disc-shaped units; "quick" oats are rolled and then further sliced thin to cook faster. "Steel cut" oats are just cut into small hard pieces like short rice grains.
For quick oats, add about 2:1 water to oats, and cook until done to desired softness, which should be a few mi... |
122,749 | I've been creating snapins with the new MMC 3.0 classes and C#. I can't seem to find any examples of how to get rid of the "Console Root" node when creating the \*.msc files. I looked through the examples in the SDK, but I can't seem to find anything for this.
I have seen other snapins that do what I want, but I can't... | 2008/09/23 | [
"https://Stackoverflow.com/questions/122749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12829/"
] | If I've understood you correctly, this isn't specific to MMC3, but it did take me a while to realise. Right-click on the node, and click `New Window from Here`. Then switch back to the Console Root window, and close it (Ctrl+F4).
Inside the .msc, it's //View/BookMark/@NodeID, which needs to be "2" (etc.), instead of "... | As far as I know, MMC always shows the Console Root. Even if you open it with no snap-in, you will still see the Console Root. Snap ins are only added under it, and several could be loaded at the same time and they would all be under the console root which is simply the root of the tree. |
122,749 | I've been creating snapins with the new MMC 3.0 classes and C#. I can't seem to find any examples of how to get rid of the "Console Root" node when creating the \*.msc files. I looked through the examples in the SDK, but I can't seem to find anything for this.
I have seen other snapins that do what I want, but I can't... | 2008/09/23 | [
"https://Stackoverflow.com/questions/122749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12829/"
] | I know this is an older post, so maybe a response is not necessary but what you're trying to do requires saving a customized MSC file. As one reply states, add your SnapIn, select Open new window from here, then save the MSC file. This is your console configured to show your SnapIn as the RootNode rather than the Conso... | As far as I know, MMC always shows the Console Root. Even if you open it with no snap-in, you will still see the Console Root. Snap ins are only added under it, and several could be loaded at the same time and they would all be under the console root which is simply the root of the tree. |
122,749 | I've been creating snapins with the new MMC 3.0 classes and C#. I can't seem to find any examples of how to get rid of the "Console Root" node when creating the \*.msc files. I looked through the examples in the SDK, but I can't seem to find anything for this.
I have seen other snapins that do what I want, but I can't... | 2008/09/23 | [
"https://Stackoverflow.com/questions/122749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12829/"
] | If I've understood you correctly, this isn't specific to MMC3, but it did take me a while to realise. Right-click on the node, and click `New Window from Here`. Then switch back to the Console Root window, and close it (Ctrl+F4).
Inside the .msc, it's //View/BookMark/@NodeID, which needs to be "2" (etc.), instead of "... | I know this is an older post, so maybe a response is not necessary but what you're trying to do requires saving a customized MSC file. As one reply states, add your SnapIn, select Open new window from here, then save the MSC file. This is your console configured to show your SnapIn as the RootNode rather than the Conso... |
44,339 | I have a Windows XP/Debian Squeeze (XFCE desktop) dual-boot set up on a Dell Latitude laptop. The Windows XP portion boots fine. However, sometimes the Debian portion does not boot. If it doesn't boot, and I do a hard reboot, it will boot the second time. However, sometimes Debian will boot the first time.
How can I d... | 2012/07/30 | [
"https://unix.stackexchange.com/questions/44339",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/21321/"
] | AFAIK this is the graphics driver that is causing the problem. Can you boot to console in failsafe (recovery mode)? Check and regenerate your `xorg.conf` file, make sure all the settings are right. | This is probably a buggy driver, now the problem is to find out which.
The first thing to investigate is to look at the logs: `/var/log/kern.log` and `/var/log/Xorg.0.log`. Note that that latter file is restared each time you boot; if you've rebooted into X since the failure, the previous log will be in `/var/log/Xorg.... |
52,360,390 | I create an angular6 library call mapModule, and be imported into app module, now I want to do something before load mapModule, so I try to add **APP\_INITIALIZER** in this library :
```
export function StartupServiceFactory2(mapConfigService: MapConfigService) {
const x = 2 + 2;
console.log(x);
return ()... | 2018/09/17 | [
"https://Stackoverflow.com/questions/52360390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6408449/"
] | This is easier to achieve if you use a string prop instead of a slot, but then using the component in a template can become messy if the content is long.
If you write the render function by hand then you have more control over how the component should be rendered:
```
export default {
render(h) {
const slot = t... | You can use `$slots`(<https://v2.vuejs.org/v2/api/#vm-slots>):
```
export default {
methods: {
changeSlotStructure() {
let slot = this.$slots.default;
slot.map((x, i) => {
if(x.text.includes('title')) {
this.$slots.default[i].tag = "h1"
... |
131,534 | So here is the ugliest fragment of my application, I tried to reformat as much as I could but I think it's still pretty ugly.
Basically, I'm trying to use an API call to receive JSON which tells me what type of field to create dynamically (Edit text, checkbox, Multiple choice, single choice). And then, I add them dyn... | 2016/06/09 | [
"https://codereview.stackexchange.com/questions/131534",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/108565/"
] | 1. Layouts. Your biggest savings (in terms of line count) is going to be had by inflating XML layouts.
2. By hardcoding dimensions in Java, all your sizes are going to un-scaled (so you're saying margin 30px somewhere - that's going to look wildly different on different screens). If you use XML layouts (per #1), the sy... | I agree with [@mdd-sbo's answer](https://codereview.stackexchange.com/a/131548/9381)
Also:
* The lifecycle of several fields seem to be longer than needed. In particular `obj`.
* Use a `SparseArray` rather than a `Map<Integer, String>` when the mapping is not enormous
* I prefer `"date".equalsIgnoreCase(type)` rather... |
2,403,012 | I'm having some trouble with this statement, owing no doubt to my ignorance of what is returned from this select statement:
```
declare @myInt as INT
set @myInt = (select COUNT(*) from myTable as count)
if(@myInt <> 0)
begin
print 'there's something in the table'
end
```
There are records in myTable, but when I... | 2010/03/08 | [
"https://Stackoverflow.com/questions/2403012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172617/"
] | If @myInt is zero it means no rows in the table: it would be NULL if never set at all.
COUNT will always return a row, even for no rows in a table.
Edit, Apr 2012: the rules for this are described in my answer here:[Does COUNT(\*) always return a result?](https://stackoverflow.com/questions/2552086/does-count-alway... | ```
select @myInt = COUNT(*) from myTable
``` |
2,403,012 | I'm having some trouble with this statement, owing no doubt to my ignorance of what is returned from this select statement:
```
declare @myInt as INT
set @myInt = (select COUNT(*) from myTable as count)
if(@myInt <> 0)
begin
print 'there's something in the table'
end
```
There are records in myTable, but when I... | 2010/03/08 | [
"https://Stackoverflow.com/questions/2403012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172617/"
] | ```
select @myInt = COUNT(*) from myTable
``` | ```
Declare @MyInt int
Set @MyInt = ( Select Count(*) From MyTable )
If @MyInt > 0
Begin
Print 'There''s something in the table'
End
```
I'm not sure if this is your issue, but you have to esacpe the single quote in the print statement with a second single quote. While you can use SELECT to populate the variable... |
2,403,012 | I'm having some trouble with this statement, owing no doubt to my ignorance of what is returned from this select statement:
```
declare @myInt as INT
set @myInt = (select COUNT(*) from myTable as count)
if(@myInt <> 0)
begin
print 'there's something in the table'
end
```
There are records in myTable, but when I... | 2010/03/08 | [
"https://Stackoverflow.com/questions/2403012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172617/"
] | ```
select @myInt = COUNT(*) from myTable
``` | [update] -- Well, my own foolishness provides the answer to this one. As it turns out, I was deleting the records from myTable before running the select COUNT statement.
How did I do that and not notice? Glad you asked. I've been testing a sql unit testing platform [(tsqlunit, if you're interested)](http://sourceforg... |
2,403,012 | I'm having some trouble with this statement, owing no doubt to my ignorance of what is returned from this select statement:
```
declare @myInt as INT
set @myInt = (select COUNT(*) from myTable as count)
if(@myInt <> 0)
begin
print 'there's something in the table'
end
```
There are records in myTable, but when I... | 2010/03/08 | [
"https://Stackoverflow.com/questions/2403012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172617/"
] | If @myInt is zero it means no rows in the table: it would be NULL if never set at all.
COUNT will always return a row, even for no rows in a table.
Edit, Apr 2012: the rules for this are described in my answer here:[Does COUNT(\*) always return a result?](https://stackoverflow.com/questions/2552086/does-count-alway... | ```
Declare @MyInt int
Set @MyInt = ( Select Count(*) From MyTable )
If @MyInt > 0
Begin
Print 'There''s something in the table'
End
```
I'm not sure if this is your issue, but you have to esacpe the single quote in the print statement with a second single quote. While you can use SELECT to populate the variable... |
2,403,012 | I'm having some trouble with this statement, owing no doubt to my ignorance of what is returned from this select statement:
```
declare @myInt as INT
set @myInt = (select COUNT(*) from myTable as count)
if(@myInt <> 0)
begin
print 'there's something in the table'
end
```
There are records in myTable, but when I... | 2010/03/08 | [
"https://Stackoverflow.com/questions/2403012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172617/"
] | If @myInt is zero it means no rows in the table: it would be NULL if never set at all.
COUNT will always return a row, even for no rows in a table.
Edit, Apr 2012: the rules for this are described in my answer here:[Does COUNT(\*) always return a result?](https://stackoverflow.com/questions/2552086/does-count-alway... | [update] -- Well, my own foolishness provides the answer to this one. As it turns out, I was deleting the records from myTable before running the select COUNT statement.
How did I do that and not notice? Glad you asked. I've been testing a sql unit testing platform [(tsqlunit, if you're interested)](http://sourceforg... |
2,403,012 | I'm having some trouble with this statement, owing no doubt to my ignorance of what is returned from this select statement:
```
declare @myInt as INT
set @myInt = (select COUNT(*) from myTable as count)
if(@myInt <> 0)
begin
print 'there's something in the table'
end
```
There are records in myTable, but when I... | 2010/03/08 | [
"https://Stackoverflow.com/questions/2403012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/172617/"
] | ```
Declare @MyInt int
Set @MyInt = ( Select Count(*) From MyTable )
If @MyInt > 0
Begin
Print 'There''s something in the table'
End
```
I'm not sure if this is your issue, but you have to esacpe the single quote in the print statement with a second single quote. While you can use SELECT to populate the variable... | [update] -- Well, my own foolishness provides the answer to this one. As it turns out, I was deleting the records from myTable before running the select COUNT statement.
How did I do that and not notice? Glad you asked. I've been testing a sql unit testing platform [(tsqlunit, if you're interested)](http://sourceforg... |
42,344,883 | I'm trying to create a query that has 3 columns: 1 column represents the list Job numbers (not nulls values), the 2° and 3rd column represents a sum of values respectively before and after a specific date
SQL Server gives an error and I really don't know how to work it around (except than create 2 queries..)
```
SELE... | 2017/02/20 | [
"https://Stackoverflow.com/questions/42344883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7441055/"
] | It seems you simply want to select records from EleGcImpianti and want related sums from EleGcPianificazioneRate:
```
SELECT
i.PiIndex,
COALESCE(pr.sum_after, 0) AS sum_after_date,
COALESCE(pr.sum_before, 0) AS sum_before_date
FROM EleGcImpianti i
LEFT JOIN
(
SELECT
PrIdImpianto,
SUM(CASE WHEN PrData... | Your query is syntactically invalid SQL: There is no table/view from which to collect the results (apart from within the subqueries).
The following (untested) query ...
* ... defines an indicator variable `after_cutoff` derived from the cutoff date condition
* ... deletes the base values for the summarions from the r... |
57,884,390 | So I am trying to re-learn some python by myself and a task wants me to make a list and put the elements that are less than 5 into another list,
```
a = []
b = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for element in b:
if ( b < 5 ):
a.append(b)
print (a)
``` | 2019/09/11 | [
"https://Stackoverflow.com/questions/57884390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12051604/"
] | `b` is the list here; `element` is the single element you're using in iteration.
```py
for element in b:
if element < 5:
a.append(element)
``` | You are comparing the entire list instead of the individual elements
Try:
```
if element < 5
``` |
409,019 | I have a WordPress website running on a Plesk 10.4 server and only this website on the server, and it started receiving huge traffic recently. How can I install nginx as a reverse proxy for the WordPress website?
Current config:
* Centos 5
* Plesk 10.4
* PHP 5
* MySQL
* Apache2 | 2012/07/18 | [
"https://serverfault.com/questions/409019",
"https://serverfault.com",
"https://serverfault.com/users/53134/"
] | Probably, the easiest way is to update the Plesk panel. Plesk 11 supports [nginx by default](http://download1.parallels.com/Plesk/PP11/11.0/release-notes/parallels-plesk-panel-11.0-for-linux-based-os.html). And you will be able to [enable it by pushing a button](http://download1.parallels.com/Plesk/PP11/11.0/Doc/en-US/... | If you're getting traffic spikes on a WordPress website, switching to nginx is probably not the first thing you should do.
The first thing to do is to install some WordPress-specific caching mechanism. My favorite is the [W3 Total Cache](http://wordpress.org/extend/plugins/w3-total-cache/) plugin. This will help you b... |
1,694,125 | I'm looking for the best way to design a shopping cart. I'm at a crossroads with how to handle a product that has multiple options being color and size. The main issue being inventory management for the colors and sizes.
Currently on admin panel:
textfield for color
textfield for quantity
User seperates colors by c... | 2009/11/07 | [
"https://Stackoverflow.com/questions/1694125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168202/"
] | I'm not quit sure I understand your question but I think you are looking for suggestions on how to data model this and how to represent arrays of data from this model as strings that can be manipulated browser-side.
For the data model, it sounds like you need a 5 tables:
1) Product, 2) Color, 3) Size, 4) an associati... | Why not start by exploring how open source shopping carts have handled similar tasks. [osCommerce](http://www.oscommerce.com/solutions/downloads) is one that comes to mind. |
1,694,125 | I'm looking for the best way to design a shopping cart. I'm at a crossroads with how to handle a product that has multiple options being color and size. The main issue being inventory management for the colors and sizes.
Currently on admin panel:
textfield for color
textfield for quantity
User seperates colors by c... | 2009/11/07 | [
"https://Stackoverflow.com/questions/1694125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168202/"
] | I'm not quit sure I understand your question but I think you are looking for suggestions on how to data model this and how to represent arrays of data from this model as strings that can be manipulated browser-side.
For the data model, it sounds like you need a 5 tables:
1) Product, 2) Color, 3) Size, 4) an associati... | Use 3NF
<http://www.troubleshooters.com/littstip/ltnorm.html>
<http://en.wikipedia.org/wiki/Third_normal_form> |
71,285,907 | Could someone explain what is the difference between those 2 ***v-for*** structures:
```html
<li v-for="item in items" :key="item">
</li>
```
and
```html
<li v-for="(item, i) in items" :key="i">
</li>
``` | 2022/02/27 | [
"https://Stackoverflow.com/questions/71285907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16790664/"
] | Vue requires all items inside a `v-for` to be "*key*-ed". The key is used to uniquely identify each element. This doesn't mean Vue will break if you don't use a `key`. It will warn it might not be able to detect all changes.
The *"key"* is particularly useful and important to Vue, as it allows it to skip re-rendering ... | In the first case, the v-for iterates over all elements of `items`. It assigns the `:key` to the item itself. This is not ideal if you have duplicate elements in `items`, because each `:key` should be unique.
In the second case, v-for also iterates over all elements of `items`, but it introduces another variable named... |
71,285,907 | Could someone explain what is the difference between those 2 ***v-for*** structures:
```html
<li v-for="item in items" :key="item">
</li>
```
and
```html
<li v-for="(item, i) in items" :key="i">
</li>
``` | 2022/02/27 | [
"https://Stackoverflow.com/questions/71285907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16790664/"
] | Vue requires all items inside a `v-for` to be "*key*-ed". The key is used to uniquely identify each element. This doesn't mean Vue will break if you don't use a `key`. It will warn it might not be able to detect all changes.
The *"key"* is particularly useful and important to Vue, as it allows it to skip re-rendering ... | As the purpose of `:key` attribute is to give `a hint for Vue virtual DOM algorithm about change detection happen`. Essentially, it helps Vue identify what's changed and what hasn't.
To understand it better I am adding the uses of both the scenarios **:**
* `:key="item"` - If item is having unique value. So that each... |
24,743,187 | I'm having some div boxes where there is an image inside. What I want it to do, is to add a class to the image if the image height is smaller than the div boxs height its inside.
But I have set the image to be a 100% width of the div box with css, so when I use jquery's .Height() on the image, it gives me the original... | 2014/07/14 | [
"https://Stackoverflow.com/questions/24743187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3661240/"
] | try
```
var currentContentHeight = contentElement.offsetHeight;
``` | You should use clientWidth & clientHeight.
```
var img = document.getElementById('imgProjekt1');
var width = img.clientWidth;
var height = img.clientHeight;
```
Edit:
```
$(window).load(function () {
var image = $('.boxe img');
var box = $(".boxe");
if (image[0].clientHeight > box[0].clientHeight) {
... |
24,743,187 | I'm having some div boxes where there is an image inside. What I want it to do, is to add a class to the image if the image height is smaller than the div boxs height its inside.
But I have set the image to be a 100% width of the div box with css, so when I use jquery's .Height() on the image, it gives me the original... | 2014/07/14 | [
"https://Stackoverflow.com/questions/24743187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3661240/"
] | try
```
var currentContentHeight = contentElement.offsetHeight;
``` | use window.getComputedStyle to get current DOM's object style value. Below is code example of how to extract height and width of dom object.
```
function Scale(width_offset, height_offset) {
var imgs = document.getElementsByClassName("your img tag class name");
for (var i = 0; i < imgs.length; i++) {
var c... |
29,434 | I am working specifically with Opportunities, but I assume that all closeDates are stored the same in SF.
If an Opportunity is closed at 10pm EST, March 4th; the time is 3am March 5th in UTC. Does Salesforce store the closed date as 2014-03-04 or 2014-03-05? And what timezone is that date for?
If your brain hurts, m... | 2014/03/05 | [
"https://salesforce.stackexchange.com/questions/29434",
"https://salesforce.stackexchange.com",
"https://salesforce.stackexchange.com/users/4888/"
] | You can do this in the action method you are using to move to the next page:
```
public PageReference next() {
if (quo.size() <= 1000) {
return Page.TheNextPage;
} else {
Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.Info,'Refine search Records should be less than 1000'));
... | Governor limits cannot be handled on Apex code and Visualforce page like other exceptions.
In you scenario you can check collection size in Apex controller and show error on visualforce page
In Code
```
List<Account> accToAddInSelectOption = [SELECT id FROM Account];
if(accToAddInSelectOption.size()>=1000)
{
Apexp... |
40,290,560 | Our errbot is providing links to JIRA tickets when it sees the right ticket patterns. Unfortunately, in slack it is common for users to edit their posts, and if both edits contain the JIRA ticket pattern, errbot provides the link twice, it is annoying.
Can I detect when a message is an edit as opposed to the original... | 2016/10/27 | [
"https://Stackoverflow.com/questions/40290560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132426/"
] | Now you can because from the .extra argument on the messages you can get the message ID from slack. | This is not currently possible (on any of the backends), no. For chat networks which allow editing of messages, errbot currently injects edited messages as a new message.
If you need this functionality, please open an issue on errbot's issue tracker so we can brainstorm about how to possibly introduce this functionali... |
40,290,560 | Our errbot is providing links to JIRA tickets when it sees the right ticket patterns. Unfortunately, in slack it is common for users to edit their posts, and if both edits contain the JIRA ticket pattern, errbot provides the link twice, it is annoying.
Can I detect when a message is an edit as opposed to the original... | 2016/10/27 | [
"https://Stackoverflow.com/questions/40290560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132426/"
] | Now you can because from the .extra argument on the messages you can get the message ID from slack. | My bot watches for and expands references to Jira issues too; one of the things I did was keep track of how many messages had been seen in the channel, and when the last time was that I responded to any given issue. Issues expanded within the last N (I use 10) messages are ignored. That way, if they edit the issue key ... |
8,996,168 | I'm developing a messaging system and I would like to display when a user is typing or not. How I figured I would do it is just have a table in my database called "typing" with the columns for who is typing and who they're typing to and the time. Every time they press a key in the input field I would post to the databa... | 2012/01/25 | [
"https://Stackoverflow.com/questions/8996168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/938745/"
] | Why don't we shift your thinking a little. Put the burden on the client, not the server, for the typing.
After the *first* keypress, send an event to the server, and start a timeout. After 5 seconds, we will say we aren't typing any more. If there is another keypress, we erase the old timeout, and start a new one. Thi... | Every five seconds or so, check if the contents of the text input are blank. If there is text, mark the user as typing.
The only disadvantage is this is that leaving a message half-typed will mark the user as typing until they either close the window, realise and come back to send it, or clear it out. But you can dete... |
8,996,168 | I'm developing a messaging system and I would like to display when a user is typing or not. How I figured I would do it is just have a table in my database called "typing" with the columns for who is typing and who they're typing to and the time. Every time they press a key in the input field I would post to the databa... | 2012/01/25 | [
"https://Stackoverflow.com/questions/8996168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/938745/"
] | Why don't we shift your thinking a little. Put the burden on the client, not the server, for the typing.
After the *first* keypress, send an event to the server, and start a timeout. After 5 seconds, we will say we aren't typing any more. If there is another keypress, we erase the old timeout, and start a new one. Thi... | Seems like a lot of overhead for something so simple, even if you are long polling (I hope). It really depends on the backend system connecting to sql. Have you considered using a web socket to do this? It is true full duplex communication. |
8,996,168 | I'm developing a messaging system and I would like to display when a user is typing or not. How I figured I would do it is just have a table in my database called "typing" with the columns for who is typing and who they're typing to and the time. Every time they press a key in the input field I would post to the databa... | 2012/01/25 | [
"https://Stackoverflow.com/questions/8996168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/938745/"
] | Why don't we shift your thinking a little. Put the burden on the client, not the server, for the typing.
After the *first* keypress, send an event to the server, and start a timeout. After 5 seconds, we will say we aren't typing any more. If there is another keypress, we erase the old timeout, and start a new one. Thi... | you could offload the typing state to something like memcache or redis as it doesn't matter if you lose the typing state for a user. and as you only need to read the value to tell others if the user was typing in the last 5 seconds. |
35,517,331 | I have two entities with following relationShip (these entities are taken for example purpose only)
```
public class Entity
{
public long ID { get; set; }
}
public class Doctor : Entity
{
public string Name {get; set;}
public string sprcialization { get; set;}
public string Icollection<JrDoctor> child... | 2016/02/20 | [
"https://Stackoverflow.com/questions/35517331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3859419/"
] | Generally, no, it doesn't. The reason of that behavior is that Lombok is an annotation processor for javac but when the kotlin compiler runs it uses javac as well but with no annotation processing so this is why kotlin don't see declarations that wasn't yet generated.
The only workaround for now is to define strict co... | As it was mentioned in comments above, delombok helps.
In case of maven build it would be:
```
<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>${lombok.version}.0</version>
<executions>
<execution>
<id>delombok</id>
<ph... |
35,517,331 | I have two entities with following relationShip (these entities are taken for example purpose only)
```
public class Entity
{
public long ID { get; set; }
}
public class Doctor : Entity
{
public string Name {get; set;}
public string sprcialization { get; set;}
public string Icollection<JrDoctor> child... | 2016/02/20 | [
"https://Stackoverflow.com/questions/35517331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3859419/"
] | Generally, no, it doesn't. The reason of that behavior is that Lombok is an annotation processor for javac but when the kotlin compiler runs it uses javac as well but with no annotation processing so this is why kotlin don't see declarations that wasn't yet generated.
The only workaround for now is to define strict co... | To add to Sergey Mashkov's response (adding here I don't have enough rep points to comment on it), here's an [example app](https://github.com/rojiani/kotlin-lombok-integration) of a Gradle multi-project setup where Kotlin can see the Lombok-generated code (without kapt or delomboking. Caveats do apply - namely, Kotlin ... |
35,517,331 | I have two entities with following relationShip (these entities are taken for example purpose only)
```
public class Entity
{
public long ID { get; set; }
}
public class Doctor : Entity
{
public string Name {get; set;}
public string sprcialization { get; set;}
public string Icollection<JrDoctor> child... | 2016/02/20 | [
"https://Stackoverflow.com/questions/35517331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3859419/"
] | Generally, no, it doesn't. The reason of that behavior is that Lombok is an annotation processor for javac but when the kotlin compiler runs it uses javac as well but with no annotation processing so this is why kotlin don't see declarations that wasn't yet generated.
The only workaround for now is to define strict co... | Looks like it works if you use delombok according to [site](http://awhitford.github.io/lombok.maven/lombok-maven-plugin/usage.html) and add the target/generated-sources/delombok folder in the pom.xml under build > plugins > plugin > kotlin-maven-plugin |
35,517,331 | I have two entities with following relationShip (these entities are taken for example purpose only)
```
public class Entity
{
public long ID { get; set; }
}
public class Doctor : Entity
{
public string Name {get; set;}
public string sprcialization { get; set;}
public string Icollection<JrDoctor> child... | 2016/02/20 | [
"https://Stackoverflow.com/questions/35517331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3859419/"
] | Generally, no, it doesn't. The reason of that behavior is that Lombok is an annotation processor for javac but when the kotlin compiler runs it uses javac as well but with no annotation processing so this is why kotlin don't see declarations that wasn't yet generated.
The only workaround for now is to define strict co... | There is a Kotlin compiler plugin for lombok. **It is still experimental** and it can be used with **Gradle** or **Maven**.
It only supports a hand full of annotations, including
* `@Getter`, `@Setter`
* `@NoArgsConstructor`, `@RequiredArgsConstructor`, and `@AllArgsConstructor`
* `@Data`
* `@With`
* `@Value`
Seem t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.