问:
Installation failed while installing Laravel's Valet due to conflicts
I was having some problems with Laravel's Valet, so I attempted to uninstall and reinstall. Upon reinstallation, when I type the command composer global require laravel/valet I get this extremely lengthy error

```<code>Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install symfony/process v3.4.1
- Conclusion: don't install laravel/valet v2.0.6
- Conclusion: don't install laravel/valet v2.0.5
- Conclusion: don't install laravel/valet v2.0.4
- Conclusion: don't install laravel/valet v2.0.3
- Conclusion: don't install laravel/valet v2.0.1
- Conclusion: don't install symfony/process v3.4.0
- Conclusion: remove symfony/console v4.0.1
- Conclusion: don't install symfony/console v4.0.1
- symfony/process v2.7.0 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.1 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.10 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.11 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.12 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.13 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.14 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.15 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.16 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.17 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.18 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.19 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.2 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.20 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.21 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.22 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.23 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.24 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.25 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.26 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.27 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.28 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.29 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.3 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.30 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.31 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.32 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.33 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.34 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.35 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.36 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.37 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.38 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.39 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.4 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.5 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.6 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.7 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.8 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.9 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.0 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.1 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.10 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.11 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.12 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.13 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.14 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.15 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.16 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.17 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.18 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.19 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.2 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.20 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.21 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.22 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.23 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.24 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.25 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.26 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.27 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.28 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.29 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.3 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.30 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.31 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.32 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.4 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.5 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.6 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.7 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.8 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.9 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.0 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.1 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.2 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.3 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.4 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.5 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.6 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.7 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.8 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.9 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.0 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.1 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.10 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.2 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.3 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.4 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.5 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.6 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.7 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.8 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.9 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.0 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.1 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.10 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.11 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.12 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.13 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.14 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.2 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.3 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.4 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.5 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.6 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.7 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.8 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.9 conflicts with symfony/console[v4.0.1].
- Conclusion: remove symfony/process v4.0.1|install symfony/process v2.7.0|install symfony/process v2.7.1|install symfony/process v2.7.10|install symfony/process v2.7.11|install symfony/process v2.7.12|install symfony/process v2.7.13|install symfony/process v2.7.14|install symfony/process v2.7.15|install symfony/process v2.7.16|install symfony/process v2.7.17|install symfony/process v2.7.18|install symfony/process v2.7.19|install symfony/process v2.7.2|install symfony/process v2.7.20|install symfony/process v2.7.21|install symfony/process v2.7.22|install symfony/process v2.7.23|install symfony/process v2.7.24|install symfony/process v2.7.25|install symfony/process v2.7.26|install symfony/process v2.7.27|install symfony/process v2.7.28|install symfony/process v2.7.29|install symfony/process v2.7.3|install symfony/process v2.7.30|install symfony/process v2.7.31|install symfony/process v2.7.32|install symfony/process v2.7.33|install symfony/process v2.7.34|install symfony/process v2.7.35|install symfony/process v2.7.36|install symfony/process v2.7.37|install symfony/process v2.7.38|install symfony/process v2.7.39|install symfony/process v2.7.4|install symfony/process v2.7.5|install symfony/process v2.7.6|install symfony/process v2.7.7|install symfony/process v2.7.8|install symfony/process v2.7.9|install symfony/process v2.8.0|install symfony/process v2.8.1|install symfony/process v2.8.10|install symfony/process v2.8.11|install symfony/process v2.8.12|install symfony/process v2.8.13|install symfony/process v2.8.14|install symfony/process v2.8.15|install symfony/process v2.8.16|install symfony/process v2.8.17|install symfony/process v2.8.18|install symfony/process v2.8.19|install symfony/process v2.8.2|install symfony/process v2.8.20|install symfony/process v2.8.21|install symfony/process v2.8.22|install symfony/process v2.8.23|install symfony/process v2.8.24|install symfony/process v2.8.25|install symfony/process v2.8.26|install symfony/process v2.8.27|install symfony/process v2.8.28|install symfony/process v2.8.29|install symfony/process v2.8.3|install symfony/process v2.8.30|install symfony/process v2.8.31|install symfony/process v2.8.32|install symfony/process v2.8.4|install symfony/process v2.8.5|install symfony/process v2.8.6|install symfony/process v2.8.7|install symfony/process v2.8.8|install symfony/process v2.8.9|install symfony/process v3.0.0|install symfony/process v3.0.1|install symfony/process v3.0.2|install symfony/process v3.0.3|install symfony/process v3.0.4|install symfony/process v3.0.5|install symfony/process v3.0.6|install symfony/process v3.0.7|install symfony/process v3.0.8|install symfony/process v3.0.9|install symfony/process v3.1.0|install symfony/process v3.1.1|install symfony/process v3.1.10|install symfony/process v3.1.2|install symfony/process v3.1.3|install symfony/process v3.1.4|install symfony/process v3.1.5|install symfony/process v3.1.6|install symfony/process v3.1.7|install symfony/process v3.1.8|install symfony/process v3.1.9|install symfony/process v3.2.0|install symfony/process v3.2.1|install symfony/process v3.2.10|install symfony/process v3.2.11|install symfony/process v3.2.12|install symfony/process v3.2.13|install symfony/process v3.2.14|install symfony/process v3.2.2|install symfony/process v3.2.3|install symfony/process v3.2.4|install symfony/process v3.2.5|install symfony/process v3.2.6|install symfony/process v3.2.7|install symfony/process v3.2.8|install symfony/process v3.2.9
- Conclusion: don't install symfony/process v3.3.14|keep symfony/process v4.0.1
- Installation request for symfony/console (locked at v4.0.1, required as ^4.0) -> satisfiable by symfony/console[v4.0.1].
- Installation request for laravel/valet ^2.0 -> satisfiable by laravel/valet[v2.0.0, v2.0.1, v2.0.3, v2.0.4, v2.0.5, v2.0.6].
- Conclusion: don't install symfony/process v4.0.1|install symfony/process v2.7.0|install symfony/process v2.7.1|install symfony/process v2.7.10|install symfony/process v2.7.11|install symfony/process v2.7.12|install symfony/process v2.7.13|install symfony/process v2.7.14|install symfony/process v2.7.15|install symfony/process v2.7.16|install symfony/process v2.7.17|install symfony/process v2.7.18|install symfony/process v2.7.19|install symfony/process v2.7.2|install symfony/process v2.7.20|install symfony/process v2.7.21|install symfony/process v2.7.22|install symfony/process v2.7.23|install symfony/process v2.7.24|install symfony/process v2.7.25|install symfony/process v2.7.26|install symfony/process v2.7.27|install symfony/process v2.7.28|install symfony/process v2.7.29|install symfony/process v2.7.3|install symfony/process v2.7.30|install symfony/process v2.7.31|install symfony/process v2.7.32|install symfony/process v2.7.33|install symfony/process v2.7.34|install symfony/process v2.7.35|install symfony/process v2.7.36|install symfony/process v2.7.37|install symfony/process v2.7.38|install symfony/process v2.7.39|install symfony/process v2.7.4|install symfony/process v2.7.5|install symfony/process v2.7.6|install symfony/process v2.7.7|install symfony/process v2.7.8|install symfony/process v2.7.9|install symfony/process v2.8.0|install symfony/process v2.8.1|install symfony/process v2.8.10|install symfony/process v2.8.11|install symfony/process v2.8.12|install symfony/process v2.8.13|install symfony/process v2.8.14|install symfony/process v2.8.15|install symfony/process v2.8.16|install symfony/process v2.8.17|install symfony/process v2.8.18|install symfony/process v2.8.19|install symfony/process v2.8.2|install symfony/process v2.8.20|install symfony/process v2.8.21|install symfony/process v2.8.22|install symfony/process v2.8.23|install symfony/process v2.8.24|install symfony/process v2.8.25|install symfony/process v2.8.26|install symfony/process v2.8.27|install symfony/process v2.8.28|install symfony/process v2.8.29|install symfony/process v2.8.3|install symfony/process v2.8.30|install symfony/process v2.8.31|install symfony/process v2.8.32|install symfony/process v2.8.4|install symfony/process v2.8.5|install symfony/process v2.8.6|install symfony/process v2.8.7|install symfony/process v2.8.8|install symfony/process v2.8.9|install symfony/process v3.0.0|install symfony/process v3.0.1|install symfony/process v3.0.2|install symfony/process v3.0.3|install symfony/process v3.0.4|install symfony/process v3.0.5|install symfony/process v3.0.6|install symfony/process v3.0.7|install symfony/process v3.0.8|install symfony/process v3.0.9|install symfony/process v3.1.0|install symfony/process v3.1.1|install symfony/process v3.1.10|install symfony/process v3.1.2|install symfony/process v3.1.3|install symfony/process v3.1.4|install symfony/process v3.1.5|install symfony/process v3.1.6|install symfony/process v3.1.7|install symfony/process v3.1.8|install symfony/process v3.1.9|install symfony/process v3.2.0|install symfony/process v3.2.1|install symfony/process v3.2.10|install symfony/process v3.2.11|install symfony/process v3.2.12|install symfony/process v3.2.13|install symfony/process v3.2.14|install symfony/process v3.2.2|install symfony/process v3.2.3|install symfony/process v3.2.4|install symfony/process v3.2.5|install symfony/process v3.2.6|install symfony/process v3.2.7|install symfony/process v3.2.8|install symfony/process v3.2.9|install symfony/process v3.3.14
- laravel/valet v2.0.0 requires symfony/process ~2.7|~3.0 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.39, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1].
- Can only install one of: symfony/process[v3.3.0, v4.0.1].
- Can only install one of: symfony/process[v3.3.1, v4.0.1].
- Can only install one of: symfony/process[v3.3.10, v4.0.1].
- Can only install one of: symfony/process[v3.3.11, v4.0.1].
- Can only install one of: symfony/process[v3.3.12, v4.0.1].
- Can only install one of: symfony/process[v3.3.13, v4.0.1].
- Can only install one of: symfony/process[v3.3.2, v4.0.1].
- Can only install one of: symfony/process[v3.3.3, v4.0.1].
- Can only install one of: symfony/process[v3.3.4, v4.0.1].
- Can only install one of: symfony/process[v3.3.5, v4.0.1].
- Can only install one of: symfony/process[v3.3.6, v4.0.1].
- Can only install one of: symfony/process[v3.3.7, v4.0.1].
- Can only install one of: symfony/process[v3.3.8, v4.0.1].
- Can only install one of: symfony/process[v3.3.9, v4.0.1].
- Installation request for symfony/process (locked at v4.0.1) -> satisfiable by symfony/process[v4.0.1].

Installation failed, reverting ./composer.json to its original content.
</code>```

