qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
65,257,848 | I just started using timber for logging on android, we are trying to add filenames/class-names to log message. I was able to add filenames in debug build using debug tree, but I'm not finding a way to add filenames in the release tree. Is there a possibility to add the filename in the release tree with R8 enabled? | 2020/12/11 | [
"https://Stackoverflow.com/questions/65257848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2657670/"
] | I got this error by having two different NavControllers in my compose hierarchy as a result of having a composable with a navController parameter:
`navController: NavController = rememberNavController()` but not setting it to a common, single root navController. | i had
```
app:launchSingleTop="true"
```
in my action
```
<action
android:id="@+id/action_confirmation_to_home_page"
app:destination="@id/nav_graph_home"
app:launchSingleTop="true"
app:popUpTo="@id/home_page_fragment"
app:popUpToInclusive="true" />
```
i removed it,... |
10,683,216 | Is there an easy way to pass an object from my controller to view to controller?
I tried *ViewData["compaignId"]* but that didn't work.
**Controller *"Content"* :**
```
ViewData["CompaignId"] = id;
```
**View *"Content"* :**
```
<div>
@Html.ActionLink("Go To Team Creation", "Team", ViewData["CompaignId"])
</d... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10683216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1395918/"
] | In general you should use a ViewModel for things like that. But you can use the `ViewBag` too.
```
ViewBag.CompaignId = id;
``` | You should take a look at [this overload](http://msdn.microsoft.com/en-us/library/dd492936.aspx)
```
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
Object routeValues
)
```
And you can pass [anonymous object](http://msdn.microsoft.com/en-us/lib... |
10,683,216 | Is there an easy way to pass an object from my controller to view to controller?
I tried *ViewData["compaignId"]* but that didn't work.
**Controller *"Content"* :**
```
ViewData["CompaignId"] = id;
```
**View *"Content"* :**
```
<div>
@Html.ActionLink("Go To Team Creation", "Team", ViewData["CompaignId"])
</d... | 2012/05/21 | [
"https://Stackoverflow.com/questions/10683216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1395918/"
] | U can use:
**Controller "Content" :**
```
ViewBag.CompaignId = id;
```
**View "Content" :**
```
<div>
@Html.ActionLink("Go To Team Creation", "Team", new
{
CompaignId = (long)ViewBag.CompaignId
})
</div>
```
**Controller "Team":**
```
public ActionResult Team(long CompaignId)
{
....
}... | You should take a look at [this overload](http://msdn.microsoft.com/en-us/library/dd492936.aspx)
```
public static MvcHtmlString ActionLink(
this HtmlHelper htmlHelper,
string linkText,
string actionName,
Object routeValues
)
```
And you can pass [anonymous object](http://msdn.microsoft.com/en-us/lib... |
47,074 | Game Programming is fun and interesting.
To develop games I have to learn several languages, game engines and should have sound knowledge in Math.
But what I'm really looking is how to be a **master** in **Game Programming**.
---
I have read a nice question and answer
* <https://softwareengineering.stackexchange... | 2013/01/09 | [
"https://gamedev.stackexchange.com/questions/47074",
"https://gamedev.stackexchange.com",
"https://gamedev.stackexchange.com/users/19664/"
] | Make games.
... that's all I've got. You want to master *anything*, you practice it until you have. That's all the other great game makers have done: make lots of games. The experienced people who frequent this site? Check their credentials, you'll see they've made a lot of games.
That's it. Practice makes perfect. | Make lots of games. If you really want to focus on mastering, you need depth and breadth. This means:
* Make different types of games. Pong has totally different challenges from a 2D RPG.
* Challenge yourself. Try to solve "hard" problems or technical growth (eg. different architectures, like an entity/component syste... |
47,798,440 | My gmail account I used to create my google cloud instance is johnsmith@gmail.com.
When I tried to connect to instance with WinSCP using "johnsmith" it failed, but it worked with "JOHN.SMITH"? Where can I find out my exact username for google cloud instance?
UPDATE. I tried web-based SSH and typed `whoami`, it return... | 2017/12/13 | [
"https://Stackoverflow.com/questions/47798440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1700890/"
] | Just to clarify, I presume you are trying to connect to a Compute Engine Windows Instance in your Google Cloud Platform project, is that correct?
In order to confirm the username of this instance I would recommend following these instructions:
1) Login to Google Cloud Platform Console at this link <https://console.c... | In GCP, I created Ubuntu 18.04 disk/instance (and created a discourse forum in it).
I found that when we create a new instance, there is a bar/panel on the right side of the screen, which showed our credentials to login into that instance/website. But I found no way to invoke that details screen again (I can remember t... |
47,798,440 | My gmail account I used to create my google cloud instance is johnsmith@gmail.com.
When I tried to connect to instance with WinSCP using "johnsmith" it failed, but it worked with "JOHN.SMITH"? Where can I find out my exact username for google cloud instance?
UPDATE. I tried web-based SSH and typed `whoami`, it return... | 2017/12/13 | [
"https://Stackoverflow.com/questions/47798440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1700890/"
] | Just to clarify, I presume you are trying to connect to a Compute Engine Windows Instance in your Google Cloud Platform project, is that correct?
In order to confirm the username of this instance I would recommend following these instructions:
1) Login to Google Cloud Platform Console at this link <https://console.c... | Using google cloud SDK shell, type the following command:
>
> gcloud compute ssh --project PROJECT\_ID --zone ZONE VM\_NAME
>
>
>
Replace the following:
```
PROJECT_ID: the ID of the project that contains the instance
ZONE: the name of the zone in which the instance is located
VM_NAME: the name of the instance
... |
47,798,440 | My gmail account I used to create my google cloud instance is johnsmith@gmail.com.
When I tried to connect to instance with WinSCP using "johnsmith" it failed, but it worked with "JOHN.SMITH"? Where can I find out my exact username for google cloud instance?
UPDATE. I tried web-based SSH and typed `whoami`, it return... | 2017/12/13 | [
"https://Stackoverflow.com/questions/47798440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1700890/"
] | Under Cloud Shell Session:
gcloud compute os-login describe-profile
You will see your username. | In GCP, I created Ubuntu 18.04 disk/instance (and created a discourse forum in it).
I found that when we create a new instance, there is a bar/panel on the right side of the screen, which showed our credentials to login into that instance/website. But I found no way to invoke that details screen again (I can remember t... |
47,798,440 | My gmail account I used to create my google cloud instance is johnsmith@gmail.com.
When I tried to connect to instance with WinSCP using "johnsmith" it failed, but it worked with "JOHN.SMITH"? Where can I find out my exact username for google cloud instance?
UPDATE. I tried web-based SSH and typed `whoami`, it return... | 2017/12/13 | [
"https://Stackoverflow.com/questions/47798440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1700890/"
] | Under Cloud Shell Session:
gcloud compute os-login describe-profile
You will see your username. | Using google cloud SDK shell, type the following command:
>
> gcloud compute ssh --project PROJECT\_ID --zone ZONE VM\_NAME
>
>
>
Replace the following:
```
PROJECT_ID: the ID of the project that contains the instance
ZONE: the name of the zone in which the instance is located
VM_NAME: the name of the instance
... |
50,300,724 | I am creating a normal ES6 class. The problem encountered is putting a variable inside the `class` encapsulation while keeping it outside of `constructor().`
You can replicate this error when you use this code:
```
class Polygon {
constructor() {
this.name = "Polygon";
var goodboy = "I lik... | 2018/05/11 | [
"https://Stackoverflow.com/questions/50300724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8419634/"
] | You can declare class level variables like so
```
class Polygon {
myVar = null;
constructor(args){
this.myVar = args.myVar;
}
}
let polygon = new Polygon({myVar:"some value"});
console.log(polygon.myVar); // "some value"
```
To accomplish this by transpiling with Babel you will need to use [transf... | >
> Cannot define variables outside of a class's constructor function
>
>
>
Yes, that's not syntactically valid.
>
> I'm putting a variable inside the `class` encapsulation while keeping it outside of `constructor()`.
>
>
>
That's not possible. A `class` does not provide any such encapsulation, it does not c... |
50,300,724 | I am creating a normal ES6 class. The problem encountered is putting a variable inside the `class` encapsulation while keeping it outside of `constructor().`
You can replicate this error when you use this code:
```
class Polygon {
constructor() {
this.name = "Polygon";
var goodboy = "I lik... | 2018/05/11 | [
"https://Stackoverflow.com/questions/50300724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8419634/"
] | I think, inside a class you can not declare a member directly, you need to use getter and setter. Otherwise you will get an error: "Unexpected token. A constructor, method, accessor, or property was expected."
Here is how you can get your badboy:
```
class Polygon {
constructor() {
this.name = "Polygon";
}
... | >
> Cannot define variables outside of a class's constructor function
>
>
>
Yes, that's not syntactically valid.
>
> I'm putting a variable inside the `class` encapsulation while keeping it outside of `constructor()`.
>
>
>
That's not possible. A `class` does not provide any such encapsulation, it does not c... |
50,300,724 | I am creating a normal ES6 class. The problem encountered is putting a variable inside the `class` encapsulation while keeping it outside of `constructor().`
You can replicate this error when you use this code:
```
class Polygon {
constructor() {
this.name = "Polygon";
var goodboy = "I lik... | 2018/05/11 | [
"https://Stackoverflow.com/questions/50300724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8419634/"
] | You can declare class level variables like so
```
class Polygon {
myVar = null;
constructor(args){
this.myVar = args.myVar;
}
}
let polygon = new Polygon({myVar:"some value"});
console.log(polygon.myVar); // "some value"
```
To accomplish this by transpiling with Babel you will need to use [transf... | ```
// adjusted
class Polygon
{
constructor()
{
this.name = "Polygon";
var goodboy = "I like pie...I can stay since I'm legal!";
}
}
var poly = new Polygon();
console.log(poly.name);
// option 2
// This works also
function Polygon2()
{
this.name ... |
50,300,724 | I am creating a normal ES6 class. The problem encountered is putting a variable inside the `class` encapsulation while keeping it outside of `constructor().`
You can replicate this error when you use this code:
```
class Polygon {
constructor() {
this.name = "Polygon";
var goodboy = "I lik... | 2018/05/11 | [
"https://Stackoverflow.com/questions/50300724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8419634/"
] | I think, inside a class you can not declare a member directly, you need to use getter and setter. Otherwise you will get an error: "Unexpected token. A constructor, method, accessor, or property was expected."
Here is how you can get your badboy:
```
class Polygon {
constructor() {
this.name = "Polygon";
}
... | ```
// adjusted
class Polygon
{
constructor()
{
this.name = "Polygon";
var goodboy = "I like pie...I can stay since I'm legal!";
}
}
var poly = new Polygon();
console.log(poly.name);
// option 2
// This works also
function Polygon2()
{
this.name ... |
6,177,411 | I want to autoplay my video on mouse over.
Can anybody tell me how to make it play via media player or flash player?
PS: Can I play WMV/ASF/MP4 in flash player? | 2011/05/30 | [
"https://Stackoverflow.com/questions/6177411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/680297/"
] | No. Each request will spawn a new process. Nothing survives between them.
You can retain state using sessions, which are essentially a disk-based serialization mechanism. Sessions them selves rely on cookies to identify the data between requests (But the data it self is stored in a file on the server). As such, they a... | `$visits` will be 1 in both case.
Singletons are per request and not per machine / host. Each request will have its own instance.
I don't think you can count the number of hits for one page without some kind of disk storage / database. |
30,833,080 | I am trying to create a simple alert dialogue and I am following the steps from this [link](http://developer.android.com/guide/topics/ui/dialogs.html)
However,I am getting the error: `getActivity() can't be resolved` After some search I understood that `getActivity()` can be user defined, but I am not sure what should ... | 2015/06/14 | [
"https://Stackoverflow.com/questions/30833080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3551661/"
] | getActivity() is fragments method to get Activity.
If u are in activity u just need to replace this by YourActivityClassName.this | ```
// in a fragment
new AlertDialog.Builder(getContext())
.setTitle("Alert title")
.setMessage("Alert Message")
.setCancelable(false)
.setPositiveButton("ok", new DialogInterface.OnClickListener() {
... |
62,408 | As a graduate student, I have recently supervised an undergraduate with their thesis work in co-operation with my own supervisor. I took care of the daily in-detail supervision, and my supervisor had the "grand overview" of the project and where it should lead to. This went on for almost 7 months.
Today, in roughly 3 ... | 2016/01/28 | [
"https://academia.stackexchange.com/questions/62408",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/6049/"
] | In general, supervisors should "acknowledge" their students more. We often forget to tell people when they are doing well and only point out mistakes.
Your supervisor should have most definitely acknowledged your help with the student. He should have thanked you for helping out with the student and ideally given you f... | I can think of three possibilities, in addition to StrongBad's "oversight" possibility, which are not necessarily exclusive of each other.
* He doesn't want your opinion because he needs and wants to form his own, independent opinion of the work in order to execute his function at the defense. The (lead) supervisor be... |
42,354,122 | ```
#include<iostream>
using namespace std;
class emp
{
public:
int en;
char name[10],des[10];
void get()
{
cout<<"enter emp no.";
cin>>en;
cout<<"enter emp name";
cin>>name;
cout<<"enter designation";
cin>>des;
}
};
class salary : public emp
{
public:
flo... | 2017/02/20 | [
"https://Stackoverflow.com/questions/42354122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7590114/"
] | `cin>>des[10];` reads *one* (single) character for standard input, and attempts to write it to `des[10]`. Unfortunately, you've defined `des` as having 10 characters, so only `des[0]` through `des[9]` are valid, so when it attempts to write to `des[10]`, you get undefined behavior.
My guess is that you probably wanted... | instead of name[10] and des[10], use cin >> name and cin >> des |
7,721,775 | Is there a fatser way to xor every column of a matrix than this?
```
mod(sum(matrix),2)
```
It converts from logical to double and uses the expensive modulo.
Update:
According to [this source](http://www.mathworks.com/matlabcentral/newsreader/view_thread/246073), summing uint's is slower than summing doubles becau... | 2011/10/11 | [
"https://Stackoverflow.com/questions/7721775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/907578/"
] | I tried to avoid the cast to `double` but it's not better (often worse).
```
A = rand(2000000, 1) > 0.5;
class(A)
tic
B = mod(sum(A),2)
toc
tic
C = mod(sum(uint32(A),'native'),2)
toc
tic
D = bitand(sum(uint32(A),'native'),1)
toc
```
The `native` option of sum allow you to keep the type of the argument in the res... | In addition to what @ClementJ says, I tried
```
tic
E = A(1)
for i = 2:numel(A)
E = xor(y, A(i));
end
E
toc
```
hoping the accelerator would help, but it doesn't (much), and
```
tic
F = num2cell(A);
F = xor(F{:})
toc
```
which doesn't actually work because XOR only allows 2 inputs.
MATLAB's double precision ... |
73,290,974 | I feel like that question has been asked a few times already but I haven't been able to find an answer to that specific use case.
Here's what I want:
[](https://i.stack.imgur.com/WVgoU.png)
I think the closest post/answer I've been able to find is [... | 2022/08/09 | [
"https://Stackoverflow.com/questions/73290974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2398593/"
] | If you can fix the width of your left column then you can use absolute positioning on your middle divs to get the overflow you want:
```css
html,
body {
display: block;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.wrapper {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
... | I think this demo should solve the issue.
[stackblitz-demo](https://stackblitz.com/edit/web-platform-z26z9p?file=index.html)
The trick is to hide the overflow on the body, but only make it to auto on the div you want to scroll in. Then you have to define the height you want that div to be and you should be able to scr... |
73,290,974 | I feel like that question has been asked a few times already but I haven't been able to find an answer to that specific use case.
Here's what I want:
[](https://i.stack.imgur.com/WVgoU.png)
I think the closest post/answer I've been able to find is [... | 2022/08/09 | [
"https://Stackoverflow.com/questions/73290974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2398593/"
] | If you can fix the width of your left column then you can use absolute positioning on your middle divs to get the overflow you want:
```css
html,
body {
display: block;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
.wrapper {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
... | The height and position attributes are the main things you should play around with.
```css
html,
body {
display: block;
width: 100%;
height: 100%;
max-height: 100vh;
margin: 0;
padding: 0;
}
.wrapper {
width: 100%;
height: 80%;
display: flex;
... |
59,053,764 | I want to do something like this (similar to the Accordion in react bootstrap):
```
class Foo extends React.Component{
static Button;
static Content;
render(){
return(
<div>
<Foo.Button/>
<Foo.Content/>
</div>
);
}
}
```
so that I can use it like thi... | 2019/11/26 | [
"https://Stackoverflow.com/questions/59053764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8634687/"
] | Have you tried adding:
```
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("headless");
``` | Ok, after some investigation, it should be:
```
using System.Linq;
using OpenQA.Selenium.Chrome;
using Scripting;
using System.IO;
namespace WebDriverTest
{
class Program
{
static void Main(string[] args)
{
var chromeOptions = new ChromeOptions();
chromeOptions.AddArgu... |
12,366,716 | ```
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"><script>
<script>
$(document).ready(function()
{
$('.sss').filter(':nth-child(n+2)').hide();
$('.sss').on('mouseenter', '.question', function()
{
$(this).next().slideDown(200).siblings('.answer').slideUp(... | 2012/09/11 | [
"https://Stackoverflow.com/questions/12366716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1043575/"
] | Try this:
```
$('.sss').children().filter(':nth-child(n+2)').hide();
```
If you need all `question` div then try:
```
$('.sss').children(':nth-child(2n)').hide();
```
***OR***
```
$('.sss .question').hide();
```
and for all `answer`:
```
$('.sss').children(':nth-child(2n+1)').hide();
```
***OR***
```
$('.s... | Here is an alternative not using filter:
```
$('.sss').children(':nth-child(n+2)').hide();
``` |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | EAMann,
I know this is a physics site, and you are looking for a physics answer; but I noticed that you are in Portland, Oregon. It seems amazing to me that you can not find a site reasonably close.
If nothing is closer, it seems to me that one of your beautiful beaches would make a nice launch site. That is (IIRC) m... | I found [this water rocket video](http://www.youtube.com/watch?v=CAAhQ6xcAnw), which appears to attain sufficient altitude. The group that makes them has a nice website and [tutorial](http://www.aircommandrockets.com/).
Perhaps launching black powder based rockets from a boat might be an alternative solution. |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | I found [this water rocket video](http://www.youtube.com/watch?v=CAAhQ6xcAnw), which appears to attain sufficient altitude. The group that makes them has a nice website and [tutorial](http://www.aircommandrockets.com/).
Perhaps launching black powder based rockets from a boat might be an alternative solution. | This doesn't answer the question, but it does solve the problem. Do it on the 4th of July along side your neighbors who (I assume) will also be launching bottle rockets etc. Here in South Carolina it sounds like a war zone on the 4th from about 8-12pm. It that doesn't work, maybe ask to do it before/after a fireworks d... |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | I found [this water rocket video](http://www.youtube.com/watch?v=CAAhQ6xcAnw), which appears to attain sufficient altitude. The group that makes them has a nice website and [tutorial](http://www.aircommandrockets.com/).
Perhaps launching black powder based rockets from a boat might be an alternative solution. | You can also take a look at the line of model rockets called the Micro Maxx series and similar. They are made by the [Model Aerospace Company](http://www.modelaerospace.com/macmicro.php), and have a max launch height of 80 feet. These could be launched in just about any large, empty parking lot or baseball field (Barri... |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | EAMann,
I know this is a physics site, and you are looking for a physics answer; but I noticed that you are in Portland, Oregon. It seems amazing to me that you can not find a site reasonably close.
If nothing is closer, it seems to me that one of your beautiful beaches would make a nice launch site. That is (IIRC) m... | This doesn't answer the question, but it does solve the problem. Do it on the 4th of July along side your neighbors who (I assume) will also be launching bottle rockets etc. Here in South Carolina it sounds like a war zone on the 4th from about 8-12pm. It that doesn't work, maybe ask to do it before/after a fireworks d... |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | EAMann,
I know this is a physics site, and you are looking for a physics answer; but I noticed that you are in Portland, Oregon. It seems amazing to me that you can not find a site reasonably close.
If nothing is closer, it seems to me that one of your beautiful beaches would make a nice launch site. That is (IIRC) m... | You really need to look into Water Rockets as the ideal solution to your problem. In addition to being cold and the opposite of flame/fire, they are dirt cheap and very easy to make. The coolest thing about them is that they can be a lot more powerful than the little pyro rockets you have been using, so you can put som... |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | EAMann,
I know this is a physics site, and you are looking for a physics answer; but I noticed that you are in Portland, Oregon. It seems amazing to me that you can not find a site reasonably close.
If nothing is closer, it seems to me that one of your beautiful beaches would make a nice launch site. That is (IIRC) m... | You can also take a look at the line of model rockets called the Micro Maxx series and similar. They are made by the [Model Aerospace Company](http://www.modelaerospace.com/macmicro.php), and have a max launch height of 80 feet. These could be launched in just about any large, empty parking lot or baseball field (Barri... |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | You really need to look into Water Rockets as the ideal solution to your problem. In addition to being cold and the opposite of flame/fire, they are dirt cheap and very easy to make. The coolest thing about them is that they can be a lot more powerful than the little pyro rockets you have been using, so you can put som... | This doesn't answer the question, but it does solve the problem. Do it on the 4th of July along side your neighbors who (I assume) will also be launching bottle rockets etc. Here in South Carolina it sounds like a war zone on the 4th from about 8-12pm. It that doesn't work, maybe ask to do it before/after a fireworks d... |
9,543 | Does the nature of the assortment of virtual particles depend upon the warping of spacetime in a direct manner ? | 2011/05/06 | [
"https://physics.stackexchange.com/questions/9543",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/14207/"
] | You really need to look into Water Rockets as the ideal solution to your problem. In addition to being cold and the opposite of flame/fire, they are dirt cheap and very easy to make. The coolest thing about them is that they can be a lot more powerful than the little pyro rockets you have been using, so you can put som... | You can also take a look at the line of model rockets called the Micro Maxx series and similar. They are made by the [Model Aerospace Company](http://www.modelaerospace.com/macmicro.php), and have a max launch height of 80 feet. These could be launched in just about any large, empty parking lot or baseball field (Barri... |
8,638,775 | I have a problem I'm hoping someone has come across and can help. I had a similar question posted (solved), but have had no further help with a new issue, so I thought I'd post with that question (sorry if this is taboo).
```
<table border="1" class="autoTable">
<tr>
<td>Description</td><td>Stocked</td><td>Qua... | 2011/12/26 | [
"https://Stackoverflow.com/questions/8638775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1112780/"
] | I don't see where the classes `add_to_total`, `quantity`, `part`, `hours`, `rate` or `is_total` are in your HTML, or which elements you're trying to select in your Javascript as a result...hope this helps...
***EDIT:***
Thinking about it again, it might be as a result of the newly-added rows' `add_to_total` classed e... | Thanks to Chris' suggestion, I moved the `row.find(".is_total").val(total);` associated to the row. In his suggestion, he had it outside the element where it was declared, so I *think* the function didn't know what we were talking about.
I also changed the
`$(".add_to_total").change(function() {`
to:
`$(".ad... |
9,342 | I have written a library. It compiles. It has basic unit tests. - One could say it works.
However, I would like to improve the usability of the API and get general feedback.
Am I allowed to open a question about the library in codereview? I was not sure, being that I do not really have a concrete question on what I wa... | 2019/09/21 | [
"https://codereview.meta.stackexchange.com/questions/9342",
"https://codereview.meta.stackexchange.com",
"https://codereview.meta.stackexchange.com/users/209950/"
] | >
> I'm not asking to review the code
>
>
>
This alone dismisses the idea of a meta-review as invalid, for me. We only review code. The OP could easily just post the new code and receive valuable feedback about it. Whether that's feedback about portions of the new code that have been affected by the changeset or p... | We have a tag [comparative-review](https://codereview.stackexchange.com/questions/tagged/comparative-review "show questions tagged 'comparative-review'"). I believe this indicates that we do support these kinds of reviews. The user went one step further by including the git diff; I don't see that as a problem. |
1,771,057 | strange bug:
i have an ajax datepicker added to a text box of my form.
i submit the form.. and I could receive all values excepting those of the datepicker checkboxes.
why is the .Text property empty of this elements?
Thanks | 2009/11/20 | [
"https://Stackoverflow.com/questions/1771057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/141235/"
] | Is your TextBox disabled for user input, so that it might only be changed by javascript, by the datepicker?
The problem in that case, is that .NET "knows" that the control is disabled, and just assumes that the value cannot, then, have changed since it was rendered. So .NET will use the ViewStated value immediately, w... | Try accessing SelectedDate instead of Text. |
50,544,555 | How would I execute command like this from the Controller?
Package I am using that gives the below artisan commands: <https://github.com/JosephSilber/page-cache>
```
php artisan page-cache:clear {slug}
```
For example if typed manually:
```
php artisan page-cache:clear about-us
```
Laravel docs gives us this:
<h... | 2018/05/26 | [
"https://Stackoverflow.com/questions/50544555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1080420/"
] | In the end, I discovered some requests sent to my auth service which didn't set the session cookie, for some paths it wasn't even supposed to be used.
So I defined those paths related to session with:
```js
const sessionPaths = ['/path1', '/path2', ...];
app.use(sessionPaths, session(sessionOptions));
app.use(sessionP... | I had run in to the same issue a few days back! I have set up my repo and sharing my link to the same! It works perfect! Do check it out.
<https://github.com/ritwbanerjee/angular-node-seed> |
50,544,555 | How would I execute command like this from the Controller?
Package I am using that gives the below artisan commands: <https://github.com/JosephSilber/page-cache>
```
php artisan page-cache:clear {slug}
```
For example if typed manually:
```
php artisan page-cache:clear about-us
```
Laravel docs gives us this:
<h... | 2018/05/26 | [
"https://Stackoverflow.com/questions/50544555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1080420/"
] | Not sure if this is completely solved but given the order of how you lay it out, you might have the cors handler after the session handler. As the preflight requests come in a session is possibly being created for each of those as there is no session cookie or credentials being sent. The simple fix is to move the cors ... | I had run in to the same issue a few days back! I have set up my repo and sharing my link to the same! It works perfect! Do check it out.
<https://github.com/ritwbanerjee/angular-node-seed> |
50,544,555 | How would I execute command like this from the Controller?
Package I am using that gives the below artisan commands: <https://github.com/JosephSilber/page-cache>
```
php artisan page-cache:clear {slug}
```
For example if typed manually:
```
php artisan page-cache:clear about-us
```
Laravel docs gives us this:
<h... | 2018/05/26 | [
"https://Stackoverflow.com/questions/50544555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1080420/"
] | Not sure if this is completely solved but given the order of how you lay it out, you might have the cors handler after the session handler. As the preflight requests come in a session is possibly being created for each of those as there is no session cookie or credentials being sent. The simple fix is to move the cors ... | In the end, I discovered some requests sent to my auth service which didn't set the session cookie, for some paths it wasn't even supposed to be used.
So I defined those paths related to session with:
```js
const sessionPaths = ['/path1', '/path2', ...];
app.use(sessionPaths, session(sessionOptions));
app.use(sessionP... |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | You should use a `for` loop instead of a `foreach` loop like so:
```
for($i = 0; $i < count($children); $i+=2) {
$child1 = $children[$i];
$child2 = $children[$i+1];
// print both
}
```
if you may have an odd number of children you have to check if `$i+1 < count($children)` before printing it. | Try this
```
$i = 1;
//Build custom items
foreach($children as $child){
if($i>2){
$i =1;
}
if ($i==2) {
//close row
}
$i++;
}
``` |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | you're almost there:
```
//Build custom items
echo "<row>";
$i = 0;
foreach($children as $child) {
echo "item ";
$i++;
if ($i % 2 == 0 && $i != count($children)) {
echo "</row><row>";
}
}
echo "</row>"
``` | >
> This is in Wordpress but understands it and it will help you.
>
>
>
```
<?php $query = new WP_Query( array( 'post_type' => 'slides', 'order'=> 'DESC', 'post_status' => 'publish', 'posts_per_page' => -1) );
$posts = $query->posts;
$numOfCols = 2;
$rowCount = 0;
... |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | ```
# Process every second item starting with the first one [0].
foreach ($array as $key => $value) {
if (($key - 1) % 2 === 0) {
continue;
}
# Do something here.
}
``` | Try this
```
$i = 1;
//Build custom items
foreach($children as $child){
if($i>2){
$i =1;
}
if ($i==2) {
//close row
}
$i++;
}
``` |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | you're almost there:
```
//Build custom items
echo "<row>";
$i = 0;
foreach($children as $child) {
echo "item ";
$i++;
if ($i % 2 == 0 && $i != count($children)) {
echo "</row><row>";
}
}
echo "</row>"
``` | Or this:
```
<?php
$i=0;
foreach($children as $child){
++$i;
if($i==1){
echo "<row>";
echo "<item>$child</item>";
}
if($i==2){
echo "<item>$child</item>";
echo "</row>"
$i=0;
}
}
```
[UPDATE]
This bugs me: An odd count of children could possibly lead to a... |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | Or this:
```
<?php
$i=0;
foreach($children as $child){
++$i;
if($i==1){
echo "<row>";
echo "<item>$child</item>";
}
if($i==2){
echo "<item>$child</item>";
echo "</row>"
$i=0;
}
}
```
[UPDATE]
This bugs me: An odd count of children could possibly lead to a... | ```
# Process every second item starting with the first one [0].
foreach ($array as $key => $value) {
if (($key - 1) % 2 === 0) {
continue;
}
# Do something here.
}
``` |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | Or this:
```
<?php
$i=0;
foreach($children as $child){
++$i;
if($i==1){
echo "<row>";
echo "<item>$child</item>";
}
if($i==2){
echo "<item>$child</item>";
echo "</row>"
$i=0;
}
}
```
[UPDATE]
This bugs me: An odd count of children could possibly lead to a... | Try this
```
$i = 1;
//Build custom items
foreach($children as $child){
if($i>2){
$i =1;
}
if ($i==2) {
//close row
}
$i++;
}
``` |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | You should use a `for` loop instead of a `foreach` loop like so:
```
for($i = 0; $i < count($children); $i+=2) {
$child1 = $children[$i];
$child2 = $children[$i+1];
// print both
}
```
if you may have an odd number of children you have to check if `$i+1 < count($children)` before printing it. | ```
# Process every second item starting with the first one [0].
foreach ($array as $key => $value) {
if (($key - 1) % 2 === 0) {
continue;
}
# Do something here.
}
``` |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | you're almost there:
```
//Build custom items
echo "<row>";
$i = 0;
foreach($children as $child) {
echo "item ";
$i++;
if ($i % 2 == 0 && $i != count($children)) {
echo "</row><row>";
}
}
echo "</row>"
``` | Try this
```
$i = 1;
//Build custom items
foreach($children as $child){
if($i>2){
$i =1;
}
if ($i==2) {
//close row
}
$i++;
}
``` |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | >
> This is in Wordpress but understands it and it will help you.
>
>
>
```
<?php $query = new WP_Query( array( 'post_type' => 'slides', 'order'=> 'DESC', 'post_status' => 'publish', 'posts_per_page' => -1) );
$posts = $query->posts;
$numOfCols = 2;
$rowCount = 0;
... | ```
# Process every second item starting with the first one [0].
foreach ($array as $key => $value) {
if (($key - 1) % 2 === 0) {
continue;
}
# Do something here.
}
``` |
30,031,751 | ```
<div class="puffar">
<?php
//Set up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));
//Get children
$children = ($post->post_parent) ? get_page_children( $post->post_parent, $all_wp_pages ) : get_pa... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30031751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4820395/"
] | you're almost there:
```
//Build custom items
echo "<row>";
$i = 0;
foreach($children as $child) {
echo "item ";
$i++;
if ($i % 2 == 0 && $i != count($children)) {
echo "</row><row>";
}
}
echo "</row>"
``` | ```
# Process every second item starting with the first one [0].
foreach ($array as $key => $value) {
if (($key - 1) % 2 === 0) {
continue;
}
# Do something here.
}
``` |
31,564,683 | I wanted to count no. of objects on Google homepage using static programming, i mean without creating object first(the way we do in dynamic one).
Pls tell me what is wrong in below statement
```
Set P = Browser("creationtime:=0").page("title:=Google").WebButton("type:=submit","html tag:=INPUT")
MsgBox P.Count()
``... | 2015/07/22 | [
"https://Stackoverflow.com/questions/31564683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4824268/"
] | You can get the total number of buttons by using descriptive approach.
```
Set odesc = description.Create()
odesc("micclass").value="WebButton"
Set i = Browser("creationtime:=0").Page("title:=Google").ChildObjects(odesc)
Msgbox i.Count()
Set i = Nothing : Set odesc = Nothing
``` | You are actually trying to get a count of the **child** webbutton objects on that **page** object. With the original code that you posted, if there is more than one webbutton object on the page with the descriptors you're using, QTP will throw a multiple object matches found error.
Nelly's code regarding the descripti... |
59,729,550 | I work on an ASP.NET MVC project that I need some help with. I need to be able to create x number of textboxes when the user click "add textbox". When the user enter the page a viewmodel is loaded. This viewmodel need to handle the x number of textboxes that the user create when he is on the page so that when the page ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59729550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2153383/"
] | You can add a list of String, like this
`public String[] MyTextFields`
and then create HTML using Javascript, like this:
`<input name="myTextFields[0]"></input>`
`<input name="myTextFields[1]"></input>` | In Razor view:
```
@for (var i = 0; i < Model.EventList.Count; i++)
{
@Html.EditorFor(x => Model.EventList[i].Name)
}
```
To set the name attribute of all edited elements in javascript, this is to be called on page load, and any time the collection changes (item is added or removed):
```
var children = document... |
59,729,550 | I work on an ASP.NET MVC project that I need some help with. I need to be able to create x number of textboxes when the user click "add textbox". When the user enter the page a viewmodel is loaded. This viewmodel need to handle the x number of textboxes that the user create when he is on the page so that when the page ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59729550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2153383/"
] | You can add a list of String, like this
`public String[] MyTextFields`
and then create HTML using Javascript, like this:
`<input name="myTextFields[0]"></input>`
`<input name="myTextFields[1]"></input>` | If it is ok to have JS dependency than I suggest to use light Knockout library. It will help you to create/edit/delete your inputs. [Check example in JS fiddle](https://jsfiddle.net/yn9crg6w/).
Use HTML to adjust your view. Tag **data-bind** lets you to bind to data and events
```
<button data-bind="click: addInput">... |
59,729,550 | I work on an ASP.NET MVC project that I need some help with. I need to be able to create x number of textboxes when the user click "add textbox". When the user enter the page a viewmodel is loaded. This viewmodel need to handle the x number of textboxes that the user create when he is on the page so that when the page ... | 2020/01/14 | [
"https://Stackoverflow.com/questions/59729550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2153383/"
] | In Razor view:
```
@for (var i = 0; i < Model.EventList.Count; i++)
{
@Html.EditorFor(x => Model.EventList[i].Name)
}
```
To set the name attribute of all edited elements in javascript, this is to be called on page load, and any time the collection changes (item is added or removed):
```
var children = document... | If it is ok to have JS dependency than I suggest to use light Knockout library. It will help you to create/edit/delete your inputs. [Check example in JS fiddle](https://jsfiddle.net/yn9crg6w/).
Use HTML to adjust your view. Tag **data-bind** lets you to bind to data and events
```
<button data-bind="click: addInput">... |
36,514,444 | Now I am using JPA to access database. I want to get the comments in the specific courses and specific lessons, so the sql would like this:
```
select * from comment where (commentType, commentId) in (("course", "1"), ("lesson", 2))
```
I use annotation @Query like this:
```
@Query("select c from Comment c where (c... | 2016/04/09 | [
"https://Stackoverflow.com/questions/36514444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3453976/"
] | An `IN` expression allows only a single-valued path expressions, so you can't do `(commentType, commentId) in` in a JPQL query. | JPQL BNF documentation is very clear for the IN part
```
in_expression ::= {state_field_path_expression | type_discriminator} [NOT] IN { ( in_item {, in_item}* ) | (subquery) | collection_valued_input_parameter }
in_item ::= literal | single_valued_input_parameter
```
Consequently it can be concluded that you can't... |
28,702,250 | I want to regress y1 with x, then y2 with x and so on and save the slope,intercept,r2 values ,p values etc. to a vector such that the final vector should contain values for `y1...n` even if the value is NA.
The following is how my data looks
```
y1 y2 y3 y4 y5 x
NA 89 86 91 69 1
NA 86 NA 88 NA 2
NA 8... | 2015/02/24 | [
"https://Stackoverflow.com/questions/28702250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3389264/"
] | `sapply` over the non-x columns of `DF` returning the coefficients if there are any non-NAs in the dependent variable (`y`) and returning NAs otherwise:
```
t(sapply(DF[-6], function(y) if (any(!is.na(y))) coef(lm(y ~ x, DF)) else c(NA, NA)))
```
This gives the following where column 1 is the intercepts and column 2... | ```
#This is for the slope only.
nn<-lapply(paste0("y",1:5),function(i){
if (all(is.na(y[[i]]))==FALSE) {bb<-lm(y[[i]]~x,data=y)
return(bb[[1]][2])
}else{
return(NA)
}
})
do.call(rbind,kk)
x
[1,] NA
[2,] 3.300000
[3,] -1.500000
[4,] 3.300000
[5,] 2.92... |
63,998,033 | Hey I am trying to delete the element I have clicked on
My app.js
```
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
ninja: [
{
name: 'Ryu',
age: 30,
belt: 'black',
id: 1
... | 2020/09/21 | [
"https://Stackoverflow.com/questions/63998033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13344058/"
] | Your first example was almost right, you just needed to specify the sequence of dates a bit differently.
Get set up:
```
library(tidyverse)
set.seed(pi)
start_date = as.Date("2009-01-01")
end_date = as.Date("2020-05-19")
```
Create a bit of demo data for testing:
```
df = expand_grid(site = LETTERS[1:3],
... | Here's an option using packages from the tidyverse:
```
library(dplyr)
library(tidyr)
# find all date and site combinations
all <- df %>%
mutate(date = as.Date(date)) %>%
expand(site, date = full_seq(date, 1))
# merge back all date/site combinations to original data
df %>% right_join(all, by = c("date", "sit... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | There are no common idioms / patterns that use dynamic downcasting because it is not very useful. The use of downcasting is indicative of a bad design.
If you find yourself in a rare situation where you think that you need dynamic downcasting because you've been painted into a corner by the design of a framework or a ... | Often there are APIs or libraries which use callbacks to notify you of events. Those will usually have a tag that you pass that gets passed back to the callback function.
The problem with such a system is producing unique tags that can be associated back with a code object. The simplest system is to simply cast a poin... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | 1. You obtain abstract class from external/user code you do not trust too much. And you need to verify that it matches the type(s) you expect. If it doesn't match you report error instead of going UB. Furthermore, it would be a problem if you were to expose too much of your code/classes to users/external code - so you ... | Often there are APIs or libraries which use callbacks to notify you of events. Those will usually have a tag that you pass that gets passed back to the callback function.
The problem with such a system is producing unique tags that can be associated back with a code object. The simplest system is to simply cast a poin... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | The main situations where I've seen downcasting useful in object-oriented frameworks like .NET and Java are those in which all objects implementing a certain interface can be used perform some task a certain way, but some can also be used to perform the task in a faster way. For example, one might have an instance of s... | Downcasting is widely used in Unreal Engine. There's even a dedicated `Cast` function that operates on integral representations of `UObject`-derived types which makes it cheap in terms of performance.
The engine comes with a base hierarchy of types that are supposed to be inherited and extended in your game module. Th... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | The curiously recurring template pattern (CRTP)
===============================================
>
> where downcasting is actually useful?
>
>
>
It is very useful when implementing the [Curiously recurring template pattern](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern):
>
>
> ```
> templat... | Downcasting is widely used in Unreal Engine. There's even a dedicated `Cast` function that operates on integral representations of `UObject`-derived types which makes it cheap in terms of performance.
The engine comes with a base hierarchy of types that are supposed to be inherited and extended in your game module. Th... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | The main situations where I've seen downcasting useful in object-oriented frameworks like .NET and Java are those in which all objects implementing a certain interface can be used perform some task a certain way, but some can also be used to perform the task in a faster way. For example, one might have an instance of s... | Often there are APIs or libraries which use callbacks to notify you of events. Those will usually have a tag that you pass that gets passed back to the callback function.
The problem with such a system is producing unique tags that can be associated back with a code object. The simplest system is to simply cast a poin... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | The curiously recurring template pattern (CRTP)
===============================================
>
> where downcasting is actually useful?
>
>
>
It is very useful when implementing the [Curiously recurring template pattern](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern):
>
>
> ```
> templat... | The main situations where I've seen downcasting useful in object-oriented frameworks like .NET and Java are those in which all objects implementing a certain interface can be used perform some task a certain way, but some can also be used to perform the task in a faster way. For example, one might have an instance of s... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | There are no common idioms / patterns that use dynamic downcasting because it is not very useful. The use of downcasting is indicative of a bad design.
If you find yourself in a rare situation where you think that you need dynamic downcasting because you've been painted into a corner by the design of a framework or a ... | Downcasting is widely used in Unreal Engine. There's even a dedicated `Cast` function that operates on integral representations of `UObject`-derived types which makes it cheap in terms of performance.
The engine comes with a base hierarchy of types that are supposed to be inherited and extended in your game module. Th... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | The curiously recurring template pattern (CRTP)
===============================================
>
> where downcasting is actually useful?
>
>
>
It is very useful when implementing the [Curiously recurring template pattern](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern):
>
>
> ```
> templat... | There are no common idioms / patterns that use dynamic downcasting because it is not very useful. The use of downcasting is indicative of a bad design.
If you find yourself in a rare situation where you think that you need dynamic downcasting because you've been painted into a corner by the design of a framework or a ... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | The curiously recurring template pattern (CRTP)
===============================================
>
> where downcasting is actually useful?
>
>
>
It is very useful when implementing the [Curiously recurring template pattern](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern):
>
>
> ```
> templat... | 1. You obtain abstract class from external/user code you do not trust too much. And you need to verify that it matches the type(s) you expect. If it doesn't match you report error instead of going UB. Furthermore, it would be a problem if you were to expose too much of your code/classes to users/external code - so you ... |
62,777,681 | Hey guys so I've almost solved this kata but my code keeps failing this one test. Any ideas?
```
def move_zeros(array):
n = len(array)
count = 0
for i in range(n):
if array[i] is not 0:
if type(array[i]) != int or type(array[i]) != float:
array[count] = array[i]
... | 2020/07/07 | [
"https://Stackoverflow.com/questions/62777681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842932/"
] | 1. You obtain abstract class from external/user code you do not trust too much. And you need to verify that it matches the type(s) you expect. If it doesn't match you report error instead of going UB. Furthermore, it would be a problem if you were to expose too much of your code/classes to users/external code - so you ... | Downcasting is widely used in Unreal Engine. There's even a dedicated `Cast` function that operates on integral representations of `UObject`-derived types which makes it cheap in terms of performance.
The engine comes with a base hierarchy of types that are supposed to be inherited and extended in your game module. Th... |
8,851,260 | In [Revealing module pattern](http://addyosmani.com/resources/essentialjsdesignpatterns/book/#revealingmodulepatternjavascript) of JavaScript how to use setTimeout function?
Here is the [example](http://jsfiddle.net/ashwinkumark/Lrm3p/).
HTML: `<div id="container1"></div>`
JavaScript:
```
var classA = (function() ... | 2012/01/13 | [
"https://Stackoverflow.com/questions/8851260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/815812/"
] | I've made a few slight modifications to your code which means it now works as you wish it to:
```
var classA = (function() {
var i = 0,
names = ["a", "b", "c", "d", "e", "f"],
namesLength = names.length,
callTest = function() {
window.setTimeout(function() {
call... | cause the function insight setTimeout is calling not in that place, but after 1sec. And when it is called the n is equal to the last index. You have to make n global and increment each time the function is called
```
var classA = (function() {
var i = 0;
var names = ["a", "b", "c", "d", "e", "f"];
var n = ... |
8,851,260 | In [Revealing module pattern](http://addyosmani.com/resources/essentialjsdesignpatterns/book/#revealingmodulepatternjavascript) of JavaScript how to use setTimeout function?
Here is the [example](http://jsfiddle.net/ashwinkumark/Lrm3p/).
HTML: `<div id="container1"></div>`
JavaScript:
```
var classA = (function() ... | 2012/01/13 | [
"https://Stackoverflow.com/questions/8851260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/815812/"
] | I've made a few slight modifications to your code which means it now works as you wish it to:
```
var classA = (function() {
var i = 0,
names = ["a", "b", "c", "d", "e", "f"],
namesLength = names.length,
callTest = function() {
window.setTimeout(function() {
call... | ```
for (var n in names) {
window.setTimeout(function() {
callTest2(names[n]);
}, 1000);
}
```
Code above is equivalent to below code.
```
callTest2("f");
callTest2("f");
callTest2("f");
callTest2("f");
callTest2("f");
callTes... |
8,851,260 | In [Revealing module pattern](http://addyosmani.com/resources/essentialjsdesignpatterns/book/#revealingmodulepatternjavascript) of JavaScript how to use setTimeout function?
Here is the [example](http://jsfiddle.net/ashwinkumark/Lrm3p/).
HTML: `<div id="container1"></div>`
JavaScript:
```
var classA = (function() ... | 2012/01/13 | [
"https://Stackoverflow.com/questions/8851260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/815812/"
] | cause the function insight setTimeout is calling not in that place, but after 1sec. And when it is called the n is equal to the last index. You have to make n global and increment each time the function is called
```
var classA = (function() {
var i = 0;
var names = ["a", "b", "c", "d", "e", "f"];
var n = ... | ```
for (var n in names) {
window.setTimeout(function() {
callTest2(names[n]);
}, 1000);
}
```
Code above is equivalent to below code.
```
callTest2("f");
callTest2("f");
callTest2("f");
callTest2("f");
callTest2("f");
callTes... |
38,811,754 | This is my code:
```
def fun_one(x):
total = x + 5
return total
def fun_two(y):
y += 5
return y
fun_one(5)
print(fun_two(fun_one()))
```
Now here I want to pass `fun_one`'s return value as argument to `fun_two`. How to do it? | 2016/08/07 | [
"https://Stackoverflow.com/questions/38811754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6570112/"
] | You can do it as:
```
def fun_one(x):
total = x + 5
return total
def fun_two(y):
y += 5
return y
print(fun_two(fun_one(5)))
```
Or you can also do it as:
```
def fun_one(x):
total = x + 5
return total
def fun_two(y):
y += 5
return y
temp=fun_one(5)
print(fun_two(temp))
``` | Call your `fun_one(5)` inside `fun_two()` like so:
```
# Replace these lines
fun_one(5)
print(fun_two(fun_one()))
# With this
print(fun_two(fun_one(5)))
``` |
49,796,141 | I am trying to update an item on podio through their Java API. It worked fine for a while, but now, but after some time it gave me this error:
```
APIException [status=Conflict, error=conflict, description=A newer version exists , parameters=null]
```
Right now, if I sent another request to update the item that had... | 2018/04/12 | [
"https://Stackoverflow.com/questions/49796141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8206772/"
] | I like @jeprubio's answer above, however I ran into the same issue @desgraci mentioned in the comments, where their matcher is consistently looking for a view on an old, stale rootview. This happens frequently when trying to have transitions between activities in your test.
My implementation of the traditional "Implic... | You can either create an [idling resource](https://medium.com/azimolabs/wait-for-it-idlingresource-and-conditionwatcher-602055f32356) or use a custom [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction.html) as this one:
```
/**
* Perform action of waiting for a specific view... |
49,796,141 | I am trying to update an item on podio through their Java API. It worked fine for a while, but now, but after some time it gave me this error:
```
APIException [status=Conflict, error=conflict, description=A newer version exists , parameters=null]
```
Right now, if I sent another request to update the item that had... | 2018/04/12 | [
"https://Stackoverflow.com/questions/49796141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8206772/"
] | You can either create an [idling resource](https://medium.com/azimolabs/wait-for-it-idlingresource-and-conditionwatcher-602055f32356) or use a custom [ViewAction](https://developer.android.com/reference/android/support/test/espresso/ViewAction.html) as this one:
```
/**
* Perform action of waiting for a specific view... | If the text that you're waiting on is in a `TextView` that won't enter the view hierarchy until after the sign-in is complete, then I suggest going with one of the other answers in this thread which operate on the root view (i.e. [here](https://stackoverflow.com/a/49814995/1071320) or [here](https://stackoverflow.com/a... |
49,796,141 | I am trying to update an item on podio through their Java API. It worked fine for a while, but now, but after some time it gave me this error:
```
APIException [status=Conflict, error=conflict, description=A newer version exists , parameters=null]
```
Right now, if I sent another request to update the item that had... | 2018/04/12 | [
"https://Stackoverflow.com/questions/49796141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8206772/"
] | I like @jeprubio's answer above, however I ran into the same issue @desgraci mentioned in the comments, where their matcher is consistently looking for a view on an old, stale rootview. This happens frequently when trying to have transitions between activities in your test.
My implementation of the traditional "Implic... | If the text that you're waiting on is in a `TextView` that won't enter the view hierarchy until after the sign-in is complete, then I suggest going with one of the other answers in this thread which operate on the root view (i.e. [here](https://stackoverflow.com/a/49814995/1071320) or [here](https://stackoverflow.com/a... |
1,103,868 | i have included DotnetFramework, Windows installer in VS Setup Project through
Setup Project ->properties
[alt text http://img35.imageshack.us/img35/3158/prerequisite.jpg](http://img35.imageshack.us/img35/3158/prerequisite.jpg)
but while run setup.msi it ask me to download dotnet framework from online
i would like t... | 2009/07/09 | [
"https://Stackoverflow.com/questions/1103868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/107748/"
] | i have found one solution [DotnetInstaller](http://dotnetinstaller.codeplex.com), which is perfectly worked for me | You have to include the actual .NET framework file in your installer then.
The properties page simply lists dependencies, but does not actually include them. |
1,385,231 | If the lines $2x+3y=10$ and $2x-3y=10$ are tangents at the extremities of its same latus rectum to an ellipse whose center is origin,then the length of the latus rectum is
$(A)\frac{110}{27}\hspace{1cm}(B)\frac{98}{27}\hspace{1cm}(C)\frac{100}{27}\hspace{1cm}(D)\frac{120}{27}$
I found point of intersection of tw... | 2015/08/05 | [
"https://math.stackexchange.com/questions/1385231",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258051/"
] | This would be the fastest.
$$
P(2 \leq X\leq 6) = P(X\leq 6) - P(X<2)
$$
so this would be
$$
P(X=2) + P(X=3) + P(X=4) + P(X=5) + P(X=6)
$$ | You can also approximate the answer using a normal approximation to the binomial, since $n$ is fairly large:
$$X\sim B(100,0.028)$$ can be recast as a normal distribution:
$$X\sim N(np,npq) \implies X\sim N(np,np(1-p))$$ so with your numbers, $n=100$, $p=0.028$:
$$X\sim N(2.8,2.7216)$$. |
1,385,231 | If the lines $2x+3y=10$ and $2x-3y=10$ are tangents at the extremities of its same latus rectum to an ellipse whose center is origin,then the length of the latus rectum is
$(A)\frac{110}{27}\hspace{1cm}(B)\frac{98}{27}\hspace{1cm}(C)\frac{100}{27}\hspace{1cm}(D)\frac{120}{27}$
I found point of intersection of tw... | 2015/08/05 | [
"https://math.stackexchange.com/questions/1385231",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/258051/"
] | As far as I know, if $X\sim \mathcal{B}(n,p)$, then it can be approached by the Gaussian distribution $\mathcal{N}\big(np,np(1-p)\big)$, as long as $\mathbf{n\ge 30}$ and $\mathbf{np \ge 5}$, which can give us a fairly good approximation. In that case, we have:
$$\Pr(a\le X\le b)\approx \Pr\left(\frac{a - np}{\sqrt{np(... | You can also approximate the answer using a normal approximation to the binomial, since $n$ is fairly large:
$$X\sim B(100,0.028)$$ can be recast as a normal distribution:
$$X\sim N(np,npq) \implies X\sim N(np,np(1-p))$$ so with your numbers, $n=100$, $p=0.028$:
$$X\sim N(2.8,2.7216)$$. |
22,267,875 | I'm bringing a web application from PHP core to Laravel 4. In the current application passwords are encrypted with phpass.
Encrypted passwords of phpass are compatible with the encryption of laravel? or I have to implement phpass on laravel?
Thanks. | 2014/03/08 | [
"https://Stackoverflow.com/questions/22267875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2352191/"
] | You'll have to replace the default hasher, which uses the Bcrypt hashing algorithm.
Here's an example repository which shows how to do it - in his case he's replaced it with a simple MD5, but you can modify it to use whatever algorithm you like.
<https://github.com/robclancy/laravel4-hashing> | There is bundle to override bcrypt hashing
<https://github.com/ksungcaya/phpass> |
29,981,545 | From [python docs](https://docs.python.org/3.0/library/heapq.html#heapq.merge).
I have found the algorithm in quite a few places such as [here](https://stackoverflow.com/a/5446254/3664835), [here](http://www.geeksforgeeks.org/merge-k-sorted-arrays/) and [here](http://www.careercup.com/question?id=2261). None of them h... | 2015/05/01 | [
"https://Stackoverflow.com/questions/29981545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3664835/"
] | This is known as *"Multiway merging"* and is described by Donald Knuth in The Art of Computer Programming, Volume III - Sorting and Searching, section 5.4.1. | If you understand merging of sorted lists then that is what this function is basically doing. There is no name for it, other than merging.
As an aside, merge-sort uses a similar routine, generally on two sorted lists. It is why it's called 'merge'-sort. |
19,282,833 | I'm trying to compare two lists of integers, each the same size, in Python 2.6. The comparison I need is to compare the first item in List 1 with the first item in List 2, the second item in List 1 with the second item in List 2, and so on, and returns a result if ALL of the list items follow the same comparison criter... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19282833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541913/"
] | You can consider a numpy-based vectorized comparison.
```
import numpy as np
a = [1,1,1,2]
b = [2,2,4,3]
all_larger = np.all(np.asarray(b) > np.asarray(a)) # true if b > a holds elementwise
print all_larger
True
```
Clearly, you can engineer the thing to have your answer.
```
all_larger = lambda b,a : ... | Are you familiar with the wonderful `zip` function?
```
import itertools
def compare(xs, ys):
all_less = True
all_greater = True
for x, y in itertools.izip(xs, ys):
if not all_less and not all_greater:
return None
if x > y:
all_less = False
elif x < y:
all_greater = False
if al... |
19,282,833 | I'm trying to compare two lists of integers, each the same size, in Python 2.6. The comparison I need is to compare the first item in List 1 with the first item in List 2, the second item in List 1 with the second item in List 2, and so on, and returns a result if ALL of the list items follow the same comparison criter... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19282833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541913/"
] | Are you familiar with the wonderful `zip` function?
```
import itertools
def compare(xs, ys):
all_less = True
all_greater = True
for x, y in itertools.izip(xs, ys):
if not all_less and not all_greater:
return None
if x > y:
all_less = False
elif x < y:
all_greater = False
if al... | For anyone interested in the performance of the two methods, I named the iterative method 'tortoise' and the numpy method 'hare', and tested it with the code below.
At first, the 'tortoise' won [.009s [T] vs .033s [H]], but I checked it and found that asarray() was being called more often than it need to be. With tha... |
19,282,833 | I'm trying to compare two lists of integers, each the same size, in Python 2.6. The comparison I need is to compare the first item in List 1 with the first item in List 2, the second item in List 1 with the second item in List 2, and so on, and returns a result if ALL of the list items follow the same comparison criter... | 2013/10/09 | [
"https://Stackoverflow.com/questions/19282833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541913/"
] | You can consider a numpy-based vectorized comparison.
```
import numpy as np
a = [1,1,1,2]
b = [2,2,4,3]
all_larger = np.all(np.asarray(b) > np.asarray(a)) # true if b > a holds elementwise
print all_larger
True
```
Clearly, you can engineer the thing to have your answer.
```
all_larger = lambda b,a : ... | For anyone interested in the performance of the two methods, I named the iterative method 'tortoise' and the numpy method 'hare', and tested it with the code below.
At first, the 'tortoise' won [.009s [T] vs .033s [H]], but I checked it and found that asarray() was being called more often than it need to be. With tha... |
6,978,304 | I am trying to delete a few records but am getting the following error:
>
> Cannot delete or update a parent row: a foreign key constraint fails
>
>
>
The thing is, the foreign key constraint is failing for only 1 or 2 of my 100 records I wish to delete. I wish to write a query which deletes these 98-99 records,... | 2011/08/08 | [
"https://Stackoverflow.com/questions/6978304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/363502/"
] | You have to `LEFT JOIN` the referencing table and add a condition saying that the row is missing in that table.
For example:
```
DELETE a FROM a
LEFT JOIN b ON b.a_id = a.id
WHERE b.a_id IS NULL;
``` | Use ignore:
```
DELETE IGNORE ...
```
<http://dev.mysql.com/doc/refman/5.0/en/delete.html> |
71,379,340 | How can I implement a photo-like layout using flexbox?
[enter image description here](https://i.stack.imgur.com/BTHB8.jpg)
```
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-3"></div>
<div class="col-md-3"></div>
<div class="col-md-6"></div>
<div class="col-md-3"></div>
<div class="col-md-3"></div>... | 2022/03/07 | [
"https://Stackoverflow.com/questions/71379340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16727131/"
] | This is easier done via `grid`. Here's the implementation:
```css
.row {
display: grid;
grid-template-areas: "a b c" "d d c" "e f c";
grid-gap: 5px;
}
div {
border: 1px solid black;
padding: 5px;
}
.a {
grid-area: a;
}
.b {
grid-area: b;
}
.c {
grid-area: c;
}
.d {
grid-area: d;
}
.e {
grid-a... | ```css
* {
box-sizing: border-box;
}
.row {
display: grid;
grid-template-columns: repeat(4, 100px);
grid-template-rows: repeat(3, 200px);
grid-gap: 10px;
width: max-content;
margin: auto;
}
.col {
background-color: red;
display: flex;
justify-content: center;
align-items: center;
}
.col:nth-chi... |
71,379,340 | How can I implement a photo-like layout using flexbox?
[enter image description here](https://i.stack.imgur.com/BTHB8.jpg)
```
<div class="row">
<div class="col-md-6"></div>
<div class="col-md-3"></div>
<div class="col-md-3"></div>
<div class="col-md-6"></div>
<div class="col-md-3"></div>
<div class="col-md-3"></div>... | 2022/03/07 | [
"https://Stackoverflow.com/questions/71379340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16727131/"
] | HTML CODES:
```
<div class="main-div">
<div class="leftside">
<div class="leftside-1">
<div class="leftside-1a">1a</div>
<div class="leftside-2a">2a</div>
</div>
<div class="leftside-2">2</div>
<div class="leftside-3">
<div class="leftside-1c">1c<... | ```css
* {
box-sizing: border-box;
}
.row {
display: grid;
grid-template-columns: repeat(4, 100px);
grid-template-rows: repeat(3, 200px);
grid-gap: 10px;
width: max-content;
margin: auto;
}
.col {
background-color: red;
display: flex;
justify-content: center;
align-items: center;
}
.col:nth-chi... |
38,565,590 | I have data in the following form:
```
TicketID Status Datetime
25 Open 2016-07-21 11:46:40
25 Open 2016-07-22 09:42:40
25 Closed 2016-07-22 09:46:40
25 Open 2016-07-23 08:42:40
25 Open 2016-07-24 08:46:40
25 Open 2016-07-24 09:26:... | 2016/07/25 | [
"https://Stackoverflow.com/questions/38565590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1621640/"
] | Here is an idea: For each "open" get the next "closed". Then only choose the "closed" values and take the minimum open to determine the length of time. So, the following gets the pairs of times that you want:
```
select close_datetime, min(datetime) as open_datetime
from (select t.*,
(select t2.DateTime
... | This seems okay to me.
```
set @x=now(), @y=-1;
select
avg(timestampdiff(second,prev_stat_dt,curr_stat_dt))
from
(select
TicketID,
@y prev_stat,
@y:=Status curr_stat,
@x prev_stat_dt,
@x:=DateTime curr_stat_dt
from
table1
where
... |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | [Per documentation](http://www.postgresql.org/docs/9.4/static/functions-json.html), there are also the functions
```
jsonb_populate_record()
jsonb_populate_recordset()
```
Analog to their json twins (present since pg 9.3)
```
json_populate_record()
json_populate_recordset()
```
You need a predefined row type. Eit... | You must to cast the json value to text and then to float.
Try this:
```
(json_data #>> '{field}')::float
``` |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | There are two operations to get value from `JSON`. The first one `->` will return `JSON`. The second one `->>` will return text.
Details: [JSON Functions and Operators](http://www.postgresql.org/docs/current/static/functions-json.html)
Try
```
SELECT (json_data->'position'->>'lat')::float + 1.0 AS lat
FROM updates
... | [Per documentation](http://www.postgresql.org/docs/9.4/static/functions-json.html), there are also the functions
```
jsonb_populate_record()
jsonb_populate_recordset()
```
Analog to their json twins (present since pg 9.3)
```
json_populate_record()
json_populate_recordset()
```
You need a predefined row type. Eit... |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | There are two operations to get value from `JSON`. The first one `->` will return `JSON`. The second one `->>` will return text.
Details: [JSON Functions and Operators](http://www.postgresql.org/docs/current/static/functions-json.html)
Try
```
SELECT (json_data->'position'->>'lat')::float + 1.0 AS lat
FROM updates
... | AFAIK there's no json->float casting in Postgres, so you could try an explicit `(json_data->'position'->'lat')::text::float` cast |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | There are two operations to get value from `JSON`. The first one `->` will return `JSON`. The second one `->>` will return text.
Details: [JSON Functions and Operators](http://www.postgresql.org/docs/current/static/functions-json.html)
Try
```
SELECT (json_data->'position'->>'lat')::float + 1.0 AS lat
FROM updates
... | Now we can do it!
-----------------
In nowadays we can cast directly from JSONb to SQL datatypes. I am using PostgreSQL **v12.3**, where it is working fine:
```sql
SELECT (j->'i')::int, (j->>'i')::int, (j->'f')::float, (j->>'f')::float
FROM (SELECT '{"i":123,"f":12.34}'::jsonb) t(j);
```
---
Sub-questions:
* *F... |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | AFAIK there's no json->float casting in Postgres, so you could try an explicit `(json_data->'position'->'lat')::text::float` cast | Now we can do it!
-----------------
In nowadays we can cast directly from JSONb to SQL datatypes. I am using PostgreSQL **v12.3**, where it is working fine:
```sql
SELECT (j->'i')::int, (j->>'i')::int, (j->'f')::float, (j->>'f')::float
FROM (SELECT '{"i":123,"f":12.34}'::jsonb) t(j);
```
---
Sub-questions:
* *F... |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | There are two operations to get value from `JSON`. The first one `->` will return `JSON`. The second one `->>` will return text.
Details: [JSON Functions and Operators](http://www.postgresql.org/docs/current/static/functions-json.html)
Try
```
SELECT (json_data->'position'->>'lat')::float + 1.0 AS lat
FROM updates
... | When creating a view I used CAST:
```
create view mydb.myview as
select id,
config->>'version' as version,
config->>'state' as state,
config->>'name' as name,
config->>'internal-name' as internal_name,
config->>'namespace' as namespace,
... |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | You must to cast the json value to text and then to float.
Try this:
```
(json_data #>> '{field}')::float
``` | When creating a view I used CAST:
```
create view mydb.myview as
select id,
config->>'version' as version,
config->>'state' as state,
config->>'name' as name,
config->>'internal-name' as internal_name,
config->>'namespace' as namespace,
... |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | Adding a clarification because this comes up as the top hit for a 'JSONB float conversion' search - note that you need to wrap the JSON conversion in brackets, and *then* apply the '::' casting.
As mentioned above, the correct method is:
```
(json_data #>> '{field}')::float
```
If instead you try this it will fail:... | You must to cast the json value to text and then to float.
Try this:
```
(json_data #>> '{field}')::float
``` |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | Adding a clarification because this comes up as the top hit for a 'JSONB float conversion' search - note that you need to wrap the JSON conversion in brackets, and *then* apply the '::' casting.
As mentioned above, the correct method is:
```
(json_data #>> '{field}')::float
```
If instead you try this it will fail:... | When creating a view I used CAST:
```
create view mydb.myview as
select id,
config->>'version' as version,
config->>'state' as state,
config->>'name' as name,
config->>'internal-name' as internal_name,
config->>'namespace' as namespace,
... |
24,826,385 | I'm trying the following query:
```
SELECT (json_data->'position'->'lat') + 1.0 AS lat FROM updates LIMIT 5;
```
(The +1.0 is just there to force conversion to float. My actual queries are far more complex, this query is just a test case for the problem.)
I get the error:
```
ERROR: operator does not exist: jsonb... | 2014/07/18 | [
"https://Stackoverflow.com/questions/24826385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129805/"
] | AFAIK there's no json->float casting in Postgres, so you could try an explicit `(json_data->'position'->'lat')::text::float` cast | When creating a view I used CAST:
```
create view mydb.myview as
select id,
config->>'version' as version,
config->>'state' as state,
config->>'name' as name,
config->>'internal-name' as internal_name,
config->>'namespace' as namespace,
... |
2,144,175 | If I have $\begin{bmatrix}a&0\\0&a^{-1}\end{bmatrix}$ in $SL(2,\Bbb C)$, how do I find what element I would have corresponding to this in $\mathfrak{sl}(2,\Bbb C)$? I imagine it might be something like $\begin{bmatrix}a&0\\0&-a\end{bmatrix}$, but I am not sure how to find this.
I know I want to go from determinant $1$... | 2017/02/14 | [
"https://math.stackexchange.com/questions/2144175",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/229882/"
] | The exponential map $\exp: \mathfrak{g}\rightarrow G$ gives you the matrices, however it need not be surjective (or injective) in general. Indeed, for $\mathfrak{g}=\mathfrak{sl}\_2(\mathbb{C})$ and $G=SL\_2(\mathbb{C})$ it is not - see [here](https://math.stackexchange.com/questions/643216/non-surjectivity-of-the-expo... | In general, there is no one-to-one correspondence between a group $G$ and its Lie algebra $\mathfrak{g}$, but we do have a map
$$\exp:\mathfrak{g}\to G.$$
In case of matrix groups, we have that for diagonal matrices
$$\exp\begin{pmatrix}s & 0 \\ 0 & t\end{pmatrix}=\begin{pmatrix}e^s & 0 \\ 0 & e^t\end{pmatrix}.$$
Thus... |
2,144,175 | If I have $\begin{bmatrix}a&0\\0&a^{-1}\end{bmatrix}$ in $SL(2,\Bbb C)$, how do I find what element I would have corresponding to this in $\mathfrak{sl}(2,\Bbb C)$? I imagine it might be something like $\begin{bmatrix}a&0\\0&-a\end{bmatrix}$, but I am not sure how to find this.
I know I want to go from determinant $1$... | 2017/02/14 | [
"https://math.stackexchange.com/questions/2144175",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/229882/"
] | In general, there is no one-to-one correspondence between a group $G$ and its Lie algebra $\mathfrak{g}$, but we do have a map
$$\exp:\mathfrak{g}\to G.$$
In case of matrix groups, we have that for diagonal matrices
$$\exp\begin{pmatrix}s & 0 \\ 0 & t\end{pmatrix}=\begin{pmatrix}e^s & 0 \\ 0 & e^t\end{pmatrix}.$$
Thus... | The correspondence between elements is given by the exponential map. This is actually a pretty deep statement in Lie theory, but for this particular case suffice it to say that the identity $$e^{\text{tr}(A)} = \det(e^A)$$ holds (not hard to show with Jordan normal form), and this shows that $$\text{tr}(A) = 0 \iff \de... |
2,144,175 | If I have $\begin{bmatrix}a&0\\0&a^{-1}\end{bmatrix}$ in $SL(2,\Bbb C)$, how do I find what element I would have corresponding to this in $\mathfrak{sl}(2,\Bbb C)$? I imagine it might be something like $\begin{bmatrix}a&0\\0&-a\end{bmatrix}$, but I am not sure how to find this.
I know I want to go from determinant $1$... | 2017/02/14 | [
"https://math.stackexchange.com/questions/2144175",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/229882/"
] | The exponential map $\exp: \mathfrak{g}\rightarrow G$ gives you the matrices, however it need not be surjective (or injective) in general. Indeed, for $\mathfrak{g}=\mathfrak{sl}\_2(\mathbb{C})$ and $G=SL\_2(\mathbb{C})$ it is not - see [here](https://math.stackexchange.com/questions/643216/non-surjectivity-of-the-expo... | The correspondence between elements is given by the exponential map. This is actually a pretty deep statement in Lie theory, but for this particular case suffice it to say that the identity $$e^{\text{tr}(A)} = \det(e^A)$$ holds (not hard to show with Jordan normal form), and this shows that $$\text{tr}(A) = 0 \iff \de... |
101,557 | I would like to control several high power DC devices (12V DC LEDs). From a tutorial, I found that I can control these using a 3.3V PWM input and a MOSFET. From what I understand, the MOSFET only allows current to flow through the LED to ground when the PWM input is high.
I have several (lets say 4) of these LEDs and... | 2014/03/02 | [
"https://electronics.stackexchange.com/questions/101557",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/34208/"
] | You can skip step 3 if you get a decoder with an enable input, e.g. 74HC238. Connect the PWM output to the enable input and this will switch the decoded output on and off with the PWM signal. You will still need one sink per device you want to switch though. | >
> Does this approach make sense?
>
>
>
Yes, it might work.
However, the real question is if this is what you really want. Being able to choose a single LED to power at a time is less useful than being able to power all LEDs simultaneously. And the fact is that this latter version is simpler and requires less co... |
101,557 | I would like to control several high power DC devices (12V DC LEDs). From a tutorial, I found that I can control these using a 3.3V PWM input and a MOSFET. From what I understand, the MOSFET only allows current to flow through the LED to ground when the PWM input is high.
I have several (lets say 4) of these LEDs and... | 2014/03/02 | [
"https://electronics.stackexchange.com/questions/101557",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/34208/"
] | You can skip step 3 if you get a decoder with an enable input, e.g. 74HC238. Connect the PWM output to the enable input and this will switch the decoded output on and off with the PWM signal. You will still need one sink per device you want to switch though. | Why don't you look for an analogue multiplexer that can run from a 12V power supply and has low on-resistance and can take the current for one LED. You haven't stated the LED current so this approach may not yield a definite result.
This one might work for you: -
. From a tutorial, I found that I can control these using a 3.3V PWM input and a MOSFET. From what I understand, the MOSFET only allows current to flow through the LED to ground when the PWM input is high.
I have several (lets say 4) of these LEDs and... | 2014/03/02 | [
"https://electronics.stackexchange.com/questions/101557",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/34208/"
] | Why don't you look for an analogue multiplexer that can run from a 12V power supply and has low on-resistance and can take the current for one LED. You haven't stated the LED current so this approach may not yield a definite result.
This one might work for you: -
buttonClicked:(id)sender {
NSLog(@"Clicked button %lo.", [sender tag]);
}
```
However, I'm running into a problem. It works fine from buttons 1-7, but the 8th one... | 2015/02/07 | [
"https://Stackoverflow.com/questions/28378516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1107398/"
] | Your button values are correct, you're just printing them wrong, in octal format (the 'o' in %lo) instead of decimal. That's why your 8 prints out as a 10 -- that's 8 in octal representation. 130 is octal for 88 decimal: | You should use an `unsigned int` (**%u**) format, not `long` (**%lo**):
```
NSLog(@"Clicked button %u.", [sender tag]);
```
* depending on the format of your tag you could possibly just use `%o`. Treating the integer as long is what is adding to the number. |
66,738,678 | ### When I load the following code using php...
`<?php <h1>Some text</h1> ?>`
### the tags are printed as text -
`<h1>Some text</h1>`
### Any ideas?
Found the answer - see my answer.
================================= | 2021/03/21 | [
"https://Stackoverflow.com/questions/66738678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14920090/"
] | You need to output the actual HTML code if you are placing any HTML code within PHP.
You can achieve this using [`echo()`](https://www.php.net/manual/en/function.echo.php).
```php
<?php
echo("<h1>Some text</h1>");
?>
``` | ```
<h1><?php Some text ?></h1>
```
why dont you try this. |
66,738,678 | ### When I load the following code using php...
`<?php <h1>Some text</h1> ?>`
### the tags are printed as text -
`<h1>Some text</h1>`
### Any ideas?
Found the answer - see my answer.
================================= | 2021/03/21 | [
"https://Stackoverflow.com/questions/66738678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14920090/"
] | You need to output the actual HTML code if you are placing any HTML code within PHP.
You can achieve this using [`echo()`](https://www.php.net/manual/en/function.echo.php).
```php
<?php
echo("<h1>Some text</h1>");
?>
``` | You must print it in order for it to appear the way you want it to
```
<?php echo"<h1>Some text</h1>" ?>
```
like this |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.