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
32,785,066
I'm trying to read some French character from the file but some symbols comes if letter contains à é è. Can anyone guide me how to get actual character of the file. Here is my main method ``` public static void main(String args[]) throws IOException { char current,org; //String strPath = "C:/Documents a...
2015/09/25
[ "https://Stackoverflow.com/questions/32785066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4485283/" ]
You can download one jar file for Apache Commons IO and try to implement it by reading each line rather than reading char by char. ``` List<String> lines = IOUtils.readLines(fis, "UTF8"); for (String line: lines) { dbhelper.addDataRecord(line + ",'" + strCompCode + "'"); } ```
The following assumes the text is in Windows Latin-1, but I have added alternatively UTF-8. ``` private static final String FILE_PATH = "c:\\temp\\test.txt"; Path path = Paths.get(FILE_PATH); //Charset charset = StandardCharset.ISO_8859_1; //Charset charset = StandardCharset.UTF_8; Charset charset = Charset.forName("...
32,785,066
I'm trying to read some French character from the file but some symbols comes if letter contains à é è. Can anyone guide me how to get actual character of the file. Here is my main method ``` public static void main(String args[]) throws IOException { char current,org; //String strPath = "C:/Documents a...
2015/09/25
[ "https://Stackoverflow.com/questions/32785066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4485283/" ]
You can download one jar file for Apache Commons IO and try to implement it by reading each line rather than reading char by char. ``` List<String> lines = IOUtils.readLines(fis, "UTF8"); for (String line: lines) { dbhelper.addDataRecord(line + ",'" + strCompCode + "'"); } ```
the specific encoding for french give by IBM is CP1252 (preferred because run on all operating system). Regards, A frenchy guy
14,639,130
My JSON data is like ``` { "Brand":["EM-03","TORRES"], "Price":["5.00000","10.00000","15.00000"], "Country":["US","SG"] } ``` I want to loop that JSON data to get ``` Brand = EM-03 - TORRES Price = 5.00000 - 10.00000 - 15.00000 Country = US - SG ```
2013/02/01
[ "https://Stackoverflow.com/questions/14639130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1474420/" ]
With [`$.each`](http://api.jquery.com/jQuery.each/) ``` $.each(data, function(key, value){ console.log(value); }); ```
Try this ``` $.each(data, function(key, value){ console.log(value.join('-')); }); ```
358,755
**I'm pretty sure this happens to someone out there now and then:** You've read a question, done the work with writing a pretty decent answer, at least you think you have, then you find some detail in the question, either edited in at a later time or maybe not clearly defined in the title or pointed out in the context...
2020/12/26
[ "https://meta.stackexchange.com/questions/358755", "https://meta.stackexchange.com", "https://meta.stackexchange.com/users/201397/" ]
It can respond to another answer, but you still need to give at least a partial answer to the question. Thus, answering like this is okay: > > My experience about @X's answer (link) is negative, although I used a newer version of (...). Instead, what I did is (explanation), and now it works. > > > [(example)](ht...
There has recently been a discussion on Stack Overflow: [Is an answer that only addresses other answers not an answer?](https://meta.stackoverflow.com/q/403026/13552470) The consensus of [the most upvoted answer](https://meta.stackoverflow.com/a/403027/13552470) is: > > "Not an Answer" is the wrong flag in any case....
40,059
I would like to say in German, > > I would love to talk sometime. > > > So far I have this, > > Ich würde gerne mal reden. > > > Is *reden* the right verb here? How would you say it?
2017/11/05
[ "https://german.stackexchange.com/questions/40059", "https://german.stackexchange.com", "https://german.stackexchange.com/users/21516/" ]
Your translation works. Another possibility would be > > Ich würde mich gerne mal mit dir unterhalten > > > Which is a way to ask for a conversation some time in the future. The “dir“ is used when talking to a friend or close co-worker while it can be exchanged with “Ihnen“ to suit a more formal setting.
Although the given answer is correct, I would like to distinguish cases more: > > Ich würde gerne mal reden. > > > This sounds like you would like to talk, no matter with who, when, or what. You could be very shy and desire to step up and talk sometimes. > > Ich würde gerne (mal) mit dir reden. > > > This a...
40,059
I would like to say in German, > > I would love to talk sometime. > > > So far I have this, > > Ich würde gerne mal reden. > > > Is *reden* the right verb here? How would you say it?
2017/11/05
[ "https://german.stackexchange.com/questions/40059", "https://german.stackexchange.com", "https://german.stackexchange.com/users/21516/" ]
Your translation works. Another possibility would be > > Ich würde mich gerne mal mit dir unterhalten > > > Which is a way to ask for a conversation some time in the future. The “dir“ is used when talking to a friend or close co-worker while it can be exchanged with “Ihnen“ to suit a more formal setting.
Irgendwann würde ich (sehr) gerne mal mit Dir reden.
40,059
I would like to say in German, > > I would love to talk sometime. > > > So far I have this, > > Ich würde gerne mal reden. > > > Is *reden* the right verb here? How would you say it?
2017/11/05
[ "https://german.stackexchange.com/questions/40059", "https://german.stackexchange.com", "https://german.stackexchange.com/users/21516/" ]
Although the given answer is correct, I would like to distinguish cases more: > > Ich würde gerne mal reden. > > > This sounds like you would like to talk, no matter with who, when, or what. You could be very shy and desire to step up and talk sometimes. > > Ich würde gerne (mal) mit dir reden. > > > This a...
Irgendwann würde ich (sehr) gerne mal mit Dir reden.
25,406,330
I have a star image in my activity. Now when the user clicks on that star image, that image should change to **ON Star image**, Same as favorite star image. For this I use the following code : ``` ImageView star=(ImageView)findViewById(R.id.favorite); star.setOnTouchListener(new OnTouchListener() { ...
2014/08/20
[ "https://Stackoverflow.com/questions/25406330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3898113/" ]
Use an OnClickListener instead of an OnTouchListener. ``` ImageView star=(ImageView)findViewById(R.id.favorite); star.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { star.setImageResource(android.R.drawable.star_big_on); } }); ...
To change the image you can use this code : star.setOnClickListener(new OnClickListener() { ``` @Override public void onClick(View v) { star.setImageResource(android.R.drawable.star_big_on); } }); ```
25,406,330
I have a star image in my activity. Now when the user clicks on that star image, that image should change to **ON Star image**, Same as favorite star image. For this I use the following code : ``` ImageView star=(ImageView)findViewById(R.id.favorite); star.setOnTouchListener(new OnTouchListener() { ...
2014/08/20
[ "https://Stackoverflow.com/questions/25406330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3898113/" ]
Use an OnClickListener instead of an OnTouchListener. ``` ImageView star=(ImageView)findViewById(R.id.favorite); star.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { star.setImageResource(android.R.drawable.star_big_on); } }); ...
you can use selctor xml. create xml under res/drawable and then create selector\_star.xml, your code in that xml should like this : ``` <?xml version="1.0" encoding="utf-8"?> ``` `<selector xmlns:android="http://schemas.android.com/apk/res/android">` ``` <item android:drawable="@drawable/star_big_on" android:state_...
43,278,020
In the success part of my ajax each result gets put into columns. What I am trying to achive is every 4 columns it will create a new row. Question: On success part of ajax how to make it so every after every 4 columns will create a new row? ``` <script type="text/javascript"> $("#select_category").on('keyup', functi...
2017/04/07
[ "https://Stackoverflow.com/questions/43278020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4419336/" ]
Remove one line from your css ``` tbody { height: 100%; display: block;//<--- Remove this line width: 100%; overflow-y: auto; } ```
Check with this : ``` tbody { position: absolute; width: 100%; height: 400px; overflow: hidden; overflow-y: scroll; } ``` and remove ``` .scrollbar { height: 450px; overflow-y: auto; // Remove this line } ```
43,278,020
In the success part of my ajax each result gets put into columns. What I am trying to achive is every 4 columns it will create a new row. Question: On success part of ajax how to make it so every after every 4 columns will create a new row? ``` <script type="text/javascript"> $("#select_category").on('keyup', functi...
2017/04/07
[ "https://Stackoverflow.com/questions/43278020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4419336/" ]
Add this in your css class. this will work. ``` table ,tr td{ border:1px solid red } tbody { display:block; height:50px; overflow:auto; height: calc(100vh - 360px); } thead, tbody tr { display:table; width:100%; table-layout:fixed; } thead { width: calc( 100% - 1em ) } table { ...
Check with this : ``` tbody { position: absolute; width: 100%; height: 400px; overflow: hidden; overflow-y: scroll; } ``` and remove ``` .scrollbar { height: 450px; overflow-y: auto; // Remove this line } ```
6,110,068
**Assuming an invariant culture**, is it possible to define a different group separator in the format - than the comma? ``` Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; Console.WriteLine(String.Format("{0:#,##0}", 2295)); ``` Output: ``` 2,295 ``` Desired output: ``` 2.295 ``` The inva...
2011/05/24
[ "https://Stackoverflow.com/questions/6110068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/77884/" ]
When you have different format strings, this does not mean that you have to use InvariantCulture. If you have a format string for germany e.g. you format this string using the Culture("de-de"): ``` String.Format(CultureInfo.GetCultureInfo( "de-de" ), "{0:0},-", 2295) //will result in 2.295,- String.Format(CultureInfo....
The normal approach would be to *not* use an Invariant culture. You do specify the formatting in Invariant style, but the proper symbols would be substituted, `#,##0.00` will come out as **1.234,50** or as **1,235.50** depending on the actual culture used.
601,834
I need to terminate an unused op amp and plan to use the [recommended circuit](https://youtu.be/gwQiFuckMz0?t=727) below with +3.3V. How do I choose the resistor values? The op amp I'm using is the [MCP6002](https://www.microchip.com/en-us/product/MCP6002) ([datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/MC...
2021/12/26
[ "https://electronics.stackexchange.com/questions/601834", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/303644/" ]
The op-amp has rail-to-rail input capabilities hence, you can tie the unused input to either: - * 3V3 or * 0 volts Noting this from the DS: - [![enter image description here](https://i.stack.imgur.com/T7p9M.png)](https://i.stack.imgur.com/T7p9M.png) I'd probably tie IN+ to 0 volts. > > *What determines a reasonab...
The voltage divider has the purpose of guaranteeing a voltage on the IN+ that is within both the input common-mode voltage range and the output voltage range. Mid-supply is a safe bet but not a must. If you use resistors, use the largest resistor present in your BOM. That way, the least amount of current from the supp...
601,834
I need to terminate an unused op amp and plan to use the [recommended circuit](https://youtu.be/gwQiFuckMz0?t=727) below with +3.3V. How do I choose the resistor values? The op amp I'm using is the [MCP6002](https://www.microchip.com/en-us/product/MCP6002) ([datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/MC...
2021/12/26
[ "https://electronics.stackexchange.com/questions/601834", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/303644/" ]
The op-amp has rail-to-rail input capabilities hence, you can tie the unused input to either: - * 3V3 or * 0 volts Noting this from the DS: - [![enter image description here](https://i.stack.imgur.com/T7p9M.png)](https://i.stack.imgur.com/T7p9M.png) I'd probably tie IN+ to 0 volts. > > *What determines a reasonab...
The general way to do this is to look at the op-amp's input current specification (not the output current). You want to choose a resistance that (A) won't generate more than about 10% of the power supply voltage when it's drawn through the bias network, and (B) is well below the board's self-leakage resistance. I'm ju...
601,834
I need to terminate an unused op amp and plan to use the [recommended circuit](https://youtu.be/gwQiFuckMz0?t=727) below with +3.3V. How do I choose the resistor values? The op amp I'm using is the [MCP6002](https://www.microchip.com/en-us/product/MCP6002) ([datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/MC...
2021/12/26
[ "https://electronics.stackexchange.com/questions/601834", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/303644/" ]
The voltage divider has the purpose of guaranteeing a voltage on the IN+ that is within both the input common-mode voltage range and the output voltage range. Mid-supply is a safe bet but not a must. If you use resistors, use the largest resistor present in your BOM. That way, the least amount of current from the supp...
The general way to do this is to look at the op-amp's input current specification (not the output current). You want to choose a resistance that (A) won't generate more than about 10% of the power supply voltage when it's drawn through the bias network, and (B) is well below the board's self-leakage resistance. I'm ju...
6,598,247
I made a survey and gave to certain user Contribute permission to answer the survey. Appears that even if you give to user "Read" permissions Action bar is still available. Is there any chance to hide "Action bar" for limited permission users?
2011/07/06
[ "https://Stackoverflow.com/questions/6598247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/671141/" ]
Try using the `onbeforeunload()` function or jQuery [unload()](http://api.jquery.com/unload/)
Not sure jQuery will help you here, but you could try ``` <html> <body onUnLoad='alert("Please do not leave!")'> </html> ``` Should note that this will fire whenever the user tries to leave your page (Refresh or otherwise).
46,182,318
I am trying to make a simple 'Simon Game'. I am currently stuck trying to add a class 'on' to a div for one second, then remove that class for the same amount of time. So I have four divs that I am blinking on and off depending on a sequence of numbers, e.g. `[0, 1, 2, 3]`. This would blink `div[0]` on for one second ...
2017/09/12
[ "https://Stackoverflow.com/questions/46182318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4030469/" ]
I think you could turn a list of buttons into a sequence of commands. Then you could use a single `setInterval` to play commands until it runs out of commands. The `setInterval` could use 1 second intervals if you want on and off to take just as long, but you could also set it to a little faster to easily allow for dif...
TLDR ;) All you need to do is to use `setInterval()` or `setTimeout()` and within the callback function use **[`element.classList.toggle()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList)** to add or remove a class from the element. If/when you want the blinking to stop, just use `clearTimeout()...
46,182,318
I am trying to make a simple 'Simon Game'. I am currently stuck trying to add a class 'on' to a div for one second, then remove that class for the same amount of time. So I have four divs that I am blinking on and off depending on a sequence of numbers, e.g. `[0, 1, 2, 3]`. This would blink `div[0]` on for one second ...
2017/09/12
[ "https://Stackoverflow.com/questions/46182318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4030469/" ]
Use setInterval instead of setTimeout I have created four divison and blink each division for 1 sec. ```js var i = 0, j = 4; function blink(i) { new Promise(function(resolve, reject) { x = setTimeout(function() { document.querySelectorAll(".post-text")[i].classList.add("myClass"); resolve("added...
TLDR ;) All you need to do is to use `setInterval()` or `setTimeout()` and within the callback function use **[`element.classList.toggle()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/classList)** to add or remove a class from the element. If/when you want the blinking to stop, just use `clearTimeout()...
7,188,989
> > **Possible Duplicate:** > > [Set array key as string not int?](https://stackoverflow.com/questions/3231318/set-array-key-as-string-not-int) > > > I know you can do something like `$array["string"]` in php but can you also do something like this in C# instead of using arrays with numbers?
2011/08/25
[ "https://Stackoverflow.com/questions/7188989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911848/" ]
If you want to store key/value pairs, you could probably use a Dictionary: <http://msdn.microsoft.com/en-us/library/xfhwa508.aspx> In PHP the "array" class is actually a map, which is a data structure that maps values to keys. In C# there are a [lot of distinct data structure](http://msdn.microsoft.com/en-us/vcsharp/...
`var ar = new string[]{"one", "two"};`
7,188,989
> > **Possible Duplicate:** > > [Set array key as string not int?](https://stackoverflow.com/questions/3231318/set-array-key-as-string-not-int) > > > I know you can do something like `$array["string"]` in php but can you also do something like this in C# instead of using arrays with numbers?
2011/08/25
[ "https://Stackoverflow.com/questions/7188989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911848/" ]
Arrays in PHP are in reality more like dictionaries in C#. So yes, you can do this, using a [**`Dictionary<string, YourValueType>`**](http://msdn.microsoft.com/en-us/library/xfhwa508.aspx): ``` var dict = new Dictionary<string, int>(); dict["hello"] = 42; dict["world"] = 12; ```
`var ar = new string[]{"one", "two"};`
7,188,989
> > **Possible Duplicate:** > > [Set array key as string not int?](https://stackoverflow.com/questions/3231318/set-array-key-as-string-not-int) > > > I know you can do something like `$array["string"]` in php but can you also do something like this in C# instead of using arrays with numbers?
2011/08/25
[ "https://Stackoverflow.com/questions/7188989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911848/" ]
Arrays in PHP are in reality more like dictionaries in C#. So yes, you can do this, using a [**`Dictionary<string, YourValueType>`**](http://msdn.microsoft.com/en-us/library/xfhwa508.aspx): ``` var dict = new Dictionary<string, int>(); dict["hello"] = 42; dict["world"] = 12; ```
If you want to store key/value pairs, you could probably use a Dictionary: <http://msdn.microsoft.com/en-us/library/xfhwa508.aspx> In PHP the "array" class is actually a map, which is a data structure that maps values to keys. In C# there are a [lot of distinct data structure](http://msdn.microsoft.com/en-us/vcsharp/...
7,188,989
> > **Possible Duplicate:** > > [Set array key as string not int?](https://stackoverflow.com/questions/3231318/set-array-key-as-string-not-int) > > > I know you can do something like `$array["string"]` in php but can you also do something like this in C# instead of using arrays with numbers?
2011/08/25
[ "https://Stackoverflow.com/questions/7188989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911848/" ]
If you want to store key/value pairs, you could probably use a Dictionary: <http://msdn.microsoft.com/en-us/library/xfhwa508.aspx> In PHP the "array" class is actually a map, which is a data structure that maps values to keys. In C# there are a [lot of distinct data structure](http://msdn.microsoft.com/en-us/vcsharp/...
Use `Dictionary` for this purpose :)
7,188,989
> > **Possible Duplicate:** > > [Set array key as string not int?](https://stackoverflow.com/questions/3231318/set-array-key-as-string-not-int) > > > I know you can do something like `$array["string"]` in php but can you also do something like this in C# instead of using arrays with numbers?
2011/08/25
[ "https://Stackoverflow.com/questions/7188989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911848/" ]
If you want to store key/value pairs, you could probably use a Dictionary: <http://msdn.microsoft.com/en-us/library/xfhwa508.aspx> In PHP the "array" class is actually a map, which is a data structure that maps values to keys. In C# there are a [lot of distinct data structure](http://msdn.microsoft.com/en-us/vcsharp/...
``` var dictionary = new Dictionary<string, string>(); dictionary["key"] = "value"; ``` and so on
7,188,989
> > **Possible Duplicate:** > > [Set array key as string not int?](https://stackoverflow.com/questions/3231318/set-array-key-as-string-not-int) > > > I know you can do something like `$array["string"]` in php but can you also do something like this in C# instead of using arrays with numbers?
2011/08/25
[ "https://Stackoverflow.com/questions/7188989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911848/" ]
Arrays in PHP are in reality more like dictionaries in C#. So yes, you can do this, using a [**`Dictionary<string, YourValueType>`**](http://msdn.microsoft.com/en-us/library/xfhwa508.aspx): ``` var dict = new Dictionary<string, int>(); dict["hello"] = 42; dict["world"] = 12; ```
Use `Dictionary` for this purpose :)
7,188,989
> > **Possible Duplicate:** > > [Set array key as string not int?](https://stackoverflow.com/questions/3231318/set-array-key-as-string-not-int) > > > I know you can do something like `$array["string"]` in php but can you also do something like this in C# instead of using arrays with numbers?
2011/08/25
[ "https://Stackoverflow.com/questions/7188989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/911848/" ]
Arrays in PHP are in reality more like dictionaries in C#. So yes, you can do this, using a [**`Dictionary<string, YourValueType>`**](http://msdn.microsoft.com/en-us/library/xfhwa508.aspx): ``` var dict = new Dictionary<string, int>(); dict["hello"] = 42; dict["world"] = 12; ```
``` var dictionary = new Dictionary<string, string>(); dictionary["key"] = "value"; ``` and so on
48,273,719
I'm new to programming. Here is the code I try to use: ``` <div style="width: 300px;"> texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext </div> ``` So, the problem is the text won't break after `300px`. Why and how can I fix that?
2018/01/16
[ "https://Stackoverflow.com/questions/48273719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9222224/" ]
this also work ```css div{ word-wrap: break-word; width: 300px; } ``` ```html <div> texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttext </div> ```
Try the following code for the styling of your div: ``` div{ overflow-wrap: break-word; /* wrap/break lines that are longer the the container width */ overflow: hidden; /* Not necessary but it will hide everything outside of the div box */ } ``` Programming is not coding and both HTML & CSS code aren't progr...
73,901,048
Very simple, I want to round my 'base\_price' and 'entry' with the precision, here 0.00001. It doesn't work because it converts it to a scientific number. How do I do this; I have been stuck for 1 hour. Some post says to use `output="{:.9f}".format(num)` but it adds some zero after the last 1. It work with `precision...
2022/09/29
[ "https://Stackoverflow.com/questions/73901048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18578687/" ]
If you want to round to a precision given by a variable, you can just do ```py precision = 0.00001 entry = 0.031525 entry_price = round(entry / precision) * precision ```
It sounds like you want to truncate the number, so: ``` precision = 0.00001 base_price = 0.0314858333 # use int to truncate the division to the nearest fraction. base_price = int(base_price / precision) * precision print(base_price) # prints 0.03148 ```
73,901,048
Very simple, I want to round my 'base\_price' and 'entry' with the precision, here 0.00001. It doesn't work because it converts it to a scientific number. How do I do this; I have been stuck for 1 hour. Some post says to use `output="{:.9f}".format(num)` but it adds some zero after the last 1. It work with `precision...
2022/09/29
[ "https://Stackoverflow.com/questions/73901048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18578687/" ]
To use numbers in the format '0.00001' to set precision instead of the number you want, I'd use int(abs(math.log10(precision))) then pass that number to format. Like so ```py import math precision = 0.00001 precision_count = int(abs(math.log10(precision))) base = 0.0314858333 entry = 0.031525 print(f"{entry:.{preci...
It sounds like you want to truncate the number, so: ``` precision = 0.00001 base_price = 0.0314858333 # use int to truncate the division to the nearest fraction. base_price = int(base_price / precision) * precision print(base_price) # prints 0.03148 ```
42,339,632
I am not able to understand the forced need of permission check in my code. Moreover, even after doing that, the location is null. This is the code of my onCreate method: Please help!! ``` @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layo...
2017/02/20
[ "https://Stackoverflow.com/questions/42339632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7591842/" ]
In D3 4.0 the [callback function for the `.on()` method is passed 3 arguments](https://github.com/d3/d3-selection#handling-events): the current datum (d), the current index (i), and the current group (nodes). Within the mouseover callback, you can `selectAll("rect")`, and filter out items which are in the current grou...
One solution could be: Make a function which selects all group and gives it a transition of opacity 0. The DOM on which mouse is over give opacity 1. ``` function hoverIn(){ d3.selectAll(".group-me").transition() .style("opacity", 0.01);//all groups given opacity 0 d3.select(this).transition() ...
12,863,043
I've looking looking at this with no success so far. I need a regular expression that returns me the string after the one in a phone number. Let me give you the perfect example: phone number (in exact format i need): 15063217711 return i need: 5063217711 --> so the FIRST char if its a 1 is removed. I need a regular e...
2012/10/12
[ "https://Stackoverflow.com/questions/12863043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/835883/" ]
For a playlist DEFINITELY the database. The preferences is just a simple key-value pair.
It all depends on the complexity of what you are going to save. SharedPreferences it's the simple approach, but I don't think it is a good idea in terms of scalability. In your case you would be better off using SQLite just because you can create complex structures using a relational database and still being easy to d...
55,763,548
I have following docker file. ``` MAINTANER Your Name "youremail@domain.tld" RUN apt-get update -y && \ apt-get install -y python-pip python-dev # We copy just the requirements.txt first to leverage Docker cache COPY ./requirements.txt /app/requirements.txt WORKDIR /app RUN pip install -r requirements.txt CO...
2019/04/19
[ "https://Stackoverflow.com/questions/55763548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1972924/" ]
One solution could be to use a docker-entrypoint.sh script. Basically that entrypoint would allow you to define a set of commands to run to initialize your program. For example, I could create the following docker-entrypoint.sh: ``` #!/bin/bash set -e if [ "$1" = 'app' ]; then sh /run-my-other-file.sh exec pyt...
You could try creating a bash file called run.sh and put inside app.py try changing the CMD ``` CMD [ "run.sh" ] ``` Also make sure permission in executable for run.sh
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I would use the OUTPUT clause present in SQL SERVER 2008 onwards... [**OUTPUT Clause (Transact-SQL)**](http://msdn.microsoft.com/en-us/library/ms177564.aspx) Something like... ``` BEGIN TRANSACTION DELETE [table] OUTPUT deleted.* WHERE [woof] ROLLBACK TRANSACTION ``` INSERTs and UPDATEs can use the 'inserted' t...
When you are in the context of the transaction, you can rollback changes any time before the transaction is committed. (Either by calling commit tran explicitly or if a condition arises that will cause the server to implicitly commit the transaction) ``` create table x (id int, val varchar(10)) insert into x values (...
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I live in fear of someone doing this to my databases so I always ask my Team to do something like the following: ``` BEGIN TRAN DELETE FROM X -- SELECT * FROM X FROM Table A as X JOIN Table B ON Blah blah blah WHERE blah blah blah ROLLBACK TRAN COMMIT TRAN ``` In this way, if you accidentally hit F5 (done it!) you...
When you are in the context of the transaction, you can rollback changes any time before the transaction is committed. (Either by calling commit tran explicitly or if a condition arises that will cause the server to implicitly commit the transaction) ``` create table x (id int, val varchar(10)) insert into x values (...
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
When you are in the context of the transaction, you can rollback changes any time before the transaction is committed. (Either by calling commit tran explicitly or if a condition arises that will cause the server to implicitly commit the transaction) ``` create table x (id int, val varchar(10)) insert into x values (...
When I want to see what will be deleted, I just change the "delete" statement to a "select \*". I like this better than using a transaction because I don't have to worry about locking.
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
When deleting: ``` BEGIN TRANSACTION DELETE FROM table1 OUTPUT deleted.* WHERE property1 = 99 ROLLBACK TRANSACTION ``` When updating/inserting: ``` BEGIN TRANSACTION UPDATE table1 SET table1.property1 = 99 OUTPUT inserted.* ROLLBACK TRANSACTION ```
When you are in the context of the transaction, you can rollback changes any time before the transaction is committed. (Either by calling commit tran explicitly or if a condition arises that will cause the server to implicitly commit the transaction) ``` create table x (id int, val varchar(10)) insert into x values (...
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I would use the OUTPUT clause present in SQL SERVER 2008 onwards... [**OUTPUT Clause (Transact-SQL)**](http://msdn.microsoft.com/en-us/library/ms177564.aspx) Something like... ``` BEGIN TRANSACTION DELETE [table] OUTPUT deleted.* WHERE [woof] ROLLBACK TRANSACTION ``` INSERTs and UPDATEs can use the 'inserted' t...
I live in fear of someone doing this to my databases so I always ask my Team to do something like the following: ``` BEGIN TRAN DELETE FROM X -- SELECT * FROM X FROM Table A as X JOIN Table B ON Blah blah blah WHERE blah blah blah ROLLBACK TRAN COMMIT TRAN ``` In this way, if you accidentally hit F5 (done it!) you...
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I would use the OUTPUT clause present in SQL SERVER 2008 onwards... [**OUTPUT Clause (Transact-SQL)**](http://msdn.microsoft.com/en-us/library/ms177564.aspx) Something like... ``` BEGIN TRANSACTION DELETE [table] OUTPUT deleted.* WHERE [woof] ROLLBACK TRANSACTION ``` INSERTs and UPDATEs can use the 'inserted' t...
When I want to see what will be deleted, I just change the "delete" statement to a "select \*". I like this better than using a transaction because I don't have to worry about locking.
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I would use the OUTPUT clause present in SQL SERVER 2008 onwards... [**OUTPUT Clause (Transact-SQL)**](http://msdn.microsoft.com/en-us/library/ms177564.aspx) Something like... ``` BEGIN TRANSACTION DELETE [table] OUTPUT deleted.* WHERE [woof] ROLLBACK TRANSACTION ``` INSERTs and UPDATEs can use the 'inserted' t...
When deleting: ``` BEGIN TRANSACTION DELETE FROM table1 OUTPUT deleted.* WHERE property1 = 99 ROLLBACK TRANSACTION ``` When updating/inserting: ``` BEGIN TRANSACTION UPDATE table1 SET table1.property1 = 99 OUTPUT inserted.* ROLLBACK TRANSACTION ```
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I live in fear of someone doing this to my databases so I always ask my Team to do something like the following: ``` BEGIN TRAN DELETE FROM X -- SELECT * FROM X FROM Table A as X JOIN Table B ON Blah blah blah WHERE blah blah blah ROLLBACK TRAN COMMIT TRAN ``` In this way, if you accidentally hit F5 (done it!) you...
When I want to see what will be deleted, I just change the "delete" statement to a "select \*". I like this better than using a transaction because I don't have to worry about locking.
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
I live in fear of someone doing this to my databases so I always ask my Team to do something like the following: ``` BEGIN TRAN DELETE FROM X -- SELECT * FROM X FROM Table A as X JOIN Table B ON Blah blah blah WHERE blah blah blah ROLLBACK TRAN COMMIT TRAN ``` In this way, if you accidentally hit F5 (done it!) you...
When deleting: ``` BEGIN TRANSACTION DELETE FROM table1 OUTPUT deleted.* WHERE property1 = 99 ROLLBACK TRANSACTION ``` When updating/inserting: ``` BEGIN TRANSACTION UPDATE table1 SET table1.property1 = 99 OUTPUT inserted.* ROLLBACK TRANSACTION ```
465,096
Hello we have an SQL server application running over a low bandwith connection. We use ADO.NET. I was wondering if anybody has any tips on minimizing traffic over the channel. Im looking for answers on ADO.NET/SQL-Server specific tips that make it more efficient. Not obvious answers like "dont fetch many records". E...
2009/01/21
[ "https://Stackoverflow.com/questions/465096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44894/" ]
When deleting: ``` BEGIN TRANSACTION DELETE FROM table1 OUTPUT deleted.* WHERE property1 = 99 ROLLBACK TRANSACTION ``` When updating/inserting: ``` BEGIN TRANSACTION UPDATE table1 SET table1.property1 = 99 OUTPUT inserted.* ROLLBACK TRANSACTION ```
When I want to see what will be deleted, I just change the "delete" statement to a "select \*". I like this better than using a transaction because I don't have to worry about locking.
41,084,005
I have three divs red, black and green. I want red div whose height is 45mm and next black div on its right whose height is 55mm and then green div just below the red div and green div height is 50mm. I am using the code ``` <div style="height:45mm;width:30mm;border:1mm solid red;float:left;position:relative;"> </div...
2016/12/11
[ "https://Stackoverflow.com/questions/41084005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6482428/" ]
This uses a flexbox with direction of column, wrap, and tight constraints (height and width). I've used `order` to change the order of the elements, but you can just switch the order in the HTML. ```css #container { display: flex; flex-direction: column; flex-wrap: wrap; width: 35mm; height: 105mm; } ...
My initial reaction was *use flexbox!* But I can't actually figure out how to do what you want with `display: flex`. I can do what you want in this exact situation with `position: relative` on the third rectangle, but I'm not sure if that's the kind of solution you're looking for: ```css #rect1 { height:45mm; w...
73,667,680
My program is loading some news article from the web. I then have an array of html documents representing these articles. I need to parse them and show on the screen only the relevant content. That includes converting all html escape sequences into readable symbols. So I need some function which is similar to `unEscape...
2022/09/09
[ "https://Stackoverflow.com/questions/73667680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18572447/" ]
There are several packages at CRAN that may help: * [Ryacas](https://cran.r-project.org/package=Ryacas) interfacing yacas * its predecessor [Ryacas0](https://cran.r-project.org/web/packages/Ryacas0/index.html) * [rim](https://cran.r-project.org/web/packages/rim/index.html) interfacing maxima * [caracas](https://cran.r...
It will definitely be easiest to do this numerically, if you can live with that: ```r uniroot(function(x) 1000/(1+x)^(25/252) - 985, c(0,10)) ``` However: I tried this in Wolfram Alpha, which gave me the exact result ``` x = (102400000000000000000000 2^(6/25) 5^(4/25) 197^(23/25) - 17343170265605241347130653)...
41,368,915
I want to use sqlite with the json extension so I've installed it with homebrew. When I run `which sqlite` though, the one that is being used is the anaconda install. If I try and use pythons sqlite library I have the same issue. It's linked to the Anaconda version and the JSON functions aren't available. How do I repl...
2016/12/28
[ "https://Stackoverflow.com/questions/41368915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6862111/" ]
Sqlite installed by Homebrew is keg-only, which is not linked to /usr/local/... . This is because system already have older version of `sqlite3`. If you really want to invoke Homebrew's sqlite binary, specify full path as below. ``` $ /usr/local/opt/sqlite/bin/sqlite3 ``` (All Homebrew package is symlinked under...
The answer by **equal-l2** is correct. Also, the comment under it by **Keith John Hutchison**. But, since they are from quite a few years ago and there is not an officially accepted answer still, here you go as this still catches you off-guard in 2022. To fix, add this to your `~/.zshrc` file and you should be good: ...
3,004
I swear that for the past couple of weeks or so the speed of responses on serverfault.com has really degraded from what it used to be. Is it time to beef that site up a little?
2012/02/23
[ "https://meta.serverfault.com/questions/3004", "https://meta.serverfault.com", "https://meta.serverfault.com/users/1592/" ]
Are you sure it's nothing at your end? I've noticed no difference here.
Where are you located? I'm in Sydney, Australia and for the last 10 months I've had speed issues with the site - it's so "normal" now that I don't even notice them. See my [meta.stackoverflow question here](https://meta.stackexchange.com/questions/92452/cdn-sstatic-net-is-slowing-down-initial-page-loads) - there's a ...
20,113,314
I have database having hundreds of tables with relations. I want to look a db design for understanding tables relations in a single place. Any idea how I can do this? Regards
2013/11/21
[ "https://Stackoverflow.com/questions/20113314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/966709/" ]
If it is displaying a different hour you may need to set the default timezone after setting the dateFormat (this happens only after ios7) ``` [dateFormat setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; ``` it seems that the default timezone is the one the device has, so if you no specify the default timez...
You need to check your "Date time format" set in iPhone Default Setting (Setting -> General -> Date and Time). if in this setting time format is set as 24 hr then u will get time in 24 hr format. If it is set as 12 hr format then u will get 12 hr date time format. I think in ur iPhone5 device date time setting is s...
60,942,686
Brand new to Python and could use some help importing multiple Excel files to separate Pandas dataframes. I have successfully implemented the following code, but of course it imports everything into one frame. I would like to import them into df1, df2, df3, df4, df5, etc. Anything helps, thank you! ``` import pandas...
2020/03/31
[ "https://Stackoverflow.com/questions/60942686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13160761/" ]
The easiest way to do that is to use a list. Each element of the list is a dataframe ``` def get_files(): directory_path = input('Enter directory path: ') filenames = glob.glob(directory_path + '/*.xlsx') number_of_files = len(filenames) df_list = [] for f in filenames: data = pd.read_excel...
Just as another option by Jezrael answer here <https://stackoverflow.com/a/52074347/13160821> but modified for your code. ``` from os.path import basename def get_files(): directory_path = input('Enter directory path: ') filenames = glob.glob(directory_path + '/*.xlsx') number_of_files = len(filenames) ...
201,164
a few weeks ago, we setup a cronjob that wipes the entire contents of /tmp every Sunday at 5am. I wasn't really convinced that this is a good idea. Today we discovered that a certain task depended on an existing directory inside /tmp - the task was broken, and worse, it remained silence about why it failed. The questio...
2010/11/12
[ "https://serverfault.com/questions/201164", "https://serverfault.com", "https://serverfault.com/users/39808/" ]
It's not a bad idea to do something about stale old files in /tmp, but I'm not sure that nuking the contents is the best thing you could do. My CentOS servers use something called tmpwatch, which runs daily and can be configured to remove only files that haven't been accessed in a certain period (30 days is a popular ...
My thoughts on this is.. Yes.. dont wipe the /tmp.. Lots of strange and weird applications use the temp for buffering and temporary storage.. If the information wasnt important, it wouldnt store it there :) Ive seen, logging buffers, webserver sessions and even library versions in there on servers.. Its best that y...
201,164
a few weeks ago, we setup a cronjob that wipes the entire contents of /tmp every Sunday at 5am. I wasn't really convinced that this is a good idea. Today we discovered that a certain task depended on an existing directory inside /tmp - the task was broken, and worse, it remained silence about why it failed. The questio...
2010/11/12
[ "https://serverfault.com/questions/201164", "https://serverfault.com", "https://serverfault.com/users/39808/" ]
It depends a bit on applications and distributions. It's typically safe to wipe /tmp on reboots. Wiping it on a running system is very likely to break applications. /tmp is not meant for permanent storage, and any application using it for such is serious broken, but applications can easily leave files in /tmp for month...
My thoughts on this is.. Yes.. dont wipe the /tmp.. Lots of strange and weird applications use the temp for buffering and temporary storage.. If the information wasnt important, it wouldnt store it there :) Ive seen, logging buffers, webserver sessions and even library versions in there on servers.. Its best that y...
201,164
a few weeks ago, we setup a cronjob that wipes the entire contents of /tmp every Sunday at 5am. I wasn't really convinced that this is a good idea. Today we discovered that a certain task depended on an existing directory inside /tmp - the task was broken, and worse, it remained silence about why it failed. The questio...
2010/11/12
[ "https://serverfault.com/questions/201164", "https://serverfault.com", "https://serverfault.com/users/39808/" ]
According to [the FHS](http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES): > > Programs must not assume that any files or directories in /tmp are preserved between invocations of the program. > > > Rationale > > > IEEE standard P1003.2 (POSIX, part 2) makes requirements that are similar to the above ...
My thoughts on this is.. Yes.. dont wipe the /tmp.. Lots of strange and weird applications use the temp for buffering and temporary storage.. If the information wasnt important, it wouldnt store it there :) Ive seen, logging buffers, webserver sessions and even library versions in there on servers.. Its best that y...
201,164
a few weeks ago, we setup a cronjob that wipes the entire contents of /tmp every Sunday at 5am. I wasn't really convinced that this is a good idea. Today we discovered that a certain task depended on an existing directory inside /tmp - the task was broken, and worse, it remained silence about why it failed. The questio...
2010/11/12
[ "https://serverfault.com/questions/201164", "https://serverfault.com", "https://serverfault.com/users/39808/" ]
It's not a bad idea to do something about stale old files in /tmp, but I'm not sure that nuking the contents is the best thing you could do. My CentOS servers use something called tmpwatch, which runs daily and can be configured to remove only files that haven't been accessed in a certain period (30 days is a popular ...
It depends a bit on applications and distributions. It's typically safe to wipe /tmp on reboots. Wiping it on a running system is very likely to break applications. /tmp is not meant for permanent storage, and any application using it for such is serious broken, but applications can easily leave files in /tmp for month...
201,164
a few weeks ago, we setup a cronjob that wipes the entire contents of /tmp every Sunday at 5am. I wasn't really convinced that this is a good idea. Today we discovered that a certain task depended on an existing directory inside /tmp - the task was broken, and worse, it remained silence about why it failed. The questio...
2010/11/12
[ "https://serverfault.com/questions/201164", "https://serverfault.com", "https://serverfault.com/users/39808/" ]
It's not a bad idea to do something about stale old files in /tmp, but I'm not sure that nuking the contents is the best thing you could do. My CentOS servers use something called tmpwatch, which runs daily and can be configured to remove only files that haven't been accessed in a certain period (30 days is a popular ...
According to [the FHS](http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES): > > Programs must not assume that any files or directories in /tmp are preserved between invocations of the program. > > > Rationale > > > IEEE standard P1003.2 (POSIX, part 2) makes requirements that are similar to the above ...
201,164
a few weeks ago, we setup a cronjob that wipes the entire contents of /tmp every Sunday at 5am. I wasn't really convinced that this is a good idea. Today we discovered that a certain task depended on an existing directory inside /tmp - the task was broken, and worse, it remained silence about why it failed. The questio...
2010/11/12
[ "https://serverfault.com/questions/201164", "https://serverfault.com", "https://serverfault.com/users/39808/" ]
It depends a bit on applications and distributions. It's typically safe to wipe /tmp on reboots. Wiping it on a running system is very likely to break applications. /tmp is not meant for permanent storage, and any application using it for such is serious broken, but applications can easily leave files in /tmp for month...
According to [the FHS](http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES): > > Programs must not assume that any files or directories in /tmp are preserved between invocations of the program. > > > Rationale > > > IEEE standard P1003.2 (POSIX, part 2) makes requirements that are similar to the above ...
56,406,047
I have a table view which has card kind of cells as shown in picture. I have set the content Inset so that I can get the cells with 20px spacing in left,right and top. [![enter image description here](https://i.stack.imgur.com/zEaDl.png)](https://i.stack.imgur.com/zEaDl.png) tableVw.contentInset = UIEdgeInsets(top: 2...
2019/06/01
[ "https://Stackoverflow.com/questions/56406047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4253261/" ]
Have a look at the [API for the datasets](https://docs.ckan.org/en/2.7/api/) that will likely be the easiest way to do this. In the meantime, here is how you can get the API links at id level from those pages and store the entire package info for all packages in one list, `data_sets`, and just the info of interest in ...
For simplicity use selenium package: ``` from selenium import webdriver import os # initialise browser browser = webdriver.Chrome(os.getcwd() + '/chromedriver') browser.get('https://data.nsw.gov.au/data/dataset') # find all elements by xpath get_elements = browser.find_elements_by_xpath('//*[@id="content"]/div/div/s...
59,837,873
I have a problem that should be easy to solve but I simply cannot figure it out. I have a huge dataset with groups and a variable. Some groups are empty for this variable (filled only with NAs) and some contains values but also NAs. For example: ``` ID <- c("A1","A1","A1","A1","B1","B1","B1","B1", "B1", "C1", "C1", "...
2020/01/21
[ "https://Stackoverflow.com/questions/59837873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9804952/" ]
You can use a simple if` statement, i.e. ``` library(dplyr) library(tidyr) data %>% group_by(ID) %>% mutate(Value1 = if (all(is.na(Value1))){Value1}else{replace_na(Value1, 0)}) ``` which gives, > > > ``` > # A tibble: 12 x 2 > # Groups: ID [3] > ID Value1 > <fct> <dbl> > 1 A1 0 > 2 A1 ...
Here is a base R solution ``` dfout <- Reduce(rbind, lapply(split(data,data$ID), function(v) {if (!all(is.na(v$Value1))) v$Value1[is.na(v$Value1)]<- 0; v})) ``` such that ``` > dfout ID Value1 1 A1 0 2 A1 2 3 A1 1 4 A1 1 5 B1 0 6 B1 1 7 ...
59,837,873
I have a problem that should be easy to solve but I simply cannot figure it out. I have a huge dataset with groups and a variable. Some groups are empty for this variable (filled only with NAs) and some contains values but also NAs. For example: ``` ID <- c("A1","A1","A1","A1","B1","B1","B1","B1", "B1", "C1", "C1", "...
2020/01/21
[ "https://Stackoverflow.com/questions/59837873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9804952/" ]
You can use a simple if` statement, i.e. ``` library(dplyr) library(tidyr) data %>% group_by(ID) %>% mutate(Value1 = if (all(is.na(Value1))){Value1}else{replace_na(Value1, 0)}) ``` which gives, > > > ``` > # A tibble: 12 x 2 > # Groups: ID [3] > ID Value1 > <fct> <dbl> > 1 A1 0 > 2 A1 ...
With `dplyr`: ``` data %>% group_by(ID) %>% mutate(Value1 = ifelse(any(!is.na(Value1)) & is.na(Value1), 0, Value1)) # A tibble: 12 x 2 # Groups: ID [3] ID Value1 <fct> <dbl> 1 A1 0 2 A1 2 3 A1 1 4 A1 1 5 B1 0 6 B1 1 7 B1 1 8 B1 0 ...
59,837,873
I have a problem that should be easy to solve but I simply cannot figure it out. I have a huge dataset with groups and a variable. Some groups are empty for this variable (filled only with NAs) and some contains values but also NAs. For example: ``` ID <- c("A1","A1","A1","A1","B1","B1","B1","B1", "B1", "C1", "C1", "...
2020/01/21
[ "https://Stackoverflow.com/questions/59837873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9804952/" ]
You can use a simple if` statement, i.e. ``` library(dplyr) library(tidyr) data %>% group_by(ID) %>% mutate(Value1 = if (all(is.na(Value1))){Value1}else{replace_na(Value1, 0)}) ``` which gives, > > > ``` > # A tibble: 12 x 2 > # Groups: ID [3] > ID Value1 > <fct> <dbl> > 1 A1 0 > 2 A1 ...
Using `data.table` ``` setDT(data) data[, Value1 := if (all(is.na(Value1))) NA else replace(Value1, is.na(Value1), 0), by = ID] ID Value1 1: A1 0 2: A1 2 3: A1 1 4: A1 1 5: B1 0 6: B1 1 7: B1 1 8: B1 0 9: B1 1 10: C1 NA 11: C1 NA 12: C1 NA ```
2,914
Specifically for the SpaceX SES-8 mission going on right now. But, generally, how long does it take for a satellite to reach GEO at a minimum?
2013/11/25
[ "https://space.stackexchange.com/questions/2914", "https://space.stackexchange.com", "https://space.stackexchange.com/users/603/" ]
In theory, the shortest practical time from spacecraft separation would be about five and a quarter hours, which is half of a geosynchronous transfer orbit. At apogee, which is carefully placed to occur over the equator, a single burn raises the perigee and changes the inclination of the orbit, and you're there. All ea...
**Less than 30 minutes** > > Falcon 9’s second stage single Merlin vacuum engine ignited at 185 > seconds after launch to begin a five minute, 20 second burn to deliver > SES-8 into a temporary parking orbit. Eighteen minutes after injecting > SES-8 into that orbit, the second stage engine reignited for just over ...
68,473,791
``` #include <iostream> using namespace std; int main(){ int a=0 , b=0; cin>>a>>b; for(int i = a+1;i < b;i++){ int counter = 0; for(int j = 2;j <= i / 2;j++){ if(i % j == 0){ counter++; break; } } if(counter == 0 && i!= ...
2021/07/21
[ "https://Stackoverflow.com/questions/68473791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16497151/" ]
You haven't provided any code so, I may not give you exact answer but you can try this: ``` st={'captchaId': '67561984031', 'code': '03AGdBq26D5XwT-p6LuAwftuZ3gUcvj0dB7lhZUT7OOfKIZU_wZzN03CCVZAaRGzzD0rXVbsJOjTBN1Ed2d0v0X6Tl2wQQPbT_R1lRHOkh5FFU46MN3tfVbajIFyZfZHUHZAt_h-5yY0cVqfJTy1_fwebyr-ilN_N1R04214z9WVXg9-cuSYJD9a2c...
That looks like a dictionary, so you can just access the terms like you would in a dictionary. eg. ```py dict = { 'firstkey': 'firstvalue', 'secondkey': 'secondvalue' } ``` so if you call `dict[firstkey]`, it would return `firstvalue`. In your case, you can just save that into `var` and ac...
68,473,791
``` #include <iostream> using namespace std; int main(){ int a=0 , b=0; cin>>a>>b; for(int i = a+1;i < b;i++){ int counter = 0; for(int j = 2;j <= i / 2;j++){ if(i % j == 0){ counter++; break; } } if(counter == 0 && i!= ...
2021/07/21
[ "https://Stackoverflow.com/questions/68473791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16497151/" ]
You haven't provided any code so, I may not give you exact answer but you can try this: ``` st={'captchaId': '67561984031', 'code': '03AGdBq26D5XwT-p6LuAwftuZ3gUcvj0dB7lhZUT7OOfKIZU_wZzN03CCVZAaRGzzD0rXVbsJOjTBN1Ed2d0v0X6Tl2wQQPbT_R1lRHOkh5FFU46MN3tfVbajIFyZfZHUHZAt_h-5yY0cVqfJTy1_fwebyr-ilN_N1R04214z9WVXg9-cuSYJD9a2c...
Have a look at the [json](https://docs.python.org/3/library/json.html) library for python. If you are reading the response from a file you can do something like: ``` import json with open("/tmp/test.json", "r") as src_json: src=json.load(src_json) print(src["code"]) ```
32,037
I'm using a tablet with Android 2.2. Is there something like `Tab` to switch to the next form field?
2012/10/19
[ "https://android.stackexchange.com/questions/32037", "https://android.stackexchange.com", "https://android.stackexchange.com/users/18840/" ]
Is this what you are looking for [paid app]: <https://play.google.com/store/apps/details?id=com.vmlite.vncserver&hl=en> However, if you are willing to go through a lengthy process [but free], you can follow the tutorial [here](http://www.howtogeek.com/howto/42491/how-to-remote-view-and-control-your-android-phone/) to...
Give [androidscreencast](http://code.google.com/p/androidscreencast/) a try. You may already need to have USB Debugging enabled for it to work, but you've said you already have that enabled, so should be ok. It just needs a USB connection to the phone and goes over the ADB protocol.
32,037
I'm using a tablet with Android 2.2. Is there something like `Tab` to switch to the next form field?
2012/10/19
[ "https://android.stackexchange.com/questions/32037", "https://android.stackexchange.com", "https://android.stackexchange.com/users/18840/" ]
Is this what you are looking for [paid app]: <https://play.google.com/store/apps/details?id=com.vmlite.vncserver&hl=en> However, if you are willing to go through a lengthy process [but free], you can follow the tutorial [here](http://www.howtogeek.com/howto/42491/how-to-remote-view-and-control-your-android-phone/) to...
Use a USB-OTG cable to connect a mouse. You can even make your own by cutting and soldering a microUSB cable to the female end of a USB extension cable.
32,037
I'm using a tablet with Android 2.2. Is there something like `Tab` to switch to the next form field?
2012/10/19
[ "https://android.stackexchange.com/questions/32037", "https://android.stackexchange.com", "https://android.stackexchange.com/users/18840/" ]
Is this what you are looking for [paid app]: <https://play.google.com/store/apps/details?id=com.vmlite.vncserver&hl=en> However, if you are willing to go through a lengthy process [but free], you can follow the tutorial [here](http://www.howtogeek.com/howto/42491/how-to-remote-view-and-control-your-android-phone/) to...
Scrcpy is awesome! It uses adb directly for backend and it doesn't block those remote screen restricted apps too. And since it's adb. You can remote control via same network wirelessly. For linux users. It's available on most of package managers.
32,037
I'm using a tablet with Android 2.2. Is there something like `Tab` to switch to the next form field?
2012/10/19
[ "https://android.stackexchange.com/questions/32037", "https://android.stackexchange.com", "https://android.stackexchange.com/users/18840/" ]
Give [androidscreencast](http://code.google.com/p/androidscreencast/) a try. You may already need to have USB Debugging enabled for it to work, but you've said you already have that enabled, so should be ok. It just needs a USB connection to the phone and goes over the ADB protocol.
Use a USB-OTG cable to connect a mouse. You can even make your own by cutting and soldering a microUSB cable to the female end of a USB extension cable.
32,037
I'm using a tablet with Android 2.2. Is there something like `Tab` to switch to the next form field?
2012/10/19
[ "https://android.stackexchange.com/questions/32037", "https://android.stackexchange.com", "https://android.stackexchange.com/users/18840/" ]
Give [androidscreencast](http://code.google.com/p/androidscreencast/) a try. You may already need to have USB Debugging enabled for it to work, but you've said you already have that enabled, so should be ok. It just needs a USB connection to the phone and goes over the ADB protocol.
Scrcpy is awesome! It uses adb directly for backend and it doesn't block those remote screen restricted apps too. And since it's adb. You can remote control via same network wirelessly. For linux users. It's available on most of package managers.
32,037
I'm using a tablet with Android 2.2. Is there something like `Tab` to switch to the next form field?
2012/10/19
[ "https://android.stackexchange.com/questions/32037", "https://android.stackexchange.com", "https://android.stackexchange.com/users/18840/" ]
Use a USB-OTG cable to connect a mouse. You can even make your own by cutting and soldering a microUSB cable to the female end of a USB extension cable.
Scrcpy is awesome! It uses adb directly for backend and it doesn't block those remote screen restricted apps too. And since it's adb. You can remote control via same network wirelessly. For linux users. It's available on most of package managers.
26,697,879
I have a "rawqueryset" object that its fields can be vary in term of some business rules. How can I access to its count and name of fields in corresponding template? View.py ``` objs=MyModel.objects.raw(sql) return list(objs) ``` template.py ``` {%for obj in objs%} {{obj.?}} {{obj.?}} . ? {%en...
2014/11/02
[ "https://Stackoverflow.com/questions/26697879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1843934/" ]
I solved this issue using two filters: template.py: ``` {% load my_tags %} {%for obj in objs%} {%for key in obj|get_dict %} {% with d=obj|get_dict %} {{key}} - {{ d|get_val:key }} {% endwith %} {%endfor%} {%endfor%} ``` my\_tags.py: ``` @register.filter(name='get_dict') def ge...
Must be honest, I'm not sure about the properties of a `RawQuerySet`. If it was a normal `QuerySet`, I'd try this. ``` {% for obj in objs.values %} {% for key, val in values.items %} {{ key }}: {{ val }} {% endfor %} {% endfor %} ``` Does that do the trick?
17,254,122
I'm making a core data model, and I have a Client entity that has a to-many relationship to an Appointment entity. An Appointment can turn into a Transaction (if it has been paid for etc.), and I need to keep track of the Appointments of Clients that have turned into Transactions (where Transaction is an entity along w...
2013/06/22
[ "https://Stackoverflow.com/questions/17254122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362840/" ]
Use the trigger function.... So attach the click handler... ``` $('.test').on('click', function() { $(this).toggleClass("btn-danger btn-success"); }); ``` Then in your ajax success function....trigger that click... ``` $('.test').trigger('click'); ``` But determining which one to trigger will be the trick. Ho...
Is it not possible to give each of these an ID so you can access them directly? If you are triggering them on a callback function can you create a reference to the clicked div in a variable? i.e. ``` var clicked; $('.test').click(function(){ clicked = $(this); }); ``` then in your ajax response: ``` cl...
17,254,122
I'm making a core data model, and I have a Client entity that has a to-many relationship to an Appointment entity. An Appointment can turn into a Transaction (if it has been paid for etc.), and I need to keep track of the Appointments of Clients that have turned into Transactions (where Transaction is an entity along w...
2013/06/22
[ "https://Stackoverflow.com/questions/17254122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362840/" ]
It sounds like the ajax call is made when one of the elements is clicked, but you need to pass different values in the ajax call depending on which element is clicked. Rather than use an "onclick" attribute, you could do the following: HTML: ``` <div class="test" data-param1="value1a" data-param2="value2a">hi</div> <...
Use the trigger function.... So attach the click handler... ``` $('.test').on('click', function() { $(this).toggleClass("btn-danger btn-success"); }); ``` Then in your ajax success function....trigger that click... ``` $('.test').trigger('click'); ``` But determining which one to trigger will be the trick. Ho...
17,254,122
I'm making a core data model, and I have a Client entity that has a to-many relationship to an Appointment entity. An Appointment can turn into a Transaction (if it has been paid for etc.), and I need to keep track of the Appointments of Clients that have turned into Transactions (where Transaction is an entity along w...
2013/06/22
[ "https://Stackoverflow.com/questions/17254122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362840/" ]
It sounds like the ajax call is made when one of the elements is clicked, but you need to pass different values in the ajax call depending on which element is clicked. Rather than use an "onclick" attribute, you could do the following: HTML: ``` <div class="test" data-param1="value1a" data-param2="value2a">hi</div> <...
Is it not possible to give each of these an ID so you can access them directly? If you are triggering them on a callback function can you create a reference to the clicked div in a variable? i.e. ``` var clicked; $('.test').click(function(){ clicked = $(this); }); ``` then in your ajax response: ``` cl...
17,254,122
I'm making a core data model, and I have a Client entity that has a to-many relationship to an Appointment entity. An Appointment can turn into a Transaction (if it has been paid for etc.), and I need to keep track of the Appointments of Clients that have turned into Transactions (where Transaction is an entity along w...
2013/06/22
[ "https://Stackoverflow.com/questions/17254122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362840/" ]
``` $('.test').click(function(){ clicked = $(this); }); ``` The above code returns an array of a single item. So use index 0 to select it as below: ``` $('.test').click(function(){ clicked = $(this)[0]; }); ```
Is it not possible to give each of these an ID so you can access them directly? If you are triggering them on a callback function can you create a reference to the clicked div in a variable? i.e. ``` var clicked; $('.test').click(function(){ clicked = $(this); }); ``` then in your ajax response: ``` cl...
17,254,122
I'm making a core data model, and I have a Client entity that has a to-many relationship to an Appointment entity. An Appointment can turn into a Transaction (if it has been paid for etc.), and I need to keep track of the Appointments of Clients that have turned into Transactions (where Transaction is an entity along w...
2013/06/22
[ "https://Stackoverflow.com/questions/17254122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362840/" ]
It sounds like the ajax call is made when one of the elements is clicked, but you need to pass different values in the ajax call depending on which element is clicked. Rather than use an "onclick" attribute, you could do the following: HTML: ``` <div class="test" data-param1="value1a" data-param2="value2a">hi</div> <...
``` $('.test').click(function(){ clicked = $(this); }); ``` The above code returns an array of a single item. So use index 0 to select it as below: ``` $('.test').click(function(){ clicked = $(this)[0]; }); ```
608,991
I have setup a Remote Desktop Gateway server using Windows Server 2012 R2. I am using the Remote Desktop Gateway as an intermediary between to provide the remote desktop session over 443 since 3389 is blocked at many client locations. However, I ran into a problem with a client who's network seems to be using an web p...
2014/06/30
[ "https://serverfault.com/questions/608991", "https://serverfault.com", "https://serverfault.com/users/228593/" ]
As of 2008 [a Microsoft employee indicated there was "no official way" to accomplish this](http://social.technet.microsoft.com/Forums/windowsserver/en-US/a341fda4-10ef-4c4c-8646-3ff10bea3a38/connecting-to-ts-gateway-through-a-web-proxy?forum=winserverTS). Given the six intervening years you'd like to think there has be...
Another option is to use an SSH tunnel. PuTTY, to name names, has an easily-configured proxy option, so it can work through the proxy server and then provide a local tunnel through which you can connect to the RDP destination. This does assume that the client has something to login to via SSH, and more specifically s...
608,991
I have setup a Remote Desktop Gateway server using Windows Server 2012 R2. I am using the Remote Desktop Gateway as an intermediary between to provide the remote desktop session over 443 since 3389 is blocked at many client locations. However, I ran into a problem with a client who's network seems to be using an web p...
2014/06/30
[ "https://serverfault.com/questions/608991", "https://serverfault.com", "https://serverfault.com/users/228593/" ]
As of 2008 [a Microsoft employee indicated there was "no official way" to accomplish this](http://social.technet.microsoft.com/Forums/windowsserver/en-US/a341fda4-10ef-4c4c-8646-3ff10bea3a38/connecting-to-ts-gateway-through-a-web-proxy?forum=winserverTS). Given the six intervening years you'd like to think there has be...
As Omaha's answer suggested, another option is an SSH tunnel. If you had SSH installed on your windows box [possibly not trivial] then you may be able to connect to that box, creating an SSH tunnel for a port, then connect your rdp client to that port (putty can create tunnels, or ssh can something like <https://stacko...
608,991
I have setup a Remote Desktop Gateway server using Windows Server 2012 R2. I am using the Remote Desktop Gateway as an intermediary between to provide the remote desktop session over 443 since 3389 is blocked at many client locations. However, I ran into a problem with a client who's network seems to be using an web p...
2014/06/30
[ "https://serverfault.com/questions/608991", "https://serverfault.com", "https://serverfault.com/users/228593/" ]
As of 2008 [a Microsoft employee indicated there was "no official way" to accomplish this](http://social.technet.microsoft.com/Forums/windowsserver/en-US/a341fda4-10ef-4c4c-8646-3ff10bea3a38/connecting-to-ts-gateway-through-a-web-proxy?forum=winserverTS). Given the six intervening years you'd like to think there has be...
Guacamole and FreeRDP-WebConnect are Linux based gateways. For Windows Servers (I saw you are using Windows Server 2012 R2), you can try [Myrtille](https://github.com/cedrozor/myrtille), a comparable solution (equally using FreeRDP as rdp client), also open source.
608,991
I have setup a Remote Desktop Gateway server using Windows Server 2012 R2. I am using the Remote Desktop Gateway as an intermediary between to provide the remote desktop session over 443 since 3389 is blocked at many client locations. However, I ran into a problem with a client who's network seems to be using an web p...
2014/06/30
[ "https://serverfault.com/questions/608991", "https://serverfault.com", "https://serverfault.com/users/228593/" ]
Another option is to use an SSH tunnel. PuTTY, to name names, has an easily-configured proxy option, so it can work through the proxy server and then provide a local tunnel through which you can connect to the RDP destination. This does assume that the client has something to login to via SSH, and more specifically s...
Guacamole and FreeRDP-WebConnect are Linux based gateways. For Windows Servers (I saw you are using Windows Server 2012 R2), you can try [Myrtille](https://github.com/cedrozor/myrtille), a comparable solution (equally using FreeRDP as rdp client), also open source.
608,991
I have setup a Remote Desktop Gateway server using Windows Server 2012 R2. I am using the Remote Desktop Gateway as an intermediary between to provide the remote desktop session over 443 since 3389 is blocked at many client locations. However, I ran into a problem with a client who's network seems to be using an web p...
2014/06/30
[ "https://serverfault.com/questions/608991", "https://serverfault.com", "https://serverfault.com/users/228593/" ]
As Omaha's answer suggested, another option is an SSH tunnel. If you had SSH installed on your windows box [possibly not trivial] then you may be able to connect to that box, creating an SSH tunnel for a port, then connect your rdp client to that port (putty can create tunnels, or ssh can something like <https://stacko...
Guacamole and FreeRDP-WebConnect are Linux based gateways. For Windows Servers (I saw you are using Windows Server 2012 R2), you can try [Myrtille](https://github.com/cedrozor/myrtille), a comparable solution (equally using FreeRDP as rdp client), also open source.
73,315,389
I am trying to create a new data frame using R from a larger data frame. This is a short version of my large data frame: ``` df <- data.frame(time = c(0,1,5,10,12,13,20,22,25,30,32,35,39), t_0_1 = c(20,20,20,120,300,350,400,600,700,100,20,20,20), t_0_2 = c(20,20,20,20,120,300,350,400,600,700...
2022/08/11
[ "https://Stackoverflow.com/questions/73315389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7033156/" ]
You could calculate the time difference for each column with `summarise(across(...))`, and then transform the data to long. ```r library(tidyverse) df %>% summarise(across(-time, ~ sum(diff(time[.x > 300])))) %>% pivot_longer(everything(), names_to = c(".value", "height"), names_pattern = "t_(.+)_(.+)") # # A ti...
Here is a `tidyverse` solution ```r library(tidyverse) df %>% pivot_longer(-time) %>% separate(name, c(NA, "col", "height"), sep = "_") %>% pivot_wider(names_from = "col", names_prefix = "X") %>% group_by(height) %>% summarise( across(starts_with("X"), ~ sum(diff(time[.x > 300]))), ...
3,739,753
I'm trying to figure out how to unit test my object that persists itself to session state. The controller does something like... ``` [HttpPost] public ActionResult Update(Account a) { SessionManager sm = SessionManager.FromSessionState(HttpContext.Current.Session); if ( a.equals(sm.Accoun...
2010/09/17
[ "https://Stackoverflow.com/questions/3739753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69983/" ]
Here's an idea: Create a session manager "persistence" interface: ``` public interface ISessionManagerPersist { SessionManager Load(); void Save(SessionManager sessionManager); } ``` Create an HTTPSession-based implementation of your persistence: ``` public class SessionStatePersist : ISessionManagerPersist...
Currently this controller action is very difficult to unit test as it calls a static method that is relying on `HttpContext.Current`. While the first approach seems to work in the second you still need to pass the session state somewhere so that the manager could work with it. Also don't pass `HttpSessionStateWrapper`,...
653,858
I've just been wondering because I see this on ubiquity and want to know how this is better during the installation of Ubuntu.
2015/07/28
[ "https://askubuntu.com/questions/653858", "https://askubuntu.com", "https://askubuntu.com/users/409520/" ]
If you are not plugged, then your laptop battery may be dead before the installation is finished, if you have a laptop. **;)** The result can be a ruined or incomplete installation and you have to start over. Assuming your hard drive still functions.
There is another point. When you are on battery performance is all depend on battery but while charging performance increase little bit and laptop all depends on direct DC charge and it gives little bit more volts than battery.
2,477
Many people learn foreign languages at school, which often involves [learning vocabulary lists](https://languagelearning.stackexchange.com/q/2462/800). Others learn languages through [immersion](https://languagelearning.stackexchange.com/questions/tagged/immersion). Each method has its benefits and drawbacks. What ar...
2016/12/09
[ "https://languagelearning.stackexchange.com/questions/2477", "https://languagelearning.stackexchange.com", "https://languagelearning.stackexchange.com/users/800/" ]
In a [YouTube video from September 2016](https://www.youtube.com/watch?v=A6IIH49dt-g), the British polyglot Olly Richards explains that he had been learning **Cantonese without learning to read and write**. He had been following the advice to focus on oral skills first, and he found that it kept the **momentum** going ...
For many/most languages, learning only oral way would not allow you to learn to read and write. Which might (or might not) be included in your goals. (This is obvious: you might speak and understand, but be illiterate and not able to read and write) Also, learning by conversation does not allow (a learner of English) ...
24,080,285
I gave margin 20px for both the div inside sidebar div. But for some reason the gap between two div's us just 20px, which should be 40px. 20px from box1 and 20px from box2. Am I missing some minor thing. please point it out. **Fiddle:** <http://jsfiddle.net/3UJWf/> **HTML:** ``` <div class="sidebar"> <div clas...
2014/06/06
[ "https://Stackoverflow.com/questions/24080285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2177755/" ]
[Check Demo](http://jsfiddle.net/3UJWf/3/) [CSS Margin Collapsing](https://stackoverflow.com/questions/102640/css-margin-collapsing) `float:left;` or `display: inline-block` solves the above issue Let’s explore exactly what the consequences of collapsing margins are, and how they will affect elements on the page. *...
try using `.common{ display: inline-block }` and give the sidebar a width. solves the problem for me
24,080,285
I gave margin 20px for both the div inside sidebar div. But for some reason the gap between two div's us just 20px, which should be 40px. 20px from box1 and 20px from box2. Am I missing some minor thing. please point it out. **Fiddle:** <http://jsfiddle.net/3UJWf/> **HTML:** ``` <div class="sidebar"> <div clas...
2014/06/06
[ "https://Stackoverflow.com/questions/24080285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2177755/" ]
This is in the CSS 2.1 specification > > "In CSS, the adjoining margins of two or more boxes (which might or might not be siblings) can combine to form a single margin. Margins that combine this way are said to collapse, and the resulting combined margin is called a collapsed margin." > > > [Source](http://www.w3...
try using `.common{ display: inline-block }` and give the sidebar a width. solves the problem for me
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
It is doable, no problem. There is the `$_REQUEST` array that merges GET, POST, and COOKIE values but the better way would be to handle GET and POST manually in your script. Just have your engine check both `$_GET["variable"]` and `$_POST["variable"]` and use whichever is set. If a variable is set in both methods, y...
You could use something like the following: ``` <?php function getParam($key) { switch (true) { case isset($_GET[$key]): return $_GET[$key]; case isset($_POST[$key]): return $_POST[$key]; case isset($_COOKIE[$key]): return $_COOKIE[$key]; case...
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
It is doable, no problem. There is the `$_REQUEST` array that merges GET, POST, and COOKIE values but the better way would be to handle GET and POST manually in your script. Just have your engine check both `$_GET["variable"]` and `$_POST["variable"]` and use whichever is set. If a variable is set in both methods, y...
Here's how you could use GET and POST in one: ``` <form action="myfile.php?var1=get1&amp;var2=get2&amp;var3=get3" method="post"> <input type="hidden" name="var1" value="post1" /> <input type="hidden" name="var2" value="post2" /> <input type="submit" /> </form> ``` The PHP: ``` print_r($_REQUEST); // v...
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
It is doable, no problem. There is the `$_REQUEST` array that merges GET, POST, and COOKIE values but the better way would be to handle GET and POST manually in your script. Just have your engine check both `$_GET["variable"]` and `$_POST["variable"]` and use whichever is set. If a variable is set in both methods, y...
It's also as well to be aware that using GET opens up a temptation among certain sets of users to manipulate the URL to 'see what happens' so it's absolutely necessary to ensure that your code suitably sanitises the input variables. Of course you were doing that anyway ;-). But with get it pays to be doubly paranoid. ...
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
It is doable, no problem. There is the `$_REQUEST` array that merges GET, POST, and COOKIE values but the better way would be to handle GET and POST manually in your script. Just have your engine check both `$_GET["variable"]` and `$_POST["variable"]` and use whichever is set. If a variable is set in both methods, y...
Yes its doable, although (IMHO) the limit at which GET becomes cumbersome is significantly greater than the threshold at which a user interface for providing this much information becomes unusable. Also, the more complex a query you submit to a conventional search engine, the more effectively it can be resolved. But I...
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
It is doable, no problem. There is the `$_REQUEST` array that merges GET, POST, and COOKIE values but the better way would be to handle GET and POST manually in your script. Just have your engine check both `$_GET["variable"]` and `$_POST["variable"]` and use whichever is set. If a variable is set in both methods, y...
``` function getQVar($key){ return isset($_GET[$key]) ? $_GET[$key] : (isset($_POST[$key]) ? $_POST[$key] : null); } echo getQVar("name"); ``` Switch around $\_GET and $\_POST to prioritize POST over GET vars.
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
Here's how you could use GET and POST in one: ``` <form action="myfile.php?var1=get1&amp;var2=get2&amp;var3=get3" method="post"> <input type="hidden" name="var1" value="post1" /> <input type="hidden" name="var2" value="post2" /> <input type="submit" /> </form> ``` The PHP: ``` print_r($_REQUEST); // v...
You could use something like the following: ``` <?php function getParam($key) { switch (true) { case isset($_GET[$key]): return $_GET[$key]; case isset($_POST[$key]): return $_POST[$key]; case isset($_COOKIE[$key]): return $_COOKIE[$key]; case...
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
Here's how you could use GET and POST in one: ``` <form action="myfile.php?var1=get1&amp;var2=get2&amp;var3=get3" method="post"> <input type="hidden" name="var1" value="post1" /> <input type="hidden" name="var2" value="post2" /> <input type="submit" /> </form> ``` The PHP: ``` print_r($_REQUEST); // v...
It's also as well to be aware that using GET opens up a temptation among certain sets of users to manipulate the URL to 'see what happens' so it's absolutely necessary to ensure that your code suitably sanitises the input variables. Of course you were doing that anyway ;-). But with get it pays to be doubly paranoid. ...
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
Here's how you could use GET and POST in one: ``` <form action="myfile.php?var1=get1&amp;var2=get2&amp;var3=get3" method="post"> <input type="hidden" name="var1" value="post1" /> <input type="hidden" name="var2" value="post2" /> <input type="submit" /> </form> ``` The PHP: ``` print_r($_REQUEST); // v...
Yes its doable, although (IMHO) the limit at which GET becomes cumbersome is significantly greater than the threshold at which a user interface for providing this much information becomes unusable. Also, the more complex a query you submit to a conventional search engine, the more effectively it can be resolved. But I...
2,036,862
I have a mapping defined where a parent object has a collection of child objects. In my design, I'd like to be able to delete the child objects without having to remove them from the collection on the parent object and re-saving the parent object. However, when I try this, I get the "deleted object would be re-created ...
2010/01/10
[ "https://Stackoverflow.com/questions/2036862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/129648/" ]
Here's how you could use GET and POST in one: ``` <form action="myfile.php?var1=get1&amp;var2=get2&amp;var3=get3" method="post"> <input type="hidden" name="var1" value="post1" /> <input type="hidden" name="var2" value="post2" /> <input type="submit" /> </form> ``` The PHP: ``` print_r($_REQUEST); // v...
``` function getQVar($key){ return isset($_GET[$key]) ? $_GET[$key] : (isset($_POST[$key]) ? $_POST[$key] : null); } echo getQVar("name"); ``` Switch around $\_GET and $\_POST to prioritize POST over GET vars.
105,849
So in 3 we learn about the Virgo II lander, but really not much else in the space program. What else happened? Were there space stations, probes to other planets?
2015/10/23
[ "https://scifi.stackexchange.com/questions/105849", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/40833/" ]
Ultimately, we have speculative evidence that *Project: Safehouse*, aka the *Societal Preservation Program*, which tasked the Enclave to oversee the vaults, had but one supreme objective. > > The purpose of the [vault experiments](http://fallout.wikia.com/wiki/Vault) was to help prepare the Enclave for either re-colo...
There was Hubology in Fallout 2, with the questionable goal of leaving Earth in an old pre-war space shuttle. In Fallout New Vegas the ghouls in the quest 'Come Fly With Me' use three pre-war rockets to leave Earth. And if you join Mr House in Fallout New Vegas I believe one of the ending slides mentions a return to sp...
45,804,686
Given a variable number of strings, I'd like to one-hot encode them as in the following example: ``` s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' # desired result - NumPy array array([[ 1., 1., 1., 0., 0., 0.], [ 1., 0., 0., 1., 1., 0.], [ 0., 0., 1., 0., 1., 1.]])...
2017/08/21
[ "https://Stackoverflow.com/questions/45804686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7954504/" ]
If you do a slight refactoring so that you treat each sentence as a list of words thoughout, it removes a lot of the `split`ting and `join`ing you're having to do, and naturalises the behaviour of `word in s` a bit. However, a `set` is preferred for membership testing, as it can do this in `O(1)`, and you should only c...
A Set will make the in operator runs in O(1) on average. Change: ``` vec[num] = word in s ``` to: ``` vec[num] = word in set(s.split()) ``` Final version: ``` def encode(*args): """One-hot encode the given input strings""" unique = uniquewords(*args) feature_vectors = np.zeros((len(args), len(uniqu...
45,804,686
Given a variable number of strings, I'd like to one-hot encode them as in the following example: ``` s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' # desired result - NumPy array array([[ 1., 1., 1., 0., 0., 0.], [ 1., 0., 0., 1., 1., 0.], [ 0., 0., 1., 0., 1., 1.]])...
2017/08/21
[ "https://Stackoverflow.com/questions/45804686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7954504/" ]
Here's one approach - ``` def membership(list_strings): split_str = [i.split(" ") for i in list_strings] split_str_unq = np.unique(np.concatenate(split_str)) out = np.array([np.in1d(split_str_unq, b_i) for b_i in split_str]).astype(int) df_out = pd.DataFrame(out, columns = split_str_unq) return df_...
A Set will make the in operator runs in O(1) on average. Change: ``` vec[num] = word in s ``` to: ``` vec[num] = word in set(s.split()) ``` Final version: ``` def encode(*args): """One-hot encode the given input strings""" unique = uniquewords(*args) feature_vectors = np.zeros((len(args), len(uniqu...
45,804,686
Given a variable number of strings, I'd like to one-hot encode them as in the following example: ``` s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' # desired result - NumPy array array([[ 1., 1., 1., 0., 0., 0.], [ 1., 0., 0., 1., 1., 0.], [ 0., 0., 1., 0., 1., 1.]])...
2017/08/21
[ "https://Stackoverflow.com/questions/45804686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7954504/" ]
You can use pandas to create a one-hot encoding transformation from a list of lists (e.g. a list of strings where each each string is subsequently split into a list of words). ``` import pandas as pd s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' words = pd.Series([s1, s2, s3]) df = pd.melt(wor...
A Set will make the in operator runs in O(1) on average. Change: ``` vec[num] = word in s ``` to: ``` vec[num] = word in set(s.split()) ``` Final version: ``` def encode(*args): """One-hot encode the given input strings""" unique = uniquewords(*args) feature_vectors = np.zeros((len(args), len(uniqu...
45,804,686
Given a variable number of strings, I'd like to one-hot encode them as in the following example: ``` s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' # desired result - NumPy array array([[ 1., 1., 1., 0., 0., 0.], [ 1., 0., 0., 1., 1., 0.], [ 0., 0., 1., 0., 1., 1.]])...
2017/08/21
[ "https://Stackoverflow.com/questions/45804686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7954504/" ]
If you do a slight refactoring so that you treat each sentence as a list of words thoughout, it removes a lot of the `split`ting and `join`ing you're having to do, and naturalises the behaviour of `word in s` a bit. However, a `set` is preferred for membership testing, as it can do this in `O(1)`, and you should only c...
You can use pandas to create a one-hot encoding transformation from a list of lists (e.g. a list of strings where each each string is subsequently split into a list of words). ``` import pandas as pd s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' words = pd.Series([s1, s2, s3]) df = pd.melt(wor...
45,804,686
Given a variable number of strings, I'd like to one-hot encode them as in the following example: ``` s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' # desired result - NumPy array array([[ 1., 1., 1., 0., 0., 0.], [ 1., 0., 0., 1., 1., 0.], [ 0., 0., 1., 0., 1., 1.]])...
2017/08/21
[ "https://Stackoverflow.com/questions/45804686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7954504/" ]
Here's one approach - ``` def membership(list_strings): split_str = [i.split(" ") for i in list_strings] split_str_unq = np.unique(np.concatenate(split_str)) out = np.array([np.in1d(split_str_unq, b_i) for b_i in split_str]).astype(int) df_out = pd.DataFrame(out, columns = split_str_unq) return df_...
You can use pandas to create a one-hot encoding transformation from a list of lists (e.g. a list of strings where each each string is subsequently split into a list of words). ``` import pandas as pd s1 = 'awaken my love' s2 = 'awaken the beast' s3 = 'wake beast love' words = pd.Series([s1, s2, s3]) df = pd.melt(wor...
13,841,212
I have working web service. I had to use same code and develop REST web service. I have done it. When I was debugging it I found one unusual thing. Static constructors are not being called when I am debugging my `RESTWebService` project. All business logic is inside one DLL. Both `WebService` and `RESTWebService` proj...
2012/12/12
[ "https://Stackoverflow.com/questions/13841212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1099228/" ]
Don't check if it was called via a breakpoint - instead, when an instance/service mthod is called, check if the values are actually initialized. Or try to log something from the static constructor and see if it was called. The static constructor may be called before you have a chance to debug/break on it.
The static constructors should still be called, but this will happen when the hosting program first loads your DLL. It could be that the host (IIS I presume?) has the service loaded before you added your breakpoint. Try an IISRESET and then check again, you will need to attach to the iis worker process for debugging.
523,140
[1] Total number of 3-digit numbers which do not contain more than 2 different digits. [2] Total number of 5-digit numbers which do not contain more than 3 different digits. $\underline{\bf{My\; Try}}::$ I have formed different cases. $\bullet$ If all digits are different, like in the form $aaa$, where $a\in \{1,2...
2013/10/12
[ "https://math.stackexchange.com/questions/523140", "https://math.stackexchange.com", "https://math.stackexchange.com/users/14311/" ]
The fact that a $3$-digit number, by most definitions, cannot begin with $0$ complicates the analysis. The case where there is only one digit is easy, there are $9$ possibilities. We now count the $3$-digit numbers which have $2$ different digit. There are two subcases (i) $0$ is one of the digits, and (ii) all the...
So you want three digit numbers that have either two different digits or only one digit? The latter are easily found: $111, 222, \ldots, 999$. There are $9$ of these. Next, consider $11X$ and $1X1$. Then $X$ can be any digit but $1$, giving a total of $9$ possibilities. This gives a total of $18$ numbers. Similarly,...