What exactly is going on here and why can't I globally install Valet? I realize it is probably some sort of dependency issue/conflict, but it doesn't make sense to me.

答:
For anyone having this same issue, I know I'm two years too late but just in case someone still is having this issue, go to your Composer folder

/users/[name]/AppData/Roaming/Composer

Move EVERYTHING from that folder to a temporary folder, for backup. Just make sure that you MOVE (cut and paste), don't copy. That folder needs to be emptied.

Then

```<code>composer global require laravel/valet
</code>```

And Bob's your Uncle.

Body:
I was having some problems with Laravel's Valet, so I attempted to uninstall and reinstall. Upon reinstallation, when I type the command composer global require laravel/valet I get this extremely lengthy error

Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install symfony/process v3.4.1
- Conclusion: don't install laravel/valet v2.0.6
- Conclusion: don't install laravel/valet v2.0.5
- Conclusion: don't install laravel/valet v2.0.4
- Conclusion: don't install laravel/valet v2.0.3
- Conclusion: don't install laravel/valet v2.0.1
- Conclusion: don't install symfony/process v3.4.0
- Conclusion: remove symfony/console v4.0.1
- Conclusion: don't install symfony/console v4.0.1
- symfony/process v2.7.0 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.1 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.10 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.11 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.12 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.13 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.14 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.15 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.16 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.17 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.18 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.19 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.2 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.20 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.21 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.22 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.23 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.24 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.25 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.26 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.27 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.28 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.29 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.3 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.30 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.31 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.32 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.33 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.34 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.35 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.36 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.37 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.38 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.39 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.4 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.5 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.6 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.7 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.8 conflicts with symfony/console[v4.0.1].
- symfony/process v2.7.9 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.0 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.1 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.10 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.11 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.12 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.13 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.14 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.15 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.16 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.17 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.18 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.19 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.2 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.20 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.21 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.22 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.23 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.24 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.25 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.26 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.27 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.28 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.29 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.3 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.30 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.31 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.32 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.4 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.5 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.6 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.7 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.8 conflicts with symfony/console[v4.0.1].
- symfony/process v2.8.9 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.0 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.1 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.2 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.3 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.4 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.5 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.6 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.7 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.8 conflicts with symfony/console[v4.0.1].
- symfony/process v3.0.9 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.0 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.1 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.10 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.2 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.3 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.4 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.5 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.6 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.7 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.8 conflicts with symfony/console[v4.0.1].
- symfony/process v3.1.9 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.0 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.1 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.10 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.11 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.12 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.13 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.14 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.2 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.3 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.4 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.5 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.6 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.7 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.8 conflicts with symfony/console[v4.0.1].
- symfony/process v3.2.9 conflicts with symfony/console[v4.0.1].
- Conclusion: remove symfony/process v4.0.1|install symfony/process v2.7.0|install symfony/process v2.7.1|install symfony/process v2.7.10|install symfony/process v2.7.11|install symfony/process v2.7.12|install symfony/process v2.7.13|install symfony/process v2.7.14|install symfony/process v2.7.15|install symfony/process v2.7.16|install symfony/process v2.7.17|install symfony/process v2.7.18|install symfony/process v2.7.19|install symfony/process v2.7.2|install symfony/process v2.7.20|install symfony/process v2.7.21|install symfony/process v2.7.22|install symfony/process v2.7.23|install symfony/process v2.7.24|install symfony/process v2.7.25|install symfony/process v2.7.26|install symfony/process v2.7.27|install symfony/process v2.7.28|install symfony/process v2.7.29|install symfony/process v2.7.3|install symfony/process v2.7.30|install symfony/process v2.7.31|install symfony/process v2.7.32|install symfony/process v2.7.33|install symfony/process v2.7.34|install symfony/process v2.7.35|install symfony/process v2.7.36|install symfony/process v2.7.37|install symfony/process v2.7.38|install symfony/process v2.7.39|install symfony/process v2.7.4|install symfony/process v2.7.5|install symfony/process v2.7.6|install symfony/process v2.7.7|install symfony/process v2.7.8|install symfony/process v2.7.9|install symfony/process v2.8.0|install symfony/process v2.8.1|install symfony/process v2.8.10|install symfony/process v2.8.11|install symfony/process v2.8.12|install symfony/process v2.8.13|install symfony/process v2.8.14|install symfony/process v2.8.15|install symfony/process v2.8.16|install symfony/process v2.8.17|install symfony/process v2.8.18|install symfony/process v2.8.19|install symfony/process v2.8.2|install symfony/process v2.8.20|install symfony/process v2.8.21|install symfony/process v2.8.22|install symfony/process v2.8.23|install symfony/process v2.8.24|install symfony/process v2.8.25|install symfony/process v2.8.26|install symfony/process v2.8.27|install symfony/process v2.8.28|install symfony/process v2.8.29|install symfony/process v2.8.3|install symfony/process v2.8.30|install symfony/process v2.8.31|install symfony/process v2.8.32|install symfony/process v2.8.4|install symfony/process v2.8.5|install symfony/process v2.8.6|install symfony/process v2.8.7|install symfony/process v2.8.8|install symfony/process v2.8.9|install symfony/process v3.0.0|install symfony/process v3.0.1|install symfony/process v3.0.2|install symfony/process v3.0.3|install symfony/process v3.0.4|install symfony/process v3.0.5|install symfony/process v3.0.6|install symfony/process v3.0.7|install symfony/process v3.0.8|install symfony/process v3.0.9|install symfony/process v3.1.0|install symfony/process v3.1.1|install symfony/process v3.1.10|install symfony/process v3.1.2|install symfony/process v3.1.3|install symfony/process v3.1.4|install symfony/process v3.1.5|install symfony/process v3.1.6|install symfony/process v3.1.7|install symfony/process v3.1.8|install symfony/process v3.1.9|install symfony/process v3.2.0|install symfony/process v3.2.1|install symfony/process v3.2.10|install symfony/process v3.2.11|install symfony/process v3.2.12|install symfony/process v3.2.13|install symfony/process v3.2.14|install symfony/process v3.2.2|install symfony/process v3.2.3|install symfony/process v3.2.4|install symfony/process v3.2.5|install symfony/process v3.2.6|install symfony/process v3.2.7|install symfony/process v3.2.8|install symfony/process v3.2.9
- Conclusion: don't install symfony/process v3.3.14|keep symfony/process v4.0.1
- Installation request for symfony/console (locked at v4.0.1, required as ^4.0) -> satisfiable by symfony/console[v4.0.1].
- Installation request for laravel/valet ^2.0 -> satisfiable by laravel/valet[v2.0.0, v2.0.1, v2.0.3, v2.0.4, v2.0.5, v2.0.6].
- Conclusion: don't install symfony/process v4.0.1|install symfony/process v2.7.0|install symfony/process v2.7.1|install symfony/process v2.7.10|install symfony/process v2.7.11|install symfony/process v2.7.12|install symfony/process v2.7.13|install symfony/process v2.7.14|install symfony/process v2.7.15|install symfony/process v2.7.16|install symfony/process v2.7.17|install symfony/process v2.7.18|install symfony/process v2.7.19|install symfony/process v2.7.2|install symfony/process v2.7.20|install symfony/process v2.7.21|install symfony/process v2.7.22|install symfony/process v2.7.23|install symfony/process v2.7.24|install symfony/process v2.7.25|install symfony/process v2.7.26|install symfony/process v2.7.27|install symfony/process v2.7.28|install symfony/process v2.7.29|install symfony/process v2.7.3|install symfony/process v2.7.30|install symfony/process v2.7.31|install symfony/process v2.7.32|install symfony/process v2.7.33|install symfony/process v2.7.34|install symfony/process v2.7.35|install symfony/process v2.7.36|install symfony/process v2.7.37|install symfony/process v2.7.38|install symfony/process v2.7.39|install symfony/process v2.7.4|install symfony/process v2.7.5|install symfony/process v2.7.6|install symfony/process v2.7.7|install symfony/process v2.7.8|install symfony/process v2.7.9|install symfony/process v2.8.0|install symfony/process v2.8.1|install symfony/process v2.8.10|install symfony/process v2.8.11|install symfony/process v2.8.12|install symfony/process v2.8.13|install symfony/process v2.8.14|install symfony/process v2.8.15|install symfony/process v2.8.16|install symfony/process v2.8.17|install symfony/process v2.8.18|install symfony/process v2.8.19|install symfony/process v2.8.2|install symfony/process v2.8.20|install symfony/process v2.8.21|install symfony/process v2.8.22|install symfony/process v2.8.23|install symfony/process v2.8.24|install symfony/process v2.8.25|install symfony/process v2.8.26|install symfony/process v2.8.27|install symfony/process v2.8.28|install symfony/process v2.8.29|install symfony/process v2.8.3|install symfony/process v2.8.30|install symfony/process v2.8.31|install symfony/process v2.8.32|install symfony/process v2.8.4|install symfony/process v2.8.5|install symfony/process v2.8.6|install symfony/process v2.8.7|install symfony/process v2.8.8|install symfony/process v2.8.9|install symfony/process v3.0.0|install symfony/process v3.0.1|install symfony/process v3.0.2|install symfony/process v3.0.3|install symfony/process v3.0.4|install symfony/process v3.0.5|install symfony/process v3.0.6|install symfony/process v3.0.7|install symfony/process v3.0.8|install symfony/process v3.0.9|install symfony/process v3.1.0|install symfony/process v3.1.1|install symfony/process v3.1.10|install symfony/process v3.1.2|install symfony/process v3.1.3|install symfony/process v3.1.4|install symfony/process v3.1.5|install symfony/process v3.1.6|install symfony/process v3.1.7|install symfony/process v3.1.8|install symfony/process v3.1.9|install symfony/process v3.2.0|install symfony/process v3.2.1|install symfony/process v3.2.10|install symfony/process v3.2.11|install symfony/process v3.2.12|install symfony/process v3.2.13|install symfony/process v3.2.14|install symfony/process v3.2.2|install symfony/process v3.2.3|install symfony/process v3.2.4|install symfony/process v3.2.5|install symfony/process v3.2.6|install symfony/process v3.2.7|install symfony/process v3.2.8|install symfony/process v3.2.9|install symfony/process v3.3.14
- laravel/valet v2.0.0 requires symfony/process ~2.7|~3.0 -> satisfiable by symfony/process[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.39, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1].
- Can only install one of: symfony/process[v3.3.0, v4.0.1].
- Can only install one of: symfony/process[v3.3.1, v4.0.1].
- Can only install one of: symfony/process[v3.3.10, v4.0.1].
- Can only install one of: symfony/process[v3.3.11, v4.0.1].
- Can only install one of: symfony/process[v3.3.12, v4.0.1].
- Can only install one of: symfony/process[v3.3.13, v4.0.1].
- Can only install one of: symfony/process[v3.3.2, v4.0.1].
- Can only install one of: symfony/process[v3.3.3, v4.0.1].
- Can only install one of: symfony/process[v3.3.4, v4.0.1].
- Can only install one of: symfony/process[v3.3.5, v4.0.1].
- Can only install one of: symfony/process[v3.3.6, v4.0.1].
- Can only install one of: symfony/process[v3.3.7, v4.0.1].
- Can only install one of: symfony/process[v3.3.8, v4.0.1].
- Can only install one of: symfony/process[v3.3.9, v4.0.1].
- Installation request for symfony/process (locked at v4.0.1) -> satisfiable by symfony/process[v4.0.1].

