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 |
|---|---|---|---|---|---|
3,274 | I have studied German for the whole year last year. But I want to study other languages too.
I haven't mastered German yet, and I am seeking advice whether I should start learning a new language together with German.
My issue is that I know learning a language is not easy. Let's assume, in 3-4 years time, I can master... | 2018/01/03 | [
"https://languagelearning.stackexchange.com/questions/3274",
"https://languagelearning.stackexchange.com",
"https://languagelearning.stackexchange.com/users/4384/"
] | I have had this same issue where I've been forced to learn two languages, and I also switch between which one I focus on often. Finally, I have decided that I will focus on one very strongly for the next several months.
I have found that without making a firm decision about either I am adrift, but when I focus I'm abl... | Learning how to learn a language is a skill in and of itself, so studying another language, even if you haven't mastered German, can have a positive effect on how well, efficient and fast your learning is.
Depending on the language family, there will be similarities in grammar and I've found that one concept which wa... |
57,652,936 | How can I write an array of coordinates to the Cloud Firestore as a `GeoPoint` datatype?
I do have an `arraylist<latlng> points` with coordinates and I need to write those coordinates to Firestore:
```
@Override
public void onLocationChanged(Location location) {
mLastLocation = location;
mLatLng = new
LatLn... | 2019/08/26 | [
"https://Stackoverflow.com/questions/57652936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11732622/"
] | I think the explicit question you're asking is different from the problem you are trying to solve, but I'll try to help with both.
First, you've already realized you cannot declare a property wrapper inside a protocol. This is because property wrapper declarations get synthesized into three separate properties at comp... | I would consider another solution - have the protocol define a class property with all your state information:
```
protocol WelcomeViewModel {
var state: WelcomeState { get }
}
```
And the WelcomeState has the `@Published` property:
```
class WelcomeState: ObservableObject {
@Published var hasAgreedToTermsA... |
41,120,942 | I have the following values:
>
> 1465509600000
>
>
> 1402437600000
>
>
>
I tried the following:
attempt 1:
```
public long? CommitmentStartDate { get; set; }
public long? CommitmentEndDate { get; set; }
public DateTime? CommitmentStartDateDate => new DateTime( (CommitmentStartDate != null ? (lo... | 2016/12/13 | [
"https://Stackoverflow.com/questions/41120942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1862808/"
] | Your 2 samples are 2 years apart, taking the difference from those ticks and dividing by 2, 365, 24 and 3600 leaves 1000 so they are milliseconds.
A quick check reveals that they are indeed based on 1-1-1970 so
```
//return _unixEpoch.AddSeconds(timestamp);
return _unixEpoch.AddMilliSeconds(timestamp);
``` | In this part you are adding seconds:
```
public static DateTime DateFromTimestamp(long timestamp)
{
return _unixEpoch.AddSeconds(timestamp);
}
```
If you want to pass ticks, you need to add ticks:
```
public static DateTime DateFromTimestamp(long timestamp)
{
return _unixEpoch.AddTicks(timestamp);
}
```
B... |
41,120,942 | I have the following values:
>
> 1465509600000
>
>
> 1402437600000
>
>
>
I tried the following:
attempt 1:
```
public long? CommitmentStartDate { get; set; }
public long? CommitmentEndDate { get; set; }
public DateTime? CommitmentStartDateDate => new DateTime( (CommitmentStartDate != null ? (lo... | 2016/12/13 | [
"https://Stackoverflow.com/questions/41120942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1862808/"
] | Your 2 samples are 2 years apart, taking the difference from those ticks and dividing by 2, 365, 24 and 3600 leaves 1000 so they are milliseconds.
A quick check reveals that they are indeed based on 1-1-1970 so
```
//return _unixEpoch.AddSeconds(timestamp);
return _unixEpoch.AddMilliSeconds(timestamp);
``` | I used this extension
```
public static DateTime FromUnixTicks(this double ms)
{
DateTime d1 = new DateTime(1970, 1, 1);
return d1.AddMilliseconds(ms).ToLocalTime();
}
```
and sample:
```
1465509600000.0.FromUnixTicks()
```
and convert back
```
public static double ToUnixTicks(this DateTime dt)
{
Dat... |
16,517,152 | Apple doesn't allowed to add application to the app store that used the [UIDevice uniqueIdentifier] because the property become private in iOS SDK 6.0
What are the Alternatives? | 2013/05/13 | [
"https://Stackoverflow.com/questions/16517152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442541/"
] | Your code is correct there is no problem because i've implemented at my end. See below i think you are doing something wrong in other code..
```
NSString *temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.f... | ```
NSString *str = @"S21";
NSString *newStr = [str substringFromIndex:0];
``` |
16,517,152 | Apple doesn't allowed to add application to the app store that used the [UIDevice uniqueIdentifier] because the property become private in iOS SDK 6.0
What are the Alternatives? | 2013/05/13 | [
"https://Stackoverflow.com/questions/16517152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442541/"
] | Just check `IBOutlet` connection of your `UIButton` if you are creating it through nib file. | ```
NSString *str = @"S21";
NSString *newStr = [str substringFromIndex:0];
``` |
16,517,152 | Apple doesn't allowed to add application to the app store that used the [UIDevice uniqueIdentifier] because the property become private in iOS SDK 6.0
What are the Alternatives? | 2013/05/13 | [
"https://Stackoverflow.com/questions/16517152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442541/"
] | Your code is correct there is no problem because i've implemented at my end. See below i think you are doing something wrong in other code..
```
NSString *temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.f... | This should work
```
NSString *temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
_b0.tag = [temp intValue];
``` |
16,517,152 | Apple doesn't allowed to add application to the app store that used the [UIDevice uniqueIdentifier] because the property become private in iOS SDK 6.0
What are the Alternatives? | 2013/05/13 | [
"https://Stackoverflow.com/questions/16517152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442541/"
] | Just check `IBOutlet` connection of your `UIButton` if you are creating it through nib file. | This should work
```
NSString *temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
_b0.tag = [temp intValue];
``` |
16,517,152 | Apple doesn't allowed to add application to the app store that used the [UIDevice uniqueIdentifier] because the property become private in iOS SDK 6.0
What are the Alternatives? | 2013/05/13 | [
"https://Stackoverflow.com/questions/16517152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442541/"
] | Your code is correct there is no problem because i've implemented at my end. See below i think you are doing something wrong in other code..
```
NSString *temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.f... | ```
*temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
_b0.tag = [temp intValue];
``` |
16,517,152 | Apple doesn't allowed to add application to the app store that used the [UIDevice uniqueIdentifier] because the property become private in iOS SDK 6.0
What are the Alternatives? | 2013/05/13 | [
"https://Stackoverflow.com/questions/16517152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442541/"
] | Just check `IBOutlet` connection of your `UIButton` if you are creating it through nib file. | Your code is correct there is no problem because i've implemented at my end. See below i think you are doing something wrong in other code..
```
NSString *temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.f... |
16,517,152 | Apple doesn't allowed to add application to the app store that used the [UIDevice uniqueIdentifier] because the property become private in iOS SDK 6.0
What are the Alternatives? | 2013/05/13 | [
"https://Stackoverflow.com/questions/16517152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1442541/"
] | Just check `IBOutlet` connection of your `UIButton` if you are creating it through nib file. | ```
*temp = [[array objectAtIndex:0] stringByReplacingOccurrencesOfString:@"s" withString:@""];
_b0.tag = [temp intValue];
``` |
1,539 | I struggled for a while reading [this question](https://android.stackexchange.com/q/50469/16265) where the OP was asking for a consistent answer about the Android battery, battery calibration and battery usage.
He pointed out several answers from different users that present a conflict on advices on how should an Andr... | 2013/08/03 | [
"https://android.meta.stackexchange.com/questions/1539",
"https://android.meta.stackexchange.com",
"https://android.meta.stackexchange.com/users/16265/"
] | Good point, I shared (and still share) Zuul's concern. Alternative to a question/answer summing up things and pointing to the corresponding answers, this summary could be **placed in the corrsponding tag-wikis** ([calibration](https://android.stackexchange.com/questions/tagged/calibration "show questions tagged 'calibr... | I think this is out of our domain. Most of this is really about the physical properties of batteries in general, and not Android or Android device batteries specifically.
I also think a lot of the conflicting answers are due to the fact that different batteries (even of the same type, like lithium ion) respond differe... |
58,857,222 | I need to convert country iso3 code for example FRA to France is it possible? I tried with:`Locale locale = new Locale("FRA") or Locale locale = new Locale("","FRA")
locale.getDisplayCountry()`
but return empty String. | 2019/11/14 | [
"https://Stackoverflow.com/questions/58857222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2971619/"
] | 2nd parameter of Locale constructor needs a ISO2 code, not ISO3. You need to first map ISO3 to ISO2 and then get country name.
This possibly the worst case solution, I don't know any better solution, but its works.
```
String[] languages = Locale.getISOLanguages();
Map<String, Locale> localeMap = new HashMap<String, ... | In kotlin you can do below:
```
object CountryCodeConverter {
private val countryCodes: MutableList<CountryCode>
fun iso3CountryCodeToIso2CountryCode(iso3CountryCode: String?): String? {
return countryCodes.find { it.iso3CountryCode == iso3CountryCode }?.locale?.country
}
fun getCountry(iso3C... |
87,226 | I don't know the exact sources but I remembered some commentaries from the Malbim and Vilna Gaon which point out a difference between 'את'-based words and 'עם'-based words (both translated to mean 'with') in the stories of Lot and Avram and the story of Bilaam.
* [Gen 12:4](http://mechon-mamre.org/p/pt/pt0112.htm#4) ... | 2017/11/25 | [
"https://judaism.stackexchange.com/questions/87226",
"https://judaism.stackexchange.com",
"https://judaism.stackexchange.com/users/4762/"
] | According to [HaKtav v'HaKabala](https://en.wikipedia.org/wiki/Yaakov_Tzvi_Mecklenburg) (Genesis 13:14) when Lot was good (as in 12:4), and in that sense similar to Avraham, the term אתו 'ito' is used, indicating that the two things are similar. When Lot was not righteous (as in 13:1), and went with Avraham, עמו 'imo' ... | [This might help to answer your question](http://thejewishstar.com/stories/Parshat-Balak-Relationships-with-with,2539)
In addressing this question, the Netziv shares his own observations about the differences between going “et” versus going “im.” Following on his coattails, perhaps in the specific context of people tr... |
1,488,419 | Recently I had a SMART error show up on one of my conventional hard drives and I was able to save the drive and back up the data in time before the drive was inaccessible.
I was wondering does SMART work for SSDs as well? From what I have read online it does not.
I also read that Samsung has a software called "Samsun... | 2019/10/02 | [
"https://superuser.com/questions/1488419",
"https://superuser.com",
"https://superuser.com/users/408220/"
] | Modern science has not reached the point where it can reliably predict failure of electronic devices. SMART warnings are a step in that direction but it has many limitations. SMART will measure writes to the drive and a few other things but there are other issues it cannot measure. Excessive writes are no longer a majo... | SSDs report SMART info as well, including some SSD-specific values that don't make sense for HDDs. Samsung Magician simply keeps tabs on SSD wear by looking at SMART values. Other SSD manufacturers also have their tools for this, for example Storage Executive from Crucial.
Modern SSDs are really hard to kill with regu... |
10,117,071 | ```
MyObject : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSArray *notificationsArray;
```
I have an array of MyObjects in my tableView that can be edited for name, time of the notification, etc. Currently, I have it setup so when the user presses Save, the current MyObject g... | 2012/04/12 | [
"https://Stackoverflow.com/questions/10117071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207524/"
] | You can associate custom data with your notification using the userInfo property. Build it like this:
```
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.userInfo = [NSDictionary dictionaryWithObject:@"myNotificationName" forKey:@"name"];
```
Then look it up like this:
```
- (U... | use `userInfo` (`NSDictionary` type) property of `UILocalNotification` class to ditinguish the notifications
see this [link](http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Reference/UILocalNotification_Class/Reference/Reference.html) |
53,273,857 | Currently I am using a `StringBuilder` to remove a list of characters from a `string` as below
```
char[] charArray = {
'%', '&', '=', '?', '{', '}', '|', '<', '>',
';', ':', ',', '"', '(', ')', '[', ']', '\\',
'/', '*', '+', ' ' };
// Remove special characters that aren't allowed
var sanitizedAddress = new... | 2018/11/13 | [
"https://Stackoverflow.com/questions/53273857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1773900/"
] | [moviepy](https://zulko.github.io/moviepy/) is the most appropriate tool for this (it uses ffmpeg as a backend). Concatenating videos is trivial in moviepy:
```
import moviepy.editor
import os
import random
import fnmatch
directory = '/directory/to/videos/'
xdim = 854
ydim = 480
ext = "*mp4"
length = 10
outputs=[]
... | EDIT: Cutting video with ffmpeg needs to be done on a key-frame. I extensively edited this code to first find the key-frames, then cut around this. It works for me.
So to do this in `bash`, assuming there exists some program `randtime.py` which outputs a random starting time in 'H:MM:SS' format, and some other program... |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | A list of Perl CMS's can be found under [`applications`](http://www.perlfoundation.org/perl5/index.cgi?applications) on the [`Perl5 wiki`](http://www.perlfoundation.org/perl5/).
Also looking at your requirement you may find a Wiki to be an option? In particular [`MojoMojo`](http://www.mojomojo.org/) because this diffe... | Going with Perl Catalyst will be good.
In PHP I would recommend using SilverStripe CMS:<http://silverstripe.org/>
Its powerful and easy to extend. |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | **Perl:** if you're happy coding up the admin backend and (possibly) have used [CGI::Application](http://articles.sitepoint.com/article/cgi-application), Mark Strosberg's [Titanium](http://mark.stosberg.com/blog/2008/12/titanium-a-new-release-and-more.html) framework is nippy and lightweight but as powerful as you need... | Going with Perl Catalyst will be good.
In PHP I would recommend using SilverStripe CMS:<http://silverstripe.org/>
Its powerful and easy to extend. |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | A list of Perl CMS's can be found under [`applications`](http://www.perlfoundation.org/perl5/index.cgi?applications) on the [`Perl5 wiki`](http://www.perlfoundation.org/perl5/).
Also looking at your requirement you may find a Wiki to be an option? In particular [`MojoMojo`](http://www.mojomojo.org/) because this diffe... | [Cyclone3](http://www.cyclone3.org/) CMS is very interesting, including GUI based on Firefox. |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | If you want to go with a PHP CMS then I can only recommend Drupal.
<http://drupal.org/> | Going with Perl Catalyst will be good.
In PHP I would recommend using SilverStripe CMS:<http://silverstripe.org/>
Its powerful and easy to extend. |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | [Bricolage 2](http://www.bricolagecms.org/) - You'll get permissions, alerts, ldap authentication, publishing process, and a whole bunch of great features with it. Or if you'd rather write the whole thing by yourself, use [Catalyst](http://www.catalystframework.org/). | If you want to go with a PHP CMS then I can only recommend Drupal.
<http://drupal.org/> |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | **Perl:** if you're happy coding up the admin backend and (possibly) have used [CGI::Application](http://articles.sitepoint.com/article/cgi-application), Mark Strosberg's [Titanium](http://mark.stosberg.com/blog/2008/12/titanium-a-new-release-and-more.html) framework is nippy and lightweight but as powerful as you need... | If you want to go with a PHP CMS then I can only recommend Drupal.
<http://drupal.org/> |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | A list of Perl CMS's can be found under [`applications`](http://www.perlfoundation.org/perl5/index.cgi?applications) on the [`Perl5 wiki`](http://www.perlfoundation.org/perl5/).
Also looking at your requirement you may find a Wiki to be an option? In particular [`MojoMojo`](http://www.mojomojo.org/) because this diffe... | If you want to go with a PHP CMS then I can only recommend Drupal.
<http://drupal.org/> |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | If you want to go with a PHP CMS then I can only recommend Drupal.
<http://drupal.org/> | [Cyclone3](http://www.cyclone3.org/) CMS is very interesting, including GUI based on Firefox. |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | [Bricolage 2](http://www.bricolagecms.org/) - You'll get permissions, alerts, ldap authentication, publishing process, and a whole bunch of great features with it. Or if you'd rather write the whole thing by yourself, use [Catalyst](http://www.catalystframework.org/). | [Cyclone3](http://www.cyclone3.org/) CMS is very interesting, including GUI based on Firefox. |
3,599,581 | I am going to create a corporate site with around 150-200 pages. Several pages have three category levels (I mean a URL like products/myproduct/overview)
The client's employees should be able to edit all the pages very easily, manage the navigation and left blocks as well.
What CMS (opensource, if possible) can I use... | 2010/08/30 | [
"https://Stackoverflow.com/questions/3599581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/434854/"
] | [Bricolage 2](http://www.bricolagecms.org/) - You'll get permissions, alerts, ldap authentication, publishing process, and a whole bunch of great features with it. Or if you'd rather write the whole thing by yourself, use [Catalyst](http://www.catalystframework.org/). | Going with Perl Catalyst will be good.
In PHP I would recommend using SilverStripe CMS:<http://silverstripe.org/>
Its powerful and easy to extend. |
86,492 | I have a bathroom fan that doesn't seem to be doing the job. I'd like to replace it with something that has much higher CFM (jet speed); is there any reason not to do this?
Is it possible that it can cause more problems? | 2016/03/12 | [
"https://diy.stackexchange.com/questions/86492",
"https://diy.stackexchange.com",
"https://diy.stackexchange.com/users/43366/"
] | While this would just be short term use. If you have natural gas, propane or oil appliances, this could & even would suck noxious fumes into the house which could eventually or quickly kill you. That's the bad news.
Other than that, an exhaust fan does, of course, remove heated & cooled air. If you're single I don't s... | For bathrooms less than 100 square feet, determine the room’s CFM (cubic feet per minute, that's how they are rated in the U.S.) requirements by measuring and multiplying the length, width and ceiling height of the room, then use the multiplication factor of .13 and round up to the next “ten.”
For example: 10’ long x ... |
37,553,292 | Here is the code
```
Iterator i = MultiUserChat.getJoinedRooms(connectionManager.getXMPPConnection(), "test123@dulanjaya-pc");
while(i.hasNext()) {
System.out.println(i.next());
}
``` | 2016/05/31 | [
"https://Stackoverflow.com/questions/37553292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6138914/"
] | I had the same frustration. I found in the [ui-select spec](https://github.com/angular-ui/ui-select/blob/master/test/select.spec.js) that executing the `on-select` function requires calling `$timeout.flush()` after clicking one of the choice items.
Something like this (don't forget to inject $timeout):
```
compiledU... | Your unit test should just be calling the itemSelected function directly. So once you create an instance of the controller in the unit test just call:
```
vm.itemSelected(mockData);
``` |
44,220,306 | I try to dynamically add Roles to my User/Roles-application. I have a Formarray where i can show the Roles of the User in the Edit View. And there is a button for adding more Roles to the User. But when i press the button "Add Role", i got this error message:
>
> ERROR Error: Cannot find control with path: 'rolesArr ... | 2017/05/27 | [
"https://Stackoverflow.com/questions/44220306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7593672/"
] | You should create a form group with the controls for `Roles` as below,
```
createRole() : FormGroup {
return this.fb.group({
name: '',
type: '',
});
}
```
Then you should push the role as below,
```
addRole() {
this.roles.push(this.createRole());
}
``` | While Aravind's [answer](https://stackoverflow.com/a/44220367/6754146) works you are still able to do the exact same thing you are doing now:
```
addRole() {
this.roles.push(this.fb.group(new Roles()));
}
```
but the control requires default values for your properties in the class (which is exactly what Aravind'... |
1,506,456 | This is the specific error I am getting:
```
libFoo.so: undefined reference to `IID_IFOOBAR'
collect2: ld returned 1 exit status
make: *** [/home/F.exe] Error 1
```
when I try to check the symbols in my object file A.o
```
nm A.obj | grep IID_
```
I get no symbols listed in my object file of the 'IID\_IFOOBAR' th... | 2009/10/01 | [
"https://Stackoverflow.com/questions/1506456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/136396/"
] | [EDIT]
Add the definition of the variable somewhere (without `extern`). Extern identifiers without initializers are not definitions - the definition must be somewhere else. | To make an `extern`ly *declared* symbol appear in your symbol table as "undefined", you should actually *use* it from within a library.
If your object file neither contains a *definition* of symbol (as opposed to declaration) nor uses it somewhere inside its functions, then the symbol won't appear in the symbol table.... |
45,227,459 | I have a function that is used for dynamically building an update query that works by having a manually created form with fields that match the names of the table columns, then building the query based on the field names and values being submitted. However I have come across an instance where certain posted fields must... | 2017/07/21 | [
"https://Stackoverflow.com/questions/45227459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5175034/"
] | I have done a similar task in the past, perhaps it will give you some idea(s). This is assuming you are using `mysql`, if not, the filter may need some degree of manual handling.
1) Create a function that will extract the fields from the table. I have a class that I am feeding in which is labeled as `$db`. It will run... | Working now and updated to handle Insert, Update and Delete operations. I decided that I couldn't have separate functions for the update and insert query building due to the need for some special field processing so I moved the functionality back into the main formProcess() function. I did need to filter out certain fi... |
36,981,584 | I'm using CloudKit to download an array of records (contained in myArray) The myArray enumeration is within the completion handler of the CloudKit block. There are a few nested CloudKit queries and array enumerations (example below). From there, I'm creating managed objects in a loop, and saving them, which will run on... | 2016/05/02 | [
"https://Stackoverflow.com/questions/36981584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521653/"
] | Turn on concurrency debugging if you are worried about the threads. Add this as a command line parameter to the start up
```
-com.apple.CoreData.ConcurrencyDebug 1
```
see an example here; <http://oleb.net/blog/2014/06/core-data-concurrency-debugging/> | I think you are correct in worrying about threads because you can't be sure what thread your CloudKit completion block is being run. Try wrapping your object creation loop (and the save) within a [self.managedObjectContext performBlockAndWait] section. |
36,981,584 | I'm using CloudKit to download an array of records (contained in myArray) The myArray enumeration is within the completion handler of the CloudKit block. There are a few nested CloudKit queries and array enumerations (example below). From there, I'm creating managed objects in a loop, and saving them, which will run on... | 2016/05/02 | [
"https://Stackoverflow.com/questions/36981584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521653/"
] | Solved this issue using private queues with the help of the following documentation (in addition to the helpful comments/answers shared before this answer):
* [Correct implementation of parent/child NSManagedObjectContext](https://stackoverflow.com/questions/14284301/correct-implementation-of-parent-child-nsmanagedobj... | I think you are correct in worrying about threads because you can't be sure what thread your CloudKit completion block is being run. Try wrapping your object creation loop (and the save) within a [self.managedObjectContext performBlockAndWait] section. |
2,806 | In version 7 there exist these `Internal`` context functions:
```
?Internal`*Periodical*
```
>
> AddPeriodical Periodicals RemovePeriodical $ThisPeriodical
>
>
>
In a comment to [this answer](https://mathematica.stackexchange.com/a/2803/121) Szabolcs stated that these "seem to provide very similar (the sa... | 2012/03/11 | [
"https://mathematica.stackexchange.com/questions/2806",
"https://mathematica.stackexchange.com",
"https://mathematica.stackexchange.com/users/121/"
] | You can turn this then into a package, and change the lower-case to uppercase... Hope it works well enough for your goals. If not, we'll improve it in time
```
AppendTo[$ContextPath, "Internal`"];
ClearAll["`private`*"];
SetAttributes[`private`count, HoldRest];
`private`count[_, expr_, count_Symbol][id_, ___] /;
B... | As a starting point I'll write up what I found about these functions before. I'm hoping someone will take a better look at them and will write a more complete answer.
---
Spelunking in version 8,
```
Internal`AddPeriodical[Print["boo!"], 3]
```
Now you get a `boo!` every 3 seconds.
```
Internal`Periodicals[]
(* ... |
12,405,563 | I have a Apache load balancer and a jBoss cluster serving it.
Now I would like to add compression/gzip to the responses but so far I've only found how to enable it on the load balancer or on the http-connector in jBoss. Nothing about enabling it on the ajp-connector.
I don't want to do the compression on the load bal... | 2012/09/13 | [
"https://Stackoverflow.com/questions/12405563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/296452/"
] | HTTP client from apache is good, also look into jackson which will provide JSON parsing (https://github.com/FasterXML/jackson-core).
**UPDATE:**
Something else you can look into is Spring's [RestTemplate](http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html). Th... | If you want to perform HTTP request to another server I recommend you to user Apache HTTP client. You can configure it using Spring XML and inject into the context just as any other bean. |
363,324 | I installed TinyOS on RedHat for my academic purposes. Now I can't log in to the system.
I logged in in single user mode.
Then I tried to log in.
I couldn't login in as any user.
I couldn't start the X server manually (the system doesn't start the X server when it boots up).
Then I execute these commands
```
sh# hos... | 2011/12/01 | [
"https://superuser.com/questions/363324",
"https://superuser.com",
"https://superuser.com/users/144563/"
] | CentOS 5.x has the "gcc44" package containing GCC version 4.4. | You could try [Remi's repository](http://blog.famillecollet.com/pages/Config-en). It usually has more up to date packages than the normal CentOS repository. |
28,710,785 | I want to return the string of group 1 in this example, so I have a pattern like below. But it doesn't correct. Can anyone help me to write the pattern please?
```
Pattern pattern = Pattern.compile("^(\\w+-\\d)(\\s+)(\\d+)$");
String line = "list.txt-1 40";
Matcher list = pattern.matcher(line);
if(... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28710785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4599440/"
] | Yes, this does happen. This is what Ng-Cloak is used for.
Reference:
<https://docs.angularjs.org/api/ng/directive/ngCloak> | As far as I know, the handlebars do appear briefly, but they go away quickly enough that it is not noticeable. |
28,710,785 | I want to return the string of group 1 in this example, so I have a pattern like below. But it doesn't correct. Can anyone help me to write the pattern please?
```
Pattern pattern = Pattern.compile("^(\\w+-\\d)(\\s+)(\\d+)$");
String line = "list.txt-1 40";
Matcher list = pattern.matcher(line);
if(... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28710785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4599440/"
] | It depends how the template is loaded, and what directives are used on the page. If the template is loaded from a url or cache, it is processed through the template engine before being output to the page. In a full-on SPA that uses routing and ngView, the process goes like this:
* javascript loads, including angular
*... | As far as I know, the handlebars do appear briefly, but they go away quickly enough that it is not noticeable. |
28,710,785 | I want to return the string of group 1 in this example, so I have a pattern like below. But it doesn't correct. Can anyone help me to write the pattern please?
```
Pattern pattern = Pattern.compile("^(\\w+-\\d)(\\s+)(\\d+)$");
String line = "list.txt-1 40";
Matcher list = pattern.matcher(line);
if(... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28710785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4599440/"
] | Yes, this does happen. This is what Ng-Cloak is used for.
Reference:
<https://docs.angularjs.org/api/ng/directive/ngCloak> | I'm not familiar with Angular, but I assume handlebars templates work there the same way they do in Backbone: they're wrapped in `<script>` tags so that nothing between the script tags is displayed initially, including all the handlebars expressions.
These templates of course get compiled to javascript functions, whos... |
28,710,785 | I want to return the string of group 1 in this example, so I have a pattern like below. But it doesn't correct. Can anyone help me to write the pattern please?
```
Pattern pattern = Pattern.compile("^(\\w+-\\d)(\\s+)(\\d+)$");
String line = "list.txt-1 40";
Matcher list = pattern.matcher(line);
if(... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28710785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4599440/"
] | It depends how the template is loaded, and what directives are used on the page. If the template is loaded from a url or cache, it is processed through the template engine before being output to the page. In a full-on SPA that uses routing and ngView, the process goes like this:
* javascript loads, including angular
*... | I'm not familiar with Angular, but I assume handlebars templates work there the same way they do in Backbone: they're wrapped in `<script>` tags so that nothing between the script tags is displayed initially, including all the handlebars expressions.
These templates of course get compiled to javascript functions, whos... |
28,710,785 | I want to return the string of group 1 in this example, so I have a pattern like below. But it doesn't correct. Can anyone help me to write the pattern please?
```
Pattern pattern = Pattern.compile("^(\\w+-\\d)(\\s+)(\\d+)$");
String line = "list.txt-1 40";
Matcher list = pattern.matcher(line);
if(... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28710785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4599440/"
] | Yes, this does happen. This is what Ng-Cloak is used for.
Reference:
<https://docs.angularjs.org/api/ng/directive/ngCloak> | It depends how the template is loaded, and what directives are used on the page. If the template is loaded from a url or cache, it is processed through the template engine before being output to the page. In a full-on SPA that uses routing and ngView, the process goes like this:
* javascript loads, including angular
*... |
28,710,785 | I want to return the string of group 1 in this example, so I have a pattern like below. But it doesn't correct. Can anyone help me to write the pattern please?
```
Pattern pattern = Pattern.compile("^(\\w+-\\d)(\\s+)(\\d+)$");
String line = "list.txt-1 40";
Matcher list = pattern.matcher(line);
if(... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28710785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4599440/"
] | Yes, this does happen. This is what Ng-Cloak is used for.
Reference:
<https://docs.angularjs.org/api/ng/directive/ngCloak> | Best pratices for not showing such curly braces before js executes you can use **ng-bind** or **ng-cloak**
```
<script>
angular.module('eg', [])
.controller('egCtrl', ['$scope', function($scope) {
$scope.name = 'Aerovistae';
}]);
</script>
<div ng-app="eg" ng-controller="egCtrl">
Enter name: <input ... |
28,710,785 | I want to return the string of group 1 in this example, so I have a pattern like below. But it doesn't correct. Can anyone help me to write the pattern please?
```
Pattern pattern = Pattern.compile("^(\\w+-\\d)(\\s+)(\\d+)$");
String line = "list.txt-1 40";
Matcher list = pattern.matcher(line);
if(... | 2015/02/25 | [
"https://Stackoverflow.com/questions/28710785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4599440/"
] | It depends how the template is loaded, and what directives are used on the page. If the template is loaded from a url or cache, it is processed through the template engine before being output to the page. In a full-on SPA that uses routing and ngView, the process goes like this:
* javascript loads, including angular
*... | Best pratices for not showing such curly braces before js executes you can use **ng-bind** or **ng-cloak**
```
<script>
angular.module('eg', [])
.controller('egCtrl', ['$scope', function($scope) {
$scope.name = 'Aerovistae';
}]);
</script>
<div ng-app="eg" ng-controller="egCtrl">
Enter name: <input ... |
61,542,419 | How do I position the form(inside a card), 3-cols from both sides so the form lies in about 6-cols in the middle without using Bootstrap, Materialize or anything similar
Thanks
```html
<div class="card">
<div class="form_top">
<h1>Form</h1>
</div>
<div class="field1">
<label>... | 2020/05/01 | [
"https://Stackoverflow.com/questions/61542419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can achieve the same in Kotlin using `map.keys.elementAt(index)`
```kotlin
import java.util.TreeMap
fun main() {
val index = 0
val map = TreeMap<String, String>()
map.put("1", "Test")
map.put("2", "Test2")
val obj = map.keys.elementAt(index)
print(obj)
}
``` | If you need to stick to the `toArray()[index]` call for some reason, you can use `myMap.keys.toTypedArray()[index]`, see the example below:
```
import java.util.TreeMap
fun main() {
val map = TreeMap<String, String>()
map.put("key", "value")
println(map.keys.toTypedArray()[0])
}
```
Otherwise, @Marek's ... |
2,838,700 | How can I determine the extrema (minima and maxima) of $f: D \to \mathbb{R}$
$$f(x,y)=e^{x(y+1)}$$
for $D=\{(x,y) \in \mathbb{R}^2:\sqrt{x^2+y^2} \le 1\}?$
The solution should be $\Big(\frac{\sqrt{3}}{2},\frac{1}{2}\Big)$ for the maximum and $\Big(-\frac{\sqrt{3}}{2},\frac{1}{2}\Big)$ for the minimum. | 2018/07/02 | [
"https://math.stackexchange.com/questions/2838700",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/571741/"
] | Undergradute Analysis by Serge Lang
Mathematical Analysis by Tom Apostol
Principles of Mathematical Analysis by Walter Rudin
Calculus Volumes I and II by Tom Apostol
Linear Algebra by Serge Lang
Linear Algebra with Applications by W. Keith Nicholson
Complex Analysis by Theodore W. Gamelin
Complex Analysis by Jos... | *Visual Complex Analysis*, by Needham, is a wonderful book which helps gaining a lot of intuition on the subject (especially geometric and visual one). |
2,838,700 | How can I determine the extrema (minima and maxima) of $f: D \to \mathbb{R}$
$$f(x,y)=e^{x(y+1)}$$
for $D=\{(x,y) \in \mathbb{R}^2:\sqrt{x^2+y^2} \le 1\}?$
The solution should be $\Big(\frac{\sqrt{3}}{2},\frac{1}{2}\Big)$ for the maximum and $\Big(-\frac{\sqrt{3}}{2},\frac{1}{2}\Big)$ for the minimum. | 2018/07/02 | [
"https://math.stackexchange.com/questions/2838700",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/571741/"
] | Undergradute Analysis by Serge Lang
Mathematical Analysis by Tom Apostol
Principles of Mathematical Analysis by Walter Rudin
Calculus Volumes I and II by Tom Apostol
Linear Algebra by Serge Lang
Linear Algebra with Applications by W. Keith Nicholson
Complex Analysis by Theodore W. Gamelin
Complex Analysis by Jos... | Introduction to Real Analysis by Robert Bartle
Multivariate Calculus by James Hurley
Differential Equations by Shepley Ross
Complex Fundamentals of Complex Analysis for Mathematics, Science And Engineering (2nd Edition)
by E. B. Saff (Author), A. D. Snider (Author)
Introduction to Linear Algebra (Gilbert Strang) |
2,838,700 | How can I determine the extrema (minima and maxima) of $f: D \to \mathbb{R}$
$$f(x,y)=e^{x(y+1)}$$
for $D=\{(x,y) \in \mathbb{R}^2:\sqrt{x^2+y^2} \le 1\}?$
The solution should be $\Big(\frac{\sqrt{3}}{2},\frac{1}{2}\Big)$ for the maximum and $\Big(-\frac{\sqrt{3}}{2},\frac{1}{2}\Big)$ for the minimum. | 2018/07/02 | [
"https://math.stackexchange.com/questions/2838700",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/571741/"
] | *Visual Complex Analysis*, by Needham, is a wonderful book which helps gaining a lot of intuition on the subject (especially geometric and visual one). | Introduction to Real Analysis by Robert Bartle
Multivariate Calculus by James Hurley
Differential Equations by Shepley Ross
Complex Fundamentals of Complex Analysis for Mathematics, Science And Engineering (2nd Edition)
by E. B. Saff (Author), A. D. Snider (Author)
Introduction to Linear Algebra (Gilbert Strang) |
18,061,588 | I am using asm for inserting a callback function inside each function which is executed.
How can I print the arguents values which?
I am using MethodAdapter.visitCode to inject my function into each function ran.
I want to insert the function argument into an array and send my callbackk function this array and return... | 2013/08/05 | [
"https://Stackoverflow.com/questions/18061588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/750395/"
] | Before the for loop, you are storing/creating your array onto the local variable table at the `paramLength` index. But after the loop, you are accessing it from the `i`th index. Just to be safe: replace `i` with `paramLength` in your third-to-last source-code statement; i.e. do this: `this.visitVarInsn(Opcodes.ALOAD, p... | In AMS 9.x
I have a simple suggest.
```
// org.objectweb.asm.commons.GeneratorAdapter
public void loadArgArray() {
push(argumentTypes.length);
newArray(OBJECT_TYPE);
for (int i = 0; i < argumentTypes.length; i++) {
dup();
push(i);
loadArg(i);
box(argumentTypes[i]);
arrayS... |
23,212,643 | I need to get the values of my JSON object at the back end using C#. The JSON object is as follows:
```
{ "StudentName": "Michael Lumb", "SubjectCodes": [ "1", "2" ], "Grade": "3"}
```
The code I have tried is this:
```
public string AddStudent(JObject studentData)
{
dynamic dObject = JObject.Parse(stude... | 2014/04/22 | [
"https://Stackoverflow.com/questions/23212643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1640256/"
] | Install newtonsoft:
```
Install-Package Newtonsoft.Json
```
Convert from json:
```
string json = "{ 'StudentName': 'Michael Lumb', 'SubjectCodes': ['1','2'], 'Grade': '3'}";
Student student = JsonConvert.DeserializeObject<Student>(json);
```
Convert to json:
```
string json = JsonConvert.Serialize(student);
``` | Download NewtonSoft.dll from <http://james.newtonking.com/json>
it has methods to convert data to json files and vice versa |
23,212,643 | I need to get the values of my JSON object at the back end using C#. The JSON object is as follows:
```
{ "StudentName": "Michael Lumb", "SubjectCodes": [ "1", "2" ], "Grade": "3"}
```
The code I have tried is this:
```
public string AddStudent(JObject studentData)
{
dynamic dObject = JObject.Parse(stude... | 2014/04/22 | [
"https://Stackoverflow.com/questions/23212643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1640256/"
] | Download NewtonSoft.dll from <http://james.newtonking.com/json>
it has methods to convert data to json files and vice versa | Found the answer in a [similar StackOverflow question](https://stackoverflow.com/questions/13565245/convert-newtonsoft-json-linq-jarray-to-a-list-of-specific-object-type).
But you should also consider using strongly typed objects:
```
public class Student
{
public string StudentName { get; set; }
public st... |
23,212,643 | I need to get the values of my JSON object at the back end using C#. The JSON object is as follows:
```
{ "StudentName": "Michael Lumb", "SubjectCodes": [ "1", "2" ], "Grade": "3"}
```
The code I have tried is this:
```
public string AddStudent(JObject studentData)
{
dynamic dObject = JObject.Parse(stude... | 2014/04/22 | [
"https://Stackoverflow.com/questions/23212643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1640256/"
] | Install newtonsoft:
```
Install-Package Newtonsoft.Json
```
Convert from json:
```
string json = "{ 'StudentName': 'Michael Lumb', 'SubjectCodes': ['1','2'], 'Grade': '3'}";
Student student = JsonConvert.DeserializeObject<Student>(json);
```
Convert to json:
```
string json = JsonConvert.Serialize(student);
``` | Found the answer in a [similar StackOverflow question](https://stackoverflow.com/questions/13565245/convert-newtonsoft-json-linq-jarray-to-a-list-of-specific-object-type).
But you should also consider using strongly typed objects:
```
public class Student
{
public string StudentName { get; set; }
public st... |
28,994,396 | I'm trying to change the height of the Twitter feed module you can see [here](http://chugiakhigh.asdk12.org/). The layout was done by the vendor we're using for our WCMS, so the CSS is proving a little difficult to navigate. I resized the iFrame for the feed so that it spans two rows, but now when it resizes for phones... | 2015/03/11 | [
"https://Stackoverflow.com/questions/28994396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4659792/"
] | Your route requires a POST request, which the button makes, but `link_to` makes an `<a>` element, which will make a GET request. You can't make an `<a>` submit a POST. I suggest you use the button and restyle it with CSS to look like a link. | You can use the `:method` option to set http verb (e.g. `:post`) in `link_to` (see <http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to>).
However, you should consider changing your route since the `reviews#new` action renders the new review form. Use the POST request when creating or... |
31,794,811 | How can I update Einstein's score to a 100 in the controller?
In a controller, I have an array of JSON objects like :
```
items = [
{title:"John", score:24},
{title:"Einstein", score:2},
{title:"Mary", score:19}
];
```
This is rendered in the template using component like this : ... | 2015/08/03 | [
"https://Stackoverflow.com/questions/31794811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1917463/"
] | I discovered the Ember way of doing this:
```
var elem = items.objectAt(1);
Ember.set(elem, 'score', 100);
``` | You could use `.findBy` to find the record and give it a new value.
If you aren't using Ember Data for your data layer then I would also make the array of objects Ember Objects so you can use `.get` and `.set` to update the attributes.
Here's a [full JSBin](http://emberjs.jsbin.com/zayehemegu/edit?html,js,console,out... |
31,794,811 | How can I update Einstein's score to a 100 in the controller?
In a controller, I have an array of JSON objects like :
```
items = [
{title:"John", score:24},
{title:"Einstein", score:2},
{title:"Mary", score:19}
];
```
This is rendered in the template using component like this : ... | 2015/08/03 | [
"https://Stackoverflow.com/questions/31794811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1917463/"
] | I discovered the Ember way of doing this:
```
var elem = items.objectAt(1);
Ember.set(elem, 'score', 100);
``` | Where exactly are you trying to set the score to 100?
If you make your items Ember objects
```
items = [
{title:"John", score:24},
{title:"Einstein", score:2},
{title:"Mary", score:19}
].map(function(item) { return Ember.Object.create(item) });
```
you will be able to use the sett... |
46,642,247 | I'm making a quiz program that asks the user simple math questions, recieves an answer, calculates the user's score, etc...
I'm getting an error because I'm using a variable (in this case, x) inside an actionListener:
```
for(x = 0;x < total;x++){
System.out.print((x+1)+". ");
questionLabel.setText(number1" + "+ num... | 2017/10/09 | [
"https://Stackoverflow.com/questions/46642247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8744687/"
] | The best way is to define an extra class for this ActionListener implementation.
```
public class NumberedActionListener implements ActionListener {
private int number;
public NumberedActionListener(int number) {
this.number = number;
}
@Override
public void actionPerformed(ActionEvent e) {
// ...... | You can assign the value of `x` to another variable inside the `for`-loop and then make that variable final.
```
for(x = 0;x < total;x++){
final int index = x;
// use index inside your actionListener
}
``` |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | ES6 solution:
Just keep a track of the reversed list and keep adding that to tmp.
```
const reverseLinkedList = (head) => {
let reversed = null;
while(head) {
const tmp = head;
head = head.next;
tmp.next = reversed;
reversed = tmp;
}
return reversed;
};
console.log(JSON.stringify(reverseLinke... | Since inserting data at the beginning of the linked list pushes other first nodes till the end, and since it's a `O(1)` process.
Then I created the following function `reverse()`
where it basically insert node elements in the beginning which basically will get a reversed list at the end.
Here's a demo down below:
```... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | There are a couple of problems with your code. This should make it clear.
```
// reverse a linked list
var reverseLinkedList = function(linkedlist) {
var node = linkedlist;
var previous = null;
while(node) {
// save next or you lose it!!!
var save = node.next;
// reverse pointer
node.next = pr... | **Reversing the SinglyLinkedList:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL**
To understand The Solution we have to keep track of previous head and next variables
for example in above input Head = 1 ; next = 2 we don't have previous so assume previous = null
loop the list till head is not null. reverse th... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | There are a couple of problems with your code. This should make it clear.
```
// reverse a linked list
var reverseLinkedList = function(linkedlist) {
var node = linkedlist;
var previous = null;
while(node) {
// save next or you lose it!!!
var save = node.next;
// reverse pointer
node.next = pr... | Since inserting data at the beginning of the linked list pushes other first nodes till the end, and since it's a `O(1)` process.
Then I created the following function `reverse()`
where it basically insert node elements in the beginning which basically will get a reversed list at the end.
Here's a demo down below:
```... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | **Reversing the SinglyLinkedList:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL**
To understand The Solution we have to keep track of previous head and next variables
for example in above input Head = 1 ; next = 2 we don't have previous so assume previous = null
loop the list till head is not null. reverse th... | Since inserting data at the beginning of the linked list pushes other first nodes till the end, and since it's a `O(1)` process.
Then I created the following function `reverse()`
where it basically insert node elements in the beginning which basically will get a reversed list at the end.
Here's a demo down below:
```... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | There are a couple of problems with your code. This should make it clear.
```
// reverse a linked list
var reverseLinkedList = function(linkedlist) {
var node = linkedlist;
var previous = null;
while(node) {
// save next or you lose it!!!
var save = node.next;
// reverse pointer
node.next = pr... | This is my recursive solution:
<https://codesandbox.io/s/reverse-linked-list-tqh2tq?file=/src/index.js>
```
let d = { me: "d" };
let c = { me: "c", next: d };
let b = { me: "b", next: c };
let a = { me: "a", next: b };
const reverseMe = (o) => {
let lastDude;
if (o.next.next) lastDude = reverseMe(o.next);
else... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | You could solve this problem recursively in O(n) time as [ckersch](https://stackoverflow.com/users/2066336/ckersch) mentions. The thing is, that you need to know that recursion is memory intensive since functions accumulate in the calls stack until they hit the stop condition and start returning actual things.
The way... | This is my recursive solution:
<https://codesandbox.io/s/reverse-linked-list-tqh2tq?file=/src/index.js>
```
let d = { me: "d" };
let c = { me: "c", next: d };
let b = { me: "b", next: c };
let a = { me: "a", next: b };
const reverseMe = (o) => {
let lastDude;
if (o.next.next) lastDude = reverseMe(o.next);
else... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | This would be O(n) in time, since you do a constant number of operations on each node. Conceptually, there isn't a more efficient way of doing things (in terms of big-O notation, there's some code optimization that could be done.)
The reason why you can't exceed O(n) is because, in order to do so, you would need to sk... | **Reversing the SinglyLinkedList:
Input: 1->2->3->4->5->NULL
Output: 5->4->3->2->1->NULL**
To understand The Solution we have to keep track of previous head and next variables
for example in above input Head = 1 ; next = 2 we don't have previous so assume previous = null
loop the list till head is not null. reverse th... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | This would be O(n) in time, since you do a constant number of operations on each node. Conceptually, there isn't a more efficient way of doing things (in terms of big-O notation, there's some code optimization that could be done.)
The reason why you can't exceed O(n) is because, in order to do so, you would need to sk... | This is my recursive solution:
<https://codesandbox.io/s/reverse-linked-list-tqh2tq?file=/src/index.js>
```
let d = { me: "d" };
let c = { me: "c", next: d };
let b = { me: "b", next: c };
let a = { me: "a", next: b };
const reverseMe = (o) => {
let lastDude;
if (o.next.next) lastDude = reverseMe(o.next);
else... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | There are a couple of problems with your code. This should make it clear.
```
// reverse a linked list
var reverseLinkedList = function(linkedlist) {
var node = linkedlist;
var previous = null;
while(node) {
// save next or you lose it!!!
var save = node.next;
// reverse pointer
node.next = pr... | ```js
//O(n) | O(1) wherre n is the number of nodes in the linked list
class Node{
constructor(val){
this.val = val;
this.next = null;
}
}
function reverseLinkedList(head) {
if(!head) return null;
let p1 = head;
let p2 = null;
while(p1){
let temp = p1.next;
p1.next = p2;
p2 = p1... |
23,278,017 | I just struggled through a simple interview question: Please reverse a singly linked list.
While I failed to provide a working answer in time to save the interview, I was able to come up with a solution afterwards.
Is my solution correct? How would you analyze this with Big-Oh? Are there more efficient ways to revers... | 2014/04/24 | [
"https://Stackoverflow.com/questions/23278017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2954463/"
] | There are a couple of problems with your code. This should make it clear.
```
// reverse a linked list
var reverseLinkedList = function(linkedlist) {
var node = linkedlist;
var previous = null;
while(node) {
// save next or you lose it!!!
var save = node.next;
// reverse pointer
node.next = pr... | ES6 solution:
Just keep a track of the reversed list and keep adding that to tmp.
```
const reverseLinkedList = (head) => {
let reversed = null;
while(head) {
const tmp = head;
head = head.next;
tmp.next = reversed;
reversed = tmp;
}
return reversed;
};
console.log(JSON.stringify(reverseLinke... |
28,947,332 | This is a first, never saw this in my life, and I do this job for the past 20 years...
I have a customer, with a form issue, when you submit the form only the hidden fields and static values are send.
Simulation...
In the code I have this
```
<form action="index.php?option=com_kocgc&format=raw&task=preview_card&la... | 2015/03/09 | [
"https://Stackoverflow.com/questions/28947332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2624063/"
] | why using `div` instead of `submit` button?
```
<div class="btn btn-warning koBtn" id="koBtnSave">Save</div>
```
change it to something like this:
```
<input type = "submit" class="btn btn-warning koBtn" id="koBtnSave" value="Save" />
``` | Ahhh I found the answer of this weird issue.
The customer have the CloudFlare cache enable for his website, I ask to disable it and the problem was gone, I ask to enable it and restore the original setting and the problem is history.
I think he play in the setting and do something about the form.
Anyway it was a cod... |
17,640,107 | I have a function that gets all neighbours of a list of points in a grid out to a certain distance, which involves a lot of duplicates (my neighbour's neighbour == me again).
I've been experimenting with a couple of different solutions, but I have no idea which is the more efficient. Below is some code demonstrating t... | 2013/07/14 | [
"https://Stackoverflow.com/questions/17640107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/535103/"
] | A great deal here is likely to depend on the size of the output set (which, in turn, will depend on how distant of neighbors you sample).
If it's small, (no more than a few dozen items or so) your hand-rolled set implementation using `std::vector` and `std::find` will probably remain fairly competitive. Its problem is... | Unsorted set has a constant time complexity o(1) for insertion (on average), so the operation will be o(n) where n is the number is elements before removal.
sorting a list of element of size n is o(n log n), going over the list to remove duplicates is o(n). o(n log n) + o(n) = o(n log n)
The unsorted set (which is si... |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | `__asm__ __volatile__ ("bkpt #0");`
See [BKPT](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABHCHGB.html) man entry. | For Windows on ARM, the instrinsic `__debugbreak()` still works which utilizes undefined opcode.
```
nt!DbgBreakPointWithStatus:
defe __debugbreak
``` |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | ARM does not define a specific breakpoint instruction. It can be different in different OSes. On ARM Linux it's usually an UND opcode (e.g. `FE DE FF E7`) in ARM mode and BKPT (`BE BE`) in Thumb.
With GCC compilers, you can usually use `__builtin_trap()` intrinsic to generate a platform-specific breakpoint. Another op... | `__asm__ __volatile__ ("bkpt #0");`
See [BKPT](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABHCHGB.html) man entry. |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | Using arm-none-eabi-gdb.exe cross compiler, this works great for me (thanks to Igor's answer):
```
__asm__("BKPT");
``` | Although the original question asked about Cortex-A7 which is ARMv7-A, on ARMv8 GDB uses
>
> *brk #0*
>
>
> |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | ARM does not define a specific breakpoint instruction. It can be different in different OSes. On ARM Linux it's usually an UND opcode (e.g. `FE DE FF E7`) in ARM mode and BKPT (`BE BE`) in Thumb.
With GCC compilers, you can usually use `__builtin_trap()` intrinsic to generate a platform-specific breakpoint. Another op... | We can use breakpoint inst:
* For A32: use
[BRK #imm](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0802a/BRK.html) instruction
* For Arm and Thumb: use [BKPT #imme](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihbiggi.html) instruction.
Or we can use [UND](http://infocenter... |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | ARM does not define a specific breakpoint instruction. It can be different in different OSes. On ARM Linux it's usually an UND opcode (e.g. `FE DE FF E7`) in ARM mode and BKPT (`BE BE`) in Thumb.
With GCC compilers, you can usually use `__builtin_trap()` intrinsic to generate a platform-specific breakpoint. Another op... | On my armv7hl (i.MX6q with linux 4.1.15) system, to set a breakpoint in another process, I use :
ptrace(PTRACE\_POKETEXT, pid, address, 0xe7f001f0)
I choose that value after strace'ing gdb :)
This works perfectly : I can examine the traced process, restore the original instruction, and restart the process with PTRAC... |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | I have a simple library ([scottt/debugbreak](https://github.com/scottt/debugbreak)) just for this:
```
#include <debugbreak.h>
...
debug_break();
```
Just copy the single `debugbreak.h` header into your code and it'll correctly handle ARM, AArch64, i386, x86-64 and even MSVC. | For Windows on ARM, the instrinsic `__debugbreak()` still works which utilizes undefined opcode.
```
nt!DbgBreakPointWithStatus:
defe __debugbreak
``` |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | `__asm__ __volatile__ ("bkpt #0");`
See [BKPT](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABHCHGB.html) man entry. | On my armv7hl (i.MX6q with linux 4.1.15) system, to set a breakpoint in another process, I use :
ptrace(PTRACE\_POKETEXT, pid, address, 0xe7f001f0)
I choose that value after strace'ing gdb :)
This works perfectly : I can examine the traced process, restore the original instruction, and restart the process with PTRAC... |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | ARM does not define a specific breakpoint instruction. It can be different in different OSes. On ARM Linux it's usually an UND opcode (e.g. `FE DE FF E7`) in ARM mode and BKPT (`BE BE`) in Thumb.
With GCC compilers, you can usually use `__builtin_trap()` intrinsic to generate a platform-specific breakpoint. Another op... | I have a simple library ([scottt/debugbreak](https://github.com/scottt/debugbreak)) just for this:
```
#include <debugbreak.h>
...
debug_break();
```
Just copy the single `debugbreak.h` header into your code and it'll correctly handle ARM, AArch64, i386, x86-64 and even MSVC. |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | Using arm-none-eabi-gdb.exe cross compiler, this works great for me (thanks to Igor's answer):
```
__asm__("BKPT");
``` | ARM does not define a specific breakpoint instruction. It can be different in different OSes. On ARM Linux it's usually an UND opcode (e.g. `FE DE FF E7`) in ARM mode and BKPT (`BE BE`) in Thumb.
With GCC compilers, you can usually use `__builtin_trap()` intrinsic to generate a platform-specific breakpoint. Another op... |
11,345,371 | How do I do the equivalent of an x86 software interrupt:
```
asm( "int $3" )
```
on an ARM processor (specifically a Cortex A8) to generate an event that will break execution under gdb? | 2012/07/05 | [
"https://Stackoverflow.com/questions/11345371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307745/"
] | `__asm__ __volatile__ ("bkpt #0");`
See [BKPT](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABHCHGB.html) man entry. | We can use breakpoint inst:
* For A32: use
[BRK #imm](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0802a/BRK.html) instruction
* For Arm and Thumb: use [BKPT #imme](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0489c/Cihbiggi.html) instruction.
Or we can use [UND](http://infocenter... |
31,186,394 | how to select radio button & checkbox in selenium webdriver with java? | 2015/07/02 | [
"https://Stackoverflow.com/questions/31186394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5073586/"
] | **For selecting Radio button**
```
driver.findElement(By.xpath(".//*[@id='ValidRadio_3']")).click();
```
**For selecting Checkbox**
```
driver.findElement(By.xpath(".//*[@id='ValidCheckbox_1']")).click();
``` | **Answer** : select radio button & checkbox in selenium webdriver with java go through below code.
**Click on Radio button :**
```
driver.findElement(By.id("RadioBtn_ID")).click();
```
**Click on Checkbox :**
```
driver.findElement(By.id("Checkbox_ID")).click();
```
For more details with brief description go thr... |
38,646,822 | I'm working in a IBM environment, specifically with AS400 machines and DB2 databases.
My next task is converting every possible file from PF and LF, to SQL (for instance, CREATE TABLE... and CREATE VIEW...).
Are there cases when I can't do that?
I know that for multiple record format file you can't, is it true? | 2016/07/28 | [
"https://Stackoverflow.com/questions/38646822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1392277/"
] | With System i Navigator on a PC, connect to your server and drill down into Databases and a schema. Click on either Tables or Views to list (possibly all) PFs or LFs in that library. Then, right-click the selections and select 'Generate SQL'. I suggest choosing to generate into 'Run SQL scripts'.
The result will be a ... | Yes, there are cases where a file cannot be 'converted to SQL.'
Multiformat logicals are one such case.
Program described physicals are another.
There may be others where the API cannot generate DDL. This sounds as if you are replacing IBM i with something else. Be advised that DB2 for i is a somewhat different dial... |
38,646,822 | I'm working in a IBM environment, specifically with AS400 machines and DB2 databases.
My next task is converting every possible file from PF and LF, to SQL (for instance, CREATE TABLE... and CREATE VIEW...).
Are there cases when I can't do that?
I know that for multiple record format file you can't, is it true? | 2016/07/28 | [
"https://Stackoverflow.com/questions/38646822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1392277/"
] | With System i Navigator on a PC, connect to your server and drill down into Databases and a schema. Click on either Tables or Views to list (possibly all) PFs or LFs in that library. Then, right-click the selections and select 'Generate SQL'. I suggest choosing to generate into 'Run SQL scripts'.
The result will be a ... | Yes one case is when the file has more than one member. Any pf that has max members greater than 1 will cause problems. You can create a list of all PF with multiple members with the dspfd command.
```
dspfd file(*all/*allusr) type(*mbr) output(*outfile) outfile(mylib/myfile)
```
Search the outfile for max members >... |
38,646,822 | I'm working in a IBM environment, specifically with AS400 machines and DB2 databases.
My next task is converting every possible file from PF and LF, to SQL (for instance, CREATE TABLE... and CREATE VIEW...).
Are there cases when I can't do that?
I know that for multiple record format file you can't, is it true? | 2016/07/28 | [
"https://Stackoverflow.com/questions/38646822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1392277/"
] | Yes, there are cases where a file cannot be 'converted to SQL.'
Multiformat logicals are one such case.
Program described physicals are another.
There may be others where the API cannot generate DDL. This sounds as if you are replacing IBM i with something else. Be advised that DB2 for i is a somewhat different dial... | Yes one case is when the file has more than one member. Any pf that has max members greater than 1 will cause problems. You can create a list of all PF with multiple members with the dspfd command.
```
dspfd file(*all/*allusr) type(*mbr) output(*outfile) outfile(mylib/myfile)
```
Search the outfile for max members >... |
20,185,950 | I have requirement, where i have to give rownumber for each record returned by my query based on the total count of the rows returned.
lets say a rownumber for each 3 record.
for ex.
```
colA colB colC(rowno)
1 abc 1
2 asd 1
3 asw 1
4 tre 2
5 cfr 2
6 dfr 2
7 sdf 3
`... | 2013/11/25 | [
"https://Stackoverflow.com/questions/20185950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1958279/"
] | Use some maths and the integer division rules:
```
select colA,colB,(ROW_NUMBER() OVER (ORDER BY colA)+2)/3 as colC
from table
```
The two integer constants are related - you always want the inner constant (`2`) to be one less than the number of rows which should be assigned the same number (`3`). | try this
```
SELECT ROW_NUMBER() OVER (Order by [Col]) as ColID FROM [TABLE NAME]
WHERE colC = 3
``` |
65,010,281 | I'm running the next script from my local host and the production server, and Im getting different outputs. Anyone knows why am I getting that `false` from my localhost?
```
<?php
$host = 'ssl://mail.companyname.org';
$port = 993;
$error = 0;
$errorString = "";
var_dump(fsockopen($host, $port, $error, $errorString, 3... | 2020/11/25 | [
"https://Stackoverflow.com/questions/65010281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/248959/"
] | it seems this is problem with server certificate :
first you can check if your server certificate and its chains are valid by this:
<https://www.sslshopper.com/ssl-checker.htm>
if somethings were wrong in ssl-checker?
* you can try to correct SSL certificate configs in *companyname.org*
if you succeed and error wa... | Remove the @ symbol. You are hiding error messages that might tell you what the problem is. You should also set a variable in the errorno argument to fsockopen() and echo it for debugging.
My guess would be that you haven't installed PHP with SSL support on your local server. See [here](https://www.php.net/manual/en/o... |
65,010,281 | I'm running the next script from my local host and the production server, and Im getting different outputs. Anyone knows why am I getting that `false` from my localhost?
```
<?php
$host = 'ssl://mail.companyname.org';
$port = 993;
$error = 0;
$errorString = "";
var_dump(fsockopen($host, $port, $error, $errorString, 3... | 2020/11/25 | [
"https://Stackoverflow.com/questions/65010281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/248959/"
] | it seems this is problem with server certificate :
first you can check if your server certificate and its chains are valid by this:
<https://www.sslshopper.com/ssl-checker.htm>
if somethings were wrong in ssl-checker?
* you can try to correct SSL certificate configs in *companyname.org*
if you succeed and error wa... | Per the [documentation](https://www.php.net/manual/en/function.fsockopen.php) for `fsockopen`
>
> The function [stream\_socket\_client()](https://www.php.net/manual/en/function.stream-socket-client.php) is similar but provides a richer set of options, including non-blocking connection and the ability to provide a str... |
31,639,913 | Hi I have searched all over and I still cannot find any information that would help me with this task. How would I create a custom tab bar that looks like this using Swift:
Here is a link to the image of what the tab bar looks like:
[![http://2.bp.blogspot.com/-QlGT8CjZqJw/VbUZDwlRXzI/AAAAAAAAEHg/zqT_1Valsvo/s1600/Tab... | 2015/07/26 | [
"https://Stackoverflow.com/questions/31639913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5158019/"
] | Try this code in applicationDidFinishLaunchingWithOption.
"tabbarbg.png" image height=49.
```
UITabBar.appearance().tintColor = UIColor.lightGrayColor()//selected tab color
UITabBar.appearance().backgroundImage = UIImage(named:"tabbarbg.png")
UITabBar.appearance().barTintColor = UIColor.whiteColor()
``` | You'll need to create the icons yourself in a separate software, then import them in Images.xcassets, then apply them using the main.storyboard |
31,639,913 | Hi I have searched all over and I still cannot find any information that would help me with this task. How would I create a custom tab bar that looks like this using Swift:
Here is a link to the image of what the tab bar looks like:
[![http://2.bp.blogspot.com/-QlGT8CjZqJw/VbUZDwlRXzI/AAAAAAAAEHg/zqT_1Valsvo/s1600/Tab... | 2015/07/26 | [
"https://Stackoverflow.com/questions/31639913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5158019/"
] | First, you would need the assets in @2x and @3x forms(@1x if you are developing for before iOS 7). The icons need to be square with a set of white icons in the sizes below and icons with hex color `#2E967E` and the background alpha with sizes:
* icon@2x = 50x50
* icon@3x = 75x75
You would need to go to `images.xcasse... | You'll need to create the icons yourself in a separate software, then import them in Images.xcassets, then apply them using the main.storyboard |
31,639,913 | Hi I have searched all over and I still cannot find any information that would help me with this task. How would I create a custom tab bar that looks like this using Swift:
Here is a link to the image of what the tab bar looks like:
[![http://2.bp.blogspot.com/-QlGT8CjZqJw/VbUZDwlRXzI/AAAAAAAAEHg/zqT_1Valsvo/s1600/Tab... | 2015/07/26 | [
"https://Stackoverflow.com/questions/31639913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5158019/"
] | Try this code in applicationDidFinishLaunchingWithOption.
"tabbarbg.png" image height=49.
```
UITabBar.appearance().tintColor = UIColor.lightGrayColor()//selected tab color
UITabBar.appearance().backgroundImage = UIImage(named:"tabbarbg.png")
UITabBar.appearance().barTintColor = UIColor.whiteColor()
``` | It is very easy to set up the image for the tab bar view controller all you need is different images for the tabs that you want to use. first of all open up your story board and select the tab [ie., tab bar view controller followed by navigation controller followed by view controller like this if u set up you will get ... |
31,639,913 | Hi I have searched all over and I still cannot find any information that would help me with this task. How would I create a custom tab bar that looks like this using Swift:
Here is a link to the image of what the tab bar looks like:
[![http://2.bp.blogspot.com/-QlGT8CjZqJw/VbUZDwlRXzI/AAAAAAAAEHg/zqT_1Valsvo/s1600/Tab... | 2015/07/26 | [
"https://Stackoverflow.com/questions/31639913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5158019/"
] | First, you would need the assets in @2x and @3x forms(@1x if you are developing for before iOS 7). The icons need to be square with a set of white icons in the sizes below and icons with hex color `#2E967E` and the background alpha with sizes:
* icon@2x = 50x50
* icon@3x = 75x75
You would need to go to `images.xcasse... | It is very easy to set up the image for the tab bar view controller all you need is different images for the tabs that you want to use. first of all open up your story board and select the tab [ie., tab bar view controller followed by navigation controller followed by view controller like this if u set up you will get ... |
31,639,913 | Hi I have searched all over and I still cannot find any information that would help me with this task. How would I create a custom tab bar that looks like this using Swift:
Here is a link to the image of what the tab bar looks like:
[![http://2.bp.blogspot.com/-QlGT8CjZqJw/VbUZDwlRXzI/AAAAAAAAEHg/zqT_1Valsvo/s1600/Tab... | 2015/07/26 | [
"https://Stackoverflow.com/questions/31639913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5158019/"
] | First, you would need the assets in @2x and @3x forms(@1x if you are developing for before iOS 7). The icons need to be square with a set of white icons in the sizes below and icons with hex color `#2E967E` and the background alpha with sizes:
* icon@2x = 50x50
* icon@3x = 75x75
You would need to go to `images.xcasse... | Try this code in applicationDidFinishLaunchingWithOption.
"tabbarbg.png" image height=49.
```
UITabBar.appearance().tintColor = UIColor.lightGrayColor()//selected tab color
UITabBar.appearance().backgroundImage = UIImage(named:"tabbarbg.png")
UITabBar.appearance().barTintColor = UIColor.whiteColor()
``` |
48,828,590 | I´m trying to add a new feature to a project I´m currently working on.
The idea is that, when certain variable gets a value the application sends an automated email to a mailbox as a warning notification.
I did some research about SmtpClient and I believe that is the best approach to add this new feature, but I have ... | 2018/02/16 | [
"https://Stackoverflow.com/questions/48828590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8138067/"
] | •Prevent email spamming: I want this email to be sent just once per event change.
If it is a background event then how can it be used for spamming? Your users wouldn't know about this feature, When your event is triggered the email will be sent.
•Email body building: How should I build the emails body.
Email b... | 1. Create a table in your database, and have a background worker to handle the email-sending-process. This way you can run it every 10 minute, and only send mails if theres anything new in the table. And when you send it, you can combine every event within the last 10 minutes in one message..
2. The body can just be pl... |
9,728,010 | ```
$.ajax({
type: "POST",
url: "/zzz/bbb/abcd.aspx?deleteIDs=" + request_ids,
contentType: "application/x-www-form-urlencoded",
data: '',
dataType: "html",
complete: function(xhr, status) {
if (status == "success")
{
}
else {
}
}
```
The jquery code above has its status ="success" regardless o... | 2012/03/15 | [
"https://Stackoverflow.com/questions/9728010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1110437/"
] | you need to this to the end of your sending mail function
```
die(); // this is required to return a proper result
```
[AJAX in Plugins](http://codex.wordpress.org/AJAX_in_Plugins) half way down the page. | Why don't you using a ready solution for this?
Try out [WordPress Contact Form Slider](http://wordpresscontactform.com/)
It is also works with AJAX and Cross-Browser compatible. |
5,463,893 | I have been trying to add items to a comboxbox but cannot seem to get the code behind file to recognize the combobox added to the xaml. I am pretty sure I am missing something simple. Basically the xaml here illustrates an empty combobox. The code behind executes the service, waits for json to come back and deserialize... | 2011/03/28 | [
"https://Stackoverflow.com/questions/5463893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/680776/"
] | Make GRService\_DownloadStringCompleted method **non static**:
```
void GRService_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
List<Area> dataList = new List<Area>();
MemoryStream memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(e.Result));
... | Try adding ItemsSource="{Binding}" to the combobox property within the Xaml |
6,400,732 | If I have a structure definition in C of the following
```
typedef struct example
{
char c;
int ii;
int iii;
};
```
What should be the memory allocated when I declare a variable of the above structure type.
example ee;
and also what is structure padding and if there is any risk associated with structure padd... | 2011/06/19 | [
"https://Stackoverflow.com/questions/6400732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/791124/"
] | Try it. It may be different on different systems.
```
#include <stdio.h>
#include <stddef.h> /* for offsetof */
struct example { char c; int ii; int iii; };
int main(int argc, char *argv[])
{
printf("offsetof(struct example, c) == %zd\n", offsetof(struct example, c));
printf("offsetof(struct example, ii) == %z... | Under normal 32 bit it should take 12 bytes - the `c` field will be padded. This is architecture and compiler depended, however.
You can always use a `pragma` for the compiler to declare the alignment for the structure (and for some compilers, change the default alignment). |
30,038,650 | I have an `ArrayList<String[]> array_list`
I want to convert it into a 2D String array say result
such that first string array in array\_list is in `result[0]`.
Also I want to have first string in result to be equal to string `equal`.
i.e.
If first array in array\_list has `["A","B","C"]`
and my string `equal` is... | 2015/05/04 | [
"https://Stackoverflow.com/questions/30038650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4717047/"
] | `array[j]` is never initialized. You have to first assign a `String[]` instance to `array[j]` before using it.
Add the following line at the beginning of your outer for-loop (before `array[j][0] = arr`):
```
array[j] = new String[arrs.length + 1];
``` | Here is an alternative (to your question in the title).
My initial thought was to do the following;
`String[][] array = (String[][]) result.toArray()`
But it turns out to give a nasty `ClassCastException` telling we can't cast an `Object` array to a `String` array.
So, this is where the `Arrays` class (`java.util.... |
5,023,809 | I can read the DLLs involved in a running process through enumprocessmodules and I can reach the process IAT. Process IAT contains API adresses and not the name.
Is there any way to get the API Name and signature. | 2011/02/17 | [
"https://Stackoverflow.com/questions/5023809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399924/"
] | Your function doesn't seem to be related to any particular element, so why not just store it in some global namespace.
If you don't want to create another, you could borrow jQuery's if you're careful not to overwrite anything:
```
jQuery.cF = function(param) {
// do something special
};
$.cF(param);
``` | You could use [`jQuery.extend()`](http://api.jquery.com/jQuery.extend).
In your particular case you would be extending `$` so you might as well just do it patrick's way as long as your careful not to override and existing functions. |
5,023,809 | I can read the DLLs involved in a running process through enumprocessmodules and I can reach the process IAT. Process IAT contains API adresses and not the name.
Is there any way to get the API Name and signature. | 2011/02/17 | [
"https://Stackoverflow.com/questions/5023809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399924/"
] | Your function doesn't seem to be related to any particular element, so why not just store it in some global namespace.
If you don't want to create another, you could borrow jQuery's if you're careful not to overwrite anything:
```
jQuery.cF = function(param) {
// do something special
};
$.cF(param);
``` | Try this:
`$.fn.call = function(){};`
Then create a function for a specific element:
`$('#some_id .some-class').call.myCustomFunction = function(arg1,arg2){
...
};`
Now when you want to call it:
`$('#some_id .some-class').call.myCustomFunction('a','b');` |
5,023,809 | I can read the DLLs involved in a running process through enumprocessmodules and I can reach the process IAT. Process IAT contains API adresses and not the name.
Is there any way to get the API Name and signature. | 2011/02/17 | [
"https://Stackoverflow.com/questions/5023809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399924/"
] | It sounds like think what you want to do is make a **plugin**. It's not really extensive at all. Taken from <http://docs.jquery.com/Plugins/Authoring>, you can just do:
```
(function( $ ){
$.fn.myPlugin = function() {
// Do your awesome plugin stuff here
};
})( jQuery );
```
Then calling it is simp... | You could use [`jQuery.extend()`](http://api.jquery.com/jQuery.extend).
In your particular case you would be extending `$` so you might as well just do it patrick's way as long as your careful not to override and existing functions. |
5,023,809 | I can read the DLLs involved in a running process through enumprocessmodules and I can reach the process IAT. Process IAT contains API adresses and not the name.
Is there any way to get the API Name and signature. | 2011/02/17 | [
"https://Stackoverflow.com/questions/5023809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399924/"
] | It sounds like think what you want to do is make a **plugin**. It's not really extensive at all. Taken from <http://docs.jquery.com/Plugins/Authoring>, you can just do:
```
(function( $ ){
$.fn.myPlugin = function() {
// Do your awesome plugin stuff here
};
})( jQuery );
```
Then calling it is simp... | Try this:
`$.fn.call = function(){};`
Then create a function for a specific element:
`$('#some_id .some-class').call.myCustomFunction = function(arg1,arg2){
...
};`
Now when you want to call it:
`$('#some_id .some-class').call.myCustomFunction('a','b');` |
25,850,937 | I'm trying to redirect all my traffic to a different part of the site and to redirect my IP to the development section, can someone tell me what I've done wrong?
```
RewriteCond %{REMOTE_ADDR} ==My IP
RewriteRule ^([^/\.]+)/?$ dev/index.php?page=$1 [L]
```
If i goto mysite.com/index it goes to a 404. If I remove the... | 2014/09/15 | [
"https://Stackoverflow.com/questions/25850937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1157885/"
] | You can use that rule like this:
```
RewriteCond %{REMOTE_ADDR} =11.22.33.44
RewriteRule ^([^/.]+)/?$ dev/index.php?page=$1 [L,QSA]
RewriteCond %{REMOTE_ADDR} =11.22.33.44
RewriteRule ^([^/.]+)/([^/.]+)/?$ dev/index.php?page=$1&action=$2 [L,QSA]
``` | try this:
RewriteRule ^([^/.]+)/?$ /dev/index.php?page=$1 [L] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.