qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
342,914
This question has come from a conversation at loggerheads. I can't find the answer online. There are two positions on which is the correct expression to use when starting a job.For the example, I've used a job as a plumber. Person A states "John becomes a plumber today" Person B states "John has started working as a p...
2016/08/15
[ "https://english.stackexchange.com/questions/342914", "https://english.stackexchange.com", "https://english.stackexchange.com/users/191368/" ]
Quote ----- I haven't read the book but I searched for the line you are mentioning on [goodreads](https://www.goodreads.com/work/quotes/16176791-the-song-of-achilles). This is the complete quote: > > *I stopped watching for ridicule, the scorpion's tail hidden in his words. He said what he meant; he was puzzled if y...
"To cut to the heart" could mean different things in different contexts. For example it could be a poetic way of saying "When you attack someone, you hurt them very badly", or perhaps, using the metaphor "the heart of the problem" (meaning the most important aspect), "When you analyse a problem, you immediately see the...
342,914
This question has come from a conversation at loggerheads. I can't find the answer online. There are two positions on which is the correct expression to use when starting a job.For the example, I've used a job as a plumber. Person A states "John becomes a plumber today" Person B states "John has started working as a p...
2016/08/15
[ "https://english.stackexchange.com/questions/342914", "https://english.stackexchange.com", "https://english.stackexchange.com/users/191368/" ]
Considering this is the part you're talking about: > > I stopped watching for ridicule, the scorpion's tail hidden in his words. He said what he meant; he was puzzled if you did not. Some people might have mistaken this for simplicity. But is it not a sort of genius to cut always to the heart? > > > I believe the...
To "cut to the heart of the matter" is an idiom that means "get straight to the point". But "cut to the heart" can also mean to strongly engage someone's emotions, as a song might do. Which meaning applies would depend on context.
342,914
This question has come from a conversation at loggerheads. I can't find the answer online. There are two positions on which is the correct expression to use when starting a job.For the example, I've used a job as a plumber. Person A states "John becomes a plumber today" Person B states "John has started working as a p...
2016/08/15
[ "https://english.stackexchange.com/questions/342914", "https://english.stackexchange.com", "https://english.stackexchange.com/users/191368/" ]
Considering this is the part you're talking about: > > I stopped watching for ridicule, the scorpion's tail hidden in his words. He said what he meant; he was puzzled if you did not. Some people might have mistaken this for simplicity. But is it not a sort of genius to cut always to the heart? > > > I believe the...
Quote ----- I haven't read the book but I searched for the line you are mentioning on [goodreads](https://www.goodreads.com/work/quotes/16176791-the-song-of-achilles). This is the complete quote: > > *I stopped watching for ridicule, the scorpion's tail hidden in his words. He said what he meant; he was puzzled if y...
40,266,666
I'm storing an array of comma separated values in my database in a column called `line_services`. The data in the column looks like `1,1,1,1,0,0,0` and I have a prepared statement where I bind the results of this column to the variable `$line_services`. In this prepared statement I have the following code after my fetc...
2016/10/26
[ "https://Stackoverflow.com/questions/40266666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1774820/" ]
You are using an assignment to strtolower, and you can't do this. Check your code: ``` strtolower(str_replace(...)) = ...; ``` That doesn't make any sense. What are you trying to do? You are not assigning the result of `(($service_tax / 100) * ($line_L + $line_W)) + ($line_L + $line_W)` (for example) to any variable...
For starters, you are overwriting your variable in you foreach. ``` foreach(explode(',', $line_services) as $lineservices) ``` Switch this to: ``` foreach(explode(',', $line_services) as $lineservice) ``` Second of all, what are you expecting to happen here? ``` strtolower(str_replace('','_',$service_name.'_tota...
40,266,666
I'm storing an array of comma separated values in my database in a column called `line_services`. The data in the column looks like `1,1,1,1,0,0,0` and I have a prepared statement where I bind the results of this column to the variable `$line_services`. In this prepared statement I have the following code after my fetc...
2016/10/26
[ "https://Stackoverflow.com/questions/40266666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1774820/" ]
I assume you are trying for a [variable variables](http://php.net/manual/en/language.variables.variable.php)? Rarely if ever a good idea, but you can use the curly syntax: ``` ${strtolower(str_replace('','_',$service_name.'_total'))} = 'whatever'; ``` Consider using an array instead: ``` $total[$service_name] = '...
For starters, you are overwriting your variable in you foreach. ``` foreach(explode(',', $line_services) as $lineservices) ``` Switch this to: ``` foreach(explode(',', $line_services) as $lineservice) ``` Second of all, what are you expecting to happen here? ``` strtolower(str_replace('','_',$service_name.'_tota...
16,420,357
I have a code where I routinely fill a vector with between 0 and 5000 elements. I know the maximum never exceeds 5000. Instead of initializing vector multiple times, I would like to do just once ``` vector<struct> myvector; myvector.reserve(5000); ``` However, to fill the vector again, I have to clear the vector fir...
2013/05/07
[ "https://Stackoverflow.com/questions/16420357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/788171/" ]
If your struct has a non-trivial destructor, then that needs to be called for all the elements of the vector regardless of how it is emptied. If your struct only has a trivial destructor, the compiler or the standard library implementation is allowed to optimize away the destruction process and give you a O(1) operatio...
Anything you do to remove the existing items from the vector needs to (potentially) invoke the destructor of each item being destroyed. Therefore, from the container's viewpoint, the best you can hope for is linear complexity. That leaves only the question of what sort of items you store in the vector. If you store so...
16,420,357
I have a code where I routinely fill a vector with between 0 and 5000 elements. I know the maximum never exceeds 5000. Instead of initializing vector multiple times, I would like to do just once ``` vector<struct> myvector; myvector.reserve(5000); ``` However, to fill the vector again, I have to clear the vector fir...
2013/05/07
[ "https://Stackoverflow.com/questions/16420357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/788171/" ]
If your struct has a non-trivial destructor, then that needs to be called for all the elements of the vector regardless of how it is emptied. If your struct only has a trivial destructor, the compiler or the standard library implementation is allowed to optimize away the destruction process and give you a O(1) operatio...
The cost of `clear()` depends greately on what the stored objects are, and in particular whether they have a trivial destructor. If the type does not have a trivial destructor, then the call must destroy all stored objects and it is in fact an O(n) operation, but you cannot really do anything better. Now, if the store...
16,420,357
I have a code where I routinely fill a vector with between 0 and 5000 elements. I know the maximum never exceeds 5000. Instead of initializing vector multiple times, I would like to do just once ``` vector<struct> myvector; myvector.reserve(5000); ``` However, to fill the vector again, I have to clear the vector fir...
2013/05/07
[ "https://Stackoverflow.com/questions/16420357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/788171/" ]
The cost of `clear()` depends greately on what the stored objects are, and in particular whether they have a trivial destructor. If the type does not have a trivial destructor, then the call must destroy all stored objects and it is in fact an O(n) operation, but you cannot really do anything better. Now, if the store...
Anything you do to remove the existing items from the vector needs to (potentially) invoke the destructor of each item being destroyed. Therefore, from the container's viewpoint, the best you can hope for is linear complexity. That leaves only the question of what sort of items you store in the vector. If you store so...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
Generally, you'd call C++ from python in order to use an existing library or other functionality. Often someone else has written a set of functions that make your life easier, and calling compiled C code is easier than re-writing the library in python. The other reason is for performance purposes. Often, specific func...
Here's two possibilities: 1. Perhaps the C++ code is already written & available for use. 2. It's likely the C++ code is faster/smaller than equivalent Python
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
Here's a real-life example: I've written a DLL in C to interface with some custom hardware for work. Then for the very first stage of testing, I was writing short programs in C to verify that the different commands were working properly. The process of write, compile, run took probably 3-5 times as long as when I final...
One nice thing about using a scripting language is that you can reload new code into the application without quitting the app, then making changes, recompile, and then relaunching the app. When people talk about quicker development times, some of that refers to this capability. A downside of using a scripting languages...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
Here's a real-life example: I've written a DLL in C to interface with some custom hardware for work. Then for the very first stage of testing, I was writing short programs in C to verify that the different commands were working properly. The process of write, compile, run took probably 3-5 times as long as when I final...
1. Performance : From my limited experience, Python is about 10 times slower than using C. Using Psyco will dramatically improve it, but still about 5 times slower than C. BUT, calling c module from python is only a little faster than Psyco. 2. When you have some libraries in C. For example, I am working heavily o...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
It depends on your point of view: **Calling C++ code from a python application** You generally want to do this when performance is an issue. Highly dynamic languages like python are typically somewhat slower then native code such as C++. "Features" of C++ such as manual memory management allows for the development of...
Here's two possibilities: 1. Perhaps the C++ code is already written & available for use. 2. It's likely the C++ code is faster/smaller than equivalent Python
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
It depends on your point of view: **Calling C++ code from a python application** You generally want to do this when performance is an issue. Highly dynamic languages like python are typically somewhat slower then native code such as C++. "Features" of C++ such as manual memory management allows for the development of...
1. Performance : From my limited experience, Python is about 10 times slower than using C. Using Psyco will dramatically improve it, but still about 5 times slower than C. BUT, calling c module from python is only a little faster than Psyco. 2. When you have some libraries in C. For example, I am working heavily o...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
Generally, you'd call C++ from python in order to use an existing library or other functionality. Often someone else has written a set of functions that make your life easier, and calling compiled C code is easier than re-writing the library in python. The other reason is for performance purposes. Often, specific func...
1. Performance : From my limited experience, Python is about 10 times slower than using C. Using Psyco will dramatically improve it, but still about 5 times slower than C. BUT, calling c module from python is only a little faster than Psyco. 2. When you have some libraries in C. For example, I am working heavily o...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
Because C++ provides a direct way of calling OS services, and (if used in a careful way) can produce code that is more efficient in memory and time, whereas Python is a high-level language, and is less painful to use in those situations where utter efficiency isn't a concern and where you already have libraries giving ...
One nice thing about using a scripting language is that you can reload new code into the application without quitting the app, then making changes, recompile, and then relaunching the app. When people talk about quicker development times, some of that refers to this capability. A downside of using a scripting languages...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
Here's two possibilities: 1. Perhaps the C++ code is already written & available for use. 2. It's likely the C++ code is faster/smaller than equivalent Python
One nice thing about using a scripting language is that you can reload new code into the application without quitting the app, then making changes, recompile, and then relaunching the app. When people talk about quicker development times, some of that refers to this capability. A downside of using a scripting languages...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
Generally, you'd call C++ from python in order to use an existing library or other functionality. Often someone else has written a set of functions that make your life easier, and calling compiled C code is easier than re-writing the library in python. The other reason is for performance purposes. Often, specific func...
Here's a real-life example: I've written a DLL in C to interface with some custom hardware for work. Then for the very first stage of testing, I was writing short programs in C to verify that the different commands were working properly. The process of write, compile, run took probably 3-5 times as long as when I final...
1,181,462
I've been seeing some examples of Python being used with c++, and I'm trying to understand why would someone want to do it. What are the benefits of calling C++ code from an external language such as Python? I'd appreciate a simple example - Boost::Python will do
2009/07/25
[ "https://Stackoverflow.com/questions/1181462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/142168/" ]
It depends on your point of view: **Calling C++ code from a python application** You generally want to do this when performance is an issue. Highly dynamic languages like python are typically somewhat slower then native code such as C++. "Features" of C++ such as manual memory management allows for the development of...
Because C++ provides a direct way of calling OS services, and (if used in a careful way) can produce code that is more efficient in memory and time, whereas Python is a high-level language, and is less painful to use in those situations where utter efficiency isn't a concern and where you already have libraries giving ...
14,387,138
I'm trying desperatly to find a bash or ksh routine that allows me to find for example the previous Monday,Tuesday,Wednesday,... preceding today's date. Additonal it has to work on plain vanilla Solaris X and I don't have the GNU date available. eg: Today = Thursday 2013/01/17 ; Let's say I want to find the last Monda...
2013/01/17
[ "https://Stackoverflow.com/questions/14387138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/281607/" ]
Usually I do something like this with images to achieve the click event with just css ``` <figure> <img id="zoom" src="http://cargowire.net/Content/images/events/stackoverflow.jpg" alt="EE" /> <figcaption> <ul> <li> <a href="#zoom">Zoom In</a> </li> <li> <a href="#">Zoom Out</a> </li> </ul> </figcaption> </figure> ``...
It is perfectly possible, but only when the mouse hovers, not on click as far as I am aware. You will want to use CSS :hover states. There is an in depth article here: <http://csswizardry.com/2011/02/creating-a-pure-css-dropdown-menu/> and the demo for that article here: <http://csswizardry.com/demos/css-dropdown/> ...
14,387,138
I'm trying desperatly to find a bash or ksh routine that allows me to find for example the previous Monday,Tuesday,Wednesday,... preceding today's date. Additonal it has to work on plain vanilla Solaris X and I don't have the GNU date available. eg: Today = Thursday 2013/01/17 ; Let's say I want to find the last Monda...
2013/01/17
[ "https://Stackoverflow.com/questions/14387138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/281607/" ]
Usually I do something like this with images to achieve the click event with just css ``` <figure> <img id="zoom" src="http://cargowire.net/Content/images/events/stackoverflow.jpg" alt="EE" /> <figcaption> <ul> <li> <a href="#zoom">Zoom In</a> </li> <li> <a href="#">Zoom Out</a> </li> </ul> </figcaption> </figure> ``...
If you insist on using click in stead of hover, you could try to use :focus as suggested, but it would actually be a hack, and not considered correct use of HTML and css. Just for demonstration though, have a look at this: <http://jsfiddle.net/9efMt/1/> As you can see, I use an input, with the `:focus` pseudo class an...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
It could be a Steam setting that lowers your system volume when you get a message. Turn it off in your Steam settings.
The main Windows volume may be 100%, but is the individual application volume still 100%? When it happens, click the speaker in the tray and select "mixer". See if your player volume is down for some reason ![enter image description here](https://i.stack.imgur.com/DSBAE.jpg) I also have W7 x64 and see similar behavi...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
The main Windows volume may be 100%, but is the individual application volume still 100%? When it happens, click the speaker in the tray and select "mixer". See if your player volume is down for some reason ![enter image description here](https://i.stack.imgur.com/DSBAE.jpg) I also have W7 x64 and see similar behavi...
I've got logitech Z-10 speakers, and they sometimes cause a phenomena which either turns my volume down or up, depending on which button I have pressed most recently. It seems like muting the speaker and then unmuting it fixed it. I think it's related to Z-10 being USB speaker, and being it's own sound device, it'll a...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
Might be due to your codec pack (i.e. the ffdshow audio decoder which comes with K-lite) settings which are independent from your Windows 7 audio. See if there are any icons appearing in addition to the already existing ones on your Windows taskbar during music/video playback. These should be related to your audio co...
I've got logitech Z-10 speakers, and they sometimes cause a phenomena which either turns my volume down or up, depending on which button I have pressed most recently. It seems like muting the speaker and then unmuting it fixed it. I think it's related to Z-10 being USB speaker, and being it's own sound device, it'll a...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
It could be a Steam setting that lowers your system volume when you get a message. Turn it off in your Steam settings.
Might be due to your codec pack (i.e. the ffdshow audio decoder which comes with K-lite) settings which are independent from your Windows 7 audio. See if there are any icons appearing in addition to the already existing ones on your Windows taskbar during music/video playback. These should be related to your audio co...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
I would wager that you have Skype or some other VOIP software installed. I've encountered this same issue when using Skype. As soon as I launch a call in Skype it lowers my speaker volume for me automatically. Took me ages to figure out why it kept lowering. The problem was that Skype doesn't automatically set it bac...
I've got logitech Z-10 speakers, and they sometimes cause a phenomena which either turns my volume down or up, depending on which button I have pressed most recently. It seems like muting the speaker and then unmuting it fixed it. I think it's related to Z-10 being USB speaker, and being it's own sound device, it'll a...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
For me, the problem was solved by running Windows Update followed by ensuring the drivers for the audio / video card AND the chipset were up to date.
Do you have lots of things sucking juice from the power supply? Maybe a device becomes active then the power flux causes the audio issue? I have this same problem randomly on my cheap Gateway desktop, but it only happens after I plug or unplug a USB device. Another less likely thought... do you have any cables laying...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
I would check for a bad connection or splitting cable to your headphones or speakers. I've had this happen to me before. Try bending your audio cables in different directions at both your PC's end and the audio equipment's end.
I would wager that you have Skype or some other VOIP software installed. I've encountered this same issue when using Skype. As soon as I launch a call in Skype it lowers my speaker volume for me automatically. Took me ages to figure out why it kept lowering. The problem was that Skype doesn't automatically set it bac...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
I would check for a bad connection or splitting cable to your headphones or speakers. I've had this happen to me before. Try bending your audio cables in different directions at both your PC's end and the audio equipment's end.
Might be due to your codec pack (i.e. the ffdshow audio decoder which comes with K-lite) settings which are independent from your Windows 7 audio. See if there are any icons appearing in addition to the already existing ones on your Windows taskbar during music/video playback. These should be related to your audio co...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
Might be due to your codec pack (i.e. the ffdshow audio decoder which comes with K-lite) settings which are independent from your Windows 7 audio. See if there are any icons appearing in addition to the already existing ones on your Windows taskbar during music/video playback. These should be related to your audio co...
Do you have lots of things sucking juice from the power supply? Maybe a device becomes active then the power flux causes the audio issue? I have this same problem randomly on my cheap Gateway desktop, but it only happens after I plug or unplug a USB device. Another less likely thought... do you have any cables laying...
450,055
This is the weirdest issue I've ever encountered with my PC. Every so often, my sound will start playing back at a lower volume. This happens when watching video, listening to music, all independently. It usually lasts anywhere up to a minute, after which it will turn up again. The weird thing about it is that the vo...
2012/07/17
[ "https://superuser.com/questions/450055", "https://superuser.com", "https://superuser.com/users/33338/" ]
It could be a Steam setting that lowers your system volume when you get a message. Turn it off in your Steam settings.
For me, the problem was solved by running Windows Update followed by ensuring the drivers for the audio / video card AND the chipset were up to date.
11,469,058
> > **Possible Duplicate:** > > [Convert String to another locale in java](https://stackoverflow.com/questions/5316131/convert-string-to-another-locale-in-java) > > > I want to convert a `java` `String` that contains english numbers to arabic one's so i make this ``` int arabic_zero_unicode= 1632; String st...
2012/07/13
[ "https://Stackoverflow.com/questions/11469058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/671676/" ]
This gives a 5x speedup over your version with a string of length 3036. This also checks to make sure you're only changing digits. It's about a 6x speedup without the if/else check. Please pardon me if the characters are incorrect/misplaced. I had to find some of them from another source. ``` char[] arabicChars = {'٠...
There are a couple of Java classes that you can utilize to accomplish this in a high level fashion without explicit assumptions on Unicode table structure. For example you can check out [DecimalFormatSymbols](http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormatSymbols.html). However the idea will be the sam...
67,121,439
I need to implement regex validation for value that will be used in my server side to get data where certain timestamp is older (smaller) than `now() - interval 'myValue'`. pSQL interval function is explained [here](https://www.postgresql.org/docs/9.1/functions-datetime.html), and in short it can have values like `2 d...
2021/04/16
[ "https://Stackoverflow.com/questions/67121439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9886447/" ]
You can use ```sql ^(?!.*(second|minute|hour|day|week|month|year).*\1)\d+\s+(?:second|minute|hour|day|week|month|year)s?(?:\s+\d+\s+(?:second|minute|hour|day|week|month|year)s?)*$ ``` See the [regex demo](https://regex101.com/r/htldlR/2) *Details* * `^` - start of string * `(?!.*(second|minute|hour|day|week|month|...
Forget it. The only complete documentation of the supported values for `interval` is [the implementation](https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/adt/timestamp.c;h=3a93e92e4036dc0afe0fcf81ca7251749b599166;hb=HEAD#l875) (the guts are in `ParseDateTime`). Consider these: ``` SELEC...
24,518,945
I'm using `http.NewRequest` to make several http requests ( obviously ). Now I need to make request and extract some query strings from the final URL ( there is a redirect ) . So the question is how can I find the URL (if the final URL if the client was redirected ) ? There is no such field in [Response](http://golan...
2014/07/01
[ "https://Stackoverflow.com/questions/24518945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3780579/" ]
You add a callback to `http.Client.CheckRedirect` ``` // CheckRedirect specifies the policy for handling redirects. // If CheckRedirect is not nil, the client calls it before // following an HTTP redirect. The arguments req and via are // the upcoming request and the requests made already, oldest /...
Although @JimB actually answered the question I'm posting this as it may help someone. I've used an anonymous function. Perhaps could be done better using a closures but I didn't figured it out yet how closures actually work. ``` req, err = http.NewRequest("GET", URL, nil) cl := http.Client{} var lastUrlQuery string c...
59,985,335
I have a vector with integers. I would like to select the most common numbers. I would like to make a top 5 list. For example: ``` std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; ``` the most common numbers are: TOP 1: 32, TOP 2: 11, TOP 3: 12, TOP 4: 9; after I selected them, I would like to store ...
2020/01/30
[ "https://Stackoverflow.com/questions/59985335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12770540/" ]
You can create a `unordered_map<int,int> mp` where you can store the count of each number, like `mp[32] = 3`. Next you need to find the top five elements 1. **Time Complexity : O(mlogm)** : You can sort the map in descending order( to sort it you will have to use a extra vector), and take the first 5 elements. 2. **...
There are many many ways how to achieve this. One of which may be. ``` std::vector numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; int maxNumber = *std::max_element(numbers.begin(), numbers.end()) std::vector<int> occurrences(maxNumber + 1, 0); for(auto& value : numbers) { occurrences[value]++; } ``` Then you just...
59,985,335
I have a vector with integers. I would like to select the most common numbers. I would like to make a top 5 list. For example: ``` std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; ``` the most common numbers are: TOP 1: 32, TOP 2: 11, TOP 3: 12, TOP 4: 9; after I selected them, I would like to store ...
2020/01/30
[ "https://Stackoverflow.com/questions/59985335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12770540/" ]
Here's another algorithm, the cost is going to be O(n) for any `k`, plus a decent cache locality. 1.First store all elements in a `unordered_map` O(N) ``` std::unordered_map<int, int> m; for(const auto ele: numbers) { m[ele]++; } ``` 2.Dump all elements in a vector of pairs O(N) ``` std::vector<std::pair<int...
You can create a `unordered_map<int,int> mp` where you can store the count of each number, like `mp[32] = 3`. Next you need to find the top five elements 1. **Time Complexity : O(mlogm)** : You can sort the map in descending order( to sort it you will have to use a extra vector), and take the first 5 elements. 2. **...
59,985,335
I have a vector with integers. I would like to select the most common numbers. I would like to make a top 5 list. For example: ``` std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; ``` the most common numbers are: TOP 1: 32, TOP 2: 11, TOP 3: 12, TOP 4: 9; after I selected them, I would like to store ...
2020/01/30
[ "https://Stackoverflow.com/questions/59985335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12770540/" ]
I've made this example and put comments in-line. It needs C++11 at least. ``` #include <map> #include <vector> #include <iostream> #include <algorithm> int main(void) { std::map<int, int> ans; std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; std::vector<std::pair<int, int>> sorted; std::vector<...
There are many many ways how to achieve this. One of which may be. ``` std::vector numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; int maxNumber = *std::max_element(numbers.begin(), numbers.end()) std::vector<int> occurrences(maxNumber + 1, 0); for(auto& value : numbers) { occurrences[value]++; } ``` Then you just...
59,985,335
I have a vector with integers. I would like to select the most common numbers. I would like to make a top 5 list. For example: ``` std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; ``` the most common numbers are: TOP 1: 32, TOP 2: 11, TOP 3: 12, TOP 4: 9; after I selected them, I would like to store ...
2020/01/30
[ "https://Stackoverflow.com/questions/59985335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12770540/" ]
Here's another algorithm, the cost is going to be O(n) for any `k`, plus a decent cache locality. 1.First store all elements in a `unordered_map` O(N) ``` std::unordered_map<int, int> m; for(const auto ele: numbers) { m[ele]++; } ``` 2.Dump all elements in a vector of pairs O(N) ``` std::vector<std::pair<int...
There are many many ways how to achieve this. One of which may be. ``` std::vector numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; int maxNumber = *std::max_element(numbers.begin(), numbers.end()) std::vector<int> occurrences(maxNumber + 1, 0); for(auto& value : numbers) { occurrences[value]++; } ``` Then you just...
59,985,335
I have a vector with integers. I would like to select the most common numbers. I would like to make a top 5 list. For example: ``` std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; ``` the most common numbers are: TOP 1: 32, TOP 2: 11, TOP 3: 12, TOP 4: 9; after I selected them, I would like to store ...
2020/01/30
[ "https://Stackoverflow.com/questions/59985335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12770540/" ]
you can do this: create a set so you get rid off duplicated, then find the frequency of every item of the set in the vector, with this result create a pair (something like int, int) push the pair in a vector and finally sort it using your own predicate: now for the top x you can do a for loop or just resize the vect...
There are many many ways how to achieve this. One of which may be. ``` std::vector numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; int maxNumber = *std::max_element(numbers.begin(), numbers.end()) std::vector<int> occurrences(maxNumber + 1, 0); for(auto& value : numbers) { occurrences[value]++; } ``` Then you just...
59,985,335
I have a vector with integers. I would like to select the most common numbers. I would like to make a top 5 list. For example: ``` std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; ``` the most common numbers are: TOP 1: 32, TOP 2: 11, TOP 3: 12, TOP 4: 9; after I selected them, I would like to store ...
2020/01/30
[ "https://Stackoverflow.com/questions/59985335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12770540/" ]
Here's another algorithm, the cost is going to be O(n) for any `k`, plus a decent cache locality. 1.First store all elements in a `unordered_map` O(N) ``` std::unordered_map<int, int> m; for(const auto ele: numbers) { m[ele]++; } ``` 2.Dump all elements in a vector of pairs O(N) ``` std::vector<std::pair<int...
I've made this example and put comments in-line. It needs C++11 at least. ``` #include <map> #include <vector> #include <iostream> #include <algorithm> int main(void) { std::map<int, int> ans; std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; std::vector<std::pair<int, int>> sorted; std::vector<...
59,985,335
I have a vector with integers. I would like to select the most common numbers. I would like to make a top 5 list. For example: ``` std::vector<int> numbers = {32, 32, 32, 12, 12, 11, 11, 11, 9}; ``` the most common numbers are: TOP 1: 32, TOP 2: 11, TOP 3: 12, TOP 4: 9; after I selected them, I would like to store ...
2020/01/30
[ "https://Stackoverflow.com/questions/59985335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12770540/" ]
Here's another algorithm, the cost is going to be O(n) for any `k`, plus a decent cache locality. 1.First store all elements in a `unordered_map` O(N) ``` std::unordered_map<int, int> m; for(const auto ele: numbers) { m[ele]++; } ``` 2.Dump all elements in a vector of pairs O(N) ``` std::vector<std::pair<int...
you can do this: create a set so you get rid off duplicated, then find the frequency of every item of the set in the vector, with this result create a pair (something like int, int) push the pair in a vector and finally sort it using your own predicate: now for the top x you can do a for loop or just resize the vect...
64,794,970
How to avoid the dark grey background which will flash for a second before the splash screen appears in android app built by Cordova ?
2020/11/11
[ "https://Stackoverflow.com/questions/64794970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is a simple plugin for Android which will set the window background color for you app's MainActivity to a color of your choice. This allows you to avoid the standard dark grey background which will flash for a second before your splash screen appears. Set the color to the same background as your splash screen for ...
For some reason the plugin 'cordova-plugin-android-window-background' didn't work for me, it closes the application. This solution provided by @Nsamba Isaac worked like a charm on my phone right now <https://stackoverflow.com/a/72063894/5961202>
49,838
I was able to read about cyber-warfare and how the United States regularly uses the term. However, the term is said to [still be ambiguous](https://en.wikipedia.org/wiki/Cyberwarfare#Definition) with the former Cyber Security Coordinator for the Obama Administration saying that > > "there is no cyberwar... I think th...
2020/01/29
[ "https://politics.stackexchange.com/questions/49838", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/29927/" ]
There [seems to be no formal definition](https://fas.org/sgp/crs/natsec/R43955.pdf) (as of 2015): > > Although there is no clear doctrinal definition of “cyberwarfare,” it is typically conceptualized as state-on-state action equivalent to an armed attack or use of force in cyberspace that may trigger a military respo...
[United States Cyber Command](https://en.wikipedia.org/wiki/United_States_Cyber_Command) (USCYBERCOM) handles cyberspace concerns for the Department of Defense, and seem the best source of any sort of definition for 'cyberwarfare' or 'cyberwar'. Overall, they don't appear to reference 'cyberwarfare' as it's own domain,...
49,838
I was able to read about cyber-warfare and how the United States regularly uses the term. However, the term is said to [still be ambiguous](https://en.wikipedia.org/wiki/Cyberwarfare#Definition) with the former Cyber Security Coordinator for the Obama Administration saying that > > "there is no cyberwar... I think th...
2020/01/29
[ "https://politics.stackexchange.com/questions/49838", "https://politics.stackexchange.com", "https://politics.stackexchange.com/users/29927/" ]
There [seems to be no formal definition](https://fas.org/sgp/crs/natsec/R43955.pdf) (as of 2015): > > Although there is no clear doctrinal definition of “cyberwarfare,” it is typically conceptualized as state-on-state action equivalent to an armed attack or use of force in cyberspace that may trigger a military respo...
While not an official definition of *cyberwar*, the Congressional Research Service has published studies including this term. That research breaks it down to more precise terminology used by the U.S. military. For example, see [Information Operations, Electronic Warfare, and Cyberwar: Capabilities and Related Policy Is...
4,613,283
I want to solve following question on probability distribution: > > A coin is tossed repeatedly and probability that a head appears at any toss is $p$ where $0<p<1$. What is the expected length of initial run ? > > > --- A run of length $r$ is $r$ consecutive toss that are all the same. (e.g. $HTTHH$ has a run o...
2023/01/07
[ "https://math.stackexchange.com/questions/4613283", "https://math.stackexchange.com", "https://math.stackexchange.com/users/1108680/" ]
"But I am confused with the term "initial run" in my question. What does mean it ?" In e.g. $HHTHTT$ the initial run is $HH$, in e.g. $TTTHHT$ the initial run is $TTT$. I hope that these examples are enough to make clear what is meant by "initial run". --- Problems of this sort can often be solved without looking t...
$E$(length of run)$ = (1 + $E(length until we see tails given first is head)$)\*p+ (1 + $E(length until we see heads given first is tails) $)\*(1-p)$ $E = p\*(1 + 1/(1-p)) + (1-p)\*(1 + 1/p) $ [1/p => expected number of tosses until we see a head and likewise for tails also] $= p(2-p)/(1-p) + (1-p)(p+1)/p = (2p^2 - p...
42,814,681
I have a classic asp site, and an MVC web app. I have both of them hosted locally as localhost in my dev environment. I also have both of them set up on a remote server. Below is a list of URLs of my apps: 1. classic asp site hosted locally: <http://localhost/AspAppName/> 2. classic asp site hosted on remote server (...
2017/03/15
[ "https://Stackoverflow.com/questions/42814681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2296301/" ]
**TL;DR:** you can't run server-side modules inside a browser. From what I understand, you're trying to use server-side JavaScript modules inside of a browser, which isn't going to work. Browser have (very) limited abilities to set up network connection, or read from local file systems. The `http` dependency that you...
From the browser, to talk to CouchDB, try the PouchDB library (<https://pouchdb.com/>) and put the URL to your CouchDB in the constructor. It's intended for connecting to a local PouchDB (javascript implementation of CouchDB) but their APIs are identical. Or, try actually using a local PouchDB and then syncing between ...
10,254,754
I am using ofstream to output some text to a file in `ios::app` mode within a loop. But after some step, I need to clear the content of the file. I know we can do it by either delete the file and open again or to open it again with `ios::trunc`, but is there any where I can get it done without close and open the file a...
2012/04/20
[ "https://Stackoverflow.com/questions/10254754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1285419/" ]
If you have opened it in `ios::app` mode, there's no way to clear content without opening it again. `ofstream` can only put text in a file, and as text files are sequential, you can't directly erase data on them.
Note sure if it is possible with io streams, but in general you can truncate an open file by setting its current position to 0 and then setting the EOF marker on the file. In the Win32 API, for instance, you can do that with `SetFilePointer()` and `SetEndOfFile()`.
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
Now there's a better way to do it using a simple JS script called [AdBlock Detector](https://github.com/R4meau/abDetector) Here's how to use it: Add this to your `<head>` section: ``` <script type="text/javascript"> window.onload = function() { var iframe = document.createElement('iframe'), randomDomain =...
Run this with adblock on and Paste this in your page-footer before the close of the `</body>` tag on your page. ```html <script type="text/javascript" charset="utf-8"> // Place this code snippet near the footer of your page before the close of the /body tag // eval(function(p,a,c,k,e,d){e=function(c){return(c<a?...
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
To detect if the user is blocking ads, all you have to do is find a function in the ad javascript and try testing for it. It doesn't matter what method they're using to block the ad. Here's what it looks like for Google Adsense ads: ``` if(!window.hasOwnProperty('google_render_ad') || window.google_render_ad === undef...
this worked for me the document has to be ready before you look for adblock hope this help someone! ``` jQuery(document).ready(function() { var adBlockEnabled = false; var testAd = document.createElement('div'); testAd.innerHTML = '&nbsp;'; testAd.className = 'adsbox'; document.body.appendChild(testAd); window.setTi...
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
```js async function detectAdBlock() { let adBlockEnabled = false const googleAdUrl = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js' try { await fetch(new Request(googleAdUrl)).catch(_ => adBlockEnabled = true) } catch (e) { adBlockEnabled = true } finally { console.log(`AdBlock ...
An efficient way to check if there is an adblock: Simply check if there is adblock enabled by trying to trigger the URL of google ads. If yes then run the callback\_has\_adblock, if not then run the callback\_no\_adblock. This solution costs one request more but at least it always works: ``` var hasAdBlock = function ...
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
<http://thepcspy.com/read/how_to_block_adblock/> With jQuery: ``` function blockAdblockUser() { if ($('.myTestAd').height() == 0) { window.location = 'http://example.com/AdblockNotice.html'; } } $(document).ready(function(){ blockAdblockUser(); }); ``` Of course, you would need to have a landin...
My easiest solution with jquery is: ``` $.ajax({ url: "/scripts/advertisement.js", // this is just an empty js file dataType: "script" }).fail(function () { // redirect or display message here }); ``` advertisement.js just contains nothing. When somebody uses adblock, it fails and the function gets calle...
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
Most ads are dynamically loaded in javascript. I just used the onerror event to detect whether the ad script could be loaded or not. Seems to work. **Example with GoogleAds:** ``` <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" onerror="adBlockFunction();"></script> ``` This can be used...
Despite the age of this question, I recently found it very useful and therefore can only assume there are others still viewing it. After looking here and elsewhere I surmised that the main three client side checks for indirectly detecting an ad blocker were to check for blocked `div`/`img`, blocked `iframe`s and blocke...
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
This approach I use on my site, maybe you will find it helpful. In my opinion, it's the **simpliest** solution. AdBlocker blocks specific classes and html elements, by inspecting these selectors of any blocked ads in developer console (they are all listed) you can see which elements will be always blocked. E.g. just...
html file ``` <script src="wp-banners.js"></script> <script> if(document.getElementById('LavXngdFojBe')){ alert('Blocking Ads: No'); } else { alert('Blocking Ads: Yes'); } </script> ``` wp-banners.js ``` var e=document.createElement('div'); e.id='LavXngdFojBe'; e.style.display='none'; document.body.appendChild...
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
if you are using react with hooks: ``` import React, { useState, useEffect } from 'react' const AdblockDetect = () => { const [usingAdblock, setUsingAdblock] = useState(false) let fakeAdBanner useEffect(() => { if (fakeAdBanner) { setUsingAdblock(fakeAdBanner.offsetHeight === 0) } }) if (usi...
I'm a bit late to the party here but here's the simplest solution I know for the old AdSense code with jQuery: ``` $ads = $("ins"); if ($ads.length == 0) { // Replacement code about you needing ad income } ``` And in plain JavaScript: ``` $ads = document.getElementsByTagName("ins"); if ($ads.length == 0) { ...
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
``` <script src="http://code.jquery.com/jquery-latest.js"></script> <script>var adb=true;</script> <script src="./getbanner.cfm?"></script> <script> $(document).ready(function(){if(adb)alert('AdBlock!');}); </script> ``` and in getbanner.cfm file: ``` adb = false; ``` I think it's easiest way to detect adblock.
This docuemnt might help. Most effective way to detect ad blockers Completely free & easy to implement <https://www.detectadblock.com/>
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
This approach I use on my site, maybe you will find it helpful. In my opinion, it's the **simpliest** solution. AdBlocker blocks specific classes and html elements, by inspecting these selectors of any blocked ads in developer console (they are all listed) you can see which elements will be always blocked. E.g. just...
If using the new AdSense code, you can do an easy check, with out resorting to content or css checks. Place your ads as normal in your markup: ``` <ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-######" data-ad-slot="#######" data-ad-format="auto"></ins> <script>(adsbygoogle = window....
4,869,154
I would like to be able to detect if the user is using adblocking software when they visit my website. If they are using it, I want to display a message asking them to turn it off in order to support the project, like [this website](http://www.playonlinux.com/en/) does. If you enter to that site and your browser has s...
2011/02/01
[ "https://Stackoverflow.com/questions/4869154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/585432/" ]
I know there are already enough answers, but since this question comes up on Google searched for "detect adblock" at the topic, I wanted to provide some insight in case you're **not using adsense**. Specifically, with this example you can detect if the default Adblock-list provided by Firefox Adblock is used. It takes...
For me none of the tricks worked, may be I was doing something wrong. but this is a very specific way to implement for **google ads**. ``` window.onload = function() { if (document.getElementsByClassName('google-auto-placed').length == 0){ // Adblock Detected } } ``` If you have other a...
45,391,728
I was working on a school project with my friend and we want our program to take integer values from user and store it in a vector as long as the user enter some value and exit the loop for input when user stops inputting numbers. This was my first sample code which goes on infinitely: ``` while(cin>>x){ ...
2017/07/29
[ "https://Stackoverflow.com/questions/45391728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6541368/" ]
Most important part for you is to clearly describe what you want. The program has to have some condition under which it terminates. Two ideas: 1. The user enters integer values separated by spaces and then pushes enter 2. The user enters an integer, presses enter and continues. As soon as he presses enter twice, it t...
Not entirely sure but I think you mean something like read the line then extract integers? If so, try something like this - there is no error checking, it will simply discard the everything from the first non-integer. I have left out exceptions and not used and for\_each or lambdas or anything fancy. Hopefully will be ...
45,391,728
I was working on a school project with my friend and we want our program to take integer values from user and store it in a vector as long as the user enter some value and exit the loop for input when user stops inputting numbers. This was my first sample code which goes on infinitely: ``` while(cin>>x){ ...
2017/07/29
[ "https://Stackoverflow.com/questions/45391728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6541368/" ]
Most important part for you is to clearly describe what you want. The program has to have some condition under which it terminates. Two ideas: 1. The user enters integer values separated by spaces and then pushes enter 2. The user enters an integer, presses enter and continues. As soon as he presses enter twice, it t...
After using [Aziuth's](https://stackoverflow.com/users/5114342/aziuth) suggestion and doing some research on websites like Topcoder and Codechef and other competitive programming websites I think i found a solution without needing to use a string. It takes all the input values until a newline is entered. Thanks a lot ...
38,658,350
I want to write a bash script to re-attach to the existing linux screen, perform some commands and then detach from that screen. I know to create a new linux screen in detached mode and perform some commands. But I haven't found a way to re-attach to a existing linux screen.
2016/07/29
[ "https://Stackoverflow.com/questions/38658350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5700967/" ]
You can give a name to a screen session by using the -S option. Example : `screen -dS NAME <command>` Then you can reattach to that session using `screen -r NAME`
try this; ``` user@host:/screen -ls There are screens on: 29229558.pts-5.host (Detached) 46661728.pts-22.host (Detached) user@host:/screen -r 46661728.pts-22.host ``` If you see (attached) as below; ``` user@host:/screen -ls There are screens on: 29229558.pts-5.host (Detached) ...
38,658,350
I want to write a bash script to re-attach to the existing linux screen, perform some commands and then detach from that screen. I know to create a new linux screen in detached mode and perform some commands. But I haven't found a way to re-attach to a existing linux screen.
2016/07/29
[ "https://Stackoverflow.com/questions/38658350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5700967/" ]
try this; ``` user@host:/screen -ls There are screens on: 29229558.pts-5.host (Detached) 46661728.pts-22.host (Detached) user@host:/screen -r 46661728.pts-22.host ``` If you see (attached) as below; ``` user@host:/screen -ls There are screens on: 29229558.pts-5.host (Detached) ...
To re-attach to the screen you have to follow this steps: Before de-attaching from the screen, execute: ``` STDOUTTERM=$(who -m|awk '{print $2}') ``` Then you can attach stdout to whatever you want. When you finish, to reattach to stdout, execute this: ``` exec > /dev/$STDOUTTERM ```
38,658,350
I want to write a bash script to re-attach to the existing linux screen, perform some commands and then detach from that screen. I know to create a new linux screen in detached mode and perform some commands. But I haven't found a way to re-attach to a existing linux screen.
2016/07/29
[ "https://Stackoverflow.com/questions/38658350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5700967/" ]
try this; ``` user@host:/screen -ls There are screens on: 29229558.pts-5.host (Detached) 46661728.pts-22.host (Detached) user@host:/screen -r 46661728.pts-22.host ``` If you see (attached) as below; ``` user@host:/screen -ls There are screens on: 29229558.pts-5.host (Detached) ...
You can send a command to a running screen using `screen -X exec`. See the man page for redirection options. ``` screen -X exec ls ``` Alternatively you can send text to a running screen's stdin buffer using `screen -X paste`, as if the user had typed it. This can be a way of running commands inside an interactive s...
38,658,350
I want to write a bash script to re-attach to the existing linux screen, perform some commands and then detach from that screen. I know to create a new linux screen in detached mode and perform some commands. But I haven't found a way to re-attach to a existing linux screen.
2016/07/29
[ "https://Stackoverflow.com/questions/38658350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5700967/" ]
You can give a name to a screen session by using the -S option. Example : `screen -dS NAME <command>` Then you can reattach to that session using `screen -r NAME`
To re-attach to the screen you have to follow this steps: Before de-attaching from the screen, execute: ``` STDOUTTERM=$(who -m|awk '{print $2}') ``` Then you can attach stdout to whatever you want. When you finish, to reattach to stdout, execute this: ``` exec > /dev/$STDOUTTERM ```
38,658,350
I want to write a bash script to re-attach to the existing linux screen, perform some commands and then detach from that screen. I know to create a new linux screen in detached mode and perform some commands. But I haven't found a way to re-attach to a existing linux screen.
2016/07/29
[ "https://Stackoverflow.com/questions/38658350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5700967/" ]
You can give a name to a screen session by using the -S option. Example : `screen -dS NAME <command>` Then you can reattach to that session using `screen -r NAME`
You can send a command to a running screen using `screen -X exec`. See the man page for redirection options. ``` screen -X exec ls ``` Alternatively you can send text to a running screen's stdin buffer using `screen -X paste`, as if the user had typed it. This can be a way of running commands inside an interactive s...
68,439,482
I'm trying to make some research on IIR precision, so I write a simple IIR using GNU MPFR: ``` #include <mpfr.h> class DirectFormIIR { public: DirectFormIIR( int precision ); ~DirectFormIIR(); void setParams( double b0, double b1, double b2, double a1, double a2 ); void resetState(); double proc...
2021/07/19
[ "https://Stackoverflow.com/questions/68439482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1484850/" ]
The script has just failed again. After working on a number of occasions which hadn't been happening, it has now failed and return the same error as before. I can therefore only assume that creating a self-invoking function within the main function has made no material difference to the efficiency of the script.
**The error you are receiving does not seem to be the expected one.** I think the best solution in this situation is to file a bug on Google's Issue Tracker by using the template [here](https://issuetracker.google.com/issues/new?component=191640&template=823905).
54,485,672
I have a table in SQL Server which has millions of records. I was trying to do a select by passing id in the where condition, like this: ``` select id,processid value from table1 where processid= 5 ``` It's returning around 1 million records and took around 25 minutes to execute. There is one index on the table...
2019/02/01
[ "https://Stackoverflow.com/questions/54485672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5058563/" ]
Optimal variant: 1. Since id is ever increasing identity field, change the primary key from non-clustered to clustered. Also this will prevent fragmentation. 2. Add non-clustered index on processid. It will be covered for your query. Which will make it ideal in terms of select performance --- Less optimal: In case ...
At first, if you just need to extract list of IDs for certain ProcessId and you do not want to create clustered index by ID you can create clustered index on "processid" column. If you do not want to create clustered index at all, create index by ProcessId with included ID: ``` CREATE INDEX IDX_Table1 ON [Table1](proc...
403,271
we have the following file: ``` more /tmp/file Allow,Deny Allow,Deny ``` we want to change only the second match word ( to replace Allow,Deny with Deny,Allow ) so we did ``` sed 's/Allow,Deny/Deny,Allow/1' /tmp/file Deny,Allow Deny,Allow ``` but it replace both them while the expected results: ``` Allow,Den...
2017/11/08
[ "https://unix.stackexchange.com/questions/403271", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/237298/" ]
> > to change only the second match word ( to replace Allow,Deny with > Deny,Allow ) > > > **sed** solution: Sample `tmp_file`: ``` Allow,Deny Allow,Deny Allow,Deny Allow,Deny ``` --- ``` sed ':a;N;$!ba; s/Allow,Deny/Deny,Allow/2' tmp_file ``` The output: ``` Allow,Deny Deny,Allow Allow,Deny Allow,Deny `...
Another sed solution. ``` sed '0,/Allow/!{0,/Allow/s/Allow/Deny/}' /tmp/file ``` Here we match the first `Allow` then we ignore the substitution for the first `Allow` we come across and substitute the next line. To give an idea, the following would substitute the second and fourth since we used `N;` ``` sed '0,/...
28,741,193
I'm using sticky events in EventBus to pass my "selected" objects into the upcoming Activity. The detail activity allows the user to "select" another object to fetch a new list. I want to post another sticky event with the *same* object class again into yet another list activity, but from what I understand, the previou...
2015/02/26
[ "https://Stackoverflow.com/questions/28741193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/267680/" ]
By looking at the source <https://github.com/greenrobot/EventBus/blob/master/EventBus/src/de/greenrobot/event/EventBus.java> line 52: ``` private final Map<Class<?>, Object> stickyEvents; ``` It uses the class as the key, so I don't think it can be done, but I thought of a work around. You may do something simila...
> > I really like having sticky objects, it eliminated my need to > hand-wire up the Android Parcelable interface just to send objects > from one living activity to another with the Intent mechanism. I'd > hate to be forced to go and have to implement Parcelable even after > getting a fully working EventBus just b...
31,069,869
I want to put a condition in my query where I have a column that should contain second position as an alphabet. How to achieve this? I've tried with `_[A-Z]%` in where clause but is not working. I've also tried `[A-Z]%`. Any inputs please?
2015/06/26
[ "https://Stackoverflow.com/questions/31069869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5052314/" ]
I think you want mysql query. like this ``` SELECT * FROM table WHERE column REGEXP '^.[A-Za-z]+$' ``` or sql server ``` select * from table where column like '_[a-zA-Z]%' ```
You can use regular expression matching in your query. For example: ``` SELECT * FROM `test` WHERE `name` REGEXP '^.[a-zA-Z].*'; ``` That would match the `name` column from the `test` table against a regex that verifies if the second character is either a lowercase or uppercase alphabet letter. Also see this [SQL F...
31,069,869
I want to put a condition in my query where I have a column that should contain second position as an alphabet. How to achieve this? I've tried with `_[A-Z]%` in where clause but is not working. I've also tried `[A-Z]%`. Any inputs please?
2015/06/26
[ "https://Stackoverflow.com/questions/31069869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5052314/" ]
I think you want mysql query. like this ``` SELECT * FROM table WHERE column REGEXP '^.[A-Za-z]+$' ``` or sql server ``` select * from table where column like '_[a-zA-Z]%' ```
The use of `'%[A-Z]%'` suggests that you are using SQL Server. If so, you can do this using `LIKE`: ``` where col like '_[A-Z]%' ``` For `LIKE` patterns, `_` represents any character. If the first character needs to be a digit: ``` where col like '[0-9][A-Z]%' ``` EDIT: The above doesn't work in DB2. Instead: `...
31,069,869
I want to put a condition in my query where I have a column that should contain second position as an alphabet. How to achieve this? I've tried with `_[A-Z]%` in where clause but is not working. I've also tried `[A-Z]%`. Any inputs please?
2015/06/26
[ "https://Stackoverflow.com/questions/31069869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5052314/" ]
I think you want mysql query. like this ``` SELECT * FROM table WHERE column REGEXP '^.[A-Za-z]+$' ``` or sql server ``` select * from table where column like '_[a-zA-Z]%' ```
agree with @Gordon Linoff, your ('\_[A-Z]%') should work. if not work, kindly add some sample data with your question. ``` Declare @Table Table ( TextCol Varchar(20) ) Insert Into @Table(TextCol) Values ('23423cvxc43f') ,('2eD97S9') ,('sAgsdsf') ,('3Ss08008') Select * From @Table As t Where t.TextC...
14,149
I am building my workbench, and I have a couple of Arauco softwood plywood that I glued together. On top of them, I want to place a hardboard that I can remove when its beat up. I am considering different ways to place this hardboard on top of the plywood, and I want to avoid gluing so it's easier to replace when need...
2022/09/27
[ "https://woodworking.stackexchange.com/questions/14149", "https://woodworking.stackexchange.com", "https://woodworking.stackexchange.com/users/12492/" ]
Edging is typically glued. Wood glue is not the best option for this due to the plywood edge not being a great surface to glue to, so contact cement is more typical (and most ready made edging use some variation of that). However, for a workbench I would forgo edging entirely and just bevel the plywood edge a bit to a...
It's probably worth highlighting that, as mentioned in the linked Answer, solid-wood edging provides a solid bump in the looks department as well as protecting the relatively fragile edges of the MDF or plywood: [![Solid-wood edging on workbench tops](https://i.stack.imgur.com/Rt6xl.jpg)](https://i.stack.imgur.com/Rt6...
5,991,422
When I build a solution on my build server it generates a binaries folder and then later on copies these binaries to the final output folder. In my case some of the third party assemblies REFERENCES are correctly copied over while other 3rd part assemblies REFERENCES are not copied over. Take not that my solution proje...
2011/05/13
[ "https://Stackoverflow.com/questions/5991422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/160728/" ]
For ASP.NET projects there is a built in mechanism for this. Ensure required assemblies are in a folder under your project named \_bin\_deployableAssemblies and they will get automatically copied. To see how this customization is wired into the build of Web projects, find the file... ``` %PROGRAMFILES%\MSBuild\Microso...
Please do one thing, add the third party dlls to your bin folder and give reference to that dll in the bin folder. Then build the solution and commit the results. This will copy the third party dlls in the bin folder.
5,991,422
When I build a solution on my build server it generates a binaries folder and then later on copies these binaries to the final output folder. In my case some of the third party assemblies REFERENCES are correctly copied over while other 3rd part assemblies REFERENCES are not copied over. Take not that my solution proje...
2011/05/13
[ "https://Stackoverflow.com/questions/5991422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/160728/" ]
Please do one thing, add the third party dlls to your bin folder and give reference to that dll in the bin folder. Then build the solution and commit the results. This will copy the third party dlls in the bin folder.
In some cases you need assemblies that you don't have as references to be copied, if that's the case see: [Visual Studio Package build and DLLs in private bin path](https://stackoverflow.com/questions/6152794/visual-studio-package-build-and-dlls-in-private-bin-path/6191243#6191243) If the above is not the case, check ...
5,991,422
When I build a solution on my build server it generates a binaries folder and then later on copies these binaries to the final output folder. In my case some of the third party assemblies REFERENCES are correctly copied over while other 3rd part assemblies REFERENCES are not copied over. Take not that my solution proje...
2011/05/13
[ "https://Stackoverflow.com/questions/5991422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/160728/" ]
For ASP.NET projects there is a built in mechanism for this. Ensure required assemblies are in a folder under your project named \_bin\_deployableAssemblies and they will get automatically copied. To see how this customization is wired into the build of Web projects, find the file... ``` %PROGRAMFILES%\MSBuild\Microso...
In some cases you need assemblies that you don't have as references to be copied, if that's the case see: [Visual Studio Package build and DLLs in private bin path](https://stackoverflow.com/questions/6152794/visual-studio-package-build-and-dlls-in-private-bin-path/6191243#6191243) If the above is not the case, check ...
56,728,742
I'm creating a location tracking app for which I'm using the `FusedLocationProviderClient.requestLocationUpdates()` method. One of its argument requires a `Looper` object and I'm not completely sure how it works. Right now I'm just passing `null` to it and it works as expected. After researching I learned that the UI ...
2019/06/24
[ "https://Stackoverflow.com/questions/56728742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5982406/" ]
Add a bit more info from the [document](https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient#requestLocationUpdates(com.google.android.gms.location.LocationRequest,%20com.google.android.gms.location.LocationCallback,%20android.os.Looper)): `Callbacks for LocationCa...
If you are calling *getLocationUpdates* method in the Main thread then *locationCallback* would be also executed in the Main thread. If you are calling *getLocationUpdates* in background thread with passed null as a looper your callback would be executed in background thread. It depends on your needs do you exactly nee...
4,137,163
Greetings, I'm trying to simply display an image using Appcelerator on Android. I don't understand why it won't work. Here is my code: ``` var back=Titanium.UI.createImageView({ url:'images/back.png' }); win.add(back); ``` I've also tried putting the image inside a view: ``` var view = Titanium.UI.createView({...
2010/11/09
[ "https://Stackoverflow.com/questions/4137163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/395974/" ]
I got it working as follows: ``` var back_fn=Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'images/back.png'); var back=Titanium.UI.createImageView({ image:back_fn, top:10, right:10 }); win.add(back); ``` Thanks for all the responses guys,
try this ``` var back=Titanium.UI.createImageView({ url:'images/back.png', height : 130, width : 130 }); ```
56,540,077
I parse a JSON file to a dictionary, example JSON data below ``` "environmental": { "temprature": { "test" : "temprature", "unit": "c", "now": 12.65, "now_timestamp": "10-06-2019 08:02:18", "min": "12.5", "min_timestamp": "03-06-2019 07:40:0...
2019/06/11
[ "https://Stackoverflow.com/questions/56540077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11630000/" ]
You can use this: ``` void onAddButtonTapped(int index) { // use this to animate to the page pageController.animateToPage(index); // or this to jump to it without animating pageController.jumpToPage(index); } ``` Pass the function as params: ``` class first { final void Function(int) onAddButtonTapped; ...
You can pass a callback to your first widget and call that when the button is pressed, so you can change the page in the parent widget. Something like this: ``` import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext contex...
2,772,102
Django (1.2 beta) will reset the database(s) between every test that runs, meaning each test runs on an empty DB. However, the database(s) are not **flushed**. One of the effects of flushing the database is the `auto_increment` counters are reset. Consider a test which pulls data out of the database by primary key: `...
2010/05/05
[ "https://Stackoverflow.com/questions/2772102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2576/" ]
> > is it possible to force ./manage.py test to flush the database between each test case? > > > Have a look on the implementation of the command of django.core.management.commands.flush.py. You can call the flush command from inside your test call (maybe in TestCase.setUp): ``` management.call_command('flush') ...
The answer to this is, don't write your tests in such a way as they depend on particular key values. For example, your test could better be written: ``` def test_one(self): do_something_which_creates_two_log_entries() logs = LogEntry.objects.all() assert_log_entry_correct(log[0]) assert_log_entry_corre...
2,772,102
Django (1.2 beta) will reset the database(s) between every test that runs, meaning each test runs on an empty DB. However, the database(s) are not **flushed**. One of the effects of flushing the database is the `auto_increment` counters are reset. Consider a test which pulls data out of the database by primary key: `...
2010/05/05
[ "https://Stackoverflow.com/questions/2772102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2576/" ]
> > is it possible to force ./manage.py test to flush the database between each test case? > > > Have a look on the implementation of the command of django.core.management.commands.flush.py. You can call the flush command from inside your test call (maybe in TestCase.setUp): ``` management.call_command('flush') ...
You can also use [TransactionTestCase.reset\_sequences](https://docs.djangoproject.com/en/2.1/topics/testing/advanced/#django.test.TransactionTestCase.reset_sequences): > > Setting **reset\_sequences = True** on a TransactionTestCase will make sure sequences are always reset before the test run: > > > > ``` > clas...
2,772,102
Django (1.2 beta) will reset the database(s) between every test that runs, meaning each test runs on an empty DB. However, the database(s) are not **flushed**. One of the effects of flushing the database is the `auto_increment` counters are reset. Consider a test which pulls data out of the database by primary key: `...
2010/05/05
[ "https://Stackoverflow.com/questions/2772102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2576/" ]
> > is it possible to force ./manage.py test to flush the database between each test case? > > > Have a look on the implementation of the command of django.core.management.commands.flush.py. You can call the flush command from inside your test call (maybe in TestCase.setUp): ``` management.call_command('flush') ...
If you use any sort of "flush", keep in mind that if you've automated user creation or any other sort of data insert, it'll be deleted too. An easy way to solve this problem without flushing is to get the ID of the first object during the test and increment from there. ``` Test1: assertEqual(foo.id, 1) assertEqual(ba...
2,772,102
Django (1.2 beta) will reset the database(s) between every test that runs, meaning each test runs on an empty DB. However, the database(s) are not **flushed**. One of the effects of flushing the database is the `auto_increment` counters are reset. Consider a test which pulls data out of the database by primary key: `...
2010/05/05
[ "https://Stackoverflow.com/questions/2772102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2576/" ]
The answer to this is, don't write your tests in such a way as they depend on particular key values. For example, your test could better be written: ``` def test_one(self): do_something_which_creates_two_log_entries() logs = LogEntry.objects.all() assert_log_entry_correct(log[0]) assert_log_entry_corre...
You can also use [TransactionTestCase.reset\_sequences](https://docs.djangoproject.com/en/2.1/topics/testing/advanced/#django.test.TransactionTestCase.reset_sequences): > > Setting **reset\_sequences = True** on a TransactionTestCase will make sure sequences are always reset before the test run: > > > > ``` > clas...
2,772,102
Django (1.2 beta) will reset the database(s) between every test that runs, meaning each test runs on an empty DB. However, the database(s) are not **flushed**. One of the effects of flushing the database is the `auto_increment` counters are reset. Consider a test which pulls data out of the database by primary key: `...
2010/05/05
[ "https://Stackoverflow.com/questions/2772102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2576/" ]
The answer to this is, don't write your tests in such a way as they depend on particular key values. For example, your test could better be written: ``` def test_one(self): do_something_which_creates_two_log_entries() logs = LogEntry.objects.all() assert_log_entry_correct(log[0]) assert_log_entry_corre...
If you use any sort of "flush", keep in mind that if you've automated user creation or any other sort of data insert, it'll be deleted too. An easy way to solve this problem without flushing is to get the ID of the first object during the test and increment from there. ``` Test1: assertEqual(foo.id, 1) assertEqual(ba...
2,772,102
Django (1.2 beta) will reset the database(s) between every test that runs, meaning each test runs on an empty DB. However, the database(s) are not **flushed**. One of the effects of flushing the database is the `auto_increment` counters are reset. Consider a test which pulls data out of the database by primary key: `...
2010/05/05
[ "https://Stackoverflow.com/questions/2772102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2576/" ]
You can also use [TransactionTestCase.reset\_sequences](https://docs.djangoproject.com/en/2.1/topics/testing/advanced/#django.test.TransactionTestCase.reset_sequences): > > Setting **reset\_sequences = True** on a TransactionTestCase will make sure sequences are always reset before the test run: > > > > ``` > clas...
If you use any sort of "flush", keep in mind that if you've automated user creation or any other sort of data insert, it'll be deleted too. An easy way to solve this problem without flushing is to get the ID of the first object during the test and increment from there. ``` Test1: assertEqual(foo.id, 1) assertEqual(ba...
404,906
Why a holomorphic function is infinitely differentiable just because of satisfying the Cauchy Riemann equations, but on the other side, a two variable real function that is twice differentiable is not infinitely differentiable? I'm asking this for two reasons: 1) $\mathbb{R}^2$ is somehow an analog to the complex pla...
2013/05/28
[ "https://math.stackexchange.com/questions/404906", "https://math.stackexchange.com", "https://math.stackexchange.com/users/64824/" ]
Even though $\mathbb R^2$ and $\mathbb C$ are isomorphic as real vector spaces, they are very different in some algebraic respects, which crucially influence the notion of differentiability. Recall the key idea that a function is differentiable at a point if it has a best linear approximation (more precisely, a constan...
This is one of the beautiful features of complex analysis. The answer is that holomorphic functions can be represented by an integral formula (the Cauchy integral formula), whereas most continuously differentiable functions (even smooth ones) on $\mathbb R^2$ cannot.
404,906
Why a holomorphic function is infinitely differentiable just because of satisfying the Cauchy Riemann equations, but on the other side, a two variable real function that is twice differentiable is not infinitely differentiable? I'm asking this for two reasons: 1) $\mathbb{R}^2$ is somehow an analog to the complex pla...
2013/05/28
[ "https://math.stackexchange.com/questions/404906", "https://math.stackexchange.com", "https://math.stackexchange.com/users/64824/" ]
The usual presentation of holomorphic functions (and complex analysis in general) is misleading; the analogue of a holomorphic function to a function on the real line is *one whose derivative is zero*! Recall one nice property of holomorphic functions: if a point $p$ lies inside a region $D$, which has a boundary $C$,...
This is one of the beautiful features of complex analysis. The answer is that holomorphic functions can be represented by an integral formula (the Cauchy integral formula), whereas most continuously differentiable functions (even smooth ones) on $\mathbb R^2$ cannot.
404,906
Why a holomorphic function is infinitely differentiable just because of satisfying the Cauchy Riemann equations, but on the other side, a two variable real function that is twice differentiable is not infinitely differentiable? I'm asking this for two reasons: 1) $\mathbb{R}^2$ is somehow an analog to the complex pla...
2013/05/28
[ "https://math.stackexchange.com/questions/404906", "https://math.stackexchange.com", "https://math.stackexchange.com/users/64824/" ]
Even though $\mathbb R^2$ and $\mathbb C$ are isomorphic as real vector spaces, they are very different in some algebraic respects, which crucially influence the notion of differentiability. Recall the key idea that a function is differentiable at a point if it has a best linear approximation (more precisely, a constan...
Note that an analytic, complex function $w=f(z)$ implies a function $F:\mathbb R^2\rightarrow\mathbb R^2$ by $r+is=f(x+iy)$. The reverse is *not* true, however. It is *not* the case that just any differentiable $F:\mathbb R^2\rightarrow\mathbb R^2$ implies a complex, analytic function. On the contrary, the [Cauchy-Riem...
404,906
Why a holomorphic function is infinitely differentiable just because of satisfying the Cauchy Riemann equations, but on the other side, a two variable real function that is twice differentiable is not infinitely differentiable? I'm asking this for two reasons: 1) $\mathbb{R}^2$ is somehow an analog to the complex pla...
2013/05/28
[ "https://math.stackexchange.com/questions/404906", "https://math.stackexchange.com", "https://math.stackexchange.com/users/64824/" ]
The usual presentation of holomorphic functions (and complex analysis in general) is misleading; the analogue of a holomorphic function to a function on the real line is *one whose derivative is zero*! Recall one nice property of holomorphic functions: if a point $p$ lies inside a region $D$, which has a boundary $C$,...
Note that an analytic, complex function $w=f(z)$ implies a function $F:\mathbb R^2\rightarrow\mathbb R^2$ by $r+is=f(x+iy)$. The reverse is *not* true, however. It is *not* the case that just any differentiable $F:\mathbb R^2\rightarrow\mathbb R^2$ implies a complex, analytic function. On the contrary, the [Cauchy-Riem...
404,906
Why a holomorphic function is infinitely differentiable just because of satisfying the Cauchy Riemann equations, but on the other side, a two variable real function that is twice differentiable is not infinitely differentiable? I'm asking this for two reasons: 1) $\mathbb{R}^2$ is somehow an analog to the complex pla...
2013/05/28
[ "https://math.stackexchange.com/questions/404906", "https://math.stackexchange.com", "https://math.stackexchange.com/users/64824/" ]
Even though $\mathbb R^2$ and $\mathbb C$ are isomorphic as real vector spaces, they are very different in some algebraic respects, which crucially influence the notion of differentiability. Recall the key idea that a function is differentiable at a point if it has a best linear approximation (more precisely, a constan...
The usual presentation of holomorphic functions (and complex analysis in general) is misleading; the analogue of a holomorphic function to a function on the real line is *one whose derivative is zero*! Recall one nice property of holomorphic functions: if a point $p$ lies inside a region $D$, which has a boundary $C$,...
250,410
If I write `Session["asdf"] = 234;` In my asp.net web app, does this mean the client will have a cookie stored on their browser?
2008/10/30
[ "https://Stackoverflow.com/questions/250410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes, but 234 won't be stored in the cookie. The cookie will only contain a unique ID (for example, `lit3py55t21z5v55vlm25s55`). Every time ASP.NET sees that unique ID, it will look up the corresponding session information. If you don't want to use cookies, you can put the session ID in the URL. Read this [MSDN article...
Session variables are kept on the server, but the user will have a cookie that identifies his session.
250,410
If I write `Session["asdf"] = 234;` In my asp.net web app, does this mean the client will have a cookie stored on their browser?
2008/10/30
[ "https://Stackoverflow.com/questions/250410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Yes, but 234 won't be stored in the cookie. The cookie will only contain a unique ID (for example, `lit3py55t21z5v55vlm25s55`). Every time ASP.NET sees that unique ID, it will look up the corresponding session information. If you don't want to use cookies, you can put the session ID in the URL. Read this [MSDN article...
There is a SessionID stored as a cookie in your browser in most circumstances. ASP.NET does allow "cookieless" sessions (though to be honest I've never seen this used in the real world): <http://msdn.microsoft.com/en-us/library/aa479314.aspx>
302,214
Can anyone help me fit my mind map in beamer? **EDIT:** I have these codes for the figure, but how I would like to fit the figure in beamer. ``` \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{mindmap,trees} \usepackage{verbatim} \begin{document} \pagestyle{empty} \begin{comment} :Title: Computer scienc...
2016/04/03
[ "https://tex.stackexchange.com/questions/302214", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/59923/" ]
There are many different ways to shrink a `tikzpicture` to fit inside a beamer frame, see, e.g., [Scaling a tikzpicture for a Beamer slide](https://tex.stackexchange.com/questions/62788/scaling-a-tikzpicture-for-a-beamer-slide). One possibility using `adjustbox`: ``` \documentclass{beamer} \usepackage{tikz} \usetikz...
Making a mind map is not, strictly speaking, a beamer capability, but is (for example) a tikz capability. I have never tried to put a tikz mind map on a beamer slide, but the coding would start with using some tikz code. I am not sure if there are other LaTeX-based implementations of mind maps, but tikz includes "mindm...
2,908,244
I'll illustrate my question with code: ``` #include <iostream> void PrintInt(const unsigned char*& ptr) { int data = 0; ::memcpy(&data, ptr, sizeof(data)); // advance the pointer reference. ptr += sizeof(data); std::cout << std::hex << data << " " << std::endl; } int main(int, char**) { unsig...
2010/05/25
[ "https://Stackoverflow.com/questions/2908244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/316606/" ]
If the pointer gets converted to a const pointer, as you suggest, then the result of that conversion is a temporary value, an *rvalue*. You cannot attach a non-const reference to an rvalue - it is illegal in C++. For example, this code will not compile for a similar reason ``` int i = 42; double &r = i; ``` Even t...
I think you need: `void PrintInt(const unsigned char* const& ptr)` if you want to pass a const pointer by reference.
2,908,244
I'll illustrate my question with code: ``` #include <iostream> void PrintInt(const unsigned char*& ptr) { int data = 0; ::memcpy(&data, ptr, sizeof(data)); // advance the pointer reference. ptr += sizeof(data); std::cout << std::hex << data << " " << std::endl; } int main(int, char**) { unsig...
2010/05/25
[ "https://Stackoverflow.com/questions/2908244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/316606/" ]
That will break the const-correctness: ``` // if it was allowed const int x = 5; int *p; const int*& cp = p; // cp is a ´constant´ alias to p cp = &x; // make cp (and p) point to a constant *p = 7; // !!!! ``` If the conversion was allowed the above code would compile. Once you have initialize...
I think you need: `void PrintInt(const unsigned char* const& ptr)` if you want to pass a const pointer by reference.
2,908,244
I'll illustrate my question with code: ``` #include <iostream> void PrintInt(const unsigned char*& ptr) { int data = 0; ::memcpy(&data, ptr, sizeof(data)); // advance the pointer reference. ptr += sizeof(data); std::cout << std::hex << data << " " << std::endl; } int main(int, char**) { unsig...
2010/05/25
[ "https://Stackoverflow.com/questions/2908244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/316606/" ]
If the pointer gets converted to a const pointer, as you suggest, then the result of that conversion is a temporary value, an *rvalue*. You cannot attach a non-const reference to an rvalue - it is illegal in C++. For example, this code will not compile for a similar reason ``` int i = 42; double &r = i; ``` Even t...
That will break the const-correctness: ``` // if it was allowed const int x = 5; int *p; const int*& cp = p; // cp is a ´constant´ alias to p cp = &x; // make cp (and p) point to a constant *p = 7; // !!!! ``` If the conversion was allowed the above code would compile. Once you have initialize...
2,908,244
I'll illustrate my question with code: ``` #include <iostream> void PrintInt(const unsigned char*& ptr) { int data = 0; ::memcpy(&data, ptr, sizeof(data)); // advance the pointer reference. ptr += sizeof(data); std::cout << std::hex << data << " " << std::endl; } int main(int, char**) { unsig...
2010/05/25
[ "https://Stackoverflow.com/questions/2908244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/316606/" ]
If the pointer gets converted to a const pointer, as you suggest, then the result of that conversion is a temporary value, an *rvalue*. You cannot attach a non-const reference to an rvalue - it is illegal in C++. For example, this code will not compile for a similar reason ``` int i = 42; double &r = i; ``` Even t...
You cannot convert a reference to a pointer because the pointer can be null and a reference can't. In other words the reference is more restrictive that a pointer. A reference is always a valid pointer but the opposite is not always true.
2,908,244
I'll illustrate my question with code: ``` #include <iostream> void PrintInt(const unsigned char*& ptr) { int data = 0; ::memcpy(&data, ptr, sizeof(data)); // advance the pointer reference. ptr += sizeof(data); std::cout << std::hex << data << " " << std::endl; } int main(int, char**) { unsig...
2010/05/25
[ "https://Stackoverflow.com/questions/2908244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/316606/" ]
That will break the const-correctness: ``` // if it was allowed const int x = 5; int *p; const int*& cp = p; // cp is a ´constant´ alias to p cp = &x; // make cp (and p) point to a constant *p = 7; // !!!! ``` If the conversion was allowed the above code would compile. Once you have initialize...
You cannot convert a reference to a pointer because the pointer can be null and a reference can't. In other words the reference is more restrictive that a pointer. A reference is always a valid pointer but the opposite is not always true.
34,558,765
I'm learning C and am currently experimenting with storing strings in variables. I put together the following to try different stuff. ``` #include <stdio.h> int main() { char *name = "Tristan"; char today[] = "January 1st, 2016"; char newyear[] = {'H','a','p','p','y',' ','N','e','w',' ','Y','e','a','r','!'...
2016/01/01
[ "https://Stackoverflow.com/questions/34558765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5481126/" ]
`newyear` misses a trailing null byte, so `printf`ing it is undefined behavior. Only string literals implicitly append a null byte. You explicitly initialize every character, so **no null byte is appended**. Undefined behavior means that something the standard does not define in this occasion will happen. That incl...
Remember that strings in C are terminated by the special `'\0'` character. Not having this terminator at the end of data that is treated as a string will lead to *undefined behavior* as the string functions pass the end of the data searching for the terminator.
34,558,765
I'm learning C and am currently experimenting with storing strings in variables. I put together the following to try different stuff. ``` #include <stdio.h> int main() { char *name = "Tristan"; char today[] = "January 1st, 2016"; char newyear[] = {'H','a','p','p','y',' ','N','e','w',' ','Y','e','a','r','!'...
2016/01/01
[ "https://Stackoverflow.com/questions/34558765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5481126/" ]
`newyear` misses a trailing null byte, so `printf`ing it is undefined behavior. Only string literals implicitly append a null byte. You explicitly initialize every character, so **no null byte is appended**. Undefined behavior means that something the standard does not define in this occasion will happen. That incl...
This because you are defining `newyear` directly as a `char` array and not through the string literal `""` syntax. This prevents the compiler from adding a trailing `\0` character which is required to mark the end of a string. Since both `newyear` and `today` reside on stack, in this case they have contiguous storage ...
34,558,765
I'm learning C and am currently experimenting with storing strings in variables. I put together the following to try different stuff. ``` #include <stdio.h> int main() { char *name = "Tristan"; char today[] = "January 1st, 2016"; char newyear[] = {'H','a','p','p','y',' ','N','e','w',' ','Y','e','a','r','!'...
2016/01/01
[ "https://Stackoverflow.com/questions/34558765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5481126/" ]
`newyear` misses a trailing null byte, so `printf`ing it is undefined behavior. Only string literals implicitly append a null byte. You explicitly initialize every character, so **no null byte is appended**. Undefined behavior means that something the standard does not define in this occasion will happen. That incl...
`newyear` should finish with a `'\0'` instead of the `newline`, to be a C string. You can then put the `newline` in the `printf` statement, like the others: ``` char newyear[] = {'H','a','p','p','y',' ','N','e','w',' ','Y','e','a','r','!','\0'}; //... printf("%s.\n", newyear); ``` Or, you can add the string terminat...
3,099,521
Hi guys I'm using zend framework here and I've enabled url-rewrite so all my urls are clean. The thing is that I've incorporated pagination of results on some pages and I want to append parameters to the url in this form: ``` www.mysite.com/controller/page/2 ``` However I can't do it without appending the default a...
2010/06/23
[ "https://Stackoverflow.com/questions/3099521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/89752/" ]
I'm pretty new to ZF, but I think you can provide your own router to the front-controller. There you can add a route, which leaves out the "/index"-part.
Depending on the complexity of our setup you could just override the `default` route ``` resources.router.routes.default.route = :action/:page resources.router.routes.default.defaults.page = 0 resources.router.routes.default.defaults.module = default resources.router.routes.default.defaults.controller = index resource...