Installation failed, reverting ./composer.json to its original content.

What exactly is going on here and why can't I globally install Valet? I realize it is probably some sort of dependency issue/conflict, but it doesn't make sense to me.

Body:
For anyone having this same issue, I know I'm two years too late but just in case someone still is having this issue, go to your Composer folder

/users/[name]/AppData/Roaming/Composer

Move EVERYTHING from that folder to a temporary folder, for backup. Just make sure that you MOVE (cut and paste), don't copy. That folder needs to be emptied.

Then

composer global require laravel/valet

And Bob's your Uncle.


来源: stackexchange

问:
Create a Measure or Calculated Column to Find Max Date in a Column of Dates
I have a column which is a list of variable amounts of dates. I would like to create a measure or a calculated column that will do the following:

Loop over all the individual dates to find the Latest Date.

Below is a table of what I would expect MaxDate to return.

I currently am splitting Dates in the Query Editor and finding the MAXX of the columns, but that is only a temporary solution as the number of Dates can grow quite large.

答:
You can do this in the query editor with a custom column. Use Text.Split to turn your Dates column into a list, List.Transform the list of text dates to date type, and then take the List.Max.

The formula for the custom column:

```<code>List.Max(List.Transform(Text.Split([Dates], ","), each Date.FromText(_)))
</code>```

ContentLicense: CC BY-SA 4.0

Body:
You can do this in the query editor with a custom column. Use Text.Split to turn your Dates column into a list, List.Transform the list of text dates to date type, and then take the List.Max.

The formula for the custom column:

List.Max(List.Transform(Text.Split([Dates], ","), each Date.FromText(_)))


问:
C#: Is this possible? (Providing default implementation for IEquatable in sub-interface)
I'm trying to make an interface that has an Id property and then implements IEquatable using that Id.

However, a class that implements the intermediate-interface is throwing an error that it does not implement the IEquatable.

I'm guessing this type of functionality simply doesn't exist, but I'm struggling to both describe what exactly this functionality is and to find any workarounds for the thing I want to do.

What I want to do is to allow classes to simply implement the IntermediateInterface and immediately be equatable to each other via the Id property required by that interface.

Here's the code as text:

```<code>public interface IntermediateInterface<T> : IEquatable<T>
    where T : IntermediateInterface<T>
{
    int Id { get; set; }
    public new bool Equals(T other)
    {
        return Id.Equals(other.Id);
    }
}

public class ActualType : IntermediateInterface<ActualType> {
    public int Id { get; set; }
}
</code>```

Here's the Error Text:

Error   CS0535  'ActualType' does not implement interface member 'IEquatable<ActualType>.Equals(ActualType)'

Here's a screenshot from visual studio:

答:
So I figured it out.

If I have IntermediateInterface override Equals explicitly (using the IEquatable identifier) it works how I expected.

Screenshot:

Edit:

Here's some correct code (as text!):

```<code>public interface IntermediateInterface<T> : IEquatable<T>
    where T : IntermediateInterface<T>
{
    int Id { get; set; }
    bool IEquatable<T>.Equals(T other)
    {
        return Id == other?.Id;
    }
}

public class ActualType : IntermediateInterface<ActualType> {
    public int Id { get; set; }
}
</code>```

Body:
I'm trying to make an interface that has an Id property and then implements IEquatable using that Id.

However, a class that implements the intermediate-interface is throwing an error that it does not implement the IEquatable.

I'm guessing this type of functionality simply doesn't exist, but I'm struggling to both describe what exactly this functionality is and to find any workarounds for the thing I want to do.

What I want to do is to allow classes to simply implement the IntermediateInterface and immediately be equatable to each other via the Id property required by that interface.

Here's the code as text:

public interface IntermediateInterface<T> : IEquatable<T>
    where T : IntermediateInterface<T>
{
    int Id { get; set; }
    public new bool Equals(T other)
    {
        return Id.Equals(other.Id);
    }
}

public class ActualType : IntermediateInterface<ActualType> {
    public int Id { get; set; }
}

Here's the Error Text:

Error   CS0535  'ActualType' does not implement interface member 'IEquatable<ActualType>.Equals(ActualType)'

Here's a screenshot from visual studio:

Body:
So I figured it out.

If I have IntermediateInterface override Equals explicitly (using the IEquatable identifier) it works how I expected.

Screenshot:

Edit:

Here's some correct code (as text!):

public interface IntermediateInterface<T> : IEquatable<T>
    where T : IntermediateInterface<T>
{
    int Id { get; set; }
    bool IEquatable<T>.Equals(T other)
    {
        return Id == other?.Id;
    }
}

public class ActualType : IntermediateInterface<ActualType> {
    public int Id { get; set; }
}


问:
Too late to create Fragments?
I am working on my first Android application. I just came to discover Fragments and I need them to create a ViewPager to create nice transitions between my activities, but I fear that it's too late to implement that.

I have to put all my code (MainActivity) in my MainFragment? Or just some pieces   I don't know what I have to keep in my MainActivity

Here is my code

