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 |
|---|---|---|---|---|---|
226,735 | I am looking at establish a circuit allowing to detect when one or two wire are cut such as a tamper system. When the wire are cut it should signal this a GPIO.
I suppose I need to use a transistor connected to GPIO but I have a bit some difficulty to see how. | 2016/04/06 | [
"https://electronics.stackexchange.com/questions/226735",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/104309/"
] | 
[simulate this circuit](/plugins/schematics?image=http%3a%2f%2fi.stack.imgur.com%2fA8UqT.png) – Schematic created using [CircuitLab](https://www.circuitlab.com/)
*Figure 1. GPIO normally pulled low by tamper loop. Cutting loop causes GPIO to be pulled high by R1.*
C1... | It depends on what level of tampering you want to be able to detect. The minimum approach is described by transistor.
Note that a clever tamperer can simply ground the top line, then cut the loop and perform mischief. A more robust system uses two pins. The processor drives one with different values, then checks the o... |
226,735 | I am looking at establish a circuit allowing to detect when one or two wire are cut such as a tamper system. When the wire are cut it should signal this a GPIO.
I suppose I need to use a transistor connected to GPIO but I have a bit some difficulty to see how. | 2016/04/06 | [
"https://electronics.stackexchange.com/questions/226735",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/104309/"
] | An alternative to detecting change in voltage on the GPIO pin would be to use a dedicated [current loop](https://en.wikipedia.org/wiki/Current_loop) controller. There exists many [4–20mA](https://electronics.stackexchange.com/tags/4-20ma/info) control circuits that will have a indicator pin for when there is no current... | It depends on what level of tampering you want to be able to detect. The minimum approach is described by transistor.
Note that a clever tamperer can simply ground the top line, then cut the loop and perform mischief. A more robust system uses two pins. The processor drives one with different values, then checks the o... |
226,735 | I am looking at establish a circuit allowing to detect when one or two wire are cut such as a tamper system. When the wire are cut it should signal this a GPIO.
I suppose I need to use a transistor connected to GPIO but I have a bit some difficulty to see how. | 2016/04/06 | [
"https://electronics.stackexchange.com/questions/226735",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/104309/"
] | Pull up the GPIO externally to HIGH. Configure a cheap uC to trigger an interrupt when the pin value changes from HIGH->LOW.When you enter the ISR,you'l know that your circuit was tampered/cut.
If you want to go a little further,you could use an [Event Monitor](http://www.nxp.com/documents/data_sheet/PCF2127.pdf) to c... | It depends on what level of tampering you want to be able to detect. The minimum approach is described by transistor.
Note that a clever tamperer can simply ground the top line, then cut the loop and perform mischief. A more robust system uses two pins. The processor drives one with different values, then checks the o... |
15,216,048 | My Box Shadow is not showing in IE7 and IE8.
```
#bodyContainer{
background: url(../images/site_bg.png) repeat ;
margin: 0px auto;
width:1000px;
float:left;
position:relative;
border: 1px solid #EEEEEE;
/*background:#FFFFFF;*/
box-shadow: 0 0 5px 0 #000000;
}
``` | 2013/03/05 | [
"https://Stackoverflow.com/questions/15216048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1548927/"
] | You have to use the non-standard IE filter property. See [this article](http://hedgerwow.appspot.com/demo/shadow) | Accoding to `Box-shadow`'s [MDN compatibility table](https://developer.mozilla.org/en-US/docs/CSS/box-shadow#Browser_compatibility), Box-shadow doesn't support in IE7 and IE8.
Check the same link (Notes section) for more info on alternative properties like [Dropshadow](http://msdn.microsoft.com/en-us/library/ms532985%... |
15,216,048 | My Box Shadow is not showing in IE7 and IE8.
```
#bodyContainer{
background: url(../images/site_bg.png) repeat ;
margin: 0px auto;
width:1000px;
float:left;
position:relative;
border: 1px solid #EEEEEE;
/*background:#FFFFFF;*/
box-shadow: 0 0 5px 0 #000000;
}
``` | 2013/03/05 | [
"https://Stackoverflow.com/questions/15216048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1548927/"
] | Use [CSS3 PIE](http://css3pie.com/), which emulates [some CSS3 properties](http://css3pie.com/documentation/supported-css3-features/) in older versions of IE.
It supports `box-shadow` ([except for](https://github.com/lojjic/PIE/issues/3) the `inset` keyword).
and
There are article about [CSS3 Box Shadow in Internet... | Accoding to `Box-shadow`'s [MDN compatibility table](https://developer.mozilla.org/en-US/docs/CSS/box-shadow#Browser_compatibility), Box-shadow doesn't support in IE7 and IE8.
Check the same link (Notes section) for more info on alternative properties like [Dropshadow](http://msdn.microsoft.com/en-us/library/ms532985%... |
15,216,048 | My Box Shadow is not showing in IE7 and IE8.
```
#bodyContainer{
background: url(../images/site_bg.png) repeat ;
margin: 0px auto;
width:1000px;
float:left;
position:relative;
border: 1px solid #EEEEEE;
/*background:#FFFFFF;*/
box-shadow: 0 0 5px 0 #000000;
}
``` | 2013/03/05 | [
"https://Stackoverflow.com/questions/15216048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1548927/"
] | You have to use the non-standard IE filter property. See [this article](http://hedgerwow.appspot.com/demo/shadow) | box-shadow is a feature of CSS3
hence it is not supported below ie9
you can check the compatibity here:
<http://caniuse.com/#search=box-shadow> |
15,216,048 | My Box Shadow is not showing in IE7 and IE8.
```
#bodyContainer{
background: url(../images/site_bg.png) repeat ;
margin: 0px auto;
width:1000px;
float:left;
position:relative;
border: 1px solid #EEEEEE;
/*background:#FFFFFF;*/
box-shadow: 0 0 5px 0 #000000;
}
``` | 2013/03/05 | [
"https://Stackoverflow.com/questions/15216048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1548927/"
] | Use [CSS3 PIE](http://css3pie.com/), which emulates [some CSS3 properties](http://css3pie.com/documentation/supported-css3-features/) in older versions of IE.
It supports `box-shadow` ([except for](https://github.com/lojjic/PIE/issues/3) the `inset` keyword).
and
There are article about [CSS3 Box Shadow in Internet... | You have to use the non-standard IE filter property. See [this article](http://hedgerwow.appspot.com/demo/shadow) |
15,216,048 | My Box Shadow is not showing in IE7 and IE8.
```
#bodyContainer{
background: url(../images/site_bg.png) repeat ;
margin: 0px auto;
width:1000px;
float:left;
position:relative;
border: 1px solid #EEEEEE;
/*background:#FFFFFF;*/
box-shadow: 0 0 5px 0 #000000;
}
``` | 2013/03/05 | [
"https://Stackoverflow.com/questions/15216048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1548927/"
] | You have to use the non-standard IE filter property. See [this article](http://hedgerwow.appspot.com/demo/shadow) | Box-Shadow is not compatible below IE9
Always check compatibility of CSS Properties using following link
<http://caniuse.com/css-boxshadow> |
15,216,048 | My Box Shadow is not showing in IE7 and IE8.
```
#bodyContainer{
background: url(../images/site_bg.png) repeat ;
margin: 0px auto;
width:1000px;
float:left;
position:relative;
border: 1px solid #EEEEEE;
/*background:#FFFFFF;*/
box-shadow: 0 0 5px 0 #000000;
}
``` | 2013/03/05 | [
"https://Stackoverflow.com/questions/15216048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1548927/"
] | Use [CSS3 PIE](http://css3pie.com/), which emulates [some CSS3 properties](http://css3pie.com/documentation/supported-css3-features/) in older versions of IE.
It supports `box-shadow` ([except for](https://github.com/lojjic/PIE/issues/3) the `inset` keyword).
and
There are article about [CSS3 Box Shadow in Internet... | box-shadow is a feature of CSS3
hence it is not supported below ie9
you can check the compatibity here:
<http://caniuse.com/#search=box-shadow> |
15,216,048 | My Box Shadow is not showing in IE7 and IE8.
```
#bodyContainer{
background: url(../images/site_bg.png) repeat ;
margin: 0px auto;
width:1000px;
float:left;
position:relative;
border: 1px solid #EEEEEE;
/*background:#FFFFFF;*/
box-shadow: 0 0 5px 0 #000000;
}
``` | 2013/03/05 | [
"https://Stackoverflow.com/questions/15216048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1548927/"
] | Use [CSS3 PIE](http://css3pie.com/), which emulates [some CSS3 properties](http://css3pie.com/documentation/supported-css3-features/) in older versions of IE.
It supports `box-shadow` ([except for](https://github.com/lojjic/PIE/issues/3) the `inset` keyword).
and
There are article about [CSS3 Box Shadow in Internet... | Box-Shadow is not compatible below IE9
Always check compatibility of CSS Properties using following link
<http://caniuse.com/css-boxshadow> |
16,134,120 | Visual Studio / monodevelop have awesome feature that can let you specify xml comments above every function / variable which is then displayed as a description of that function when you roll over it, click it etc.
```
/// <summary>
/// This is example for stack overflow
/// </summary>
public void Foo()... | 2013/04/21 | [
"https://Stackoverflow.com/questions/16134120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1514983/"
] | You can generate the xml for documentation of your library using visual studio, check it [here](http://msdn.microsoft.com/en-us/library/vstudio/x4sa0ak0%28v=vs.100%29.aspx).
>
> The Generate XML documentation file property determines whether an XML
> file will be generated during compilation. You set this property o... | You can use `/doc` and then bundle the generated documentation with your assemblies:
<http://msdn.microsoft.com/en-us/library/3260k4x7.aspx> |
6,411 | How can I make backup from iPhoto without time machine? | 2009/05/08 | [
"https://serverfault.com/questions/6411",
"https://serverfault.com",
"https://serverfault.com/users/1968/"
] | iPhoto puts all of your photos into a library similar to the way iTunes puts all of your music into a music in a library folder structure. That being said you could easily just copy the library from your hard drive to another. I know you want to back it up, but here is some information on how to move the library and mu... | If you don't mind getting your hands dirty with the command line, there are a couple of great ways. Personally, I use rsync to keep my iPhoto library (and iTunes for that matter) coordinated between 3 systems by pushing out the newest copy whenever I make changes.
```
rsync -azv -e ssh ~/Pictures/iPhoto\ Library/ <rem... |
415,701 | I am working on my chess engine in C++ and I went for bitboards to represent the board. It is basically a 64-bit number for which I use the `bitset` library. I feel the most crucial part in performance comes through the move generation. Earlier I encoded moves as `std::string`'s in a `std::vector` which would perform m... | 2020/09/09 | [
"https://softwareengineering.stackexchange.com/questions/415701",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/-1/"
] | Questions like this usually boil down to a trade-off between memory usage and speed. A program which uses a highly packed representation for keeping boards in memory will always require some time to unpack the data into a form where it can evaluate and apply the game's semantics. This is especially true when this "unpa... | You want to store enough information to make the move and to undo the move. So that is start position, end position, piece taken, and piece converted to at the very least. 6 bit + 6 bit + 3 bit + 2 bit.
If you want to take it to 16 bit at most, store 1 bit for "conversion" set if a pawn moves to the last row, and you ... |
415,701 | I am working on my chess engine in C++ and I went for bitboards to represent the board. It is basically a 64-bit number for which I use the `bitset` library. I feel the most crucial part in performance comes through the move generation. Earlier I encoded moves as `std::string`'s in a `std::vector` which would perform m... | 2020/09/09 | [
"https://softwareengineering.stackexchange.com/questions/415701",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/-1/"
] | Questions like this usually boil down to a trade-off between memory usage and speed. A program which uses a highly packed representation for keeping boards in memory will always require some time to unpack the data into a form where it can evaluate and apply the game's semantics. This is especially true when this "unpa... | Best way?
No clue. It depends on what you are using this encoding for.
For example the best way would for a human would be column/row to column/row.
For a computer? Considering that you have a 64bit board it takes exactly 6 bits to identify a location. Even then extra information such the piece being white/black bis... |
54,754,090 | I am trying to see if two times, both with start and end times, overlap in any way. for instance, if A has a start time of 0800 and an end time of 0900 and I want to see if B, which has a start time of 0845 and an end time of 0945, interests/ overlaps it in any way. I don't care about the actual date just the times. | 2019/02/18 | [
"https://Stackoverflow.com/questions/54754090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9761440/"
] | If you want to do this specifically using moment.js then you can try this plugin `moment-range` which allows you to have two date ranges and a function `overlaps` that can check this for you.
<https://github.com/rotaready/moment-range#overlaps>
Alternatively, you can manually do this check with if statements as well ... | You want to check if the
EndDate of A > StartDate of B
EndDate of B > Start |
126,532 | So I have generic fantasy Human Empire, relatively Good folks, but mostly Orderly. Racially mostly homogeneous, some elves and dwarves are present, but 99% humans. And there is the Monster Empire, which is ruled by dragons, but has all kinds of naturally Evil monsters (and by Evil I mean DnD like alignments, so tangibl... | 2018/10/02 | [
"https://worldbuilding.stackexchange.com/questions/126532",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/55884/"
] | The US and Britain worked with the USSR in WW2.
-----------------------------------------------
It's not exactly like your scenario, though, since the US+Britain and USSR made Germany fight a three-front war whereas your scenario is a one-front war.
More importantly, there were people in US+Britain who were deluded i... | Continued from my comment...
There's a TV show running just now, "Britannia", that tells a story (a story expanded and exaggerated for the sake of romance/theatrics) of the second attempt of the Roman empire to invade Britain.
As the story is told (minor spoiler), **after the Romans establish a foothold, while consi... |
29,934,164 | I have two fragments within one fragment using ViewPager.
Sometimes my app crash with following error:
```
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp/com.myapp.MyAcitivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.fragments.MyFragmen... | 2015/04/29 | [
"https://Stackoverflow.com/questions/29934164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3176004/"
] | The deadlock is at `Line 3`. At this line both the `Threads` are waiting continuously to acquire lock on resource `t`. The initial value of `t` is 0, which means it is already in a locked state, so for example if `Thread1` reaches first to `line 3` it waits till the value of `t` becomes 1 and similarly after some time ... | Hint: You can avoid deadlocks by lock ordering. For example, all code must lock `s` before it locks `t`. The question demonstrates what can happen if that is not the case. You can "make changes to the initial semaphore values" to conform with lock ordering. |
63,077,450 | I've spent the last few hours trying to figure how to do something relatively simple- i'd like to write a python script that returns a number of strings from a predefined alphabet using certain weights. So for example
```
strings = 3
length= 4
alphabet = list('QWER')
weights=[0.0, 0.0, 0.0, 1.0]
```
this would retu... | 2020/07/24 | [
"https://Stackoverflow.com/questions/63077450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13989644/"
] | SO thank you for the suggestions, i manged to puzzle through it-
```
import random
for i in range(100): #number of strings
a = random.choices(["A", "B", "C"], [0.5, 0.5, 0.0], k=100) #weights of strings
random_sequence=''
for i in range(0,5): #length of string
random_sequence+=random.choice(a)
... | As of Python 3.6, there's a built-in method for this, [`random.choices()`](https://docs.python.org/3/library/random.html#random.choices). Here's a working example with output.
```py
import random
strings = 2
length= 3
alphabet = list('ABC')
weights=[0.3,0.3,0.3]
for i in range(10):
print(random.choices(alphabet... |
64,366,902 | My code:
Added data in array adapter but last data only comming how to add all the data in spinner using arrayadapter
```
while (rs.next()) {
int_EMP_ID = rs.getInt("EmpID");
str_EMP_Name = rs.getString("EmployeeName");
int User_ID_List[] = {int_EMP_ID};
... | 2020/10/15 | [
"https://Stackoverflow.com/questions/64366902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14454144/"
] | You *could* try doing a regex replacement here:
```
String input = "\"email_settings\": {\n \"email.starttls.enable\":\"true\",\n \"email.port\":\"111\",\n \"email.host\":\"xxxx\",\n \"email.auth\":\"true\",\n}";
String output = input.replaceAll("([ ]*\"email.host\":\".*?\")", " \"email.name\"... | ```
content = content.replace("\"email.host\":", "\"email.name\":\"myTest\",\n" + " \"email.host\":");
```
Or you could look in to libraries which parse json files. |
50,479,400 | I'm trying to show my users notifications through my service that checks my database when an item is at it's set date it should send a notification. My problem is that when the date comes it doesn't send a notification.
```
databaseReference = FirebaseDatabase.getInstance().getReference().child("Groups").child(mGroupU... | 2018/05/23 | [
"https://Stackoverflow.com/questions/50479400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9554176/"
] | Implement the `textFieldDidBeginEditing` text field delegate method and set the text field's text if it doesn't already have a value.
```
func textFieldDidBeginEditing(_ textField: UITextField) {
if textField.text!.isEmpty {
// set the text as needed
}
}
``` | ```
import UIKit
class ActivityPersonDetail : UIViewController,UITextFieldDelegate,UIPickerViewDataSource, UIPickerViewDelegate {
let salutations = ["1", "2", "3","4","5","6","7","8","9","10","11","12"]
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(... |
50,479,400 | I'm trying to show my users notifications through my service that checks my database when an item is at it's set date it should send a notification. My problem is that when the date comes it doesn't send a notification.
```
databaseReference = FirebaseDatabase.getInstance().getReference().child("Groups").child(mGroupU... | 2018/05/23 | [
"https://Stackoverflow.com/questions/50479400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9554176/"
] | Implement the `textFieldDidBeginEditing` text field delegate method and set the text field's text if it doesn't already have a value.
```
func textFieldDidBeginEditing(_ textField: UITextField) {
if textField.text!.isEmpty {
// set the text as needed
}
}
``` | I'm going to build on rmaddy's answer and add more nuances and answers to questions in the comments.
Main answer lays in the first extension, the rest of the code outlines class structure and components that need to be present for everything to work.
```
class ViewController {
private var selectedItem: String = "... |
50,479,400 | I'm trying to show my users notifications through my service that checks my database when an item is at it's set date it should send a notification. My problem is that when the date comes it doesn't send a notification.
```
databaseReference = FirebaseDatabase.getInstance().getReference().child("Groups").child(mGroupU... | 2018/05/23 | [
"https://Stackoverflow.com/questions/50479400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9554176/"
] | Implement the `textFieldDidBeginEditing` text field delegate method and set the text field's text if it doesn't already have a value.
```
func textFieldDidBeginEditing(_ textField: UITextField) {
if textField.text!.isEmpty {
// set the text as needed
}
}
``` | ```
@IBOutlet weak var tF: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
tF.delegate = self
}
func textFieldDidEndEditing(_ textField: UITextField) {
textField.text = pickOptions[row]
}
``` |
50,479,400 | I'm trying to show my users notifications through my service that checks my database when an item is at it's set date it should send a notification. My problem is that when the date comes it doesn't send a notification.
```
databaseReference = FirebaseDatabase.getInstance().getReference().child("Groups").child(mGroupU... | 2018/05/23 | [
"https://Stackoverflow.com/questions/50479400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9554176/"
] | I'm going to build on rmaddy's answer and add more nuances and answers to questions in the comments.
Main answer lays in the first extension, the rest of the code outlines class structure and components that need to be present for everything to work.
```
class ViewController {
private var selectedItem: String = "... | ```
import UIKit
class ActivityPersonDetail : UIViewController,UITextFieldDelegate,UIPickerViewDataSource, UIPickerViewDelegate {
let salutations = ["1", "2", "3","4","5","6","7","8","9","10","11","12"]
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(... |
50,479,400 | I'm trying to show my users notifications through my service that checks my database when an item is at it's set date it should send a notification. My problem is that when the date comes it doesn't send a notification.
```
databaseReference = FirebaseDatabase.getInstance().getReference().child("Groups").child(mGroupU... | 2018/05/23 | [
"https://Stackoverflow.com/questions/50479400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9554176/"
] | I'm going to build on rmaddy's answer and add more nuances and answers to questions in the comments.
Main answer lays in the first extension, the rest of the code outlines class structure and components that need to be present for everything to work.
```
class ViewController {
private var selectedItem: String = "... | ```
@IBOutlet weak var tF: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
tF.delegate = self
}
func textFieldDidEndEditing(_ textField: UITextField) {
textField.text = pickOptions[row]
}
``` |
1,737,108 | I am stuck with WIN32 ( no .NET or anything managed ) | 2009/11/15 | [
"https://Stackoverflow.com/questions/1737108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11100/"
] | WM\_CTLCOLORSTATIC was the correct way to control the color of the group box title.
However, it no longer works: If your application uses a manifest to include the version 6 comctl library, the Groupbox control no longer sends the `WM_CTLCOLORSTATIC` to its parent to get a brush. If your dialog controls look ugly, squ... | I think [WM\_CTLCOLORSTATIC notification](http://msdn.microsoft.com/en-us/library/bb787524(VS.85).aspx) might be what you're after. |
1,737,108 | I am stuck with WIN32 ( no .NET or anything managed ) | 2009/11/15 | [
"https://Stackoverflow.com/questions/1737108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11100/"
] | WM\_CTLCOLORSTATIC was the correct way to control the color of the group box title.
However, it no longer works: If your application uses a manifest to include the version 6 comctl library, the Groupbox control no longer sends the `WM_CTLCOLORSTATIC` to its parent to get a brush. If your dialog controls look ugly, squ... | Well you set the font using the normal way of setting control fonts. Send a WM\_SETFONT message in your window initialisation using a HFONT you created with CreateFont. e.g.
```
SendDlgItemMessage(hDlg, IDC_STATIC, WM_SETFONT, (WPARAM)hFont, TRUE);
```
Then as pointed out you need to use the WM\_CTLCOLORSTATIC notifi... |
16,402,483 | I have an iPhone 4S (running iOS 5.1) & an iPhone 5 (running iOS 6.1). I noticed that when i try to open the `cocos2D` game, on the iPhone 4S running 5.1, the game is able to open perfectly fine in landscape mode.
However, when I try to open the same `cocos2D` game on my iPhone 5 running 6.1, the game is opened in po... | 2013/05/06 | [
"https://Stackoverflow.com/questions/16402483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/783188/"
] | I just set the orientation modes in Xcode ("Summary" tab on your target) to landscape left and right. Then for every UIViewController I added this:
```
// Autorotation iOS5 + iOS6
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation {
return UIInterfaceOrientationIsLand... | What I'm doing for landscape in my cocos2d game (on iOS 6.1):
```
//This is in the AppDelegate.m
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
//change to 'return UIInterfaceOrientationIsPortrait(interfa... |
44,680,971 | I added a redirection link to the reference numbers in a grid that link back to receipts. I followed the instructions given in T200 to perform the task, except
I made the page that opens a popup instead of a new tab. It works for the first reference number I click, but after that it doesn't change the record. Instead ... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44680971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7085476/"
] | Pass the index label to `loc` and the col of interest:
```
In[198]:
df.loc[diff_row.idxmax(), 'City']
Out[198]: 'Dallas'
``` | Taking a step back and using `numpy.ptp` (peak to peak) to do the subtraction of max less min.
```
df.set_index('City').apply(np.ptp, 1).idxmax()
'Dallas'
```
---
We can push more over to `numpy` with
```
df.City.values[np.ptp(df.set_index('City').values, 1).argmax()]
'Dallas'
```
---
**Timing**
```
%timeit... |
4,236,395 | So my question is: if we have a function f(x, y), how do we know if the curve f(x, y)=0 encloses a finite region or not. As an example, the curve $x^2+y^2-1=0$ encloses a finite region, while the curve $x^2-y^2-1=0$ doesn't. | 2021/08/30 | [
"https://math.stackexchange.com/questions/4236395",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/494803/"
] | Consider the following result from geometric analysis due to [Matthew Grayson (1987)](https://en.wikipedia.org/wiki/Mean_curvature_flow#Convergence_theorems):
>
> Let $g:\mathbb{S}^1\to\mathbb{R}^2$ be a smooth embedding, then the mean curvature flow with initial data $g$ eventually consists exclusively of embeddings... | First of all you can't call a region of $\mathbb{R}^2$ finite unless its cardinal is finite. What you are trying to say it is that the region is bounded (that is, that there is some $D(x\_0,r)$ such that the region is inside the disck)
Although this is not a very concrete question, I guess that the best I can offer yo... |
6,393,438 | So I hoped to figure out the code that would finish this:
```
public List<List<Integer>> create4(List<Integer> dice) {
//unknown code
return listOf4s;
}
```
So dice would always be a List of 5 Integers,
from the 5 Integers I would like to create a List every possible permutation using only 4 numbers... | 2011/06/18 | [
"https://Stackoverflow.com/questions/6393438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/679413/"
] | I have not tried this out, but hopefully this helps.
```
public List<List<Integer>> createN(List<Integer> dice) {
if (dice.size() == 1) {
List<List<Integer>> permutations = new ArrayList<List<Integer>>();
permutations.add(dice);
return permutations;
}
else {
List<List<Integer... | This is what I did using @btreat 's idea and it worked great.
```
public List<List<Integer>> create4(List<Integer> dice) {
List<List<Integer>> permutations = new ArrayList<List<Integer>>();
for(int i = 0; i < dice.size(); i++) {
List<Integer> includedPermutation = new ArrayList<Integer>();
... |
6,393,438 | So I hoped to figure out the code that would finish this:
```
public List<List<Integer>> create4(List<Integer> dice) {
//unknown code
return listOf4s;
}
```
So dice would always be a List of 5 Integers,
from the 5 Integers I would like to create a List every possible permutation using only 4 numbers... | 2011/06/18 | [
"https://Stackoverflow.com/questions/6393438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/679413/"
] | I tend to like shorter code ;)
```
public List<List<Integer>> create4(List<Integer> dice) {
List<List<Integer>> listOf4s = new ArrayList<List<Integer>>();
for(Integer num : dice) {
List<Integer> dice2 = new ArrayList<Integer>(dice);
dices2.remove(num);
listOf4s.add(dices2);
}
re... | I have not tried this out, but hopefully this helps.
```
public List<List<Integer>> createN(List<Integer> dice) {
if (dice.size() == 1) {
List<List<Integer>> permutations = new ArrayList<List<Integer>>();
permutations.add(dice);
return permutations;
}
else {
List<List<Integer... |
6,393,438 | So I hoped to figure out the code that would finish this:
```
public List<List<Integer>> create4(List<Integer> dice) {
//unknown code
return listOf4s;
}
```
So dice would always be a List of 5 Integers,
from the 5 Integers I would like to create a List every possible permutation using only 4 numbers... | 2011/06/18 | [
"https://Stackoverflow.com/questions/6393438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/679413/"
] | I tend to like shorter code ;)
```
public List<List<Integer>> create4(List<Integer> dice) {
List<List<Integer>> listOf4s = new ArrayList<List<Integer>>();
for(Integer num : dice) {
List<Integer> dice2 = new ArrayList<Integer>(dice);
dices2.remove(num);
listOf4s.add(dices2);
}
re... | This is what I did using @btreat 's idea and it worked great.
```
public List<List<Integer>> create4(List<Integer> dice) {
List<List<Integer>> permutations = new ArrayList<List<Integer>>();
for(int i = 0; i < dice.size(); i++) {
List<Integer> includedPermutation = new ArrayList<Integer>();
... |
301,927 | So, I'm playing this video game and I came across this sentence that uses "stem from" in an alien way to me.
"Their zeal is admirable, but their ideas impractical for a society that must maintain secrecy and organization **to stem** its own genocide **from** coming about."
I know that "stem from" means Originate from... | 2021/11/10 | [
"https://ell.stackexchange.com/questions/301927",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/140013/"
] | Both are correct. But how?
These sentences both use "unreal" grammar. The reason they're both correct will make more sense if we change them back to real sentences with the same meaning:
>
> (1) We **have been** able to come here because it isn't raining.
>
>
> (2) We **were** able to come here because it wasn't r... | One does not say, "If it was..", but "If it were..." This is the subjunctive mood, used in stating a condition *known* to be false.
[Tevye is grammatically correct](https://genius.com/Topol-if-i-were-a-rich-man-lyrics) asking, "If I were a rich man." |
301,927 | So, I'm playing this video game and I came across this sentence that uses "stem from" in an alien way to me.
"Their zeal is admirable, but their ideas impractical for a society that must maintain secrecy and organization **to stem** its own genocide **from** coming about."
I know that "stem from" means Originate from... | 2021/11/10 | [
"https://ell.stackexchange.com/questions/301927",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/140013/"
] | Both are correct, it depends on the time. You say the second one, for instance, when you tell this memory to a friend a year later because it's the third conditional. It's explained on British Council Learn English website as;
''The third conditional is used to imagine a different past. We imagine a change in a past s... | One does not say, "If it was..", but "If it were..." This is the subjunctive mood, used in stating a condition *known* to be false.
[Tevye is grammatically correct](https://genius.com/Topol-if-i-were-a-rich-man-lyrics) asking, "If I were a rich man." |
301,927 | So, I'm playing this video game and I came across this sentence that uses "stem from" in an alien way to me.
"Their zeal is admirable, but their ideas impractical for a society that must maintain secrecy and organization **to stem** its own genocide **from** coming about."
I know that "stem from" means Originate from... | 2021/11/10 | [
"https://ell.stackexchange.com/questions/301927",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/140013/"
] | The simple past ("was") is used to discuss possibilities. The past perfect ("had been") is used to discuss counterfactuals. That is, if you're uncertain about whether something happened, and want to discuss the consequences of it being the case, the simple past is appropriate. For instance, "If it was raining, they wil... | One does not say, "If it was..", but "If it were..." This is the subjunctive mood, used in stating a condition *known* to be false.
[Tevye is grammatically correct](https://genius.com/Topol-if-i-were-a-rich-man-lyrics) asking, "If I were a rich man." |
3,533,757 | So, that's the problem. I tried factoring the quadratic equation to get something like $2x-y$ but it doesn't work. Dividing by $y^2$ won't work because the right side is $9$, not $0$. The last idea I have is to say that $2x-y=t => y=2x-t$ and replace $y$ in the quadratic equation with $2x-t$ to get a function but then,... | 2020/02/04 | [
"https://math.stackexchange.com/questions/3533757",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/502482/"
] | $$2x^2-4xy+6y^2=9$$ and let $$k=2x-y\Rightarrow y=2x-k$$
$2x^2-4x(2x-k)+6(2x-k)^2=9$
$2x^2-8x^2+4xk+6(4x^2+k^2-4xk)=9$
$-6x^2+4xk+24x^2+6k^2-24xk-9=0$
$$18x^2-20kx+6k^2-9=0$$
For real roots, Discriminant $\geq 0$
$$400k^2-4\cdot 18(6k^2-9)\geq 0$$
$$100k^2-108k^2+162\geq 0$$
$$-8k^2+162\geq 0\Rightarrow k^2-\fr... | The trick is to notice that:
$$4(2x-y)^2 = 9(2x^2-4xy+6y^2) - 2(x-5y)^2\leq 9(2x^2-4xy+6y^2) = 81$$
It follows that
$$-\frac{9}{2} \leq 2x-y \leq \frac{9}{2}$$
The minimum is attained when $(x,y)=\left(-\dfrac{5}{2},-\dfrac{1}{2}\right)$ and the maximum when $(x,y)=\left(\dfrac{5}{2},\dfrac{1}{2}\right)$. |
3,533,757 | So, that's the problem. I tried factoring the quadratic equation to get something like $2x-y$ but it doesn't work. Dividing by $y^2$ won't work because the right side is $9$, not $0$. The last idea I have is to say that $2x-y=t => y=2x-t$ and replace $y$ in the quadratic equation with $2x-t$ to get a function but then,... | 2020/02/04 | [
"https://math.stackexchange.com/questions/3533757",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/502482/"
] | $$2x^2-4xy+6y^2=9$$ and let $$k=2x-y\Rightarrow y=2x-k$$
$2x^2-4x(2x-k)+6(2x-k)^2=9$
$2x^2-8x^2+4xk+6(4x^2+k^2-4xk)=9$
$-6x^2+4xk+24x^2+6k^2-24xk-9=0$
$$18x^2-20kx+6k^2-9=0$$
For real roots, Discriminant $\geq 0$
$$400k^2-4\cdot 18(6k^2-9)\geq 0$$
$$100k^2-108k^2+162\geq 0$$
$$-8k^2+162\geq 0\Rightarrow k^2-\fr... | Let $2x-y=z \implies y=2x-z$, then $$f(x,y)=2x^2-4xy+6y^2-9=0 \implies z)+6(2x-z)=9 \implies 18x^2-20zx+6z^2-9=0 $$ Now for $x$ to be real $B^2\ge 4AC$
Then $$ 648-32 z^2 \ge 0 \implies -9/2 \le z \le 9/2.$$
So the are the maximum and mininumm values of $2x-y$ are $\pm 9/2$
This also means that 2x-y=z will be tangent ... |
3,533,757 | So, that's the problem. I tried factoring the quadratic equation to get something like $2x-y$ but it doesn't work. Dividing by $y^2$ won't work because the right side is $9$, not $0$. The last idea I have is to say that $2x-y=t => y=2x-t$ and replace $y$ in the quadratic equation with $2x-t$ to get a function but then,... | 2020/02/04 | [
"https://math.stackexchange.com/questions/3533757",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/502482/"
] | $$2x^2-4xy+6y^2=9$$ and let $$k=2x-y\Rightarrow y=2x-k$$
$2x^2-4x(2x-k)+6(2x-k)^2=9$
$2x^2-8x^2+4xk+6(4x^2+k^2-4xk)=9$
$-6x^2+4xk+24x^2+6k^2-24xk-9=0$
$$18x^2-20kx+6k^2-9=0$$
For real roots, Discriminant $\geq 0$
$$400k^2-4\cdot 18(6k^2-9)\geq 0$$
$$100k^2-108k^2+162\geq 0$$
$$-8k^2+162\geq 0\Rightarrow k^2-\fr... | By C-S:
$$3=\sqrt{2x^2-4xy+6y^2}=\frac{2}{3}\sqrt{\left(2(x-y)^2+4y^2\right)\left(2+\frac{1}{4}\right)}\geq$$
$$\geq\frac{2}{3}\sqrt{(2(x-y)+y)^2}=\frac{2}{3}|2x-y|,$$ which gives
$$-\frac{9}{2}\leq2x-y\leq\frac{9}{2}.$$
The equality occurs for $$\left(\sqrt2(x-y),y\right)||\left(\sqrt2,\frac{1}{2}\right),$$ which with... |
20,184,852 | I am supposed to create a file (done, it's called "factoriales.txt") and print in it the value of 10! (which is 3628800), the thing is, I can't seem to write the value into a file. I already know how to write text, but this wont work.... here's what I have so far. Please help!
```
import java.io.File;
import j... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20184852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3029988/"
] | the reason any way is that
```
for (int i = 1; i<=10; i--)
```
runs to infinity since 1 cannot be reduced to 10
it should be
```
for (int i = 1; i<=10; i++)
```
and change data type to long as well | Change the for-loop:
From
```
for (int i = 1; i<=10; i--)
```
to
```
for (int i = 1; i<=10; i++)
```
and you will get the right result.
have a try and go ahead. |
20,184,852 | I am supposed to create a file (done, it's called "factoriales.txt") and print in it the value of 10! (which is 3628800), the thing is, I can't seem to write the value into a file. I already know how to write text, but this wont work.... here's what I have so far. Please help!
```
import java.io.File;
import j... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20184852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3029988/"
] | the reason any way is that
```
for (int i = 1; i<=10; i--)
```
runs to infinity since 1 cannot be reduced to 10
it should be
```
for (int i = 1; i<=10; i++)
```
and change data type to long as well | If you want to save a number in text format use PrintWriter, it has methods for writing numbers. |
20,184,852 | I am supposed to create a file (done, it's called "factoriales.txt") and print in it the value of 10! (which is 3628800), the thing is, I can't seem to write the value into a file. I already know how to write text, but this wont work.... here's what I have so far. Please help!
```
import java.io.File;
import j... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20184852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3029988/"
] | the reason any way is that
```
for (int i = 1; i<=10; i--)
```
runs to infinity since 1 cannot be reduced to 10
it should be
```
for (int i = 1; i<=10; i++)
```
and change data type to long as well | ```
public static void main(String[] args)
{
try
{
File fac = new File("c:\\bea\\factoriales.txt");
if (!fac.exists())
{
fac.createNewFile();
}
System.out.println("The file has been created.");
int r = 1;
Fil... |
20,184,852 | I am supposed to create a file (done, it's called "factoriales.txt") and print in it the value of 10! (which is 3628800), the thing is, I can't seem to write the value into a file. I already know how to write text, but this wont work.... here's what I have so far. Please help!
```
import java.io.File;
import j... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20184852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3029988/"
] | Change the for-loop:
From
```
for (int i = 1; i<=10; i--)
```
to
```
for (int i = 1; i<=10; i++)
```
and you will get the right result.
have a try and go ahead. | If you want to save a number in text format use PrintWriter, it has methods for writing numbers. |
20,184,852 | I am supposed to create a file (done, it's called "factoriales.txt") and print in it the value of 10! (which is 3628800), the thing is, I can't seem to write the value into a file. I already know how to write text, but this wont work.... here's what I have so far. Please help!
```
import java.io.File;
import j... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20184852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3029988/"
] | ```
public static void main(String[] args)
{
try
{
File fac = new File("c:\\bea\\factoriales.txt");
if (!fac.exists())
{
fac.createNewFile();
}
System.out.println("The file has been created.");
int r = 1;
Fil... | If you want to save a number in text format use PrintWriter, it has methods for writing numbers. |
16,469,619 | I'm new to WCF. I've created a basic service and engineer tested it with the debugger and WCFTestClient. I've never written my own WCF client. Now I need to build unit tests for the service.
My classes:
```
IXService
CXService
CServiceLauncher
```
(Yes, I know the C prefix does not meet current standards, but it i... | 2013/05/09 | [
"https://Stackoverflow.com/questions/16469619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2091951/"
] | I just needed to build a simple client.
Reference:
<http://webbeyond.blogspot.com/2012/11/wcf-simple-wcf-client-example.html>
1. Add Service Reference to test project
2. Add to test file:
`using System.ServiceModel;`
`using MyTests.ServiceReferenceNamespace;`
Code inside try is now:
```
Assert.AreEqua... | It's not a real answer so please take it easy.
I have been trying to do similar things and what I have learnt that integration testing is difficult. It is difficult because there are many hidden tasks that you need to do, such as:
* Make sure you can run the tests regularly
* Make sure integration tests can run on th... |
12,409,813 | Ideally I want to be able to write something like:
```
function a( b ) {
b.defaultVal( 1 );
return b;
}
```
The intention of this is that if `b` is any defined value, `b` will remain as that value; but if `b` is undefined, then `b` will be set to the value specified in the parameter of `defaultVal()`, in thi... | 2012/09/13 | [
"https://Stackoverflow.com/questions/12409813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037617/"
] | Well the most important thing to learn here is if a variable is `undefined` you, by default, do not have any methods available on it. So you need to use a method that can operate on the variable, but is not a member/method *of* that variable.
Try something like:
```
function defaultValue(myVar, defaultVal){
if(ty... | While the two answers already provided are correct, the language has progressed since then. If your target [browsers support](https://kangax.github.io/compat-table/es6/) it, you can use *default function parameters* like this:
```js
function greetMe(greeting = "Hello", name = "World") {
console.log(greeting + ", " ... |
12,409,813 | Ideally I want to be able to write something like:
```
function a( b ) {
b.defaultVal( 1 );
return b;
}
```
The intention of this is that if `b` is any defined value, `b` will remain as that value; but if `b` is undefined, then `b` will be set to the value specified in the parameter of `defaultVal()`, in thi... | 2012/09/13 | [
"https://Stackoverflow.com/questions/12409813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1037617/"
] | Why not use the default operator:
```
function someF(b)
{
b = b || 1;
return b;
}
```
Job done! Here's [more info](http://javascript.crockford.com/style2.html) about how it works.
Just as a side-note: your prototype won't work, because you're augmenting the `String` prototype, whereas if your variable is un... | While the two answers already provided are correct, the language has progressed since then. If your target [browsers support](https://kangax.github.io/compat-table/es6/) it, you can use *default function parameters* like this:
```js
function greetMe(greeting = "Hello", name = "World") {
console.log(greeting + ", " ... |
302,472 | where i put file of programatically create product
```
<?php
use Magento\Framework\App\Bootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
... | 2020/01/29 | [
"https://magento.stackexchange.com/questions/302472",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/85815/"
] | ***programmatically create product file put in Magento root directory and run***
example in localhost go to ***var/www/html/magentosmpl233/*** and put your file and run
```
example http://127.0.0.1/magesmpl233/createproduct.php
``` | **Method - 1:**
Put your file in a Magento root directory and run your url in browser.
Example: `www.yourdomain.com/your_file_name.php`
*OR*
**Method - 2:**
Create your custom directory on root and keep your custom file in that directory and run url with your custom directory path in browser.
Example: `www.yourdoma... |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | You can install the free 1 month trail version of [Adobe Flash CS4 Professional](https://www.adobe.com/products/flash/), which you can use to edit and create free flash movies. If all you need to do is a one-time editing of the flash (.fla) file, you can get away using just the trial version. | there are no legally free programs that allows full capable editing of Flash source files (.fla). Only Adobe Flash (not Player!) can do it.
I suggest you stop wasting time hoping a free program like this comes along, and start using that time saved to work and buy a copy eventually. |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | Check [projects on osflash](http://www.osflash.org/projects). All of these are free. There are IDEs, command line tools, editors, game servers, etc
...and check [tutorials](http://osflash.org/tutorials). | there are no legally free programs that allows full capable editing of Flash source files (.fla). Only Adobe Flash (not Player!) can do it.
I suggest you stop wasting time hoping a free program like this comes along, and start using that time saved to work and buy a copy eventually. |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | You can download the 30-day trial version of [Adobe Flash Professional](http://www.adobe.com/products/flash/). I don't know of any free alternative that works as well. | there are no legally free programs that allows full capable editing of Flash source files (.fla). Only Adobe Flash (not Player!) can do it.
I suggest you stop wasting time hoping a free program like this comes along, and start using that time saved to work and buy a copy eventually. |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | You can install the free 1 month trail version of [Adobe Flash CS4 Professional](https://www.adobe.com/products/flash/), which you can use to edit and create free flash movies. If all you need to do is a one-time editing of the flash (.fla) file, you can get away using just the trial version. | Check [projects on osflash](http://www.osflash.org/projects). All of these are free. There are IDEs, command line tools, editors, game servers, etc
...and check [tutorials](http://osflash.org/tutorials). |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | You can install the free 1 month trail version of [Adobe Flash CS4 Professional](https://www.adobe.com/products/flash/), which you can use to edit and create free flash movies. If all you need to do is a one-time editing of the flash (.fla) file, you can get away using just the trial version. | You can download the 30-day trial version of [Adobe Flash Professional](http://www.adobe.com/products/flash/). I don't know of any free alternative that works as well. |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | You can install the free 1 month trail version of [Adobe Flash CS4 Professional](https://www.adobe.com/products/flash/), which you can use to edit and create free flash movies. If all you need to do is a one-time editing of the flash (.fla) file, you can get away using just the trial version. | From the command-line, you may try [SWFTools](http://www.swftools.org/) - SWF manipulation and generation utilities
You can install SWFTools distribution (which has also a command line program), and use [SWFExtract](http://www.swftools.org/swfextract.html), that can decompile flash files.
On OSX, install via: `brew i... |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | Check [projects on osflash](http://www.osflash.org/projects). All of these are free. There are IDEs, command line tools, editors, game servers, etc
...and check [tutorials](http://osflash.org/tutorials). | From the command-line, you may try [SWFTools](http://www.swftools.org/) - SWF manipulation and generation utilities
You can install SWFTools distribution (which has also a command line program), and use [SWFExtract](http://www.swftools.org/swfextract.html), that can decompile flash files.
On OSX, install via: `brew i... |
41,786 | I have Flash files that I would like to make edits on but I don't know how or with what.
Is there some software that can edit a Flash (.fla) file?
(Ideally something free.) | 2009/09/15 | [
"https://superuser.com/questions/41786",
"https://superuser.com",
"https://superuser.com/users/10319/"
] | You can download the 30-day trial version of [Adobe Flash Professional](http://www.adobe.com/products/flash/). I don't know of any free alternative that works as well. | From the command-line, you may try [SWFTools](http://www.swftools.org/) - SWF manipulation and generation utilities
You can install SWFTools distribution (which has also a command line program), and use [SWFExtract](http://www.swftools.org/swfextract.html), that can decompile flash files.
On OSX, install via: `brew i... |
27,737,444 | I have a table `#TrackPlayedInformation` upon which I am looping. Sample data of `#TrackPlayedInformation` is as follows:
```
ProfileTrackTimeId JukeBoxTrackId ProfileId EndTime SessionId StartTime
14 52 33 2014-08-16 05:47:19.410 23424234 2... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27737444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3079776/"
] | It is not entirely clear to me what you are trying to accomplish. Nevertheless, loops in SQL should be avoided if possible.
You might consider an `UPDATE` statement similar to:
```
UPDATE TempGraph
SET AirCount = AirCount + 1
WHERE AirTime BETWEEN @StartTime AND @EndTime
```
followed by something that inserts ... | To create sequence between startTime and EndTime you can use pattern with the [nodes()](http://msdn.microsoft.com/en-us/library/ms188282.aspx) method. To perform insert and update operations you can use [MERGE](http://msdn.microsoft.com/en-us/library/bb510625.aspx) statement. The following example show you how to do th... |
27,737,444 | I have a table `#TrackPlayedInformation` upon which I am looping. Sample data of `#TrackPlayedInformation` is as follows:
```
ProfileTrackTimeId JukeBoxTrackId ProfileId EndTime SessionId StartTime
14 52 33 2014-08-16 05:47:19.410 23424234 2... | 2015/01/02 | [
"https://Stackoverflow.com/questions/27737444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3079776/"
] | I don't actually understand what you are trying to do. The following may help you
```
SELECT * INTO #TEMP
FROM
(
SELECT 14 ProfileTrackTimeId,'2014-08-16 05:47:19.410' StartTime, '2014-08-16 05:50:19.410' EndTime
UNION ALL
SELECT 14 ProfileTrackTimeId,'2014-08-16 10:20:19.410' StartTime, '2014-08-16 10:23:19.410' ... | To create sequence between startTime and EndTime you can use pattern with the [nodes()](http://msdn.microsoft.com/en-us/library/ms188282.aspx) method. To perform insert and update operations you can use [MERGE](http://msdn.microsoft.com/en-us/library/bb510625.aspx) statement. The following example show you how to do th... |
1,803,165 | I need to calculate the volume of solid enclosed by the surface $(x^2+y^2+z^2)^2=x$, using only spherical coordinates.
My attempt: by changing coordinates to spherical: $x=r\sin\phi\cos\theta~,~y=r\sin\phi\sin\theta~,~z=r\cos\phi$ we obtain the Jacobian $J=r^2\sin\phi$. When $\phi$ and $\theta$ are fixed, $r$ varies f... | 2016/05/28 | [
"https://math.stackexchange.com/questions/1803165",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342907/"
] | It's a solid of revolution. Let $h=\sqrt{y^{2}+z^{2}}$, then $(x^{2}+h^{2})^{2}=x$.
$\therefore \; h^{2}=\sqrt{x}-x^{2} \:$ where $\, 0\leq x \leq 1$.
\begin{align\*}
V &= \int\_{0}^{1} \pi h^{2} dx \\
&= \pi \int\_{0}^{1} \left( \sqrt{x}-x^{2} \right) dx \\
&= \pi \left[ \frac{2}{3} x^{\frac{3}{2}}-
\frac{1}{3} ... | Byron Schmuland's suggestion is the easiest way to find this volume,
but using spherical coordinates and symmetry to find the volume bounded by
$(x^2+y^2+z^2)^2=z\;\;$
gives $\;\;\displaystyle V=\int\_0^{2\pi}\int\_0^{\frac{\pi}{2}}\int\_0^{\sqrt[3]{\cos\phi}}\rho^2\sin\phi\;d\rho d\phi d\theta=\frac{\pi}{3}$. |
1,803,165 | I need to calculate the volume of solid enclosed by the surface $(x^2+y^2+z^2)^2=x$, using only spherical coordinates.
My attempt: by changing coordinates to spherical: $x=r\sin\phi\cos\theta~,~y=r\sin\phi\sin\theta~,~z=r\cos\phi$ we obtain the Jacobian $J=r^2\sin\phi$. When $\phi$ and $\theta$ are fixed, $r$ varies f... | 2016/05/28 | [
"https://math.stackexchange.com/questions/1803165",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342907/"
] | We may as well consider the surface $(x^2+y^2+z^2)=z$ which is a rotational surface $S$ around the $z$-axis. Put $x^2+y^2=:\rho^2$. Then $S$ is given by the equation
$$(\rho^2+z^2)^2=z\geq0\ .$$ It follows that
$$\rho^2(z)=\sqrt{z}-z^2\qquad(0\leq z\leq1)\ ,$$
so that
$$V=\pi\int\_0^1\rho^2(z)\>dz=\pi\>\left({2\over3}z... | Byron Schmuland's suggestion is the easiest way to find this volume,
but using spherical coordinates and symmetry to find the volume bounded by
$(x^2+y^2+z^2)^2=z\;\;$
gives $\;\;\displaystyle V=\int\_0^{2\pi}\int\_0^{\frac{\pi}{2}}\int\_0^{\sqrt[3]{\cos\phi}}\rho^2\sin\phi\;d\rho d\phi d\theta=\frac{\pi}{3}$. |
1,803,165 | I need to calculate the volume of solid enclosed by the surface $(x^2+y^2+z^2)^2=x$, using only spherical coordinates.
My attempt: by changing coordinates to spherical: $x=r\sin\phi\cos\theta~,~y=r\sin\phi\sin\theta~,~z=r\cos\phi$ we obtain the Jacobian $J=r^2\sin\phi$. When $\phi$ and $\theta$ are fixed, $r$ varies f... | 2016/05/28 | [
"https://math.stackexchange.com/questions/1803165",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342907/"
] | Succinctly, the bounds of integration on $\theta$ should be $-\pi/2\leq\theta\leq\pi/2$, which yields the very believable value of $\pi/3$. The comments seem to indicate some confusion about this, so let's explore it a bit further.
A standard exercise related to spherical coordinates is to show that the graph of
$\rho... | Byron Schmuland's suggestion is the easiest way to find this volume,
but using spherical coordinates and symmetry to find the volume bounded by
$(x^2+y^2+z^2)^2=z\;\;$
gives $\;\;\displaystyle V=\int\_0^{2\pi}\int\_0^{\frac{\pi}{2}}\int\_0^{\sqrt[3]{\cos\phi}}\rho^2\sin\phi\;d\rho d\phi d\theta=\frac{\pi}{3}$. |
1,803,165 | I need to calculate the volume of solid enclosed by the surface $(x^2+y^2+z^2)^2=x$, using only spherical coordinates.
My attempt: by changing coordinates to spherical: $x=r\sin\phi\cos\theta~,~y=r\sin\phi\sin\theta~,~z=r\cos\phi$ we obtain the Jacobian $J=r^2\sin\phi$. When $\phi$ and $\theta$ are fixed, $r$ varies f... | 2016/05/28 | [
"https://math.stackexchange.com/questions/1803165",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342907/"
] | Succinctly, the bounds of integration on $\theta$ should be $-\pi/2\leq\theta\leq\pi/2$, which yields the very believable value of $\pi/3$. The comments seem to indicate some confusion about this, so let's explore it a bit further.
A standard exercise related to spherical coordinates is to show that the graph of
$\rho... | It's a solid of revolution. Let $h=\sqrt{y^{2}+z^{2}}$, then $(x^{2}+h^{2})^{2}=x$.
$\therefore \; h^{2}=\sqrt{x}-x^{2} \:$ where $\, 0\leq x \leq 1$.
\begin{align\*}
V &= \int\_{0}^{1} \pi h^{2} dx \\
&= \pi \int\_{0}^{1} \left( \sqrt{x}-x^{2} \right) dx \\
&= \pi \left[ \frac{2}{3} x^{\frac{3}{2}}-
\frac{1}{3} ... |
1,803,165 | I need to calculate the volume of solid enclosed by the surface $(x^2+y^2+z^2)^2=x$, using only spherical coordinates.
My attempt: by changing coordinates to spherical: $x=r\sin\phi\cos\theta~,~y=r\sin\phi\sin\theta~,~z=r\cos\phi$ we obtain the Jacobian $J=r^2\sin\phi$. When $\phi$ and $\theta$ are fixed, $r$ varies f... | 2016/05/28 | [
"https://math.stackexchange.com/questions/1803165",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/342907/"
] | Succinctly, the bounds of integration on $\theta$ should be $-\pi/2\leq\theta\leq\pi/2$, which yields the very believable value of $\pi/3$. The comments seem to indicate some confusion about this, so let's explore it a bit further.
A standard exercise related to spherical coordinates is to show that the graph of
$\rho... | We may as well consider the surface $(x^2+y^2+z^2)=z$ which is a rotational surface $S$ around the $z$-axis. Put $x^2+y^2=:\rho^2$. Then $S$ is given by the equation
$$(\rho^2+z^2)^2=z\geq0\ .$$ It follows that
$$\rho^2(z)=\sqrt{z}-z^2\qquad(0\leq z\leq1)\ ,$$
so that
$$V=\pi\int\_0^1\rho^2(z)\>dz=\pi\>\left({2\over3}z... |
499,345 | **UPDATE 20th May:**
Swapped the analog output regulator for an AZ1117-EH based on Peter Smith's suggestion, removed C1306, so now the 3.3VA output should be ok at least based on the [datasheet](https://www.diodes.com/assets/Datasheets/AZ1117E.pdf). However, no significant improvement. See scope shots and discussion u... | 2020/05/13 | [
"https://electronics.stackexchange.com/questions/499345",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/54822/"
] | The problem could well be at the 3.3V regulators:
[](https://i.stack.imgur.com/SC53A.png)
I have circled the output capacitors; the LM1117 [datasheet](https://www.ti.com/lit/ds/symlink/lm1117.pdf?&ts=1589794564554) states:
**8.2.2.1.3 Output Capacitor**
>
> Th... | >
> *There's a 10nF hold capacitor after the multiplexer*
>
>
>
Another possible source might be made worse by a slow refresh time. For instance, the input bias current for the TL074 could be around 1 nA and using the capacitor equation below: -
$$I = C\frac{dv}{dt}$$
We find that the rate of change of voltage o... |
499,345 | **UPDATE 20th May:**
Swapped the analog output regulator for an AZ1117-EH based on Peter Smith's suggestion, removed C1306, so now the 3.3VA output should be ok at least based on the [datasheet](https://www.diodes.com/assets/Datasheets/AZ1117E.pdf). However, no significant improvement. See scope shots and discussion u... | 2020/05/13 | [
"https://electronics.stackexchange.com/questions/499345",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/54822/"
] | The problem could well be at the 3.3V regulators:
[](https://i.stack.imgur.com/SC53A.png)
I have circled the output capacitors; the LM1117 [datasheet](https://www.ti.com/lit/ds/symlink/lm1117.pdf?&ts=1589794564554) states:
**8.2.2.1.3 Output Capacitor**
>
> Th... | I suggest you look into charge injection. The edges of the hold signal are capacitively coupled to the output, resulting in a step change in the output when feeding a cap.
The quick test is to change the value of the buffer cap, and see what happens to your step size. If it's charge injection, a smaller cap will give ... |
3,814,277 | I'm working on a PHP project that has a lot of hard coded paths in it. I'm not the main developer, just working on a small part of the project.
I'd like to be able to test my changes locally before committing them, but my directory structure is completely different. For example, there's a lot of this in the code:
```... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3814277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222374/"
] | Always use `$_SERVER['DOCUMENT_ROOT']` instead of hardcoded path.
```
require_once($_SERVER['DOCUMENT_ROOT']."/include.php")
```
as for your wamb environment, you will need a dedicated drive to simulate file structure. You can use NTFS tools or simple `subst` command to map some directory to a drive.
Create `/hom... | **WARNING: ONLY USE THIS SOLUTION FOR EMERGENCY REPAIRS, NEVER FOR LONGER PRODUCTION CODE**
Define a class with rewriting methods, see <http://php.net/manual/en/class.streamwrapper.php>
```
<?php
class YourEmergencyWrapper {
static $from = '/home/clientx/htdocs/';
static $to = 'c:/shared/clients/client';
... |
3,814,277 | I'm working on a PHP project that has a lot of hard coded paths in it. I'm not the main developer, just working on a small part of the project.
I'd like to be able to test my changes locally before committing them, but my directory structure is completely different. For example, there's a lot of this in the code:
```... | 2010/09/28 | [
"https://Stackoverflow.com/questions/3814277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222374/"
] | If its a local copy, do a search and replace on the whole directory , Please don't forget trailing slash. And when you commit the code, do reverse.
This is the solution, if you don't want to add extra variables and stuff (because that would change other developers' code/work/dependencies (if any)
search "/home/clien... | **WARNING: ONLY USE THIS SOLUTION FOR EMERGENCY REPAIRS, NEVER FOR LONGER PRODUCTION CODE**
Define a class with rewriting methods, see <http://php.net/manual/en/class.streamwrapper.php>
```
<?php
class YourEmergencyWrapper {
static $from = '/home/clientx/htdocs/';
static $to = 'c:/shared/clients/client';
... |
63,313,509 | For my work, we are trying to spin up a docker swarm cluster with Puppet. We use puppetlabs-docker for this, which has a module `docker::swarm`. This module allows you to instantiate a docker swarm manager on your master node. This works so far.
On the docker workers you can join to docker swarm manager with exported ... | 2020/08/08 | [
"https://Stackoverflow.com/questions/63313509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3419197/"
] | >
> My question is: is there a way (without breaking Puppet philosophy on
> idempotent and convergence) to get the output from the join-token Exec
> and pass this along to the exported resource, so that my workers can
> join master?
>
>
>
No, because the properties of resource declarations, exported or otherwise, ... | Thanks to @John Bollinger I seem to have fixed my issue. In the end, it was a bit more worked than I envisioned, but this is the idea:
1. My puppet setup now uses PuppetDB for storing facts and sharing exported resources.
2. I have added an additional custom fact to the code base of Docker (in `./lib/facter/docker.rb`... |
40,161,673 | The problem I am trying to solve.
I want to use jQuery to dynamically add content to a div depending on which class is being used. I am not sure why the alerts aren't working. It could be my html or the jquery itself. I want to solve this so that I can have different text appear depending on which class shows up.
Her... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40161673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3174713/"
] | Your usage of `$(this)` won't work because you haven't made a selection. In JQuery `this` is always bound to the context the previous selector or method, it's a JQuery object containing the results of the selection or filter. Additionally, your selector for finding the child element to insert HTML into is too broad.
`... | You don't need the conditional at all. You should just do the following:
```
$(document).ready(function() {
$(".size3").nextAll(".p-accessible-alt").html("Your HTML here");
$(".size4").nextAll(".p-accessible-alt").html("Your HTML here");
$(".size5").nextAll(".p-accessible-alt").html("Your HTML here");
});
... |
40,161,673 | The problem I am trying to solve.
I want to use jQuery to dynamically add content to a div depending on which class is being used. I am not sure why the alerts aren't working. It could be my html or the jquery itself. I want to solve this so that I can have different text appear depending on which class shows up.
Her... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40161673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3174713/"
] | Your usage of `$(this)` won't work because you haven't made a selection. In JQuery `this` is always bound to the context the previous selector or method, it's a JQuery object containing the results of the selection or filter. Additionally, your selector for finding the child element to insert HTML into is too broad.
`... | here is little more generic solution with some suggestions:
* Use classes only for CSS or JavaScript and [prefix your JavaScript-classes with "js-"](http://csswizardry.com/2015/03/more-transparent-ui-code-with-namespaces/)
* I would choose a generic approach. So you can add or delete items without changing your JavaSc... |
40,161,673 | The problem I am trying to solve.
I want to use jQuery to dynamically add content to a div depending on which class is being used. I am not sure why the alerts aren't working. It could be my html or the jquery itself. I want to solve this so that I can have different text appear depending on which class shows up.
Her... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40161673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3174713/"
] | Your usage of `$(this)` won't work because you haven't made a selection. In JQuery `this` is always bound to the context the previous selector or method, it's a JQuery object containing the results of the selection or filter. Additionally, your selector for finding the child element to insert HTML into is too broad.
`... | The code works once you take out (this) and reference the selector .po because ,as other's have stated, (this) is actually referencing the document.
```
<td>
<div class="po size3"></div>
<a class="external">Find your doctor</a>
<div class="p-acce... |
40,161,673 | The problem I am trying to solve.
I want to use jQuery to dynamically add content to a div depending on which class is being used. I am not sure why the alerts aren't working. It could be my html or the jquery itself. I want to solve this so that I can have different text appear depending on which class shows up.
Her... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40161673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3174713/"
] | You don't need the conditional at all. You should just do the following:
```
$(document).ready(function() {
$(".size3").nextAll(".p-accessible-alt").html("Your HTML here");
$(".size4").nextAll(".p-accessible-alt").html("Your HTML here");
$(".size5").nextAll(".p-accessible-alt").html("Your HTML here");
});
... | here is little more generic solution with some suggestions:
* Use classes only for CSS or JavaScript and [prefix your JavaScript-classes with "js-"](http://csswizardry.com/2015/03/more-transparent-ui-code-with-namespaces/)
* I would choose a generic approach. So you can add or delete items without changing your JavaSc... |
40,161,673 | The problem I am trying to solve.
I want to use jQuery to dynamically add content to a div depending on which class is being used. I am not sure why the alerts aren't working. It could be my html or the jquery itself. I want to solve this so that I can have different text appear depending on which class shows up.
Her... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40161673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3174713/"
] | You don't need the conditional at all. You should just do the following:
```
$(document).ready(function() {
$(".size3").nextAll(".p-accessible-alt").html("Your HTML here");
$(".size4").nextAll(".p-accessible-alt").html("Your HTML here");
$(".size5").nextAll(".p-accessible-alt").html("Your HTML here");
});
... | The code works once you take out (this) and reference the selector .po because ,as other's have stated, (this) is actually referencing the document.
```
<td>
<div class="po size3"></div>
<a class="external">Find your doctor</a>
<div class="p-acce... |
40,161,673 | The problem I am trying to solve.
I want to use jQuery to dynamically add content to a div depending on which class is being used. I am not sure why the alerts aren't working. It could be my html or the jquery itself. I want to solve this so that I can have different text appear depending on which class shows up.
Her... | 2016/10/20 | [
"https://Stackoverflow.com/questions/40161673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3174713/"
] | The code works once you take out (this) and reference the selector .po because ,as other's have stated, (this) is actually referencing the document.
```
<td>
<div class="po size3"></div>
<a class="external">Find your doctor</a>
<div class="p-acce... | here is little more generic solution with some suggestions:
* Use classes only for CSS or JavaScript and [prefix your JavaScript-classes with "js-"](http://csswizardry.com/2015/03/more-transparent-ui-code-with-namespaces/)
* I would choose a generic approach. So you can add or delete items without changing your JavaSc... |
1,723,227 | I have a table of a couple of million records. During production, we find that there is a particular type of query that is taking a few seconds to complete.
When I try to reproduce the issue on my machine which has replicated production data, I ran the exact query (as obtained from the slow query log) in the mysql cli... | 2009/11/12 | [
"https://Stackoverflow.com/questions/1723227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209731/"
] | You can tell the server not to place the result in the query cache by including [SQL\_NO\_CACHE](http://dev.mysql.com/doc/refman/5.1/en/query-cache-in-select.html) in the query:
```
SELECT SQL_NO_CACHE id, name FROM customer;
```
Aside from the query cache though, there's a lot more going on inside MySQL to speed th... | Once the table is loaded into memory, the query should take drastically less time. If the production box takes a long time to run the query every time, I'd start looking at memory usage. If you find that your production box is swapping a lot, I'd look at upgrading its RAM. |
1,723,227 | I have a table of a couple of million records. During production, we find that there is a particular type of query that is taking a few seconds to complete.
When I try to reproduce the issue on my machine which has replicated production data, I ran the exact query (as obtained from the slow query log) in the mysql cli... | 2009/11/12 | [
"https://Stackoverflow.com/questions/1723227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209731/"
] | You can tell the server not to place the result in the query cache by including [SQL\_NO\_CACHE](http://dev.mysql.com/doc/refman/5.1/en/query-cache-in-select.html) in the query:
```
SELECT SQL_NO_CACHE id, name FROM customer;
```
Aside from the query cache though, there's a lot more going on inside MySQL to speed th... | The have\_query\_cache server system variable indicates whether the query cache is available:
```
mysql> SHOW VARIABLES LIKE 'have_query_cache';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| have_query_cache | YES |
+------------------+-------+
```
When using a standard M... |
1,723,227 | I have a table of a couple of million records. During production, we find that there is a particular type of query that is taking a few seconds to complete.
When I try to reproduce the issue on my machine which has replicated production data, I ran the exact query (as obtained from the slow query log) in the mysql cli... | 2009/11/12 | [
"https://Stackoverflow.com/questions/1723227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/209731/"
] | You can tell the server not to place the result in the query cache by including [SQL\_NO\_CACHE](http://dev.mysql.com/doc/refman/5.1/en/query-cache-in-select.html) in the query:
```
SELECT SQL_NO_CACHE id, name FROM customer;
```
Aside from the query cache though, there's a lot more going on inside MySQL to speed th... | If you're unable to turn it off you could invalidate the query by issuing a simple set of update statements swapping around a peice of data that'd have been selected by the query.
So if you did.
```
update table set column = tmpval where id = 100;
update table set column = originalval where id = 100;
```
Then when ... |
36,196,409 | I am getting values in a format like this 00-C6 (Hex). It complains when I try to convert it to double (format execption). What to do?
```
public void check()
{
double low;
double high;
percentageCalculator(4095, 5, out low, out high);
Dictionary[] A_1 = {Max_1, Min_1};
... | 2016/03/24 | [
"https://Stackoverflow.com/questions/36196409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6013907/"
] | Assuming the `Hex` `00-C6` `string` represents `Integer` value (because if it represents `floating-point` value like `float` or `double`, it must consists of `4-byte` or `8-byte`), then one way to process it is to split the `Hex string`:
```
string hexString = "00-C6";
string[] hexes = hexString.Split('-');
```
Then... | Take a look at this piece of code:
```
string hexnumber = "00-c6";
double doubleValue = (double)Convert.ToInt32(hexnumber.Replace("-", ""), 16);
``` |
60,536,035 | I am facing an issue with shopping cart. Unable to increase quantity of existing item in cart or add another item. On button click the addToCart function executes which takes a product.
```
const [cartItems, setCartItems] = useState([])
const addToCart = product => {
console.log(product) // here I am getting the ... | 2020/03/04 | [
"https://Stackoverflow.com/questions/60536035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13008960/"
] | Your else logic is wrong. You want to update your item quantity from carItems, before you spread it.
Change:
```
const updateCart = [...cartItems];
updateCart[index].quantity += 1;
setCartItems(updateCart);
```
to
```
cartItems[index].quantity += 1;
const updateCart = [...cartItems];
setCartItem... | Your code should work, is quite good
====================================
* probably testing method failed
* problems were related to different parts of code
```js
let cartItems = [
{
_id: "1",
name: "shoe",
quantity: 1
}
];
console.log("START", JSON.stringify(cartItems), Array.isArray(cartItems));
cons... |
47,771,494 | My Android app `webview` works fine with chrome version 61 or 62, but when I update to version 63. My `webview`does not store the history and `webView.canGoBack()` always returns `false`. But previous versions of chrome work fine. How to solve? | 2017/12/12 | [
"https://Stackoverflow.com/questions/47771494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5702991/"
] | This issue should be chromium's bug. We find out the same issue in our apps. the reason of this issue is we invoke Webview's loadUrl methond in shouldOverrideUrlLoading method, when we do that , webview can't go back in some version of chromium. The code below is my workaround:
```
public class WebViewBugFixDemo exten... | Even I was facing this issue. For now You can use intent in ouldOverrideUrlLoading(WebView view, String url){} function and super.onbackpressed() will do its job to maintain history.
```
public boolean shouldOverrideUrlLoading(WebView view, String url) {
Intent intent = new Intent(MainActivity.this, MainAc... |
69,725,727 | Below comparison is giving false result in PowerShell , Want it to be true. ` operator is causing it to be false whereas for any other special character it is returning true.
```
> 'abc`@01' -like 'abc`@01'
False
``` | 2021/10/26 | [
"https://Stackoverflow.com/questions/69725727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17251840/"
] | `-like` is a wildcard comparison operator and ``` is a wildcard escape sequence.
```
PS ~> 'abc`@01' -like 'abc``@01'
True
```
Use `-eq` if you want an exact string comparison without having to worry about escaping the reference string:
```
PS ~> 'abc`@01' -eq 'abc`@01'
True
``` | To *add to* [Mathias R. Jessen's helpful answer](https://stackoverflow.com/a/69725831/45375):
On occasion you may be dealing with strings that should become *part* of a [wildcard expression](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Wildcards), but *themselves* should be... |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | First, look into a UPS (un-interuptable power supply)
Second, look into creating persistent transactions, transactions that will save early and often, but not commit until you tell it to. This goes a little beyond the typical transactions in TSQL. | If it's a hard power-cut (like the battery removed on a laptop while unplugged), then there's not much you can do other than write to disk every. step. of. the. way. (Talk about a performance hit.) And also make sure that you have something recorded to let the application know when it starts back up what it was in the ... |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | First, look into a UPS (un-interuptable power supply)
Second, look into creating persistent transactions, transactions that will save early and often, but not commit until you tell it to. This goes a little beyond the typical transactions in TSQL. | PowerFailureException class will solve this. Actually just maintain power with a UPS. The only other option really is to maintain atomicity for database transactions. |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | You can append the current information being received to the file system. It will be a performance hit, but will allow you to get back to the last item being captured.
When the application starts detect if there is a pending file, and provide the option to recover. Load the data saved in the file appropriately.
Once... | You might want to consider having your application use [SQLite](http://www.sqlite.org).
They have some great info on their [when to use page](http://www.sqlite.org/whentouse.html).
Some points that stand out are:
>
> * Updates happen atomically as application content is revised
> * Content is updated continuously a... |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | If it's a hard power-cut (like the battery removed on a laptop while unplugged), then there's not much you can do other than write to disk every. step. of. the. way. (Talk about a performance hit.) And also make sure that you have something recorded to let the application know when it starts back up what it was in the ... | You might want to consider having your application use [SQLite](http://www.sqlite.org).
They have some great info on their [when to use page](http://www.sqlite.org/whentouse.html).
Some points that stand out are:
>
> * Updates happen atomically as application content is revised
> * Content is updated continuously a... |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | If it's a hard power-cut (like the battery removed on a laptop while unplugged), then there's not much you can do other than write to disk every. step. of. the. way. (Talk about a performance hit.) And also make sure that you have something recorded to let the application know when it starts back up what it was in the ... | PowerFailureException class will solve this. Actually just maintain power with a UPS. The only other option really is to maintain atomicity for database transactions. |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | If it's a hard power-cut (like the battery removed on a laptop while unplugged), then there's not much you can do other than write to disk every. step. of. the. way. (Talk about a performance hit.) And also make sure that you have something recorded to let the application know when it starts back up what it was in the ... | What you really want are atomic on disk transactions. There are many ways to perform these, but often times if you are using an existing database product it will be done for you.
If you rolled your own database or file formats, you have some work cut our for you depending on your file format. |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | You can append the current information being received to the file system. It will be a performance hit, but will allow you to get back to the last item being captured.
When the application starts detect if there is a pending file, and provide the option to recover. Load the data saved in the file appropriately.
Once... | What you really want are atomic on disk transactions. There are many ways to perform these, but often times if you are using an existing database product it will be done for you.
If you rolled your own database or file formats, you have some work cut our for you depending on your file format. |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | First, look into a UPS (un-interuptable power supply)
Second, look into creating persistent transactions, transactions that will save early and often, but not commit until you tell it to. This goes a little beyond the typical transactions in TSQL. | You can append the current information being received to the file system. It will be a performance hit, but will allow you to get back to the last item being captured.
When the application starts detect if there is a pending file, and provide the option to recover. Load the data saved in the file appropriately.
Once... |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | You can append the current information being received to the file system. It will be a performance hit, but will allow you to get back to the last item being captured.
When the application starts detect if there is a pending file, and provide the option to recover. Load the data saved in the file appropriately.
Once... | PowerFailureException class will solve this. Actually just maintain power with a UPS. The only other option really is to maintain atomicity for database transactions. |
736,712 | We are developing an RetailPOS .net (windows) application.
One of the customer asks 'What will happen to current data being processed in the application when a power went off suddenly?', 'Will the application able to recover the unsaved data?'
I am wondering, how this feature can be included in the .net application?... | 2009/04/10 | [
"https://Stackoverflow.com/questions/736712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53262/"
] | First, look into a UPS (un-interuptable power supply)
Second, look into creating persistent transactions, transactions that will save early and often, but not commit until you tell it to. This goes a little beyond the typical transactions in TSQL. | What you really want are atomic on disk transactions. There are many ways to perform these, but often times if you are using an existing database product it will be done for you.
If you rolled your own database or file formats, you have some work cut our for you depending on your file format. |
42,207,975 | this type of question has been asked many times. So apologies; I have searched hard to get an answer - but have not found anything that is close enough to my needs (and I am not sufficiently advanced **(I am a total newbie)** to customize an existing answer). So thanks in advance for any help.
Here's my query:
* ... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42207975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7557229/"
] | It seems the most easy way to achieve want you want would make use of dictionaries.
```
import csv
import os
# Assuming all your csv are in a single directory we will iterate on the
# files in this directory, selecting only those ending with .csv
# to list files in the directory we will use the walk function in the ... | Check out the pandas package. You can read an write csv files quite easily with it.
<http://pandas.pydata.org/pandas-docs/stable/10min.html#csv>
Then, when having the csv-content as a dataframe you convert it with the `as_matrix` function.
Use the answers to this question to get the duplicates as a list.
[Find an... |
42,207,975 | this type of question has been asked many times. So apologies; I have searched hard to get an answer - but have not found anything that is close enough to my needs (and I am not sufficiently advanced **(I am a total newbie)** to customize an existing answer). So thanks in advance for any help.
Here's my query:
* ... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42207975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7557229/"
] | That's rather easy to achieve. It would look something like:
```
import os
# Set to what kind of separator you have. '\t' for TAB
delimiter = ','
# Dictionary to keep count of ids
ids = {}
# Iterate over files in a dir
for in_file in os.listdir(os.curdir):
# Check whether it is csv file (dummy way but it shall ... | Check out the pandas package. You can read an write csv files quite easily with it.
<http://pandas.pydata.org/pandas-docs/stable/10min.html#csv>
Then, when having the csv-content as a dataframe you convert it with the `as_matrix` function.
Use the answers to this question to get the duplicates as a list.
[Find an... |
42,207,975 | this type of question has been asked many times. So apologies; I have searched hard to get an answer - but have not found anything that is close enough to my needs (and I am not sufficiently advanced **(I am a total newbie)** to customize an existing answer). So thanks in advance for any help.
Here's my query:
* ... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42207975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7557229/"
] | It seems the most easy way to achieve want you want would make use of dictionaries.
```
import csv
import os
# Assuming all your csv are in a single directory we will iterate on the
# files in this directory, selecting only those ending with .csv
# to list files in the directory we will use the walk function in the ... | That's rather easy to achieve. It would look something like:
```
import os
# Set to what kind of separator you have. '\t' for TAB
delimiter = ','
# Dictionary to keep count of ids
ids = {}
# Iterate over files in a dir
for in_file in os.listdir(os.curdir):
# Check whether it is csv file (dummy way but it shall ... |
42,207,975 | this type of question has been asked many times. So apologies; I have searched hard to get an answer - but have not found anything that is close enough to my needs (and I am not sufficiently advanced **(I am a total newbie)** to customize an existing answer). So thanks in advance for any help.
Here's my query:
* ... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42207975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7557229/"
] | It seems the most easy way to achieve want you want would make use of dictionaries.
```
import csv
import os
# Assuming all your csv are in a single directory we will iterate on the
# files in this directory, selecting only those ending with .csv
# to list files in the directory we will use the walk function in the ... | As you are a newbie, Ill try to give some directions instead of posting an answer. Mainly because this is not a "code this for me" platform.
Python has a library called [csv](https://docs.python.org/2/library/csv.html), that allows to read data from CSV files (Boom!, surprised?). This library allows you to read the fi... |
42,207,975 | this type of question has been asked many times. So apologies; I have searched hard to get an answer - but have not found anything that is close enough to my needs (and I am not sufficiently advanced **(I am a total newbie)** to customize an existing answer). So thanks in advance for any help.
Here's my query:
* ... | 2017/02/13 | [
"https://Stackoverflow.com/questions/42207975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7557229/"
] | That's rather easy to achieve. It would look something like:
```
import os
# Set to what kind of separator you have. '\t' for TAB
delimiter = ','
# Dictionary to keep count of ids
ids = {}
# Iterate over files in a dir
for in_file in os.listdir(os.curdir):
# Check whether it is csv file (dummy way but it shall ... | As you are a newbie, Ill try to give some directions instead of posting an answer. Mainly because this is not a "code this for me" platform.
Python has a library called [csv](https://docs.python.org/2/library/csv.html), that allows to read data from CSV files (Boom!, surprised?). This library allows you to read the fi... |
43,538,049 | Why does block with text shift to the bottom? I know how to fix this issue (need to add "overflow: hidden" to the box), but I don't understand why it shift to the bottom, text inside the box is short, margins in browser-inspector are same as margins of example without text.
[Example of the problem](https://codepen.io/... | 2017/04/21 | [
"https://Stackoverflow.com/questions/43538049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6151870/"
] | The problem is that by default vertical alignment of **inline elements** – **baseline**,
The text inside element affects it and pushes div to the bottom.
Use `vertical-align: top` to solve issue. | You can try to add vertical-align:
```
.box1 {
display: inline-block;
margin: 5px;
width: 50px;
height: 50px;
background: blue;
/* overflow: hidden; */
color: white;
vertical-align:top;
}
``` |
6,944 | Occasionally, I see a question for which I don't know enough to write a good answer, but I happen to know something that I think would be useful for someone asking that question to know.
* **[Example 1](https://rpg.stackexchange.com/questions/94633/how-to-create-a-custom-lycanthrope-in-heroforge-anew#comment218859_946... | 2017/04/13 | [
"https://rpg.meta.stackexchange.com/questions/6944",
"https://rpg.meta.stackexchange.com",
"https://rpg.meta.stackexchange.com/users/30299/"
] | No, these aren't acceptable. These are partial answers in comments.
A "lead", an "idea", and something that starts with "not an answer but..." are all answers in comments.
Your options are:
1. Take the time to find out and write an answer.
2. Hit them up in chat.
3. Let it lie.
Usually #3 is the best, because usua... | You do *technically* have a fourth option. If you actually have a good, substantial partial-answer but can't finish it off for whatever reason, consider posting it as a community wiki answer in its incomplete form. Community wiki answers should be rare, because we can generally answer a question without needing multipl... |
41,493,243 | I'm trying to remove a layout with the click of a button.
I have this method in my MainActivity.java file:
```
public void goBack(View view) {
TableLayout parent = (TableLayout) findViewById(R.id.activity_main);
RelativeLayout child = (RelativeLayout) findViewById(R.id.activity_displayMessage);
parent.rem... | 2017/01/05 | [
"https://Stackoverflow.com/questions/41493243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/880874/"
] | You can do this by rebinding `sys.stdout`:
```
>>> def foo():
... print('potato')
...
>>> import sys, io
>>> sys.stdout = io.StringIO()
>>> foo()
>>> val = sys.stdout.getvalue()
>>> sys.stdout = sys.__stdout__ # restores original stdout
>>> print(val)
potato
```
For a nicer way to do it, consider writing a con... | The sensible solution is simple and obvious: fix the function so that it returns the correct data instead of printing it. Else you *can* use the hack posted by wim but assuming you have the hand on the faulty function resorting to such a convoluted solution falls into the "WTF" category.
NB of course if you don't hav... |
3,910,625 | I just wanted to know which language has better memory management among C,C++ and Java,why is it so and it is based on what criteria?
I know that Java uses garbage collection for freeing memory and C uses DMA functions.Does this make java better at memory management since it's handled automatically? I do not know C++... | 2010/10/11 | [
"https://Stackoverflow.com/questions/3910625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472777/"
] | Thats a apples to oranges question in my book. C/c++ don't have memory management at least not in the language thats your job. That being said java will allocate and destroy memory for you all the live long day but at the cost of control. For the standard business app this is not at issue. You are going to load some bl... | As for internal memory management, Java has the best of the three, since it automates disposing of objects.
If your question aims at performance, C or C++ would be a better bet. You would have to do all of the memory management yourself, but at the same time wouldn't have to wait for a Garbage Collector to do it's job... |
3,910,625 | I just wanted to know which language has better memory management among C,C++ and Java,why is it so and it is based on what criteria?
I know that Java uses garbage collection for freeing memory and C uses DMA functions.Does this make java better at memory management since it's handled automatically? I do not know C++... | 2010/10/11 | [
"https://Stackoverflow.com/questions/3910625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/472777/"
] | Java has memory management. C and C++ don't, so it's memory management is a function of the programmer. | Programmer managed memory in c and c++ is the root cause of many software bugs in programs written in those languages. This is one of the main reasons modern languages like Java and C# have garbage collection. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.