qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
52,942,575 | I've running project and its really gigantic, it contain almost 1000 files and 4 Custom (own built) framework and almost 10 others added via Pods.
I've gone through [Migrating Your Objective-C Code to Swift](https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift) and also [Migrate with Swiftify](https://medium.com/swiftify/migrating-your-objective-c-project-to-swift-ccb0afac8191).
I started to converting each file one by one as Apple suggest but first Conversion isn't successfully done by Swiftify and also dependency issues.
So at this position its looks like that I start walking in Sahara Desert, where I can't see any end point.
So I need some suggestion how to convert to Swift this kinda huge scale project? | 2018/10/23 | [
"https://Stackoverflow.com/questions/52942575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671060/"
] | Your approach of converting Objective-C to Swift is wrong! Apple also took time to adopt Swift completely in their frameworks and the news is in 2018, 85% of the frameworks are converted to Swift, so the point is they has also taken nearly 3 years to get it done!
The biggest problem is that Swift is still evolving and probably next year we might see "Swift 5.0". So what I suggest you to go via following way:
1. Pick the latest version of Swift (i.e. 4.2).
2. Rather than start converting complete project, adapt modular way.
3. From your project, first of all start picking up smaller modules which don't affect app in any way and see that the "Swift" file works well with Objective-C (Your old code). Reference: [How can I import Swift code to Objective-C?](https://stackoverflow.com/questions/24102104/how-can-i-import-swift-code-to-objective-c)
4. Once you are done with smaller ones, slowly start picking up big modules also you may find open source Swift libraries which are in Objective-C in your project.
5. Besides, you can also build modules from scratch in the form of smaller projects and then just drag and drop in Objective-C project.
6. [Andreas Oetjen](https://stackoverflow.com/users/1646335/andreas-oetjen) Suggestion: You might start by separating the class hierarchy, and convert one "subtree" after the other.
>
> How the above Points help?
>
>
>
1. You may find some unusual code or libraries lying around.
2. You may end-up having clean code under proper structure
3. You can use "Swift + Objective-C" as of now to make your app running smoothly and also giving updates regularly rather than waiting for the months to convert it completely. | Here's a different perspective from the other answers. I have a project of similar size to the original poster (250 classes, 7 MB of source code). I don't want the mental load of maintaining a hybrid of two different programming languages long-term. And after converting about 30 classes, I found myself spending most of my time tweaking code for interoperability between Objective-C and Swift. Issues included:
* Some types like Array and NSMutableArray aren't automatically interchangable, so I had to insert a lot of extra type casting. Even Objc-C int and Swift Int require casting.
* Other types like enums have limited support in Obj-C -- for example, Swift enums can't be used as a function parameter type -- so I was limited in what new Swift features I could use. I found myself doing a lot of temporary coding and documenting what could change once Obj-C was gone.
* Xcode automatically generates a bridging header to expose Objc-C classes to Swift, but it makes assumptions about naming conventions that can create mismatches. The file can't be manually edited and sometimes took several clean/build cycles to get it to update.
* A Swift class can inherit from an Obj-C class, but an Obj-C class can't inherit from a Swift class. This meant I'd have to convert all the subclasses of a superclass first, then convert the superclass, then go back and make adjustments to all the subclasses, and repeat that cycle as I work up the tree.
This finally felt like too much time to spend on a temporary setup, and I decided just to push toward a complete conversion without further attention to interoperability. Not far into that, Xcode's real-time error checking (the red and yellow icons) gave up and left me with no help from the compiler ... so when everything was converted and I was able to try building again, I had 8000 compiler errors to deal with. But that's finally done and now I'm running and testing my 98% Swift app (I have a few small third-party utilities that I left alone for now).
The original poster compared his project to walking across the Sahara. I kept imagining my project as a 500 mile hike. The compiler giving up was like running out of water and then fixing all those errors was like doing the last 50 miles uphill in the mud. But I like hiking, so this metaphor kept me motivated. :-)
I have some small projects and when I convert those, I will do them all at once. I would say the smaller your project is, the less reason there is to mess with interoperability between the two languages.
By the way, my process was to convert a few files at a time with [Swiftify](https://swiftify.com/), then manually clean them up line-by-line, sometimes at a rate of only 200 lines per hour. With all the cleanup, I'd estimate [Swiftify](https://swiftify.com/) cut the conversion time in half -- not amazing but still worthwhile. I have an Android version of the same project in Kotlin, and it was sometimes faster to copy and paste Kotlin code and tweak it to Swift than to convert from Objective-C because Kotlin and Swift are so similar. |
52,942,575 | I've running project and its really gigantic, it contain almost 1000 files and 4 Custom (own built) framework and almost 10 others added via Pods.
I've gone through [Migrating Your Objective-C Code to Swift](https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift) and also [Migrate with Swiftify](https://medium.com/swiftify/migrating-your-objective-c-project-to-swift-ccb0afac8191).
I started to converting each file one by one as Apple suggest but first Conversion isn't successfully done by Swiftify and also dependency issues.
So at this position its looks like that I start walking in Sahara Desert, where I can't see any end point.
So I need some suggestion how to convert to Swift this kinda huge scale project? | 2018/10/23 | [
"https://Stackoverflow.com/questions/52942575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671060/"
] | Your approach of converting Objective-C to Swift is wrong! Apple also took time to adopt Swift completely in their frameworks and the news is in 2018, 85% of the frameworks are converted to Swift, so the point is they has also taken nearly 3 years to get it done!
The biggest problem is that Swift is still evolving and probably next year we might see "Swift 5.0". So what I suggest you to go via following way:
1. Pick the latest version of Swift (i.e. 4.2).
2. Rather than start converting complete project, adapt modular way.
3. From your project, first of all start picking up smaller modules which don't affect app in any way and see that the "Swift" file works well with Objective-C (Your old code). Reference: [How can I import Swift code to Objective-C?](https://stackoverflow.com/questions/24102104/how-can-i-import-swift-code-to-objective-c)
4. Once you are done with smaller ones, slowly start picking up big modules also you may find open source Swift libraries which are in Objective-C in your project.
5. Besides, you can also build modules from scratch in the form of smaller projects and then just drag and drop in Objective-C project.
6. [Andreas Oetjen](https://stackoverflow.com/users/1646335/andreas-oetjen) Suggestion: You might start by separating the class hierarchy, and convert one "subtree" after the other.
>
> How the above Points help?
>
>
>
1. You may find some unusual code or libraries lying around.
2. You may end-up having clean code under proper structure
3. You can use "Swift + Objective-C" as of now to make your app running smoothly and also giving updates regularly rather than waiting for the months to convert it completely. | Reference [Swiftify](https://swiftify.com/converter/code/)
Step 1: Make sure you have latest version of Xcode (Recommended Xcode 11 & newer).
Step 2: [Sign](https://swiftify.com/signin/) or [Sign Up](https://swiftify.com/signin/) to site to download the app.
Step 3: Download and install Swiftify for Xcode.
Step 4: If the app is blocked from running, go to the Apple menu > System Preferences... > Security & Privacy > General tab. Under the section labeled "Allow applications downloaded from," select "Mac App Store and identified developers".
[](https://i.stack.imgur.com/v6s6z.png)
Step 5: Run “Swiftify for Xcode” from your Applications folder and enter the following API key:
`Please, Sign In or Sign Up Free to get your own API key.`
Step 6: If there’s nothing in the Editor menu, open System Preferences -> Extensions and put a checkmark next to “Swiftify for Xcode”.
[](https://i.stack.imgur.com/mZmhV.png)
Step 7: Run (or restart) Xcode and check the Editor -> Swiftify menu.
[](https://i.stack.imgur.com/lnBN6.png)
Step 8: The new Finder extension allows you to convert files, folders and even ZIP archives with your projects using the Right-Click menu:
[](https://i.stack.imgur.com/5iTae.png)
Step 9: You can also use the Right-Click menu to convert code from most macOS text editor apps:
[](https://i.stack.imgur.com/cVbmn.png)
Step 10: You can set a shortcut (Key Binding) for any command via Xcode -> Preferences -> Key Bindings.
[](https://i.stack.imgur.com/sa3h7.png) |
52,942,575 | I've running project and its really gigantic, it contain almost 1000 files and 4 Custom (own built) framework and almost 10 others added via Pods.
I've gone through [Migrating Your Objective-C Code to Swift](https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift) and also [Migrate with Swiftify](https://medium.com/swiftify/migrating-your-objective-c-project-to-swift-ccb0afac8191).
I started to converting each file one by one as Apple suggest but first Conversion isn't successfully done by Swiftify and also dependency issues.
So at this position its looks like that I start walking in Sahara Desert, where I can't see any end point.
So I need some suggestion how to convert to Swift this kinda huge scale project? | 2018/10/23 | [
"https://Stackoverflow.com/questions/52942575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671060/"
] | I recently converted [SVProgressHUD](https://github.com/SVProgressHUD/SVProgressHUD) to swift using [Swiftify](https://swiftify.com/#/converter/code/). The converted code can be found at [here](https://github.com/Swiftify-Corp/IHProgressHUD).
The major takeaways would be:
1. To start the code conversion one file at a time maintaining
interoperability with Objective C, that is the converted swift file
should be interoperable with your existing Objective-C code.
2. Pick a class which does not have subclasses and is simple.
[](https://i.stack.imgur.com/Q37fz.png)
The detailed conversion strategy can be found [here](https://medium.com/swiftify/converting-svprogresshud-to-swift-using-swiftify-27be1817b7f6). | Here's a different perspective from the other answers. I have a project of similar size to the original poster (250 classes, 7 MB of source code). I don't want the mental load of maintaining a hybrid of two different programming languages long-term. And after converting about 30 classes, I found myself spending most of my time tweaking code for interoperability between Objective-C and Swift. Issues included:
* Some types like Array and NSMutableArray aren't automatically interchangable, so I had to insert a lot of extra type casting. Even Objc-C int and Swift Int require casting.
* Other types like enums have limited support in Obj-C -- for example, Swift enums can't be used as a function parameter type -- so I was limited in what new Swift features I could use. I found myself doing a lot of temporary coding and documenting what could change once Obj-C was gone.
* Xcode automatically generates a bridging header to expose Objc-C classes to Swift, but it makes assumptions about naming conventions that can create mismatches. The file can't be manually edited and sometimes took several clean/build cycles to get it to update.
* A Swift class can inherit from an Obj-C class, but an Obj-C class can't inherit from a Swift class. This meant I'd have to convert all the subclasses of a superclass first, then convert the superclass, then go back and make adjustments to all the subclasses, and repeat that cycle as I work up the tree.
This finally felt like too much time to spend on a temporary setup, and I decided just to push toward a complete conversion without further attention to interoperability. Not far into that, Xcode's real-time error checking (the red and yellow icons) gave up and left me with no help from the compiler ... so when everything was converted and I was able to try building again, I had 8000 compiler errors to deal with. But that's finally done and now I'm running and testing my 98% Swift app (I have a few small third-party utilities that I left alone for now).
The original poster compared his project to walking across the Sahara. I kept imagining my project as a 500 mile hike. The compiler giving up was like running out of water and then fixing all those errors was like doing the last 50 miles uphill in the mud. But I like hiking, so this metaphor kept me motivated. :-)
I have some small projects and when I convert those, I will do them all at once. I would say the smaller your project is, the less reason there is to mess with interoperability between the two languages.
By the way, my process was to convert a few files at a time with [Swiftify](https://swiftify.com/), then manually clean them up line-by-line, sometimes at a rate of only 200 lines per hour. With all the cleanup, I'd estimate [Swiftify](https://swiftify.com/) cut the conversion time in half -- not amazing but still worthwhile. I have an Android version of the same project in Kotlin, and it was sometimes faster to copy and paste Kotlin code and tweak it to Swift than to convert from Objective-C because Kotlin and Swift are so similar. |
52,942,575 | I've running project and its really gigantic, it contain almost 1000 files and 4 Custom (own built) framework and almost 10 others added via Pods.
I've gone through [Migrating Your Objective-C Code to Swift](https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift) and also [Migrate with Swiftify](https://medium.com/swiftify/migrating-your-objective-c-project-to-swift-ccb0afac8191).
I started to converting each file one by one as Apple suggest but first Conversion isn't successfully done by Swiftify and also dependency issues.
So at this position its looks like that I start walking in Sahara Desert, where I can't see any end point.
So I need some suggestion how to convert to Swift this kinda huge scale project? | 2018/10/23 | [
"https://Stackoverflow.com/questions/52942575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671060/"
] | I recently converted [SVProgressHUD](https://github.com/SVProgressHUD/SVProgressHUD) to swift using [Swiftify](https://swiftify.com/#/converter/code/). The converted code can be found at [here](https://github.com/Swiftify-Corp/IHProgressHUD).
The major takeaways would be:
1. To start the code conversion one file at a time maintaining
interoperability with Objective C, that is the converted swift file
should be interoperable with your existing Objective-C code.
2. Pick a class which does not have subclasses and is simple.
[](https://i.stack.imgur.com/Q37fz.png)
The detailed conversion strategy can be found [here](https://medium.com/swiftify/converting-svprogresshud-to-swift-using-swiftify-27be1817b7f6). | Reference [Swiftify](https://swiftify.com/converter/code/)
Step 1: Make sure you have latest version of Xcode (Recommended Xcode 11 & newer).
Step 2: [Sign](https://swiftify.com/signin/) or [Sign Up](https://swiftify.com/signin/) to site to download the app.
Step 3: Download and install Swiftify for Xcode.
Step 4: If the app is blocked from running, go to the Apple menu > System Preferences... > Security & Privacy > General tab. Under the section labeled "Allow applications downloaded from," select "Mac App Store and identified developers".
[](https://i.stack.imgur.com/v6s6z.png)
Step 5: Run “Swiftify for Xcode” from your Applications folder and enter the following API key:
`Please, Sign In or Sign Up Free to get your own API key.`
Step 6: If there’s nothing in the Editor menu, open System Preferences -> Extensions and put a checkmark next to “Swiftify for Xcode”.
[](https://i.stack.imgur.com/mZmhV.png)
Step 7: Run (or restart) Xcode and check the Editor -> Swiftify menu.
[](https://i.stack.imgur.com/lnBN6.png)
Step 8: The new Finder extension allows you to convert files, folders and even ZIP archives with your projects using the Right-Click menu:
[](https://i.stack.imgur.com/5iTae.png)
Step 9: You can also use the Right-Click menu to convert code from most macOS text editor apps:
[](https://i.stack.imgur.com/cVbmn.png)
Step 10: You can set a shortcut (Key Binding) for any command via Xcode -> Preferences -> Key Bindings.
[](https://i.stack.imgur.com/sa3h7.png) |
52,942,575 | I've running project and its really gigantic, it contain almost 1000 files and 4 Custom (own built) framework and almost 10 others added via Pods.
I've gone through [Migrating Your Objective-C Code to Swift](https://developer.apple.com/documentation/swift/migrating_your_objective-c_code_to_swift) and also [Migrate with Swiftify](https://medium.com/swiftify/migrating-your-objective-c-project-to-swift-ccb0afac8191).
I started to converting each file one by one as Apple suggest but first Conversion isn't successfully done by Swiftify and also dependency issues.
So at this position its looks like that I start walking in Sahara Desert, where I can't see any end point.
So I need some suggestion how to convert to Swift this kinda huge scale project? | 2018/10/23 | [
"https://Stackoverflow.com/questions/52942575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/671060/"
] | Reference [Swiftify](https://swiftify.com/converter/code/)
Step 1: Make sure you have latest version of Xcode (Recommended Xcode 11 & newer).
Step 2: [Sign](https://swiftify.com/signin/) or [Sign Up](https://swiftify.com/signin/) to site to download the app.
Step 3: Download and install Swiftify for Xcode.
Step 4: If the app is blocked from running, go to the Apple menu > System Preferences... > Security & Privacy > General tab. Under the section labeled "Allow applications downloaded from," select "Mac App Store and identified developers".
[](https://i.stack.imgur.com/v6s6z.png)
Step 5: Run “Swiftify for Xcode” from your Applications folder and enter the following API key:
`Please, Sign In or Sign Up Free to get your own API key.`
Step 6: If there’s nothing in the Editor menu, open System Preferences -> Extensions and put a checkmark next to “Swiftify for Xcode”.
[](https://i.stack.imgur.com/mZmhV.png)
Step 7: Run (or restart) Xcode and check the Editor -> Swiftify menu.
[](https://i.stack.imgur.com/lnBN6.png)
Step 8: The new Finder extension allows you to convert files, folders and even ZIP archives with your projects using the Right-Click menu:
[](https://i.stack.imgur.com/5iTae.png)
Step 9: You can also use the Right-Click menu to convert code from most macOS text editor apps:
[](https://i.stack.imgur.com/cVbmn.png)
Step 10: You can set a shortcut (Key Binding) for any command via Xcode -> Preferences -> Key Bindings.
[](https://i.stack.imgur.com/sa3h7.png) | Here's a different perspective from the other answers. I have a project of similar size to the original poster (250 classes, 7 MB of source code). I don't want the mental load of maintaining a hybrid of two different programming languages long-term. And after converting about 30 classes, I found myself spending most of my time tweaking code for interoperability between Objective-C and Swift. Issues included:
* Some types like Array and NSMutableArray aren't automatically interchangable, so I had to insert a lot of extra type casting. Even Objc-C int and Swift Int require casting.
* Other types like enums have limited support in Obj-C -- for example, Swift enums can't be used as a function parameter type -- so I was limited in what new Swift features I could use. I found myself doing a lot of temporary coding and documenting what could change once Obj-C was gone.
* Xcode automatically generates a bridging header to expose Objc-C classes to Swift, but it makes assumptions about naming conventions that can create mismatches. The file can't be manually edited and sometimes took several clean/build cycles to get it to update.
* A Swift class can inherit from an Obj-C class, but an Obj-C class can't inherit from a Swift class. This meant I'd have to convert all the subclasses of a superclass first, then convert the superclass, then go back and make adjustments to all the subclasses, and repeat that cycle as I work up the tree.
This finally felt like too much time to spend on a temporary setup, and I decided just to push toward a complete conversion without further attention to interoperability. Not far into that, Xcode's real-time error checking (the red and yellow icons) gave up and left me with no help from the compiler ... so when everything was converted and I was able to try building again, I had 8000 compiler errors to deal with. But that's finally done and now I'm running and testing my 98% Swift app (I have a few small third-party utilities that I left alone for now).
The original poster compared his project to walking across the Sahara. I kept imagining my project as a 500 mile hike. The compiler giving up was like running out of water and then fixing all those errors was like doing the last 50 miles uphill in the mud. But I like hiking, so this metaphor kept me motivated. :-)
I have some small projects and when I convert those, I will do them all at once. I would say the smaller your project is, the less reason there is to mess with interoperability between the two languages.
By the way, my process was to convert a few files at a time with [Swiftify](https://swiftify.com/), then manually clean them up line-by-line, sometimes at a rate of only 200 lines per hour. With all the cleanup, I'd estimate [Swiftify](https://swiftify.com/) cut the conversion time in half -- not amazing but still worthwhile. I have an Android version of the same project in Kotlin, and it was sometimes faster to copy and paste Kotlin code and tweak it to Swift than to convert from Objective-C because Kotlin and Swift are so similar. |
1,185,592 | I've asked this somewhere else, but the people there don't seem to understand what I am talking about.
When I go to the PECL website, all extensions found there are inside TGZ files.
Which is not a problem, any modern archiving program can open it.
Inside is always a .tar file and inside that are the source files.
So, what do I do with that? I'm particularly interested in using the pecl\_http extension, but I'm not sure what to do.
Note: there are no DLL files inside the .TAR files. None whatsoever, not a single one. All you find is C code and C headers. | 2009/07/26 | [
"https://Stackoverflow.com/questions/1185592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/80907/"
] | If there is not .dll provided, you have to compile it :-(
There was a pecl4win website some time ago, but it's down ; and the new <http://windows.php.net/> does not have extensions on it yet *(there is work going on, but windows is not **the** platform of choice for PHP developpers, nor core-developpers, so it's not going really fast).*
You say this :
>
> there are no DLL files inside the .TAR
> files. None whatsoever, not a single
> one. All you find is C code and C
> headers.
>
>
>
Which means you will have to compile the extension yourself :-( *(maybe you'll get lucky, and find a .dll somewhere that fits your version of PHP ; some extensions, like [Xdebug](http://xdebug.org/download.php), have those on their official website, at least for recent versions of PHP... But it's not always the case :-( )*
To compile a PECL extension with windows, you can take a look at these links :
* [Installing a PHP extension on Windows](http://us2.php.net/manual/en/install.pecl.windows.php)
* [Building from source](http://us2.php.net/manual/en/install.windows.building.php)
* [How do I get my PECL extension compiling on Windows?](http://wiki.php.net/internals/windows/peclbuilds)
Anyway... Good luck...
As a sidenote : if I remember correctly, the PHP's installer for windows has some PECL extensions bundled in ; maybe this one is one of those ? | Plugins are almost always implemented using a shared library (a.k.a. dynamic library), containing functions which are dynamically loaded at runtime. On Windows, shared libraries are DLLs, which is why all the extensions (i.e. plugins) for PHP have come in the form of one or more DLL files. If you are given the source code for a plugin, you will need to build the source code (i.e., compile and link it) into a DLL or into DLLs.
How exactly you build the source code depends on the specific plugin. A well-designed source package will come with a "README" file explaining exactly how to build the the package. If the package contains a file named "configure" and another named "Makefile", then the build process is almost always to invoke:
```
./configure
make
sudo make install
```
On Windows, the commands above would have to be invoked using Cygwin. If the package contains a Visual Studio project file, then you can probably use that the build the source package. |
1,185,592 | I've asked this somewhere else, but the people there don't seem to understand what I am talking about.
When I go to the PECL website, all extensions found there are inside TGZ files.
Which is not a problem, any modern archiving program can open it.
Inside is always a .tar file and inside that are the source files.
So, what do I do with that? I'm particularly interested in using the pecl\_http extension, but I'm not sure what to do.
Note: there are no DLL files inside the .TAR files. None whatsoever, not a single one. All you find is C code and C headers. | 2009/07/26 | [
"https://Stackoverflow.com/questions/1185592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/80907/"
] | If there is not .dll provided, you have to compile it :-(
There was a pecl4win website some time ago, but it's down ; and the new <http://windows.php.net/> does not have extensions on it yet *(there is work going on, but windows is not **the** platform of choice for PHP developpers, nor core-developpers, so it's not going really fast).*
You say this :
>
> there are no DLL files inside the .TAR
> files. None whatsoever, not a single
> one. All you find is C code and C
> headers.
>
>
>
Which means you will have to compile the extension yourself :-( *(maybe you'll get lucky, and find a .dll somewhere that fits your version of PHP ; some extensions, like [Xdebug](http://xdebug.org/download.php), have those on their official website, at least for recent versions of PHP... But it's not always the case :-( )*
To compile a PECL extension with windows, you can take a look at these links :
* [Installing a PHP extension on Windows](http://us2.php.net/manual/en/install.pecl.windows.php)
* [Building from source](http://us2.php.net/manual/en/install.windows.building.php)
* [How do I get my PECL extension compiling on Windows?](http://wiki.php.net/internals/windows/peclbuilds)
Anyway... Good luck...
As a sidenote : if I remember correctly, the PHP's installer for windows has some PECL extensions bundled in ; maybe this one is one of those ? | There **ARE** pecl library collections for Windows, and they're either appended (as a separate link) on PHP download page (named X.Y.Z-win32-pecl.zip or similar), or linked somehow (for example, the latest PHP5 can use PECL from the previous 5.X setup, and it says so on the download page).
If all You get is source code, You will need to build these yourself.
a) download PHP source code (a lot of headers required to build the libs and link them to PHP on Windows),
b) download the extensions You want to build, and put them in /phpsource/src/ext/ folder,
c) prepare Your favorite C/C++ IDE (I prefer to use VisualC++ 6.0 for the sole purpose of writing PHP extensions on Windows)
d) make a build environ, and finally
e) build ;-)
Do note You will need PHP[ver]debug\_ts.lib or PHP[ver]release\_ts.lib to link them properly.
Unless You're building them for PHP 4.4.4 (which I use to develop .exe apps using BamCompile - a roundabout way, but it works magic), in which case just send Your source code to me, I'll build it for You if I have time. ;-) Also chances are, the extension You're looking for **HAS** a .dll built for it already. Just take the name of the extension, and search Google for " php\_*NameOfTheExtension*.dll PHP*YourPHPVersionNumber* " and You just might find it (although a few, like php\_openAl.dll don't exist as .dll). |
1,185,592 | I've asked this somewhere else, but the people there don't seem to understand what I am talking about.
When I go to the PECL website, all extensions found there are inside TGZ files.
Which is not a problem, any modern archiving program can open it.
Inside is always a .tar file and inside that are the source files.
So, what do I do with that? I'm particularly interested in using the pecl\_http extension, but I'm not sure what to do.
Note: there are no DLL files inside the .TAR files. None whatsoever, not a single one. All you find is C code and C headers. | 2009/07/26 | [
"https://Stackoverflow.com/questions/1185592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/80907/"
] | There **ARE** pecl library collections for Windows, and they're either appended (as a separate link) on PHP download page (named X.Y.Z-win32-pecl.zip or similar), or linked somehow (for example, the latest PHP5 can use PECL from the previous 5.X setup, and it says so on the download page).
If all You get is source code, You will need to build these yourself.
a) download PHP source code (a lot of headers required to build the libs and link them to PHP on Windows),
b) download the extensions You want to build, and put them in /phpsource/src/ext/ folder,
c) prepare Your favorite C/C++ IDE (I prefer to use VisualC++ 6.0 for the sole purpose of writing PHP extensions on Windows)
d) make a build environ, and finally
e) build ;-)
Do note You will need PHP[ver]debug\_ts.lib or PHP[ver]release\_ts.lib to link them properly.
Unless You're building them for PHP 4.4.4 (which I use to develop .exe apps using BamCompile - a roundabout way, but it works magic), in which case just send Your source code to me, I'll build it for You if I have time. ;-) Also chances are, the extension You're looking for **HAS** a .dll built for it already. Just take the name of the extension, and search Google for " php\_*NameOfTheExtension*.dll PHP*YourPHPVersionNumber* " and You just might find it (although a few, like php\_openAl.dll don't exist as .dll). | Plugins are almost always implemented using a shared library (a.k.a. dynamic library), containing functions which are dynamically loaded at runtime. On Windows, shared libraries are DLLs, which is why all the extensions (i.e. plugins) for PHP have come in the form of one or more DLL files. If you are given the source code for a plugin, you will need to build the source code (i.e., compile and link it) into a DLL or into DLLs.
How exactly you build the source code depends on the specific plugin. A well-designed source package will come with a "README" file explaining exactly how to build the the package. If the package contains a file named "configure" and another named "Makefile", then the build process is almost always to invoke:
```
./configure
make
sudo make install
```
On Windows, the commands above would have to be invoked using Cygwin. If the package contains a Visual Studio project file, then you can probably use that the build the source package. |
4,120,944 | Mathematica will gladly tell me that the integral
$$ I\left[y,a\right]=\int\_{y}^{\infty}dx\,e^{-x^{2}}\mathrm{erf}\left(ax\right)$$
where $\mathrm{erf}(x)=\frac{2}{\sqrt{\pi}}\int\_{0}^{x}dt\,e^{-t^{2}}$ is the error function,
can be written as
$$ I\left[y,a\right]=-\frac{1}{2} \sqrt{\pi } \left(4 T\left(\sqrt{2} a y,\frac{1}{a}\right)+\mathrm{erf}(y)\, \mathrm{erf}(a y)-1\right)$$
where
$$T(x,a) =\frac{1}{2 \pi }\int\_0^a \frac{e^{-\left(t^2+1\right) x^2/2}}{ t^2+1} \, dt$$
is Owens T-function.
How is this derived? And more importantly: Can a similar result be derived for multiple error functions like
$$
I\left[y;a\_{1},\ldots a\_{n}\right]=\int\_{y}^{\infty}dx\,e^{-x^{2}}\prod\_{j=1}^{n}\mathrm{erf}\left(a\_{j}x\right)
$$
My end goal is to compute integrals like
$$ G\_{n}=\int\_{-\infty}^{\infty}dx\_{0}\,\prod\_{j=1}^{n}\int\_{x\_{j-1}}^{\infty}dx\_{j}\,e^{-\sum\_{j=0}^{n}x\_{j}^{2}} \prod\_{j=0}^n x\_j^{p\_j}$$
where the $p\_j$ are "not-too-large" non-negative integers. In these integrals, multiple error functions naturally pop up. | 2021/04/29 | [
"https://math.stackexchange.com/questions/4120944",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/180260/"
] | This is not a full answer, more of a note. Using integration by parts, notice that:
$$\int\_0^\infty e^{-x^2}\operatorname{erf}(ax)\,dx=\frac{\sqrt{\pi}}{2}-\int\_0^\infty e^{-x^2}\operatorname{erf}\left(\frac xa\right)\,dx$$
and you can try to split your integral up into:
$$\int\_y^\infty=\int\_0^\infty-\int\_0^y$$
---
Addressing what others have said:
$$I(y,a)=\int\_y^\infty e^{-x^2}\operatorname{erf}(ax)\,dx$$
$$\frac{\partial I(y,a)}{\partial a}=\int\_y^\infty e^{-x^2}\frac{\partial}{\partial a}\left[\operatorname{erf}(ax)\right]\,dx=\frac{2}{\sqrt{\pi}}\int\_y^\infty xe^{-(a^2+1)x^2}dx$$
$$=\frac{1}{\sqrt{\pi}}\frac{e^{-(a^2+1)y^2}}{(a^2+1)}$$
now you need to integrate wrt $a$, which you will see brings in our $T$ function | Let $n \ge 1$ be an integer and let $\vec{a} \in {\mathbb R}^n$ and $y \in {\mathbb R}\_+$. Then
the integral in question can be thought of as a vector argument Owen's T function. In other words we have:
\begin{eqnarray}
T[h,\vec{a}] &:=& \int\limits\_y^\infty \left(\prod\limits\_{i=1}^n \frac{1}{2}\operatorname{erf} [ \frac{a\_j x}{\sqrt{2}}]\right) \cdot \frac{e^{-\frac{x^2}{2}}}{\sqrt{2\pi}} dx \\
&=&\frac{1}{2 \pi^{\frac{n+1}{2}}}
\int\limits\_{\otimes\_{j=1}^n [0, a\_j]}
\frac{\Gamma[\frac{n+1}{2}, \frac{y^2}{2} (1+\sum\limits\_{j=1}^n z\_\xi^2)]}{\sqrt{1 + \sum\limits\_{j=1}^n z\_\xi^2}^{n+1}} \cdot
\prod\limits\_{j=1}^n dz\_\xi \tag{1}
\end{eqnarray}
```
In[563]:=
n = RandomInteger[{2, 4}];
Clear[a]; z =.; x =.; j =.;
y = RandomReal[{0, 2}];
Do[ a[j] = RandomReal[{0, 1}], {j, 1, n}];
NIntegrate[
Product[1/2 Erf[a[j] x/Sqrt[2]], {j, 1, n}] Exp[-x^2/2]/
Sqrt[2 Pi], {x, y, Infinity}]
1/2 \[Pi]^(-(1/2) - n/2)
NIntegrate[ Gamma[(n + 1)/2, y^2/2 (1 + Sum[z[xi]^2, {xi, 1, n}])]/
Sqrt[1 + Sum[z[xi]^2, {xi, 1, n}]]^(n + 1),
Evaluate[Sequence @@ Table[{z[xi], 0, a[xi]}, {xi, 1, n}]]]
Out[567]= 0.000468798
Out[568]= 0.000468798
```
Clearly as $n= 1$ the result reduces to the ordinary [Owen's T function as in Wikipedia](https://en.wikipedia.org/wiki/Owen%27s_T_function).
But now, the question appears can we come up with some fast and efficient numerical algorithm for evaluating that function? Could we generalize [this algorithm](https://people.math.sc.edu/Burkardt/m_src/owen/owen.html) when $n >1$? |
26,086,762 | Now, i'm trying to understand how Angular.js working with "Angular.js in 60 Minutes" by Dan Wahlin. And i stuck with this code, which in browser must look like this: <http://oi59.tinypic.com/25im4cy.jpg>
My code:
index.html
```
<!DOCTYPE html>
<html lang="en" ng-app="demoApp">
<head>
<meta charset="UTF-8">
<title>Angular.js</title>
</head>
<body>
<div>
<div ng-view></div>
</div>
<script type="text/javascript" src="angular.min.js"></script>
<script>
var demoApp=angular.module('demoApp',[]);
demoApp.config(function ($routeProvider) {
$routeProvider
.when('/',
{
controller: 'SimpleController',
templateUrl: 'View1.html'
})
.when('/view2',
{
controller: 'SimpleController',
templateUrl: 'View2.html'
})
.otherwise({redirectTo:'/'});
});
demoApp.controller('SimpleController', function ($scope){
$scope.customers=[
{name:'Sam',city:'Moscow'},
{name:'Dan',city:'Dubna'},
{name:'Alex',city:'Dmitrov'}
];
$scope.addCustomer= function(){
$scope.customers.push(
{
name: $scope.newCustomer.name,
city: $scope.newCustomer.city
});
};
});
</script>
</body>
</html>
```
View1.html
```
<div class="container">
<h2>View 1</h2>
Name
<br/>
<input type="text" data-ng-model="filter.name"/>
<br/>
<ul>
<li ng-repeat="cust in customers | filter:filter.name | orderBy:'name">{{cust.name | uppercase}} - {{cust.city | lowercase}}</li>
</ul>
<br/>
Customer name: <br/>
<input type="text" ng-model="newCustomer.name">
<br/>
Customer city: <br/>
<input type="text" ng-model="newCustomer.city">
<br/>
<button ng-click="addCustomer()">Add Customer</button>
<br/>
<a href="#/view2">View 2</a>
</div>
```
View2.html
```
<div class="container">
<h2>View 2</h2>
City
<br/>
<input type="text" data-ng-model="city"/>
<br/>
<ul>
<li ng-repeat="cust in customers | filter:city | orderBy:'name">{{cust.name | uppercase}} - {{cust.city | lowercase}}</li>
</ul>
</div>
```
But, when i launch index.html in browser, there is nothing at all. Can somebody explain me what's the matter or, if you have already read this book, give me your version of code? | 2014/09/28 | [
"https://Stackoverflow.com/questions/26086762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4088603/"
] | This is because you have *not* done two things:
* Include the `ngRoute` module as a dependency when you declare `angular.module('demoApp', [])`
* Include `angular-route.js` script code in your project.
I created [this JSFiddle](http://jsfiddle.net/467px16e/) from your code to show it working, just with the `View1` template, where all I have done is include `ngRoute` as a library and a dependency of the `demoApp` module.
In the future, you should check your development console, because Angular printed out an error. | ```
<body ng-app='demoApp'>
<div>
<div ng-view></div>
</div>
</body>
<script type="text/ng-template" id="View1.html">
<div class="container">
Name
<input type="text" data-ng-model="filter.name"/>
<ul>
<li ng-repeat="cust in customers | filter:filter.name | orderBy:'name">{{cust.name | uppercase}} - {{cust.city | lowercase}}</li>
</ul>
<br/>
Customer name: <br/>
<input type="text" ng-model="newCustomer.name">
<br/>
Customer city: <br/>
<input type="text" ng-model="newCustomer.city">
<br/>
<button ng-click="addCustomer()">Add Customer</button>
<br/>
<a href="#/view2">View 2</a>
</div>
<script>
var demoApp=angular.module('demoApp',['ngRoute']);
demoApp.config(function ($routeProvider) {
$routeProvider
.when('/',
{
controller: 'SimpleController',
templateUrl: 'View1.html'
})
.when('/view2',
{
controller: 'SimpleController',
templateUrl: 'View2.html'
})
.otherwise({redirectTo:'/'});
});
demoApp.controller('SimpleController', function ($scope){
$scope.customers=[
{name:'Sam',city:'Moscow'},
{name:'Dan',city:'Dubna'},
{name:'Alex',city:'Dmitrov'}
];
$scope.addCustomer= function(){
$scope.customers.push(
{
name: $scope.newCustomer.name,
city: $scope.newCustomer.city
});
};
});
</script>
``` |
59,359,767 | I have a dataset that has zero's on all the column. I need to remove the rows that has zero's. But I would like to retain the other rows. Also, I do not want to disrupt the grouping variable.
```
Participant Media B C D
A1 C11 0.5 0 0
A1 C12 0.4 0.3 0
A1 C13 0 0 0
A2 C11 0 0 0
A2 C12 1 2 0
A2 C13 2 0 0
```
I applied multiple filter function in `dplyr`. It does not help me with my dataset.
```
data <- data%>%
filter(data, B > 0 & C > 0 & D >0)
```
Is there any quick way to subset the data without disrupting the dataframe?
Expected output
```
Participant Media B C D
A1 C11 0.5 0 0
A1 C12 0.4 0.3 0
A2 C12 1 2 0
A2 C13 2 0 0
``` | 2019/12/16 | [
"https://Stackoverflow.com/questions/59359767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11962863/"
] | What you attempted to use is valid for CMD.EXE, but in PowerShell, `type` is an alias for `Get-Content`, which expects a valid device or file. However, the null device is *not* available in PowerShell, although a *variable* `$null` will return the desired value. You should instead use
```
New-Item -Path . -Name "file.js" -Value $null
```
or
```
Set-Content -Path .\file.js -Value $null
```
to create an empty file. | I didn't get a satisfactory answer so I searched the command list for PowerShell on Microsoft's website.
Use
```
Set-Content -path D:\\Main\file.js
```
Then it will ask for values \*(e.g. [-Value0], [-Value1], ...)." Values are what what you want to type in the file e.g. [-Value0] will contain what will be in the first line of the code of file.js. Pressing enter will move to next line i.e. [-Value1]. Pressing enter without typing anything in a value will exit taking values and save the file.
The above command can be shortened like:
`sc` for `Set-Content` & `.` for `D:\\Main` because it is your default directory. You can also skip the `-path` term. So the new shortened command will be:
```
sc .\file.js
``` |
2,523,075 | How to generate page numbers like the below using javascript/jquery?
If the 5 th page is selected i have to show 3,4 and 6,7 and also 1,last page with prev,next...
Any suggestion....
**EDIT:**
How to work with json data that use these pagination div? (ie) My json data contains 50 records
I want to 10 in page 1 and so on... How to paginate json data with these numbers...
I want a jquery function to pass `currentpageno,lastpagenumber` and the function should generate me page numbers like the below for me
If it is the first page
[](https://i.stack.imgur.com/BtvYz.jpg)
If it is in the middle,
[](https://i.stack.imgur.com/GrXYu.jpg)
If it is the last page,
[](https://i.stack.imgur.com/F1iRN.jpg)
**Second EDIT:**
I have tried this function but doesn't seem to get the desired result
```
function generatePages(currentPage, LastPage) {
if (LastPage <= 5) {
var pages = '';
for(var i=1;i<=5;i++)
{
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
if (LastPage > 5) {
var pages = '';
for (var i = 1; i <= 5; i++) {
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
}
```
I have the `lastPage` and `currentPage` values please help me out getting this... | 2010/03/26 | [
"https://Stackoverflow.com/questions/2523075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207556/"
] | What you are looking for is called "pagination" and there's (as always) a jQuery plugin that does the job for you:
<http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm>
(Download it [here](http://plugins.jquery.com/project/pagination))
---
**Edit:** Since you don't seem to be able to get it working, here is one way (of several different) how you can use the plugin.
**Step 1:** Generate markup from your JSON-data like the following:
```
<div id="display">
<!-- This is the div where the visible page will be displayed -->
</div>
<div id="hiddenData">
<!-- This is the div where you output your records -->
<div class="record">
<!-- create one record-div for each record you have in your JSON data -->
</div>
<div class="record">
</div>
</div>
```
The idea is to copy the respective record to the display div when clicking on a page-link. Therefore, the plugin offers a pageSelect-callback function. **Step 2** is to implement this function, for instance:
```
function pageselectCallback(pageIndex, jq){
// Clone the record that should be displayed
var newContent = $('#hiddenData div.record:eq('+pageIndex+')').clone();
// Update the display container
$('#display').empty().append(newContent);
return false;
}
```
This would mean that you have one page per record. If you want to display multiple records per page, you have to modify the above function accordingly.
**The third and final step** is to initialize the whole thing correctly.
```
function initPagination() {
// Hide the records... they shouldn't be displayed
$("#hiddenData").css("display", "none");
// Get the number of records
var numEntries = $('#hiddenData div.result').length;
// Create pagination element
$("#pagination").pagination(numEntries, {
num_edge_entries: 2,
num_display_entries: 8, // number of page links displayed
callback: pageselectCallback,
items_per_page: 1 // Adjust this value if you change the callback!
});
}
```
So, you just have to generate the HTML markup from your JSON data and call the init-function afterwards.
It's not that difficult, is it? | yeah @SLaks is right. nothing too crazy here. You will have 2 variables currentPageNumber and lastPageNumber.
```
$("div.paginator").append("<a...>prev</a>");
$("div.paginator").append("<a...>1</a>");
for (x = (currentPageNumber - 2; x <= (currentPageNumber + 2); x++) {
$("div.paginator").append("<a...>"+ x +"</a>");
}
$("div.paginator").append("<a...>"+ lastPageNumber +"</a>");
$("div.paginator").append("<a...>next</a>");
// you could apply styles to and a tag in the div.paginator
// you could apply a special class to the a tag that matches the currentPageNumber
// you can also bind some click events to each a tag and use the $(this).text() to grab the number of the page to go to
``` |
2,523,075 | How to generate page numbers like the below using javascript/jquery?
If the 5 th page is selected i have to show 3,4 and 6,7 and also 1,last page with prev,next...
Any suggestion....
**EDIT:**
How to work with json data that use these pagination div? (ie) My json data contains 50 records
I want to 10 in page 1 and so on... How to paginate json data with these numbers...
I want a jquery function to pass `currentpageno,lastpagenumber` and the function should generate me page numbers like the below for me
If it is the first page
[](https://i.stack.imgur.com/BtvYz.jpg)
If it is in the middle,
[](https://i.stack.imgur.com/GrXYu.jpg)
If it is the last page,
[](https://i.stack.imgur.com/F1iRN.jpg)
**Second EDIT:**
I have tried this function but doesn't seem to get the desired result
```
function generatePages(currentPage, LastPage) {
if (LastPage <= 5) {
var pages = '';
for(var i=1;i<=5;i++)
{
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
if (LastPage > 5) {
var pages = '';
for (var i = 1; i <= 5; i++) {
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
}
```
I have the `lastPage` and `currentPage` values please help me out getting this... | 2010/03/26 | [
"https://Stackoverflow.com/questions/2523075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207556/"
] | What you are looking for is called "pagination" and there's (as always) a jQuery plugin that does the job for you:
<http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm>
(Download it [here](http://plugins.jquery.com/project/pagination))
---
**Edit:** Since you don't seem to be able to get it working, here is one way (of several different) how you can use the plugin.
**Step 1:** Generate markup from your JSON-data like the following:
```
<div id="display">
<!-- This is the div where the visible page will be displayed -->
</div>
<div id="hiddenData">
<!-- This is the div where you output your records -->
<div class="record">
<!-- create one record-div for each record you have in your JSON data -->
</div>
<div class="record">
</div>
</div>
```
The idea is to copy the respective record to the display div when clicking on a page-link. Therefore, the plugin offers a pageSelect-callback function. **Step 2** is to implement this function, for instance:
```
function pageselectCallback(pageIndex, jq){
// Clone the record that should be displayed
var newContent = $('#hiddenData div.record:eq('+pageIndex+')').clone();
// Update the display container
$('#display').empty().append(newContent);
return false;
}
```
This would mean that you have one page per record. If you want to display multiple records per page, you have to modify the above function accordingly.
**The third and final step** is to initialize the whole thing correctly.
```
function initPagination() {
// Hide the records... they shouldn't be displayed
$("#hiddenData").css("display", "none");
// Get the number of records
var numEntries = $('#hiddenData div.result').length;
// Create pagination element
$("#pagination").pagination(numEntries, {
num_edge_entries: 2,
num_display_entries: 8, // number of page links displayed
callback: pageselectCallback,
items_per_page: 1 // Adjust this value if you change the callback!
});
}
```
So, you just have to generate the HTML markup from your JSON data and call the init-function afterwards.
It's not that difficult, is it? | Use [THIS](http://plugins.jquery.com/project/jquery-pagination) or [THAT](http://plugins.jquery.com/project/jPaginate) plugin. They're both easy html pagination plugins. Put everything in the html at once and paginate with one of those. |
2,523,075 | How to generate page numbers like the below using javascript/jquery?
If the 5 th page is selected i have to show 3,4 and 6,7 and also 1,last page with prev,next...
Any suggestion....
**EDIT:**
How to work with json data that use these pagination div? (ie) My json data contains 50 records
I want to 10 in page 1 and so on... How to paginate json data with these numbers...
I want a jquery function to pass `currentpageno,lastpagenumber` and the function should generate me page numbers like the below for me
If it is the first page
[](https://i.stack.imgur.com/BtvYz.jpg)
If it is in the middle,
[](https://i.stack.imgur.com/GrXYu.jpg)
If it is the last page,
[](https://i.stack.imgur.com/F1iRN.jpg)
**Second EDIT:**
I have tried this function but doesn't seem to get the desired result
```
function generatePages(currentPage, LastPage) {
if (LastPage <= 5) {
var pages = '';
for(var i=1;i<=5;i++)
{
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
if (LastPage > 5) {
var pages = '';
for (var i = 1; i <= 5; i++) {
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
}
```
I have the `lastPage` and `currentPage` values please help me out getting this... | 2010/03/26 | [
"https://Stackoverflow.com/questions/2523075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207556/"
] | What you are looking for is called "pagination" and there's (as always) a jQuery plugin that does the job for you:
<http://d-scribe.de/webtools/jquery-pagination/demo/demo_options.htm>
(Download it [here](http://plugins.jquery.com/project/pagination))
---
**Edit:** Since you don't seem to be able to get it working, here is one way (of several different) how you can use the plugin.
**Step 1:** Generate markup from your JSON-data like the following:
```
<div id="display">
<!-- This is the div where the visible page will be displayed -->
</div>
<div id="hiddenData">
<!-- This is the div where you output your records -->
<div class="record">
<!-- create one record-div for each record you have in your JSON data -->
</div>
<div class="record">
</div>
</div>
```
The idea is to copy the respective record to the display div when clicking on a page-link. Therefore, the plugin offers a pageSelect-callback function. **Step 2** is to implement this function, for instance:
```
function pageselectCallback(pageIndex, jq){
// Clone the record that should be displayed
var newContent = $('#hiddenData div.record:eq('+pageIndex+')').clone();
// Update the display container
$('#display').empty().append(newContent);
return false;
}
```
This would mean that you have one page per record. If you want to display multiple records per page, you have to modify the above function accordingly.
**The third and final step** is to initialize the whole thing correctly.
```
function initPagination() {
// Hide the records... they shouldn't be displayed
$("#hiddenData").css("display", "none");
// Get the number of records
var numEntries = $('#hiddenData div.result').length;
// Create pagination element
$("#pagination").pagination(numEntries, {
num_edge_entries: 2,
num_display_entries: 8, // number of page links displayed
callback: pageselectCallback,
items_per_page: 1 // Adjust this value if you change the callback!
});
}
```
So, you just have to generate the HTML markup from your JSON data and call the init-function afterwards.
It's not that difficult, is it? | Add two new hidden inputs
```
<input type='hidden' id='current_page' />
<input type='hidden' id='show_per_page' />
```
Next add an empty div to create pagination controls
```
<!-- An empty div which will be populated using jQuery -->
<div id='page_navigation'></div>
$(document).ready(function(){
//how much items per page to show
var show_per_page = 5;
//getting the amount of elements inside content div
var number_of_items = $('#content').children().size();
//calculate the number of pages we are going to have
var number_of_pages = Math.ceil(number_of_items/show_per_page);
//set the value of our hidden input fields
$('#current_page').val(0);
$('#show_per_page').val(show_per_page);
//now when we got all we need for the navigation let's make it '
/*
what are we going to have in the navigation?
- link to previous page
- links to specific pages
- link to next page
*/
var navigation_html = '<a class="previous_link" href="javascript:previous();">Prev</a>';
var current_link = 0;
while(number_of_pages > current_link){
navigation_html += '<a class="page_link" href="javascript:go_to_page(' + current_link +')" longdesc="' + current_link +'">'+ (current_link + 1) +'</a>';
current_link++;
}
navigation_html += '<a class="next_link" href="javascript:next();">Next</a>';
$('#page_navigation').html(navigation_html);
//add active_page class to the first page link
$('#page_navigation .page_link:first').addClass('active_page');
//hide all the elements inside content div
$('#content').children().css('display', 'none');
//and show the first n (show_per_page) elements
$('#content').children().slice(0, show_per_page).css('display', 'block');
});
function previous(){
new_page = parseInt($('#current_page').val()) - 1;
//if there is an item before the current active link run the function
if($('.active_page').prev('.page_link').length==true){
go_to_page(new_page);
}
}
function next(){
new_page = parseInt($('#current_page').val()) + 1;
//if there is an item after the current active link run the function
if($('.active_page').next('.page_link').length==true){
go_to_page(new_page);
}
}
function go_to_page(page_num){
//get the number of items shown per page
var show_per_page = parseInt($('#show_per_page').val());
//get the element number where to start the slice from
start_from = page_num * show_per_page;
//get the element number where to end the slice
end_on = start_from + show_per_page;
//hide all children elements of content div, get specific items and show them
$('#content').children().css('display', 'none').slice(start_from, end_on).css('display', 'block');
/*get the page link that has longdesc attribute of the current page and add active_page class to it
and remove that class from previously active page link*/
$('.page_link[longdesc=' + page_num +']').addClass('active_page').siblings('.active_page').removeClass('active_page');
//update the current page input field
$('#current_page').val(page_num);
}
``` |
2,523,075 | How to generate page numbers like the below using javascript/jquery?
If the 5 th page is selected i have to show 3,4 and 6,7 and also 1,last page with prev,next...
Any suggestion....
**EDIT:**
How to work with json data that use these pagination div? (ie) My json data contains 50 records
I want to 10 in page 1 and so on... How to paginate json data with these numbers...
I want a jquery function to pass `currentpageno,lastpagenumber` and the function should generate me page numbers like the below for me
If it is the first page
[](https://i.stack.imgur.com/BtvYz.jpg)
If it is in the middle,
[](https://i.stack.imgur.com/GrXYu.jpg)
If it is the last page,
[](https://i.stack.imgur.com/F1iRN.jpg)
**Second EDIT:**
I have tried this function but doesn't seem to get the desired result
```
function generatePages(currentPage, LastPage) {
if (LastPage <= 5) {
var pages = '';
for(var i=1;i<=5;i++)
{
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
if (LastPage > 5) {
var pages = '';
for (var i = 1; i <= 5; i++) {
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
}
```
I have the `lastPage` and `currentPage` values please help me out getting this... | 2010/03/26 | [
"https://Stackoverflow.com/questions/2523075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207556/"
] | yeah @SLaks is right. nothing too crazy here. You will have 2 variables currentPageNumber and lastPageNumber.
```
$("div.paginator").append("<a...>prev</a>");
$("div.paginator").append("<a...>1</a>");
for (x = (currentPageNumber - 2; x <= (currentPageNumber + 2); x++) {
$("div.paginator").append("<a...>"+ x +"</a>");
}
$("div.paginator").append("<a...>"+ lastPageNumber +"</a>");
$("div.paginator").append("<a...>next</a>");
// you could apply styles to and a tag in the div.paginator
// you could apply a special class to the a tag that matches the currentPageNumber
// you can also bind some click events to each a tag and use the $(this).text() to grab the number of the page to go to
``` | Use [THIS](http://plugins.jquery.com/project/jquery-pagination) or [THAT](http://plugins.jquery.com/project/jPaginate) plugin. They're both easy html pagination plugins. Put everything in the html at once and paginate with one of those. |
2,523,075 | How to generate page numbers like the below using javascript/jquery?
If the 5 th page is selected i have to show 3,4 and 6,7 and also 1,last page with prev,next...
Any suggestion....
**EDIT:**
How to work with json data that use these pagination div? (ie) My json data contains 50 records
I want to 10 in page 1 and so on... How to paginate json data with these numbers...
I want a jquery function to pass `currentpageno,lastpagenumber` and the function should generate me page numbers like the below for me
If it is the first page
[](https://i.stack.imgur.com/BtvYz.jpg)
If it is in the middle,
[](https://i.stack.imgur.com/GrXYu.jpg)
If it is the last page,
[](https://i.stack.imgur.com/F1iRN.jpg)
**Second EDIT:**
I have tried this function but doesn't seem to get the desired result
```
function generatePages(currentPage, LastPage) {
if (LastPage <= 5) {
var pages = '';
for(var i=1;i<=5;i++)
{
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
if (LastPage > 5) {
var pages = '';
for (var i = 1; i <= 5; i++) {
pages += "<a class='page-numbers' href='#'>" + i + "</a>"
}
$("#PagerDiv").append(pages);
}
}
```
I have the `lastPage` and `currentPage` values please help me out getting this... | 2010/03/26 | [
"https://Stackoverflow.com/questions/2523075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/207556/"
] | yeah @SLaks is right. nothing too crazy here. You will have 2 variables currentPageNumber and lastPageNumber.
```
$("div.paginator").append("<a...>prev</a>");
$("div.paginator").append("<a...>1</a>");
for (x = (currentPageNumber - 2; x <= (currentPageNumber + 2); x++) {
$("div.paginator").append("<a...>"+ x +"</a>");
}
$("div.paginator").append("<a...>"+ lastPageNumber +"</a>");
$("div.paginator").append("<a...>next</a>");
// you could apply styles to and a tag in the div.paginator
// you could apply a special class to the a tag that matches the currentPageNumber
// you can also bind some click events to each a tag and use the $(this).text() to grab the number of the page to go to
``` | Add two new hidden inputs
```
<input type='hidden' id='current_page' />
<input type='hidden' id='show_per_page' />
```
Next add an empty div to create pagination controls
```
<!-- An empty div which will be populated using jQuery -->
<div id='page_navigation'></div>
$(document).ready(function(){
//how much items per page to show
var show_per_page = 5;
//getting the amount of elements inside content div
var number_of_items = $('#content').children().size();
//calculate the number of pages we are going to have
var number_of_pages = Math.ceil(number_of_items/show_per_page);
//set the value of our hidden input fields
$('#current_page').val(0);
$('#show_per_page').val(show_per_page);
//now when we got all we need for the navigation let's make it '
/*
what are we going to have in the navigation?
- link to previous page
- links to specific pages
- link to next page
*/
var navigation_html = '<a class="previous_link" href="javascript:previous();">Prev</a>';
var current_link = 0;
while(number_of_pages > current_link){
navigation_html += '<a class="page_link" href="javascript:go_to_page(' + current_link +')" longdesc="' + current_link +'">'+ (current_link + 1) +'</a>';
current_link++;
}
navigation_html += '<a class="next_link" href="javascript:next();">Next</a>';
$('#page_navigation').html(navigation_html);
//add active_page class to the first page link
$('#page_navigation .page_link:first').addClass('active_page');
//hide all the elements inside content div
$('#content').children().css('display', 'none');
//and show the first n (show_per_page) elements
$('#content').children().slice(0, show_per_page).css('display', 'block');
});
function previous(){
new_page = parseInt($('#current_page').val()) - 1;
//if there is an item before the current active link run the function
if($('.active_page').prev('.page_link').length==true){
go_to_page(new_page);
}
}
function next(){
new_page = parseInt($('#current_page').val()) + 1;
//if there is an item after the current active link run the function
if($('.active_page').next('.page_link').length==true){
go_to_page(new_page);
}
}
function go_to_page(page_num){
//get the number of items shown per page
var show_per_page = parseInt($('#show_per_page').val());
//get the element number where to start the slice from
start_from = page_num * show_per_page;
//get the element number where to end the slice
end_on = start_from + show_per_page;
//hide all children elements of content div, get specific items and show them
$('#content').children().css('display', 'none').slice(start_from, end_on).css('display', 'block');
/*get the page link that has longdesc attribute of the current page and add active_page class to it
and remove that class from previously active page link*/
$('.page_link[longdesc=' + page_num +']').addClass('active_page').siblings('.active_page').removeClass('active_page');
//update the current page input field
$('#current_page').val(page_num);
}
``` |
51,891,599 | I am trying to upload multiple files with single input and i wanted to limit the total size of all files to be less than 100 MB. How can i do it?
This is my code:
```html
<?php
if(isset($_POST['submit'])){
if(count($_FILES['upload']['name']) > 0){
for($i=0; $i<count($_FILES['upload']['name']); $i++) {
$fileName = $_FILES['upload']['name'][$i];
$fileExt = strtolower(pathinfo($_FILES['upload']['name'][$i],PATHINFO_EXTENSION));
$maxFileSize = 100 * 1024 * 1024 /* 100MB */;
if(empty($fileName)) {
echo 'Please select photos to upload!';
} else if(!in_array( $fileExt, array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) {
echo 'Only photos, videos and audios allowed. If you have one or more files that is not in our <a href="#">supported extensions</a> directory, please remove it!';
} else if($_FILES['upload']['size'][$i]>$maxFileSize) {
echo 'Your file\s exceed the limit of 100MB capacity';
} else {
echo "Uploaded";
}
}
}
}
?>
<form action="" enctype="multipart/form-data" method="post">
<div>
<label for='upload'>Add Attachments:</label>
<input id='upload' name="upload[]" type="file" multiple="multiple" />
</div>
<p><input type="submit" name="submit" value="Submit"></p>
</form>
```
It seems that i can't get the sum of the size all files. How can i do this?
And thanks in advance! | 2018/08/17 | [
"https://Stackoverflow.com/questions/51891599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10045456/"
] | If you just want to get the size of all uploaded files into your code, you can use [`array_sum()`](http://php.net/manual/function.array-sum.php), there is no need to use a loop.
```
$totalFileSize = array_sum($_FILES['upload']['size']);
```
this will give you the size in bytes of all files. then you can compare it to your max size :
```
$maxFileSize = 100 * 1024 * 1024 /* 100MB */;
if ($totalFileSize > $maxFileSize) {
echo 'Your files exceed the limit of 100MB capacity';
}
```
---
based on your code, here is the full code with `array_sum` to get the total file size
```
<?php
if (isset($_POST['submit'])) {
if (count($_FILES['upload']['name']) > 0) {
// compute the total size of the uploaded files
$totalFileSize = array_sum($_FILES['upload']['size']);
echo 'upload size : ' . $totalFileSize . ' bytes';
$maxFileSize = 100 * 1024 * 1024;
// check if the upload size is less than the max allowed
if ($totalFileSize > $maxFileSize) {
echo 'Your files exceed the limit of 100MB capacity';
} else {
// upload size is OK, process files
for ($i = 0; $i < count($_FILES['upload']['name']); $i++) {
$fileName = $_FILES['upload']['name'][$i];
$fileExt = strtolower(pathinfo($_FILES['upload']['name'][$i], PATHINFO_EXTENSION));
if (empty($fileName)) {
echo 'Please select photos to upload!';
} else {
if (!in_array($fileExt, ['jpg', 'jpeg', 'png', 'gif', 'bmp'])) {
echo 'Only photos, videos and audios allowed. If you have one or more files that is not in our <a href="#">supported extensions</a> directory, please remove it!';
} else {
echo "Uploaded";
}
}
}
}
}
}
?>
<form action="" enctype="multipart/form-data" method="post">
<div>
<label for='upload'>Add Attachments:</label>
<input id='upload' name="upload[]" type="file" multiple="multiple"/>
</div>
<p><input type="submit" name="submit" value="Submit"></p>
</form>
``` | Use a variable to calculate it inside the loop. I have put **$total\_file\_size** variable to do that below.
```
<?php
if(isset($_POST['submit'])){
if(count($_FILES['upload']['name']) > 0){
$total_file_size = 0;
for($i=0; $i<count($_FILES['upload']['name']); $i++) {
$total_file_size += $_FILES['upload']['size'][$i];
$fileName = $_FILES['upload']['name'][$i];
$fileExt = strtolower(pathinfo($_FILES['upload']['name'][$i],PATHINFO_EXTENSION));
$maxFileSize = 100 * 1024 * 1024 /* 100MB */;
if(empty($fileName)) {
echo 'Please select photos to upload!';
} else if(!in_array( $fileExt, array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) {
echo 'Only photos, videos and audios allowed. If you have one or more files that is not in our <a href="#">supported extensions</a> directory, please remove it!';
} else if($_FILES['upload']['size'][$i]>$maxFileSize) {
echo 'Your file\s exceed the limit of 100MB capacity';
} else {
echo "Uploaded";
}
}
}
}
?>
``` |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | If you have enabled 2-factor authentication on your Google account you can't use your regular password to access Gmail programmatically. You need to generate an app-specific password and use that in place of your actual password.
Steps:
Log in to your Google account
Go to My Account > Sign-in & Security > App Passwords
(Sign in again to confirm it's you)
Scroll down to Select App (in the Password & sign-in method box) and choose Other (custom name)
Give this app password a name, e.g. "nodemailer"
Choose Generate
Copy the long generated password and paste it into your Node.js script instead of your actual Gmail password. | You need to use an application password for this purpose. This issue will arise when 2 Step verification is turned-on for your Gmail account. You can bypass it by using app password. here is how to generate an app password.
1. Select your profile icon in the upper-right corner of Gmail, then select Manage Google Account.
2. Select Security in the left sidebar.
3. Select App passwords under the Signing into Google section. You're then asked to confirm your Gmail login credentials.
4. Under Select app, choose Mail or Other (Custom name), then select a device.
5. Select Generate.
6. Your password appears in a new window. Follow the on-screen instructions to complete the process, then select Done.
google doc : <https://support.google.com/mail/answer/185833?hl=en#zippy=%2Cwhy-you-may-need-an-app-password> |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | If you have enabled 2-factor authentication on your Google account you can't use your regular password to access Gmail programmatically. You need to generate an app-specific password and use that in place of your actual password.
Steps:
Log in to your Google account
Go to My Account > Sign-in & Security > App Passwords
(Sign in again to confirm it's you)
Scroll down to Select App (in the Password & sign-in method box) and choose Other (custom name)
Give this app password a name, e.g. "nodemailer"
Choose Generate
Copy the long generated password and paste it into your Node.js script instead of your actual Gmail password. | Generate a password from <https://security.google.com/settings/security/apppasswords> and use that password instead. |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | If you have enabled 2-factor authentication on your Google account you can't use your regular password to access Gmail programmatically. You need to generate an app-specific password and use that in place of your actual password.
Steps:
Log in to your Google account
Go to My Account > Sign-in & Security > App Passwords
(Sign in again to confirm it's you)
Scroll down to Select App (in the Password & sign-in method box) and choose Other (custom name)
Give this app password a name, e.g. "nodemailer"
Choose Generate
Copy the long generated password and paste it into your Node.js script instead of your actual Gmail password. | UPD: You can't do this on localhost. I try. Because it's not a secure connection. |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | If you have enabled 2-factor authentication on your Google account you can't use your regular password to access Gmail programmatically. You need to generate an app-specific password and use that in place of your actual password.
Steps:
Log in to your Google account
Go to My Account > Sign-in & Security > App Passwords
(Sign in again to confirm it's you)
Scroll down to Select App (in the Password & sign-in method box) and choose Other (custom name)
Give this app password a name, e.g. "nodemailer"
Choose Generate
Copy the long generated password and paste it into your Node.js script instead of your actual Gmail password. | in Gmail, Enable 2-Step-Verification.
Then create App password & use it on SMTP |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | You need to use an application password for this purpose. This issue will arise when 2 Step verification is turned-on for your Gmail account. You can bypass it by using app password. here is how to generate an app password.
1. Select your profile icon in the upper-right corner of Gmail, then select Manage Google Account.
2. Select Security in the left sidebar.
3. Select App passwords under the Signing into Google section. You're then asked to confirm your Gmail login credentials.
4. Under Select app, choose Mail or Other (Custom name), then select a device.
5. Select Generate.
6. Your password appears in a new window. Follow the on-screen instructions to complete the process, then select Done.
google doc : <https://support.google.com/mail/answer/185833?hl=en#zippy=%2Cwhy-you-may-need-an-app-password> | Generate a password from <https://security.google.com/settings/security/apppasswords> and use that password instead. |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | You need to use an application password for this purpose. This issue will arise when 2 Step verification is turned-on for your Gmail account. You can bypass it by using app password. here is how to generate an app password.
1. Select your profile icon in the upper-right corner of Gmail, then select Manage Google Account.
2. Select Security in the left sidebar.
3. Select App passwords under the Signing into Google section. You're then asked to confirm your Gmail login credentials.
4. Under Select app, choose Mail or Other (Custom name), then select a device.
5. Select Generate.
6. Your password appears in a new window. Follow the on-screen instructions to complete the process, then select Done.
google doc : <https://support.google.com/mail/answer/185833?hl=en#zippy=%2Cwhy-you-may-need-an-app-password> | UPD: You can't do this on localhost. I try. Because it's not a secure connection. |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | You need to use an application password for this purpose. This issue will arise when 2 Step verification is turned-on for your Gmail account. You can bypass it by using app password. here is how to generate an app password.
1. Select your profile icon in the upper-right corner of Gmail, then select Manage Google Account.
2. Select Security in the left sidebar.
3. Select App passwords under the Signing into Google section. You're then asked to confirm your Gmail login credentials.
4. Under Select app, choose Mail or Other (Custom name), then select a device.
5. Select Generate.
6. Your password appears in a new window. Follow the on-screen instructions to complete the process, then select Done.
google doc : <https://support.google.com/mail/answer/185833?hl=en#zippy=%2Cwhy-you-may-need-an-app-password> | in Gmail, Enable 2-Step-Verification.
Then create App password & use it on SMTP |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | Generate a password from <https://security.google.com/settings/security/apppasswords> and use that password instead. | UPD: You can't do this on localhost. I try. Because it's not a secure connection. |
60,701,936 | i want send Welcome notification when user sign in using Cloud-Function with firebase auth
so i m using nodejs CLI and run the code
my index.js file
'use strict';
```
const functions = require('firebase-functions');
const nodemailer = require('nodemailer');
// Configure the email transport using the default SMTP transport and a GMail account.
// For Gmail, enable these:
// 1. https://www.google.com/settings/security/lesssecureapps
// 2. https://accounts.google.com/DisplayUnlockCaptcha
// For other types of transports such as Sendgrid see https://nodemailer.com/transports/
// TODO: Configure the `gmail.email` and `gmail.password` Google Cloud environment variables.
const gmailEmail = functions.config().gmail.email;
const gmailPassword = functions.config().gmail.password;
const mailTransport = nodemailer.createTransport({
service: 'gmail',
auth: {
user: gmailEmail,
pass: gmailPassword,
},
});
// Your company name to include in the emails
// TODO: Change this to your app or company name to customize the email sent.
const APP_NAME = 'Cloud Storage for Firebase quickstart';
// [START sendWelcomeEmail]
/**
* Sends a welcome email to new user.
*/
// [START onCreateTrigger]
exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
// [END onCreateTrigger]
// [START eventAttributes]
const email = user.email; // The email of the user.
const displayName = user.displayName; // The display name of the user.
// [END eventAttributes]
return sendWelcomeEmail(email, displayName);
});
// [END sendWelcomeEmail]
// [START sendByeEmail]
/**
* Send an account deleted email confirmation to users who delete their accounts.
*/
// [START onDeleteTrigger]
exports.sendByeEmail = functions.auth.user().onDelete((user) => {
// [END onDeleteTrigger]
const email = user.email;
const displayName = user.displayName;
return sendGoodbyeEmail(email, displayName);
});
// [END sendByeEmail]
// Sends a welcome email to the given user.
async function sendWelcomeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user subscribed to the newsletter.
mailOptions.subject = `Welcome to ${APP_NAME}!`;
mailOptions.text = `Hey ${displayName || ''}! Welcome to ${APP_NAME}. I hope you will enjoy our service.`;
await mailTransport.sendMail(mailOptions);
console.log('New welcome email sent to:', email);
return null;
}
// Sends a goodbye email to the given user.
async function sendGoodbyeEmail(email, displayName) {
const mailOptions = {
from: `${APP_NAME} <noreply@firebase.com>`,
to: email,
};
// The user unsubscribed to the newsletter.
mailOptions.subject = `Bye!`;
mailOptions.text = `Hey ${displayName || ''}!, We confirm that we have deleted your ${APP_NAME} account.`;
await mailTransport.sendMail(mailOptions);
console.log('Account deletion confirmation email sent to:', email);
return null;
}
```
i refer this code [`https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js`](https://github.com/firebase/functions-samples/blob/master/quickstarts/email-users/functions/index.js)
but after i ran the code i got error
```
Error: Invalid login: 534-5.7.9 Application-specific password required. Learn more at
534 5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor i82sm13686303ilf.32 - gsmtp
at SMTPConnection._formatError (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:1523:34)
at SMTPConnection._responseActions.push.str (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:550:26)
at SMTPConnection._processResponse (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:942:20)
at SMTPConnection._onData (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at TLSSocket.SMTPConnection._onSocketData.chunk (/srv/node_modules/nodemailer/lib/smtp-connection/index.js:195:44)
at emitOne (events.js:116:13)
at TLSSocket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
```
i also Allow less secure apps From your Google Account
and also done 2 step-verification [](https://i.stack.imgur.com/y8wwU.png)
but still got an error
I read all "Similar Questions" here in stackoverflow and I don't know if I need anything else or if I'm doing anything bad | 2020/03/16 | [
"https://Stackoverflow.com/questions/60701936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12454906/"
] | Generate a password from <https://security.google.com/settings/security/apppasswords> and use that password instead. | in Gmail, Enable 2-Step-Verification.
Then create App password & use it on SMTP |
10,810,926 | Is the following python code valid?
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
``` | 2012/05/30 | [
"https://Stackoverflow.com/questions/10810926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863553/"
] | Yes it is valid. The class is defined by the time you create an object and call the `returnTest` method.
```
In [2]: x = Test()
In [3]: y = x.returnTest()
In [4]: y
Out[4]: <__main__.Test instance at 0x1e36ef0>
In [5]:
```
However, in cases where a method acts like a factory, you might want to consider using the [classmethod](http://docs.python.org/library/functions.html#classmethod) decorator. When inheritance and other annoyances come in the way, this can help. | Yes, it's valid. `returnTest` will not be run until it is called. It does not create an infinite loop, since the method is not called on the newly created object. |
10,810,926 | Is the following python code valid?
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
``` | 2012/05/30 | [
"https://Stackoverflow.com/questions/10810926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863553/"
] | Yes it is valid. The class is defined by the time you create an object and call the `returnTest` method.
```
In [2]: x = Test()
In [3]: y = x.returnTest()
In [4]: y
Out[4]: <__main__.Test instance at 0x1e36ef0>
In [5]:
```
However, in cases where a method acts like a factory, you might want to consider using the [classmethod](http://docs.python.org/library/functions.html#classmethod) decorator. When inheritance and other annoyances come in the way, this can help. | Yes. It's a valid python code. Many programming languages allow to return an instance of a class being defined. Think to the **singleton** pattern. |
10,810,926 | Is the following python code valid?
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
``` | 2012/05/30 | [
"https://Stackoverflow.com/questions/10810926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863553/"
] | Yes it is valid. The class is defined by the time you create an object and call the `returnTest` method.
```
In [2]: x = Test()
In [3]: y = x.returnTest()
In [4]: y
Out[4]: <__main__.Test instance at 0x1e36ef0>
In [5]:
```
However, in cases where a method acts like a factory, you might want to consider using the [classmethod](http://docs.python.org/library/functions.html#classmethod) decorator. When inheritance and other annoyances come in the way, this can help. | Yes, it works but it appears that returnTest() is always the same instance of Test.
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
t = Test()
print t
print t.returnTest()
print t.returnTest()
$ python te.py
<__main__.Test instance at 0xb72bd28c>
<__main__.Test instance at 0xb72bd40c>
<__main__.Test instance at 0xb72bd40c>
```
This is true for Python 2.7 and 3.2. @classmethod didn't make a difference. Interestingly enough, pypy returns a different instance each time:
```
$ pypy te.py
<__main__.Test instance at 0xb6dcc1dc>
<__main__.Test instance at 0xb6dcc1f0>
<__main__.Test instance at 0xb6dcc204>
``` |
10,810,926 | Is the following python code valid?
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
``` | 2012/05/30 | [
"https://Stackoverflow.com/questions/10810926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863553/"
] | Yes, it's valid. `returnTest` will not be run until it is called. It does not create an infinite loop, since the method is not called on the newly created object. | Yes. It's a valid python code. Many programming languages allow to return an instance of a class being defined. Think to the **singleton** pattern. |
10,810,926 | Is the following python code valid?
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
``` | 2012/05/30 | [
"https://Stackoverflow.com/questions/10810926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863553/"
] | Yes, it's valid. `returnTest` will not be run until it is called. It does not create an infinite loop, since the method is not called on the newly created object. | Yes, it works but it appears that returnTest() is always the same instance of Test.
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
t = Test()
print t
print t.returnTest()
print t.returnTest()
$ python te.py
<__main__.Test instance at 0xb72bd28c>
<__main__.Test instance at 0xb72bd40c>
<__main__.Test instance at 0xb72bd40c>
```
This is true for Python 2.7 and 3.2. @classmethod didn't make a difference. Interestingly enough, pypy returns a different instance each time:
```
$ pypy te.py
<__main__.Test instance at 0xb6dcc1dc>
<__main__.Test instance at 0xb6dcc1f0>
<__main__.Test instance at 0xb6dcc204>
``` |
10,810,926 | Is the following python code valid?
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
``` | 2012/05/30 | [
"https://Stackoverflow.com/questions/10810926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/863553/"
] | Yes, it works but it appears that returnTest() is always the same instance of Test.
```
class Test:
def __init__(self):
self.number = 5
def returnTest(self):
return Test()
t = Test()
print t
print t.returnTest()
print t.returnTest()
$ python te.py
<__main__.Test instance at 0xb72bd28c>
<__main__.Test instance at 0xb72bd40c>
<__main__.Test instance at 0xb72bd40c>
```
This is true for Python 2.7 and 3.2. @classmethod didn't make a difference. Interestingly enough, pypy returns a different instance each time:
```
$ pypy te.py
<__main__.Test instance at 0xb6dcc1dc>
<__main__.Test instance at 0xb6dcc1f0>
<__main__.Test instance at 0xb6dcc204>
``` | Yes. It's a valid python code. Many programming languages allow to return an instance of a class being defined. Think to the **singleton** pattern. |
67,035,082 | I Just Started Making a Discord Bot. I Wanna Make a Command Where You Can Type -queue duos to Queue a Game With Others Who Also Want to. However, My Add Role Command Is Completely Unresponsive and Doesn't Give a Role or Error When I Type The Command Into Discord.
```
import discord
import os
#run the Bot and a message to make sure it ran
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
#Detects if someone queues
if message.content.startswith('-queue duos'):
await message.channel.send('you have joined the duos queue.')
async def role(ctx, member : discord.Member, role : discord.Role):
await member.add_roles(role)
client.run(os.getenv('TOKEN'))
``` | 2021/04/10 | [
"https://Stackoverflow.com/questions/67035082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15507350/"
] | As I can see you were trying to do this in an event. For that you need to identify the `author` of the `message` and then assign a role to it. You make a few mistakes in your code, because another function **does not** belong in an event.
**Have a look at the following code:**
```py
from discord.utils import get
@client.event
async def on_message(message):
if message.author == client.user:
return
# detects if someone queues
if message.content.startswith('-queue duos'):
role = discord.utils.get(message.guild.roles, id=RoleID) # Define the role
await message.author.add_roles(role) # Add the role to the author
await message.channel.send('you have joined the duos queue.')
```
**What did we do?**
* Define the role through `discord.utils.get`
* Identified the author of the message and assigned the role
*Maybe also take a look at the [docs](https://discordpy.readthedocs.io/en/stable/) again* | Because you defined but didn't called the role function.
I suppose you saw a tutorial using discord.ext.commands and tried to create a command.
I recommend you to use discord.ext.commands.Bot instead of discord.Client.
It is a subclass of Client so you can do the same.
Example:
```py
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='-')
botId =
@bot.event
async def on_ready():
await bot.change_presence(activity=discord.Game("with your servers"))
print("Bot is ready")
@bot.event
async def on_message(message):
if message.content == f"<@{botId}>" or message.content == f"<@!{botId}>":
await message.channel.send("My prefix is -")
else:
await bot.process_commands(message)
@bot.command()
async def role(ctx, member:discord.Member, role:discord.Role, *reason):
Reason = ' '.join(reason)
try:
await member.add_roles(role, reason=Reason)
await ctx.channel.send("Role added to member")
except:
await ctx.channel.send("I suppose I don't have the permission to do that")
bot.run(token)
``` |
67,035,082 | I Just Started Making a Discord Bot. I Wanna Make a Command Where You Can Type -queue duos to Queue a Game With Others Who Also Want to. However, My Add Role Command Is Completely Unresponsive and Doesn't Give a Role or Error When I Type The Command Into Discord.
```
import discord
import os
#run the Bot and a message to make sure it ran
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
#Detects if someone queues
if message.content.startswith('-queue duos'):
await message.channel.send('you have joined the duos queue.')
async def role(ctx, member : discord.Member, role : discord.Role):
await member.add_roles(role)
client.run(os.getenv('TOKEN'))
``` | 2021/04/10 | [
"https://Stackoverflow.com/questions/67035082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15507350/"
] | As I can see you were trying to do this in an event. For that you need to identify the `author` of the `message` and then assign a role to it. You make a few mistakes in your code, because another function **does not** belong in an event.
**Have a look at the following code:**
```py
from discord.utils import get
@client.event
async def on_message(message):
if message.author == client.user:
return
# detects if someone queues
if message.content.startswith('-queue duos'):
role = discord.utils.get(message.guild.roles, id=RoleID) # Define the role
await message.author.add_roles(role) # Add the role to the author
await message.channel.send('you have joined the duos queue.')
```
**What did we do?**
* Define the role through `discord.utils.get`
* Identified the author of the message and assigned the role
*Maybe also take a look at the [docs](https://discordpy.readthedocs.io/en/stable/) again* | Your problem is, that this isn't registered as command. You should do it with special conditions for the role command and register it outside with [`@client.command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#decorators) (for what you would have to "migrate" to [`commands.Bot()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#bot)) or if you want to stay in on\_message then with [`client.wait_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_for)
Example:
```
import discord
import os
#run the Bot and a message to make sure it ran
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
#Detects if someone queues
if message.content.startswith('-queue duos'):
await message.channel.send('You have joined the duos queue.')
await client.wait_for('message', check=lambda m: m.author == message.author and m.content == '-role')
role = # Define the role you want to add if you haven't before
await member.add_roles(role)
client.run(os.getenv('TOKEN'))
``` |
38,730,563 | My question is in regard of best practice / preferred readability in Angular 1.X with ng-show and ng-hide.
When using ng-hide and ng-show, is it advised to stick to one and to alternate the value I am evaluating or should i alternate between the two in order to keep the value in the expression the same?
See the following examples. Is one preferred over the other and if so why?
Assume that there are only two states, sportSelected can be Hockey or Football that is it, so there are two states.
**Using only ng-show and switching the value**
```
<div class="col-xs-4" ng-show="vm.sportSelected=='hockey'">
NJ Devils
</div>
<div class="col-xs-4" ng-show="vm.sportSelected=='football'">
NY Jets
</div>
<div class="col-xs-4" ng-show="vm.sportSelected=='football'">
NY Giants
</div>
```
**Alternating between ng-show and ng-hide to keep the value the same**
```
<div class="col-xs-4" ng-show="vm.isHockeySelected">
NJ Devils
</div>
<div class="col-xs-4" ng-hide="vm.isHockeySelected">
NY Jets
</div>
<div class="col-xs-4" ng-hide="vm.isHockeySelected">
NY Giants
</div>
```
The top seems more clear to me but it could just be due to poor method and variable names. I am looking through the angular documentation and I cant seem to arrive at what the preferred result is. Is one preferred over the other?
**Edit: Flagged this to be closed, I realized this is pretty opinion based like tabs vs spaces even though I think one solution has benefits over the other** | 2016/08/02 | [
"https://Stackoverflow.com/questions/38730563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1255713/"
] | `ng-hide` and `ng-show` both work in different ways. They are essentially CSS classes which either hide or show the specified div, depending on how the value evaluates.
```
<!-- when $scope.myValue is truthy (element is visible) -->
<div ng-show="myValue"></div>
```
if myValue evaluates to true then the div would be visible
```
<!-- when $scope.myValue is falsy (element is hidden) -->
<div ng-show="myValue" class="ng-hide"></div>
```
however, in the second example, the div would be hidden as the class is set to that of ng-hide.
also you can run `ng-show` or `ng-hide` to check if the value evaluates to false, like so: `<div ng-show="!myValue"></div>`
Due to the nature of the digest cycle in Angular, these checks will be ran on page load. If you do not want the div to be shown on the page, it can be recommendable to use `ng-if`, rather than `ng-show` or `ng-hide`, as it will not load on the page, as opposed to simply hiding it.
In the snippet below you will see an example working for both `ng-hide` and `ng-show`, using the value of the `ng-model` value response of the input checkbox 'checked'. Which gives a `boolean` response.
When it is clicked on, the value for 'checked' evaluates to `true`. When it is unclicked, the value evaluates to `false`. When the ng-model evaluates to false, it shows the ng-hide div, when the ng-model evalutes to true, it shows the ng-show div.
Further reading here: [Angular ng-show documentation](https://docs.angularjs.org/api/ng/directive/ngShow)
```css
@import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
.animate-show {
line-height: 20px;
opacity: 1;
padding: 10px;
border: 1px solid black;
background: white;
}
.animate-show.ng-hide-add, .animate-show.ng-hide-remove {
transition: all linear 0.5s;
}
.animate-show.ng-hide {
line-height: 0;
opacity: 0;
padding: 0 10px;
}
.check-element {
padding: 10px;
border: 1px solid black;
background: white;
}
```
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ng-show-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-animate.js"></script>
</head>
<body ng-app="ngAnimate">
Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br/>
<div>
Show:
<div class="check-element animate-show" ng-show="checked">
<span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
</div>
</div>
<div>
Hide:
<div class="check-element animate-show" ng-hide="checked">
<span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
</div>
</div>
</body>
</html>
<!--
Copyright 2016 Google Inc. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
-->
``` | Whether or not you use `ng-hide` or `ng-show` should be based on how you want the page to appear by default. If you are controlling the visibility of an element that will be hidden by default and only shown after the user completes some action (like selecting a sport), then you want to use `ng-show`. If the element is to be shown by default and only hidden after some user action (maybe a div that says 'select a sport' that disappears once a sport is selected), then you want to use `ng-hide`.
Using the directives this way will contribute more toward readability than worrying about how the boolean condition itself is specified. It also has an important practical benefit. If you use `ng-hide` for something that is supposed to be hidden by default, you might see the element flicker each time you load the page, because in early $digest cycles before your scope can be fully evaluated, the result of that condition will be falsy, which will cause the element to appear briefly before it disappears.
You've got the right idea in the top example (looks like you have a syntax issue with the quotes though). |
20,843,792 | I'm making a C# console application for my college course and I've got an issue where I (or anybody else on the course) don't know what's wrong. In fact the tutor's not sure why it's happening.
I'll show you part of the code to see if anyone can help.
Probably a good idea to mention that I'm new to C# and programming in general.
```
static void Main(string[] args)
{
string userName = GetName();
int gradelevel = level();
double random1 = 0;
double random2 = 0;
int userChoice = menu();
int numberofquestions = 0;
string Message;
int userScore = 0;
do
{
if ((gradelevel == 1) && (userChoice == 1))//ADDITION LEVEL 1
{
generateSingleDigit(ref random1, ref random2);
double userAnswer = additionQuestion(ref random1, ref random2);
double Correctanswer = random1 + random2;
Message = checkAnswer(userAnswer, Correctanswer);
if (userAnswer == Correctanswer)
{
generatePositiveResponse();
userScore++;
}
else
{
int numberofAttempts = 1;
do
{
generateNegativeResponse();
userAnswer = additionQuestion(ref random1, ref random2);
Message = checkAnswer(userAnswer, Correctanswer);
numberofAttempts++;
} while ((numberofAttempts < 3) && (Message == "Incorrect"));
Console.WriteLine("The correct answer is {0}", Correctanswer);
}
}
numberofquestions++;
} while (numberofquestions <= 9);
percentage(ref userScore); `
```
The issue I'm having is that once the user has completed the 10 questions, the results from the percentage method briefly flash up and then the application closes itself. No "Press any key to continue" that I've seen in other applications I've made.
I would really appreciate any help on this.
Thanks | 2013/12/30 | [
"https://Stackoverflow.com/questions/20843792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3146971/"
] | If you add `Console.ReadLine()` at the end, the window will stay open until you press the `enter` key. Otherwise, once it's completed, it'll close the command window. | It sounds like you're missing a `Console.ReadLine()` at the end of your program. When you run a console app in Visual Studio it's normal behavior for the window to be closed once the program finishes, unless there's code (like a `Console.ReadLine()`) to keep the program running.
IF you ran the program directly from a DOS window, the program would still exit but the window would stay open, you'd just be back at the command prompt again. |
20,843,792 | I'm making a C# console application for my college course and I've got an issue where I (or anybody else on the course) don't know what's wrong. In fact the tutor's not sure why it's happening.
I'll show you part of the code to see if anyone can help.
Probably a good idea to mention that I'm new to C# and programming in general.
```
static void Main(string[] args)
{
string userName = GetName();
int gradelevel = level();
double random1 = 0;
double random2 = 0;
int userChoice = menu();
int numberofquestions = 0;
string Message;
int userScore = 0;
do
{
if ((gradelevel == 1) && (userChoice == 1))//ADDITION LEVEL 1
{
generateSingleDigit(ref random1, ref random2);
double userAnswer = additionQuestion(ref random1, ref random2);
double Correctanswer = random1 + random2;
Message = checkAnswer(userAnswer, Correctanswer);
if (userAnswer == Correctanswer)
{
generatePositiveResponse();
userScore++;
}
else
{
int numberofAttempts = 1;
do
{
generateNegativeResponse();
userAnswer = additionQuestion(ref random1, ref random2);
Message = checkAnswer(userAnswer, Correctanswer);
numberofAttempts++;
} while ((numberofAttempts < 3) && (Message == "Incorrect"));
Console.WriteLine("The correct answer is {0}", Correctanswer);
}
}
numberofquestions++;
} while (numberofquestions <= 9);
percentage(ref userScore); `
```
The issue I'm having is that once the user has completed the 10 questions, the results from the percentage method briefly flash up and then the application closes itself. No "Press any key to continue" that I've seen in other applications I've made.
I would really appreciate any help on this.
Thanks | 2013/12/30 | [
"https://Stackoverflow.com/questions/20843792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3146971/"
] | If you add `Console.ReadLine()` at the end, the window will stay open until you press the `enter` key. Otherwise, once it's completed, it'll close the command window. | >
> No "Press any key to continue" that I've seen in other applications I've made.
>
>
>
Why would there be? That doesn't happen unless you write code to make it happen:
```
Console.WriteLine("Press any key to continue");
Console.ReadKey(true);
```
Visual Studio used to put code to do that into the default template of C++ programs, but I've never seen it for C#, and even with the old C++ programs you could see the code that caused this. |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | In general, if you have more then one TextView in a single line it is not trivial to align the first TextView to the left. I have used a Guideline for this pourpose and it works perfectly. If you remove the GuideLine it doesn't works.
Here is the xml:
```
<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:ellipsize="end"
android:maxLines="1"
android:text="first very long very long long long long long very long text"
android:textAlignment="viewStart"
app:layout_constraintEnd_toStartOf="@id/textView2"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:text="second text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="0dp" />
``` | Try this:
```
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:gravity="right"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp" />
``` |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | Unfortunately, we are missing the whole XML of your layout, but let's assume you have something like this:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
```
Now if you create exactly this layout, TextView is gonna be in the center. This is the default behavior of the ConstraintLayout, it always tries to center views in it if you set constraints this way. This behavior can be influenced by `app:layout_constraintHorizontal_bias` and `app:layout_constraintVertical_bias` property of the TextView. Default values for both are 0.5 what you can translate to 50%. If you set them both to 0, you will find the TextView in **the top left position**. If you set them both to 1, the TextView will end up in **the bottom right position**. You got the idea, this way you can position your TextView or any View wherever you want.
The **bias** properties are also described in the official documentation [here](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#CenteringPositioning).
Fully working example of TextView aligned to center vertically and aligned to right horizontally:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</android.support.constraint.ConstraintLayout>
``` | Try this:
```
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:gravity="right"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp" />
``` |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | 1. Make the TextView match parent with:
```
android:layout_width="0dp"
```
2. Then define the textAlignment property:
```
android:textAlignment="viewEnd"
```
Example, align right in a left to right language:
```
<TextView
android:id="@+id/tv_item"
style="@style/text_highlight_small_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/my_text"
android:textAlignment="viewStart"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Sample Text" />
```
Note you can use different values for textAlignment as defined in the [documentation](https://developer.android.com/reference/android/view/View.html#attr_android:textAlignment). | Unfortunately, we are missing the whole XML of your layout, but let's assume you have something like this:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
```
Now if you create exactly this layout, TextView is gonna be in the center. This is the default behavior of the ConstraintLayout, it always tries to center views in it if you set constraints this way. This behavior can be influenced by `app:layout_constraintHorizontal_bias` and `app:layout_constraintVertical_bias` property of the TextView. Default values for both are 0.5 what you can translate to 50%. If you set them both to 0, you will find the TextView in **the top left position**. If you set them both to 1, the TextView will end up in **the bottom right position**. You got the idea, this way you can position your TextView or any View wherever you want.
The **bias** properties are also described in the official documentation [here](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#CenteringPositioning).
Fully working example of TextView aligned to center vertically and aligned to right horizontally:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</android.support.constraint.ConstraintLayout>
``` |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | **Solution:**
use this xml code
```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="TextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:gravity="start"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp" />
</android.support.constraint.ConstraintLayout>
```
Hope it helps. | In general, if you have more then one TextView in a single line it is not trivial to align the first TextView to the left. I have used a Guideline for this pourpose and it works perfectly. If you remove the GuideLine it doesn't works.
Here is the xml:
```
<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:ellipsize="end"
android:maxLines="1"
android:text="first very long very long long long long long very long text"
android:textAlignment="viewStart"
app:layout_constraintEnd_toStartOf="@id/textView2"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:text="second text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="0dp" />
``` |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | 1. Make the TextView match parent with:
```
android:layout_width="0dp"
```
2. Then define the textAlignment property:
```
android:textAlignment="viewEnd"
```
Example, align right in a left to right language:
```
<TextView
android:id="@+id/tv_item"
style="@style/text_highlight_small_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/my_text"
android:textAlignment="viewStart"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Sample Text" />
```
Note you can use different values for textAlignment as defined in the [documentation](https://developer.android.com/reference/android/view/View.html#attr_android:textAlignment). | **Solution:**
use this xml code
```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="TextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:gravity="start"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp" />
</android.support.constraint.ConstraintLayout>
```
Hope it helps. |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | use this xml code
```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp" />
</android.support.constraint.ConstraintLayout>
``` | Use design because it is much easier than xml [video file](https://imgur.com/a/z7lki8C) |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | Unfortunately, we are missing the whole XML of your layout, but let's assume you have something like this:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
```
Now if you create exactly this layout, TextView is gonna be in the center. This is the default behavior of the ConstraintLayout, it always tries to center views in it if you set constraints this way. This behavior can be influenced by `app:layout_constraintHorizontal_bias` and `app:layout_constraintVertical_bias` property of the TextView. Default values for both are 0.5 what you can translate to 50%. If you set them both to 0, you will find the TextView in **the top left position**. If you set them both to 1, the TextView will end up in **the bottom right position**. You got the idea, this way you can position your TextView or any View wherever you want.
The **bias** properties are also described in the official documentation [here](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#CenteringPositioning).
Fully working example of TextView aligned to center vertically and aligned to right horizontally:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</android.support.constraint.ConstraintLayout>
``` | Try this:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.YOURUSER.YOURPROJECT.YOURACTIVITY">
<TextView
android:id="@+id/TextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
``` |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | Unfortunately, we are missing the whole XML of your layout, but let's assume you have something like this:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
```
Now if you create exactly this layout, TextView is gonna be in the center. This is the default behavior of the ConstraintLayout, it always tries to center views in it if you set constraints this way. This behavior can be influenced by `app:layout_constraintHorizontal_bias` and `app:layout_constraintVertical_bias` property of the TextView. Default values for both are 0.5 what you can translate to 50%. If you set them both to 0, you will find the TextView in **the top left position**. If you set them both to 1, the TextView will end up in **the bottom right position**. You got the idea, this way you can position your TextView or any View wherever you want.
The **bias** properties are also described in the official documentation [here](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#CenteringPositioning).
Fully working example of TextView aligned to center vertically and aligned to right horizontally:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</android.support.constraint.ConstraintLayout>
``` | use this xml code
```
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp" />
</android.support.constraint.ConstraintLayout>
``` |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | Try this:
```
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:gravity="right"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp" />
``` | Try this:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.YOURUSER.YOURPROJECT.YOURACTIVITY">
<TextView
android:id="@+id/TextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
``` |
50,583,374 | ```
SELECT artist.name, recording.name, MAX(recording.length)
FROM recording
INNER JOIN (artist_credit
INNER JOIN (artist_credit_name
INNER JOIN artist
ON artist_credit_name.artist_credit=artist.id)
ON artist_credit_name.artist_credit=artist_credit.id)
ON recording.artist_credit=artist_credit.id
WHERE artist.gender=1
AND recording.length <= (SELECT MAX(recording.length) FROM recording)
GROUP BY artist.name, recording.name
ORDER BY artist.name
```
We are using the MusicBrainz database for school and we are having troubles with the "GROUP BY" because we have two columns (it works with one column, but not two). We want the result to display just one artist with his second longest recording time, but the code displays all the recording time of every song of the same artist.
Any suggestions? Thanks. | 2018/05/29 | [
"https://Stackoverflow.com/questions/50583374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9863958/"
] | Unfortunately, we are missing the whole XML of your layout, but let's assume you have something like this:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
```
Now if you create exactly this layout, TextView is gonna be in the center. This is the default behavior of the ConstraintLayout, it always tries to center views in it if you set constraints this way. This behavior can be influenced by `app:layout_constraintHorizontal_bias` and `app:layout_constraintVertical_bias` property of the TextView. Default values for both are 0.5 what you can translate to 50%. If you set them both to 0, you will find the TextView in **the top left position**. If you set them both to 1, the TextView will end up in **the bottom right position**. You got the idea, this way you can position your TextView or any View wherever you want.
The **bias** properties are also described in the official documentation [here](https://developer.android.com/reference/android/support/constraint/ConstraintLayout#CenteringPositioning).
Fully working example of TextView aligned to center vertically and aligned to right horizontally:
```
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Something Important to align"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
</android.support.constraint.ConstraintLayout>
``` | In general, if you have more then one TextView in a single line it is not trivial to align the first TextView to the left. I have used a Guideline for this pourpose and it works perfectly. If you remove the GuideLine it doesn't works.
Here is the xml:
```
<TextView
android:id="@+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:ellipsize="end"
android:maxLines="1"
android:text="first very long very long long long long long very long text"
android:textAlignment="viewStart"
app:layout_constraintEnd_toStartOf="@id/textView2"
app:layout_constraintStart_toStartOf="@+id/guideline"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:text="second text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.constraint.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="0dp" />
``` |
3,409,919 | [c# linq]
i have 2 datasources, 1 coming from an xml document and 1 coming from an sql server database, both return an `IEnumerable<EventsDetails>` is it possible to bind both of these lists to a single repeater? | 2010/08/04 | [
"https://Stackoverflow.com/questions/3409919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/310787/"
] | You're probably looking for something like this, if you want to use LINQ:
```
var both= list1.Union(list2);
```
Then `both` is your data source. | Create a new list containing both. Or an object implementing IEnumetator which first returns elements from the first, then from the second list. |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | ADB stands for **Android Debug Bridge**.
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.

In depth details can be found [here](http://opensourceforgeeks.blogspot.in/2013/12/android-debug-bridge-adb.html).
As for restarting adb server you can execute following commands
```
adb kill-server
adb start-server
```
As for Eclipse simply close the IDE and restart/reopen. Infact restarting Eclipse should restart adb server as well.
PS: Above link goes to my personal blog that has additional details on ADB. | I saw this problem on Eclipse, and it reported that I needed to 'reset adb from the Device's view'. The adb kill&restart-server sequence didn't work for me, **but I was successful with just disabling and then re-enabling the 'USB debugging' check box in the phone's Settings->Developer Options** |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | adb is [Android Debug Bridge](http://developer.android.com/guide/developing/tools/adb.html).
To restart adb by command line:
```
adb kill-server
adb start-server
```
To restart adb in Eclipse:
1. Window > Show View > Other... > Android/Devices
2. When the view is showing: View Menu of "Devices" > Reset adb | [Android Debug Bridge](http://developer.android.com/guide/developing/tools/adb.html)
====================================================================================
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:
* A client, which runs on your development machine. You can invoke a
client from a shell by issuing an adb command. Other Android tools
such as the ADT plugin and DDMS also create adb clients.
* A server, which runs as a background process on your development
machine. The server manages communication between the client and the
adb daemon running on an emulator or device.
* A daemon, which runs as a background process on each emulator or
device instance.
**Restarting ADB**
```
adb kill-server && adb start-server
```
By using above command, that'll restart the adb server. And, if you're using `Eclipse` means, please see the below image -

In your `DDMS` one option is there for restarting the adb like in above image. Hope this helps you. |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | ADB stands for **Android Debug Bridge**.
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.

In depth details can be found [here](http://opensourceforgeeks.blogspot.in/2013/12/android-debug-bridge-adb.html).
As for restarting adb server you can execute following commands
```
adb kill-server
adb start-server
```
As for Eclipse simply close the IDE and restart/reopen. Infact restarting Eclipse should restart adb server as well.
PS: Above link goes to my personal blog that has additional details on ADB. | i also came across with this problem, i got this error **please ensure that adb is correctly located “Users/semihozkoroglu/ADT/sdk/platform-tools/adb” and can be executed**
Click devices dropdown - > reset adb, its works..
 |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | adb is [Android Debug Bridge](http://developer.android.com/guide/developing/tools/adb.html).
To restart adb by command line:
```
adb kill-server
adb start-server
```
To restart adb in Eclipse:
1. Window > Show View > Other... > Android/Devices
2. When the view is showing: View Menu of "Devices" > Reset adb | ADB stands for **Android Debug Bridge**.
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.

In depth details can be found [here](http://opensourceforgeeks.blogspot.in/2013/12/android-debug-bridge-adb.html).
As for restarting adb server you can execute following commands
```
adb kill-server
adb start-server
```
As for Eclipse simply close the IDE and restart/reopen. Infact restarting Eclipse should restart adb server as well.
PS: Above link goes to my personal blog that has additional details on ADB. |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | adb is [Android Debug Bridge](http://developer.android.com/guide/developing/tools/adb.html).
To restart adb by command line:
```
adb kill-server
adb start-server
```
To restart adb in Eclipse:
1. Window > Show View > Other... > Android/Devices
2. When the view is showing: View Menu of "Devices" > Reset adb | i also came across with this problem, i got this error **please ensure that adb is correctly located “Users/semihozkoroglu/ADT/sdk/platform-tools/adb” and can be executed**
Click devices dropdown - > reset adb, its works..
 |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | adb is [Android Debug Bridge](http://developer.android.com/guide/developing/tools/adb.html).
To restart adb by command line:
```
adb kill-server
adb start-server
```
To restart adb in Eclipse:
1. Window > Show View > Other... > Android/Devices
2. When the view is showing: View Menu of "Devices" > Reset adb | ADB is a Android Debug Bridge.
Following for more Details ADB
<http://www.addictivetips.com/mobile/what-is-adb-and-how-to-install-it-android/>
<http://developer.android.com/guide/developing/tools/adb.html>
Close And Open Eclipse,Adb is automatically restarted..!
Thanks..! |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | i also came across with this problem, i got this error **please ensure that adb is correctly located “Users/semihozkoroglu/ADT/sdk/platform-tools/adb” and can be executed**
Click devices dropdown - > reset adb, its works..
 | ADB is a Android Debug Bridge.
Following for more Details ADB
<http://www.addictivetips.com/mobile/what-is-adb-and-how-to-install-it-android/>
<http://developer.android.com/guide/developing/tools/adb.html>
Close And Open Eclipse,Adb is automatically restarted..!
Thanks..! |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | adb is [Android Debug Bridge](http://developer.android.com/guide/developing/tools/adb.html).
To restart adb by command line:
```
adb kill-server
adb start-server
```
To restart adb in Eclipse:
1. Window > Show View > Other... > Android/Devices
2. When the view is showing: View Menu of "Devices" > Reset adb | I saw this problem on Eclipse, and it reported that I needed to 'reset adb from the Device's view'. The adb kill&restart-server sequence didn't work for me, **but I was successful with just disabling and then re-enabling the 'USB debugging' check box in the phone's Settings->Developer Options** |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | ADB stands for **Android Debug Bridge**.
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device.

In depth details can be found [here](http://opensourceforgeeks.blogspot.in/2013/12/android-debug-bridge-adb.html).
As for restarting adb server you can execute following commands
```
adb kill-server
adb start-server
```
As for Eclipse simply close the IDE and restart/reopen. Infact restarting Eclipse should restart adb server as well.
PS: Above link goes to my personal blog that has additional details on ADB. | ADB is a Android Debug Bridge.
Following for more Details ADB
<http://www.addictivetips.com/mobile/what-is-adb-and-how-to-install-it-android/>
<http://developer.android.com/guide/developing/tools/adb.html>
Close And Open Eclipse,Adb is automatically restarted..!
Thanks..! |
10,223,065 | I get the following errors when I try to run my Android program.
Please explain me What really `adb` is, and how to restart it?
I am getting the following error
```
The connection to adb is down, and a severe error has occured.
You must restart adb and Eclipse.
``` | 2012/04/19 | [
"https://Stackoverflow.com/questions/10223065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/475247/"
] | [Android Debug Bridge](http://developer.android.com/guide/developing/tools/adb.html)
====================================================================================
Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:
* A client, which runs on your development machine. You can invoke a
client from a shell by issuing an adb command. Other Android tools
such as the ADT plugin and DDMS also create adb clients.
* A server, which runs as a background process on your development
machine. The server manages communication between the client and the
adb daemon running on an emulator or device.
* A daemon, which runs as a background process on each emulator or
device instance.
**Restarting ADB**
```
adb kill-server && adb start-server
```
By using above command, that'll restart the adb server. And, if you're using `Eclipse` means, please see the below image -

In your `DDMS` one option is there for restarting the adb like in above image. Hope this helps you. | I saw this problem on Eclipse, and it reported that I needed to 'reset adb from the Device's view'. The adb kill&restart-server sequence didn't work for me, **but I was successful with just disabling and then re-enabling the 'USB debugging' check box in the phone's Settings->Developer Options** |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Maybe the [direct package download for `libsystemd-journal0`](http://packages.ubuntu.com/trusty/libsystemd-journal0) can help you.
You can download certain deb file then install it using `dpkg` command, but there may still be some dependency problems. So you'd better modify your `/etc/apt/source.list` file according to this [page](http://packages.ubuntu.com/trusty/amd64/libsystemd-journal0/download)(if you need a 64-bit version).
As for `libsystemd-journal0` you can add the following line after the tail of `/etc/apt/sources.list`:
```
deb http://cz.archive.ubuntu.com/ubuntu trusty main
```
then
```
sudo apt-get update
```
I guess other dependency problems can be solved in a similar way. | Add backports to your apt repo :
"deb <http://ftp.de.debian.org/debian> wheezy-backports main"
and perform a :
```
sudo apt-get update
```
Afterwards,
```
sudo apt-get install docker-engine
```
should complete fine. |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Clean up the invalid package repository:
```
cd ../../etc/apt/sources.list.d
sudo rm docker.list
```
Then add the repository and update:
```
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
sudo apt-get install docker-engine
``` | Add backports to your apt repo :
"deb <http://ftp.de.debian.org/debian> wheezy-backports main"
and perform a :
```
sudo apt-get update
```
Afterwards,
```
sudo apt-get install docker-engine
```
should complete fine. |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Update the repos in sourcelist file and run `apt-get update` that will fix the issue,
deb <https://packages.docker.com/1.12/apt/repo/> ubuntu-xenial main
deb <http://apt.dockerproject.org/repo/> ubuntu-trusty main | Add backports to your apt repo :
"deb <http://ftp.de.debian.org/debian> wheezy-backports main"
and perform a :
```
sudo apt-get update
```
Afterwards,
```
sudo apt-get install docker-engine
```
should complete fine. |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | idk if this works but try this:
```
sudo apt update
```
and,
```
sudo apt-get update
```
then,
```
sudo apt install docker.io
```
Enter your sudo password whenever prompted/required or better login in as root.
I've tried this when i was installing docker in my linux distro. (kali).
Hope this works for you too...
[also try updating your linux distro] | Add backports to your apt repo :
"deb <http://ftp.de.debian.org/debian> wheezy-backports main"
and perform a :
```
sudo apt-get update
```
Afterwards,
```
sudo apt-get install docker-engine
```
should complete fine. |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Clean up the invalid package repository:
```
cd ../../etc/apt/sources.list.d
sudo rm docker.list
```
Then add the repository and update:
```
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
sudo apt-get install docker-engine
``` | Maybe the [direct package download for `libsystemd-journal0`](http://packages.ubuntu.com/trusty/libsystemd-journal0) can help you.
You can download certain deb file then install it using `dpkg` command, but there may still be some dependency problems. So you'd better modify your `/etc/apt/source.list` file according to this [page](http://packages.ubuntu.com/trusty/amd64/libsystemd-journal0/download)(if you need a 64-bit version).
As for `libsystemd-journal0` you can add the following line after the tail of `/etc/apt/sources.list`:
```
deb http://cz.archive.ubuntu.com/ubuntu trusty main
```
then
```
sudo apt-get update
```
I guess other dependency problems can be solved in a similar way. |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Maybe the [direct package download for `libsystemd-journal0`](http://packages.ubuntu.com/trusty/libsystemd-journal0) can help you.
You can download certain deb file then install it using `dpkg` command, but there may still be some dependency problems. So you'd better modify your `/etc/apt/source.list` file according to this [page](http://packages.ubuntu.com/trusty/amd64/libsystemd-journal0/download)(if you need a 64-bit version).
As for `libsystemd-journal0` you can add the following line after the tail of `/etc/apt/sources.list`:
```
deb http://cz.archive.ubuntu.com/ubuntu trusty main
```
then
```
sudo apt-get update
```
I guess other dependency problems can be solved in a similar way. | Update the repos in sourcelist file and run `apt-get update` that will fix the issue,
deb <https://packages.docker.com/1.12/apt/repo/> ubuntu-xenial main
deb <http://apt.dockerproject.org/repo/> ubuntu-trusty main |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Maybe the [direct package download for `libsystemd-journal0`](http://packages.ubuntu.com/trusty/libsystemd-journal0) can help you.
You can download certain deb file then install it using `dpkg` command, but there may still be some dependency problems. So you'd better modify your `/etc/apt/source.list` file according to this [page](http://packages.ubuntu.com/trusty/amd64/libsystemd-journal0/download)(if you need a 64-bit version).
As for `libsystemd-journal0` you can add the following line after the tail of `/etc/apt/sources.list`:
```
deb http://cz.archive.ubuntu.com/ubuntu trusty main
```
then
```
sudo apt-get update
```
I guess other dependency problems can be solved in a similar way. | idk if this works but try this:
```
sudo apt update
```
and,
```
sudo apt-get update
```
then,
```
sudo apt install docker.io
```
Enter your sudo password whenever prompted/required or better login in as root.
I've tried this when i was installing docker in my linux distro. (kali).
Hope this works for you too...
[also try updating your linux distro] |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Clean up the invalid package repository:
```
cd ../../etc/apt/sources.list.d
sudo rm docker.list
```
Then add the repository and update:
```
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
sudo apt-get install docker-engine
``` | Update the repos in sourcelist file and run `apt-get update` that will fix the issue,
deb <https://packages.docker.com/1.12/apt/repo/> ubuntu-xenial main
deb <http://apt.dockerproject.org/repo/> ubuntu-trusty main |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | Clean up the invalid package repository:
```
cd ../../etc/apt/sources.list.d
sudo rm docker.list
```
Then add the repository and update:
```
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get update
sudo apt-get install docker-engine
``` | idk if this works but try this:
```
sudo apt update
```
and,
```
sudo apt-get update
```
then,
```
sudo apt install docker.io
```
Enter your sudo password whenever prompted/required or better login in as root.
I've tried this when i was installing docker in my linux distro. (kali).
Hope this works for you too...
[also try updating your linux distro] |
39,403,497 | I am trying to do hyperledger fabric(setting up the environment) and it required docker. I tried searching the internet of solving to install docker but it was to no avail. The following is the errors encountered when I tried to install dockers.
At git bash(git) I tried to use `sudo apt-get install docker-engine`. But it says
```
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
Docker-engine: Depends: init-system-helpers (>= 1.13~) but it is not installable
Depends: sysv-rc (>= 2.88dsf-24) but 2.88dsf-13.10ubuntu11 is to be installed or
file-rc (>= 0.8.16) but it is not installable
Depends: libc6 (>= 2.17) but 2.15-0ubuntu10 is to be installed
Depends: libdevmapper1.02.1 (>= 2:1.02.63) but 2:1.02.48-4ubuntu7 is to be installed
Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not installable or
cgroup-lite but it is not going to be installed
Recommends: git but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
```
I have followed every single step of this website in installing docker:
<https://docs.docker.com/engine/installation/linux/ubuntulinux/>
This is the website I have tried to build hyperledger fabric (At the stage of building outside of vagrant, installing docker):
<http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/build/> | 2016/09/09 | [
"https://Stackoverflow.com/questions/39403497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6601784/"
] | idk if this works but try this:
```
sudo apt update
```
and,
```
sudo apt-get update
```
then,
```
sudo apt install docker.io
```
Enter your sudo password whenever prompted/required or better login in as root.
I've tried this when i was installing docker in my linux distro. (kali).
Hope this works for you too...
[also try updating your linux distro] | Update the repos in sourcelist file and run `apt-get update` that will fix the issue,
deb <https://packages.docker.com/1.12/apt/repo/> ubuntu-xenial main
deb <http://apt.dockerproject.org/repo/> ubuntu-trusty main |
3,526 | >
> You are smarter than me.
>
>
> You are smarter than I am.
>
>
>
Is there any difference between these two? One of my friends told me first sentence is wrong, but the second one is correct. But he could not explain me the reason. So is it true? Iff so, why? | 2013/03/06 | [
"https://ell.stackexchange.com/questions/3526",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/91/"
] | This used to be a contentious point in the world of English usage. But it's been decided in favor of agreeing that both are acceptable and idiomatic. "Than" can be used as a conjunction or a preposition. When used as a preposition, *[than](http://www.merriam-webster.com/dictionary/than)* takes an object, which can be a pronoun. If the pronoun is first person, it can be "me" because that's what most native speakers actually write and say. It used to be the case that educated native speakers would say "You are smarter than I" and just elide (delete) the "*am*". But those were the days when some people used "*whom*", as in "Whom did you give it to?" or "To whom did you give it?" Now almost everyone says "Who'd you give it to?" Almost nobody besides my 89-year-old stepmother (former English teacher) says "You are smarter than I", but some people do say "You are smarter **than I am**" (*than* is a conjunction here: "You are smarter than I am smart" is alleged to be the actual substructure of the sentence).
Your friend is merely repeating what the 18th- and 19th-century prescriptive grammarians of the [Lowth](http://en.wikipedia.org/wiki/Robert_Lowth) school laid down as the rules of grammar: that is, rules that told others to speak and write as they (the prescriptivists) thought they should. We ignore those guys now. They lied. And people still have headaches about what proper grammar is and worry about inessentials: specious rules instead of clarity, brevity, and ease of understanding, the hallmarks of good English (but not necessarily of goodness in other languages). | The Columbia Guide to Standard American English agrees with Bill Franke's answer.
In fact that guide reads:
>
> Than is both a subordinating conjunction, as in "She is wiser than I am", and a preposition, as in "She is wiser than me". Since the following verb **am** is often dropped or “understood,” we regularly hear *than I* and *than me*. Some commentators believe that the conjunction is currently more frequent than the preposition, but both are unquestionably Standard.
>
>
>
So, both constructions are acceptable in English language. |
46,796,231 | I have a text element in my window and I would like it be blink or appear and disappear for every few seconds or milli seconds.
My code is:
```
import QtQuick 2.6
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Text {
id: my_text
text: "Hello"
font.pixelSize: 30
}
}
``` | 2017/10/17 | [
"https://Stackoverflow.com/questions/46796231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7193815/"
] | The task is easily solved with a [`Timer`](http://doc.qt.io/qt-5/qml-qtqml-timer.html).
```
import QtQuick 2.6
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Text {
id: my_text
font.pixelSize: 30
text: "Hello"
}
Timer{
id: timer
interval: 1000
running: true
repeat: true
onTriggered: my_text.opacity = my_text.opacity === 0 ? 1 : 0
}
}
``` | Another solution using `OpacityAnimator`:
```
import QtQuick 2.6
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Text {
anchors.centerIn: parent
id: my_text
text: "Hello"
font.pixelSize: 30
OpacityAnimator {
target: my_text;
from: 0;
to: 1;
duration: 400;
loops: Animation.Infinite;
running: true;
easing {
type: Easing.InOutExpo;
}
}
}
}
``` |
49,226,031 | As for the Vala language cross-platform to know the bitness of the system? | 2018/03/11 | [
"https://Stackoverflow.com/questions/49226031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9058627/"
] | `sizeof(void*)` will be 8 for 64-bit systems and 4 for 32 bit systems. Also, 2 for 16 bit systems, but I don't even know that glib will work there. | The whole point of GLib is to avoid having to do platform specific code.
However according to you comment you want to do something like download platform specific packages.
First of all it would be better to use a system or user package manager to do that, since they already know how to achieve that ([DRY principle](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)).
If you absolutely must, you can also use tools like `lsb-release -a` or the more general `uname -a` (for the kernel and arch) or some other arguments to those tools.
You can invoke them with GLibs process spawning facilities.
See also:
[How to determine whether a given Linux is 32 bit or 64 bit?](https://stackoverflow.com/questions/246007/how-to-determine-whether-a-given-linux-is-32-bit-or-64-bit?rq=1)
And a related problem is OS detection:
[Is OS detection possible with GLib?](https://stackoverflow.com/questions/29634474/is-os-detection-possible-with-glib)
Also since Vala is a compiled language, you could use your favorite build system to pass something like `-DPlatformx64` or `-DPlatformx86` to the Vala compiler (see the above link on OS detection for an example on how to use the preprocessor in Vala code). |
29,626,617 | I am setting up a new dev server, and moving some old projects to this. I opened up one of the older web projects. Setup the publish settings to use Web Deploy just like I have done for many projects. However, on this one I am getting the following error when clicking the preview.
>
> Error 3 The "NormalizeServiceUrl" task was not given a value for the
> required parameter "ServiceUrl".
>
>
>
If I try to publish with out preview, I get an additional error.
>
> Web Deploy publish/package validating error: Missing or Invalid
> property value for $(MsDeployServiceUrl)
>
>
>
I have looked all over and cant find help on the "NormalizeServiceUrl" error. | 2015/04/14 | [
"https://Stackoverflow.com/questions/29626617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585103/"
] | I found a post about a similar problem. This led me to open the vbproj file. I looked at a project of ours that looked fine.
It had these 3 lines in the vbproj file.
```
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
```
My project with the issue only had
```
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
```
I added the other 2 lines and this issue was resolved. I hope this helps anyone that comes across this. | In case of incorrect import for VS 2019,
project line to fix:
```
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
```
fixed
```
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" />
``` |
29,626,617 | I am setting up a new dev server, and moving some old projects to this. I opened up one of the older web projects. Setup the publish settings to use Web Deploy just like I have done for many projects. However, on this one I am getting the following error when clicking the preview.
>
> Error 3 The "NormalizeServiceUrl" task was not given a value for the
> required parameter "ServiceUrl".
>
>
>
If I try to publish with out preview, I get an additional error.
>
> Web Deploy publish/package validating error: Missing or Invalid
> property value for $(MsDeployServiceUrl)
>
>
>
I have looked all over and cant find help on the "NormalizeServiceUrl" error. | 2015/04/14 | [
"https://Stackoverflow.com/questions/29626617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4585103/"
] | I also had this error in Visual Studio 2013. It looks like the project wasn't upgraded properly from VS 2010. I changed this line:
```
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
```
To (v10.0 => v12.0):
```
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v12.0\WebApplications\Microsoft.WebApplication.targets" />
``` | In case of incorrect import for VS 2019,
project line to fix:
```
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
```
fixed
```
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v16.0\WebApplications\Microsoft.WebApplication.targets" />
``` |
2,875,282 | I have a .NET solution containing following projects:
* web application (WAP)
* web deployment (WDP, .wdproj)
* wix setup (WIX, .wixproj)
In the WDP I've used a custom MSBuild task (SetEnvVar) to set some env. variables for further use in the build process. After setting them I can use them without prob.
in the WDP but in the WIX they are empty/undefined. The strange thing is that when I reference those env. vars in the WIX files (by using properties in .wxs or preproc vars in .wxi) I get the values as expected.
Do you have any idea why the env. vars get lost/are undefined in .wixproj?
By the way the (solution) build process is triggered from inside VS 2010.
**Update**
This is basically my task code:
```
Environment.SetEnvironmentVariable(this.Variable, this.Value);
```
Is a MSBuild solution build not one process?
Will MSBuild spawn a new process for every project in the solution? | 2010/05/20 | [
"https://Stackoverflow.com/questions/2875282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/346252/"
] | is it possible your SetEnvVar task sets the environment variables for a single process instead of globally (which it should do to be safe btw)? In that case, it's likely that the WIX thingie is started as a different process in some way, so with it's own private copy of the current global environment set. | Here are the significant parts of the project files:
**WDP (.wdproj)**
```
<Target Name="AfterBuild">
<SetEnvVar Variable="MAJOR" Value="$(MajorNumber)" />
<SetEnvVar Variable="MINOR" Value="$(MinorNumber)" />
<SetEnvVar Variable="REVISION" Value="$(RevisionNumber)" />
<SetEnvVar Variable="BUILD" Value="$(BuildNumber)" />
</Target>
```
**WIX (.wixproj)**
```
<Target Name="AfterBuild">
<Message Text="Major: $(MAJOR) Minor: $(MINOR) Revision: $(REVISION)" />
<Move SourceFiles=".\bin\$(Configuration)\$(OutputName).msi" DestinationFiles=".\bin\$(Configuration)\Product_$(MAJOR).$(MINOR).$(REVISION).msi" />
</Target>
```
The Message task's log output is **"Major: Minor: Revision: "** therefore
MAJOR, MINOR and REVISION vars are not availabe to the WIX project and for that the MSI package name is **Product\_...msi**.
The project build order is of course WAP -> WDP -> WIX. |
160,106 | Some Banished knowledge bases (I think the game for one) seem to imply that herbalist/gatherer likes old untouched forests to do their work, but a lot of people recommend a forester to keep a dense forest cover next to your gatherer/etc (The wiki says both of these things, I believe).
So which is it? Is a forester a bad thing to put next to a gatherer, or the absolute best thing? Maybe a Forester does more good than ill, but the optimum would be a completely dense untouched forest? | 2014/03/14 | [
"https://gaming.stackexchange.com/questions/160106",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/10308/"
] | **"Old Growth" versus "New Growth" is not an actual mechanic.** The only thing that matters for gatherers and herbalists are tree *density* (since this determines yields / spawnings of the smaller plants).
While I'm not certain on the absolute value of not having a cutting forester overlap a herbalist / gatherer, you definitely want to set up gathering spots in areas that have been planted / tended to by the forester, because forester's create a much denser copse than can be found on the initial map.
I'd wager your last paragraph has the right of it: a planting (but not cutting) forester + gatherer maximizes the gathering, while an active forester + gatherer maximizes total resources / map area. | A forester is not a bad thing at all, in fact you can set your forester to only Plant trees and not cut any down in order to provide the largest amount of "Mature" trees in the area, which will help you maximize the output from your Herbalist/Gatherers.
Personally I let my foresters run on Plant only until I have a nice dense forest for my Cluster to work from, after things stabalize I usually re-activate the Cut option to supplement my Lumber Supplies. |
424,464 | I am trying to develop an off grid solar monitoring system. In order to measure solar input current I am using a 50 A/75 mV shunt with an Adafruit ADS1115 (VDD=5 V).
However, when I connected A0, A1 of the ADS1115, I fried the IC. I have already fried two ADS1115 ICs.
I have attached my connection diagram for your reference.
[](https://i.stack.imgur.com/Btbad.jpg "Connection diagram") | 2019/02/26 | [
"https://electronics.stackexchange.com/questions/424464",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/193011/"
] | No, the whole needs to be compliant.
If device A is UL compliant and device B is UL compliant, it doesn't impy A+B UL compliant. It has to be tested/proved.
Moreover, if device A is UL compliant, but device B is **not** UL compliant, this doesn't imply A+B is **not** UL compliant. | The short answer as @Huisman said is yes, the cart will likely still need to be Listed (Listed is the correct term for approved, compliant etc. Not super important, but correct).
As you alluded to, there are exceptions based on the input power to the device. I don't know which standard golf carts are evaluated to, my experience is in Industrial Control Equipment. In ICE, for instance, devices which are powered by Class 2 power supples have most, if not all requirements waived:
From [Omron:](https://www.ia.omron.com/support/faq/answer/22/faq01907/)
>
> Furthermore, a benefit of using the power supplies that have received
> the Class 2 approval is that the output has the same Class 2 safety
> level. When applying for safety standards approval for the equipment,
> in some cases it is not necessary to obtain safety standard approval
> for the connected device (load) when the device (load) is connected to
> the output of a power supply that has received Class 2 approval.
>
>
>
From [CUI:](https://www.cui.com/blog/class-2-vs-class-ii-power-supplies)
>
> The limited output voltage and power delivery capabilities of Class 2
> power supplies are recognized to be of lower risk to fire initiation
> and causing electrical shocks, which allows for lower cost wiring
> methods to be employed.
>
>
>
In your case, the charger and battery will very likely require testing. Depending on what testing the battery has already undergone, you may be able to waive some or all testing "downstream" i.e. the rest of the cart. |
424,464 | I am trying to develop an off grid solar monitoring system. In order to measure solar input current I am using a 50 A/75 mV shunt with an Adafruit ADS1115 (VDD=5 V).
However, when I connected A0, A1 of the ADS1115, I fried the IC. I have already fried two ADS1115 ICs.
I have attached my connection diagram for your reference.
[](https://i.stack.imgur.com/Btbad.jpg "Connection diagram") | 2019/02/26 | [
"https://electronics.stackexchange.com/questions/424464",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/193011/"
] | UL does not approve anything. They publish standards, maintain a list of products that they have tested and/or evaluated to determine that they meet those and other applicable standards, and authorize products that have been listed to be marked with the UL label. In the USA, they are one of several nationally recognized testing laboratories (NRTLs) that provide a similar service. Other NRTLs evaluate products to UL standards, list the products and authorize their own label. In the USA, "approved" means acceptable to the authority having jurisdiction.
There appears to be a standard for information technology equipment (ITE) that allows it to be powered by a listed power supply designed for such equipment without requiring the ITE to be listed.
Golf Carts
In the USA, the standard for golf carts seems to be ANSI Z130.1. There may be NRTLs that will certify conformance with that or manufacturers may assert conformance based on their own evaluation. The standard seems to apply to all aspects of electric motor and engine driven carts. | No, the whole needs to be compliant.
If device A is UL compliant and device B is UL compliant, it doesn't impy A+B UL compliant. It has to be tested/proved.
Moreover, if device A is UL compliant, but device B is **not** UL compliant, this doesn't imply A+B is **not** UL compliant. |
424,464 | I am trying to develop an off grid solar monitoring system. In order to measure solar input current I am using a 50 A/75 mV shunt with an Adafruit ADS1115 (VDD=5 V).
However, when I connected A0, A1 of the ADS1115, I fried the IC. I have already fried two ADS1115 ICs.
I have attached my connection diagram for your reference.
[](https://i.stack.imgur.com/Btbad.jpg "Connection diagram") | 2019/02/26 | [
"https://electronics.stackexchange.com/questions/424464",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/193011/"
] | UL does not approve anything. They publish standards, maintain a list of products that they have tested and/or evaluated to determine that they meet those and other applicable standards, and authorize products that have been listed to be marked with the UL label. In the USA, they are one of several nationally recognized testing laboratories (NRTLs) that provide a similar service. Other NRTLs evaluate products to UL standards, list the products and authorize their own label. In the USA, "approved" means acceptable to the authority having jurisdiction.
There appears to be a standard for information technology equipment (ITE) that allows it to be powered by a listed power supply designed for such equipment without requiring the ITE to be listed.
Golf Carts
In the USA, the standard for golf carts seems to be ANSI Z130.1. There may be NRTLs that will certify conformance with that or manufacturers may assert conformance based on their own evaluation. The standard seems to apply to all aspects of electric motor and engine driven carts. | The short answer as @Huisman said is yes, the cart will likely still need to be Listed (Listed is the correct term for approved, compliant etc. Not super important, but correct).
As you alluded to, there are exceptions based on the input power to the device. I don't know which standard golf carts are evaluated to, my experience is in Industrial Control Equipment. In ICE, for instance, devices which are powered by Class 2 power supples have most, if not all requirements waived:
From [Omron:](https://www.ia.omron.com/support/faq/answer/22/faq01907/)
>
> Furthermore, a benefit of using the power supplies that have received
> the Class 2 approval is that the output has the same Class 2 safety
> level. When applying for safety standards approval for the equipment,
> in some cases it is not necessary to obtain safety standard approval
> for the connected device (load) when the device (load) is connected to
> the output of a power supply that has received Class 2 approval.
>
>
>
From [CUI:](https://www.cui.com/blog/class-2-vs-class-ii-power-supplies)
>
> The limited output voltage and power delivery capabilities of Class 2
> power supplies are recognized to be of lower risk to fire initiation
> and causing electrical shocks, which allows for lower cost wiring
> methods to be employed.
>
>
>
In your case, the charger and battery will very likely require testing. Depending on what testing the battery has already undergone, you may be able to waive some or all testing "downstream" i.e. the rest of the cart. |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | Had same problem few days ago. Try to change spring-boot-starter-parent version to 2.1.3.RELEASE, thats resolved my problem. | I had this error happen in a Spring Boot project where I added a custom dependency that made use of Spring (not Spring Boot). The issue in my custom dependency was that it had the following plugin configuration:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.example.Main</mainClass>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>Vendor Name, ${timestamp}</Implementation-Vendor>
</manifestEntries>
</transformer>
</transformers>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
```
Once I removed the shade plugin from my custom dependency, the error disappeared. |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | from [spring-projects-github](https://github.com/spring-projects/spring-boot/issues/18190)
" proxyBeanMethods is new in 5.2 and I can see 5.1.2.RELEASE in some elements of the stack."
do a dependency:tree and double check that spring match >= 5.2, I had a similar issue and one library brought 5.1 overriding v5.2 from springboot | Had same problem few days ago. Try to change spring-boot-starter-parent version to 2.1.3.RELEASE, thats resolved my problem. |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | Had same problem few days ago. Try to change spring-boot-starter-parent version to 2.1.3.RELEASE, thats resolved my problem. | I removed the following dependency
```
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
```
And the code was up like magic |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | Had same problem few days ago. Try to change spring-boot-starter-parent version to 2.1.3.RELEASE, thats resolved my problem. | use this in your main springboot application class :@SpringBootApplication(proxyBeanMethods = false)
this will work . |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | from [spring-projects-github](https://github.com/spring-projects/spring-boot/issues/18190)
" proxyBeanMethods is new in 5.2 and I can see 5.1.2.RELEASE in some elements of the stack."
do a dependency:tree and double check that spring match >= 5.2, I had a similar issue and one library brought 5.1 overriding v5.2 from springboot | I had this error happen in a Spring Boot project where I added a custom dependency that made use of Spring (not Spring Boot). The issue in my custom dependency was that it had the following plugin configuration:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.example.Main</mainClass>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>Vendor Name, ${timestamp}</Implementation-Vendor>
</manifestEntries>
</transformer>
</transformers>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
```
Once I removed the shade plugin from my custom dependency, the error disappeared. |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | use this in your main springboot application class :@SpringBootApplication(proxyBeanMethods = false)
this will work . | I had this error happen in a Spring Boot project where I added a custom dependency that made use of Spring (not Spring Boot). The issue in my custom dependency was that it had the following plugin configuration:
```
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.example.Main</mainClass>
<manifestEntries>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>Vendor Name, ${timestamp}</Implementation-Vendor>
</manifestEntries>
</transformer>
</transformers>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
</execution>
</executions>
</plugin>
```
Once I removed the shade plugin from my custom dependency, the error disappeared. |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | from [spring-projects-github](https://github.com/spring-projects/spring-boot/issues/18190)
" proxyBeanMethods is new in 5.2 and I can see 5.1.2.RELEASE in some elements of the stack."
do a dependency:tree and double check that spring match >= 5.2, I had a similar issue and one library brought 5.1 overriding v5.2 from springboot | I removed the following dependency
```
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
```
And the code was up like magic |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | from [spring-projects-github](https://github.com/spring-projects/spring-boot/issues/18190)
" proxyBeanMethods is new in 5.2 and I can see 5.1.2.RELEASE in some elements of the stack."
do a dependency:tree and double check that spring match >= 5.2, I had a similar issue and one library brought 5.1 overriding v5.2 from springboot | use this in your main springboot application class :@SpringBootApplication(proxyBeanMethods = false)
this will work . |
55,293,320 | I am trying to run my first springboot application but facing some issues.
In my application file, this is my code
```
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
```
but when i run my application, i get the following error. confused as to why i should get this error and how to solve it.
>
> org.springframework.core.annotation.AnnotationConfigurationException:
> Attribute 'proxyBeanMethods' in annotation
> [org.springframework.boot.autoconfigure.SpringBootApplication] is
> declared as an @AliasFor nonexistent attribute 'proxyBeanMethods' in
> annotation [org.springframework.context.annotation.Configuration].;
> nested exception is java.lang.NoSuchMethodException:
> org.springframework.context.annotation.Configuration.proxyBeanMethods()
>
>
>
This is my pom.xml file
```
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
```
Does anyone have an idea of how to fix this issue?
Thanks | 2019/03/22 | [
"https://Stackoverflow.com/questions/55293320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2809686/"
] | use this in your main springboot application class :@SpringBootApplication(proxyBeanMethods = false)
this will work . | I removed the following dependency
```
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
```
And the code was up like magic |
136,429 | How do you increase Cache size? think QGIS is falling-over as haven't given it enough...
image to export 1080 x 800 mm!
Would like at least 120 dpi or 200 : ) | 2015/02/23 | [
"https://gis.stackexchange.com/questions/136429",
"https://gis.stackexchange.com",
"https://gis.stackexchange.com/users/47940/"
] | There is no rendering cache in that sense. QGIS will use all the RAM memory that it can. The only limit might be if you're on a 32bit Windows. Then QGIS will only be able to use 4GB RAM. | Not sure I understand about the cache issue but you can set the **export resolution** if that's what you mean:
 |
38,907,297 | I have 2 tables:
```
original {ID, FirstName, LastName}
and
dummy {ID(NULL), FirstName, LastName}
```
I have to insert into t2.ID the original.ID but only if the FirstName and LastName from both tables are the same. Now, i've tried:
1.Error Code: 1054. Unknown column 't2.FirstName' in 'where clause'
```
INSERT INTO dummy (ID)
SELECT ID
FROM original
WHERE dummy.FirstName = original.FirstName
AND dummy.LastName = original.LastName;
```
2.Error Code: 1054. Unknown column 'original.FirstName' in 'where clause'
```
UPDATE dummy
SET ID = original.ID
WHERE dummy.FirstName=original.FirstName
AND dummy.LastName= original.LastName;
```
3.Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.
NOTE: I have to find a way without disableing safe mode.
```
UPDATE dummy
JOIN original
ON original.FirstName = dummy.FirstName
AND original.LastName = dummy.LastName
SET dummy.IDPacient = original.ID
WHERE original.ID <> 0;
```
Now if someone could help me understand what i did wrong in each of these 3 cases and/or give me a better solution, i would much appreciate the help. | 2016/08/11 | [
"https://Stackoverflow.com/questions/38907297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716136/"
] | Version 1 is just plain wrong - you'll insert a new row, not update the existing row.
Version 2 is close, you just need a join to "original":
```
UPDATE dummy
SET ID = original.ID
FROM dummy
INNER JOIN original
ON dummy.FirstName =original.FirstName
AND dummy.LastName = original.LastName;
``` | You need to perform a join on first and last name between the "original" and "dummy" tables and then update the ID
Try this..
```
Update a
Set a.ID = b.ID
From dummy a
Join original b
On a.firstname = b.firstname
And b.lastname = b.firstname
```
You were trying to filter based on columns in the "original" table but it wasn't included in a from clause in your query.
This link might also have some more useful info for you if you need it.
[SQL update query using joins](https://stackoverflow.com/questions/982919/sql-update-query-using-joins) |
68,002,130 | I'm trying to show list from `GraphQl` and my query is working and getting data in future but `AsyncSnapshot` showing always null.
I debugged the code and every value is coming without any exception.
This is my `FutureBuilder` to load list
```
Expanded(
child: FutureBuilder<InventoryListData>(
future: getInventory(),
builder: (context, AsyncSnapshot<InventoryListData> snapshot) {
Log.e('VECHILE hasData', 'LOG-------:::${snapshot}');
if (snapshot.hasData) {
return buildList(snapshot);
} else if(snapshot.hasError) {
return Container(
child: Center(
child: Text(
snapshot.error.toString(),
style: TextStyle(
fontFamily: 'regular',
fontSize: 18,
color: Colors.black),
)));
}
return progressBar();
},
),
```
This is my method to getdata in future.
```
Future<InventoryListData> getInventory() async {
GraphQLClient _client =
graphQLConfiguration.clientToQuery(GraphQlConstant.INVENTORY);
await _client
.mutate(MutationOptions(
document: gql(
addMutation.getInventory(idToken),
),
)).then((result) {
if (!result.hasException) {
try {
var response = InventoryListData.fromJson(result.data);
Log.e('', 'LOG-------:::${response.vehicles.length}');
return response;
} catch (e) {
Log.e('EXCEPTION', 'LOG-------:::${e}');
}
} else {
Fluttertoast.showToast(
msg: '${result.exception}',
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
fontSize: 18.0);
}
});
}
```
My response on Insomnia
[](https://i.stack.imgur.com/n4Mkq.png)
My fetch data method calling inside `initState` instead of direct calling `getInventory()` method inside `FutureBuilder`.
```
void _fetchSession() async {
try {
CognitoAuthSession res = await Amplify.Auth.fetchAuthSession(
options: CognitoSessionOptions(getAWSCredentials: true));
idToken = res.userPoolTokens.idToken;
NetworkCheck.checkConnection(context).then((onValue) {
if (onValue) {
//request = apiProvider.inventoryListService(idToken,WebConstant.INVENTORY_LIST);
//request = apiProvider.inventoryListService(idToken,WebConstant.INVENTORY_LIST);
request=getInventory();
setState(() {
request;
});
}
});
} on AuthException catch (e) {
print(e.message);
}
}
```
No error is showing
>
> AsyncSnapshot(ConnectionState.done, null, null,
> null)
>
>
> | 2021/06/16 | [
"https://Stackoverflow.com/questions/68002130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7357920/"
] | You should assign **getInventory**() to variable in **initstate**
```
var data;
initState() {
// at the beginning, all users are shown
data = getInventory();
super.initState();
}
```
And then use **StreamBuilder** instead of future
```
Expanded(
child: StreamBuilder<InventoryListData>(
stream: data.asStream()!=null?data.asStream():getInventory().asStream(),
builder: (context, snapshot) {
Log.e('VECHILE hasData', 'LOG-------:::${snapshot}');
if (snapshot.hasData) {
return buildList(snapshot);
} else if(snapshot.hasError) {
return Container(
child: Center(
child: Text(
snapshot.error.toString(),
style: TextStyle(
fontFamily: 'regular',
fontSize: 18,
color: Colors.black),
)));
}
return progressBar();
},
),
``` | The problem is that every time you call `getInventory()` it's creating a new `Future`, so with every rebuild you start fetching again.
Take a look at the [documentation](https://api.flutter.dev/flutter/widgets/FutureBuilder-class.html) for the `FutureBuilder` class:
>
> The future must have been obtained earlier, e.g. during State.initState, State.didUpdateWidget, or State.didChangeDependencies. It must not be created during the State.build or StatelessWidget.build method call when constructing the FutureBuilder. If the future is created at the same time as the FutureBuilder, then every time the FutureBuilder's parent is rebuilt, the asynchronous task will be restarted.
>
>
> |
5,334,589 | I have a vector class that has it's `Equals(object obj)` method overridden so that I can compare them.
```
public class Vector3f
{
public float x,y,z;
public Vector3f(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
public static Vector3f operator +(Vector3f a, Vector3f b) {
return new Vector3f(a.x + b.x, a.y + b.y, a.z + b.z);
}
public static Vector3f operator -(Vector3f a, Vector3f b) {
return new Vector3f(a.x - b.x, a.y - b.y, a.z - b.z);
}
public override bool Equals(object obj)
{
Vector3f other = (Vector3f)obj;
return x == other.x && y == other.y && z == other.z;
}
public override string ToString()
{
return String.Format("<{0},{1},{2}>",x,y,z);
}
}
```
The plus operator works as expected in my unit tests. However, when I subtract two vectors it says they are not equal
```
Test 'RTTests.Testies.vector_subtraction_works' failed:
Expected: <<1.1,0.1,0.1>>
But was: <<1.1,0.1,0.1>>
Testies.cs(60,0): at RTTests.Testies.vector_sub_works()
```
I'm not sure why the comparison is working for addition and not subtraction especially since the output values are identical in both cases?
EDIT: My tests for this
```
[Test]
public void vector_addition_works()
{
Vector3f v1 = new Vector3f(1.0f, 1.0f, 1.0f);
Vector3f v2 = new Vector3f(1.6f, 3.2f, 4.7f);
Vector3f expected = new Vector3f(2.6f, 4.2f, 5.7f);
Vector3f actual = v1 + v2;
Assert.AreEqual(actual, expected);
}
[Test]
public void vector_sub_works()
{
Vector3f v1 = new Vector3f(1.1f, 1.1f, 1.1f);
Vector3f v2 = new Vector3f(0.0f, 1.0f, 1.0f);
Vector3f expected = new Vector3f(1.1f, 0.1f, 0.1f);
Vector3f actual = v1 - v2;
Assert.AreEqual(actual, expected);
}
``` | 2011/03/17 | [
"https://Stackoverflow.com/questions/5334589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186359/"
] | Your problem must be a rounding/truncation error. It happens all the time with floating point operations, specially subtraction. When you test for equality, instead of a==b, use a-b < SmallConstant. You could also try using double precision or Decimal, although truncation errors will eventually return, but you might make them less common. | You are probably seeing the problem because you are using floats. Floats by their nature are not precise. Unless you need to use float for some reason, I would change my class to use Decimals instead.
Hope this helps. |
5,334,589 | I have a vector class that has it's `Equals(object obj)` method overridden so that I can compare them.
```
public class Vector3f
{
public float x,y,z;
public Vector3f(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
public static Vector3f operator +(Vector3f a, Vector3f b) {
return new Vector3f(a.x + b.x, a.y + b.y, a.z + b.z);
}
public static Vector3f operator -(Vector3f a, Vector3f b) {
return new Vector3f(a.x - b.x, a.y - b.y, a.z - b.z);
}
public override bool Equals(object obj)
{
Vector3f other = (Vector3f)obj;
return x == other.x && y == other.y && z == other.z;
}
public override string ToString()
{
return String.Format("<{0},{1},{2}>",x,y,z);
}
}
```
The plus operator works as expected in my unit tests. However, when I subtract two vectors it says they are not equal
```
Test 'RTTests.Testies.vector_subtraction_works' failed:
Expected: <<1.1,0.1,0.1>>
But was: <<1.1,0.1,0.1>>
Testies.cs(60,0): at RTTests.Testies.vector_sub_works()
```
I'm not sure why the comparison is working for addition and not subtraction especially since the output values are identical in both cases?
EDIT: My tests for this
```
[Test]
public void vector_addition_works()
{
Vector3f v1 = new Vector3f(1.0f, 1.0f, 1.0f);
Vector3f v2 = new Vector3f(1.6f, 3.2f, 4.7f);
Vector3f expected = new Vector3f(2.6f, 4.2f, 5.7f);
Vector3f actual = v1 + v2;
Assert.AreEqual(actual, expected);
}
[Test]
public void vector_sub_works()
{
Vector3f v1 = new Vector3f(1.1f, 1.1f, 1.1f);
Vector3f v2 = new Vector3f(0.0f, 1.0f, 1.0f);
Vector3f expected = new Vector3f(1.1f, 0.1f, 0.1f);
Vector3f actual = v1 - v2;
Assert.AreEqual(actual, expected);
}
``` | 2011/03/17 | [
"https://Stackoverflow.com/questions/5334589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186359/"
] | Your problem must be a rounding/truncation error. It happens all the time with floating point operations, specially subtraction. When you test for equality, instead of a==b, use a-b < SmallConstant. You could also try using double precision or Decimal, although truncation errors will eventually return, but you might make them less common. | If you debug the app you will see the following:
1.1f - 1.0f = 0.100000024
0.1 can't be represented in binary exactly. It would be like trying to write out 1/3 in base 10 exactly, you cant do it because [it goes on forever](http://docs.python.org/tutorial/floatingpoint.html). [There is another similar question](https://stackoverflow.com/questions/3495237/c-net-double-issue-6-8-6-8) that explains this and links to some code to print out what the actual value of the float is |
5,334,589 | I have a vector class that has it's `Equals(object obj)` method overridden so that I can compare them.
```
public class Vector3f
{
public float x,y,z;
public Vector3f(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
public static Vector3f operator +(Vector3f a, Vector3f b) {
return new Vector3f(a.x + b.x, a.y + b.y, a.z + b.z);
}
public static Vector3f operator -(Vector3f a, Vector3f b) {
return new Vector3f(a.x - b.x, a.y - b.y, a.z - b.z);
}
public override bool Equals(object obj)
{
Vector3f other = (Vector3f)obj;
return x == other.x && y == other.y && z == other.z;
}
public override string ToString()
{
return String.Format("<{0},{1},{2}>",x,y,z);
}
}
```
The plus operator works as expected in my unit tests. However, when I subtract two vectors it says they are not equal
```
Test 'RTTests.Testies.vector_subtraction_works' failed:
Expected: <<1.1,0.1,0.1>>
But was: <<1.1,0.1,0.1>>
Testies.cs(60,0): at RTTests.Testies.vector_sub_works()
```
I'm not sure why the comparison is working for addition and not subtraction especially since the output values are identical in both cases?
EDIT: My tests for this
```
[Test]
public void vector_addition_works()
{
Vector3f v1 = new Vector3f(1.0f, 1.0f, 1.0f);
Vector3f v2 = new Vector3f(1.6f, 3.2f, 4.7f);
Vector3f expected = new Vector3f(2.6f, 4.2f, 5.7f);
Vector3f actual = v1 + v2;
Assert.AreEqual(actual, expected);
}
[Test]
public void vector_sub_works()
{
Vector3f v1 = new Vector3f(1.1f, 1.1f, 1.1f);
Vector3f v2 = new Vector3f(0.0f, 1.0f, 1.0f);
Vector3f expected = new Vector3f(1.1f, 0.1f, 0.1f);
Vector3f actual = v1 - v2;
Assert.AreEqual(actual, expected);
}
``` | 2011/03/17 | [
"https://Stackoverflow.com/questions/5334589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/186359/"
] | If you debug the app you will see the following:
1.1f - 1.0f = 0.100000024
0.1 can't be represented in binary exactly. It would be like trying to write out 1/3 in base 10 exactly, you cant do it because [it goes on forever](http://docs.python.org/tutorial/floatingpoint.html). [There is another similar question](https://stackoverflow.com/questions/3495237/c-net-double-issue-6-8-6-8) that explains this and links to some code to print out what the actual value of the float is | You are probably seeing the problem because you are using floats. Floats by their nature are not precise. Unless you need to use float for some reason, I would change my class to use Decimals instead.
Hope this helps. |
390,954 | If $u,v,w$ and $z$ are distinct elements in $R$, then
{$(1,u,u^2,u^3), (1,v,v^2,v^3), (1,w,w^2,w^3), (1,z,z^2,z^3)$} is a linearly independent subset of $R^4$.
Is that true or false?
I even can't start the first step.. | 2013/05/14 | [
"https://math.stackexchange.com/questions/390954",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/73517/"
] | I make multiple use of the rule: $\log\_a x=b\implies a^b=x$
The first problem is already addressed in one of the other answers, but when you see $\log\_{3x}(81)=2$, you should think $(3x)^2=9x^2=81\implies x=3$
As for the second problem, since $4^2=16$, we know that $\log\_4 16=2$ and we can make the following simplification:
$$\log\_3(\log\_x(\log\_4 16))=-1\\
\log\_3(\log\_x(2))=-1$$
Now, if we think of $\log\_x(2)$ as a variable, call it $y$, we can rewrite the above equality like so:
$$\log\_3 y=-1\\
y=3^{-1}=\frac{1}{3}$$
Now that we have a value for $y$, lets put it back in context:
$$y=\log\_x(2)=\frac{1}{3}\\
x^{\frac{1}{3}}=2\\
x=8
$$ | $$\log\_{3x}(81)=2$$
$$(3x)^{\log\_{3x}(81)}=(3x)^{2}$$
$$81=9x^2$$
$$9=x^2$$
$$3=x$$ |
70,801,758 | I have created a project that when the page opens, it asks the user to accept his location. When the user accepts, a google maps window opens, displaying the user's current location as well as the coordinates:
[](https://i.stack.imgur.com/5WyQ6.png)
I want the coordinates to be displayed in an html table next to the google maps window, something similar or the same as this below:
[](https://i.stack.imgur.com/Y85r9.png)
How can I achieve this? I am a begginer in javascript and I need help.
Thank you!!!
*I will post my javascript code in case it's needed:*
```js
// SHOW COORDINATES
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (p) {
var LatLng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude);
var mapOptions = {
center: LatLng,
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
var marker = new google.maps.Marker({
position: LatLng,
map: map,
title: "<div style = 'height:60px;width:200px'><b>Your location:</b><br />Latitude: " + p.coords.latitude + "<br />Longitude: " + p.coords.longitude
});
google.maps.event.addListener(marker, "click", function (e) {
var infoWindow = new google.maps.InfoWindow();
infoWindow.setContent(marker.title);
infoWindow.open(map, marker);
});
});
} else {
alert('Geo Location feature is not supported in this browser.');
}
``` | 2022/01/21 | [
"https://Stackoverflow.com/questions/70801758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17427411/"
] | [`/#{1,6}.+(?=\n)/g`](https://regex101.com/r/n6XQub/1)
* `#{1,6}` ... matches the character `#` at least once or as sequence of maximum 6 equal characters.
* `.+` matches any character (except for line terminators) at least once and as many times as possible (greedy)
* does so until the [*positive lookahead*](https://javascript.info/regexp-lookahead-lookbehind#lookahead) `(?=\n)` matches ...
+ which is ... `\n` ... a newline / line-feed.
* uses the `g`lobal modifier which does match everything.
**Edit**
Having mentioned
>
> *"matches any character (except for line terminators)"*
>
>
>
thus a regex like ... [`/#{1,6}.+/g`](https://regex101.com/r/n6XQub/2) ... should already do the job (no need for a positive lookahead) for the OP's use case which is ...
>
> *"Headers in markdown start with a # (there can be from 1-6), **and in my case always end with a new line.**"*
>
>
>
>
> **The result that I am looking for would be: `["# Clean-er ReactJS Code - Conditional Rendering", "## TL;DR", "## Introduction"]`.**
>
>
>
```js
const testString = `\n# Clean-er ReactJS Code - Conditional Rendering\n\n## TL;DR\n\nMove render conditions into appropriately named variables. Abstract the condition logic into a function. This makes the render function code a lot easier to understand, refactor, reuse, test, and think about.\n\n## Introduction\n\nConditional rendering is when a logical operator determines what will be rendered. The following code is from the examples in the official ReactJS documentation. It is one of the simplest examples of conditional rendering that I can think of.\n\n`;
// see...[https://regex101.com/r/n6XQub/2]
const regXHeader = /#{1,6}.+/g
console.log(
testString.match(regXHeader)
);
```
```css
.as-console-wrapper { min-height: 100%!important; top: 0; }
```
**Bonus**
Refactoring the above regex into e.g. [`/(?<flag>#{1,6})\s+(?<content>.+)/g`](https://regex101.com/r/n6XQub/4) by utilizing [*named capturing groups*](https://javascript.info/regexp-groups#named-groups) alongside with [`matchAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/matchAll) and a [`map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)ping task, one could achieve a result like computed by the next provided example code ...
```js
const testString = `\n# Clean-er ReactJS Code - Conditional Rendering\n\n## TL;DR\n\nMove render conditions into appropriately named variables. Abstract the condition logic into a function. This makes the render function code a lot easier to understand, refactor, reuse, test, and think about.\n\n## Introduction\n\nConditional rendering is when a logical operator determines what will be rendered. The following code is from the examples in the official ReactJS documentation. It is one of the simplest examples of conditional rendering that I can think of.\n\n`;
// see...[https://regex101.com/r/n6XQub/4]
const regXHeader = /(?<flag>#{1,6})\s+(?<content>.+)/g
console.log(
Array
.from(
testString.matchAll(regXHeader)
)
.map(({ groups: { flag, content } }) => ({
heading: `h${ flag.length }`,
content,
}))
);
```
```css
.as-console-wrapper { min-height: 100%!important; top: 0; }
``` | The issue is that you are using a literal for the regex and should not double escape the backslash, so you can write it as `(?<!#)#{1,6} (.*?)(\r(?:\n)?|\n)`
You can shorten the pattern capturing what you want and match the trailing newline instead of using a lookbehind assertion.
```
(#{1,6} .*)\r?\n
```
Retrieving all capture group 1 values:
```js
const testString = "\n# Clean-er ReactJS Code - Conditional Rendering\n\n## TL;DR\n\nMove render conditions into appropriately named variables. Abstract the condition logic into a function. This makes the render function code a lot easier to understand, refactor, reuse, test, and think about.\n\n## Introduction\n\nConditional rendering is when a logical operator determines what will be rendered. The following code is from the examples in the official ReactJS documentation. It is one of the simplest examples of conditional rendering that I can think of.\n\n"
const HEADING_R = /(#{1,6} .*)\r?\n/g;
const headings = Array.from(testString.matchAll(HEADING_R), m => m[1]);
console.log('headings: ', headings);
``` |
20,987,153 | I'm trying to have a SKNode move onto the screen on command. I've set up the following SKAction chain so that 1) The node moves up and offscreen, then 2) the node moves down into a starting place, then 3) starts moving around. I've used the following code to try and implement this:
```
SKAction *moveUp = [SKAction moveTo: shipIntroSpot1 duration:3.0];
SKAction *moveDown = [SKAction moveTo:shipSpot1 duration:ship1MovementSpeed];
[self enumerateChildNodesWithName:@"ship1" usingBlock:^(SKNode *node, BOOL *stop) {
NSLog(@"RUNNING MOVE UP");
[node runAction: moveUp];
[node runAction:moveUp completion:^{
NSLog(@"RUNNING MOVE DOWN");
[node setHidden: NO];
[node runAction: moveDown];
}];
[node runAction:moveDown completion:^{
NSLog(@"STARTING MOVEMENT");
}];
```
However, the SKActions don't appear to be firing in the correct order. I used the code so that once one step was completed, the next would start. However, the SKAction doesn't appear to move the node fast enough before the next SKAction starts working. I was under the impressions that using the completion call would mean that the next action wouldn't start until the previous one had finished? That does not appear to be the case here. In addition, if I leave a long-enough duration for step 1 (MOVING UP), it will skip over step 2 (MOVING DOWN) and start executing step 3 (STARTING MOVEMENT). I have absolutely no idea how this is possible. If anyone could point out my error in understanding how to chain different actions together properly, I would appreciate it.
(I did not do a SKAction sequence because I have to "unhide" the node halfway through. I don't think I can put that in a sequence, unless I'm wrong about that too.) | 2014/01/08 | [
"https://Stackoverflow.com/questions/20987153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/252216/"
] | It does not seem like you understand how runAction is executed.
Using
```
[node runAction:moveUp completion:^{
NSLog(@"RUNNING MOVE DOWN");
[node setHidden: NO];
[node runAction: moveDown];
}];
```
will not just define a completion to be done at the end of the action, but it runs the action and then calls the completion, so the very first [node runAction:moveUp] needs to be removed.
Secondly, two runAction calls that are made in one function/block will be called simultaneously, and since you call [node runAction: moveUp], [node runAction:moveUp completion:] , and [node runAction:moveDown completion:] all in the same block, they will all be executed simultaneously.
This is the code you are looking for:
```
SKAction *moveUp = [SKAction moveTo: shipIntroSpot1 duration:3.0];
SKAction *moveDown = [SKAction moveTo:shipSpot1 duration:ship1MovementSpeed];
[self enumerateChildNodesWithName:@"ship1" usingBlock:^(SKNode *node, BOOL *stop) {
NSLog(@"RUNNING MOVE UP");
[node runAction:moveUp completion:^{
NSLog(@"RUNNING MOVE DOWN");
[node setHidden: NO];
[node runAction:moveDown completion:^{
NSLog(@"STARTING MOVEMENT");
}];
}];
``` | The completion block runs after the action is finished. So, if you want to move up, then move down, then move around, you need to write the following code:
```
[node runAction:moveUp completion:^{
[node runAction:moveDown completion:^{
NSLog(@"STARTING MOVEMENT");
}];
}];
```
What you have right now won't work because you call three runAction's in a row. You first tell it to moveUp, but then immediately override that action with another moveUp, this time with a completion block where you run moveDown. Then, you immediately override that action with a moveDown, so essentially, all you're doing is telling the node to moveDown, everything else is superfluous. |
20,987,153 | I'm trying to have a SKNode move onto the screen on command. I've set up the following SKAction chain so that 1) The node moves up and offscreen, then 2) the node moves down into a starting place, then 3) starts moving around. I've used the following code to try and implement this:
```
SKAction *moveUp = [SKAction moveTo: shipIntroSpot1 duration:3.0];
SKAction *moveDown = [SKAction moveTo:shipSpot1 duration:ship1MovementSpeed];
[self enumerateChildNodesWithName:@"ship1" usingBlock:^(SKNode *node, BOOL *stop) {
NSLog(@"RUNNING MOVE UP");
[node runAction: moveUp];
[node runAction:moveUp completion:^{
NSLog(@"RUNNING MOVE DOWN");
[node setHidden: NO];
[node runAction: moveDown];
}];
[node runAction:moveDown completion:^{
NSLog(@"STARTING MOVEMENT");
}];
```
However, the SKActions don't appear to be firing in the correct order. I used the code so that once one step was completed, the next would start. However, the SKAction doesn't appear to move the node fast enough before the next SKAction starts working. I was under the impressions that using the completion call would mean that the next action wouldn't start until the previous one had finished? That does not appear to be the case here. In addition, if I leave a long-enough duration for step 1 (MOVING UP), it will skip over step 2 (MOVING DOWN) and start executing step 3 (STARTING MOVEMENT). I have absolutely no idea how this is possible. If anyone could point out my error in understanding how to chain different actions together properly, I would appreciate it.
(I did not do a SKAction sequence because I have to "unhide" the node halfway through. I don't think I can put that in a sequence, unless I'm wrong about that too.) | 2014/01/08 | [
"https://Stackoverflow.com/questions/20987153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/252216/"
] | It does not seem like you understand how runAction is executed.
Using
```
[node runAction:moveUp completion:^{
NSLog(@"RUNNING MOVE DOWN");
[node setHidden: NO];
[node runAction: moveDown];
}];
```
will not just define a completion to be done at the end of the action, but it runs the action and then calls the completion, so the very first [node runAction:moveUp] needs to be removed.
Secondly, two runAction calls that are made in one function/block will be called simultaneously, and since you call [node runAction: moveUp], [node runAction:moveUp completion:] , and [node runAction:moveDown completion:] all in the same block, they will all be executed simultaneously.
This is the code you are looking for:
```
SKAction *moveUp = [SKAction moveTo: shipIntroSpot1 duration:3.0];
SKAction *moveDown = [SKAction moveTo:shipSpot1 duration:ship1MovementSpeed];
[self enumerateChildNodesWithName:@"ship1" usingBlock:^(SKNode *node, BOOL *stop) {
NSLog(@"RUNNING MOVE UP");
[node runAction:moveUp completion:^{
NSLog(@"RUNNING MOVE DOWN");
[node setHidden: NO];
[node runAction:moveDown completion:^{
NSLog(@"STARTING MOVEMENT");
}];
}];
``` | I know it's been marked as answered but though I'd offer up an alternative.
An alternative option would be to simply sequence the Actions with just one completion handler
for example (could just be written as a one liner if you wanted):
```
NSArray *actions = @[moveUp, [SKAction unhide], moveDown];
SKAction *action = [SKAction sequence:actions];
```
then in your loop just write:
```
[node runAction:action withCompletion^{
NSLog(@"STARTING MOVEMENT");
}];
```
Hopefully someone will find this useful. |
44,286,642 | I am making a django app that can hold info about items i have on ebay.
So, each user would have multiple ebay accounts.
For example:
user1 would have access to ebay1, ebay2, ebay3 account.
How can I get appid, certid, devid and token for each account?
The best would be to click 'add ebay account' and in new window with ebay sign in page and authorize by inserting username/password.
I had a look to:
<https://github.com/timotheus/ebaysdk-python>
<https://developer.ebay.com/devzone/xml/docs/reference/ebay/FetchToken.html>
but it is not clear to me.
Can anyone provide me some step-by-step or any guidelines?
Thanks in advance | 2017/05/31 | [
"https://Stackoverflow.com/questions/44286642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/468807/"
] | I used code from this repo: <https://github.com/luke-dixon/django-ebay-accounts>
with fix from: [here](https://github.com/luke-dixon/django-ebay-accounts/commit/f4913039b452cef9315f3f4deced89f09203afb4) it works great | You simply login to the developer account and then Click User Tokens.
next click Get a User Token Here.
login to each account you need a token for
your APPID, CertId, and DevID always stay the same.. |
44,286,642 | I am making a django app that can hold info about items i have on ebay.
So, each user would have multiple ebay accounts.
For example:
user1 would have access to ebay1, ebay2, ebay3 account.
How can I get appid, certid, devid and token for each account?
The best would be to click 'add ebay account' and in new window with ebay sign in page and authorize by inserting username/password.
I had a look to:
<https://github.com/timotheus/ebaysdk-python>
<https://developer.ebay.com/devzone/xml/docs/reference/ebay/FetchToken.html>
but it is not clear to me.
Can anyone provide me some step-by-step or any guidelines?
Thanks in advance | 2017/05/31 | [
"https://Stackoverflow.com/questions/44286642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/468807/"
] | ```
InvalidHeader at /ebay_accounts/begin_create Header value 3 must be of type str or bytes, not <class 'int'>
```
you have to append the str to your data you send so str("whatever") | You simply login to the developer account and then Click User Tokens.
next click Get a User Token Here.
login to each account you need a token for
your APPID, CertId, and DevID always stay the same.. |
58,322,528 | So far, I've encountered the issue "variable x is accessed within inner class,needs to be declared final. I am able to initialize the CheckBox's but I am unable to set a listener to them after initialization in the loop. Below is my code so far.
```
for(int i=0;i<checkBox_fiber_ID.length;i++){
int temp=getResources().getIdentifier(checkBox_fiber_ID[i],"id",getPackageName());
checkBoxes_fiber[i]=findViewById(temp);
checkBoxes_fiber[i].setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
if(checkBoxes_fiber[i].isChecked()){
//do something
}
}
});
}
```
Any tips on how to solve this? | 2019/10/10 | [
"https://Stackoverflow.com/questions/58322528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633966/"
] | That decoding strategy has nothing to do with numbers being represented as strings. What you need to do is to implement `init(from:)` and convert from string there
```
class MyClass : Codable {
var decimal: Double?
enum CodingKeys: String, CodingKey {
case decimal = "test"
}
required init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
decimal = Double(try container.decode(String.self, forKey: .decimal)
//or if Decimal is used:
//decimal = Decimal(string: try container.decode(String.self, forKey: .decimal)
}
}
```
Note that I am using Double instead of Decimal here to make it simpler | I believe that a cleaner solution is declare value not like a string but like a value:
```
"test": 0.007
```
having a struct like that:
```
struct Stuff {
var test: Decimal
}
```
and then:
```
let decoder = JSONDecoder()
let stuff = try decoder.decode(Stuff.self, from: json)
```
otherwise you can use this example:
<https://forums.swift.org/t/parsing-decimal-values-from-json/6906/3> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.