```<code>public class MainActivity extends FragmentActivity {
    ObjectAnimator anim;
    ObjectAnimator anim2;
    private int display, result, detect = 0;
    private NfcAdapter nfcAdapter;
    private ImageButton nfcButton;
    private PendingIntent pendingIntent;
    private ImageButton qrButton;
    private TextView text;
    private SlidrInterface slidr;
    private ImageButton webButton;
    float x1, x2, y1, y2;
    String link = null;
    public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        slidr = Slidr.attach(this);
        setDetect(1);
        setContentView((int) R.layout.activity_main);
        this.text = (TextView) findViewById(R.id.text);
        this.nfcAdapter = NfcAdapter.getDefaultAdapter(this);
        this.nfcButton = (ImageButton) findViewById(R.id.nfc_button);
        this.anim = ObjectAnimator.ofFloat(this.nfcButton, "scaleX", new float[]{0.9f});
        this.anim2 = ObjectAnimator.ofFloat(this.nfcButton, "scaleY", new float[]{0.9f});
        IntentIntegrator integrator = new IntentIntegrator(this);
        this.nfcButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                setDisplay(1);
                manageBlinkEffect();
            }
        });
        this.pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {                                   // RESULTAT DU SCAN QR CODE
        if (requestCode != CUSTOMIZED_REQUEST_CODE && requestCode != IntentIntegrator.REQUEST_CODE) {
            super.onActivityResult(requestCode, resultCode, data);
            return;
        }
        switch (requestCode) {
            case CUSTOMIZED_REQUEST_CODE: {
                Toast.makeText(this, "REQUEST_CODE = " + requestCode, Toast.LENGTH_LONG).show();
                break;
            }
            default:
                break;
        }

        IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);

        if (result.getContents() != null) {
            Log.d("MainActivity", "Scanned");
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Résultat du scan :");
            if (URLUtil.isValidUrl(result.getContents())) {                                                                      // si url...
                builder.setNeutralButton("Visiter", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
                builder.setPositiveButton("Fermer", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) { }
                });
                builder.setNegativeButton("Copier", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                        ClipData clip = ClipData.newPlainText("Texte copié", result.getContents());
                        clipboard.setPrimaryClip(clip);
                    }
                });
            } else {                                                                                // si plain text...
                builder.setNeutralButton("Copier", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                        ClipData clip = ClipData.newPlainText("Texte copié", result.getContents());
                        clipboard.setPrimaryClip(clip);
                    }
                });
                builder.setPositiveButton("Fermer", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) { }
                });
            }
            builder.setMessage(result.getContents().toString());
            builder.create().show();
        }
    }

    public void manageBlinkEffect() {                                                                           // ANIMATION DU LOGO SENZU SUITE A UN CLIC
        anim.setDuration(1000);
        anim.setRepeatMode(ValueAnimator.REVERSE);
        anim.setRepeatCount(9);
        anim.start();
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationCancel(animation);
                if (getRes() != 1){
                    Animation shake = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.shake);
                    Toast.makeText(getApplicationContext(), "Aucun badge n'a été détécté !", Toast.LENGTH_SHORT).show();
                    nfcButton.startAnimation(shake);
                }
            }
        });
        anim2.setDuration(1000);
        anim2.setRepeatMode(ValueAnimator.REVERSE);
        anim2.setRepeatCount(9);
        anim2.start();
    }

    public void onResume() {
        super.onResume();

        Intent intent = getIntent(); // Recuperer l'intent actuel
        NdefMessage[] msgs;
        if (getDetect() == 1 && (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction()) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction()))) { // si l'application a ete lancee via une detection NFC du device  (ACTION_NDEF_DISCOVERED, voir AndroidManifest)
            Parcelable[] rawMessages =
                    intent.getParcelableArrayExtra("android.nfc.extra.NDEF_MESSAGES");
            if (rawMessages != null) { // si NDEF dans le scan
                setDisplay(1);
                resolveIntent(intent); // parser le scan NFC
            }  else {
                byte[] empty = new byte[0];
                byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
                Tag tag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
                byte[] payload = NdefMessageParser.dumpTagData(tag).getBytes();
                NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, id, payload);
                NdefMessage msg = new NdefMessage(new NdefRecord[] {record});
                msgs = new NdefMessage[] {msg};
                setDetect(0);
                getResult(msgs);
            }
        }
        NfcAdapter nfcAdapter2 = this.nfcAdapter;
        if (nfcAdapter2 != null) {
            if (!nfcAdapter2.isEnabled()) {
                showWirelessSettings();
            }
            this.nfcAdapter.enableForegroundDispatch(this, this.pendingIntent, (IntentFilter[]) null, (String[][]) null);
        }
    }

    private void showWirelessSettings() {
        Toast.makeText(this, "Veuillez activer le service NFC", Toast.LENGTH_SHORT).show();
        startActivity(new Intent("android.settings.WIRELESS_SETTINGS"));
    }

    public void onPause() {
        setDetect(0);
        super.onPause();
    }

    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        if (getDetect() != 1) {
            resolveIntent(intent);
        }
    }

    private void resolveIntent(Intent intent) {                                                                 // DETECTION NFC ET PARSING NDEF
        NdefMessage[] msgs;
        String action = intent.getAction();
        Log.d("Infos", getIntent().toString());
        Log.d("Infos", "display = " + display);
        if (getDisplay() != 1) {
            Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
            nfcButton.startAnimation(shake);
            Toast.makeText(this, "Veuillez lancer un scan", Toast.LENGTH_LONG).show();
            return;
        }
        else if ("android.nfc.action.TAG_DISCOVERED".equals(action) || "android.nfc.action.TECH_DISCOVERED".equals(action) || "android.nfc.action.NDEF_DISCOVERED".equals(action)) {
            setRes(1);
            Parcelable[] rawMsgs = intent.getParcelableArrayExtra("android.nfc.extra.NDEF_MESSAGES");
            if (rawMsgs != null) {
                msgs = new NdefMessage[rawMsgs.length];
                for (int i = 0; i < rawMsgs.length; i++) {
                    msgs[i] = (NdefMessage) rawMsgs[i];
                }
            } else {
                byte[] empty = new byte[0];
                byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
                Tag tag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
                byte[] payload = NdefMessageParser.dumpTagData(tag).getBytes();
                NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, id, payload);
                NdefMessage msg = new NdefMessage(new NdefRecord[] {record});
                msgs = new NdefMessage[] {msg};
            }
            if (getDisplay() == 1) {
                getResult(msgs);
            }
        }
    }

    private void getResult(NdefMessage[] msgs) {                                                            // MODAL AVEC RESULTAT DU SCAN NFC
        if (msgs != null && msgs.length != 0) {
            final StringBuilder tmp_builder = new StringBuilder();
            List<ParsedNdefRecord> records = NdefMessageParser.parse(msgs[0]);
            int size = records.size();
            for (int i = 0; i < size; i++) {
                tmp_builder.append(records.get(i).str());
                tmp_builder.append("\n");
            }
            System.out.println(tmp_builder.toString());
            this.anim.cancel();
            this.anim2.cancel();
            setDisplay(0);
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Resultat du scan :");
            builder.setNeutralButton("Visiter", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                 /*  Intent i = new Intent(MainActivity.this, RightActivity.class);
                    link = tmp_builder.toString();
                    i.putExtra("url", link);
                    startActivity(i);*/
                }
            });
            builder.setNegativeButton("Copier", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                    ClipData clip = ClipData.newPlainText("Texte copié", link);
                    clipboard.setPrimaryClip(clip);
                }
            });
            builder.setPositiveButton("Fermer", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {}
            });
            builder.setMessage(tmp_builder.toString());
            builder.create().show();
        }
    }
</code>```

That's an App to read NFC tag

答:
The NFC reading Framework (at least newIntent and the enabling of foreground dispatch) should be in the Activity as the Intent is passed to your Activity, you could then pass the Intent data received to the Fragment for processing of the actual data.

Also handling the newIntent in the Activity provides a better user experience, you don't really want the OS launching another screen over your app because the user brought the NFC card in to range while in a Fragment that is not doing anything with NFC. So the App always should register to handle the type of cards you want in all screens and then make a decision in the Activity if it is going to do something always with the NFC data or conditionally depending on what Fragment is active (that choice can be made in the Activity or Every Fragment). Doing that part in the Activity means less copy and paste of code to every Fragment.

The same goes for onActivityResult, handle initially in Activity and pass on as required to Fragments depending on how you want to handle these

Title: Too late to create Fragments?

Body:
I am working on my first Android application. I just came to discover Fragments and I need them to create a ViewPager to create nice transitions between my activities, but I fear that it's too late to implement that.

I have to put all my code (MainActivity) in my MainFragment? Or just some pieces   I don't know what I have to keep in my MainActivity

Here is my code

