qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
18,395,622 | In my project, I have to install some package remotely. If I have to login in debian, I say:
```
$ ssh root@remotehostname
root@remotehostname's password:
```
it logs in successfully.
I have login in **ubuntu** in directly using
```
$ root@remotehostname
root@remotehostname's password:
```
it is throw error... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18395622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992679/"
] | **Do not enable the root account. Do not set a password for the root account.**
A better way is to allow root login using public key authentication, not with password. [The reasoning is explained in the Debian mailing list archives.](http://lists.debian.org/debian-security/2002/06/msg00418.html)
1. Open `/etc/ssh/ssh... | By default, the Root account password is locked in Debian based systems like Ubuntu:
Switch to `root` account user:
```
sudo -i;
```
Now set the password for root account:
```
sudo passwd;
```
Simply adding a password for root is not enough.
Incoming ssh connections need to be enabled as below:
Edit `/etc/ssh... |
18,395,622 | In my project, I have to install some package remotely. If I have to login in debian, I say:
```
$ ssh root@remotehostname
root@remotehostname's password:
```
it logs in successfully.
I have login in **ubuntu** in directly using
```
$ root@remotehostname
root@remotehostname's password:
```
it is throw error... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18395622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992679/"
] | check the `/etc/ssh/sshd_config` whether the configure `PermitRootLogin yes` below `# Authentication:`. If not `yes`, it doesn't permit login as root.
you can change it to `yes`.
Then, restart ssh service to apply the changes:
`sudo service sshd restart` | I think the only time I ever tired to log in as root was the first time I used AWS EC2 and I tried to long in as root because I knew it existed. The user name ec2-user. |
18,395,622 | In my project, I have to install some package remotely. If I have to login in debian, I say:
```
$ ssh root@remotehostname
root@remotehostname's password:
```
it logs in successfully.
I have login in **ubuntu** in directly using
```
$ root@remotehostname
root@remotehostname's password:
```
it is throw error... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18395622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992679/"
] | [Ubuntu documentation](https://help.ubuntu.com/community/RootSudo) says:
>
> **By default, the Root account password is locked in Ubuntu.**
>
>
>
It also says:
>
> **Please keep in mind, a substantial number of Ubuntu users are new to
> Linux.** There is a learning curve associated with any OS and many new
> ... | By default, the Root account password is locked in Debian based systems like Ubuntu:
Switch to `root` account user:
```
sudo -i;
```
Now set the password for root account:
```
sudo passwd;
```
Simply adding a password for root is not enough.
Incoming ssh connections need to be enabled as below:
Edit `/etc/ssh... |
18,395,622 | In my project, I have to install some package remotely. If I have to login in debian, I say:
```
$ ssh root@remotehostname
root@remotehostname's password:
```
it logs in successfully.
I have login in **ubuntu** in directly using
```
$ root@remotehostname
root@remotehostname's password:
```
it is throw error... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18395622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992679/"
] | ```
ssh -l user localhost "sudo whoami"
```
returns:
```
root
```
So long as:
1. The remote host allows the user connecting to be able to sudo without asking for a further password.
2. ssh-copy-id has been run or correct keys copied across to remote host so that the user can connect again without a password via ... | 1. Edit the
`/etc/ssh/sshd_config` file and change the line that says “PermitRootLogin forced-commands-only” to “PermitRootLogin without-password”.
2. Restart the sshd server with “`service sshd restart`”.
3. Edit the `/root/.ssh/authorized_keys` file. This file should have one line only. It starts by “echo” or “comma... |
18,395,622 | In my project, I have to install some package remotely. If I have to login in debian, I say:
```
$ ssh root@remotehostname
root@remotehostname's password:
```
it logs in successfully.
I have login in **ubuntu** in directly using
```
$ root@remotehostname
root@remotehostname's password:
```
it is throw error... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18395622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992679/"
] | You could set a password for root, but this is not recommended and could open a security risk. But if you have an user account on the target system that has sudo credentials, you could log in as user:
```
ssh user@remotehostname
user@remotehostname's password:
```
and then do what you want using sudo or get a root s... | 1. Edit sshd\_config file `vi /etc/ssh/sshd_config`
2. Comment out `#PermitRootLogin without-password` under Authentication:
3. insert below `PermitRootLogin yes`
4. Save the file.
5. Restart the ssh service `service ssh restart` |
18,395,622 | In my project, I have to install some package remotely. If I have to login in debian, I say:
```
$ ssh root@remotehostname
root@remotehostname's password:
```
it logs in successfully.
I have login in **ubuntu** in directly using
```
$ root@remotehostname
root@remotehostname's password:
```
it is throw error... | 2013/08/23 | [
"https://Stackoverflow.com/questions/18395622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1992679/"
] | ```
ssh -l user localhost "sudo whoami"
```
returns:
```
root
```
So long as:
1. The remote host allows the user connecting to be able to sudo without asking for a further password.
2. ssh-copy-id has been run or correct keys copied across to remote host so that the user can connect again without a password via ... | 1. Edit sshd\_config file `vi /etc/ssh/sshd_config`
2. Comment out `#PermitRootLogin without-password` under Authentication:
3. insert below `PermitRootLogin yes`
4. Save the file.
5. Restart the ssh service `service ssh restart` |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | >
> How do I tell our HR that I don't want to “perform” in our Christmas
> party?
>
>
>
Dear HR,
I will not dance in our Christmas party because I don't feel comfortable doing this. Thank you for your understanding.
Best regards,
donotexecuteorder66
---
If you don't want to do something, you don't have to do... | Unless you have been hired as a professional dancer (or something of the like), this is ridiculous. There is no reason to humiliate new hires in a way like that. And no, humiliation has nothing to do with team building.
As somebody has already said in the comments: What would they do if the new hire was physically una... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | Do it without doing it
----------------------
One possible solution, snag some "dance" video of internet fame that you find humorous (or think your coworkers will), whether it's I'm a kitty cat and I dance dance dance or baby shark or a video of someone else dancing from last year... whatever you feel is the right vid... | ### *This is more of a supplement to all the "Don't do it" answers:*
I strongly suggest considering a "make up move". All the others before you had to complete this initiating dance while they didnt want to and "*this new guy gets away with not doing it?!?!?*" Regarding what *you* think, you will be one step behind at... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | Don't do it!
------------
I had a similar experience where **I did a singing performance**. Like Joe's answer suggests, **I thought I could put it behind me** after. Someone recorded it, shared it, kept sharing it for years, kept bringing it up occasionally years later. And this was before the days of YouTube and prol... | ...implying a duty to loiter for the entire party
-------------------------------------------------
Let's flip it, and take it from the perspective of a social butterfly.
First, the fashionable holiday party period is very short - just a couple of weeks. *And there are a **lot** of holiday parties*. That means a soc... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | >
> How do I tell our HR that I don't want to “perform” in our Christmas
> party?
>
>
>
Dear HR,
I will not dance in our Christmas party because I don't feel comfortable doing this. Thank you for your understanding.
Best regards,
donotexecuteorder66
---
If you don't want to do something, you don't have to do... | ...implying a duty to loiter for the entire party
-------------------------------------------------
Let's flip it, and take it from the perspective of a social butterfly.
First, the fashionable holiday party period is very short - just a couple of weeks. *And there are a **lot** of holiday parties*. That means a soc... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | Don't do it!
------------
I had a similar experience where **I did a singing performance**. Like Joe's answer suggests, **I thought I could put it behind me** after. Someone recorded it, shared it, kept sharing it for years, kept bringing it up occasionally years later. And this was before the days of YouTube and prol... | I agree with Joe that this is something you probably can, but shouldn't, refuse. And yeah, it's one of those things that I as an introvert would also rather avoid. But it's probably better not to dodge it.
It's a bit like fraternity hazing. Not quite as juvenile, but kinda reminds you. You don't get to be the cool kid... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | I have actually been in a similar situation.
I worked at a large company, in a small department. Each department within our division were creating short videos that would be presented at an annual management conference.
My department's video involved us all dancing. It was intended to be humorous.
I am **very** unco... | I am also an introvert, but I do my best to fight it, in the workplace, as seemingly going along to get along works better in the long term. Let me caveat this by stating I am at the tail end of being a "baby boomer" (I was born in 1964.) Were I to be 'commanded' to dance, I would 'own it'. All four of the following do... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | What is the point of this "tradition"? You should ask HR that question.
I imagine they will tell you it's some sort of team-building activity. I can't see how imposing humiliation on the reluctant will build any *esprit de corps*.
I've worked at places where the extroverts try to force others to join in, but I have a... | Unless you have been hired as a professional dancer (or something of the like), this is ridiculous. There is no reason to humiliate new hires in a way like that. And no, humiliation has nothing to do with team building.
As somebody has already said in the comments: What would they do if the new hire was physically una... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | Do it without doing it
----------------------
One possible solution, snag some "dance" video of internet fame that you find humorous (or think your coworkers will), whether it's I'm a kitty cat and I dance dance dance or baby shark or a video of someone else dancing from last year... whatever you feel is the right vid... | I agree with Joe that this is something you probably can, but shouldn't, refuse. And yeah, it's one of those things that I as an introvert would also rather avoid. But it's probably better not to dodge it.
It's a bit like fraternity hazing. Not quite as juvenile, but kinda reminds you. You don't get to be the cool kid... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | >
> How do I tell our HR that I don't want to “perform” in our Christmas
> party?
>
>
>
Dear HR,
I will not dance in our Christmas party because I don't feel comfortable doing this. Thank you for your understanding.
Best regards,
donotexecuteorder66
---
If you don't want to do something, you don't have to do... | I agree with Joe that this is something you probably can, but shouldn't, refuse. And yeah, it's one of those things that I as an introvert would also rather avoid. But it's probably better not to dodge it.
It's a bit like fraternity hazing. Not quite as juvenile, but kinda reminds you. You don't get to be the cool kid... |
150,024 | I recently joined this company and they have this tradition wherein *newcomers* must "perform" in the Year-end/Christmas party. It's going to be a short performance in the stage, most likely in-between breaks. I've talked with my seniors about this and they told me that they did a performance before too, even if they d... | 2019/12/18 | [
"https://workplace.stackexchange.com/questions/150024",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/112115/"
] | >
> How will I confront our HR regarding this?
>
>
>
Don't *confront* HR. *Discuss* it with them.
Explain your fears. Explain why you don't want to do this.
They will likely tell you that you really should do it. I agree. I think you should do something quick, just get it over and put it behind you.
But if you ... | Don't do it!
------------
I had a similar experience where **I did a singing performance**. Like Joe's answer suggests, **I thought I could put it behind me** after. Someone recorded it, shared it, kept sharing it for years, kept bringing it up occasionally years later. And this was before the days of YouTube and prol... |
48,305,871 | I want to use generic class as items in `PagingList<>`
```
interface GenericInterface{}
class GenericImplementation: GenericInterface{}
```
As Kotlin doc state: [here](https://kotlinlang.org/docs/reference/generics.html) inheritance **in list** isn't possible, although I can declare generic type of Parameter of ***T... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48305871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2163045/"
] | Ok so I had this same problem but couldn't find anything on it except this question, but after a while I figured it out and the way I did it was to define the generic in your own class and then pass it onto the `PagedListAdapter`, for example:
You would initiate it like this:
```
var adapter: MAdapter<GenericImplemen... | I also face same problem. While rewriting Java POJO into Data Classes, i face problem with restricted Inheritance on Kotlin Data Class to use in multiple Data Type for Single PageListAdapter with multiple ViewHolder. But after Kotlin version 1.1 , we can start implementing Interface as Inheritance. But using this patte... |
48,305,871 | I want to use generic class as items in `PagingList<>`
```
interface GenericInterface{}
class GenericImplementation: GenericInterface{}
```
As Kotlin doc state: [here](https://kotlinlang.org/docs/reference/generics.html) inheritance **in list** isn't possible, although I can declare generic type of Parameter of ***T... | 2018/01/17 | [
"https://Stackoverflow.com/questions/48305871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2163045/"
] | Ok so I had this same problem but couldn't find anything on it except this question, but after a while I figured it out and the way I did it was to define the generic in your own class and then pass it onto the `PagedListAdapter`, for example:
You would initiate it like this:
```
var adapter: MAdapter<GenericImplemen... | ```
abstract class DiffUtilPagedListAdapter<T : PagingComparable<T>, VH : BaseBindingViewHolder<T>> :
PagedListAdapter<T, VH>
```
The adapter class will accept a class which implements an interface: PagingComparable, the diff util method will be called inside the classes which implemented the interface.
the adapter ... |
26,467,491 | I have a div which I would like to fill with a jsTree:
I get the "Loading" icon where the tree is meant to display, however, there would seem to be a javascript error, even though one is not thrown.
I load my folder structure from an AJAX Request as follows. The Documents.aspx/GetFolders Web Method returns a List con... | 2014/10/20 | [
"https://Stackoverflow.com/questions/26467491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2790087/"
] | I think I have finally found the answer! :)
```
"core": {
"themes": {
"responsive": true
},
"data": {
type: "POST",
url: "Documents.aspx/GetFolders",
contentType: "application/json; charset=utf-8",
success: function (data) {
data.d;
$(data).each(function () {
... | Just in case anyone has the "loading..." issue, this format fixed it for me when returning data.
```
[{"id":"node0", "parent":"#", "text":"Documents"},
{"id":"node1", "parent":"node0", "text":"Public"},
{"id":"node2", "parent":"node0", "text":"Public"}]
``` |
21,940 | >
> **Possible Duplicate:**
>
> [How to convert ArcGIS Server JSON to GeoJSON?](https://gis.stackexchange.com/questions/13029/how-to-convert-arcgis-server-json-to-geojson)
>
>
>
How to convert ArcGIS Javascript api Geometry Object to GeoJson using Javascript? | 2012/03/19 | [
"https://gis.stackexchange.com/questions/21940",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/6172/"
] | You can do it client-side in JavaScript. You can check the source out here.
<https://github.com/odoe/esritogeo>
And I've started implementing the same thing in python, but in both directions.
<https://github.com/odoe/SpatialJSON>
Here is a sample where you can use JavaScript to convert the results of an Esri map serv... | The geometry object has a method, toJson(), that will do this for you:
[Javascript API Reference](http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi_start.htm) |
34,290,901 | I am to programming so please help me in some issues.
I download app from Google play that filter web searches. If URL in blacklist then redirect to this webpage `localhost:50099/block.html`
My query is how to connect this local server? | 2015/12/15 | [
"https://Stackoverflow.com/questions/34290901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5682331/"
] | the solution is to write:
```
$('body').on('input','.someClass', function (e) {
// do something
});
```
and fix your code:
```
$('#myTable tr:last').after(
'<tr>'+
'<td><input class=' + cssClass + ' type="text"/></td></tr>'
);
``` | Mmm... aren't you missing the quotation mark (") in the input's class?
Furthermore, you are not correctly appending the td and tr closing tags. Try something like this:
```
$('#myTable tr:last').after(
'<tr>' +
'<td><input class="' + cssClass + '" type="text" /></td>' +
'</tr>'
);
``` |
3,770,851 | [](https://i.stack.imgur.com/1bCjE.png)
In the blue circle, on the left of the equation. What **base** does $\bf u'$ have here? If I actually calculate $\bf u'$ what will the vector I get stand for?
Am I going to get the vector $\bf u'$ relative to t... | 2020/07/27 | [
"https://math.stackexchange.com/questions/3770851",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/748735/"
] | The answer as to values of the basis vectors $u\_i'$ that compose the basis $B'$, is that they completely depend on the vectors which define your "original" basis $B$. **The values of the $u\_i'$ thus calculated correspond to the coordinates of the $u\_i'$ vectors, expressed in basis $B$**.
That's for the "raw" answer... | Let $V$ be a vector space. Let it be 2-dimensional euclidean space, i.e. the plane of a black/white board for concreteness. Draw 2 non-parallel lines on it. Call one the x-axis, the other y-axis. You are free to choose any orientation for these 2 lines except when they are parallel.
Draw an arrow in any direction of a... |
68,182,307 | I would like to search words after specific words with re module. (without using list comprehensions)
```
sentence = "I like you, I like your smile, I like stack o v e r flow"
# expected outcome
['you', 'your smile', 'stack o v e r flow']
```
I managed to get a single word after 'I like', but couldn't figure out ho... | 2021/06/29 | [
"https://Stackoverflow.com/questions/68182307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6886108/"
] | With this regexp I get the correct output:
```py
sentence = "I like you, I like your smile, I like stack o v e r flow"
re.compile(r'I like ([\w\s]+)').findall(sentence)
```
You need to consider an optional space (`\s`) together with the word character(`\w`). This pattern occurs at least once (`[\w\s]+`). | You need to use `[\w ]+` instead of `\w+` to account for white spaces. Also you can use the comma to separate chunks of the sentence you want to analyze:
```py
>>> re.findall("I like ([\w ]+),*", sentence)
['you', 'your smile', 'stack o v e r flow']
``` |
57,735,541 | I m new in Laravel and trying to add data to the database via ajax, but it throws this message: "The server responded with a status of 405 (Method Not Allowed)" I define two routes for this one is for form page
```
Route::get('/create/{id}', 'Participant\ParticipantProjectDefinitionController@create')->name('p... | 2019/08/31 | [
"https://Stackoverflow.com/questions/57735541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10316231/"
] | A license file is just a file.... for git, it's business as usual, just add it and commit | >
> How to add a license file to a git project which is not hosted on GitHub? I want to use license templates to create my one like GitHub.
>
>
>
You can create any file you wish and add it to any git repository.
Github supply pre-made templates.
Use this site to choose your license:
### **<https://choosealic... |
22,838,051 | I have server which communicates with database via JDBC. When I compile it
`javac -cp jdbc.jar package/Server.java`
I get nonsense errors It can't find my classes in other files. If I compile it without -cp option but run it with -cp option as:
`java -cp jdbc.jar package.Server`
I get:
`Exception in thread "main" ... | 2014/04/03 | [
"https://Stackoverflow.com/questions/22838051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2300789/"
] | Add the current directory to the classpath
```
javac -cp .:jdbc.jar package/Server.java
``` | May be you are using eclipse.
And if is that so then just copy your code paste it in some newly created file in home directory and run it.
I was facing some problem and resolved it by doing above operation. :) |
22,838,051 | I have server which communicates with database via JDBC. When I compile it
`javac -cp jdbc.jar package/Server.java`
I get nonsense errors It can't find my classes in other files. If I compile it without -cp option but run it with -cp option as:
`java -cp jdbc.jar package.Server`
I get:
`Exception in thread "main" ... | 2014/04/03 | [
"https://Stackoverflow.com/questions/22838051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2300789/"
] | Add the current directory to the classpath
```
javac -cp .:jdbc.jar package/Server.java
``` | Assuming that you have managed to compile your code and are having trouble executing it.
You need to have the following in your classpath :
1. Compiled classes
2. External dependencies
Let's say your project structure looks like follows :
```
|
|-- classes
|-- package
|-- Server.class
|-- lib
|-- jdbc.jar
`... |
22,838,051 | I have server which communicates with database via JDBC. When I compile it
`javac -cp jdbc.jar package/Server.java`
I get nonsense errors It can't find my classes in other files. If I compile it without -cp option but run it with -cp option as:
`java -cp jdbc.jar package.Server`
I get:
`Exception in thread "main" ... | 2014/04/03 | [
"https://Stackoverflow.com/questions/22838051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2300789/"
] | Assuming that you have managed to compile your code and are having trouble executing it.
You need to have the following in your classpath :
1. Compiled classes
2. External dependencies
Let's say your project structure looks like follows :
```
|
|-- classes
|-- package
|-- Server.class
|-- lib
|-- jdbc.jar
`... | May be you are using eclipse.
And if is that so then just copy your code paste it in some newly created file in home directory and run it.
I was facing some problem and resolved it by doing above operation. :) |
38,034,943 | I'm loading some HTML with jQuery asynchronously:
```
$.get(path, {}, function (data) {
var result = $(data);
var resultSelector = result.find(selector);
});
```
`result` is a valid HTML *that contains* my selector (in my specific case, `"#UsersAndRolesResults"`).
I can see that it contains when I simply ty... | 2016/06/26 | [
"https://Stackoverflow.com/questions/38034943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811405/"
] | It seems to be a design decision with jQuery. Top-level elements in an AJAX result are not queried correctly with `find`. Interesting.
I've solved my problem with a workaround by creating a dummy `div` element, encapsulating my result inside that element, and then querying that dummy element. It worked:
```
var t = $... | Try this:
```
$.get(path, {}, function (data) {
var result = $($.parseHTML(data));
var resultSelector = result.find(selector);
});
``` |
38,034,943 | I'm loading some HTML with jQuery asynchronously:
```
$.get(path, {}, function (data) {
var result = $(data);
var resultSelector = result.find(selector);
});
```
`result` is a valid HTML *that contains* my selector (in my specific case, `"#UsersAndRolesResults"`).
I can see that it contains when I simply ty... | 2016/06/26 | [
"https://Stackoverflow.com/questions/38034943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811405/"
] | **No. This is not bug, this is behavior defined in jQuery.**
`find()` is used to select the elements which are inside the element on which `find` is called. In your case, the element is not children of the selector, so `find` will not work.
Example:
```
<div id="container">
<div class="message">Hello World!</div... | Try this:
```
$.get(path, {}, function (data) {
var result = $($.parseHTML(data));
var resultSelector = result.find(selector);
});
``` |
38,034,943 | I'm loading some HTML with jQuery asynchronously:
```
$.get(path, {}, function (data) {
var result = $(data);
var resultSelector = result.find(selector);
});
```
`result` is a valid HTML *that contains* my selector (in my specific case, `"#UsersAndRolesResults"`).
I can see that it contains when I simply ty... | 2016/06/26 | [
"https://Stackoverflow.com/questions/38034943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811405/"
] | Try this:
```
$.get(path, {}, function (data) {
var result = $($.parseHTML(data));
var resultSelector = result.find(selector);
});
``` | Given
```js
console.log($("<div id=target></div>").find("#target"));
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
```
`.length` would be `0` as expected.
---
You can use `.closest()` to search for both child elements and original jQuery object selector
```j... |
38,034,943 | I'm loading some HTML with jQuery asynchronously:
```
$.get(path, {}, function (data) {
var result = $(data);
var resultSelector = result.find(selector);
});
```
`result` is a valid HTML *that contains* my selector (in my specific case, `"#UsersAndRolesResults"`).
I can see that it contains when I simply ty... | 2016/06/26 | [
"https://Stackoverflow.com/questions/38034943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811405/"
] | **No. This is not bug, this is behavior defined in jQuery.**
`find()` is used to select the elements which are inside the element on which `find` is called. In your case, the element is not children of the selector, so `find` will not work.
Example:
```
<div id="container">
<div class="message">Hello World!</div... | It seems to be a design decision with jQuery. Top-level elements in an AJAX result are not queried correctly with `find`. Interesting.
I've solved my problem with a workaround by creating a dummy `div` element, encapsulating my result inside that element, and then querying that dummy element. It worked:
```
var t = $... |
38,034,943 | I'm loading some HTML with jQuery asynchronously:
```
$.get(path, {}, function (data) {
var result = $(data);
var resultSelector = result.find(selector);
});
```
`result` is a valid HTML *that contains* my selector (in my specific case, `"#UsersAndRolesResults"`).
I can see that it contains when I simply ty... | 2016/06/26 | [
"https://Stackoverflow.com/questions/38034943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811405/"
] | It seems to be a design decision with jQuery. Top-level elements in an AJAX result are not queried correctly with `find`. Interesting.
I've solved my problem with a workaround by creating a dummy `div` element, encapsulating my result inside that element, and then querying that dummy element. It worked:
```
var t = $... | Given
```js
console.log($("<div id=target></div>").find("#target"));
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
```
`.length` would be `0` as expected.
---
You can use `.closest()` to search for both child elements and original jQuery object selector
```j... |
38,034,943 | I'm loading some HTML with jQuery asynchronously:
```
$.get(path, {}, function (data) {
var result = $(data);
var resultSelector = result.find(selector);
});
```
`result` is a valid HTML *that contains* my selector (in my specific case, `"#UsersAndRolesResults"`).
I can see that it contains when I simply ty... | 2016/06/26 | [
"https://Stackoverflow.com/questions/38034943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/811405/"
] | **No. This is not bug, this is behavior defined in jQuery.**
`find()` is used to select the elements which are inside the element on which `find` is called. In your case, the element is not children of the selector, so `find` will not work.
Example:
```
<div id="container">
<div class="message">Hello World!</div... | Given
```js
console.log($("<div id=target></div>").find("#target"));
```
```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
```
`.length` would be `0` as expected.
---
You can use `.closest()` to search for both child elements and original jQuery object selector
```j... |
58,982,924 | I am new to Nebular theme. I have a checkbox but it's not working.
HTML
```
<nb-checkbox [value]="checked" (change)="toggle($event)"></nb-checkbox>
```
TypeScript
```
toggle(checked: any) {
this.checked = checked.target.checked;
}
```
Module.ts
```
//import
import { NbCheckboxModule } from '@nebular... | 2019/11/21 | [
"https://Stackoverflow.com/questions/58982924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4887891/"
] | I think you should use it like in [these](https://akveo.github.io/nebular/docs/components/checkbox/examples#nbcheckboxcomponent) examples
it works with `value` and `checked` inputs
```
<nb-checkbox [checked]="checked" (checkedChange)="toggle($event)">Toggle me</nb-checkbox>
```
i created stackblitz for you with w... | Add the following in your HTML:
```
<nb-checkbox status="primary" [value]="checked" (change)="setCheckedStatus($event)">Primary</nb-checkbox>
```
Add the following in your component.ts file:
```
checked: true; // declare this variable in your component
setCheckedStatus(checked) {
console.log('checked', checked.... |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | `.value` refers to a `value` property, which cannot be set for a **P** tag. If you want the inner text of a `html` tag, you could do this:
```
var value = document.getElementById("theInput").innerHTML;
``` | `.value` does not return the inner text. You should use `.textContent` or `.innerHTML`. Use one of the following
```
var value1 = document.getElementById("theInput").innerHTML;
console.log(value1);
var value2 = document.getElementById("theInput").textContent;
console.log(value2);
``` |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | ```
var value = document.getElementById("theInput").innerHTML;
console.log(value);
``` | There is also another solution if the HTML Element you are looking for, **does not have** an "**id**" tag.
Officially if you would like to take the "value" of the element, you would do something like this:
```
var value = document.getElementById("someId").value
```
But sometimes ther is no "**id**" of that element, ... |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | `.value` refers to a `value` property, which cannot be set for a **P** tag. If you want the inner text of a `html` tag, you could do this:
```
var value = document.getElementById("theInput").innerHTML;
``` | There is also another solution if the HTML Element you are looking for, **does not have** an "**id**" tag.
Officially if you would like to take the "value" of the element, you would do something like this:
```
var value = document.getElementById("someId").value
```
But sometimes ther is no "**id**" of that element, ... |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | Better to use **innerText** instead **innerHTML** if you wants to get only text, if you wants to get tag also use innerHTML.
**innerText**: Give you only text
**innerHTML**: Give you text and HTML
```js
var value = document.getElementById("theInput").innerText;
console.log(value);
value = document.getElementByI... | Use innerHTML:
```
var value = document.getElementById("theInput").innerHTML;
console.log(value);
```
[JS Fiddle](https://jsfiddle.net/c3jtg60v/1/) |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | `.value` refers to a `value` property, which cannot be set for a **P** tag. If you want the inner text of a `html` tag, you could do this:
```
var value = document.getElementById("theInput").innerHTML;
``` | ```js
var msg = document.getElementById('theInput').innerHTML;
alert(msg);
```
```html
<p id="theInput">
desired-value
</p>
``` |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | ```
var value = document.getElementById("theInput").innerHTML;
console.log(value);
``` | .value property in java script is only for returning values of the tag used for "forms" such as input tag.
What you wanna do is use innerHTML property which returns the value of content inside the html tag.
So
```
var value = document.getElementById("theInput").innerHTML;
console.log(value);
```
Would be the wa... |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | `.value` refers to a `value` property, which cannot be set for a **P** tag. If you want the inner text of a `html` tag, you could do this:
```
var value = document.getElementById("theInput").innerHTML;
``` | It should be `textContent` not `value`.
```
var value = document.getElementById("theInput").textContent;
console.log(value);
``` |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | Better to use **innerText** instead **innerHTML** if you wants to get only text, if you wants to get tag also use innerHTML.
**innerText**: Give you only text
**innerHTML**: Give you text and HTML
```js
var value = document.getElementById("theInput").innerText;
console.log(value);
value = document.getElementByI... | It should be `textContent` not `value`.
```
var value = document.getElementById("theInput").textContent;
console.log(value);
``` |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | Better to use **innerText** instead **innerHTML** if you wants to get only text, if you wants to get tag also use innerHTML.
**innerText**: Give you only text
**innerHTML**: Give you text and HTML
```js
var value = document.getElementById("theInput").innerText;
console.log(value);
value = document.getElementByI... | `.value` does not return the inner text. You should use `.textContent` or `.innerHTML`. Use one of the following
```
var value1 = document.getElementById("theInput").innerHTML;
console.log(value1);
var value2 = document.getElementById("theInput").textContent;
console.log(value2);
``` |
39,288,562 | so I'm having trouble with getting the value of a specific field in my code - I made this pretty simple example to show my problem, here is the JSFiddle:
<https://jsfiddle.net/c3jtg60v/>
The HTML:
```
<p id="theInput">
desired-value
</p>
```
The Javascript:
```
var value = document.getElementById("theInput").va... | 2016/09/02 | [
"https://Stackoverflow.com/questions/39288562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4132538/"
] | ```
var value = document.getElementById("theInput").innerHTML;
console.log(value);
``` | `.value` does not return the inner text. You should use `.textContent` or `.innerHTML`. Use one of the following
```
var value1 = document.getElementById("theInput").innerHTML;
console.log(value1);
var value2 = document.getElementById("theInput").textContent;
console.log(value2);
``` |
41,647,108 | I am curious about how to access another object property in module.exports.
**here is the case :**
```js
module.exports = {
text: 'abcd',
index: (req, res)=>{
console.log(text) <-- is not defined
console.log(this.text) <-- undefined
}
}
```
>
> well then, how to access the text property? ... | 2017/01/14 | [
"https://Stackoverflow.com/questions/41647108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7102582/"
] | Javascript does not have a built-in way to refer to other properties in the same object. There are good reasons why it cannot do this for any arbitrary property. So, you either have to make sure that `this` has the right object value in it or you need to save the appropriate object reference yourself somewhere that you... | Try this
```
module.exports = {
text: 'abcd',
index: function (req,res) {
console.log(this.text)
}
}
```
accessing via
```
var te=require('modulename')
te.index()
``` |
7,519,093 | I'm having an issue with the selected node in a treeview.
Here is are two scenario. (# 2 is causing my problem)
1 -
If I select the node "level", press F2, change the label and press enter. The selectedNode inside the AfterLabelEdit will change. The selectedNode will change from "Level1" to "Root".
2 -
If I select ... | 2011/09/22 | [
"https://Stackoverflow.com/questions/7519093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/468062/"
] | It is an event order problem, the mouse click fires *after* AfterLabelEdit so it wins. The typical BeginInvoke trick doesn't work, you'll need a Timer to select the node:
```
void treeView1_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) {
TreeNode nextnode = this.treeView1.SelectedNode.Parent;
... | Kinda a hack, but this will select the root node when the user clicks somewhere else in the treeview, except for the level2 node:
```
private bool SelectParent = false;
void treeView1_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
{
this.treeView1.SelectedNode = e.Node.Parent;
SelectParent = true;
}
... |
19,776,825 | i have html
```
<a href="#" data-ext="sql" rel="\dir\file.sql" id="file">file.sql</a>
```
And i want find this `a#file` among others by `rel`, so
```
$("#file[rel='\dir\file.sql']")
```
not works, because `\` removing (why?)
```
var some_var = "/s/s/s/\a\a\a";
// undefined
some_var
// "/s/s/s/aaa"
```
So, ho... | 2013/11/04 | [
"https://Stackoverflow.com/questions/19776825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1430313/"
] | The backslash is an escape character. To escape the escape character, you can double it up:
Edit - In this case, the escaping needs to be double-escaped:
<http://jsfiddle.net/FSqZe/>
```
var $el = $('#file[rel="\\\\dir\\\\file.sql"]');
``` | You need to use double backslashed for this:
```
$("#file[rel='\\dir\\file.sql']")
```
This happens because just one `\` slash will try to escape next symbol and double slashes will escape first slash.
**UPDATE**
Seems you need to use `\\\\`:
```
$("#file[rel='\\\\dir\\\\file.sql']")
```
[jsFiddle demo](http://... |
19,776,825 | i have html
```
<a href="#" data-ext="sql" rel="\dir\file.sql" id="file">file.sql</a>
```
And i want find this `a#file` among others by `rel`, so
```
$("#file[rel='\dir\file.sql']")
```
not works, because `\` removing (why?)
```
var some_var = "/s/s/s/\a\a\a";
// undefined
some_var
// "/s/s/s/aaa"
```
So, ho... | 2013/11/04 | [
"https://Stackoverflow.com/questions/19776825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1430313/"
] | The backslash is an escape character. To escape the escape character, you can double it up:
Edit - In this case, the escaping needs to be double-escaped:
<http://jsfiddle.net/FSqZe/>
```
var $el = $('#file[rel="\\\\dir\\\\file.sql"]');
``` | You need to escape both slashes, not just 1.
```
$("#file[rel='\\\\dir\\\\file.sql']") // that's 4 slashes in each case, 8 total
```
<http://jsfiddle.net/Tentonaxe/fUNLV/2/>
This is because First, this string is passed to jQuery, at which point it would become
```
"#file[rel='\\dir\\file.sql']"
```
then when it... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | These answers are getting a bit old. I hope to offer a little bit of an updated answer. jQuery UI now comes with AMD support built in. You can simply get it using
```
bower install jquery-ui
```
and then in requirejs.config simply add jquery\_ui to the paths{} section. No shim is required anymore.
If you want to lo... | Change your shim to this:
```
shim: {
'jquery-ui': ['jquery']
}
```
Here is an [example](https://github.com/BoilerplateMVC/Backbone-Require-Boilerplate/blob/master/public/js/app/config/config.js) of a bunch of Require.js configurations for popular libraries. |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | had a similar issue were 3rd part ASP.NET controls were hijacking the jQuery define.
$telerik.$ = jQuery.noConflict();
Although the script cleaned itself, the tail of the jQuery script effectively overwrote my RequireJS mapping
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function () {... | I think I have a solution to my problem. Though since this problem has been hard to reproduce, I'm going to wait a while before I "accept" my own answer as correct. Also, my answer does not load jquery using requirejs. I don't see any reason why this matters to me. But if anyone sees a way to accomplish this without ha... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | Change your shim to this:
```
shim: {
'jquery-ui': ['jquery']
}
```
Here is an [example](https://github.com/BoilerplateMVC/Backbone-Require-Boilerplate/blob/master/public/js/app/config/config.js) of a bunch of Require.js configurations for popular libraries. | I think I have a solution to my problem. Though since this problem has been hard to reproduce, I'm going to wait a while before I "accept" my own answer as correct. Also, my answer does not load jquery using requirejs. I don't see any reason why this matters to me. But if anyone sees a way to accomplish this without ha... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | These answers are getting a bit old. I hope to offer a little bit of an updated answer. jQuery UI now comes with AMD support built in. You can simply get it using
```
bower install jquery-ui
```
and then in requirejs.config simply add jquery\_ui to the paths{} section. No shim is required anymore.
If you want to lo... | I had the same problem as you, defining my widgets within RequireJS modules, and even though I am not 100% sure this is the best solution, it was one that worked for me without violating the integrity of the modules:
```
requirejs.config({
//By default load any module IDs from js/lib
baseUrl: 'js',
... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | Change your shim to this:
```
shim: {
'jquery-ui': ['jquery']
}
```
Here is an [example](https://github.com/BoilerplateMVC/Backbone-Require-Boilerplate/blob/master/public/js/app/config/config.js) of a bunch of Require.js configurations for popular libraries. | if you want to override some method of jQuery-ui , then the best is use Requirejs init method , this makes sure that in each module, which include jQuery-ui use same modified code.
use your Shim like this
```
'jquery-ui': { deps: ['jQuery'], init: function ($) {
//do whatever with $.widget , all reference of
... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | These answers are getting a bit old. I hope to offer a little bit of an updated answer. jQuery UI now comes with AMD support built in. You can simply get it using
```
bower install jquery-ui
```
and then in requirejs.config simply add jquery\_ui to the paths{} section. No shim is required anymore.
If you want to lo... | I think I have a solution to my problem. Though since this problem has been hard to reproduce, I'm going to wait a while before I "accept" my own answer as correct. Also, my answer does not load jquery using requirejs. I don't see any reason why this matters to me. But if anyone sees a way to accomplish this without ha... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | had a similar issue were 3rd part ASP.NET controls were hijacking the jQuery define.
$telerik.$ = jQuery.noConflict();
Although the script cleaned itself, the tail of the jQuery script effectively overwrote my RequireJS mapping
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function () {... | I had the same problem as you, defining my widgets within RequireJS modules, and even though I am not 100% sure this is the best solution, it was one that worked for me without violating the integrity of the modules:
```
requirejs.config({
//By default load any module IDs from js/lib
baseUrl: 'js',
... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | had a similar issue were 3rd part ASP.NET controls were hijacking the jQuery define.
$telerik.$ = jQuery.noConflict();
Although the script cleaned itself, the tail of the jQuery script effectively overwrote my RequireJS mapping
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function () {... | I encountered a similar, very occasional error when using jQuery UI with Require.js that I fixed by using the [jqueryui-amd](https://github.com/jrburke/jqueryui-amd) conversion script to create "AMD-wrapped modules for jQuery UI for use in loaders like RequireJS".
1. Install using npm.
```
npm install -g jqueryui-amd... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | These answers are getting a bit old. I hope to offer a little bit of an updated answer. jQuery UI now comes with AMD support built in. You can simply get it using
```
bower install jquery-ui
```
and then in requirejs.config simply add jquery\_ui to the paths{} section. No shim is required anymore.
If you want to lo... | had a similar issue were 3rd part ASP.NET controls were hijacking the jQuery define.
$telerik.$ = jQuery.noConflict();
Although the script cleaned itself, the tail of the jQuery script effectively overwrote my RequireJS mapping
if ( typeof define === "function" && define.amd ) {
define( "jquery", [], function () {... |
17,793,289 | I am using requirejs + jquery + jqueryui. I have read TONS of examples of how to do this. I think I understand the various approaches and it seems to me that my setup should be working correctly. However, I occasionally get a **$.widget is not defined** error in my custom modules that depend on jquery-ui. It is a pain ... | 2013/07/22 | [
"https://Stackoverflow.com/questions/17793289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311049/"
] | Change your shim to this:
```
shim: {
'jquery-ui': ['jquery']
}
```
Here is an [example](https://github.com/BoilerplateMVC/Backbone-Require-Boilerplate/blob/master/public/js/app/config/config.js) of a bunch of Require.js configurations for popular libraries. | I encountered a similar, very occasional error when using jQuery UI with Require.js that I fixed by using the [jqueryui-amd](https://github.com/jrburke/jqueryui-amd) conversion script to create "AMD-wrapped modules for jQuery UI for use in loaders like RequireJS".
1. Install using npm.
```
npm install -g jqueryui-amd... |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | You can't close the application by clicking on the red button, as you said it is meant to close the window...
Using cmd-q is not a bypass but the shortcut to close the application. And the windows are not instances of the application, they are in the same instance...
What bothers you is the "resume" functionality tha... | Do u want to say 'cmd+Q'instead of ctrl-q.
& are u sure about your stmt "When I press all the instances of that program opens up the next time I open that application".
As far as i know, if you quit application it will not open your last opened docs. It will just remain in "Open recent" option from File menu |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | You can't close the application by clicking on the red button, as you said it is meant to close the window...
Using cmd-q is not a bypass but the shortcut to close the application. And the windows are not instances of the application, they are in the same instance...
What bothers you is the "resume" functionality tha... | Indeed, there are some applications which will close completly when hitting the red button, while others will just close a window. I'm afraid you can't do nothing about it, as it's a developers choice.
What you can do is disable the Auto-Open, so the `Command`+`Q` shortcut will do exactly what you want.
To do so, jus... |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | You can't close the application by clicking on the red button, as you said it is meant to close the window...
Using cmd-q is not a bypass but the shortcut to close the application. And the windows are not instances of the application, they are in the same instance...
What bothers you is the "resume" functionality tha... | To do so, just go to System Preferences > General and uncheck "Restore windows when quitting and re-opening apps".
This solved my problem! |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | You can't close the application by clicking on the red button, as you said it is meant to close the window...
Using cmd-q is not a bypass but the shortcut to close the application. And the windows are not instances of the application, they are in the same instance...
What bothers you is the "resume" functionality tha... | What you need is [RedQuits](http://www.carsten-mielke.com/redquits.html). It allows to do exactly what you explained in your post.
I just arrived on Mac OS world two days ago, and I have been pretty confused about this functionality of Mac OS. Fortunately, there is a software to get around of this "issue".
It works n... |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | Indeed, there are some applications which will close completly when hitting the red button, while others will just close a window. I'm afraid you can't do nothing about it, as it's a developers choice.
What you can do is disable the Auto-Open, so the `Command`+`Q` shortcut will do exactly what you want.
To do so, jus... | Do u want to say 'cmd+Q'instead of ctrl-q.
& are u sure about your stmt "When I press all the instances of that program opens up the next time I open that application".
As far as i know, if you quit application it will not open your last opened docs. It will just remain in "Open recent" option from File menu |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | To do so, just go to System Preferences > General and uncheck "Restore windows when quitting and re-opening apps".
This solved my problem! | Do u want to say 'cmd+Q'instead of ctrl-q.
& are u sure about your stmt "When I press all the instances of that program opens up the next time I open that application".
As far as i know, if you quit application it will not open your last opened docs. It will just remain in "Open recent" option from File menu |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | What you need is [RedQuits](http://www.carsten-mielke.com/redquits.html). It allows to do exactly what you explained in your post.
I just arrived on Mac OS world two days ago, and I have been pretty confused about this functionality of Mac OS. Fortunately, there is a software to get around of this "issue".
It works n... | Do u want to say 'cmd+Q'instead of ctrl-q.
& are u sure about your stmt "When I press all the instances of that program opens up the next time I open that application".
As far as i know, if you quit application it will not open your last opened docs. It will just remain in "Open recent" option from File menu |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | Indeed, there are some applications which will close completly when hitting the red button, while others will just close a window. I'm afraid you can't do nothing about it, as it's a developers choice.
What you can do is disable the Auto-Open, so the `Command`+`Q` shortcut will do exactly what you want.
To do so, jus... | To do so, just go to System Preferences > General and uncheck "Restore windows when quitting and re-opening apps".
This solved my problem! |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | What you need is [RedQuits](http://www.carsten-mielke.com/redquits.html). It allows to do exactly what you explained in your post.
I just arrived on Mac OS world two days ago, and I have been pretty confused about this functionality of Mac OS. Fortunately, there is a software to get around of this "issue".
It works n... | Indeed, there are some applications which will close completly when hitting the red button, while others will just close a window. I'm afraid you can't do nothing about it, as it's a developers choice.
What you can do is disable the Auto-Open, so the `Command`+`Q` shortcut will do exactly what you want.
To do so, jus... |
51,964 | `/System/Library/Framework/JavaVM.framework` and `/System/Library/Java` have been deleted from my disk. I thought of making things back to normal by running the last Apple Java update ([Java for OS X Lion 2012-003 as of this writing](http://support.apple.com/kb/DL1515)) but unfortunately I'm facing the following error ... | 2012/05/23 | [
"https://apple.stackexchange.com/questions/51964",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/8528/"
] | What you need is [RedQuits](http://www.carsten-mielke.com/redquits.html). It allows to do exactly what you explained in your post.
I just arrived on Mac OS world two days ago, and I have been pretty confused about this functionality of Mac OS. Fortunately, there is a software to get around of this "issue".
It works n... | To do so, just go to System Preferences > General and uncheck "Restore windows when quitting and re-opening apps".
This solved my problem! |
15,944,236 | I'm working on an API written in NodeJS and connecting to a MySQL 5.5 database. On our live system, we have one query that's running at over 7 seconds. We've traced this down to a couple of tables having over 5 millions records in and incorrectly indexed.
On our dev areas, we don't have that number of records. I think... | 2013/04/11 | [
"https://Stackoverflow.com/questions/15944236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/787109/"
] | You can write Perl or Python script to populate your big test tables.
If you do it as single transaction, it should not take very long time.
If MySQL had `generate_series()` supported by PostgreSQL, it would have been much easier to do without scripting, but unfortunately, it doesn't :(.
However, you still can easily... | In Oracle, you can load in table statistics to from other databases - ie production to dev - in effect, mock the data volumes used when doing things like explain plans. Might be worth seeing if something equivalent exists under MySQL. It's not perfect, but would give you a better idea of what's going on under the hood.... |
15,944,236 | I'm working on an API written in NodeJS and connecting to a MySQL 5.5 database. On our live system, we have one query that's running at over 7 seconds. We've traced this down to a couple of tables having over 5 millions records in and incorrectly indexed.
On our dev areas, we don't have that number of records. I think... | 2013/04/11 | [
"https://Stackoverflow.com/questions/15944236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/787109/"
] | My original thought was of get a lot of data into the databases to highlight the issue. I managed to get a million records in, just by leaving a script hammering the (dev) API overnight on.
The EXPLAIN function was pretty helpful. I also found the EXPLAIN EXTENDED one pretty useful too. However, neither of these highl... | In Oracle, you can load in table statistics to from other databases - ie production to dev - in effect, mock the data volumes used when doing things like explain plans. Might be worth seeing if something equivalent exists under MySQL. It's not perfect, but would give you a better idea of what's going on under the hood.... |
15,944,236 | I'm working on an API written in NodeJS and connecting to a MySQL 5.5 database. On our live system, we have one query that's running at over 7 seconds. We've traced this down to a couple of tables having over 5 millions records in and incorrectly indexed.
On our dev areas, we don't have that number of records. I think... | 2013/04/11 | [
"https://Stackoverflow.com/questions/15944236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/787109/"
] | You can write Perl or Python script to populate your big test tables.
If you do it as single transaction, it should not take very long time.
If MySQL had `generate_series()` supported by PostgreSQL, it would have been much easier to do without scripting, but unfortunately, it doesn't :(.
However, you still can easily... | My original thought was of get a lot of data into the databases to highlight the issue. I managed to get a million records in, just by leaving a script hammering the (dev) API overnight on.
The EXPLAIN function was pretty helpful. I also found the EXPLAIN EXTENDED one pretty useful too. However, neither of these highl... |
62,965,354 | Pair every two arrays is the task – store it, print it and repeat it until it becomes one value.
```
input : 1, 2, 3, 4, 5, 6, 8, 9, 9
output: 3 7 11 17 9
10 28 9
38 9
47
```
My code is working fine in this scenario. Somehow I managed to add 0 at the end for pairless elements. But my main f... | 2020/07/18 | [
"https://Stackoverflow.com/questions/62965354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9879071/"
] | You can adopt an iterative approach and look at this as processing each level of values with every next level have 1 value less from total values. In other words, you can look at this as a breadth first search going level by level. Hence, you can use a `queue` data structure processing each level one at a time.
You ca... | Does this do what you want?
```
function pairBySums($inputArray)
{
if (sizeof($inputArray) % 2 == 1) {
$lastEntry = array_pop($inputArray); //$inputArray now has even number of elements
}
$answer = [];
for ($ii = 0; $ii < sizeof($inputArray) / 2; $ii++) {
$firstIndexOfPair = $ii * 2; /... |
35,650,422 | I am new to Xmpp and am confused right now.When I add a new Toast to the ConnectionListener interface methods the Toast does not show up in the application.
My code:
```
conn2.addConnectionListener(new ConnectionListener()
{
@Override
public void connected(XMPPConnection xmppConnection)
... | 2016/02/26 | [
"https://Stackoverflow.com/questions/35650422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5358105/"
] | You have to use a handler but should look this way:
`new Handler(Looper.getMainLooper())` | You will need to create a handler in order to show the toast message.
For example:
```
private Handler mHandler = new Handler();
```
this creates the handler object. After that at any of your connection listener code, add this:
For example, i'm displaying the toast at reconnectionSuccessful() method :
```
... |
14,906,458 | Given my code:
```
import java.util.Scanner;
public class AccountTest {
public static void main(String[] args) {
Account account1 = new Account(50.00);
Account account2 = new Account(0.00);
System.out.printf("account1 balance: $%.2f\n", account1.getBalance());
System.out.printf("... | 2013/02/16 | [
"https://Stackoverflow.com/questions/14906458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2077545/"
] | 1) you can redirect stdout to a file when running your program
```
java AccountTest >> test.txt
```
2) you can reassign stdout at the beginning of your program
```
PrintStream out = new PrintStream(new FileOutputStream("test.txt", true));
System.setOut(out);
```
3) you can use java.io.PrintWriter instead... | It depends on how you run this program. If you have a POSIX shell at hand, you can just redirect its standard output to a file.
The following would append to a log file:
```
$ java -jar myjar.jar >> log
```
this one would create a new epoch-dated log file each time (the `$(…)` might be a bash-specific feature, I'm ... |
7,231,157 | I am creating a page in JSP where I have a dropdown list and once the user selects a value he has to click on the go button and then the value is sent to the Servlet.
```
</select>
<input type="submit" name="GO" value="Go"/>
```
How do I make it so that it does it on change? E.g. when the use... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7231157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/329563/"
] | Just ask assistance of JavaScript.
```
<select onchange="this.form.submit()">
...
</select>
```
### See also:
* [HTML dog - JavaScript tutorial](http://www.htmldog.com/guides/htmlintermediate/javascript/) | Simple JavaScript will do -
```
<form action="myservlet.do" method="POST">
<select name="myselect" id="myselect" onchange="this.form.submit()">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</selec... |
7,231,157 | I am creating a page in JSP where I have a dropdown list and once the user selects a value he has to click on the go button and then the value is sent to the Servlet.
```
</select>
<input type="submit" name="GO" value="Go"/>
```
How do I make it so that it does it on change? E.g. when the use... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7231157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/329563/"
] | Just ask assistance of JavaScript.
```
<select onchange="this.form.submit()">
...
</select>
```
### See also:
* [HTML dog - JavaScript tutorial](http://www.htmldog.com/guides/htmlintermediate/javascript/) | other than using `this.form.submit()` you also can submiting by id or name.
example i have form like this : `<form action="" name="PostName" id="PostID">`
1. By Name : `<select onchange="PostName.submit()">`
2. By Id : `<select onchange="PostID.submit()">` |
7,231,157 | I am creating a page in JSP where I have a dropdown list and once the user selects a value he has to click on the go button and then the value is sent to the Servlet.
```
</select>
<input type="submit" name="GO" value="Go"/>
```
How do I make it so that it does it on change? E.g. when the use... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7231157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/329563/"
] | Just ask assistance of JavaScript.
```
<select onchange="this.form.submit()">
...
</select>
```
### See also:
* [HTML dog - JavaScript tutorial](http://www.htmldog.com/guides/htmlintermediate/javascript/) | To those in the answer above. It's definitely JavaScript. It's just inline.
BTW the jQuery equivalent if you want to apply to all selects:
```
$('form select').on('change', function(){
$(this).closest('form').submit();
});
``` |
7,231,157 | I am creating a page in JSP where I have a dropdown list and once the user selects a value he has to click on the go button and then the value is sent to the Servlet.
```
</select>
<input type="submit" name="GO" value="Go"/>
```
How do I make it so that it does it on change? E.g. when the use... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7231157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/329563/"
] | Simple JavaScript will do -
```
<form action="myservlet.do" method="POST">
<select name="myselect" id="myselect" onchange="this.form.submit()">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</selec... | other than using `this.form.submit()` you also can submiting by id or name.
example i have form like this : `<form action="" name="PostName" id="PostID">`
1. By Name : `<select onchange="PostName.submit()">`
2. By Id : `<select onchange="PostID.submit()">` |
7,231,157 | I am creating a page in JSP where I have a dropdown list and once the user selects a value he has to click on the go button and then the value is sent to the Servlet.
```
</select>
<input type="submit" name="GO" value="Go"/>
```
How do I make it so that it does it on change? E.g. when the use... | 2011/08/29 | [
"https://Stackoverflow.com/questions/7231157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/329563/"
] | Simple JavaScript will do -
```
<form action="myservlet.do" method="POST">
<select name="myselect" id="myselect" onchange="this.form.submit()">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</selec... | To those in the answer above. It's definitely JavaScript. It's just inline.
BTW the jQuery equivalent if you want to apply to all selects:
```
$('form select').on('change', function(){
$(this).closest('form').submit();
});
``` |
4,542,628 | I have two differing methods for initializing my objective-c class. One is the default, and one takes a configuration parameter. Now, I'm pretty green when it comes to objective-c, but I've implemented these methods and I'm wondering if there's a better (more correct/in good style) way to handle initialization than the... | 2010/12/27 | [
"https://Stackoverflow.com/questions/4542628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205930/"
] | When one initializer simply performs the more complex initializer with some default parameters, call it as such:
```
-(id)init {
return [self initWithAppID:nil];
}
-(id)initWithAppID:(id)input {
if (self = [super init]) {
/* perform your post-initialization logic here */
}
return self;
}
```
Usually you... | To be honest, I see this as a moot point. Your second initialization method makes no sense when receiving a nil argument (plus you have a logic problem in your conditional checking if input is nil). What I would do in this case, is provide one initialization method, and two factory class methods which act in the usual ... |
4,542,628 | I have two differing methods for initializing my objective-c class. One is the default, and one takes a configuration parameter. Now, I'm pretty green when it comes to objective-c, but I've implemented these methods and I'm wondering if there's a better (more correct/in good style) way to handle initialization than the... | 2010/12/27 | [
"https://Stackoverflow.com/questions/4542628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205930/"
] | Your init method should call the preferred initializer, initWithAppId:, instead of the super implementation. Then the initWithAppId calls the super implementation, as it does. Also, in initWithAppId:, you have if(input = nil), which will always set input to nil and evaluate to YES. Here are the proper implementations.
... | To be honest, I see this as a moot point. Your second initialization method makes no sense when receiving a nil argument (plus you have a logic problem in your conditional checking if input is nil). What I would do in this case, is provide one initialization method, and two factory class methods which act in the usual ... |
4,542,628 | I have two differing methods for initializing my objective-c class. One is the default, and one takes a configuration parameter. Now, I'm pretty green when it comes to objective-c, but I've implemented these methods and I'm wondering if there's a better (more correct/in good style) way to handle initialization than the... | 2010/12/27 | [
"https://Stackoverflow.com/questions/4542628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205930/"
] | When one initializer simply performs the more complex initializer with some default parameters, call it as such:
```
-(id)init {
return [self initWithAppID:nil];
}
-(id)initWithAppID:(id)input {
if (self = [super init]) {
/* perform your post-initialization logic here */
}
return self;
}
```
Usually you... | The `default` will be whichever one you choose to call,
```
[awesome alloc] init];
[awesome alloc] initWithAppId:ID];
``` |
4,542,628 | I have two differing methods for initializing my objective-c class. One is the default, and one takes a configuration parameter. Now, I'm pretty green when it comes to objective-c, but I've implemented these methods and I'm wondering if there's a better (more correct/in good style) way to handle initialization than the... | 2010/12/27 | [
"https://Stackoverflow.com/questions/4542628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205930/"
] | Your init method should call the preferred initializer, initWithAppId:, instead of the super implementation. Then the initWithAppId calls the super implementation, as it does. Also, in initWithAppId:, you have if(input = nil), which will always set input to nil and evaluate to YES. Here are the proper implementations.
... | The `default` will be whichever one you choose to call,
```
[awesome alloc] init];
[awesome alloc] initWithAppId:ID];
``` |
4,542,628 | I have two differing methods for initializing my objective-c class. One is the default, and one takes a configuration parameter. Now, I'm pretty green when it comes to objective-c, but I've implemented these methods and I'm wondering if there's a better (more correct/in good style) way to handle initialization than the... | 2010/12/27 | [
"https://Stackoverflow.com/questions/4542628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205930/"
] | When one initializer simply performs the more complex initializer with some default parameters, call it as such:
```
-(id)init {
return [self initWithAppID:nil];
}
-(id)initWithAppID:(id)input {
if (self = [super init]) {
/* perform your post-initialization logic here */
}
return self;
}
```
Usually you... | Your init method should call the preferred initializer, initWithAppId:, instead of the super implementation. Then the initWithAppId calls the super implementation, as it does. Also, in initWithAppId:, you have if(input = nil), which will always set input to nil and evaluate to YES. Here are the proper implementations.
... |
6,164,064 | I am stuck with SimpleCursorAdapter, I am calling my local SQLite DB and putting it into a cursor which then is passed to the SimpleCursorAdapter.
For same reason the Log Cat keeps showing this error below. I have no idea what is going on and I have been working on this for 6 hours, I didn't think SimpleCursorAdapter ... | 2011/05/28 | [
"https://Stackoverflow.com/questions/6164064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/637146/"
] | See my answer to this question [Android: column '\_id' does not exist problem](https://stackoverflow.com/questions/5825020/android-column-id-does-not-exist-problem/5825507#5825507). It explains about the need for the \_id column and how to alias it if your DB tables don't have a column with that name.
\*\*\*\*EDIT:\*\... | Well, as the error says your database table definition is missing the default `_id` column that `SimpleCursorAdapter` expects to use as the ID column. What is your database table defined as? Add the `CREATE TABLE` statement you are using to your question.
`SimpleCursorAdapter` relies on the presence of an `_id` column... |
6,164,064 | I am stuck with SimpleCursorAdapter, I am calling my local SQLite DB and putting it into a cursor which then is passed to the SimpleCursorAdapter.
For same reason the Log Cat keeps showing this error below. I have no idea what is going on and I have been working on this for 6 hours, I didn't think SimpleCursorAdapter ... | 2011/05/28 | [
"https://Stackoverflow.com/questions/6164064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/637146/"
] | See my answer to this question [Android: column '\_id' does not exist problem](https://stackoverflow.com/questions/5825020/android-column-id-does-not-exist-problem/5825507#5825507). It explains about the need for the \_id column and how to alias it if your DB tables don't have a column with that name.
\*\*\*\*EDIT:\*\... | Thanks guys for all you help. I managed to do it a different way and it seems to work like a charm. If anyone has any question or suggestions let me know.
```
Cursor c = rec.getAllVeh();
while (c.moveToNext()) {
String vehName = c.getString(1);
vehInfo.add(vehName);
}
//put information into the addapter for listview... |
12,965,722 | I'm using this webservice through php
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try{
$return = $soap->GetCountriesByContinent(array('continentCode'=>'AS'));
} catch (Exception $e) {
die ('Error: ' . $e->getMessage());
}
var_dump($return-... | 2012/10/19 | [
"https://Stackoverflow.com/questions/12965722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206078/"
] | The WSDL definition determines how the SoapClient forms requests and interprets responses.
The method you are trying to access has a response defined as so:
```
<s:element name="GetCountriesByContinentResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetCountriesByContin... | Assuming the wsdl is valid, I would try to download the wsdl manually and save it as a local file and access it that way. I have found the soapClient in php to not be very good at consuming urls for wsdl's especially ones that have get parameter strings. If this works for you, great. As soap is a dying religion, i woul... |
12,965,722 | I'm using this webservice through php
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try{
$return = $soap->GetCountriesByContinent(array('continentCode'=>'AS'));
} catch (Exception $e) {
die ('Error: ' . $e->getMessage());
}
var_dump($return-... | 2012/10/19 | [
"https://Stackoverflow.com/questions/12965722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206078/"
] | Its as very simple XML output you can try something like this
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try {
$return = $soap->GetCountriesByContinent(array('continentCode' => 'AS'));
$xml = new SimpleXMLElement($return->GetCountries... | Assuming the wsdl is valid, I would try to download the wsdl manually and save it as a local file and access it that way. I have found the soapClient in php to not be very good at consuming urls for wsdl's especially ones that have get parameter strings. If this works for you, great. As soap is a dying religion, i woul... |
12,965,722 | I'm using this webservice through php
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try{
$return = $soap->GetCountriesByContinent(array('continentCode'=>'AS'));
} catch (Exception $e) {
die ('Error: ' . $e->getMessage());
}
var_dump($return-... | 2012/10/19 | [
"https://Stackoverflow.com/questions/12965722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206078/"
] | The WSDL definition determines how the SoapClient forms requests and interprets responses.
The method you are trying to access has a response defined as so:
```
<s:element name="GetCountriesByContinentResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetCountriesByContin... | Check your source code, that long text you think is appended has some XML tags that aren't showing up (your browser doesn't know how to interpret "<Country>". Maybe they expect you to parse it further before using? |
12,965,722 | I'm using this webservice through php
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try{
$return = $soap->GetCountriesByContinent(array('continentCode'=>'AS'));
} catch (Exception $e) {
die ('Error: ' . $e->getMessage());
}
var_dump($return-... | 2012/10/19 | [
"https://Stackoverflow.com/questions/12965722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206078/"
] | Its as very simple XML output you can try something like this
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try {
$return = $soap->GetCountriesByContinent(array('continentCode' => 'AS'));
$xml = new SimpleXMLElement($return->GetCountries... | Check your source code, that long text you think is appended has some XML tags that aren't showing up (your browser doesn't know how to interpret "<Country>". Maybe they expect you to parse it further before using? |
12,965,722 | I'm using this webservice through php
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try{
$return = $soap->GetCountriesByContinent(array('continentCode'=>'AS'));
} catch (Exception $e) {
die ('Error: ' . $e->getMessage());
}
var_dump($return-... | 2012/10/19 | [
"https://Stackoverflow.com/questions/12965722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206078/"
] | The WSDL definition determines how the SoapClient forms requests and interprets responses.
The method you are trying to access has a response defined as so:
```
<s:element name="GetCountriesByContinentResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetCountriesByContin... | Its as very simple XML output you can try something like this
```
$wsdl = 'http://www.ezzylearning.com/services/CountryInformationService.asmx?wsdl';
$soap = new soapClient($wsdl);
try {
$return = $soap->GetCountriesByContinent(array('continentCode' => 'AS'));
$xml = new SimpleXMLElement($return->GetCountries... |
70,999,969 | I used to do this in react router v5:
```
<Redirect exact from="/:org" to="/:org/users" />
```
translating it into this doesn't work:
```
<Route path="/:org" element={<Navigate replace to="/:org/users" />} />
```
What is the correct way to perform this kind of a redirect?
UPD: To clarify – I don't have a separat... | 2022/02/05 | [
"https://Stackoverflow.com/questions/70999969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1826109/"
] | Use relative navigation for the redirect.
```
<Route path="/:org/*" element={<OrgPagesComponent />} />
<Route path="/:org" element={<Navigate to="users" replace />} />
```
When the path matches exactly `"/:org"` the second `Route` will be matched and render the `Navigate` which will ***relatively*** navigate to `"/:... | so far I've come up with the following solution:
```
const OrgRedirect = () => {
const { org } = useParams();
return <Navigate to={`/${org}/users`} />
}
<Route path="/:org" element={<OrgRedirect />} />
``` |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | If you implement `operator==` like this:
```
template<typename Type>
bool operator== (const stack<Type> &lhs, const stack<Type> &rhs){
// compare and return.
}
```
You already know that both stacks will contain elements of the same type. There's no need to check for that.
If you want to allow stacks using diffe... | C++ is not like other (dynamic) languages in that you do not need to check types. If two stacks contain different types, your code will not compile if you try to compare them. In other words, skip this step, the compiler will do it for you. |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | If you implement `operator==` like this:
```
template<typename Type>
bool operator== (const stack<Type> &lhs, const stack<Type> &rhs){
// compare and return.
}
```
You already know that both stacks will contain elements of the same type. There's no need to check for that.
If you want to allow stacks using diffe... | If you implement the stack data structure using *templates* (e.g. `template <typename T> class Stack...`), then you just need to overload `operator==` and check sizes and do an item-wise comparison:
```
template <typename T>
bool operator==(const Stack<T> & lhs, const Stack<T> & rhs)
{
if (lhs.Size() != rhs.Size())
... |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | If you implement `operator==` like this:
```
template<typename Type>
bool operator== (const stack<Type> &lhs, const stack<Type> &rhs){
// compare and return.
}
```
You already know that both stacks will contain elements of the same type. There's no need to check for that.
If you want to allow stacks using diffe... | As you can see in C++ tag definition of stackoverflow
```
C++ is a widely-used, statically-typed, free-form, compiled,
multi-paradigm, multi-level, imperative, general-purpose,
object-oriented programming language.
```
In this definition `statically-typed` mean all type information must be clean in compile time so i... |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | If you implement `operator==` like this:
```
template<typename Type>
bool operator== (const stack<Type> &lhs, const stack<Type> &rhs){
// compare and return.
}
```
You already know that both stacks will contain elements of the same type. There's no need to check for that.
If you want to allow stacks using diffe... | I found a simple program which will solve your purpose, Its simple and very efficient way of checking if two stacks are equal or not.
```
bool isEqual(stack<Type> &stack1, stack<Type> &stack2) {
if (stack1.empty() && stack2.empty())
return true;
else if (stack1.empty() || stack2.empty())
return ... |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | C++ is not like other (dynamic) languages in that you do not need to check types. If two stacks contain different types, your code will not compile if you try to compare them. In other words, skip this step, the compiler will do it for you. | If you implement the stack data structure using *templates* (e.g. `template <typename T> class Stack...`), then you just need to overload `operator==` and check sizes and do an item-wise comparison:
```
template <typename T>
bool operator==(const Stack<T> & lhs, const Stack<T> & rhs)
{
if (lhs.Size() != rhs.Size())
... |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | C++ is not like other (dynamic) languages in that you do not need to check types. If two stacks contain different types, your code will not compile if you try to compare them. In other words, skip this step, the compiler will do it for you. | As you can see in C++ tag definition of stackoverflow
```
C++ is a widely-used, statically-typed, free-form, compiled,
multi-paradigm, multi-level, imperative, general-purpose,
object-oriented programming language.
```
In this definition `statically-typed` mean all type information must be clean in compile time so i... |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | C++ is not like other (dynamic) languages in that you do not need to check types. If two stacks contain different types, your code will not compile if you try to compare them. In other words, skip this step, the compiler will do it for you. | I found a simple program which will solve your purpose, Its simple and very efficient way of checking if two stacks are equal or not.
```
bool isEqual(stack<Type> &stack1, stack<Type> &stack2) {
if (stack1.empty() && stack2.empty())
return true;
else if (stack1.empty() || stack2.empty())
return ... |
12,864,341 | I am working with stacks and need to check to see if two are the same. I have overloaded the
```
bool operator==
```
function in my code, and now I need to put the logic in the code. I will check a few things to see if the two stacks are the same: the length, the data type, and the content of each element. Length ... | 2012/10/12 | [
"https://Stackoverflow.com/questions/12864341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/843443/"
] | If you implement the stack data structure using *templates* (e.g. `template <typename T> class Stack...`), then you just need to overload `operator==` and check sizes and do an item-wise comparison:
```
template <typename T>
bool operator==(const Stack<T> & lhs, const Stack<T> & rhs)
{
if (lhs.Size() != rhs.Size())
... | As you can see in C++ tag definition of stackoverflow
```
C++ is a widely-used, statically-typed, free-form, compiled,
multi-paradigm, multi-level, imperative, general-purpose,
object-oriented programming language.
```
In this definition `statically-typed` mean all type information must be clean in compile time so i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.