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
34,608,621
I know that this question has already been asked several times on this website but I'm seriously starting to wonder wheter I'm crazy or not. My configuration : WampServer 2.5 64bits (PHP 5.5.12, Apache 2.4.9) My steps: 1. Download Microsoft Driver SQLSRV32.exe from <https://www.microsoft.com/en-us/download/details.a...
2016/01/05
[ "https://Stackoverflow.com/questions/34608621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965878/" ]
I finally found what was causing the problem. My Wamp was in 64 bits but the sqlsrv driver only works with 32 bits version. Now it works perfectly.
Detailed steps for SQL Server Lovers to Install and Configure PhP: 1. Install Wamp wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b.exe 2. Configure PhP a. Update conf file Thumbrules are i. Change Port ii. Change from Deny to Granted iii. Change from None to Allow iii. Change the order from Deny, Allow to ...
34,608,621
I know that this question has already been asked several times on this website but I'm seriously starting to wonder wheter I'm crazy or not. My configuration : WampServer 2.5 64bits (PHP 5.5.12, Apache 2.4.9) My steps: 1. Download Microsoft Driver SQLSRV32.exe from <https://www.microsoft.com/en-us/download/details.a...
2016/01/05
[ "https://Stackoverflow.com/questions/34608621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965878/" ]
Did you try to modify php.ini using the wamp interface ? I know it sounds strange but sometimes the result is different than editing directly the file using the browser. Wamp manages those files in a strange way, give it a try...
It'll work with 64 or 32 bits just download the right dll file for your operating system and update your php.ini file.
410,850
I'm trying to create as much redundancy as possible with the hardware we have and here is how I have everything configured: We have a pair of stacked force10 S55 switches that is our core. Then at each of our 4 cabinets we have a pair of Cisco 2960-S switches that have a single cable back to our core. as an example: ...
2012/07/24
[ "https://serverfault.com/questions/410850", "https://serverfault.com", "https://serverfault.com/users/55097/" ]
The cheapest way to create redundancy is to do the following: Switch A -> Core A | | Switch B -> Core B Spanning tree will bring down the link between Switches A and B unless one of the Core switches dies or the link goes down. For performance reasons, split the primary NIC's on your server between Switch...
I am not a cisco guy so someone will probably be able to give better details but here goes: 1&2: If you enable STP (spanning tree protocol) you can have both an individual uplink from each 2960 to each s55 and a link between the 2960's. STP will take handle the potential loops and will only utilise for instance the li...
410,850
I'm trying to create as much redundancy as possible with the hardware we have and here is how I have everything configured: We have a pair of stacked force10 S55 switches that is our core. Then at each of our 4 cabinets we have a pair of Cisco 2960-S switches that have a single cable back to our core. as an example: ...
2012/07/24
[ "https://serverfault.com/questions/410850", "https://serverfault.com", "https://serverfault.com/users/55097/" ]
If I understand your topology correctly, there is no need to connect your 2960-S switches together at the access layer. While it can vary based on unique requirements, it is not a Cisco or Dell best practice to cross-connect access-layer switches. And as long as you dont cross connect at the access layer, spanning tr...
I am not a cisco guy so someone will probably be able to give better details but here goes: 1&2: If you enable STP (spanning tree protocol) you can have both an individual uplink from each 2960 to each s55 and a link between the 2960's. STP will take handle the potential loops and will only utilise for instance the li...
410,850
I'm trying to create as much redundancy as possible with the hardware we have and here is how I have everything configured: We have a pair of stacked force10 S55 switches that is our core. Then at each of our 4 cabinets we have a pair of Cisco 2960-S switches that have a single cable back to our core. as an example: ...
2012/07/24
[ "https://serverfault.com/questions/410850", "https://serverfault.com", "https://serverfault.com/users/55097/" ]
You need to define how long you can be down before making any choice at all. A stacked core provides good redundancy (especially when it comes to power failure, if those Force10 switches support power stacking). Running two links from each edge switch to the core removes the potential downtime if a core member dies, a...
I am not a cisco guy so someone will probably be able to give better details but here goes: 1&2: If you enable STP (spanning tree protocol) you can have both an individual uplink from each 2960 to each s55 and a link between the 2960's. STP will take handle the potential loops and will only utilise for instance the li...
410,850
I'm trying to create as much redundancy as possible with the hardware we have and here is how I have everything configured: We have a pair of stacked force10 S55 switches that is our core. Then at each of our 4 cabinets we have a pair of Cisco 2960-S switches that have a single cable back to our core. as an example: ...
2012/07/24
[ "https://serverfault.com/questions/410850", "https://serverfault.com", "https://serverfault.com/users/55097/" ]
If I understand your topology correctly, there is no need to connect your 2960-S switches together at the access layer. While it can vary based on unique requirements, it is not a Cisco or Dell best practice to cross-connect access-layer switches. And as long as you dont cross connect at the access layer, spanning tr...
The cheapest way to create redundancy is to do the following: Switch A -> Core A | | Switch B -> Core B Spanning tree will bring down the link between Switches A and B unless one of the Core switches dies or the link goes down. For performance reasons, split the primary NIC's on your server between Switch...
410,850
I'm trying to create as much redundancy as possible with the hardware we have and here is how I have everything configured: We have a pair of stacked force10 S55 switches that is our core. Then at each of our 4 cabinets we have a pair of Cisco 2960-S switches that have a single cable back to our core. as an example: ...
2012/07/24
[ "https://serverfault.com/questions/410850", "https://serverfault.com", "https://serverfault.com/users/55097/" ]
The cheapest way to create redundancy is to do the following: Switch A -> Core A | | Switch B -> Core B Spanning tree will bring down the link between Switches A and B unless one of the Core switches dies or the link goes down. For performance reasons, split the primary NIC's on your server between Switch...
You need to define how long you can be down before making any choice at all. A stacked core provides good redundancy (especially when it comes to power failure, if those Force10 switches support power stacking). Running two links from each edge switch to the core removes the potential downtime if a core member dies, a...
410,850
I'm trying to create as much redundancy as possible with the hardware we have and here is how I have everything configured: We have a pair of stacked force10 S55 switches that is our core. Then at each of our 4 cabinets we have a pair of Cisco 2960-S switches that have a single cable back to our core. as an example: ...
2012/07/24
[ "https://serverfault.com/questions/410850", "https://serverfault.com", "https://serverfault.com/users/55097/" ]
If I understand your topology correctly, there is no need to connect your 2960-S switches together at the access layer. While it can vary based on unique requirements, it is not a Cisco or Dell best practice to cross-connect access-layer switches. And as long as you dont cross connect at the access layer, spanning tr...
You need to define how long you can be down before making any choice at all. A stacked core provides good redundancy (especially when it comes to power failure, if those Force10 switches support power stacking). Running two links from each edge switch to the core removes the potential downtime if a core member dies, a...
67,106,182
I'm programming a youtube video downloader that allows you to download youtube videos in different resolutions and refresh rates. However, when I try to list the available resolutions and fps, I weirdly only get lower quality options. In my code example I am using the [YouTube Rewind 2019 video](https://www.youtube.com...
2021/04/15
[ "https://Stackoverflow.com/questions/67106182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13917714/" ]
I've just gone through the same issue. You can use something like this ``` from pytube import YouTube import os youtube = YouTube('https://youtu.be/kdmgpMfnjdU') video = youtube.streams.filter(res="480p").first().download() os.rename(video,"video_best.mp4") ``` Notice that 480p is the best available quality in that...
You can download it in lowest or highest quality by-- highest- ``` youtube.streams.get_highest_resolution.download() ``` lowest- ``` youtube.streams.get_lowest_resolution.download() ```
67,106,182
I'm programming a youtube video downloader that allows you to download youtube videos in different resolutions and refresh rates. However, when I try to list the available resolutions and fps, I weirdly only get lower quality options. In my code example I am using the [YouTube Rewind 2019 video](https://www.youtube.com...
2021/04/15
[ "https://Stackoverflow.com/questions/67106182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13917714/" ]
I've just gone through the same issue. You can use something like this ``` from pytube import YouTube import os youtube = YouTube('https://youtu.be/kdmgpMfnjdU') video = youtube.streams.filter(res="480p").first().download() os.rename(video,"video_best.mp4") ``` Notice that 480p is the best available quality in that...
To list all available resolutions in a video, you can use the `adaptive` filter. ```py video = youtube("URL") resolution = video.streams.filter(adaptive=true) ``` `progressive=true` allows you to view only progressive downloads. A progressive download is a legacy stream containing the audio and video in a single fil...
67,106,182
I'm programming a youtube video downloader that allows you to download youtube videos in different resolutions and refresh rates. However, when I try to list the available resolutions and fps, I weirdly only get lower quality options. In my code example I am using the [YouTube Rewind 2019 video](https://www.youtube.com...
2021/04/15
[ "https://Stackoverflow.com/questions/67106182", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13917714/" ]
I've just gone through the same issue. You can use something like this ``` from pytube import YouTube import os youtube = YouTube('https://youtu.be/kdmgpMfnjdU') video = youtube.streams.filter(res="480p").first().download() os.rename(video,"video_best.mp4") ``` Notice that 480p is the best available quality in that...
Because "progressive=True" in ```py for stream in youtube.streams.filter(progressive=True) ``` The highest quality you can get is 720p and below when "progressive=True", read this [section](https://pytube.io/en/latest/user/streams.html#dash-vs-progressive-streams) on pytube docs it explains it all. If u want the hi...
22,225,800
I want a set of form where User will input billing address and by checking the check box user will able to fill up next part. I want to do it with jQuery. If possible, how can I do it. Or, if it is not possible with jQuery. Then, How can I do it? ``` <form role="form" class="form-horizontal"> <div class="form-group"...
2014/03/06
[ "https://Stackoverflow.com/questions/22225800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3155597/" ]
**JQuery** First of all you need to set some ID's on your `checkbox` and your group `div`, like this: ``` <input id="matchedbilling" type="checkbox"> ``` and ``` <div id="billinggroup" class="form-group"> ``` That will allow you to easily reference them with [JQuery ID selector](http://api.jquery.com/id-selector...
This is very simple. Your markup is not that great, but you need to assign a specific ID on each input element. Then populate with jQuery. Here is the jsfiddle: <http://jsfiddle.net/Pvu8r/> ``` <form role="form" class="form-horizontal"> <div class="form-group"> <h2>Billing Address</h2> <p><span>Address 1</span><input ...
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
Brute force for nearest neighbour search is only feasible for a small number of points. You might want to look into kd-Trees or spatial data structures generally. [Here is a demo for kd-Tree.](http://donar.umiacs.umd.edu/quadtree/points/kdtree.html) [This is what wikipedia says.](http://en.wikipedia.org/wiki/Kd-tree)
Another possibility, simpler than creating a kd-tree, is using a **neighborhood matrix**. First place all your points into a 2D square matrix. Then you can run a full or partial spatial sort, so points will became ordered inside the matrix. Points with small Y could move to the top rows of the matrix, and likewise, p...
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
I would definitely sort by x first. Then I would use the x distance between points as a quick reject test: once you have the distance to one neighbor, any closer neighbor has to be closer in x. This avoids all the distSquared computations for points outside the x range. Every time you find a closer neighbor, you also t...
Either use a kd-tree, or use a good library for nearest neighbor search. [Weka](http://www.ibm.com/developerworks/opensource/library/os-weka3/index.html?ca=dnw-1124&ca=dth-o) includes one.
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
There are some fairly standard ways of improving this kind of search, and how complicated you want to get depends on how many points you are searching. A fairly common easy one is to sort the points by X or Y. For each point you then look for near points, going both forwards and backwards in the array. Remember how fa...
Another possibility, simpler than creating a kd-tree, is using a **neighborhood matrix**. First place all your points into a 2D square matrix. Then you can run a full or partial spatial sort, so points will became ordered inside the matrix. Points with small Y could move to the top rows of the matrix, and likewise, p...
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
Either use a kd-tree, or use a good library for nearest neighbor search. [Weka](http://www.ibm.com/developerworks/opensource/library/os-weka3/index.html?ca=dnw-1124&ca=dth-o) includes one.
If your points are relatively close together, you can sort by distance from some point (I think it can be any point, but it may have to be a point for which all the points are in the same quadrant if that point is treated as the origin). Lets say the point of interest is point A and has distance D. Pick the closest p...
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
Brute force for nearest neighbour search is only feasible for a small number of points. You might want to look into kd-Trees or spatial data structures generally. [Here is a demo for kd-Tree.](http://donar.umiacs.umd.edu/quadtree/points/kdtree.html) [This is what wikipedia says.](http://en.wikipedia.org/wiki/Kd-tree)
If your points are relatively close together, you can sort by distance from some point (I think it can be any point, but it may have to be a point for which all the points are in the same quadrant if that point is treated as the origin). Lets say the point of interest is point A and has distance D. Pick the closest p...
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
There are some fairly standard ways of improving this kind of search, and how complicated you want to get depends on how many points you are searching. A fairly common easy one is to sort the points by X or Y. For each point you then look for near points, going both forwards and backwards in the array. Remember how fa...
Either use a kd-tree, or use a good library for nearest neighbor search. [Weka](http://www.ibm.com/developerworks/opensource/library/os-weka3/index.html?ca=dnw-1124&ca=dth-o) includes one.
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
I would definitely sort by x first. Then I would use the x distance between points as a quick reject test: once you have the distance to one neighbor, any closer neighbor has to be closer in x. This avoids all the distSquared computations for points outside the x range. Every time you find a closer neighbor, you also t...
If your points are relatively close together, you can sort by distance from some point (I think it can be any point, but it may have to be a point for which all the points are in the same quadrant if that point is treated as the origin). Lets say the point of interest is point A and has distance D. Pick the closest p...
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
Brute force for nearest neighbour search is only feasible for a small number of points. You might want to look into kd-Trees or spatial data structures generally. [Here is a demo for kd-Tree.](http://donar.umiacs.umd.edu/quadtree/points/kdtree.html) [This is what wikipedia says.](http://en.wikipedia.org/wiki/Kd-tree)
Either use a kd-tree, or use a good library for nearest neighbor search. [Weka](http://www.ibm.com/developerworks/opensource/library/os-weka3/index.html?ca=dnw-1124&ca=dth-o) includes one.
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
I would definitely sort by x first. Then I would use the x distance between points as a quick reject test: once you have the distance to one neighbor, any closer neighbor has to be closer in x. This avoids all the distSquared computations for points outside the x range. Every time you find a closer neighbor, you also t...
Another possibility, simpler than creating a kd-tree, is using a **neighborhood matrix**. First place all your points into a 2D square matrix. Then you can run a full or partial spatial sort, so points will became ordered inside the matrix. Points with small Y could move to the top rows of the matrix, and likewise, p...
5,174,143
I am writing a method that takes as input an array of points and finds, for each point in the array, the closest point to it other than itself. I am currently doing this in a brute force way (cheking every point with every other point). My current implimentation doesn't have the array sorted but i can sort it by p.x va...
2011/03/02
[ "https://Stackoverflow.com/questions/5174143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/642012/" ]
There are some fairly standard ways of improving this kind of search, and how complicated you want to get depends on how many points you are searching. A fairly common easy one is to sort the points by X or Y. For each point you then look for near points, going both forwards and backwards in the array. Remember how fa...
If your points are relatively close together, you can sort by distance from some point (I think it can be any point, but it may have to be a point for which all the points are in the same quadrant if that point is treated as the origin). Lets say the point of interest is point A and has distance D. Pick the closest p...
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
No. I don't think the C++ standard guarantees anything about the memory layout of global variables.
Mick - in order to do what you want (copy/test), you will simply need to * add a constructor to test\_type class as well as a non-constructor init\_from\_globals() (whose code copies the 4 values one by one, the arrays copied in a loop or via memcopy). * Add a "diff\_from\_globals()" method, which again diffs the 4 m...
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
C/C++ standards does not require variables to be stored in the order of their declarations. So compilers are free to store variables in the order they want. But it is guaranteed that they will be initialized in the order of their declaration. This is true for both global and class member variables. Some notes on glob...
No, it is not guaranteed. Depending on what you would like to do, you can use pointer-to-member operators to make sure you know the relative address of a member variable. So in your class: ``` class test_type { int a; char b; float c[10]; double d[3]; } void* pa = &test_type::a; void* pb = &test_type...
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
C/C++ standards does not require variables to be stored in the order of their declarations. So compilers are free to store variables in the order they want. But it is guaranteed that they will be initialized in the order of their declaration. This is true for both global and class member variables. Some notes on glob...
Memory allocation is compiler dependent. So, contiguous allocation, or identical allocation of global and class member variables, cannot be guaranteed.
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
Why don't you simply use a global object of type test\_type instead of defining multiple global variables? ``` class test_type { int a; char b; float c[10]; double d[3]; }; test_type global; ``` Now, it's a piece of cake to initialize a new test\_type object with a copy of "global".
I think people are missing the point. It is always dangerous to assume any layout as this can change from CPU to CPU, compiler to compiler and even degree of optimisation. C++ will generate a default copy assignment function as if you had written this: ``` class test_type { int a; char b; float c[10]; ...
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
Why don't you simply use a global object of type test\_type instead of defining multiple global variables? ``` class test_type { int a; char b; float c[10]; double d[3]; }; test_type global; ``` Now, it's a piece of cake to initialize a new test\_type object with a copy of "global".
C/C++ standards does not require variables to be stored in the order of their declarations. So compilers are free to store variables in the order they want. But it is guaranteed that they will be initialized in the order of their declaration. This is true for both global and class member variables. Some notes on glob...
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
Why don't you simply use a global object of type test\_type instead of defining multiple global variables? ``` class test_type { int a; char b; float c[10]; double d[3]; }; test_type global; ``` Now, it's a piece of cake to initialize a new test\_type object with a copy of "global".
No, you can't rely on that. It's up to compiler how to allocate memory for the variables.
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
No. I don't think the C++ standard guarantees anything about the memory layout of global variables.
Memory allocation is compiler dependent. So, contiguous allocation, or identical allocation of global and class member variables, cannot be guaranteed.
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
Why don't you simply use a global object of type test\_type instead of defining multiple global variables? ``` class test_type { int a; char b; float c[10]; double d[3]; }; test_type global; ``` Now, it's a piece of cake to initialize a new test\_type object with a copy of "global".
Mick - in order to do what you want (copy/test), you will simply need to * add a constructor to test\_type class as well as a non-constructor init\_from\_globals() (whose code copies the 4 values one by one, the arrays copied in a loop or via memcopy). * Add a "diff\_from\_globals()" method, which again diffs the 4 m...
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
No. I don't think the C++ standard guarantees anything about the memory layout of global variables.
No, you can't rely on that. It's up to compiler how to allocate memory for the variables.
1,471,222
If I have a list of global variables like this... ``` int a; char b; float c[10]; double d[3]; ``` and I have an identical sequence of variables listed inside a class... ``` class test_type { int a; char b; float c[10]; double d[3]; } ``` is it guaranteed that the arrangement of all the variables ...
2009/09/24
[ "https://Stackoverflow.com/questions/1471222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169774/" ]
C/C++ standards does not require variables to be stored in the order of their declarations. So compilers are free to store variables in the order they want. But it is guaranteed that they will be initialized in the order of their declaration. This is true for both global and class member variables. Some notes on glob...
Mick - in order to do what you want (copy/test), you will simply need to * add a constructor to test\_type class as well as a non-constructor init\_from\_globals() (whose code copies the 4 values one by one, the arrays copied in a loop or via memcopy). * Add a "diff\_from\_globals()" method, which again diffs the 4 m...
11,584
What is the link between these concepts? For example let's take a process $Z\_n$ which follows a random walk, I would say that: 1. This is a martingale, because my expectations of tomorrow, i.e. n+1 depends only on today 2. If we assume an individual with rational expectation, he will assume that the forecast of tomo...
2016/04/15
[ "https://economics.stackexchange.com/questions/11584", "https://economics.stackexchange.com", "https://economics.stackexchange.com/users/9/" ]
All concepts are used in Economics. Definitions (not stated in a fully rigorous manner): **Martingale :** A stochastic process $\{X\_t\}$ is called "martingale" if and only if it holds that $$E(X\_{t+1} \mid X\_t,X\_{t-1},...) = X\_t \tag{1}$$ There are extensions like "sub-martingale", "super-martingale" but the ba...
Martingale is a very broad term, sometimes just basically meaning "the future is independent conditioned on today". Of course, any random walk has this property. So do Markov chains. "Martingale" also usually refers to a real-valued random variable that changes over time, but whose expectation is always equal to its c...
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
My issue was currency, properly formatted would change to a much larger number if the numbers entered could represent a date; such as 4.22 becoming $42,482. I discovered that adding a trailing zero solved the problem.
I had pasted numbers from another site and it kept coming up with dates. I just messed around and hit the arrow that's on the paste board to give me the option of unformatted text or HTML format. I selected unformatted, a window opened to show me the text I wanted so I pressed o.k.
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
I understand your problem with pasting pure unformatted text. This may be more work than you like (we can try to automate that later) but when I paste data from Notepad, I am prompted with an import screen as you can see below. Select the column header(s) and then select Column type: Text. This should solve your paste/...
When you are importing, you're given a bunch of options. Select "Quoted field as text" so any text inside quotes is treated as `text` which is interpreted by LibreOffice as sacred and they do not modify it in the way they they modify something that they identify as `number` [![enter image description here](https://i.s...
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
When you are importing, you're given a bunch of options. Select "Quoted field as text" so any text inside quotes is treated as `text` which is interpreted by LibreOffice as sacred and they do not modify it in the way they they modify something that they identify as `number` [![enter image description here](https://i.s...
I had pasted numbers from another site and it kept coming up with dates. I just messed around and hit the arrow that's on the paste board to give me the option of unformatted text or HTML format. I selected unformatted, a window opened to show me the text I wanted so I pressed o.k.
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
If you want your input to be interpreted as text and preventing Calc to do fancy (and annoying) things with your input, you have to change the format **before** entering any value. * Select the cells/columns/rows. * Right-click 'Format Cells...' * Select the tab 'Numbers' * In the list 'Category', select 'Text' (the l...
just simply put character ' before the text, '0.1.16 and calc will interprate it as text data
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
I understand your problem with pasting pure unformatted text. This may be more work than you like (we can try to automate that later) but when I paste data from Notepad, I am prompted with an import screen as you can see below. Select the column header(s) and then select Column type: Text. This should solve your paste/...
just simply put character ' before the text, '0.1.16 and calc will interprate it as text data
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
If you want your input to be interpreted as text and preventing Calc to do fancy (and annoying) things with your input, you have to change the format **before** entering any value. * Select the cells/columns/rows. * Right-click 'Format Cells...' * Select the tab 'Numbers' * In the list 'Category', select 'Text' (the l...
I initially arrived at this page with a very similar (but not identical) problem. I am posting the solution here for the benefit of those who might be visiting with the same issue. Every time I would save, close, and then re-open my .XSLX spreadsheet in OpenOffice, it would delete the spaces I had entered in between t...
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
When you are importing, you're given a bunch of options. Select "Quoted field as text" so any text inside quotes is treated as `text` which is interpreted by LibreOffice as sacred and they do not modify it in the way they they modify something that they identify as `number` [![enter image description here](https://i.s...
I initially arrived at this page with a very similar (but not identical) problem. I am posting the solution here for the benefit of those who might be visiting with the same issue. Every time I would save, close, and then re-open my .XSLX spreadsheet in OpenOffice, it would delete the spaces I had entered in between t...
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
When you are importing, you're given a bunch of options. Select "Quoted field as text" so any text inside quotes is treated as `text` which is interpreted by LibreOffice as sacred and they do not modify it in the way they they modify something that they identify as `number` [![enter image description here](https://i.s...
When you have your data in the clipboard click **Edit** -> **Paste as...** in main menu. In next window choose "**Paste as text**". All your data will be pasted as is.
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
just simply put character ' before the text, '0.1.16 and calc will interprate it as text data
I had pasted numbers from another site and it kept coming up with dates. I just messed around and hit the arrow that's on the paste board to give me the option of unformatted text or HTML format. I selected unformatted, a window opened to show me the text I wanted so I pressed o.k.
13,835,264
Basically, I want LibreOffice Calc to do what I tell it, not what it wants. For example: * when I input 1.1.12, I want to have 1.1.12 in that cell, not 01.01.2012 or whatever. * when I input 001, I want to have 001 in that cell, not 1 * and so on and so forth I want it to never ever touch my data until I explicitl...
2012/12/12
[ "https://Stackoverflow.com/questions/13835264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/876659/" ]
I initially arrived at this page with a very similar (but not identical) problem. I am posting the solution here for the benefit of those who might be visiting with the same issue. Every time I would save, close, and then re-open my .XSLX spreadsheet in OpenOffice, it would delete the spaces I had entered in between t...
I had pasted numbers from another site and it kept coming up with dates. I just messed around and hit the arrow that's on the paste board to give me the option of unformatted text or HTML format. I selected unformatted, a window opened to show me the text I wanted so I pressed o.k.
324,895
I am getting into the world of analog electronics, although it is much more challenging it is much more interesting. Im dabbling into audio and would like to build an op-amp amplifier followed with a class ab amplifier. But while toying around with the circuit the output voltage dropped significantly when the load went...
2017/08/20
[ "https://electronics.stackexchange.com/questions/324895", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/157907/" ]
"10 uF" is far too small for a coupling cap into 8 ohms ... try 1000uF here. And simulate a voltage source via both caps into both loads. You'll see the difference clearly. Resources? Basic AC circuit theory, covering the impedance of capacitors versus frequency.
Install Darlingtons in each device location, and increase the diode biasing from 4 diodes to 6 diodes.
324,895
I am getting into the world of analog electronics, although it is much more challenging it is much more interesting. Im dabbling into audio and would like to build an op-amp amplifier followed with a class ab amplifier. But while toying around with the circuit the output voltage dropped significantly when the load went...
2017/08/20
[ "https://electronics.stackexchange.com/questions/324895", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/157907/" ]
"10 uF" is far too small for a coupling cap into 8 ohms ... try 1000uF here. And simulate a voltage source via both caps into both loads. You'll see the difference clearly. Resources? Basic AC circuit theory, covering the impedance of capacitors versus frequency.
Anytime you see phase shifting in the presence of capacitors and AC, it probably means that your capacitor values have an impedance magnitude that 'significant' in some way. \$X\_C=\frac{1}{2 \pi f C}\approx 16\:\Omega\$ at \$1000\:\textrm{kHz}\$. And I think you can see that this is significant, relative to your low s...
324,895
I am getting into the world of analog electronics, although it is much more challenging it is much more interesting. Im dabbling into audio and would like to build an op-amp amplifier followed with a class ab amplifier. But while toying around with the circuit the output voltage dropped significantly when the load went...
2017/08/20
[ "https://electronics.stackexchange.com/questions/324895", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/157907/" ]
Anytime you see phase shifting in the presence of capacitors and AC, it probably means that your capacitor values have an impedance magnitude that 'significant' in some way. \$X\_C=\frac{1}{2 \pi f C}\approx 16\:\Omega\$ at \$1000\:\textrm{kHz}\$. And I think you can see that this is significant, relative to your low s...
Install Darlingtons in each device location, and increase the diode biasing from 4 diodes to 6 diodes.
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
It's lost. You aren't even in the same request, since it's done by a redirect. That last point is bad enough in itself (what's the point of redirecting someone to an error page?), but it affects you here. However, with `redirectMode="ResponseRewrite"` added to the `customErrors` element, then that solves this problem ...
You can log error in some file on server (you need to add Application\_Error event handler in Global.asax.cs), or drop this row in webconfig to get yellow screen with exception.
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
Per this SO post (http://stackoverflow.com/questions/343014/asp-net-custom-error-page-server-getlasterror-is-null), if you are running .Net 3.5 SP1, you can use the `redirectMode` property on your `customErrors` element. More info on the redirectMode: <http://msdn.microsoft.com/en-us/library/system.web.configuration.c...
In your global.asax you can catch the error and save it to be retrieved in the Error page. You override `Application_Error` to catch the error.
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
Per this SO post (http://stackoverflow.com/questions/343014/asp-net-custom-error-page-server-getlasterror-is-null), if you are running .Net 3.5 SP1, you can use the `redirectMode` property on your `customErrors` element. More info on the redirectMode: <http://msdn.microsoft.com/en-us/library/system.web.configuration.c...
You can log error in some file on server (you need to add Application\_Error event handler in Global.asax.cs), or drop this row in webconfig to get yellow screen with exception.
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
Per this SO post (http://stackoverflow.com/questions/343014/asp-net-custom-error-page-server-getlasterror-is-null), if you are running .Net 3.5 SP1, you can use the `redirectMode` property on your `customErrors` element. More info on the redirectMode: <http://msdn.microsoft.com/en-us/library/system.web.configuration.c...
The Exception is not lost. You can call [`Server.GetLastError()`](http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx) to get the last exception thrown. Since it returns an `Exception` object, you can simply get call `StackTrace` to get the full stack trace.
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
It's lost. You aren't even in the same request, since it's done by a redirect. That last point is bad enough in itself (what's the point of redirecting someone to an error page?), but it affects you here. However, with `redirectMode="ResponseRewrite"` added to the `customErrors` element, then that solves this problem ...
The Exception is not lost. You can call [`Server.GetLastError()`](http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx) to get the last exception thrown. Since it returns an `Exception` object, you can simply get call `StackTrace` to get the full stack trace.
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
In your global.asax you can catch the error and save it to be retrieved in the Error page. You override `Application_Error` to catch the error.
Use GetLastError, that allows you (oddly enough) to get the last error that occurred. <http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx>
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
The Exception is not lost. You can call [`Server.GetLastError()`](http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx) to get the last exception thrown. Since it returns an `Exception` object, you can simply get call `StackTrace` to get the full stack trace.
Use GetLastError, that allows you (oddly enough) to get the last error that occurred. <http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx>
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
Per this SO post (http://stackoverflow.com/questions/343014/asp-net-custom-error-page-server-getlasterror-is-null), if you are running .Net 3.5 SP1, you can use the `redirectMode` property on your `customErrors` element. More info on the redirectMode: <http://msdn.microsoft.com/en-us/library/system.web.configuration.c...
Use GetLastError, that allows you (oddly enough) to get the last error that occurred. <http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx>
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
It's lost. You aren't even in the same request, since it's done by a redirect. That last point is bad enough in itself (what's the point of redirecting someone to an error page?), but it affects you here. However, with `redirectMode="ResponseRewrite"` added to the `customErrors` element, then that solves this problem ...
Per this SO post (http://stackoverflow.com/questions/343014/asp-net-custom-error-page-server-getlasterror-is-null), if you are running .Net 3.5 SP1, you can use the `redirectMode` property on your `customErrors` element. More info on the redirectMode: <http://msdn.microsoft.com/en-us/library/system.web.configuration.c...
12,200,626
If my web.config has: ``` <customErrors mode="Off" defaultRedirect="CustomErrorPage.aspx"> <error statusCode="401" redirect="~/CustomErrorPage.aspx?statusCode=401" /> <error statusCode="403" redirect="~/CustomErrorPage.aspx?statusCode=403" /> <error statusCode="404" redirect="~/CustomErrorPage.aspx?s...
2012/08/30
[ "https://Stackoverflow.com/questions/12200626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1361315/" ]
It's lost. You aren't even in the same request, since it's done by a redirect. That last point is bad enough in itself (what's the point of redirecting someone to an error page?), but it affects you here. However, with `redirectMode="ResponseRewrite"` added to the `customErrors` element, then that solves this problem ...
Use GetLastError, that allows you (oddly enough) to get the last error that occurred. <http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx>
60,059,390
I want to select the distinct `a, b`'s for which **all** the `c`'s have a specific value (in my case **null**) So given the rows below ``` a b c AN8 USD 99 AN8 USD AT0 EUR AT0 EUR ``` the result should be ``` a b AT0 EUR ``` I have failed to successfully translate that to a query, could you please hel...
2020/02/04
[ "https://Stackoverflow.com/questions/60059390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2895833/" ]
Try: ``` select a, b from foo group by a, b having bool_and(c is null); ``` where `bool_and` is a postgres aggregate function. Or maybe this, should work with ANSI sql I think: ``` select a, b from foo group by a, b having count(c) = 0; ```
You can also try below: ``` select a, b from table where c is NULL group by a, b having count(*)>1; ```
60,059,390
I want to select the distinct `a, b`'s for which **all** the `c`'s have a specific value (in my case **null**) So given the rows below ``` a b c AN8 USD 99 AN8 USD AT0 EUR AT0 EUR ``` the result should be ``` a b AT0 EUR ``` I have failed to successfully translate that to a query, could you please hel...
2020/02/04
[ "https://Stackoverflow.com/questions/60059390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2895833/" ]
Try: ``` select a, b from foo group by a, b having bool_and(c is null); ``` where `bool_and` is a postgres aggregate function. Or maybe this, should work with ANSI sql I think: ``` select a, b from foo group by a, b having count(c) = 0; ```
If you `group by a, b` any aggregation function like `min()`, `max()`, `sum()` or even `avg()` on `c` returns `null` for the condition that you set: ``` select a, b from tablename group by a, b having max(c) is null ``` See the [demo](https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=9e21f729d17c12633b6f66f912548e3d)...
60,059,390
I want to select the distinct `a, b`'s for which **all** the `c`'s have a specific value (in my case **null**) So given the rows below ``` a b c AN8 USD 99 AN8 USD AT0 EUR AT0 EUR ``` the result should be ``` a b AT0 EUR ``` I have failed to successfully translate that to a query, could you please hel...
2020/02/04
[ "https://Stackoverflow.com/questions/60059390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2895833/" ]
If you `group by a, b` any aggregation function like `min()`, `max()`, `sum()` or even `avg()` on `c` returns `null` for the condition that you set: ``` select a, b from tablename group by a, b having max(c) is null ``` See the [demo](https://dbfiddle.uk/?rdbms=sqlserver_2019&fiddle=9e21f729d17c12633b6f66f912548e3d)...
You can also try below: ``` select a, b from table where c is NULL group by a, b having count(*)>1; ```
2,383,695
> > Why should we have $\sin^2(x) = \frac{1-\cos(2x)}{2}$ knowing that $\sin^2(x) = 1 - \cos^2(x)$? > > > Logically, can you not subtract $\cos^2(x)$ to the other side from this Pythagorean identity $\sin^2(x)+\cos^2(x)=1?$ When I look up trig identities, however, it says $\sin^2(x) = \frac{1-\cos(2x)}{2}$. Wh...
2017/08/05
[ "https://math.stackexchange.com/questions/2383695", "https://math.stackexchange.com", "https://math.stackexchange.com/users/469802/" ]
Notice that $\cos^{2}(x):=(\cos(x))^{2}$ is not the same thing as $\cos(2x)$. It is indeed true that $\sin^{2}(x)=1-\cos^{2}(x)$ and that $\sin^{2}(x)=\frac{1-\cos(2x)}{2}$.
From the angle addition formula, we have $$\begin{align} \cos(2x)&=\cos(x+x)\\\\ &=\cos(x)\cos(x)-\sin(x)\sin(x)\\\\ &=\cos^2(x)-\sin^2(x)\\\\ &=\left(1-\sin^2(x)\right)-\sin^2(x)\\\\ &=1-2\sin^2(x)\tag 1 \end{align}$$ Solving $(1)$ for $\sin^2(x)$ yields $$\sin^2(x)=\frac{1-\cos(2x)}{2}$$ as expected.
2,383,695
> > Why should we have $\sin^2(x) = \frac{1-\cos(2x)}{2}$ knowing that $\sin^2(x) = 1 - \cos^2(x)$? > > > Logically, can you not subtract $\cos^2(x)$ to the other side from this Pythagorean identity $\sin^2(x)+\cos^2(x)=1?$ When I look up trig identities, however, it says $\sin^2(x) = \frac{1-\cos(2x)}{2}$. Wh...
2017/08/05
[ "https://math.stackexchange.com/questions/2383695", "https://math.stackexchange.com", "https://math.stackexchange.com/users/469802/" ]
From the angle addition formula, we have $$\begin{align} \cos(2x)&=\cos(x+x)\\\\ &=\cos(x)\cos(x)-\sin(x)\sin(x)\\\\ &=\cos^2(x)-\sin^2(x)\\\\ &=\left(1-\sin^2(x)\right)-\sin^2(x)\\\\ &=1-2\sin^2(x)\tag 1 \end{align}$$ Solving $(1)$ for $\sin^2(x)$ yields $$\sin^2(x)=\frac{1-\cos(2x)}{2}$$ as expected.
Let's address two things, the question in the post and the confusion others have pointed out. Part 1: Proof ------------- Here's a proof that $\cos^2(\theta)+\sin^2(\theta)=1$, from which you can show that $\sin^2(\theta)=1-\cos^2(\theta)$. It requires a bit of set up using the Euler identity and that $i=\sqrt{-1}$. ...
2,383,695
> > Why should we have $\sin^2(x) = \frac{1-\cos(2x)}{2}$ knowing that $\sin^2(x) = 1 - \cos^2(x)$? > > > Logically, can you not subtract $\cos^2(x)$ to the other side from this Pythagorean identity $\sin^2(x)+\cos^2(x)=1?$ When I look up trig identities, however, it says $\sin^2(x) = \frac{1-\cos(2x)}{2}$. Wh...
2017/08/05
[ "https://math.stackexchange.com/questions/2383695", "https://math.stackexchange.com", "https://math.stackexchange.com/users/469802/" ]
Notice that $\cos^{2}(x):=(\cos(x))^{2}$ is not the same thing as $\cos(2x)$. It is indeed true that $\sin^{2}(x)=1-\cos^{2}(x)$ and that $\sin^{2}(x)=\frac{1-\cos(2x)}{2}$.
Both formulas are true, however, both are useful in different contexts (applications). * You use $\sin^2(x) = \frac{1-\cos(2x)}{2}$ for integrating $\sin^2(x)$. * You use $\sin^2(x) = 1 - \cos^2(x)$, for example, when solving $\sin^2(x) = 2\cos(x)$. Note that it is just in some way more "natural" to write $\sin^2(x) ...
2,383,695
> > Why should we have $\sin^2(x) = \frac{1-\cos(2x)}{2}$ knowing that $\sin^2(x) = 1 - \cos^2(x)$? > > > Logically, can you not subtract $\cos^2(x)$ to the other side from this Pythagorean identity $\sin^2(x)+\cos^2(x)=1?$ When I look up trig identities, however, it says $\sin^2(x) = \frac{1-\cos(2x)}{2}$. Wh...
2017/08/05
[ "https://math.stackexchange.com/questions/2383695", "https://math.stackexchange.com", "https://math.stackexchange.com/users/469802/" ]
Notice that $\cos^{2}(x):=(\cos(x))^{2}$ is not the same thing as $\cos(2x)$. It is indeed true that $\sin^{2}(x)=1-\cos^{2}(x)$ and that $\sin^{2}(x)=\frac{1-\cos(2x)}{2}$.
Let's address two things, the question in the post and the confusion others have pointed out. Part 1: Proof ------------- Here's a proof that $\cos^2(\theta)+\sin^2(\theta)=1$, from which you can show that $\sin^2(\theta)=1-\cos^2(\theta)$. It requires a bit of set up using the Euler identity and that $i=\sqrt{-1}$. ...
2,383,695
> > Why should we have $\sin^2(x) = \frac{1-\cos(2x)}{2}$ knowing that $\sin^2(x) = 1 - \cos^2(x)$? > > > Logically, can you not subtract $\cos^2(x)$ to the other side from this Pythagorean identity $\sin^2(x)+\cos^2(x)=1?$ When I look up trig identities, however, it says $\sin^2(x) = \frac{1-\cos(2x)}{2}$. Wh...
2017/08/05
[ "https://math.stackexchange.com/questions/2383695", "https://math.stackexchange.com", "https://math.stackexchange.com/users/469802/" ]
Both formulas are true, however, both are useful in different contexts (applications). * You use $\sin^2(x) = \frac{1-\cos(2x)}{2}$ for integrating $\sin^2(x)$. * You use $\sin^2(x) = 1 - \cos^2(x)$, for example, when solving $\sin^2(x) = 2\cos(x)$. Note that it is just in some way more "natural" to write $\sin^2(x) ...
Let's address two things, the question in the post and the confusion others have pointed out. Part 1: Proof ------------- Here's a proof that $\cos^2(\theta)+\sin^2(\theta)=1$, from which you can show that $\sin^2(\theta)=1-\cos^2(\theta)$. It requires a bit of set up using the Euler identity and that $i=\sqrt{-1}$. ...
143,656
The story : I create lets say a simple module to store input data and sent a mail when you click save. Now i done the part of store data, send mail and retrieve data, but i would like to add tokens to the mail part. So for now i have something like this. ``` function mymodule_form (){ $form['name'] = arra...
2015/01/08
[ "https://drupal.stackexchange.com/questions/143656", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/20471/" ]
You would have to add them to a global token piece like [site] for them to be able to be used anywhere tokens are used. But to use in a custom module you can use the following hooks: Generate token info: ``` /** * Implements hook_token_info(). */ function module_name_token_info() { $info = array(); // Define ...
Thanks for the help i did it this way: ``` function mymodule_submit(){ here goes the part for saving data into table(not going to write it).... /*mail send*/ $text=array(); $subject=array(); $mail = db_query("SELECT * FROM {mail_data} WHERE mail_id=2"); foreach ($mail as $data){ $text = $...
143,656
The story : I create lets say a simple module to store input data and sent a mail when you click save. Now i done the part of store data, send mail and retrieve data, but i would like to add tokens to the mail part. So for now i have something like this. ``` function mymodule_form (){ $form['name'] = arra...
2015/01/08
[ "https://drupal.stackexchange.com/questions/143656", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/20471/" ]
You would have to add them to a global token piece like [site] for them to be able to be used anywhere tokens are used. But to use in a custom module you can use the following hooks: Generate token info: ``` /** * Implements hook_token_info(). */ function module_name_token_info() { $info = array(); // Define ...
The answer given by @burnsjeremy shows you how to define the custom tokens. To actually use the custom tokens, you need to use [token\_replace()](https://api.drupal.org/api/drupal/includes%21token.inc/function/token_replace/7.x). Token replacement should be done in your custom hook\_mail(). Because your module is calle...
143,656
The story : I create lets say a simple module to store input data and sent a mail when you click save. Now i done the part of store data, send mail and retrieve data, but i would like to add tokens to the mail part. So for now i have something like this. ``` function mymodule_form (){ $form['name'] = arra...
2015/01/08
[ "https://drupal.stackexchange.com/questions/143656", "https://drupal.stackexchange.com", "https://drupal.stackexchange.com/users/20471/" ]
The answer given by @burnsjeremy shows you how to define the custom tokens. To actually use the custom tokens, you need to use [token\_replace()](https://api.drupal.org/api/drupal/includes%21token.inc/function/token_replace/7.x). Token replacement should be done in your custom hook\_mail(). Because your module is calle...
Thanks for the help i did it this way: ``` function mymodule_submit(){ here goes the part for saving data into table(not going to write it).... /*mail send*/ $text=array(); $subject=array(); $mail = db_query("SELECT * FROM {mail_data} WHERE mail_id=2"); foreach ($mail as $data){ $text = $...
108,172
Is it possible to search for multiple content types (products, categories, blogs, articles etc) in Magento? I got the search result for products only. I want to display products when to search for the category name.
2016/03/28
[ "https://magento.stackexchange.com/questions/108172", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/34346/" ]
Note that there are different Context objects, in this case it's `\Magento\Framework\App\Action\Context` and to understand it, you should read it as "ActionContext". It represents the application context in which the action is executed. In other words, it gives you access to all objects with application state that a co...
Context objects were introduced to isolate third party developers from changes in constructors of abstract classes. In Magento 1 Abstract classes with a lot of "helper" behaviour were considered a convenient API for class extender. This caused huge numbers of methods and implicit dependencies in abstract classes (`Abs...
108,172
Is it possible to search for multiple content types (products, categories, blogs, articles etc) in Magento? I got the search result for products only. I want to display products when to search for the category name.
2016/03/28
[ "https://magento.stackexchange.com/questions/108172", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/34346/" ]
Note that there are different Context objects, in this case it's `\Magento\Framework\App\Action\Context` and to understand it, you should read it as "ActionContext". It represents the application context in which the action is executed. In other words, it gives you access to all objects with application state that a co...
Magento2 – Use Defined Methods from Context Object When you run php bin/magento setup:di:compile command in magento2, Sometimes this type of error occurs “Incorrect dependency in class“. This error occurs when we use some class’s object in constructor which is already present in $context object. Solution of this prob...
108,172
Is it possible to search for multiple content types (products, categories, blogs, articles etc) in Magento? I got the search result for products only. I want to display products when to search for the category name.
2016/03/28
[ "https://magento.stackexchange.com/questions/108172", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/34346/" ]
Context objects were introduced to isolate third party developers from changes in constructors of abstract classes. In Magento 1 Abstract classes with a lot of "helper" behaviour were considered a convenient API for class extender. This caused huge numbers of methods and implicit dependencies in abstract classes (`Abs...
Magento2 – Use Defined Methods from Context Object When you run php bin/magento setup:di:compile command in magento2, Sometimes this type of error occurs “Incorrect dependency in class“. This error occurs when we use some class’s object in constructor which is already present in $context object. Solution of this prob...
60,950,557
I would like to aggregate multiple 2D sheets within same scene of Forge viewer. Testing with the legendary "Office" model so it's easy for you to reproduce. When loading sheet1 everything is ok, when loading a second sheet the sheet itself completely overlap the sheet1 so none of the entities on sheet1 are visible any ...
2020/03/31
[ "https://Stackoverflow.com/questions/60950557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4916074/" ]
(ie. from tip#4 above) To overlay 2 different sheets on top of each other, using the two sheets example above, see the image below and this code snippet: Use the model browser to hide/show each layer (in the image, there are two models): ``` view.viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_E...
Unfortunately as things were before it is not yet possible to aggregate 2D sheets with Viewer so as a workaround you’d need to made do with multiple Viewer instances in parallel on one page and try achieve overlapping with CSS settings (which is a bit hacky obviously this approach has its limitations as the geometry an...
60,950,557
I would like to aggregate multiple 2D sheets within same scene of Forge viewer. Testing with the legendary "Office" model so it's easy for you to reproduce. When loading sheet1 everything is ok, when loading a second sheet the sheet itself completely overlap the sheet1 so none of the entities on sheet1 are visible any ...
2020/03/31
[ "https://Stackoverflow.com/questions/60950557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4916074/" ]
(ie. from tip#4 above) To overlay 2 different sheets on top of each other, using the two sheets example above, see the image below and this code snippet: Use the model browser to hide/show each layer (in the image, there are two models): ``` view.viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_E...
I have three tips for multi-model. I'm writing a blog post on it. The first tip: To get side-by-side-2d-sheets, I changed the placementTransform in the options3D. [![side-by-side-2d-sheets](https://i.stack.imgur.com/8fv0Q.gif)](https://i.stack.imgur.com/8fv0Q.gif) placement transform notes: <https://forge.autodesk.c...
60,950,557
I would like to aggregate multiple 2D sheets within same scene of Forge viewer. Testing with the legendary "Office" model so it's easy for you to reproduce. When loading sheet1 everything is ok, when loading a second sheet the sheet itself completely overlap the sheet1 so none of the entities on sheet1 are visible any ...
2020/03/31
[ "https://Stackoverflow.com/questions/60950557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4916074/" ]
(ie. from tip#4 above) To overlay 2 different sheets on top of each other, using the two sheets example above, see the image below and this code snippet: Use the model browser to hide/show each layer (in the image, there are two models): ``` view.viewer.addEventListener(Autodesk.Viewing.GEOMETRY_LOADED_E...
Did you try modelSpace:true in the options ? let options = { placementTransform: new window.THREE.Matrix4(), modelSpace: true, globalOffset: { x: 0, y: 0, z: 0 }, applyRefPoint: true, isAEC: true, // to align the models, } More details here: [Autodesk forge viewer api v7.\* align multiple 2d dwg models](https:...
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
You have a DISTINCT. This means that to find 10 distinct rows, it's necessary to scan all rows that match the predicate until 10 *different* some\_fields are found. Depending on your indices, the query optimizer may decide that scanning all rows is the best way to do this. 10 distinct rows could represent 10, a milli...
I'm suspicious it's because you don't have an ORDER BY. Without ordering, you might have to cruise a whole lot of records to get 10 that meet your criterion.
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
Any time there's an operation that involves aggregation, and "DISTINCT" certainly qualifies, the optimizer is going to do the aggration before even thinking about what's next. And aggration means scanning the whole table (in your case involving a sort, unless there's an index). But the most likely deal-breaker is that...
I'm suspicious it's because you don't have an ORDER BY. Without ordering, you might have to cruise a whole lot of records to get 10 that meet your criterion.
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
how big is the table? do you have any indexes on the table? check your query execution plan to determine if it's doing a table scan, an index scan, or an index seek. if it's doing a table scan then you most likely dont have any indexes. try putting an index on the field your filtering by and/or the field your selectin...
I'm suspicious it's because you don't have an ORDER BY. Without ordering, you might have to cruise a whole lot of records to get 10 that meet your criterion.
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
Can you post the results of running EXPLAIN on the query? This will reveal what Postgres is doing to execute the query, and is generally the first step in diagnosing query performance problems. It may be sorting or constructing a hash table of the entire rowset to eliminate the non-distinct records before returning th...
I'm suspicious it's because you don't have an ORDER BY. Without ordering, you might have to cruise a whole lot of records to get 10 that meet your criterion.
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
You have a DISTINCT. This means that to find 10 distinct rows, it's necessary to scan all rows that match the predicate until 10 *different* some\_fields are found. Depending on your indices, the query optimizer may decide that scanning all rows is the best way to do this. 10 distinct rows could represent 10, a milli...
Any time there's an operation that involves aggregation, and "DISTINCT" certainly qualifies, the optimizer is going to do the aggration before even thinking about what's next. And aggration means scanning the whole table (in your case involving a sort, unless there's an index). But the most likely deal-breaker is that...
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
You have a DISTINCT. This means that to find 10 distinct rows, it's necessary to scan all rows that match the predicate until 10 *different* some\_fields are found. Depending on your indices, the query optimizer may decide that scanning all rows is the best way to do this. 10 distinct rows could represent 10, a milli...
how big is the table? do you have any indexes on the table? check your query execution plan to determine if it's doing a table scan, an index scan, or an index seek. if it's doing a table scan then you most likely dont have any indexes. try putting an index on the field your filtering by and/or the field your selectin...
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
You have a DISTINCT. This means that to find 10 distinct rows, it's necessary to scan all rows that match the predicate until 10 *different* some\_fields are found. Depending on your indices, the query optimizer may decide that scanning all rows is the best way to do this. 10 distinct rows could represent 10, a milli...
Can you post the results of running EXPLAIN on the query? This will reveal what Postgres is doing to execute the query, and is generally the first step in diagnosing query performance problems. It may be sorting or constructing a hash table of the entire rowset to eliminate the non-distinct records before returning th...
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
Any time there's an operation that involves aggregation, and "DISTINCT" certainly qualifies, the optimizer is going to do the aggration before even thinking about what's next. And aggration means scanning the whole table (in your case involving a sort, unless there's an index). But the most likely deal-breaker is that...
how big is the table? do you have any indexes on the table? check your query execution plan to determine if it's doing a table scan, an index scan, or an index seek. if it's doing a table scan then you most likely dont have any indexes. try putting an index on the field your filtering by and/or the field your selectin...
792,060
consider the following pgSQL statement: ``` SELECT DISTINCT some_field FROM some_table WHERE some_field LIKE 'text%' LIMIT 10; ``` Consider also, that some\_table consists of several million records, and that some\_field has a b-tree index. Why does the query take so long to execute (several minutes)? What...
2009/04/27
[ "https://Stackoverflow.com/questions/792060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
Can you post the results of running EXPLAIN on the query? This will reveal what Postgres is doing to execute the query, and is generally the first step in diagnosing query performance problems. It may be sorting or constructing a hash table of the entire rowset to eliminate the non-distinct records before returning th...
how big is the table? do you have any indexes on the table? check your query execution plan to determine if it's doing a table scan, an index scan, or an index seek. if it's doing a table scan then you most likely dont have any indexes. try putting an index on the field your filtering by and/or the field your selectin...
74,264,817
so I have a string as shown below ``` seqs = """>UDW38231.1 |surface glycoprotein|MS|GenBank|ssRNA(+) MFVFLVLLPLVSSQCVNLRTRTQLPPAYTNSFTRGVYYPDKVFRSSVLHSTQDLFLPFFS NVTWFHAIHVSGTNGTKRFDNPVLPFNDGVYFASIEKSNIIRGWIFGTTLDSKTQSLIIV NNATNVVIKVCEFQFCNDPFLDVYYHKNNKSWMESGVYSSANNCTFEYVSQPFLMDLEGK QGNFKNLREFVFKNIDGYFKIYSKHTPINLVRDL...
2022/10/31
[ "https://Stackoverflow.com/questions/74264817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16483846/" ]
FWIW, I think your existing solution is fine (and it's probably faster than what I'm about to suggest), but if you want something that involves `append` rather than `split` and `replace` you could do: ``` >>> seq_list = [] >>> for c in seqs: ... if c == ">": ... seq_list.append("") ... elif c != "\n": ...
You can use `re` : ```py import re list_sequences = re.findall(r">([^>|]+)\|([^>|]+)\|([^>|]+)\|([^>|]+)\|([^>|\n]+)\s+([^>|]+)\n", seqs) list_sequences = [list(map(lambda s : s.replace("\n", "").strip(), seq)) for seq in list_sequences] print(list_sequences) # [['UDW38231.1', 'surface glycoprotein', 'MS', 'GenBank'...
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
If your weather patterns are predictable, you can just use a one liner: ``` $img = str_replace ( ' ' , '_', $desc ) . '.png'; ``` However if you have a list that you cannot just alter dynaically you can use this: ``` $descriptions = [ 'clear sky'=>'clear_sky', 'few clouds'=>'few_clouds', 'scattered c...
``` <?php $desc = "clear sky"; $weather_icon = str_replace(" ","_",$desc).".png"; echo $weather_icon; ?> ```
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
If your weather patterns are predictable, you can just use a one liner: ``` $img = str_replace ( ' ' , '_', $desc ) . '.png'; ``` However if you have a list that you cannot just alter dynaically you can use this: ``` $descriptions = [ 'clear sky'=>'clear_sky', 'few clouds'=>'few_clouds', 'scattered c...
It looks like you have a some fixed notation. You could use this: ``` <?php $desc = 'clear sky'; convertDescriptionToImage( $desc ); function convertDescriptionToImage( $description ) { $arrayCodes = ["clear sky", "few clouds"]; if ( TRUE == in_array( $description, $arrayCodes ) ) { return str_rep...
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
Arrays are the glue that holds the universe together (if the universe is written in PHP). ``` $map = [ 'clear sky' => "clear_sky.png", 'few clouds' =>"few_clouds.png", 'scattered clouds' => 'scattered_clouds.png' 'broken clouds' => 'broken_clouds.png' ]; if (isset($map[$desc])) { $weather_icon = $map[...
If your weather patterns are predictable, you can just use a one liner: ``` $img = str_replace ( ' ' , '_', $desc ) . '.png'; ``` However if you have a list that you cannot just alter dynaically you can use this: ``` $descriptions = [ 'clear sky'=>'clear_sky', 'few clouds'=>'few_clouds', 'scattered c...
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
Since your description matches what you're looking for you could do this. ``` if ( in_array( $desc, array( 'clear sky', 'few clouds', 'scattered clouds', 'broken clouds' ) ) ) { $weather_icon = str_replace(' ', '_', $desc) . '.png'; } ...
``` <?php $desc = "clear sky"; $weather_icon = str_replace(" ","_",$desc).".png"; echo $weather_icon; ?> ```
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
Since your description matches what you're looking for you could do this. ``` if ( in_array( $desc, array( 'clear sky', 'few clouds', 'scattered clouds', 'broken clouds' ) ) ) { $weather_icon = str_replace(' ', '_', $desc) . '.png'; } ...
It looks like you have a some fixed notation. You could use this: ``` <?php $desc = 'clear sky'; convertDescriptionToImage( $desc ); function convertDescriptionToImage( $description ) { $arrayCodes = ["clear sky", "few clouds"]; if ( TRUE == in_array( $description, $arrayCodes ) ) { return str_rep...
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
Arrays are the glue that holds the universe together (if the universe is written in PHP). ``` $map = [ 'clear sky' => "clear_sky.png", 'few clouds' =>"few_clouds.png", 'scattered clouds' => 'scattered_clouds.png' 'broken clouds' => 'broken_clouds.png' ]; if (isset($map[$desc])) { $weather_icon = $map[...
Since your description matches what you're looking for you could do this. ``` if ( in_array( $desc, array( 'clear sky', 'few clouds', 'scattered clouds', 'broken clouds' ) ) ) { $weather_icon = str_replace(' ', '_', $desc) . '.png'; } ...
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
Arrays are the glue that holds the universe together (if the universe is written in PHP). ``` $map = [ 'clear sky' => "clear_sky.png", 'few clouds' =>"few_clouds.png", 'scattered clouds' => 'scattered_clouds.png' 'broken clouds' => 'broken_clouds.png' ]; if (isset($map[$desc])) { $weather_icon = $map[...
``` <?php $desc = "clear sky"; $weather_icon = str_replace(" ","_",$desc).".png"; echo $weather_icon; ?> ```
43,260,065
i have a question about shorten if else statement. I am trying to make a weather application using [OpenWeatherMap](https://openweathermap.org/weather-conditions) api. But i don't like those icons. I want to change the icons like this: ``` if($desc == 'clear sky'){ $weather_icon = 'clear_sky.png'; }else if($desc == ...
2017/04/06
[ "https://Stackoverflow.com/questions/43260065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5715258/" ]
Arrays are the glue that holds the universe together (if the universe is written in PHP). ``` $map = [ 'clear sky' => "clear_sky.png", 'few clouds' =>"few_clouds.png", 'scattered clouds' => 'scattered_clouds.png' 'broken clouds' => 'broken_clouds.png' ]; if (isset($map[$desc])) { $weather_icon = $map[...
It looks like you have a some fixed notation. You could use this: ``` <?php $desc = 'clear sky'; convertDescriptionToImage( $desc ); function convertDescriptionToImage( $description ) { $arrayCodes = ["clear sky", "few clouds"]; if ( TRUE == in_array( $description, $arrayCodes ) ) { return str_rep...
36,751,395
I am using Django 1.9. I have a Django table that represents the value of a particular measure, by organisation by month, with raw values and percentiles: ``` class MeasureValue(models.Model): org = models.ForeignKey(Org, null=True, blank=True) month = models.DateField() calc_value = models.FloatField(null...
2016/04/20
[ "https://Stackoverflow.com/questions/36751395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194000/" ]
Atomic transactions can reduce the time spent in the loop: ``` from django.db import transaction with transaction.atomic(): for i, row in df.iterrows(): mv = MeasureValue.objects.get(org=row.org, month=month) if (row.percentile is None) or np.isnan(row.percentile): # if it's already ...
As of Django 2.2, you can use the [`bulk_update()`](https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-update) queryset method to efficiently update the given fields on the provided model instances, generally with one query: ``` objs = [ Entry.objects.create(headline='Entry 1'), Entry.objects.cre...
36,751,395
I am using Django 1.9. I have a Django table that represents the value of a particular measure, by organisation by month, with raw values and percentiles: ``` class MeasureValue(models.Model): org = models.ForeignKey(Org, null=True, blank=True) month = models.DateField() calc_value = models.FloatField(null...
2016/04/20
[ "https://Stackoverflow.com/questions/36751395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194000/" ]
Atomic transactions can reduce the time spent in the loop: ``` from django.db import transaction with transaction.atomic(): for i, row in df.iterrows(): mv = MeasureValue.objects.get(org=row.org, month=month) if (row.percentile is None) or np.isnan(row.percentile): # if it's already ...
Actually, attempting @Eugene Yarmash 's answer I found I got this error: `FieldError: Joined field references are not permitted in this query` But I believe iterating `update` is still quicker than multiple saves, and I expect using a transaction should also expedite. So, for versions of Django that don't offer `bul...
36,751,395
I am using Django 1.9. I have a Django table that represents the value of a particular measure, by organisation by month, with raw values and percentiles: ``` class MeasureValue(models.Model): org = models.ForeignKey(Org, null=True, blank=True) month = models.DateField() calc_value = models.FloatField(null...
2016/04/20
[ "https://Stackoverflow.com/questions/36751395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194000/" ]
As of Django 2.2, you can use the [`bulk_update()`](https://docs.djangoproject.com/en/dev/ref/models/querysets/#bulk-update) queryset method to efficiently update the given fields on the provided model instances, generally with one query: ``` objs = [ Entry.objects.create(headline='Entry 1'), Entry.objects.cre...
Actually, attempting @Eugene Yarmash 's answer I found I got this error: `FieldError: Joined field references are not permitted in this query` But I believe iterating `update` is still quicker than multiple saves, and I expect using a transaction should also expedite. So, for versions of Django that don't offer `bul...
70,613,285
I have this code, but its doesn't show up the maps (output). I don't know what is the error. ``` import geemap Map=geemap.Map() Map ``` After running the above code, I get the error "AttributeError: module 'collections' has no attribute 'Callable'" I have also tried the code below, but this one gives the error "Att...
2022/01/06
[ "https://Stackoverflow.com/questions/70613285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15430674/" ]
I had this problem and fixed it by downgrading my python version to be less than 3.10.
This problem was informed [here](https://github.com/GoogleCloudPlatform/httplib2shim/issues/15), to solve this I edited the httplib2shim package in C:\Users\USERxx\AppData\Local\Programs\Python\Python310\Lib\site-packages\httplib2shim\_*init*\_.py Changing the line 45: 45 if isinstance(proxy\_info, collections.Calla...
70,613,285
I have this code, but its doesn't show up the maps (output). I don't know what is the error. ``` import geemap Map=geemap.Map() Map ``` After running the above code, I get the error "AttributeError: module 'collections' has no attribute 'Callable'" I have also tried the code below, but this one gives the error "Att...
2022/01/06
[ "https://Stackoverflow.com/questions/70613285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15430674/" ]
I had this problem and fixed it by downgrading my python version to be less than 3.10.
You can solve the problem in one easy way. The new python file name and the built-in function name conflict are modified, change the name of the Python file.
64,668,137
I have demographic data set, which includes the age of people in a household. This is collected via a survey and participants are allowed to refuse providing their age. The result is a data set with one household per row (each with a household ID code), and various household characteristics such as age in the columns....
2020/11/03
[ "https://Stackoverflow.com/questions/64668137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14235320/" ]
Why not simply? ``` df[,2:5][df[, 2:5] == 'R'] <- '-9' # A tibble: 5 x 5 Household_ID AGE1 AGE2 AGE3 AGE4 <chr> <chr> <chr> <chr> <chr> 1 1A 25 66 28 81 2 1B 47 23 17 22 3 1C 39 71 -9 48 4 1D 50 -9 -9 59 5 1E ...
You could use `across` with `replace`. 1. List to tibble with `as_tibble()` 2. replace R with -9 3. integer class for AGE ``` df %>% as_tibble() %>% mutate(across(everything(), ~replace(., . == "R" , "-9"))) %>% type.convert(as.is=TRUE) ``` Output: ``` Household_ID AGE1 AGE2 AGE3 AGE4 <chr> ...
64,668,137
I have demographic data set, which includes the age of people in a household. This is collected via a survey and participants are allowed to refuse providing their age. The result is a data set with one household per row (each with a household ID code), and various household characteristics such as age in the columns....
2020/11/03
[ "https://Stackoverflow.com/questions/64668137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14235320/" ]
Or maybe this one which is not much difference from dear @TarJae's interpretation: ``` library(dplyr) library(stringr) df %>% mutate(across(AGE1:AGE4, ~ str_replace(., "R", "-9")), across(AGE1:AGE4, as.integer)) # A tibble: 5 x 5 Household_ID AGE1 AGE2 AGE3 AGE4 <chr> <int> <int> <int> <int...
You could use `across` with `replace`. 1. List to tibble with `as_tibble()` 2. replace R with -9 3. integer class for AGE ``` df %>% as_tibble() %>% mutate(across(everything(), ~replace(., . == "R" , "-9"))) %>% type.convert(as.is=TRUE) ``` Output: ``` Household_ID AGE1 AGE2 AGE3 AGE4 <chr> ...
57,815,696
How can I create this nested child json in C#? I am unable to figure out how to add into list to child nestedly. I am using [this](http://bl.ocks.org/d3noob/8375092). **JSON** ``` { "name": "Top Level", "parent": "null", "children": [ { "name": "Level 2: A", "parent": "Top Level", "children": [ {...
2019/09/06
[ "https://Stackoverflow.com/questions/57815696", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4569045/" ]
You always have to return the same type from both branches. If you want to return different types what you can do is to instead use `Either A B` from both branches and use `Left a` in one case and `Right b` in the other. So for a full example, let’s say you have an `if` and an `Int` in the first branch and a `Text` in ...
but this if else return makes the **template to archive it**,without allowing other data to be execute
7,706,699
What is the best method for adding time to a timestamp? I have in a database **2011-10-09 10:29:23** and I would like add to this 20 days. How can I do that? I need an example for: 1. 20 hours 2. 20 days
2011/10/09
[ "https://Stackoverflow.com/questions/7706699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/964920/" ]
You can use [Date::add](http://fr.php.net/manual/fr/datetime.add.php) like this: ``` <?php $date = new DateTime('2011-10-09 10:29:23'); $date->add(new DateInterval('P20D')); //use PT20H for 20 hours echo $date->format('Y-m-d H:i:s'); ?> ```
<http://www.php.net/manual/en/function.strtotime.php> Use PHP's strtotime function like: ``` $newtimestamp = strtotime("+20 days", $yourtimestamp); ```