public class MainActivity extends FragmentActivity {
    ObjectAnimator anim;
    ObjectAnimator anim2;
    private int display, result, detect = 0;
    private NfcAdapter nfcAdapter;
    private ImageButton nfcButton;
    private PendingIntent pendingIntent;
    private ImageButton qrButton;
    private TextView text;
    private SlidrInterface slidr;
    private ImageButton webButton;
    float x1, x2, y1, y2;
    String link = null;
    public final int CUSTOMIZED_REQUEST_CODE = 0x0000ffff;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        slidr = Slidr.attach(this);
        setDetect(1);
        setContentView((int) R.layout.activity_main);
        this.text = (TextView) findViewById(R.id.text);
        this.nfcAdapter = NfcAdapter.getDefaultAdapter(this);
        this.nfcButton = (ImageButton) findViewById(R.id.nfc_button);
        this.anim = ObjectAnimator.ofFloat(this.nfcButton, "scaleX", new float[]{0.9f});
        this.anim2 = ObjectAnimator.ofFloat(this.nfcButton, "scaleY", new float[]{0.9f});
        IntentIntegrator integrator = new IntentIntegrator(this);
        this.nfcButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                setDisplay(1);
                manageBlinkEffect();
            }
        });
        this.pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {                                   // RESULTAT DU SCAN QR CODE
        if (requestCode != CUSTOMIZED_REQUEST_CODE && requestCode != IntentIntegrator.REQUEST_CODE) {
            super.onActivityResult(requestCode, resultCode, data);
            return;
        }
        switch (requestCode) {
            case CUSTOMIZED_REQUEST_CODE: {
                Toast.makeText(this, "REQUEST_CODE = " + requestCode, Toast.LENGTH_LONG).show();
                break;
            }
            default:
                break;
        }

        IntentResult result = IntentIntegrator.parseActivityResult(resultCode, data);

        if (result.getContents() != null) {
            Log.d("MainActivity", "Scanned");
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Résultat du scan :");
            if (URLUtil.isValidUrl(result.getContents())) {                                                                      // si url...
                builder.setNeutralButton("Visiter", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                    }
                });
                builder.setPositiveButton("Fermer", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) { }
                });
                builder.setNegativeButton("Copier", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                        ClipData clip = ClipData.newPlainText("Texte copié", result.getContents());
                        clipboard.setPrimaryClip(clip);
                    }
                });
            } else {                                                                                // si plain text...
                builder.setNeutralButton("Copier", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                        ClipData clip = ClipData.newPlainText("Texte copié", result.getContents());
                        clipboard.setPrimaryClip(clip);
                    }
                });
                builder.setPositiveButton("Fermer", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) { }
                });
            }
            builder.setMessage(result.getContents().toString());
            builder.create().show();
        }
    }

    public void manageBlinkEffect() {                                                                           // ANIMATION DU LOGO SENZU SUITE A UN CLIC
        anim.setDuration(1000);
        anim.setRepeatMode(ValueAnimator.REVERSE);
        anim.setRepeatCount(9);
        anim.start();
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationCancel(animation);
                if (getRes() != 1){
                    Animation shake = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.shake);
                    Toast.makeText(getApplicationContext(), "Aucun badge n'a été détécté !", Toast.LENGTH_SHORT).show();
                    nfcButton.startAnimation(shake);
                }
            }
        });
        anim2.setDuration(1000);
        anim2.setRepeatMode(ValueAnimator.REVERSE);
        anim2.setRepeatCount(9);
        anim2.start();
    }

    public void onResume() {
        super.onResume();

        Intent intent = getIntent(); // Recuperer l'intent actuel
        NdefMessage[] msgs;
        if (getDetect() == 1 && (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction()) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(intent.getAction()))) { // si l'application a ete lancee via une detection NFC du device  (ACTION_NDEF_DISCOVERED, voir AndroidManifest)
            Parcelable[] rawMessages =
                    intent.getParcelableArrayExtra("android.nfc.extra.NDEF_MESSAGES");
            if (rawMessages != null) { // si NDEF dans le scan
                setDisplay(1);
                resolveIntent(intent); // parser le scan NFC
            }  else {
                byte[] empty = new byte[0];
                byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
                Tag tag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
                byte[] payload = NdefMessageParser.dumpTagData(tag).getBytes();
                NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, id, payload);
                NdefMessage msg = new NdefMessage(new NdefRecord[] {record});
                msgs = new NdefMessage[] {msg};
                setDetect(0);
                getResult(msgs);
            }
        }
        NfcAdapter nfcAdapter2 = this.nfcAdapter;
        if (nfcAdapter2 != null) {
            if (!nfcAdapter2.isEnabled()) {
                showWirelessSettings();
            }
            this.nfcAdapter.enableForegroundDispatch(this, this.pendingIntent, (IntentFilter[]) null, (String[][]) null);
        }
    }

    private void showWirelessSettings() {
        Toast.makeText(this, "Veuillez activer le service NFC", Toast.LENGTH_SHORT).show();
        startActivity(new Intent("android.settings.WIRELESS_SETTINGS"));
    }

    public void onPause() {
        setDetect(0);
        super.onPause();
    }

    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        if (getDetect() != 1) {
            resolveIntent(intent);
        }
    }

    private void resolveIntent(Intent intent) {                                                                 // DETECTION NFC ET PARSING NDEF
        NdefMessage[] msgs;
        String action = intent.getAction();
        Log.d("Infos", getIntent().toString());
        Log.d("Infos", "display = " + display);
        if (getDisplay() != 1) {
            Animation shake = AnimationUtils.loadAnimation(this, R.anim.shake);
            nfcButton.startAnimation(shake);
            Toast.makeText(this, "Veuillez lancer un scan", Toast.LENGTH_LONG).show();
            return;
        }
        else if ("android.nfc.action.TAG_DISCOVERED".equals(action) || "android.nfc.action.TECH_DISCOVERED".equals(action) || "android.nfc.action.NDEF_DISCOVERED".equals(action)) {
            setRes(1);
            Parcelable[] rawMsgs = intent.getParcelableArrayExtra("android.nfc.extra.NDEF_MESSAGES");
            if (rawMsgs != null) {
                msgs = new NdefMessage[rawMsgs.length];
                for (int i = 0; i < rawMsgs.length; i++) {
                    msgs[i] = (NdefMessage) rawMsgs[i];
                }
            } else {
                byte[] empty = new byte[0];
                byte[] id = intent.getByteArrayExtra(NfcAdapter.EXTRA_ID);
                Tag tag = (Tag) intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
                byte[] payload = NdefMessageParser.dumpTagData(tag).getBytes();
                NdefRecord record = new NdefRecord(NdefRecord.TNF_UNKNOWN, empty, id, payload);
                NdefMessage msg = new NdefMessage(new NdefRecord[] {record});
                msgs = new NdefMessage[] {msg};
            }
            if (getDisplay() == 1) {
                getResult(msgs);
            }
        }
    }

    private void getResult(NdefMessage[] msgs) {                                                            // MODAL AVEC RESULTAT DU SCAN NFC
        if (msgs != null && msgs.length != 0) {
            final StringBuilder tmp_builder = new StringBuilder();
            List<ParsedNdefRecord> records = NdefMessageParser.parse(msgs[0]);
            int size = records.size();
            for (int i = 0; i < size; i++) {
                tmp_builder.append(records.get(i).str());
                tmp_builder.append("\n");
            }
            System.out.println(tmp_builder.toString());
            this.anim.cancel();
            this.anim2.cancel();
            setDisplay(0);
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setTitle("Resultat du scan :");
            builder.setNeutralButton("Visiter", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                 /*  Intent i = new Intent(MainActivity.this, RightActivity.class);
                    link = tmp_builder.toString();
                    i.putExtra("url", link);
                    startActivity(i);*/
                }
            });
            builder.setNegativeButton("Copier", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
                    ClipData clip = ClipData.newPlainText("Texte copié", link);
                    clipboard.setPrimaryClip(clip);
                }
            });
            builder.setPositiveButton("Fermer", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {}
            });
            builder.setMessage(tmp_builder.toString());
            builder.create().show();
        }
    }

That's an App to read NFC tag


问:
How to fill in between rows gap comparing with other dataframe using pandas?
I want to compare df1 with df2 and fill only the blanks without overwriting other values. I have no idea how to achieve this without overwriting or creating an extra columns.

Can I do this by converting df2 into dictionary and mapping with df1?

```<code>df1 = pd.DataFrame({'players name':['ram', 'john', 'ismael', 'sam', 'karan'],
                   'hobbies':['jog','','photos','','studying'],
                   'sports':['cricket', 'basketball', 'chess', 'kabadi', 'volleyball']})
</code>```

df1:

```<code>  players name   hobbies      sports
0          ram       jog     cricket
1         john            basketball
2       ismael    photos       chess
3          sam                kabadi
4        karan  studying  volleyball
</code>```

And, df,

```<code>df2 = pd.DataFrame({'players name':['jagan', 'mohan', 'john', 'sam', 'karan'],
                   'hobbies':['riding', 'tv', 'sliding', 'jumping', 'studying']})
</code>```

df2:

```<code>  players name   hobbies
0        jagan    riding
1        mohan        tv
2         john   sliding
3          sam   jumping
4        karan  studying
</code>```

I want output like this:

答:
Try this:

```<code>df1['hobbies'] = (df1['players name'].map(df2.set_index('players name')['hobbies'])
                                     .fillna(df1['hobbies']))
df1
</code>```

Output:

```<code>  players name   hobbies      sports
0          ram       jog     cricket
1         john   sliding  basketball
2       ismael    photos       chess
3          sam   jumping      kabadi
4        karan  studying  volleyball
</code>```

Body:
I want to compare df1 with df2 and fill only the blanks without overwriting other values. I have no idea how to achieve this without overwriting or creating an extra columns.

Can I do this by converting df2 into dictionary and mapping with df1?

df1 = pd.DataFrame({'players name':['ram', 'john', 'ismael', 'sam', 'karan'],
                   'hobbies':['jog','','photos','','studying'],
                   'sports':['cricket', 'basketball', 'chess', 'kabadi', 'volleyball']})

df1:

  players name   hobbies      sports
0          ram       jog     cricket
1         john            basketball
2       ismael    photos       chess
3          sam                kabadi
4        karan  studying  volleyball

And, df,

df2 = pd.DataFrame({'players name':['jagan', 'mohan', 'john', 'sam', 'karan'],
                   'hobbies':['riding', 'tv', 'sliding', 'jumping', 'studying']})

df2:

  players name   hobbies
0        jagan    riding
1        mohan        tv
2         john   sliding
3          sam   jumping
4        karan  studying

I want output like this:

Body:
Try this:

df1['hobbies'] = (df1['players name'].map(df2.set_index('players name')['hobbies'])
                                     .fillna(df1['hobbies']))
df1

Output:

  players name   hobbies      sports
0          ram       jog     cricket
1         john   sliding  basketball
2       ismael    photos       chess
3          sam   jumping      kabadi
4        karan  studying  volleyball


问:
How a c++ program (.cpp) work with header(.h) and libtool (.la)?
I have create a folder in linux called helloworld.
Inside this folder have sub-directory:

