qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
5,765
In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much * Falls (almost literally) into the trap set for him * Loses a duel against Darth Vader * Loses his (father's) lightsaber * Gets his hand crudely amputated And * Is barely saved by those he came to rescue So my...
2011/09/23
[ "https://scifi.stackexchange.com/questions/5765", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/2841/" ]
Cloud City is an unmitigated disaster from Luke's POV. Well, almost unmitigated; he survives. As DampeS8N comments, Yoda tried to stop him. Yoda knew Luke wasn't ready to face Vader. Not skilled enough in the Force and not emotionally ready. That which doesn't kill us makes us stronger, so the saying goes. It is absol...
Given that Lando aided in their escape and they managed to do just that.....Luke's arrival didn't do much. But serve as a lesson for what Yoda had duly warned; Do not take the easy way. By suspending his training he fought against a clearly superior opponent and lost. In Joseph Campbells Hero of a thousand faces, the s...
5,765
In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much * Falls (almost literally) into the trap set for him * Loses a duel against Darth Vader * Loses his (father's) lightsaber * Gets his hand crudely amputated And * Is barely saved by those he came to rescue So my...
2011/09/23
[ "https://scifi.stackexchange.com/questions/5765", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/2841/" ]
Luke, No. But [R2-D2](https://starwars.fandom.com/wiki/R2-D2#Galactic_Civil_War), which was Luke's companion when he came back from Dagobah, did a lot : > > The droid stayed with Luke as he flew to Cloud City. After being separated from his master in the city, he was spotted by C-3PO, who was in a disassembled stat...
In Luke's force vision he saw bad outcomes for both Han and Leia. By going to Cloud City he changed that vision, because Leia was ultimately able to escape with the help of Lando. If Luke hadn't shown up for the trap, something probably would have happened to Leia. Certainly if Vader wasn't preoccupied with waiting for...
5,765
In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much * Falls (almost literally) into the trap set for him * Loses a duel against Darth Vader * Loses his (father's) lightsaber * Gets his hand crudely amputated And * Is barely saved by those he came to rescue So my...
2011/09/23
[ "https://scifi.stackexchange.com/questions/5765", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/2841/" ]
Luke, No. But [R2-D2](https://starwars.fandom.com/wiki/R2-D2#Galactic_Civil_War), which was Luke's companion when he came back from Dagobah, did a lot : > > The droid stayed with Luke as he flew to Cloud City. After being separated from his master in the city, he was spotted by C-3PO, who was in a disassembled stat...
Given that Lando aided in their escape and they managed to do just that.....Luke's arrival didn't do much. But serve as a lesson for what Yoda had duly warned; Do not take the easy way. By suspending his training he fought against a clearly superior opponent and lost. In Joseph Campbells Hero of a thousand faces, the s...
5,765
In Star Wars - Episode V: The Empire Strikes Back, when Luke Skywalker goes to Cloud City, he pretty much * Falls (almost literally) into the trap set for him * Loses a duel against Darth Vader * Loses his (father's) lightsaber * Gets his hand crudely amputated And * Is barely saved by those he came to rescue So my...
2011/09/23
[ "https://scifi.stackexchange.com/questions/5765", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/2841/" ]
Luke, No. But [R2-D2](https://starwars.fandom.com/wiki/R2-D2#Galactic_Civil_War), which was Luke's companion when he came back from Dagobah, did a lot : > > The droid stayed with Luke as he flew to Cloud City. After being separated from his master in the city, he was spotted by C-3PO, who was in a disassembled stat...
He showed that he valued his friends over completing his Jedi training and thus, supposedly he values them more than learning the powers he would need to defeat Vader. To me, this shows that he was on the right path, balancing the desires of his heart (Annakin's downfall) over the strict adherence to Jedi rules (Yoda's...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
You probably want to just use a regular [`CheckBox`](http://developer.android.com/reference/android/widget/CheckBox.html) (which inherits from `Button` and thus `TextView`). `CheckedTextView` is designed to work with list views. Example `CheckBox` layout XML is below: ``` <CheckBox xmlns:android="http://schemas.an...
simple answer is to add your own onClickListener, and use : `isChecked()` method instead of `isSelected()`. ``` CheckedTextView chkBox = (CheckedTextView) findViewById(R.id.CheckedTextView01); chkBox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(((CheckedTextView) v)....
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
simple answer is to add your own onClickListener, and use : `isChecked()` method instead of `isSelected()`. ``` CheckedTextView chkBox = (CheckedTextView) findViewById(R.id.CheckedTextView01); chkBox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(((CheckedTextView) v)....
If you want more fine-grained control over the label and the checkbox, another alternative is to use RelativeLayout and the android:layout\_alignParentRight attribute: ``` <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/my_checkbo...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
It is possible, and somewhat simple to implement what you are looking for. Yes, `CheckedTextView` is used primarily for having a single `Checkable` view in the row of a `ListView`, which controls its children's checkable states using `choiceMode`. However, since CheckBox does not appear to support a right-aligned check...
This layout looks and behaves the same way as `CheckedTextView`: ``` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="?attr/dropdownListPreferredItemHeight" android:gravity="center_vertical" > <TextView android:...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
It is possible, and somewhat simple to implement what you are looking for. Yes, `CheckedTextView` is used primarily for having a single `Checkable` view in the row of a `ListView`, which controls its children's checkable states using `choiceMode`. However, since CheckBox does not appear to support a right-aligned check...
You can use and toggle CheckedTextView by the following way: In layout: ``` <CheckedTextView android:id="@+id/cv_id" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Some text here" android:textSize="18sp" android:gravity="center_v...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
You probably want to just use a regular [`CheckBox`](http://developer.android.com/reference/android/widget/CheckBox.html) (which inherits from `Button` and thus `TextView`). `CheckedTextView` is designed to work with list views. Example `CheckBox` layout XML is below: ``` <CheckBox xmlns:android="http://schemas.an...
Here is my use in SingleChoiceDialog 1.select\_dialog\_singlechoice.xml ``` <?xml version="1.0" encoding="UTF-8"?> <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="@style/PopupSelectList" android:checkMark="@drawable/radio" android:ellip...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
It is possible, and somewhat simple to implement what you are looking for. Yes, `CheckedTextView` is used primarily for having a single `Checkable` view in the row of a `ListView`, which controls its children's checkable states using `choiceMode`. However, since CheckBox does not appear to support a right-aligned check...
simple answer is to add your own onClickListener, and use : `isChecked()` method instead of `isSelected()`. ``` CheckedTextView chkBox = (CheckedTextView) findViewById(R.id.CheckedTextView01); chkBox.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(((CheckedTextView) v)....
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
You probably want to just use a regular [`CheckBox`](http://developer.android.com/reference/android/widget/CheckBox.html) (which inherits from `Button` and thus `TextView`). `CheckedTextView` is designed to work with list views. Example `CheckBox` layout XML is below: ``` <CheckBox xmlns:android="http://schemas.an...
If you want more fine-grained control over the label and the checkbox, another alternative is to use RelativeLayout and the android:layout\_alignParentRight attribute: ``` <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/my_checkbo...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
This layout looks and behaves the same way as `CheckedTextView`: ``` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="?attr/dropdownListPreferredItemHeight" android:gravity="center_vertical" > <TextView android:...
If you want more fine-grained control over the label and the checkbox, another alternative is to use RelativeLayout and the android:layout\_alignParentRight attribute: ``` <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/my_checkbo...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
It is possible, and somewhat simple to implement what you are looking for. Yes, `CheckedTextView` is used primarily for having a single `Checkable` view in the row of a `ListView`, which controls its children's checkable states using `choiceMode`. However, since CheckBox does not appear to support a right-aligned check...
You probably want to just use a regular [`CheckBox`](http://developer.android.com/reference/android/widget/CheckBox.html) (which inherits from `Button` and thus `TextView`). `CheckedTextView` is designed to work with list views. Example `CheckBox` layout XML is below: ``` <CheckBox xmlns:android="http://schemas.an...
2,627,222
Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design? ``` <CheckedTextView xmlns:android="http://schemas...
2010/04/13
[ "https://Stackoverflow.com/questions/2627222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253800/" ]
It is possible, and somewhat simple to implement what you are looking for. Yes, `CheckedTextView` is used primarily for having a single `Checkable` view in the row of a `ListView`, which controls its children's checkable states using `choiceMode`. However, since CheckBox does not appear to support a right-aligned check...
Here is my use in SingleChoiceDialog 1.select\_dialog\_singlechoice.xml ``` <?xml version="1.0" encoding="UTF-8"?> <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" style="@style/PopupSelectList" android:checkMark="@drawable/radio" android:ellip...
20,425,633
I am using adventureworks database. I want to get product from the database whose price is second highest. I am using co-related query for this purpose. I am not quite sure what I might be missing here, in following query. ``` SELECT ProductID, Name, ListPrice FROM SalesLT.Product p1 WHERE 2 = ( SELECT COUNT(p2.Pro...
2013/12/06
[ "https://Stackoverflow.com/questions/20425633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/164811/" ]
Here is the [**SQL Fiddle**](http://sqlfiddle.com/#!6/5c720/1/0) that demonstrates the following query: ``` SELECT TOP(1) ProductID, Name, ListPrice FROM ( SELECT TOP(2) ProductID, Name, ListPrice FROM Product ORDER BY ListPrice DESC ) mq ORDER BY ListPrice ``` In the above example I am getting the top 2 r...
[**SQL Fiddle**](http://sqlfiddle.com/#!6/5c720/5/0) example of the following: ``` SELECT ProductID, Name, ListPrice FROM ( SELECT top(2) ProductID, Name, ListPrice, ROW_NUMBER() OVER(ORDER BY ListPrice DESC) rowNum FROM Product ) twoEntries WHERE rowNum = 2 ```
35,164,253
I have the following program, which uses the ftd2xx library to write a byte to an USB device and then reads the reply. ``` #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdarg.h> #include "../ftd2xx.h" void fatal (const char *format,...) { va_list argp; fprintf(stderr, "FATAL: "); va_star...
2016/02/02
[ "https://Stackoverflow.com/questions/35164253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5864706/" ]
What you're describing sounds like there's a bug in the ftd2xx library -- it's possible that the library performs some initialization when it's loaded which becomes invalid when the process ID changes. The ftd2xx library is closed-source and distributed under a license that prohibits reverse-engineering, so there's no...
The library is strange - I had the same problem. For me it helped to load the library dynamically after calling the `fork()`. Check this post <https://stackoverflow.com/a/7626550/907675> to see how to dynamically load a function from a library.
27,056,889
I am trying to make a function that splits a list of variable length into three lists of even length in order. The following splits it into three, but processes inserts them into each list one at a time. An example of what I want is: ``` [1, 2, 3, 4, 5] -> [1, 2], [3, 4], [5] ``` Another example would be: ``` [8,...
2014/11/21
[ "https://Stackoverflow.com/questions/27056889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3471144/" ]
The answer by @Boris does not terminate when the length of the list of the first argument is not known. To see this, there is no need to look any further than the first goal with a [failure-slice](/questions/tagged/failure-slice "show questions tagged 'failure-slice'"): ``` div(L, L1, L2, L3) :- length(L, Len), *...
``` div(L, L1, L2, L3) :- append(L1, L1_suffix, L), append(L2, L3, L1_suffix). ``` Do you see how this splits the three lists? Now you don't say how long you expect the lists `L1`, `L2`, and `L3` to be. You can use `length/2` to get the length of `L` and set the length of the three results if you don't want t...
50,698,086
I am running on Python 3.6.1 and today I missed a comma, as follows: ``` nt = namedtuple('Record', ['c', 'a' 'b']) # instead the following is what I actually want nt = namedtuple('Record', ['c', 'a', 'b']) ``` But I just wonder why the first way is valid Python in any way? Should not it complains with syntax error? ...
2018/06/05
[ "https://Stackoverflow.com/questions/50698086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2379736/" ]
You need to pass `$listing` to your view like this: ``` return view('user.dashboard', compact('listing'); ``` Edit: Of course your variables must be named the same in your controller and view. You now have a mismatch as you name your variable `$listing` in your controller but call it as `$listings` in your view. Yo...
I think you are not importing model in the controller using namespace. try to check using "Use auth" namespace ``` use App\Listing_Model; use auth; class DashboardController extends Controller { public function index() { $listing = new Listing_Model; $listing->user_id = auth()->user()->id; $listing...
50,698,086
I am running on Python 3.6.1 and today I missed a comma, as follows: ``` nt = namedtuple('Record', ['c', 'a' 'b']) # instead the following is what I actually want nt = namedtuple('Record', ['c', 'a', 'b']) ``` But I just wonder why the first way is valid Python in any way? Should not it complains with syntax error? ...
2018/06/05
[ "https://Stackoverflow.com/questions/50698086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2379736/" ]
Change ``` return view('user.dashboard'); ``` into ``` return view('user.dashboard', compact('listing')); ``` I think the reason is pretty clear.
I think you are not importing model in the controller using namespace. try to check using "Use auth" namespace ``` use App\Listing_Model; use auth; class DashboardController extends Controller { public function index() { $listing = new Listing_Model; $listing->user_id = auth()->user()->id; $listing...
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
In Java, String and Integer both are inherited from Object. So you can use Object type to define a general array. ``` String[] strArray = { "a", "b", "c" }; Integer[] intArray = { 1, 2, 3 }; Object[] arr = new Object[strArray.length + intArray.length]; int j = 0; for (int i = 0; i < strArray.lengt...
> > The first instinct would be to me: > > > In Java you just can have one Type for container, if you want to mix two types, you have to create some abstraction, like an Interface, or create another way to relate your String with your Integer. > > But > > > consider the @kimdung answer if you *just want to m...
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
In Java, String and Integer both are inherited from Object. So you can use Object type to define a general array. ``` String[] strArray = { "a", "b", "c" }; Integer[] intArray = { 1, 2, 3 }; Object[] arr = new Object[strArray.length + intArray.length]; int j = 0; for (int i = 0; i < strArray.lengt...
You need to use object type array, as in your case you are using integer wrapper object and string, which can be merge as object in java
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
In Java, String and Integer both are inherited from Object. So you can use Object type to define a general array. ``` String[] strArray = { "a", "b", "c" }; Integer[] intArray = { 1, 2, 3 }; Object[] arr = new Object[strArray.length + intArray.length]; int j = 0; for (int i = 0; i < strArray.lengt...
Make a Sting array and merge both into that array, you will have to convert Integer to String while merging and the converse when you are retrieving for any purpose ``` for(int i=0; i<intArray.length; i++) { mergerArray[i] = String.value(intArray[i]); } ```
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
In Java, String and Integer both are inherited from Object. So you can use Object type to define a general array. ``` String[] strArray = { "a", "b", "c" }; Integer[] intArray = { 1, 2, 3 }; Object[] arr = new Object[strArray.length + intArray.length]; int j = 0; for (int i = 0; i < strArray.lengt...
You can use `System.arraycopy();` ``` String[] strArray={"a","b","c"}; Integer[] intArray={1,2,3}; Object[] objArray = new Object[strArray.length + intArray.length]; System.arraycopy( strArray, 0, objArray, 0, strArray.length ); System.arraycopy( intArray, 0, objArray, strArray.length, intArray.length ); ``` Rather...
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
In Java, String and Integer both are inherited from Object. So you can use Object type to define a general array. ``` String[] strArray = { "a", "b", "c" }; Integer[] intArray = { 1, 2, 3 }; Object[] arr = new Object[strArray.length + intArray.length]; int j = 0; for (int i = 0; i < strArray.lengt...
It is not possible to join two arrays of difference types. But I want to recommend you to use instances java.util.ArrayList instead of array. For example you can join these two different arrays. ``` ArrayList<Character> strArr= new ArrayList<Character>(); strArr.add(new Character('a')); strArr.add(new Character('b'));...
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
> > The first instinct would be to me: > > > In Java you just can have one Type for container, if you want to mix two types, you have to create some abstraction, like an Interface, or create another way to relate your String with your Integer. > > But > > > consider the @kimdung answer if you *just want to m...
You need to use object type array, as in your case you are using integer wrapper object and string, which can be merge as object in java
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
> > The first instinct would be to me: > > > In Java you just can have one Type for container, if you want to mix two types, you have to create some abstraction, like an Interface, or create another way to relate your String with your Integer. > > But > > > consider the @kimdung answer if you *just want to m...
Make a Sting array and merge both into that array, you will have to convert Integer to String while merging and the converse when you are retrieving for any purpose ``` for(int i=0; i<intArray.length; i++) { mergerArray[i] = String.value(intArray[i]); } ```
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
> > The first instinct would be to me: > > > In Java you just can have one Type for container, if you want to mix two types, you have to create some abstraction, like an Interface, or create another way to relate your String with your Integer. > > But > > > consider the @kimdung answer if you *just want to m...
You can use `System.arraycopy();` ``` String[] strArray={"a","b","c"}; Integer[] intArray={1,2,3}; Object[] objArray = new Object[strArray.length + intArray.length]; System.arraycopy( strArray, 0, objArray, 0, strArray.length ); System.arraycopy( intArray, 0, objArray, strArray.length, intArray.length ); ``` Rather...
44,426,621
I have an array called `polls` with many objects `poll`. Each poll has a property `moduleState` which is initally set to the string "notVoted". The moduleState for an individual poll may later be set to the string "voted". Here is the template for one of my partials: ``` <div ng-init="loadPage()"> <div ng-repeat=...
2017/06/08
[ "https://Stackoverflow.com/questions/44426621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4456167/" ]
> > The first instinct would be to me: > > > In Java you just can have one Type for container, if you want to mix two types, you have to create some abstraction, like an Interface, or create another way to relate your String with your Integer. > > But > > > consider the @kimdung answer if you *just want to m...
It is not possible to join two arrays of difference types. But I want to recommend you to use instances java.util.ArrayList instead of array. For example you can join these two different arrays. ``` ArrayList<Character> strArr= new ArrayList<Character>(); strArr.add(new Character('a')); strArr.add(new Character('b'));...
13,672,878
I have this working code: ``` /* Include files */ #include <iostream> #include <string> #include <limits> using namespace std; void fnMainMenu(char s); /****************************************************************************** * Function: fnUpdateSalary * Description: Update employee salary *******************...
2012/12/02
[ "https://Stackoverflow.com/questions/13672878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/894470/" ]
The parameter doesn’t seem to serve a real purpose anyway. Passing `b` into the main menu function certainly achieves nothing. If you just want to distinguish between admin and non-admin access, change the type and usage of the argument: ``` void fnMainMenu(bool is_admin) { if (is_admin) cout << "Admin\n";...
Since you're writing C++ code and `data` seems to be relatively long-lived with respect to the application logic, it would perhaps make sense to regroup these functions into a class. `data` could be a data member of this class, and `fnUpdateSalary`, `fnLog`, `fnMainMenu` methods. ``` class Application { public: App...
13,672,878
I have this working code: ``` /* Include files */ #include <iostream> #include <string> #include <limits> using namespace std; void fnMainMenu(char s); /****************************************************************************** * Function: fnUpdateSalary * Description: Update employee salary *******************...
2012/12/02
[ "https://Stackoverflow.com/questions/13672878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/894470/" ]
The parameter doesn’t seem to serve a real purpose anyway. Passing `b` into the main menu function certainly achieves nothing. If you just want to distinguish between admin and non-admin access, change the type and usage of the argument: ``` void fnMainMenu(bool is_admin) { if (is_admin) cout << "Admin\n";...
If I fully understand what you are doing, you need a combination of two things. Firstly, a static variable in fnMainMenu and secondly a default parameter: ``` fnMainMenu(char s = '\0') { static char c; if(s != '\0') c = s; ... ... } ``` The "static" keyword means that the character will be preserved across f...
46,139,207
I am busy with a angular4 app where i'm trying to conditionally hide/show two div elements using \*ngIf with very strange results. I want to show the project form when newItem is false or null and show the item form when newItem is true. The div containing the item form gets displayed as it should when newItem is true ...
2017/09/10
[ "https://Stackoverflow.com/questions/46139207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2094257/" ]
Your error has nothing to do with `ngIf`. I see a lot of misprints in your code ``` itemsForm => itemForm Width => width priceM3 => priceM2 ```
Try this : ``` <div class="container-fluid"> <div class="row"> <div class="col-md-4 col-md-push-4 page-header"> <h1>Quote generator</h1> </div> </div> <div class="row"> <div class="col-md-4 col-md-push-4" *ngIf="!newItem"> <button class="btn btn-primary pull-right" ...
4,146,160
Given the equations of two lines I have to find the parameter $k$ so the lines don't interesect: \begin{gather\*} L\_1: \left\{(x,y,z)\in \Bbb{R}^3 \,\middle|\, x+2=\frac{3-y}{2}=\frac{z-1}{2} \right\}\\ L\_2: \{(x,y,z)\in \Bbb{R}^3 \mid x=a-2k,\ y=2a+k,\ z=4+2k,\ k\in \Bbb{R} \} \end{gather\*} I am trying to equalize ...
2021/05/21
[ "https://math.stackexchange.com/questions/4146160", "https://math.stackexchange.com", "https://math.stackexchange.com/users/930088/" ]
The terms "formula" and "equation" can be thought of as synonyms, but the word "formula" has a specific [connotation](https://www.dictionary.com/browse/connotation) to it. I think of a formula as more of a *recipe* for a specific output. The formula *for distance* is the equation $d = rt$, which is a recipe for calcula...
A formula can be seen as an expression that returns a value given $n$ number of parameters. An example is $$A=S^2$$ This "formula" gives the area of a square with side length $S$. On the other hand, a function is a special type of relationship between two sets called domain and codomain: each element in the domain is m...
48,493,939
Maybe this's a newbie question.But I've been searching high and low with no luck as whatever I tried didn't work. I have a `DataGridView` named `dgvDeviceList` which contains 5 columns:ID,Device Name,Mac Address,RSSI and Advertisement Type in the FormMain window. When I use a method to scan the Bluetooth device nearb...
2018/01/29
[ "https://Stackoverflow.com/questions/48493939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7078356/" ]
Yes. It is possible. To modify the `global_step` in machine B, you have to perform the following steps: Calculate the corresponding `global_step` ----------------------------------------- In the above example, `global_step` in machine A is 501 and the total number of trained batches is 501x10=5010. So the correspond...
If you want to keep decayed learning rate same on Machine B as it was on A, you can tweak other parameters of the function `tf.train.exponential_dacay` . For Example, you can change decay rate on the new machine. In order to find that `decay_rate` you need to know how `exponential_decay` is computed. > > decay\_lear...
21,394,296
Imagine I'm reading in a csv file of numbers that looks like this: ``` 1,6.2,10 5.4,5,11 17,1.5,5 ... ``` And it's really really long. I'm going to iterate through this file with a csv reader like this: ``` import csv reader = csv.reader('numbers.csv') ``` Now assume I have some function that can take an iterat...
2014/01/27
[ "https://Stackoverflow.com/questions/21394296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2998052/" ]
If you're comfortable with a more functional approach you can use functools.reduce to iterate through the file, pulling only two rows into memory at once, and accumulating the column-maximums as it goes. ``` import csv from functools import reduce def column_max(row1, row2): # zip contiguous rows and apply max to...
I would just move away from using a function which you pass the iterator but instead iterate on your own over the reader: ``` maxes = [] for row in reader: for i in range(len(row)): if i > len(maxes): maxes.append(row[i]) else: maxes[i] = max(maxes[i], row[i]) ``` At the e...
21,394,296
Imagine I'm reading in a csv file of numbers that looks like this: ``` 1,6.2,10 5.4,5,11 17,1.5,5 ... ``` And it's really really long. I'm going to iterate through this file with a csv reader like this: ``` import csv reader = csv.reader('numbers.csv') ``` Now assume I have some function that can take an iterat...
2014/01/27
[ "https://Stackoverflow.com/questions/21394296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2998052/" ]
I would just move away from using a function which you pass the iterator but instead iterate on your own over the reader: ``` maxes = [] for row in reader: for i in range(len(row)): if i > len(maxes): maxes.append(row[i]) else: maxes[i] = max(maxes[i], row[i]) ``` At the e...
``` def col_max(x0,x1): """x0 is a list of the accumulated maxes so far, x1 is a line from the file.""" return [max(a,b) for a,b in zip(x0,x1)] ``` Now functools.reduce(col\_max,reader,initializer) will return just what you want. You will have to supply initializer as a list of -inf's of the correct lengt...
21,394,296
Imagine I'm reading in a csv file of numbers that looks like this: ``` 1,6.2,10 5.4,5,11 17,1.5,5 ... ``` And it's really really long. I'm going to iterate through this file with a csv reader like this: ``` import csv reader = csv.reader('numbers.csv') ``` Now assume I have some function that can take an iterat...
2014/01/27
[ "https://Stackoverflow.com/questions/21394296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2998052/" ]
If you're comfortable with a more functional approach you can use functools.reduce to iterate through the file, pulling only two rows into memory at once, and accumulating the column-maximums as it goes. ``` import csv from functools import reduce def column_max(row1, row2): # zip contiguous rows and apply max to...
``` def col_max(x0,x1): """x0 is a list of the accumulated maxes so far, x1 is a line from the file.""" return [max(a,b) for a,b in zip(x0,x1)] ``` Now functools.reduce(col\_max,reader,initializer) will return just what you want. You will have to supply initializer as a list of -inf's of the correct lengt...
2,937,888
I have a c# winform application that when used spy++, gives "WindowsForms10.Window.8.app.0.33c0d9d" as class name. Is there a way to change that to something more friendly?
2010/05/30
[ "https://Stackoverflow.com/questions/2937888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/156144/" ]
There isn't. The last hex number is the hash code of the AppDomain that owns the window. The digit before that starts at 0 but increases if other windows were created with the same class name. The number before that is the value of the class style. Clearly you can only guess this name correctly if you have insider know...
if you need friendly names for your controls use the Accessibility properties. that is the common way.
45,564,362
Hi I am having a problem in printing the report. I have coded the report format in html and then made its module and attached it with the relevant model. and upload it on my online server First I was receiving this error : Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using ...
2017/08/08
[ "https://Stackoverflow.com/questions/45564362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7591427/" ]
Try this Solution : Downlaod this -<https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb> and then follow the step : (IF THE ABOUT WKHTMLTOPDF IS NOT INSTALL THAN AND THAN 1ST STEP HAVE TO DO IT) 1) sudo dpkg -i <http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-t...
Try this solution: 1. Download `wkhtmltopdf` <https://downloads.wkhtmltopdf.org/0.12/0.12.1/> 2. Install \*.deb file using this command, `sudo dpkg -i file_name.deb` 3. If any error occur during installation execute, `sudo apt-get install -f` 4. sudo cp /usr/local/bin/wkhtmltopdf /usr/bin 5. Restart odoo server and tr...
45,564,362
Hi I am having a problem in printing the report. I have coded the report format in html and then made its module and attached it with the relevant model. and upload it on my online server First I was receiving this error : Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using ...
2017/08/08
[ "https://Stackoverflow.com/questions/45564362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7591427/" ]
Try this Solution : Downlaod this -<https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb> and then follow the step : (IF THE ABOUT WKHTMLTOPDF IS NOT INSTALL THAN AND THAN 1ST STEP HAVE TO DO IT) 1) sudo dpkg -i <http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-t...
Try with this one might it ill help you.. ``` sudo pip install Wkhtmltopdf ``` Hope this will solve your problem.
45,564,362
Hi I am having a problem in printing the report. I have coded the report format in html and then made its module and attached it with the relevant model. and upload it on my online server First I was receiving this error : Wkhtmltopdf failed (error code: -6). Message: The switch --header-spacing, is not support using ...
2017/08/08
[ "https://Stackoverflow.com/questions/45564362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7591427/" ]
Try this Solution : Downlaod this -<https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb> and then follow the step : (IF THE ABOUT WKHTMLTOPDF IS NOT INSTALL THAN AND THAN 1ST STEP HAVE TO DO IT) 1) sudo dpkg -i <http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-t...
I tried all possible solutions, the only one worked so far is the installation using pip (pip3).
7,978,143
A part of my form is a place where users can choose days where they are closed and also the opening hours on days they are open. I have made a fiddle, this should make it clear. This form is being generated dynamicly in php because it will need to be multilanguage. <http://jsfiddle.net/ZXSKH/> I need help on how to...
2011/11/02
[ "https://Stackoverflow.com/questions/7978143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1012456/" ]
You mentioned that every input field (checkboxes, dropdowns...) are created dinamically, so use value attribute of each checkbox to trigger enable/disable action. I have edited your fiddle: <http://jsfiddle.net/ZXSKH/16/> I'm afraid I'm not very familiar with MooTools, so I wrote a little script using jQuery but I ho...
You can give an `id` to the selectboxes and check boxes and use the disabled attribute to disable the select box as below: `$('#id').attr('disabled','disabled');`
7,978,143
A part of my form is a place where users can choose days where they are closed and also the opening hours on days they are open. I have made a fiddle, this should make it clear. This form is being generated dynamicly in php because it will need to be multilanguage. <http://jsfiddle.net/ZXSKH/> I need help on how to...
2011/11/02
[ "https://Stackoverflow.com/questions/7978143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1012456/" ]
You mentioned that every input field (checkboxes, dropdowns...) are created dinamically, so use value attribute of each checkbox to trigger enable/disable action. I have edited your fiddle: <http://jsfiddle.net/ZXSKH/16/> I'm afraid I'm not very familiar with MooTools, so I wrote a little script using jQuery but I ho...
you can fire an event on selecting the checkbox and use the above answer as suggested below
1,102,801
I would like to access (to view) the list of "Recently viewed" in *Evince* documents from the terminal, without starting *Evince*. Or maybe can I find a text document where this list is stored? I am using Ubuntu 16.04. Paradisally, I would like to find a complete list of *Evince* documents opened during the previous s...
2018/12/18
[ "https://askubuntu.com/questions/1102801", "https://askubuntu.com", "https://askubuntu.com/users/905310/" ]
By running `strace -e open evince some.pdf` I was able to find the path used and it is ``` ~/.local/share/recently-used.xbel ``` I have verified that this is the case for both 14.04 and 16.04. This file contains recently used items from many applications, so you'd need to filter it by application name. The file is i...
(first Install `xidel` xml/xpath processor if not yet installed) `~/.local/share/recently-used.xbel` is an XML document with bookmarks of recently used documents. In order to extract the filenames of the `evince` entries, we must provide a XPath expression that: * looks for bookmarks with attribute `name` = "Docume...
65,087,007
I am on this page: [Google Drive Login](https://accounts.google.com/signin/v2/identifier?service=wise&passive=true&continue=http%3A%2F%2Fdrive.google.com%2F%3Futm_source%3Den&utm_medium=button&utm_campaign=web&utm_content=gotodrive&usp=gtd&ltmpl=drive&flowName=GlifWebSignIn&flowEntry=ServiceLogin) Wanting to select ...
2020/12/01
[ "https://Stackoverflow.com/questions/65087007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/984975/" ]
The *Email or Phone* field while accessing *Google Drive* login page is no different from the *Email or Phone* field during *GMail* login. To send a *character sequence* to the element you can use either of the following [Locator Strategies](https://stackoverflow.com/questions/48369043/official-locator-strategies-for-...
``` from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver = webdriver.Chrome('./chromedriver.exe') driver.get("https://accounts.google.com/signin/v2/identifier?service=wise&passive=true&continue=http%3A%2F%2Fdrive.google.com%2F%3Futm_source%3Den&utm_medium=button&utm_campaign...
35,669,191
I have an app with the following flow (all activities in the same app): * Activity A starts activity B with `startActivity`. It may add a boolean "autoContinue"=true extra. * When activity B starts, it checks the "autoContinue" flag in `onCreate` with `getIntent().hasExtra("autoContinue")`. If the flag is true, it imm...
2016/02/27
[ "https://Stackoverflow.com/questions/35669191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/846987/" ]
You're on the right track in removing the extra from the intent. However the `Intent` associated with the `Activity` still has the extra in it. You need to call `setIntent()` after removing the extra. So your code will look like this: ``` final Intent intent = getIntent(); final Bundle extras = intent.getExtras(); if ...
You can pass extras to previous activity while finishing if you have started the activity with `startActivityForResult` method. See the following code example: ``` public void finishActivity() { Intent returnIntent = new Intent(); returnIntent.putExtra("KEY", "Value"); getActivity().setResult(...
16,131,801
I want to get last option the user Chosen before the refresh This is the code select menu: ``` <select name="category" id="category" onChange="BK.Ajax.Updates('newfile.php?id='+document.getElementById('category').value,'ajx');"> <option>.....</option> <? ...
2013/04/21
[ "https://Stackoverflow.com/questions/16131801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1951527/" ]
In your \*.h file declare an action like: ``` -(IBAction)buttonTapped:(UIButton *)sender; ``` Assign the "Touch Up Inside" action to this action. In your \*.m file do the following: ``` -(IBAction)buttonTapped:(UIButton *)sender { switch(sender.tag) { case 1: // action for button 1 case 2: // a...
Just log and see the tag of button u clicked. ``` -(IBAction)buttonClicked:(UIButton *)sender { int tag=sender.tag; NSLog(@"%d",tag); } ```
16,131,801
I want to get last option the user Chosen before the refresh This is the code select menu: ``` <select name="category" id="category" onChange="BK.Ajax.Updates('newfile.php?id='+document.getElementById('category').value,'ajx');"> <option>.....</option> <? ...
2013/04/21
[ "https://Stackoverflow.com/questions/16131801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1951527/" ]
In your \*.h file declare an action like: ``` -(IBAction)buttonTapped:(UIButton *)sender; ``` Assign the "Touch Up Inside" action to this action. In your \*.m file do the following: ``` -(IBAction)buttonTapped:(UIButton *)sender { switch(sender.tag) { case 1: // action for button 1 case 2: // a...
You can add target of that button ``` [buttonName addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; ``` --- ``` -(void)buttonClicked:(UIButton *)sender { int tag=sender.tag; UIButton *btn = (UIButton *)sender; //Now you can access all he properties of that b...
8,235,261
I have a tab bar driven app. The app has some view controllers that are stacked on each other the usual way. Some of these view controllers may be top level - meaning instantiated directly from the tab bar controller. Those do not have a "back" button in their navigation bar. Some of these can be called at many po...
2011/11/22
[ "https://Stackoverflow.com/questions/8235261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854396/" ]
Consider just getting the index of the view controller within the navigation controller's `viewControllers` array property. If it's zero, then the view controller is the top controller (without a back button).
[UINavigationController](http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html) has topViewController and visibleViewController properties which could help you out. If you just want to know if there is a back button or not you can check the backBarBu...
8,235,261
I have a tab bar driven app. The app has some view controllers that are stacked on each other the usual way. Some of these view controllers may be top level - meaning instantiated directly from the tab bar controller. Those do not have a "back" button in their navigation bar. Some of these can be called at many po...
2011/11/22
[ "https://Stackoverflow.com/questions/8235261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854396/" ]
Well... from what you are describing, I can understand that you have a `UITabBarController` with a list of view controller in each tab, and each view controller is a navigation controller, which further leads to new views. And you are interested in finding if a particular view is the first view or the second view, and ...
[UINavigationController](http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html) has topViewController and visibleViewController properties which could help you out. If you just want to know if there is a back button or not you can check the backBarBu...
8,235,261
I have a tab bar driven app. The app has some view controllers that are stacked on each other the usual way. Some of these view controllers may be top level - meaning instantiated directly from the tab bar controller. Those do not have a "back" button in their navigation bar. Some of these can be called at many po...
2011/11/22
[ "https://Stackoverflow.com/questions/8235261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854396/" ]
You could ask your view controller for it's `-navigationController`, ask the navigation controller for its `-viewControllers` stack, and see what the `-count` of that stack is. The currently-showing view controller is the "last" item in the stack (index *n*-1). The "back" view controller second-to-last (*n*-2 — *n* b...
[UINavigationController](http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationController_Class/Reference/Reference.html) has topViewController and visibleViewController properties which could help you out. If you just want to know if there is a back button or not you can check the backBarBu...
8,235,261
I have a tab bar driven app. The app has some view controllers that are stacked on each other the usual way. Some of these view controllers may be top level - meaning instantiated directly from the tab bar controller. Those do not have a "back" button in their navigation bar. Some of these can be called at many po...
2011/11/22
[ "https://Stackoverflow.com/questions/8235261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854396/" ]
Well... from what you are describing, I can understand that you have a `UITabBarController` with a list of view controller in each tab, and each view controller is a navigation controller, which further leads to new views. And you are interested in finding if a particular view is the first view or the second view, and ...
Consider just getting the index of the view controller within the navigation controller's `viewControllers` array property. If it's zero, then the view controller is the top controller (without a back button).
8,235,261
I have a tab bar driven app. The app has some view controllers that are stacked on each other the usual way. Some of these view controllers may be top level - meaning instantiated directly from the tab bar controller. Those do not have a "back" button in their navigation bar. Some of these can be called at many po...
2011/11/22
[ "https://Stackoverflow.com/questions/8235261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/854396/" ]
Well... from what you are describing, I can understand that you have a `UITabBarController` with a list of view controller in each tab, and each view controller is a navigation controller, which further leads to new views. And you are interested in finding if a particular view is the first view or the second view, and ...
You could ask your view controller for it's `-navigationController`, ask the navigation controller for its `-viewControllers` stack, and see what the `-count` of that stack is. The currently-showing view controller is the "last" item in the stack (index *n*-1). The "back" view controller second-to-last (*n*-2 — *n* b...
28,874,637
This what i need. For table `X` there is column `name`. ``` `{:id => 1,:name => a} {:id => 2,:name => b} {:id => 3,:name => a} {:id => 4,:name => b}` ``` The about hash list is table `X` content. Now i want to select last record for name `['a','b']`. `X.where(:name => ['a','b'])` will give me all records but i w...
2015/03/05
[ "https://Stackoverflow.com/questions/28874637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4439275/" ]
You can try this, ``` X.group(:name).having('created_at = MAX(created_at)') ```
You can try this for get only id: ``` X.where(name: ['a','b']).group(:name).maximum(:id) ```
8,114
Is it fixed that words will always take a specific preposition after them? I am reading a book "High school English grammar". It says for example > > The following nouns take preposition **for** after them. :- ambition, blame, aptitude candidate, match, ... > > > and > > The following nouns take preposition...
2011/01/06
[ "https://english.stackexchange.com/questions/8114", "https://english.stackexchange.com", "https://english.stackexchange.com/users/2881/" ]
For the most part, your book is correct, but you are right to be suspicious. The appropriate word *can* change depending on the intended meaning of the sentence in some cases. Here are a few examples: * I have had a change **of** heart It is a change **for** the better * What we have here is a failure **to** commun...
The truth is somewhere in between. A few points: * There are rules of grammar that advise writers on how to write in the "best" way, whatever that may be. * There is a certain consensus among educated writers about many of those rules. The rules for the prepositions you mentioned are accepted by most of them, or so I ...
8,114
Is it fixed that words will always take a specific preposition after them? I am reading a book "High school English grammar". It says for example > > The following nouns take preposition **for** after them. :- ambition, blame, aptitude candidate, match, ... > > > and > > The following nouns take preposition...
2011/01/06
[ "https://english.stackexchange.com/questions/8114", "https://english.stackexchange.com", "https://english.stackexchange.com/users/2881/" ]
The truth is somewhere in between. A few points: * There are rules of grammar that advise writers on how to write in the "best" way, whatever that may be. * There is a certain consensus among educated writers about many of those rules. The rules for the prepositions you mentioned are accepted by most of them, or so I ...
to + verb is a different part of grammar which is known as to-infinitive which comes under "Determiners". verb never takes any other form except first form irrespective of the tense of the sentence
8,114
Is it fixed that words will always take a specific preposition after them? I am reading a book "High school English grammar". It says for example > > The following nouns take preposition **for** after them. :- ambition, blame, aptitude candidate, match, ... > > > and > > The following nouns take preposition...
2011/01/06
[ "https://english.stackexchange.com/questions/8114", "https://english.stackexchange.com", "https://english.stackexchange.com/users/2881/" ]
For the most part, your book is correct, but you are right to be suspicious. The appropriate word *can* change depending on the intended meaning of the sentence in some cases. Here are a few examples: * I have had a change **of** heart It is a change **for** the better * What we have here is a failure **to** commun...
to + verb is a different part of grammar which is known as to-infinitive which comes under "Determiners". verb never takes any other form except first form irrespective of the tense of the sentence
18,682,269
``` Sub TEST() If cells(i, "R").Value <> "UK" Then cells(i, "R").Interior.ColorIndex = 3 End If End Sub ``` If I run this program it throws application defined error \ I am new to Excel (beginner) How to correct this error!!! Thanks In advance
2013/09/08
[ "https://Stackoverflow.com/questions/18682269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2758599/" ]
I think the issue is "R" that I know of the cells method takes 2 parameters one is rows the other is columns (in that order) but this is done by number not letter so if you change it to cell(1,18) then the code above works fine. This link may also be useful to learn more, among other things it describes how you would ...
First you have to define i variable for example: Dim i as variant
18,682,269
``` Sub TEST() If cells(i, "R").Value <> "UK" Then cells(i, "R").Interior.ColorIndex = 3 End If End Sub ``` If I run this program it throws application defined error \ I am new to Excel (beginner) How to correct this error!!! Thanks In advance
2013/09/08
[ "https://Stackoverflow.com/questions/18682269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2758599/" ]
The problem is that the variable **i** has not been assigned a value. VBA assumes that it is zero. Since **i** is used to determine the row of the cell, Excel throws an exception because there is no row 0!
First you have to define i variable for example: Dim i as variant
65,372,522
In DDD i have an aggregate `Lobby` ``` public class Lobby : Entity { public List<User> Users { get; private set; } public void RemoveUser(string userId) { var user = Users.First(e => e.Id == userId); Users.Remove(user); if(Users.Count == 0) { // REMOVE THIS LOB...
2020/12/19
[ "https://Stackoverflow.com/questions/65372522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5768052/" ]
> > "Don't Delete, Just Don't" -- [Udi Dahan, 2009](https://udidahan.com/2009/09/01/dont-delete-just-dont/) > > > That said, if you are going to delete something... Manipulation of the repository normally happens in the application component; in other words, when the entity is in a particular state, you want to c...
I personally would still use `if statement` to check if `lobby` is null or not. ``` public class LobbyService : ILobbyService { public void RemoveUser(string lobbyId, string userId) { var lobby = _lobbyRepository.GetById(lobbyId); if (lobby == null) throw new ArgumentNullException(...
32,632,068
What is the difference between ``` <a href="#"><strong>link</strong></a> ``` and ``` <strong><a href="#">link</a></strong>? ``` Which example is semantic correct?
2015/09/17
[ "https://Stackoverflow.com/questions/32632068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Both are semantically correct since both belong to [**Flow content**](http://www.w3.org/TR/html5/dom.html#flow-content-1) For checking if the nesting of tags are semantically valid you can check the below image, although most of the time the browsers ignore the semantics and render the DOM. [**MDN Reference**](https:...
using css would be the better approach ``` <style> a.boldtext{font-weight:bold;} /* a{font-weight:bold;} this would apply to all links */ </style> <a class="boldtext" href="#">link</a> ```
21,278,199
I tried to get the image bitmap for a URI but it is giving me the following error. System.err(3102): java.io.FileNotFoundException: No content provider: /storage/emulated/0/1.jpg The code i tried is, ``` Cursor mCursor; mCursor=activity.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,...
2014/01/22
[ "https://Stackoverflow.com/questions/21278199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2530623/" ]
``` protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if (requestCode == 2 && resultCode == RESULT_OK) { Uri selectedImage = data.getData(); String[] ...
get path from uri and use this path to get image ``` public String getRealPathFromURI(Uri contentUri) { try { String[] proj = { MediaStore.Images.Media.DATA }; @SuppressWarnings("deprecation") Cursor cursor = managedQuery(contentUri, proj, null, null, null); int column_index = curso...
61,137,872
I have a class Objekt in java in that class I wrote a function to check objects the serial number of objects from other classes and I keep getting .equals error. I was wondering is it because I wrote String function and the serial number(Evidenca) is int or I wrote something wrong. So any ideas are welcome. ``` boolea...
2020/04/10
[ "https://Stackoverflow.com/questions/61137872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11511935/" ]
OK so I just checked the `ionic capacitor run` [command options docs](https://ionicframework.com/docs/cli/commands/capacitor-run) and saw this: ``` --external Description Host dev server on all network interfaces (i.e. --host=0.0.0.0) ``` Tried it... and it works. running my app with: `ionic capacitor run androi...
What has worked for me was using the external URL provided by ionic to call my end-point instead of `localhost` When I want to test on the emulator/device, I ran `ionic capacitor run android --livereload --external` and then the console show me this [![enter image description here](https://i.stack.imgur.com/GvmYz.png...
61,137,872
I have a class Objekt in java in that class I wrote a function to check objects the serial number of objects from other classes and I keep getting .equals error. I was wondering is it because I wrote String function and the serial number(Evidenca) is int or I wrote something wrong. So any ideas are welcome. ``` boolea...
2020/04/10
[ "https://Stackoverflow.com/questions/61137872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11511935/" ]
OK so I just checked the `ionic capacitor run` [command options docs](https://ionicframework.com/docs/cli/commands/capacitor-run) and saw this: ``` --external Description Host dev server on all network interfaces (i.e. --host=0.0.0.0) ``` Tried it... and it works. running my app with: `ionic capacitor run androi...
Just another answer for someone who may encounter the problem the way I faced it: On my computer (Windows 10) the issue was that a connection from the phone to my computer was not allowed. My network connection was configured with a guest/public profile and it did not have network detection on. I fixed this by: 1. na...
61,137,872
I have a class Objekt in java in that class I wrote a function to check objects the serial number of objects from other classes and I keep getting .equals error. I was wondering is it because I wrote String function and the serial number(Evidenca) is int or I wrote something wrong. So any ideas are welcome. ``` boolea...
2020/04/10
[ "https://Stackoverflow.com/questions/61137872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11511935/" ]
What has worked for me was using the external URL provided by ionic to call my end-point instead of `localhost` When I want to test on the emulator/device, I ran `ionic capacitor run android --livereload --external` and then the console show me this [![enter image description here](https://i.stack.imgur.com/GvmYz.png...
Just another answer for someone who may encounter the problem the way I faced it: On my computer (Windows 10) the issue was that a connection from the phone to my computer was not allowed. My network connection was configured with a guest/public profile and it did not have network detection on. I fixed this by: 1. na...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
I agree with "intrapersonal" possibly being hard to understand, as per gparyani's answer, but feel that "personal issues" is ambiguous. My proposed way of phrasing it: > > Questions relating to one's own thoughts and feelings are off-topic for this site. If applicable, instead ask a specific question about interacti...
I agree, but the word "intrapersonal" is kind of a high-level word for English learners, and as such I wouldn't use that word. Here's my proposed way of phrasing it (rough draft): > > Questions asking about **personal issues** are off-topic unless they focus on interactions with another party. Instead, describe the ...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
I like the current answers, but I think we should model the phrasing closer to the "What Should I Do?" close reason text: > > Questions should ask for help achieving a specific goal. Your question is asking for personal advice on "what to do" without defining a goal; this is too subjective. Edit your question to expl...
I agree, but the word "intrapersonal" is kind of a high-level word for English learners, and as such I wouldn't use that word. Here's my proposed way of phrasing it (rough draft): > > Questions asking about **personal issues** are off-topic unless they focus on interactions with another party. Instead, describe the ...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
There are several things to consider here. I think it's worth explaining what we mean when we talk about intrapersonal skills, for not everyone is familiar with that term. I relied on [that site](https://www.enotes.com/homework-help/what-difference-between-interpersonal-269628) to further explain the term. Another th...
I agree, but the word "intrapersonal" is kind of a high-level word for English learners, and as such I wouldn't use that word. Here's my proposed way of phrasing it (rough draft): > > Questions asking about **personal issues** are off-topic unless they focus on interactions with another party. Instead, describe the ...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
I agree with "intrapersonal" possibly being hard to understand, as per gparyani's answer, but feel that "personal issues" is ambiguous. My proposed way of phrasing it: > > Questions relating to one's own thoughts and feelings are off-topic for this site. If applicable, instead ask a specific question about interacti...
[gparyani](https://interpersonal.meta.stackexchange.com/a/3247/21067) made a good point when they said that the difference between "intrapersonal" and "interpersonal" might not be obvious for all non-native speakers. However, since the phrasing confuses me (as a French person), I have decided to suggest another phrasin...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
I like the current answers, but I think we should model the phrasing closer to the "What Should I Do?" close reason text: > > Questions should ask for help achieving a specific goal. Your question is asking for personal advice on "what to do" without defining a goal; this is too subjective. Edit your question to expl...
[gparyani](https://interpersonal.meta.stackexchange.com/a/3247/21067) made a good point when they said that the difference between "intrapersonal" and "interpersonal" might not be obvious for all non-native speakers. However, since the phrasing confuses me (as a French person), I have decided to suggest another phrasin...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
There are several things to consider here. I think it's worth explaining what we mean when we talk about intrapersonal skills, for not everyone is familiar with that term. I relied on [that site](https://www.enotes.com/homework-help/what-difference-between-interpersonal-269628) to further explain the term. Another th...
[gparyani](https://interpersonal.meta.stackexchange.com/a/3247/21067) made a good point when they said that the difference between "intrapersonal" and "interpersonal" might not be obvious for all non-native speakers. However, since the phrasing confuses me (as a French person), I have decided to suggest another phrasin...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
I agree with "intrapersonal" possibly being hard to understand, as per gparyani's answer, but feel that "personal issues" is ambiguous. My proposed way of phrasing it: > > Questions relating to one's own thoughts and feelings are off-topic for this site. If applicable, instead ask a specific question about interacti...
I like the current answers, but I think we should model the phrasing closer to the "What Should I Do?" close reason text: > > Questions should ask for help achieving a specific goal. Your question is asking for personal advice on "what to do" without defining a goal; this is too subjective. Edit your question to expl...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
I agree with "intrapersonal" possibly being hard to understand, as per gparyani's answer, but feel that "personal issues" is ambiguous. My proposed way of phrasing it: > > Questions relating to one's own thoughts and feelings are off-topic for this site. If applicable, instead ask a specific question about interacti...
There are several things to consider here. I think it's worth explaining what we mean when we talk about intrapersonal skills, for not everyone is familiar with that term. I relied on [that site](https://www.enotes.com/homework-help/what-difference-between-interpersonal-269628) to further explain the term. Another th...
3,246
I find there are a lot of questions here that ask about inTRApersonal issues and are thus off-topic. As someone who votes to close off-topic questions, I think having a specific close reason for this would be really convenient. Something like: > > It seems that your question is about inTRApersonal skills and is, thus...
2018/09/13
[ "https://interpersonal.meta.stackexchange.com/questions/3246", "https://interpersonal.meta.stackexchange.com", "https://interpersonal.meta.stackexchange.com/users/21067/" ]
I like the current answers, but I think we should model the phrasing closer to the "What Should I Do?" close reason text: > > Questions should ask for help achieving a specific goal. Your question is asking for personal advice on "what to do" without defining a goal; this is too subjective. Edit your question to expl...
There are several things to consider here. I think it's worth explaining what we mean when we talk about intrapersonal skills, for not everyone is familiar with that term. I relied on [that site](https://www.enotes.com/homework-help/what-difference-between-interpersonal-269628) to further explain the term. Another th...
59,689,503
My solution consist of: Windows Forms Project Windows Service Project Currently my EF6 (which connects to SQL Server) exists within the Windows Forms Project. However I would rather want to create a Class Library Project (.Net Core) where my EF6 can reside. That way I can easily reference the EF6 DbContext in the Wi...
2020/01/10
[ "https://Stackoverflow.com/questions/59689503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6588220/" ]
The accepted answer is good, and it is good practice to see how to do this directly. However it is worth pointing out that this sequence operation is a one-liner using LINQ. Instead of: ``` int kul = int.MaxValue; for (int i = 0; i < g.Length; i++) { int diff = Math.Abs(u[i].benzin - u[i].gazolaj); kul = Math....
You're close. You just need to get the smallest amount. ``` int kul = int.MaxValue; for (int i = 0; i < g.Length; i++) { int diff = Math.Abs(u[i].benzin - u[i].gazolaj); kul = Math.Min(kul, diff); } ``` How this works: Start out with a ridiculously large number. Then on each iteration, we get the absolute ...
331,282
Found question and great answer: [WMI and adding Multiple IP Addresses?](https://serverfault.com/questions/181039/wmi-and-adding-multiple-ip-addresses) However this only explains how to add multiple static IP addresses. I am looking how to configure a dynamic (DHCP) and at least one static IP address on the same NIC. B...
2011/11/15
[ "https://serverfault.com/questions/331282", "https://serverfault.com", "https://serverfault.com/users/101054/" ]
As far as I know, you can't do this to a network adapter on Windows using any method, not just WMI.
[Here is](http://www.petri.co.il/configure_tcp_ip_to_use_dhcp_and_a_static_ip_address_at_the_same_time.htm) an interesting article that does what you need but employing two steps - DHCP and registry editing. It's not a solution per se, but can be implemented as one if you really have the need.
331,282
Found question and great answer: [WMI and adding Multiple IP Addresses?](https://serverfault.com/questions/181039/wmi-and-adding-multiple-ip-addresses) However this only explains how to add multiple static IP addresses. I am looking how to configure a dynamic (DHCP) and at least one static IP address on the same NIC. B...
2011/11/15
[ "https://serverfault.com/questions/331282", "https://serverfault.com", "https://serverfault.com/users/101054/" ]
As far as I know, you can't do this to a network adapter on Windows using any method, not just WMI.
This has just turned reality (for the latest version of Windows only, probably). Quoting myself: > > There is a new property called `dhcpstaticipcoexistence` in the `netsh interface ipv4` `set interface` command, which can be set to `enabled` and this interface can be configured with multiple static IPs along with a...
46,455,939
Let's say I have a custom class in python, that has the attribute `val`. If I have a pandas dataframe with a column of these objects, how can I access this attribute and make a new column with this value? Example data: ``` df Out[46]: row custom_object 1 foo1 2 foo2 3 foo3 4 foo4 Name: book, dtype:...
2017/09/27
[ "https://Stackoverflow.com/questions/46455939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7082163/" ]
You could use a list comprehension: ``` df['custom_val'] = [foo.val for foo in df['custom_object']] ``` **Timings** ``` # Set-up 100k Foo objects. vals = [np.random.randn() for _ in range(100000)] foos = [Foo(val) for val in vals] df = pd.DataFrame(foos, columns=['custom_object']) # 1) OP's apply method. %timeit d...
Setup code: ```py import operator import random from dataclasses import dataclass import numpy as np import pandas as pd @dataclass class SomeObj: val: int df = pd.DataFrame(data={f"col_1": [SomeObj(random.randint(0, 10000)) for _ in range(10000000)]}) ``` --- Solution 1 ---------- ```py df['col_1'].map(lam...
55,741,739
I am finding it hard to understand the point of exception handling in selenium. For example, if I try to click on an element, and the element could not be found then `NoSuchElementException` occurs. I can catch the exception, throw new `RunTimeException`, or do nothing. The result will be the same ( the program will f...
2019/04/18
[ "https://Stackoverflow.com/questions/55741739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10431512/" ]
Exception handling for Selenium is a great way to proof your tests against unexpected conditions. For example, you can try to find the element again if it is no longer attached to the page, for example after a javascript is executed that changes something in the element. ``` try{ driver.findElement(By.id("MyId"))....
Exceptions are very useful features, far more useful than just for logging, you should look it up. You can do whatever you want in the catch block, you can try to click a different element if the first one failed, redirect to another page... The possibilities are endless really. Advice: Avoid generic exceptions, you sh...
55,741,739
I am finding it hard to understand the point of exception handling in selenium. For example, if I try to click on an element, and the element could not be found then `NoSuchElementException` occurs. I can catch the exception, throw new `RunTimeException`, or do nothing. The result will be the same ( the program will f...
2019/04/18
[ "https://Stackoverflow.com/questions/55741739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10431512/" ]
Exception handling for Selenium is a great way to proof your tests against unexpected conditions. For example, you can try to find the element again if it is no longer attached to the page, for example after a javascript is executed that changes something in the element. ``` try{ driver.findElement(By.id("MyId"))....
Firstly ExceptionHandling is not a concept of Selenium but it is related to JAVA. Now coming to the usage of handling exceptions it has a lot of depth to the concept which you will understand while constructing frameworks but as of now it is important to understand by handling exceptions you can continue to execute you...
13,210,154
I'm interested in creating an application that will provide an API service. Similar to Facebook, end-developers would be able to register an application and receive personalised data in order to access the provided API via a third-party application. I want to provide, at the moment, a PHP and JavaScript SDK that will a...
2012/11/03
[ "https://Stackoverflow.com/questions/13210154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/810821/" ]
Your problem seem to come down to wrong data formatting. You need to make a matrix with the right row names structure to create plot that you want with base graphics. Here is your solution: ``` #your data... d <- data.frame(row.names=c("1-2","2-3","3-4"), abc = c(10,80, 30), def = c(15, 95, 55), ghi =...
I like to use `ggplot2` for this kind of task. ``` #Make the data reproducible: column1 <- c(rep("1-2", 3), rep("2-3", 3), rep("3-4", 3)) column2 <- gl(3, 1, 9, labels=c("abc", "def", "ghi")) column3 <- c(10, 15, 20, 80, 95, 10, 30, 55, 80) d <- data.frame(column1=column1, column2=column2, column3=column3) require(g...
13,210,154
I'm interested in creating an application that will provide an API service. Similar to Facebook, end-developers would be able to register an application and receive personalised data in order to access the provided API via a third-party application. I want to provide, at the moment, a PHP and JavaScript SDK that will a...
2012/11/03
[ "https://Stackoverflow.com/questions/13210154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/810821/" ]
I like to use `ggplot2` for this kind of task. ``` #Make the data reproducible: column1 <- c(rep("1-2", 3), rep("2-3", 3), rep("3-4", 3)) column2 <- gl(3, 1, 9, labels=c("abc", "def", "ghi")) column3 <- c(10, 15, 20, 80, 95, 10, 30, 55, 80) d <- data.frame(column1=column1, column2=column2, column3=column3) require(g...
I found help from Drew Steen's answer, but this code above did not work for me as show above. I added stat="identity" and it works. ``` require(ggplot2) ggplot(d, aes(x=column1, y=column3, fill=column2)) + geom_bar(stat="identity", position=position_dodge()) ``` Thank you Drew for your answer.
13,210,154
I'm interested in creating an application that will provide an API service. Similar to Facebook, end-developers would be able to register an application and receive personalised data in order to access the provided API via a third-party application. I want to provide, at the moment, a PHP and JavaScript SDK that will a...
2012/11/03
[ "https://Stackoverflow.com/questions/13210154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/810821/" ]
Your problem seem to come down to wrong data formatting. You need to make a matrix with the right row names structure to create plot that you want with base graphics. Here is your solution: ``` #your data... d <- data.frame(row.names=c("1-2","2-3","3-4"), abc = c(10,80, 30), def = c(15, 95, 55), ghi =...
I found help from Drew Steen's answer, but this code above did not work for me as show above. I added stat="identity" and it works. ``` require(ggplot2) ggplot(d, aes(x=column1, y=column3, fill=column2)) + geom_bar(stat="identity", position=position_dodge()) ``` Thank you Drew for your answer.
1,331,622
I'm trying to create a formula to get a string of text specified in `A3` (text is `T1234-1234`) and to search this string in another workbook on a specified line, but on all sheets until a match is found and to return another cell within the sheet being searched. Below is what I have working so far. This formula is on...
2018/06/15
[ "https://superuser.com/questions/1331622", "https://superuser.com", "https://superuser.com/users/914967/" ]
I followed the advice given at [this thread forums.virtualbox.org](https://forums.virtualbox.org/viewtopic.php?f=3&t=88487) 1. Create a new machine by, for example, clicking new in the UI 2. Choose advanced mode 3. Select the .vdi file from the non-working machine with Ubuntu 4. Keep this machine's settings simple 5. ...
My setup is very similar to yours, so we might have the same issue. In my case, the boot times of the updated Ubuntu VM were just dramatically increased (5min vs. 20 sec). To verify: * Let the VM boot up process finish * In the Ubuntu session open the terminal and run `journalctl -b` * There should be a long delay st...
15,947,130
So I have data saved in the table as comma separated values. ``` availability 6, 9, 11, 12 2, 6, 10 1, 2, 6, 9 ``` And I need to get only rows where we have 9. Any idea how can I make the query please ? Thanks a lot. EDIT: Before starting to criticize in such a fashion, intelligent people will understand that O...
2013/04/11
[ "https://Stackoverflow.com/questions/15947130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1671773/" ]
Try this: ``` SELECT * FROM your_table WHERE availability like '9,%' OR availability like '%,9' OR availability like '%,9,%' ``` [demo here](http://sqlfiddle.com/#!2/7fd80/2)
I would suggest you store your data differently. You can solve it with mysql LIKE, but you have to throw a regex over that it can't be next to another number directly (so " " and ","). This is rather heavy tho.
58,268,936
I have two TFRecords `A` and `B` of different sizes and containing different data elements. I need to take all possible pairs of records from `A` and `B`. Therefore, during training or testing, I would like the signal of epoch to end only when all combinations have been exhausted, after which the process should resum...
2019/10/07
[ "https://Stackoverflow.com/questions/58268936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12007504/" ]
In the SELECT list of a `GROUP BY` query you can reference "anything" ***inside*** an aggregation expression, but only expressions from the `GROUP BY` list ***outside*** an aggregation expression. In your case, I believe (untested) that you should not have gotten an error if the `GROUP BY` contained `payload:col2` or ...
Most likely the cause is that **there is a column with the same name in the source table**. In your case if there is a `table1.type` then the `GROUP BY type` with refer to `table1.type` and not your `CASE....END as type`. In the regular case you can refer to the `CASE ... END as colname` in the `GROUP BY` clause by a...
28,480,992
So, while using Sublime Text 3, I often find myself scrolling through a file looking for some function, but then wishing to return my viewport to wherever I left my cursor. Unfortunately, I frequently have no idea where I left the cursor and I end up having to scroll endlessly just to figure out where I was. To solve ...
2015/02/12
[ "https://Stackoverflow.com/questions/28480992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1348948/" ]
Just move the curser by pressing right-arrow left-arrow and the view will scroll to it. This works with almost any editor.
You might want to add `"highlight_line": true,` to your user settings. It keeps the cursor line highlighted.
28,480,992
So, while using Sublime Text 3, I often find myself scrolling through a file looking for some function, but then wishing to return my viewport to wherever I left my cursor. Unfortunately, I frequently have no idea where I left the cursor and I end up having to scroll endlessly just to figure out where I was. To solve ...
2015/02/12
[ "https://Stackoverflow.com/questions/28480992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1348948/" ]
Just move the curser by pressing right-arrow left-arrow and the view will scroll to it. This works with almost any editor.
The easiest way would be the keyboard shortcut: `⌃L` -- "Scroll to Selection"
28,480,992
So, while using Sublime Text 3, I often find myself scrolling through a file looking for some function, but then wishing to return my viewport to wherever I left my cursor. Unfortunately, I frequently have no idea where I left the cursor and I end up having to scroll endlessly just to figure out where I was. To solve ...
2015/02/12
[ "https://Stackoverflow.com/questions/28480992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1348948/" ]
The easiest way would be the keyboard shortcut: `⌃L` -- "Scroll to Selection"
You might want to add `"highlight_line": true,` to your user settings. It keeps the cursor line highlighted.
27,913,348
I have a php problem when want to bind\_param dynamically when I using `SELECT` this is my php code ``` $sql = 'SELECT ProductName, ProductId FROM Product WHERE 1=1' if($produkname != ''){ $sql .= ' AND ProdukName Like ?'; } if($produkcode != ''){ $sql .= ' AND Produkcode Like ?'; } if($stmt = $mysqli->prep...
2015/01/13
[ "https://Stackoverflow.com/questions/27913348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2905762/" ]
You can't access `private` variables even when extending the parent class. You need to change it to `protected`: ``` protected $con; ``` You'll also need to construct the parent class, otherwise it won't ever instantiate the parent(extended) class. ``` function __construct() { parent::__construct($host, $userna...
dbConnect page changed ``` protected $host; protected $dbName; protected $uname; protected $upass; protected $con; ``` and SampleView page ``` public function __construct() { parent::__construct('localhostr', 'test', 'root', ''); } function chkConnection() { /* * dbConncect Class Connection variable ...
3,688,432
Many languages in Europe are inflectional. This means that one word can be written in multiple forms in text. For example, word 'computer' in polish "komputer" has multiple forms: "komputera", "komputerowi", "komputerem", "komputery" , etc.. **How should I use django+haystack+whoosh properly to deal with language inf...
2010/09/10
[ "https://Stackoverflow.com/questions/3688432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/442474/" ]
Whoosh has, by default, only stemming for the english language. To implement stemming for another language, first look inside: ``` /your_path_to_whoosh/whoosh/lang/analysis.py ``` This is where `StemmingAnalyzer` (the default analyzer) is defined and an excellent starting point. The `stem` function, imported from...
For future readers: Whoosh can handle different languages with snowball stemmer. ``` from whoosh.lang.snowball.russian import RussianStemmer stemmer_ru = RussianStemmer() analyzer = StemmingAnalyzer(stemfn=stemmer_ru.stem) schema = fields.Schema( name=fields.TEXT(analyzer=analyzer), ) ```
3,688,432
Many languages in Europe are inflectional. This means that one word can be written in multiple forms in text. For example, word 'computer' in polish "komputer" has multiple forms: "komputera", "komputerowi", "komputerem", "komputery" , etc.. **How should I use django+haystack+whoosh properly to deal with language inf...
2010/09/10
[ "https://Stackoverflow.com/questions/3688432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/442474/" ]
Whoosh has, by default, only stemming for the english language. To implement stemming for another language, first look inside: ``` /your_path_to_whoosh/whoosh/lang/analysis.py ``` This is where `StemmingAnalyzer` (the default analyzer) is defined and an excellent starting point. The `stem` function, imported from...
Whoosh LanguageAnalyzer: Configures a simple analyzer for the given language, with a LowercaseFilter, StopFilter, and StemFilter. <https://whoosh.readthedocs.io/en/latest/api/analysis.html#whoosh.analysis.LanguageAnalyzer>
3,688,432
Many languages in Europe are inflectional. This means that one word can be written in multiple forms in text. For example, word 'computer' in polish "komputer" has multiple forms: "komputera", "komputerowi", "komputerem", "komputery" , etc.. **How should I use django+haystack+whoosh properly to deal with language inf...
2010/09/10
[ "https://Stackoverflow.com/questions/3688432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/442474/" ]
For future readers: Whoosh can handle different languages with snowball stemmer. ``` from whoosh.lang.snowball.russian import RussianStemmer stemmer_ru = RussianStemmer() analyzer = StemmingAnalyzer(stemfn=stemmer_ru.stem) schema = fields.Schema( name=fields.TEXT(analyzer=analyzer), ) ```
Whoosh LanguageAnalyzer: Configures a simple analyzer for the given language, with a LowercaseFilter, StopFilter, and StemFilter. <https://whoosh.readthedocs.io/en/latest/api/analysis.html#whoosh.analysis.LanguageAnalyzer>
690,015
One such program that uses a wait function like this is this one: ``` #include<stdio.h> #include<stdlib.h> int main() { int pid,fd[2]; int n; char line[20]; if(pipe(fd)<0) { printf("Error creating pipe"); } else { pid=fork(); if(pid<0) { printf("Error wh...
2009/03/27
[ "https://Stackoverflow.com/questions/690015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83650/" ]
See [man wait(2)](http://linux.die.net/man/2/wait). `wait((int *)0)` calls `waitpid(-1, (int *)0, 0)`. The man page states: > > If status is not NULL, wait() and waitpid() store status information in the int to which it points. > > > Here, `status` is NULL (0). Thus, your call to `wait` waits for a state change ...
stager's answer is correct. Though it should be noted that the cast is entirely unnecessary since according to the standard, 0 used in a pointer context is the NULL pointer.
9,906,577
I am trying to used following code but I am not getting good performance in my Application. I have list of 2000 images in “dt\_Images.ToList()”. **In cs:** ``` foreach (var dr in dt_Images.ToList()) { BTN = new Button(); BTN.Name = dr.Name.ToString(); BTN.I...
2012/03/28
[ "https://Stackoverflow.com/questions/9906577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/958500/" ]
I think, usually you only need to download the picture you show and the few around. So if you download the 5 afters and the 5 before the current, your speed gonna be ok.
We can not always improve performance, but we can definitely improve perceived performance. Assuming you are developing a UI application, please refer to the following logic. As part of application start up, try to fetch the all the images and relevant data. This is time consuming, but don't worry. Cache these objects...
9,906,577
I am trying to used following code but I am not getting good performance in my Application. I have list of 2000 images in “dt\_Images.ToList()”. **In cs:** ``` foreach (var dr in dt_Images.ToList()) { BTN = new Button(); BTN.Name = dr.Name.ToString(); BTN.I...
2012/03/28
[ "https://Stackoverflow.com/questions/9906577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/958500/" ]
I think, usually you only need to download the picture you show and the few around. So if you download the 5 afters and the 5 before the current, your speed gonna be ok.
Perhaps you should only create a button when you are about to use it. (Or a few of them as in [ykatchou](https://stackoverflow.com/a/9906979/939213)'s answer.) Even if you *do* want to create them all at once – you might be better off creating them using a [BackgroundWorker](http://msdn.microsoft.com/en-us/library/sys...
9,906,577
I am trying to used following code but I am not getting good performance in my Application. I have list of 2000 images in “dt\_Images.ToList()”. **In cs:** ``` foreach (var dr in dt_Images.ToList()) { BTN = new Button(); BTN.Name = dr.Name.ToString(); BTN.I...
2012/03/28
[ "https://Stackoverflow.com/questions/9906577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/958500/" ]
I can see that you are using a `FlowLayout` panel. I suspect it to redo the whole layout each time you add a child control, which might take a lot of time too. Can you try to enclose the whole loop this way : ``` flowLayoutPanel1.SuspendLayout(); foreach (var dr in dt_Images.ToList()) { BTN = new...
We can not always improve performance, but we can definitely improve perceived performance. Assuming you are developing a UI application, please refer to the following logic. As part of application start up, try to fetch the all the images and relevant data. This is time consuming, but don't worry. Cache these objects...
9,906,577
I am trying to used following code but I am not getting good performance in my Application. I have list of 2000 images in “dt\_Images.ToList()”. **In cs:** ``` foreach (var dr in dt_Images.ToList()) { BTN = new Button(); BTN.Name = dr.Name.ToString(); BTN.I...
2012/03/28
[ "https://Stackoverflow.com/questions/9906577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/958500/" ]
I can see that you are using a `FlowLayout` panel. I suspect it to redo the whole layout each time you add a child control, which might take a lot of time too. Can you try to enclose the whole loop this way : ``` flowLayoutPanel1.SuspendLayout(); foreach (var dr in dt_Images.ToList()) { BTN = new...
Perhaps you should only create a button when you are about to use it. (Or a few of them as in [ykatchou](https://stackoverflow.com/a/9906979/939213)'s answer.) Even if you *do* want to create them all at once – you might be better off creating them using a [BackgroundWorker](http://msdn.microsoft.com/en-us/library/sys...
408,546
I recently gifted myself a new dedicated server and I am trying to squeeze maximum performance out of it, for fun and learning. I am trying to achieve maximum possible requests per second this server can handle and aiming for 500K requests/sec as mentioned here - <http://lowlatencyweb.wordpress.com/2012/03/20/500000-r...
2012/07/17
[ "https://serverfault.com/questions/408546", "https://serverfault.com", "https://serverfault.com/users/11502/" ]
Arpit, if you imagine that the absolutely smallest likely web response, even if it's a static text file is one Ethernet packet (~1,500 bytes) then 500,000 of them works out at around 750,000,000 bytes, or roughly 7.5 gigabit. So unless your server has very easily offloaded 10Gb NICs (and it doesnt't, the one you've got...
if you are just after the numbers [eg there's no real use case behind this test] - make ab use the keep alive feature of http - execute number of requests over already open TCP connection.
408,546
I recently gifted myself a new dedicated server and I am trying to squeeze maximum performance out of it, for fun and learning. I am trying to achieve maximum possible requests per second this server can handle and aiming for 500K requests/sec as mentioned here - <http://lowlatencyweb.wordpress.com/2012/03/20/500000-r...
2012/07/17
[ "https://serverfault.com/questions/408546", "https://serverfault.com", "https://serverfault.com/users/11502/" ]
Arpit, if you imagine that the absolutely smallest likely web response, even if it's a static text file is one Ethernet packet (~1,500 bytes) then 500,000 of them works out at around 750,000,000 bytes, or roughly 7.5 gigabit. So unless your server has very easily offloaded 10Gb NICs (and it doesnt't, the one you've got...
Let's identify the bottleneck. Since you're on the same machine, we can assume it's either CPU or disk activity. For the one text file, it shouldn't be disk activity, but at 35k connections, you may be generating 35MB of logging every second as well. The examples you're showing don't run access logging, only errors. Y...
408,546
I recently gifted myself a new dedicated server and I am trying to squeeze maximum performance out of it, for fun and learning. I am trying to achieve maximum possible requests per second this server can handle and aiming for 500K requests/sec as mentioned here - <http://lowlatencyweb.wordpress.com/2012/03/20/500000-r...
2012/07/17
[ "https://serverfault.com/questions/408546", "https://serverfault.com", "https://serverfault.com/users/11502/" ]
Let's identify the bottleneck. Since you're on the same machine, we can assume it's either CPU or disk activity. For the one text file, it shouldn't be disk activity, but at 35k connections, you may be generating 35MB of logging every second as well. The examples you're showing don't run access logging, only errors. Y...
if you are just after the numbers [eg there's no real use case behind this test] - make ab use the keep alive feature of http - execute number of requests over already open TCP connection.