include

lib

src

include/
In this directory I have create a header file called helloworld.h
content are:

```<code>class helloworld{
public:

       void getvalue();

};
</code>```

lib/
In lib directory I have create a cpp file called helloworld.cpp
content are mainly functions:

```<code>#include<iostream>
#include<helloworld.h>
using namespace std;

void helloworld::getvalue() {

}
</code>```

src/
In src directory I have create a main cpp file called main.cpp
content are main:

```<code>#include<iostream>
#include<helloworld.h>

int main()
{
helloworld a;
a.getvalue();
}
</code>```

but after I autoconf, automake, ./configure, and when make
it has a error:

helloworld/src/main.cpp:8: undefined reference to `helloworld::getvalue()'

All I want is to use helloworld.cpp's functions in main.cpp. I've spend a lot of time searching and try and error. Please help.

Added the Makefiles.am

in parent directory,
 I have two files Makefile.am and configure.ac:

Makefile.am

```<code>AUTOMAKE_OPTIONS = foreign
SUBDIRS=src lib

</code>```

configure.ac

```<code>AC_INIT([helloworld], [0.1], [helloworld@gmail.com])
AM_INIT_AUTOMAKE
AC_PROG_RANLIB
AC_LANG(C++)
AC_PROG_CC
AC_PROG_CXX
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_LIBTOOL
AC_DISABLE_STATIC
AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile])
AC_SUBST([CC])
LT_INIT
AC_OUTPUT

</code>```

In lib directory has one Makefile.am

```<code>INCDIR=../include
INCPATH=-I. -I$(INCDIR)
AM_CPPFLAGS=$(INCPATH)
lib_LTLIBRARIES=libhelloworld.la
libhelloworld_la_SOURCES=helloworld.cpp

</code>```

In src directory has one Makefile.am

```<code>INCDIR=../include
INCPATH=-I. -I$(INCDIR)
AM_CPPFLAGS=$(INCPATH)
helloworld_LDADD=-L/lib/libhelloworld.la
bin_PROGRAMS=helloworld
helloworld_SOURCES=main.cpp
</code>```

Compiled success if I take out the
a.getvalue();

答:
This is a good demonstration case for not using recursive make, because that simplifies the declaration of the executable depending on the library. Also, using a single Makefile.am helps with parallel builds (make -j3).

I have completed the example and put it up at github.com/ndim/cxx-automake-lib-and-main for your convenience.

The configure.ac now uses LT_INIT directly without deprecated macros, only generates one Makefile, and generates a helloworld-config.h config header to keep the compiler command line clean from all those -D defines:

```<code>AC_INIT([helloworld], [0.1], [bug-me-not], [helloworld], [this-url])
AC_CONFIG_SRCDIR([lib/helloworld.cpp])
AC_CONFIG_HEADERS([helloworld-config.h])
AC_CONFIG_MACRO_DIR([auto-m4])
AC_CONFIG_AUX_DIR([auto-aux])
AM_INIT_AUTOMAKE([
-Wall
-Werror
foreign
subdir-objects
])

AC_PROG_CXX
AM_PROG_AR
LT_INIT([disable-static])

AC_LANG([C++])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
</code>```

The top-level Makefile.am is now the only Makefile.am:

```<code>ACLOCAL_AMFLAGS = -I auto-m4

EXTRA_DIST =
bin_PROGRAMS =
lib_LTLIBRARIES =

include include/Makefile-files
include lib/Makefile-files
include src/Makefile-files
</code>```

Then include/Makefile-files deals with the header file which I put into include/helloworld/helloworld to help with keeping the include file namespace clean, and to prevent make from getting confused about the executable helloworld and the header file helloworld.

```<code># -*- makefile-automake -*-
EXTRA_DIST += %reldir%/helloworld/helloworld
</code>```

```<code>/* -*- c++ -*- */
#ifndef HELLOWORLD_HEADER
#define HELLOWORLD_HEADER

class helloworld {
public:
  void getvalue();
};

#endif /* !defined(HELLOWORLD_HEADER) */
</code>```

Now, lib/Makefile-files will build libhelloworld.la from library source file lib/helloworld.cpp which I had to adapt a bit for the changed header name:

```<code># -*- makefile-automake -*-

lib_LTLIBRARIES           += libhelloworld.la
libhelloworld_la_CPPFLAGS  = -I$(top_srcdir)/include
libhelloworld_la_SOURCES   = %reldir%/helloworld.cpp
</code>```

```<code>#include "helloworld/helloworld"

void helloworld::getvalue() {
}
</code>```

The helloworld program is defined in src/Makefile-files such that the dependency libhelloworld.la will be automatically (re)built if necessary. The source file src/main.cpp has been adapted for the new header name/location.

```<code># -*- makefile-automake -*-

bin_PROGRAMS            += helloworld
helloworld_CPPFLAGS      = -I$(top_srcdir)/include
helloworld_SOURCES       = %reldir%/main.cpp
helloworld_LDADD         = libhelloworld.la
</code>```

```<code>#include "helloworld/helloworld"

int main() {
  helloworld a;
  a.getvalue();
}
</code>```

Body:
I have create a folder in linux called helloworld.
Inside this folder have sub-directory:

include

lib

src

include/
In this directory I have create a header file called helloworld.h
content are:

class helloworld{
public:

       void getvalue();

};

lib/
In lib directory I have create a cpp file called helloworld.cpp
content are mainly functions:

#include<iostream>
#include<helloworld.h>
using namespace std;

void helloworld::getvalue() {

}

src/
In src directory I have create a main cpp file called main.cpp
content are main:

#include<iostream>
#include<helloworld.h>

int main()
{
helloworld a;
a.getvalue();
}

but after I autoconf, automake, ./configure, and when make
it has a error:

helloworld/src/main.cpp:8: undefined reference to `helloworld::getvalue()'

All I want is to use helloworld.cpp's functions in main.cpp. I've spend a lot of time searching and try and error. Please help.

Added the Makefiles.am

in parent directory,
 I have two files Makefile.am and configure.ac:

Makefile.am

AUTOMAKE_OPTIONS = foreign
SUBDIRS=src lib

configure.ac

AC_INIT([helloworld], [0.1], [helloworld@gmail.com])
AM_INIT_AUTOMAKE
AC_PROG_RANLIB
AC_LANG(C++)
AC_PROG_CC
AC_PROG_CXX
AC_CONFIG_MACRO_DIR([m4])
AC_PROG_LIBTOOL
AC_DISABLE_STATIC
AC_CONFIG_FILES([Makefile lib/Makefile src/Makefile])
AC_SUBST([CC])
LT_INIT
AC_OUTPUT

In lib directory has one Makefile.am

INCDIR=../include
INCPATH=-I. -I$(INCDIR)
AM_CPPFLAGS=$(INCPATH)
lib_LTLIBRARIES=libhelloworld.la
libhelloworld_la_SOURCES=helloworld.cpp

In src directory has one Makefile.am

INCDIR=../include
INCPATH=-I. -I$(INCDIR)
AM_CPPFLAGS=$(INCPATH)
helloworld_LDADD=-L/lib/libhelloworld.la
bin_PROGRAMS=helloworld
helloworld_SOURCES=main.cpp

Compiled success if I take out the
a.getvalue();

Body:
This is a good demonstration case for not using recursive make, because that simplifies the declaration of the executable depending on the library. Also, using a single Makefile.am helps with parallel builds (make -j3).

I have completed the example and put it up at github.com/ndim/cxx-automake-lib-and-main for your convenience.

The configure.ac now uses LT_INIT directly without deprecated macros, only generates one Makefile, and generates a helloworld-config.h config header to keep the compiler command line clean from all those -D defines:

AC_INIT([helloworld], [0.1], [bug-me-not], [helloworld], [this-url])
AC_CONFIG_SRCDIR([lib/helloworld.cpp])
AC_CONFIG_HEADERS([helloworld-config.h])
AC_CONFIG_MACRO_DIR([auto-m4])
AC_CONFIG_AUX_DIR([auto-aux])
AM_INIT_AUTOMAKE([
-Wall
-Werror
foreign
subdir-objects
])

AC_PROG_CXX
AM_PROG_AR
LT_INIT([disable-static])

AC_LANG([C++])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

The top-level Makefile.am is now the only Makefile.am:

ACLOCAL_AMFLAGS = -I auto-m4

EXTRA_DIST =
bin_PROGRAMS =
lib_LTLIBRARIES =

include include/Makefile-files
include lib/Makefile-files
include src/Makefile-files

Then include/Makefile-files deals with the header file which I put into include/helloworld/helloworld to help with keeping the include file namespace clean, and to prevent make from getting confused about the executable helloworld and the header file helloworld.

# -*- makefile-automake -*-
EXTRA_DIST += %reldir%/helloworld/helloworld

/* -*- c++ -*- */
#ifndef HELLOWORLD_HEADER
#define HELLOWORLD_HEADER

class helloworld {
public:
  void getvalue();
};

#endif /* !defined(HELLOWORLD_HEADER) */

Now, lib/Makefile-files will build libhelloworld.la from library source file lib/helloworld.cpp which I had to adapt a bit for the changed header name:

# -*- makefile-automake -*-

lib_LTLIBRARIES           += libhelloworld.la
libhelloworld_la_CPPFLAGS  = -I$(top_srcdir)/include
libhelloworld_la_SOURCES   = %reldir%/helloworld.cpp

#include "helloworld/helloworld"

void helloworld::getvalue() {
}

The helloworld program is defined in src/Makefile-files such that the dependency libhelloworld.la will be automatically (re)built if necessary. The source file src/main.cpp has been adapted for the new header name/location.

# -*- makefile-automake -*-

bin_PROGRAMS            += helloworld
helloworld_CPPFLAGS      = -I$(top_srcdir)/include
helloworld_SOURCES       = %reldir%/main.cpp
helloworld_LDADD         = libhelloworld.la

#include "helloworld/helloworld"

int main() {
  helloworld a;
  a.getvalue();
}


问:
How could I add current pc IP into security group with aws cli
I want to add current working PC's IP into a security group,

And enable all traffice for it. Every time I should do that manually with the web dashboard.

How could I do it with a shell script?

The following are the most common aws cli commands I used.

But I couldn't find how to add ip in a specific security group.

```<code>list_instances(){
    aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value,InstanceId,PublicIpAddress,PrivateIpAddress]' --output text
}
start_instance(){
    aws ec2 start-instances --instance-ids $1
}
</code>```

答:
This is a tool that you can use and easily manage to whitelist your IP with a port in the AWS security group.
You can create and update the AWS security group rule using aws_ipadd command.

https://github.com/piyushsonigra/aws_ipadd

```<code>$ aws_ipadd my_project_ssh
  Your IP 12.10.1.14/32 and Port 22 is whitelisted successfully.

$ aws_ipadd my_project_ssh
  Modifying existing rule...
  Removing old whitelisted IP '12.10.1.14/32'.
  Whitelisting new IP '131.4.10.16/32'.
  Rule successfully updated!
</code>```

Body:
I want to add current working PC's IP into a security group,

And enable all traffice for it. Every time I should do that manually with the web dashboard.

How could I do it with a shell script?

The following are the most common aws cli commands I used.

But I couldn't find how to add ip in a specific security group.

list_instances(){
    aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`Name`].Value,InstanceId,PublicIpAddress,PrivateIpAddress]' --output text
}
start_instance(){
    aws ec2 start-instances --instance-ids $1
}

Body:
This is a tool that you can use and easily manage to whitelist your IP with a port in the AWS security group.
You can create and update the AWS security group rule using aws_ipadd command.

https://github.com/piyushsonigra/aws_ipadd

$ aws_ipadd my_project_ssh
  Your IP 12.10.1.14/32 and Port 22 is whitelisted successfully.

$ aws_ipadd my_project_ssh
  Modifying existing rule...
  Removing old whitelisted IP '12.10.1.14/32'.
  Whitelisting new IP '131.4.10.16/32'.
  Rule successfully updated!


问:
Marking scenario test as skipped when background operation fails
I want to mark scenario as skipped in case of any fail in Background. I have the following structure in feature file:

```<code>Background:
  * call read('classpath:path/to/reusable.feature@ParticularScenario')
  ...

Scenario: That one I want to skip if background call statement fails
  Given ...
  When ...
  Then ...
</code>```

I tried to use * if () karate.abort() expression in background after call statement but it does nothing.

答:
I don't recommend this and strongly urge you to re-structure your tests.

But here is a possible solution. I say again, I don't like this at all.

```<code>Background:
* def error = false
* eval
"""
try {
  var result = karate.call('reusable.feature');
  karate.set(result);
} catch (e) {
  karate.log('background failed:', e);
  karate.set('error', true);
}
"""

Scenario:
* if (error) karate.abort()
</code>```

But otherwise, Karate is not designed for this, sorry.

Body:
I want to mark scenario as skipped in case of any fail in Background. I have the following structure in feature file:

Background:
  * call read('classpath:path/to/reusable.feature@ParticularScenario')
  ...

Scenario: That one I want to skip if background call statement fails
  Given ...
  When ...
  Then ...

I tried to use * if () karate.abort() expression in background after call statement but it does nothing.

Body:
I don't recommend this and strongly urge you to re-structure your tests.

But here is a possible solution. I say again, I don't like this at all.

Background:
* def error = false
* eval
"""
try {
  var result = karate.call('reusable.feature');
  karate.set(result);
} catch (e) {
  karate.log('background failed:', e);
  karate.set('error', true);
}
"""

Scenario:
* if (error) karate.abort()

But otherwise, Karate is not designed for this, sorry.


问:
Why is my NSMenuItem is disabled when it has an action?
I'm implementing a custom NSToolbarItem that has a button and a dropdown, like Mail. The only thing that's not working, though, is that the NSMenuItem is disabled. Whatever I do, I can't get it enabled. Any idea what I'm doing wrong here?

```<code>class DropdownTypeToolbarItem: NSToolbarItem {
    private var handler: ((NSNumber) -> Void)?

    init(itemIdentifier: NSToolbarItem.Identifier, handler: ((NSNumber) -> Void)?) {
        super.init(itemIdentifier: itemIdentifier)

        self.handler = handler

        let control = NSSegmentedControl(labels: ["Open", ""],
                                         trackingMode: .momentary,
                                         target: self,
                                         action: #selector(open))

        let menu = NSMenu(title: "")
        menu.addItem(withTitle: "Export", action: #selector(export(_:)), keyEquivalent: "")

        control.setMenu(menu, forSegment: 1)
        control.setShowsMenuIndicator(true, forSegment: 1)

        self.view = control
    }

    @objc func open() {
        print("select open")
        self.handler?(0)
    }

    @objc func export(_ sender: Any) {
        print("select export")
        self.handler?(1)
    }
}
</code>```

答: The NSToolbarItem itself is not part of the responder chain, which is what's used to determine if the menu item can be enabled, when the target of the menu item is nil. In this case, you should just explicitly set the target of the menu iem to be the toolbar item.

Body:
I'm implementing a custom NSToolbarItem that has a button and a dropdown, like Mail. The only thing that's not working, though, is that the NSMenuItem is disabled. Whatever I do, I can't get it enabled. Any idea what I'm doing wrong here?

class DropdownTypeToolbarItem: NSToolbarItem {
    private var handler: ((NSNumber) -> Void)?

    init(itemIdentifier: NSToolbarItem.Identifier, handler: ((NSNumber) -> Void)?) {
        super.init(itemIdentifier: itemIdentifier)

        self.handler = handler

        let control = NSSegmentedControl(labels: ["Open", ""],
                                         trackingMode: .momentary,
                                         target: self,
                                         action: #selector(open))

        let menu = NSMenu(title: "")
        menu.addItem(withTitle: "Export", action: #selector(export(_:)), keyEquivalent: "")

        control.setMenu(menu, forSegment: 1)
        control.setShowsMenuIndicator(true, forSegment: 1)

        self.view = control
    }

    @objc func open() {
        print("select open")
        self.handler?(0)
    }

    @objc func export(_ sender: Any) {
        print("select export")
        self.handler?(1)
    }
}


问:
IdentityServer4 - How to Implement Impersonation
I have a requirement of allowing our internal support users to impersonate our customer users.

I'm currently using IdentityServer4, Implicit Flow and OIDC Client.

Resources found so far.

[Question]IdentityServer4 user impersonation #853

Generate access token with IdentityServer4 without password

Given that there are limited resources online, are there any suggestions on how I can/should implement impersonation with IdentityServer4?

答:
How to do this

IdentityServer4 does not prescribe any authentication providers. It just acts as one itself for other OIDC clients. That's why you can use third-party login providers, local accounts and whatever else.

Create an ImpersonationController in your IdentityServer.
Make sure, that only your administrators can access this page.

```<code>[Authorize(Policy = "CanImpersonate")]
</code>```

Build a page, in which you can input a User ID, that the admin wants to impersonate.
When posting that form with the intended User ID, use the SignInManager<> class to Sign in the current user.

You can even build a dropdown, what external login provider you'd like to impersonate with, if that is importatant to you.
Use the ExternalLoginSignInAsync method, otherwise the plain SignInAsync(user, false) method.

You are then already signed in as that user on Identity Server. When your client applications request sign-in, IdentityServer will notice your "forged" session and will redirect back to the client immediately with your currently signed in account.

You are now impersonating that user in your client application and on IdentityServer.

If you SignOut on IdentityServer, you will be "promoted" again to your previously logged in account (if still signed in as different identity), or will need to sign in as your actual administrator account again.

What you need to be careful with

Side effects

This is obviously a topic for debate. I'm assuming you want to add this feature, so that you can reproduce user issues, or do some action as the user.

If you do this without users knowing, be very careful about side-effects of whatever actions are done during the impersonation. Are E-Mails sent, or similar notifications.

There is a lot of trust to be lost going this route.

Law

This is also a concern for privacy. Who is able to access the details. What details are revealed, when impersonating a user on your platform.

A recommendation

Don't impersonate users.

Implement a controlled way, in which your administrators can perform the required work. Then you have a consistant audit log, and whatever a signed in user does to your system, you can be sure that it was that user, and not your administrator impersonating that account.

ContentLicense: CC BY-SA 3.0

Body:
How to do this

IdentityServer4 does not prescribe any authentication providers. It just acts as one itself for other OIDC clients. That's why you can use third-party login providers, local accounts and whatever else.

Create an ImpersonationController in your IdentityServer.
Make sure, that only your administrators can access this page.

[Authorize(Policy = "CanImpersonate")]

Build a page, in which you can input a User ID, that the admin wants to impersonate.
When posting that form with the intended User ID, use the SignInManager<> class to Sign in the current user.

You can even build a dropdown, what external login provider you'd like to impersonate with, if that is importatant to you.
Use the ExternalLoginSignInAsync method, otherwise the plain SignInAsync(user, false) method.

You are then already signed in as that user on Identity Server. When your client applications request sign-in, IdentityServer will notice your "forged" session and will redirect back to the client immediately with your currently signed in account.

You are now impersonating that user in your client application and on IdentityServer.

If you SignOut on IdentityServer, you will be "promoted" again to your previously logged in account (if still signed in as different identity), or will need to sign in as your actual administrator account again.

What you need to be careful with

Side effects

This is obviously a topic for debate. I'm assuming you want to add this feature, so that you can reproduce user issues, or do some action as the user.

If you do this without users knowing, be very careful about side-effects of whatever actions are done during the impersonation. Are E-Mails sent, or similar notifications.

There is a lot of trust to be lost going this route.

Law

This is also a concern for privacy. Who is able to access the details. What details are revealed, when impersonating a user on your platform.

A recommendation

Don't impersonate users.

Implement a controlled way, in which your administrators can perform the required work. Then you have a consistant audit log, and whatever a signed in user does to your system, you can be sure that it was that user, and not your administrator impersonating that account.


问:
Increment values in Google Cloud Spanner
I'm using Google Cloud Spanner, and I need a way to Increment a Row's value by value = value + 1.
This turns out to be a major headache because I don't see a way to check if the row already exists.
I'm using the Ruby Client Library (gem version 1.13.1)

Currently I have the following Code that does the job, however only at a speed of around 40-50 Transactions per Second.
I don't see a way to batch this because as I understand I can only batch single DML Statements.

```<code>db.transaction do |transaction|
  if transaction.execute_query("SELECT value FROM table WHERE key = 'ABC'").rows.first.to_h[:value]
    transaction.execute_update("UPDATE table SET value = value + 1 WHERE key = 'ABC'")
  else
    transaction.execute_update("INSERT INTO table (key, value) VALUES ('ABC', 1)")
  end
end
</code>```

Unfortunately SQL to solve this with a single statement doesn't seem to be supported at all. (I'm getting Google::Cloud::InvalidArgumentError (3:Syntax error: Unexpected keyword ON)

```<code>db.transaction do |tx|
  tx.batch_update do |b|
    b.batch_update(
      "INSERT INTO table (key, value) VALUES ('ABC', 1) ON DUPLICATE KEY UPDATE value = value + 1"
    )
  end
end
</code>```

It also doesn't seem possible to increment via Mutations. This will just create the row or overwrite the value:

```<code>db.transaction do |tx|
  tx.upsert "test", [{ key: 'ABC', value: 1 }]
end
</code>```

Is there any way to do what I need with Spanner at all?
The slow multi-row Solution is really sad compared to batch writing performance at 100k+ rows per second.

答:
There isn't a straightforward way to accomplish what you need.

One option to explore to ensure we got reasonable throughput:

Do a read for all the keys you want to update or insert.

Construct a BatchDML with bunch of insert/update statements based on result of
reads from step#1.

Note that updates have to be conditional updates.
Example: "UPDATE table SET value = {prev_value} +1 WHERE key = "ABC"
            AND value = {prev_value}";

Execute constructed BatchDML. Note that some of the statements can fail.

Inserts can fail if the key already exists: I believe this shouldn't be a problem as the key exists (that's the desired result for insert attempt).

Updates may not occur if the value changes from the time we read. If we repeat this cycle, updates can happen in next batch.

As you can see, this comes with caveats.

Body:
I'm using Google Cloud Spanner, and I need a way to Increment a Row's value by value = value + 1.
This turns out to be a major headache because I don't see a way to check if the row already exists.
I'm using the Ruby Client Library (gem version 1.13.1)

Currently I have the following Code that does the job, however only at a speed of around 40-50 Transactions per Second.
I don't see a way to batch this because as I understand I can only batch single DML Statements.

db.transaction do |transaction|
  if transaction.execute_query("SELECT value FROM table WHERE key = 'ABC'").rows.first.to_h[:value]
    transaction.execute_update("UPDATE table SET value = value + 1 WHERE key = 'ABC'")
  else
    transaction.execute_update("INSERT INTO table (key, value) VALUES ('ABC', 1)")
  end
end

Unfortunately SQL to solve this with a single statement doesn't seem to be supported at all. (I'm getting Google::Cloud::InvalidArgumentError (3:Syntax error: Unexpected keyword ON)

db.transaction do |tx|
  tx.batch_update do |b|
    b.batch_update(
      "INSERT INTO table (key, value) VALUES ('ABC', 1) ON DUPLICATE KEY UPDATE value = value + 1"
    )
  end
end

It also doesn't seem possible to increment via Mutations. This will just create the row or overwrite the value:

db.transaction do |tx|
  tx.upsert "test", [{ key: 'ABC', value: 1 }]
end

Is there any way to do what I need with Spanner at all?
The slow multi-row Solution is really sad compared to batch writing performance at 100k+ rows per second.


问:
How can I find the right index in a chunk, knowing only the chunk index?
Let's say I have a chunk like this:

```<code>c  i   i
 +---+---+
0| 0 | 1 |
 +---+---+
1| 2 | 3 |
 +---+---+
2| 4 | 5 |
 +---+---+
3| 6 | 7 |
 +---+---+
</code>```

How can I find the right index for say chunk (c) 3 place 0?

I have an array like this:

```<code>let array = [
    0,
    1,
    2,
    3,
    4
]
</code>```

Then I part it into chunks and loop through:

```<code>let chunks = [
    [
        0,
        1
    ],
    [
        1,
        2
    ],
    [
        3,
        4
    ]
]
</code>```

I have tried like this:

```<code>chunks.forEach((data, chunk) {
    const key1 = array[chunk + 0]; // works fine on first row
    const key2 = array[chunk + 1]; // works fine on first row
});
</code>```

But it produces an invalid result:

```<code>+---+---+
| 0 | 1 | // correct
+---+---+
| 1 | 2 | // invalid, should be: 2, 3
+---+---+
| 2 | 3 | // invalid, should be: 3, 4
+---+---+
| 3 | 4 | // invalid, should be: 5, 6
+---+---+
</code>```

答:
The solution turned out to be rather simple (chunckIndex*2+index):

```<code>chunks.forEach((data, chunkIndex) {
    const key1 = array[chunkIndex * 2 + 0];
    const key2 = array[chunkIndex * 2 + 1];
});
</code>```

Body:
Let's say I have a chunk like this:

c  i   i
 +---+---+
0| 0 | 1 |
 +---+---+
1| 2 | 3 |
 +---+---+
2| 4 | 5 |
 +---+---+
3| 6 | 7 |
 +---+---+

How can I find the right index for say chunk (c) 3 place 0?

I have an array like this:

let array = [
    0,
    1,
    2,
    3,
    4
]

Then I part it into chunks and loop through:

let chunks = [
    [
        0,
        1
    ],
    [
        1,
        2
    ],
    [
        3,
        4
    ]
]

I have tried like this:

chunks.forEach((data, chunk) {
    const key1 = array[chunk + 0]; // works fine on first row
    const key2 = array[chunk + 1]; // works fine on first row
});

But it produces an invalid result:

+---+---+
| 0 | 1 | // correct
+---+---+
| 1 | 2 | // invalid, should be: 2, 3
+---+---+
| 2 | 3 | // invalid, should be: 3, 4
+---+---+
| 3 | 4 | // invalid, should be: 5, 6
+---+---+

Body:
The solution turned out to be rather simple (chunckIndex*2+index):

chunks.forEach((data, chunkIndex) {
    const key1 = array[chunkIndex * 2 + 0];
    const key2 = array[chunkIndex * 2 + 1];
});


问:
How to use draggable sections like on iGoogle?
When viewing iGoogle, each section is able to be drag-and-dropped to anywhere else on the page and then the state of the page is saved. I am curious on how this is done as I would like to provide this functionality as part of a proof of concept?

UPDATE

How do you make it so that the layout you changed to is saved for the next load? I am going to guess this is some sort of cookie?

答:
It's amazingly simple with jQuery. Check out this blog entry on the subject.

Edit: I missed the "state of the page is saved" portion of the question when I answered. That portion will vary wildly based on how you structure your application. You need to store the state of the page somehow, and that will be user dependent. If you don't mind forcing the user to restore their preferences every time they clear their cookie cache, you could store state using a cookie.

I don't know how your application is structured so I can't make any further suggestions, but storing a cookie in jQuery is also amazingly simple. The first part of this blog entry tells you almost everything you need to know.

OwnerDisplayName: Ascalonian

OwnerDisplayName: Randolpho

LastEditorDisplayName: Randolpho


问:
PyCharm Error Loading Package List
I just downloaded PyCharm the other day and wanted to download a few packages. I'm using Windows 10 with PyCharm 2016.2.2 and python 3.5.2. When I go to the available packages screen it continually states:

Error loading package list:pypi.python.org

I was just trying to download BeautifulSoup and I'm clearly missing something. Any help would be wonderful.

答:
All the above solution did not work for me, I had to manually install the package using proxy:</p>

```<code>pip install -U <package_name> --user --proxy=<your proxy>
</code>```

Title: PyCharm Error Loading Package List

Body:
All the above solution did not work for me, I had to manually install the package using proxy:

pip install -U <package_name> --user --proxy=<your proxy>