text:
Q: Cannot open NVIDIA Visual Profiler on Ubuntu 20.04 I've installed CUDA kit via apt-get following CUDA installation documentation. However, when I attempt to open NVIDIA Visual Profiler, I can't open it. By the log file I suppose it has something to do with Eclipse but I don't know how to solve it.
PC info

*

*CUDA version: 11.1

*OS Release: Ubuntu focal (20.04.1)

*My GPU is CUDA capable (already checked)

Log File
!SESSION 2020-12-07 10:24:36.991 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.9.1
java.vendor=Ubuntu
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64 -data @noDefault

!ENTRY com.nvidia.cuda.ide.editor 4 0 2020-12-07 10:24:37.633
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.nvidia.cuda.ide.editor [6]
  Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
    -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
       org.eclipse.cdt.ui [71]
         Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
           -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
              org.eclipse.cdt.core [69]
                Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY com.nvidia.pgprof.application 4 0 2020-12-07 10:24:37.637
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.nvidia.pgprof.application [10]
  Unresolved requirement: Require-Bundle: com.nvidia.viper
    -> Bundle-SymbolicName: com.nvidia.viper; bundle-version="11.1.0.202010130340"; singleton:="true"
       com.nvidia.viper [12]
         Unresolved requirement: Require-Bundle: com.nvidia.cuda.ide.editor; bundle-version="11.1.0"
           -> Bundle-SymbolicName: com.nvidia.cuda.ide.editor; bundle-version="11.1.0.202010130340"; singleton:="true"
              com.nvidia.cuda.ide.editor [6]
                Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
                  -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
                     org.eclipse.cdt.ui [71]
                       Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
                         -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
                            org.eclipse.cdt.core [69]
                              Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY com.nvidia.viper 4 0 2020-12-07 10:24:37.641
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.nvidia.viper [12]
  Unresolved requirement: Require-Bundle: com.nvidia.cuda.ide.editor; bundle-version="11.1.0"
    -> Bundle-SymbolicName: com.nvidia.cuda.ide.editor; bundle-version="11.1.0.202010130340"; singleton:="true"
       com.nvidia.cuda.ide.editor [6]
         Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
           -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
              org.eclipse.cdt.ui [71]
                Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
                  -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
                     org.eclipse.cdt.core [69]
                       Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY com.nvidia.viper.application 4 0 2020-12-07 10:24:37.644
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.nvidia.viper.application [13]
  Unresolved requirement: Require-Bundle: com.nvidia.viper; bundle-version="11.1.0"
    -> Bundle-SymbolicName: com.nvidia.viper; bundle-version="11.1.0.202010130340"; singleton:="true"
       com.nvidia.viper [12]
         Unresolved requirement: Require-Bundle: com.nvidia.cuda.ide.editor; bundle-version="11.1.0"
           -> Bundle-SymbolicName: com.nvidia.cuda.ide.editor; bundle-version="11.1.0.202010130340"; singleton:="true"
              com.nvidia.cuda.ide.editor [6]
                Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
                  -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
                     org.eclipse.cdt.ui [71]
                       Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
                         -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
                            org.eclipse.cdt.core [69]
                              Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY com.nvidia.viper.birt 4 0 2020-12-07 10:24:37.647
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: com.nvidia.viper.birt [14]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.cdt.core 4 0 2020-12-07 10:24:37.652
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.core [69]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY org.eclipse.cdt.ui 4 0 2020-12-07 10:24:37.655
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.cdt.ui [71]
  Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
    -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
       org.eclipse.cdt.core [69]
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

    at org.eclipse.osgi.container.Module.start(Module.java:434)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1561)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)

!ENTRY com.nvidia.viper.application 2 0 2020-12-07 10:24:38.980
!MESSAGE Could not resolve module: com.nvidia.viper.application [13]
  Unresolved requirement: Require-Bundle: com.nvidia.viper; bundle-version="11.1.0"
    -> Bundle-SymbolicName: com.nvidia.viper; bundle-version="11.1.0.202010130340"; singleton:="true"
       com.nvidia.viper [12]
         Unresolved requirement: Require-Bundle: com.nvidia.cuda.ide.editor; bundle-version="11.1.0"
           -> Bundle-SymbolicName: com.nvidia.cuda.ide.editor; bundle-version="11.1.0.202010130340"; singleton:="true"
              com.nvidia.cuda.ide.editor [6]
                Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
                  -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
                     org.eclipse.cdt.ui [71]
                       Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
                         -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
                            org.eclipse.cdt.core [69]
                              Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

!ENTRY org.eclipse.cdt.ui 2 0 2020-12-07 10:24:38.980
!MESSAGE Could not resolve module: org.eclipse.cdt.ui [71]
  Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
    -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
       org.eclipse.cdt.core [69]
         Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

!ENTRY com.nvidia.cuda.ide.editor 2 0 2020-12-07 10:24:38.980
!MESSAGE Could not resolve module: com.nvidia.cuda.ide.editor [6]
  Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
    -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
       org.eclipse.cdt.ui [71]
         Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
           -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
              org.eclipse.cdt.core [69]
                Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

!ENTRY com.nvidia.viper 2 0 2020-12-07 10:24:38.981
!MESSAGE Could not resolve module: com.nvidia.viper [12]
  Unresolved requirement: Require-Bundle: com.nvidia.cuda.ide.editor; bundle-version="11.1.0"
    -> Bundle-SymbolicName: com.nvidia.cuda.ide.editor; bundle-version="11.1.0.202010130340"; singleton:="true"
       com.nvidia.cuda.ide.editor [6]
         Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
           -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
              org.eclipse.cdt.ui [71]
                Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
                  -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
                     org.eclipse.cdt.core [69]
                       Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

!ENTRY org.eclipse.core.filesystem.java7 2 0 2020-12-07 10:24:38.981
!MESSAGE Could not resolve module: org.eclipse.core.filesystem.java7 [84]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"
  Unresolved requirement: Fragment-Host: org.eclipse.core.filesystem; bundle-version="[1.4.100,2.0.0)"

!ENTRY com.nvidia.pgprof.application 2 0 2020-12-07 10:24:38.981
!MESSAGE Could not resolve module: com.nvidia.pgprof.application [10]
  Unresolved requirement: Require-Bundle: com.nvidia.viper
    -> Bundle-SymbolicName: com.nvidia.viper; bundle-version="11.1.0.202010130340"; singleton:="true"
       com.nvidia.viper [12]
         Unresolved requirement: Require-Bundle: com.nvidia.cuda.ide.editor; bundle-version="11.1.0"
           -> Bundle-SymbolicName: com.nvidia.cuda.ide.editor; bundle-version="11.1.0.202010130340"; singleton:="true"
              com.nvidia.cuda.ide.editor [6]
                Unresolved requirement: Require-Bundle: org.eclipse.cdt.ui; bundle-version="[5.8.0.nvidia,5.8.1)"
                  -> Bundle-SymbolicName: org.eclipse.cdt.ui; bundle-version="5.8.0.nvidia-qualifier"; singleton:="true"
                     org.eclipse.cdt.ui [71]
                       Unresolved requirement: Require-Bundle: org.eclipse.cdt.core; bundle-version="[5.2.0,6.0.0)"
                         -> Bundle-SymbolicName: org.eclipse.cdt.core; bundle-version="5.7.0.nvidia-qualifier"; singleton:="true"
                            org.eclipse.cdt.core [69]
                              Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

!ENTRY com.nvidia.viper.birt 2 0 2020-12-07 10:24:38.982
!MESSAGE Could not resolve module: com.nvidia.viper.birt [14]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

!ENTRY org.eclipse.cdt.core 2 0 2020-12-07 10:24:38.982
!MESSAGE Could not resolve module: org.eclipse.cdt.core [69]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))"

!ENTRY org.eclipse.osgi 4 0 2020-12-07 10:24:38.982
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "com.nvidia.viper.application.application" could not be found in the registry. The applications available are: org.eclipse.ant.core.antRunner, org.eclipse.birt.report.engine.ReportExecutor, org.eclipse.e4.ui.workbench.swt.E4Application, org.eclipse.e4.ui.workbench.swt.GenTopic, org.eclipse.equinox.app.error, org.eclipse.equinox.p2.director, org.eclipse.equinox.p2.garbagecollector.application, org.eclipse.equinox.p2.publisher.InstallPublisher, org.eclipse.equinox.p2.publisher.EclipseGenerator, org.eclipse.equinox.p2.publisher.ProductPublisher, org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher, org.eclipse.equinox.p2.reconciler.application, org.eclipse.equinox.p2.repository.repo2runnable, org.eclipse.equinox.p2.repository.metadataverifier, org.eclipse.equinox.p2.artifact.repository.mirrorApplication, org.eclipse.equinox.p2.metadata.repository.mirrorApplication, org.eclipse.equinox.p2.updatesite.UpdateSitePublisher, org.eclipse.equinox.p2.publisher.UpdateSitePublisher, org.eclipse.equinox.p2.publisher.CategoryPublisher, org.eclipse.help.base.infocenterApplication, org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool, org.eclipse.ui.ide.workbench.
    at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
    at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

A: As @greg-449 commented, I just had to change Java version:
sudo update-altenatives --config java
# chose java8


text:
Q: Cannot find where to execute "gradle assembleRelease" on Windows I am trying to sign my apk for release. In eclipse I could just go File->Export, type in my credentials and be good to go.
In Android Studio I read you have to execute the "gradle assembleRelease" command after setting up the gradle script.
I just can't figure out where to run this command? The Windows console does not recognize it, "where gradle" comes up empty aswell and I can only find a gradle.jar file that does not get executed in the console.
I just want to sign my apk for realease.

A: The New Project wizard places a launcher script for Gradle at the root of your project; on Windows it will be gradlew.bat. If you have the signing config set up in your build files, you can run this command:
gradlew.bat assembleRelease

Alternately, you can use the Generate Signed APK... command in the Build menu to guide you through the process.

A: I had a same problem.

*

*Firstly you should go to file that include gradlew.bat with cd file1\.. .

*Now you can write gradlew.bat assembleRelease .

redpajama_set_name: RedPajamaStackExchange


text:
Q: Generate String based on multiple values just inserted This one might be a bit complicated. I searched for similar questions and found nothing that seemed relevant.
Let me start by establishing my database structure.
I have several tables, but the relevant ones are as follows:

Right now I have the decklist stored as a string of cardid delimited by a comma. I realize this is inefficient and when I get around to improving my code I will make a new table tcg_card_in_deck that has relationid, cardid, deckid. For now my code assumes a decklist string.
I'm building a function to allow purchases of a deck. In order to give them the actual cards, I have the following query (generated with the PHP it will actually be about 50 entries):
$db->query_write("INSERT INTO
`tcg_card`
    (masterid, userid, foil)
VALUES
    ('159', '15', '0'),
    ('209', '15', '0'),
    ('209', '15', '0'),
    ('318', '15', '0')");

This part is easy. My issue now is making sure the cards that have just been added can have their ids grabbed and put together in an array (to enter in as a string currently, and as entries into the separate table once the code is updated). If it was one entry I could use LAST_INSERT_ID(). If I did 50 separate insert queries I could grab the id on each iteration and add them into the array. But because it's all done with one query, I don't know how to effectively find the correct cards to put in the decklist. I suppose I could add a dateline field to the cards table to specify date acquired, but that seems sloppy and it may produce flawed results if a user gets cards from a trade or a booster pack in a similar timeframe.
Any advice would be appreciated!

A: Change tcg_card by removing cardid, and make masterid and userid a compound key. Then, add a row called quantity. Since you cannot distinguish between two copies of a card in any meaningful way (except for being foils, which you could handle with this schema), there is no need for every card to get its own ID.
Presumably you aren't entering new tcg_master rows dynamically, so you don't have to worry about pulling their IDs back out.

A: Reading comments on this question I thought of a very simple and easy solution:
Get all inserted IDs when inserting multiple rows using a single query
I already track booster pack purchases with a table tcg_history. This table can also track other types of purchases, such as a starter deck.
I simply need to add a field on the tcg_card table that references a tcg_history.recordid, then I will be able to select all cards that are from that purchase.


text:
Q: Stripe::InvalidRequestError: This customer has no attached payment source I'm trying to do the test signup at the end of lecture 113 in Upskill's Essential Web Developer course, however I get the following error and I have been over and over the previous lectures and cannot pinpoint where I have gone wrong.
Stripe::InvalidRequestError in Users::RegistrationsController#create

This customer has no attached payment source

Extracted source (around line #10):

8  def save_with_subscription
9    if valid?
10      customer = Stripe::Customer.create(description: email, plan: plan_id, card: stripe_card_token)
11      self.stripe_customer_token = customer.id
12      save!
13    end

Rails.root: /home/ubuntu/workspace/saasapp

Application Trace | Framework Trace | Full Trace
app/models/user.rb:10:in `save_with_subscription'
app/controllers/users/registrations_controller.rb:7:in `block in create'
app/controllers/users/registrations_controller.rb:3:in `create'
Request

Parameters:

{"utf8"=>"✓",
"authenticity_token"=>"/4EiUCLerdc0o+vIbZWWZzxC3cm1TSjyWGs/lYq/H4RiT6zwohUJUQnZaIrxADF2RiWcs6G3BDXiRDQT/bEa4Q==",
"plan"=>"2",
"user"=>{"email"=>"test@example.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"},
"commit"=>"Sign up"}

Toggle session dump
Toggle env dump
Response

Headers:

None

LOG
Started POST "/users" for 81.140.28.63 at 2017-01-18 21:24:44 +0000
Cannot render console from 81.140.28.63! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
    Processing by Users::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"GIGatf9j6proPQgjnjCwR6r6BBeDLCYa2lhOG453bQLwln1wTOEbVSPaPow6ZLGBcGpvX3Qm1Fw03vpQc0Xtsg==", "plan"=>"2", "user"=>{"email"=>"test@example.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign up"}
   (0.1ms)  begin transaction
  User Exists (0.3ms)  SELECT  1 AS one FROM "users" WHERE "users"."email" = ? LIMIT ?  [["email", "test@example.com"], ["LIMIT", 1]]
   (0.2ms)  rollback transaction
  User Exists (0.2ms)  SELECT  1 AS one FROM "users" WHERE "users"."email" = ? LIMIT ?  [["email", "test@example.com"], ["LIMIT", 1]]
  Plan Load (0.1ms)  SELECT  "plans".* FROM "plans" WHERE "plans"."id" = ? LIMIT ?  [["id", 2], ["LIMIT", 1]]
Completed 500 Internal Server Error in 905ms (ActiveRecord: 0.9ms)

Stripe::InvalidRequestError (This customer has no attached payment source):

app/models/user.rb:10:in `save_with_subscription'
app/controllers/users/registrations_controller.rb:7:in `block in create'
app/controllers/users/registrations_controller.rb:3:in `create'
  Rendering /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
  Rendering /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (9.5ms)
  Rendering /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (4.3ms)
  Rendering /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (2.7ms)
  Rendered /usr/local/rvm/gems/ruby-2.3.0@saasapp/gems/actionpack-5.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (43.3ms)

A: I would recommend dividing out the requests to see which part of it is actually failing.  I suspect that the reason it's barfing is just because something else is happening and it's unable to manifest a meaningful error message.
Try this:
cus = Stripe::Customer.create(description: email)
self.stripe_customer_token = cus.id
cus.sources.create(source: stripe_card_token)
sub = Stripe::Subscription.create(customer: cus.id, plan: plan_id)
save!

A: I just hit the same issue.
I made the fix for the typo but still got the same error. It looks like the test card number used in the course video maybe another source for this
error too. I used a test number from the following page and all worked as expected.
https://stripe.com/docs/testing#cards
Just my 2cents!

A: Many thanks for taking the time to reply. So I gave it a few days and looked at it again last night and it turned out to be a rather simple and stupid mistake on my part.
In the lesson video and notes the instructor corrects a typo in the users.js file where he referenced an incorrect ID for the submit button in the form. He had typed
var submitBtn = $('#form-submit-btn');

but he had used the following in the form
var submitBtn = $('#form-signup-btn');

While I changed my users.js file to match the correction, somehow I had actually used #form-submit-btn' so when I corrected the users.js file per the lesson I actually caused the problem.


text:
Q: Interactive Choropleth using plotly & ipywidgets in python I am trying to create an interactive choropleth using Plotly and ipywidgets for the dataframe which the head looks like the one shown below.
Data1.head()
The plot sums the values for all the available dates in the dataframe for each county.
Output for available FIPS (aggregated values)
I want to filter the values for a particular date using a dropdown menu and plot the values corresponding to this date.
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
from plotly import *
import plotly.figure_factory as ff
import plotly.graph_objects as go

date = widgets.Dropdown(
    options=['All'] + Data1.date.unique().tolist(),
    value='All',
    description='Date:',
)

# date = Data1['date'][1]  # If I use this instead of the widget defined above, the code works (at the cost of interactivity)

def func(date):

  values = Data1[Data1['date']== date]['Infected'].tolist()
  fips = Data1[Data1['date']== date]['Fips'].tolist()

   colorscale = [
       'rgb(193, 193, 193)',
       'rgb(239,239,239)',
       'rgb(195, 196, 222)',
       'rgb(144,148,194)',
       'rgb(101,104,168)',
       'rgb(65, 53, 132)'
   ]

  fig = ff.create_choropleth(
      fips=fips, values=values, scope=['IL'],
      binning_endpoints=[14348, 63983, 134827, 426762, 2081313], colorscale=colorscale,
      county_outline={'color': 'rgb(255,255,255)', 'width': 0.5}, round_legend_values=True,
      legend_title='Infected cases by County', title='Illinois State'
  )
  fig.layout.template = None
  fig.show()

interactive(func, date= date)

I am able to get the dropdown menu using this code, but it does not print the plot.
Alternatively, I tried to hardcode the date (commented in code) and it did return the plot for the specific date, at the loss of interactivity.
Can someone help me to get the plot where I can let the user choose a date from the dropdown menu and plot the choropleth correspondingly?


text:
Q: Combinations in R Hi so I am trying to do validation of my Basket for Association rules and I want to create combinations of my data frame into the same column.
So for example from this DF of UserId and Basket,
> head(validDF)
  UserID                    Basket
1    935          Toy Story (1995)
2    935   Dead Man Walking (1995)
3    935 Mr. Holland's Opus (1995)
4    936              Fargo (1996)
5    936           Rock The (1996)
6    936            Twister (1996)

I want to create these combinations:
  UserID                    Basket
1    935          Toy Story (1995), Dead Man Walking (1995)
2    935   Dead Man Walking (1995), Toy Story (1995)
3    935 Mr. Holland's Opus (1995), Toy Story (1995)
4    935 Mr. Holland's Opus (1995), Dead Man Walking (1995)
5    936              Fargo (1996), Rock The (1996)
6    936           Rock The (1996), Fargo (1996)
7    936            Twister (1996), Fargo (1996)
8    936            Twister (1996), Rock The (1996)

Anyone has any idea how to do it?
to use R to generate these combination based on UserId in the dataset, R isn't my strongest language. So any help is appreciated!

A:  # data frame
    validDF = data.frame(
    UserID = c(935, 935, 935, 936, 936, 936),
    Basket = c("Toy Story (1995)", "Dead Man Walking (1995)", "Mr. Holland's Opus (1995)",
               "Fargo (1996)", "Rock The (1996)", "Twister (1996)"))

    res = lapply(unique(validDF$UserID), function(x){
      ls_Basket <- as.character(validDF$Basket[validDF$UserID == x])
      res_int = permutations(n = 3, r=2, v= ls_Basket)
      data.frame(UserID = x, Basket = apply(res_int, 1, paste, collapse = ", "))
    })
    res <- do.call(rbind, res)

But in your example, you mix permutation (3 movies=> 6 permutations) and combination (3 movies => 3 combinations)


text:
Q: Nameerror: unable to find defined private method I keep getting a NameError in my Python 3.7 code that I don't understand. I know the problem is indentation. From what I can tell my indentation is in order. So I am unsure where this Nameerror is coming from. Any pointers to the problem are appreciated.
Exception has occurred: NameError
name '_loadconfigfile' is not defined

Method call:
 from configsettings import *
settingsfile = configSettings("setting.json")

Class causing problem:
import os
from logextension import *

class configSettings():
    def __init__(self, settingsfilepath=None):
        _loadconfigfile(settingsfilepath)

    def _loadconfigfile(self, settingsfilepath):
        configsettings = None
        try:
            if not os.path.exists(settingsfilepath):
                raise IOError
            else:
                configSettings = open(settingsfilepath, "r")
        except IOError as err:
            msg = "Error reading file" + settingsfilepath + " "+err
            _errorlogging(msg)
        return configSettings

    def _errorlogging(self, msg):
        logger = UserdefinedLogging(__name__, 'configsettings.log', True)
        logger.error(msg)


text:
Q: DB2 Before Update Trigger Behavior Wondering if someone can help me understand how a DB2 before insert trigger behaves. I have a Grails app that inserts rows to a DB2 database. The table in question has a before insert trigger that updates the date and user for the update:
CREATE TRIGGER WTESTP.SCSMA11I NO CASCADE BEFORE INSERT ON
WTESTP.SCSMA01T REFERENCING NEW AS NEWROW FOR EACH ROW MODE
DB2SQL BEGIN ATOMIC SET NEWROW.LST_UPDT_TMSP =
CURRENT_TIMESTAMP ; SET NEWROW.USER_ID = RTRIM ( USER ) ; END ;

In my Grails application I set all the values, including the user id:
flatAdjustmentInstance.setUserID("TS37813")

We use a generic application ID and password via JNDI to make the connection to the database. For auditing purposes I need to set the value of the user to whomever logged into the application. Is the only solution to remove the trigger entirely and just be really sure it is set?

A: The DB2 USER variable (also called "special register") contains the authorization ID of the current database connection. If an application wishes to pass another user ID to DB2, it can do so by calling the API function sqleseti() or the stored procedure WLM_SET_CLIENT_INFO() -- more info here. The trigger can then reference another special register, CURRENT CLIENT_USERID.


text:
Q: How do I create finish my image classification model? I am trying to create an image classification model. I have attached my code below:
Notes: I am using TensorFlow, I have 12,611 images (for training), and a csv file with the appropriate labels. The same goes for the validation and test datasets but with varying numbers of images. the variable df_train = my csv file for the train set, the variable df_test = my csv file for the test set.

#packages required for image preprocessing
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.preprocessing.image import ImageDataGenerator
from keras.applications.resnet50 import preprocess_input
from keras.metrics import mean_absolute_error

image_size = 256

train_data_generator = ImageDataGenerator(preprocessing_function = preprocess_input)
val_data_generator = ImageDataGenerator(preprocessing_function = preprocess_input)
test_data_generator = ImageDataGenerator(preprocessing_function = preprocess_input)

#train data generator
train_generator = train_data_generator.flow_from_dataframe(
    dataframe = train_df,
    directory="/Users/folder/downloads/Boneage_competition/training_dataset/resized-training/",
    validate_filenames = False,
    x_col= 'id',
    y_col= 'boneage',
    batch_size = 56,
    #flip_vertical = True,
    class_mode = None,
    target_size = (image_size, image_size)
)

#validation data generator
val_generator = val_data_generator.flow_from_dataframe(
    dataframe = valid_df,
    directory="/Users/folder/downloads/Boneage_competition/validation_dataset/resized-validation-1/",
    validate_filenames = False,
    x_col = 'id',
    y_col = 'boneage',
    batch_size = 140,
    #flip_vertical = True,
    class_mode = None,
    target_size = (image_size, image_size)
)

#test data generator
test_generator = test_data_generator.flow_from_dataframe(
    dataframe = df_test,
    directory="/Users/dolferr/downloads/Boneage_competition/testing_dataset/resized-testing/",
    validate_filenames = False,
    x_col = 'id',
    y_col = None,
    #flip_vertical = True,
    class_mode = None,
    target_size = (image_size, image_size)
)

Followed by:
from tensorflow.keras.applications.vgg16 import VGG16

from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import GlobalMaxPooling2D, Dense, Flatten, GlobalAveragePooling2D

#Model definition

my_model = Sequential()
my_model.add(VGG16(input_shape=(image_size, image_size, 3), include_top=False, weights='imagenet'))
my_model.add(GlobalMaxPooling2D())
my_model.add(Flatten())
my_model.add(Dense(128, activation='relu'))
my_model.add(Dense(1, activation='linear'))

How do I continue from here and fit/run my model?

A: You can fit your model by
my_model.fit(train_generator, validation_data=val_generator, epochs=10)


text:
Q: How to get topic name and client id from aws mqtt message broker to aws lambda After mapping send message to lambda function, in AWS IoT core with query SELECT * From '+', I am getting only messages in aws lambda event object. I am using python 3. How can I get topic name and client Id along with messages.

A: The topic and client id need to be passed in the IoT rule using the topic() and clientid() functions. These are then available in the payload that the lambda receives.
So the rule can be:
SELECT *, topic() AS topic, clientid() AS clientid FROM '+'

The lambda will then receive a JSON payload with the topic and clientid properties.


text:
Q: How to retrieve used_ids similar to a certain user_id with Twitter API v2? When interacting with the Twitter with the UI, there is an option to retrieve similar accounts to the one being selected, e.g. if I am checking an account like @MacoubD Twitter suggests to me other similar accounts.
Is it possible to retrieve this list using Twitter API v2? I checked the docs but could not find the endpoint.

A: No. There are no API functions that provide this in v1.1 or in v2.


text:
Q: how to create a simple walk through in objective c I created a simple todo app, and now I want to create a simple walk through for the app, just 4-5 pages that the first time you will log in to the app they will go through with you about the app features and you can swipe horizontally to move between pages.
I saw that there are some stuff in cocoacontrol but all of them are not that simple to implement and doing a lot of irrelevant stuff for my use.
I thought that I need something with a collection view but I was looking online for a simple guid with code to create something like that and find nothing...can someone help me with it?
All the collection view tutorials are with grid, and I dont want grid..
thankss

A: There are several libraries that do that (https://www.cocoacontrols.com/search?q=tutorial) but the simplest way to accomplish it is to create a UIScrollView with pagingEnabled = YES :D

A: Have a look at https://github.com/ruipfcosta/SwiftyWalkthrough and see if can be useful for your needs.


text:
Q: Height of flex items not remaining fixed I have a page with three rows from top to bottom, fix height header(100px) at the top and fix height footer(100px) at the bottom, the middle take up the rest height.

demo is here: http://jiazhengblog.com/test/flex-study.html
The result is what I expected.
But after I add some contents into the middle row, I found that if contents height is higher than its parents it will make parent height higher than expected. That is the middle area height is a little bit higher and both header and footer height are shortened(less than 100px). When I resize the browser window all rows height are changed.

How can I make the header and footer height fixed in this case?
demo is here: http://jiazhengblog.com/test/flex-study-2.html

A: An initial setting of a flex container is flex-shrink: 1. That means that flex items can shrink from their initial size in order to remain inside the container (i.e., they cannot overflow).
That's what is happening in your code. The header and footer are shrinking to accommodate the height of the content in the middle item.
You need to disable flex-shrink.
Instead of this:
#header {
    height: 100px;
    flex-grow: 0;
    background: pink;
}

#footer {
    height: 100px;
    flex-grow: 0;
    background: lightblue;
}

Try this:
#header {
    height: 100px;
    flex-grow: 0;
    flex-shrink: 0;
    background: pink;
}

#footer {
    height: 100px;
    flex-grow: 0; /* not really necessary; default is 0 */
    flex-shrink: 0;
    background: lightblue;
}

Or even better (in terms of efficiency), this:
#header {
    flex: 0 0 100px; /* flex-grow, flex-shrink, flex-basis */
    background: pink;
}

#footer {
    flex: 0 0 100px;
    background: lightblue;
}

A: you can achieve that using min-height in header and footer like this:
#header {
    background: pink;
    height: 100px;
    flex-grow: 0;
    min-height: 100px;
}

#footer {
    background: lightblue;
    height: 100px;
    flex-grow: 0;
    min-height: 100px;
}


text:
Q: Text next to an xskak diagram? The \chessboard command from xskak.sty assembles the board using glyphs from a chess font.  This causes me a ton of headaches trying put explanatory text next to a board.
The first and most obvious attempt was to use a table (actually I have multiple diagrams in a table with 3 boards and associated text per line, but it would be nice to get just one diagram to work for now.):
\documentclass{article}
\usepackage{xskak}
\begin{document}
{\centering
\begin{tabular}{l p{4cm}}
\chessboard[setfen=] &
White to move.  Mutual zugzwang.
\end{tabular}\par}
\end{document}

Unfortunately the text goes on the baseline in the second column and it looks... well... like shit. I would prefer to have it stick to the top of the diagram or be centred.
I.e.:
r n b q k b n r    Text should be
p p p p p p p p    aligned like this
. . . . . . . .    in the final PDF.
. . . . . . . .                          Or centred
. . . . . . . .                          vertically.
. . . . . . . .
P P P P P P P P
R N B Q K B N R                                        It should
                                                       definitely not
                                                       be aligned with
                                                       the baseline of
                                                       the diagram.

A: This has absolutly nothing to do with the way the chessboard is build. The chessboard is like e.g. a graphic simply a box with the baseline at the bottom and so allmost all answers concerning the alignment of graphics with text (see e.g. How to vertically center text with an image in the same row of a table) can be used in this case too: You can use \raisebox or e.g. adjustbox:
\documentclass{article}
\usepackage{xskak,adjustbox}
\begin{document}

\begin{tabular}{l p{4cm}}
\adjustbox{valign=c}{\chessboard[setfen=]} &
White to move.  Mutual zugzwang.
\end{tabular}
\end{document}


text:
Q: C homework with pipes and forks Hello everyone,
I'm quite lost in my school homework since they haven't told us much about it and I haven't done anything like that before.
The task is:
In the C language create a program that creates two processes (fork function) and connects them via pipe (the pipe function).
The first descendant redirects its' stdout into the pipe and writes (space separated) pairs of random numbers into it (function rand).
Delay the output of the numbers (i.e. by 1 second).
The first descendant has
to treat the SIGUSR1 signal (sigaction function) and in case of receiving such signal it prints a string "TERMINATED" to it's stderr and terminates.
The second descendant redirects the pipe output to it's stdin, redirects it's stdout into a file called out.txt in
the current directory and executes a binary file (execl function) for finding the greatest common divisor (the output of our previous tasks where we had to write a makefile that runs a small C program that detects if a number is prime).
The parent process waits 5 seconds and then sends SIGUSR1 to the first process (number generator). This should perform a correct termination of both processes. It waits for the sub-processes to terminate (wait function) and terminates itself.
In fact you are implementing something like this: while : ; do echo $RANDOM $RANDOM ; sleep 1; done | ./c1_task > out.txt
I'm absolutely lost in this and I have nothing so far unfortunatelly.
I don't know where to start.
Could somebody advise me something, please?
Thanks in advance!

A: Since I don't believe in doing people's work for them, I can't give you the "solution." I can, however, show you some of the concepts that you need to know to fulfill your assignment. I can also give you a couple of links, but if you just search for help with the concepts you don't understand, you're likely to find the information you need anyways.
Now that I've delivered a paragraph of introductory information, I'm going to work you through some of the concepts you need to understand to solve this problem.
I may fill in some missing information if I get (and feel like it's worth spending) the time necessary to turn this into a pseudo-tutorial. :)
The information provided may be simplified, a little vague, or otherwise open to improvement. Feel free to let me know if you, dear reader, spot a problem.

First Concept: fork()-ing
What is it? fork() makes it easy to do multiple things simultaneously by duplicating (much of) the current process into another process. (Actually, it is similar to asexual reproduction.)
For instance, the child process (this is the new process that was created by making the fork() system call) inherits open file descriptors (this is an important point!), has its own copy of variables that the parent process (has/had), etc.
Example: Here's an example program that illustrates a thing or two. Note the wait(). It makes the parent, the process that called fork(), wait to continue executing the rest of the program until a child has terminated. Without wait(NULL), we can't guarantee that the parent's printf statement will run after the child's printf statement.
#include <stdio.h> //the usual, perror
#include <stdlib.h> //exit
#include <sys/types.h> //wait() / pid_t
#include <sys/wait.h> //wait()
#include <unistd.h> // fork()

int main () {
    pid_t cpid;

    //create our child.
    //fork() returns -1 if the fork failed, otherwise it returns
    //    the pid of the child to the parent,
    //    and 0 to the child
    cpid = fork();

    //Both the child process and parent process executed the
    //"cpid =" assignment.
    //However, they both modified their own version of cpid.
    //From now on, everything is run by both the child and parent.

    //the fork failed; there is no child so we're done.
    if (cpid < 0) {
        perror("During attempted fork");
        exit(EXIT_FAILURE);
        }

    //Though the if statement will be checked by both,
    //cpid will equal 0 only in the child process.
    if (cpid == 0) {
        //This will be executed by the child.
        printf("Hello. I'm your child.\n");

        //Now that we've let Pops know that we're alive...
        exit(EXIT_SUCCESS);
        }

     else if (cpid > 0) {
        //wait for our child to terminate.
        //I dare you to comment this out & run the program a few times.
        //Does the parent ever print before the child?
        wait(NULL);

        printf("I proudly parented 1 child.\n");
        }

     return 0;
     }

Other: You can see another example here.

Second concept: Pipes
What is a pipe? A pipe is a method for interprocess communication. Basically, it has one end that data can be put in (write() is one way to do it) and one end that data can be gotten out of (using read).
Pipes are created using the pipe() system call. It returns -1 on error. It's only argument is the address of an array of two ints, which we'll call pipe_fds.
If the call succeeded, the first element in pipe_fds contains the file descriptor that is used to read from the pipe; the second element contains the file descriptor used to write to the pipe.
You can write to the pipe with write() and read from the pipe with read(). (More info about using pipes can be found at various places on the internet.
Here's an example:
#include <stdio.h> //the usual, perror
#include <stdlib.h> //exit
#include <sys/types.h> //wait() / pid_t
#include <sys/wait.h> //wait()
#include <unistd.h> // fork(), pipe()

#define BUFLEN 256 //must be greater than one

int main () {
    int pipe_fds[2],
        pipe_ret;
    pid_t cpid;

    //Let's create a pipe.
    //Note that we do this *before* forking so that our forked child
    //    has access to the pipe's file descriptors, pipe_fds.
    pipe_ret = pipe(pipe_fds);

    //we couldn't create our pipe
    if (pipe_ret == -1) {
        perror("Pipe Creation");
        exit(EXIT_FAILURE);
        }

    //create our child.
    cpid = fork();

    //the fork failed; there is no child so we're done.
    if (cpid < 0) {
        perror("During attempted fork");
        exit(EXIT_FAILURE);
        }

    //Am I the child?
    if (cpid == 0) {
        //close the childs read end of the pipe.
        //Failing to close unused pipe ends is life or death!
        //(Check `man 7 pipe`)
        close(pipe_fds[0]);

        //Send a message through the pipe.
        //NOTE: For simplicity's sake, we assume that our printing works.
        //    In the real world, it might not write everything, etc.
        //We could use `write()`, but this way is easier.
        dprintf(pipe_fds[1], "Daddy, I'm alive.\n");

        //We're done writing. Close write end of the pipe.
        //This is the wise thing to do, but it would get closed anyways.
        close(pipe_fds[1]);

        //Now that we've let Pops know that we're alive...
        exit(EXIT_SUCCESS);
        }

     else if (cpid > 0) {
        char buf[BUFLEN] = {};
        int bytes_read = 0;

        //close *our* write end of the pipe. Important!
        //Comment this out and watch your program hang.
        //Again, check out `man 7 pipe`.
        close(pipe_fds[1]);

        //read data from pipe until we reach EOF
        while ((bytes_read = read(pipe_fds[0], buf, BUFLEN - 1)) > 0) {
            //null terminate our string.
            //(We could use snprintf instead...)
            buf[bytes_read] = '\0';

            //You can comment this out to prove to yourself that
            //we're the one printing the child's message.
            printf("%s", buf);
            }

        //close read end of pipe
        close(pipe_fds[0]);

        //wait for our child to terminate.
        wait(NULL);

        printf("I proudly parented 1 child.\n");
        }

     return 0;
     }

As you can see, I just gave a small tutorial on two of the concepts you need to know to finish your assignment. I need some sleep, so I'll leave it at that for tonight.
Read and experiment with the examples! Notes in the comments are to help you learn.


text:
Q: Connect iPhone to multiple output devices to play music How can I output music from an iPhone to a Bluetooth speaker and at the same time output to another sound appliance where the iPhone is jacked into? Like a Bose stereo device.

A: I don't know about how a Bluetooth device would work in this context, but you can achieve what you want using WiFi and cabled connections.
1) Use an Apple Airport Express with WiFi. Streaming music and audio to a stereo system is what it is designed for.
Go to an Apple Store or other authorized Apple dealer and explain what you want to do and they can show you how it works.

2) Alternately, wire the headphone output from the iPhone into a semi-professional mixer board which was then connected to more than one amplifier and speaker device. This is equipment used by musicians for recording, and it would require some expertise to learn to use.
Here is a link to a list of small, inexpensive mixers on sale at Guitar Center.
Go to a local music store and tell them what you want to do and they can explain how to do it.

A: Currently there's no way to do this with a stock iPhone. You could try Jailbreaking the phone and getting some 3rd party software that might allow it, but I'd recommend against that. Honestly I can't imagine Apple would ever build this functionality into iOS. There are ways to accomplish this in code, but I don't think Apple would approve an app that attempted to do this.
There is a 3rd party app by Rogue Amoeba called AirFoil that lets you send audio from an iOS device to multiple outputs. It doesn't do it in the way you described, but it does get the job done.
AirFoil by Rogue Amoeba

A: Use an out board sender/receiver unit. Plugs via 3.5mm ear phone jack. Unit on phone on send mode lasts from 7-10 hrs on a charge via micro USB, sending its Bluetooth signal to another of the same unit. Other unit is switched to receive and changes signal back to RCA red and white for amp... Works well up around 7 meters
Audio Dongle
http://www.jaycar.com.au/productView.asp?ID=AA2085

A: Use the
Thonet and Vander Multi-Room Bluetooth Audio Hub Router | Connect 22 Bluetooth Devices Simultaneously | 1000 Ft Range | Powered by Cassia
Cassia makes a Bluetooth hub. You can find it at Staples or Amazon.

A: If you are trying to share to iOS devices check out:
Audibly
https://itunes.apple.com/us/app/audibly-make-your-music-heard./id882170258?mt=8


text:
Q: Apparently NULL is not known in included files I'm facing a strange problem:
I have a main starting with:
#include <stdlib.h>     /* this defines NULL */
#include <stdio.h>      /* ditto */
#include <fcntl.h>
#include <ctype.h>      /* ditto */
#include <unistd.h>     /* ditto */

#include <linux/input.h>

#include <string.h>     /* ditto */
#include <sys/ioctl.h>

#include "parse.h"

... but in the included file:
#define NULL ((void*)0)  /* I need this! */

struct parse_key {
    char *name;
    unsigned int value;
} keynames[] = {
    {"KEY_RESERVED", 0},
    {"KEY_ESC", 1},
    {"KEY_1", 2},
    {"KEY_2", 3},
    ...
    {"KEY_MAX", 0x2ff},
    {NULL, 0}
};

I need to redefine NULL, otherwise I get the error:" error: 'NULL' undeclared here (not in a function)".
Note: NULL is defined in main file; if I try to #define it I get: "warning: "NULL" redefined"
Fix is trivial, but I do not understand what's going on. Can someone shed a light?

A: Do not redefine it.
Just include <stdlib.h> in your header files
Also do not define any functions and data in the header files. Just the types declarations, extern variables, function declarations and static inline functions if they are used in many C files.

A: Usually this issue happens when you don't include the necessary headers in the actual header file, but they get included before the header in certain compilation units.
I.e. you have your header file without the necessary #include:
// parse.h
#ifndef PARSE_H
#define PARSE_H

struct parse_key
{
    char *name;
    unsigned int value;
}

static inline void key_init(struct parse_key * pk)
{
    pk->name = NULL; // <-- you need it here
}

#endif // PARSE_H

And then you have two compilation units, but only one of them includes the appropriate header:
// something.c
#include <stdlib.h>
#include "parse.h"    // <-- preprocessor inserts this when NULL is already known

// something_else.c
#include "parse.h"    // <-- but in this case, it will not compile

The only reliable solution is to include all the necessary headers in the problematic header itself.
Since only .c files are compiled, your compiler won't care if you are missing includes in .h files, but IDEs like Visual Studio or Eclipse often show warning messages in these cases.
As a side note, this:
struct parse_key {
    char *name;
    unsigned int value;
} keynames[] = {
    {"KEY_RESERVED", 0},
    {"KEY_ESC", 1},
    {"KEY_1", 2},
    {"KEY_2", 3},
    ...
    {"KEY_MAX", 0x2ff},
    {NULL, 0}
};

is a variable which will get created in each compilation unit that includes the header file. This means that you will probably also get linker errors telling you that you have duplicate variables.

A: I agree with the previous answer, but to try to explain your problem :
if you #include stdlib.h then parse.h where NULL is (re)defined you have the redefinition because NULL is already defined in stdlib
if in an other file you #include parse.h but not stdlib.h you need to define NULL in parse.h else it is not defined
if you really want to use NULL in parse.h you need to #include stdlib inside, but for me the best way is to not use NULL

A: Macro redefinition is incorrect here. NULL is a name reserved by these headers, and defining it before the inclusion of a header that defines it invokes undefined behaviour.
It is preferable to include the minimal needed headers in your own headers.
If NULL and types like size_t are all that you need, do include only <stddef.h>.

A: NULL is defined in the <stddef.h> library.


text:
Q: Summation of special binomial series $\lim _{n \rightarrow \infty} \sum_{r=1}^{n}\left(\begin{array}{c}2 r \\ r\end{array}\right)\left(\frac{1}{6}\right)^{r}$
I have a feeling that this will be solved using some standard series but I cannot get around which series to use.

A: Hint
$$ \sum_{r=0}^{\infty}\left(\begin{array}{c}2 r \\ r\end{array}\right)x^{r}=\frac{1}{\sqrt{1-4 x}}$$


text:
Q: Read files by folder in R I was trying to read all files in a folder using R, but I always got an error such like that:
>folder<-"/Volumes/cphg/projects/PROVIDE/freeze" #working directory
>filelist<-list.files(folder) #all files in the directory
>data<-vector("list", length(filelist)) #empty list
>names(data)<-filelist
>for (name in filelist) {
+           data[[name]]<-read.table(paste(folder, name, sep="/"), header=T)
+}
Error in read.table(file = file, header = header, sep = sep, quote = quote,  :
  no lines available in input

Does any body know what' wrong here and how to fix it?

A: You can use tryCatch and return NULL if reading the file fails.  Then you can Filter the results to exclude the NULLs
L <- setNames(lapply(filelist, function(x) {
  tryCatch(read.table(file.path(folder, name)), error=function(e) NULL)
}), filelist)
data <- Filter(NROW, L)

A: Just to make it clear... and to close the question properly
The problem is that  there is at least one file empty. Check the file name when it through the error.


text:
Q: Internal style sheet being over riden by external css declared earlier in html doc Im playing around with the front end of a site using the new bootstrap 3.0 and im fine tuning things by irritating in firebug, but there is something odd that i keep noticing
even though my <head> is layed out like this
<link rel="stylesheet" href="bootstrap.css">

<style>
 td {padding:0px;}
<style>

With the external css being declared before the internal (which im only using during development) the external styles are still over riding them.
To get the padding:0px; to work i need to set it as padding:0px !important;
Any ideas why this is.. i thought that the last declared peice of css would always override conflicting previously declared css.

A: CSS precedence is about !important, origin (user vs browser), specificity and then order. Here is a good explanation.


text:
Q: webpack + octicons: how to handle/ignore "main": "readme.md" in package.json How do you tell webpack to ignore the main property of the package.json when it's invalid/unnecessary?
Here's an example: GitHub's octicons package has a readme.md for a main:
{
  "name": "octicons",
  "version": "3.5.0",
  "description": "GitHub's icon font",
  "main": "README.md",  <-------------------------------------
  "repository": {
    "type": "git",
    "url": "https://github.com/github/octicons.git"
  },
  ...
}

https://github.com/github/octicons/blob/master/package.json#L5
Causes this error:
ERROR in ./~/octicons/README.md
Module parse failed: C:\repos\foo\node_modules\octicons\README.md Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '#' (1:0)
    at Parser.pp.raise (C:\repos\foo\node_modules\acorn\dist\acorn.js:920:13)
    at Parser.pp.getTokenFromCode (C:\repos\foo\node_modules\acorn\dist\acorn.js:2813:8)
    at Parser.pp.readToken (C:\repos\foo\node_modules\acorn\dist\acorn.js:2508:15)
    at Parser.pp.nextToken (C:\repos\foo\node_modules\acorn\dist\acorn.js:2500:71)
    at Parser.parse (C:\repos\foo\node_modules\acorn\dist\acorn.js:1615:10)
    at Object.parse (C:\repos\foo\node_modules\acorn\dist\acorn.js:882:44)
    at Parser.parse (C:\repos\foo\node_modules\webpack\lib\Parser.js:902:15)
    at DependenciesBlock.<anonymous> (C:\repos\foo\node_modules\webpack\lib\NormalModule.js:104:16)
    at DependenciesBlock.onModuleBuild (C:\repos\foo\node_modules\webpack-core\lib\NormalModuleMixin.js:31
0:10)
    at nextLoader (C:\repos\foo\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)
 @ ./src ^\.\/.*$

The octicons package is referenced in only one spot- my main.js (entry point):
import '../node_modules/octicons/octicons/octicons.css';

A: I'm not sure if this is the correct solution but it gets me past the error.  If someone posts a better solution I'll gladly accept and upvote.
Install the null-loader: npm install --save null-loader
Send all .md files to the null loader:
webpack.config
  ...
  module: {
    loaders: [
      ...
      { test: /\.md$/, loader: 'null' }
    ]
  },
  ...


text:
Q: Diferencia entre un programa estructurado y uno orientado a objetos en PHP Supongamos que tenemos el mismo programa pero uno es estructurado y otro es orientado a objetos.
1.-Es mucha la diferencia en cuestion de redimiento?
2.-Esta mal visto o mal hecho que se haga un sistema estructurado en estos tiempos?
Apenas me inicio en esto, gracias por su tiempo :D

A: *

*Hablar de rendimiento es bastante ambiguo, depende de el tamaño del programa que quieras realizar, si se puede realizar con relativamente pocas líneas de código ( entorno a -100 ), la estructurada es más legible y solucionable a nivel de errores que si programas orientado a objetos, además de evitar creaciones de clases y el uso de objetos, los cuales llevan normalmente, varios datos que en un programa pequeño no llegues a sacarle provecho. De lo contrario, POO es tu respuesta por su versatilidad.

*El paradigma POO es una evolución de la programación estructurada (la cuál data del 1960) y por tanto más moderna, ello no descarta que se puede sacar provecho de la programación estructurada. Sin embargo fue ideada para programas de otra época y con otra perspectiva, hoy en día cualquier lenguaje orientado a objetos o que permita esta variante relativamente, será trabajada por programadores que conocerán POO en un 99% de los casos, así que probablemente no sea muy bien recibido, además podrá mermar la usabilidad y la escalabilidad de tu código.


text:
Q: How can I manipulate discord objects? import discord
import discord.ext
from discord.ext import commands
from discord.ext.commands import Bot
import asyncio

bot=commands.Bot(command_prefix='v.')

@bot.event
async def on_ready():
    print(bot.user.name)

@bot.command(pass_context=True)
async def role(ctx):
    user_role=ctx.message.author.roles
    print(user_role)

bot.run('bot token')

I want to get the role names of the user that used the command be able to remove the command from the user, but I'm getting this response
[<discord.role.Role object at 0x067A83B0>, <discord.role.Role object at 0x067A8530>, <discord.role.Role object at 0x067A84B0>, <discord.role.Role object at 0x067A8630>]

How can I manipulate discord objects?

A: You can see all the attributes of a discord.Role object here. So you could do
@bot.command(pass_context=True)
async def role(ctx):
    user_role=ctx.message.author.roles
    for r in user_role:
        print(r.name)


text:
Q: why button click insert data twice i have this button which i add in row of data however, i only add two row of the date, when click this button it give me 4 data, each date is being inserted twice meaning date A den date B den date A and den date B, what the problem
Protected Sub Button2_Click(sender As Object, e As System.EventArgs) Handles Button2.Click
    Dim rowIndex As Integer = 0
    Dim sc As New StringCollection()
    Dim sc1 As New Date
    If ViewState("CurrentTable") IsNot Nothing Then
        Dim dtCurrentTable As DataTable = DirectCast(ViewState("CurrentTable"), DataTable)
        Dim drCurrentRow As DataRow = Nothing
        If dtCurrentTable.Rows.Count < 10 Then
            For i As Integer = 1 To dtCurrentTable.Rows.Count
                'extract the TextBox values

                Dim box5 As TextBox = DirectCast(Gridview3.Rows(rowIndex).Cells(1).FindControl("TextBox5"), TextBox)

                Dim box7 As Date = Convert.ToDateTime(box5.Text)

                Dim myConn As New SqlConnection
                Dim myCmd As New SqlCommand
                myConn.ConnectionString = ConfigurationManager.ConnectionStrings("mydatabase").ConnectionString
                Dim cmd As String
                cmd = "Insert into Date values (@date) "
                myCmd.CommandText = cmd
                myCmd.CommandType = CommandType.Text

                myCmd.Parameters.Add(New SqlParameter("@date", box7))

                myCmd.Connection = myConn
                myConn.Open()
                myCmd.ExecuteNonQuery()
                myCmd.Dispose()
                myConn.Dispose()
                rowIndex += 1
            Next

        End If
    Else
        '   lblMessage.Text = "Cannot save as there no information recorded"
        MsgBox("failed")
    End If
End Sub
<asp:GridView ID="Gridview3" runat="server" AutoGenerateColumns="False"
            Height="89px" ShowFooter="True" Width="303px">
            <Columns>
                <asp:BoundField DataField="RowNumber" HeaderText="No of Available:" />
                <asp:TemplateField HeaderText="New Date Available :">
                    <ItemTemplate>
                        <asp:TextBox ID="TextBox5" runat="server" />
                        <AjaxToolkit:CalendarExtender ID="calExtender6" runat="server"
                            Format="dd/MM/yyyy" OnClientDateSelectionChanged="CheckDateEalier"
                            TargetControlID="TextBox5" />
                    </ItemTemplate>
                    <FooterStyle Height="22px" HorizontalAlign="Right" />
                    <FooterTemplate>
                        <asp:Button ID="ButtonAdd" runat="server" onclick="ButtonAdd_Click"
                            Text="Add New Row" />
                    </FooterTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    Protected Sub ButtonAdd_Click(sender As Object, e As System.EventArgs)
    AddNewRowToGrid()
End Sub

A: You called the function twice, once when you declare "Handles Button2.Click" and second when you set the onclick="ButtonAdd_Click".
You need to choose one of the options.
Hope that's help

A: Please check in the view page. I have experienced a similar issue like this in my struts,spring,hibernate application. My action method was called twice. This is because i have give the tag for the button as submit. something like <button:submit... . Just ensure that your method is called once or twice.

A: I had a similar problem, I created another button and copied all codes of the first button and inserted behind the new button, now the problem has solved.
it worked for me.


text:
Q: How can multithreading of three or more mobile cameras be done using Python Opencv? I'm trying to connect four mobile cams using Iriun cam application but it doesn't show all the four cams' output in a single screen. Is there a way/application to get the output from four cams in a single screen and analyze them? I'm going to scan four sets of QR Codes in each cam and use the output from it for a different purpose.
I want to use multi threading of cameras because the QR Codes are placed far away from each other such that the QR Codes are not covered in a single frame of the camera.
This is the basic code for my project.
import numpy as np
import cv2
from pyzbar.pyzbar import decode

cap = cv2.VideoCapture(0)
cap.set(3,640)
cap.set(4,480)

A = ['A9', 'I2', 'I19', 'I20', 'J1', 'J2', 'J20']
B1 = set(A)

while True:
    myData=[]
    success, img = cap.read()
    for barcode in decode(img):
        myData.append(barcode.data.decode('utf-8'))

    if len(myData) == A:
     while True:
        print(myData)
        print("Authorised")
        break
    else:
        print("Not authorised")
    for barcode in decode(img):
        pts = np.array([barcode.polygon],np.int32)
        pts = pts.reshape((-1,1,2))
        cv2.polylines(img,[pts],True,(255,0,255),5)
        pts2 = barcode.rect
        #cv2.putText(img,myData,(pts2[0],pts2[1]),cv2.FONT_HERSHEY_SIMPLEX,0.9,(255,0,255),2)
    cv2.imshow('Result',img)
    cv2.waitKey(1)


text:
Q: Python popen2 function rewrite (php-mail-parsing) i try to rewrite popen2 to subprocess.Popen. And I get error.
My code:
cmd = '/usr/sbin/sendmail -t -i'
if len(sys.argv) == 3:
  cmd += " -f%s" % sys.argv[2]

# OLD CODE =======================
#(out, s) = popen2(cmd)
#s.write(data)
#s.close()
# ================================

# NEW CODE =======================

p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, close_fds=True)
(out, s) = (p.stdin, p.stdout)
s.write(data)
s.close()
sys.stdout.flush()

In apache error_log I get error:
Traceback (most recent call last):
  File "/opt/php-secure-sendmail/secure_sendmail.py", line 80, in <module>
    s.write(data)
IOError: File not open for writing
sendmail: fatal: test@serve.tld(10000): No recipient addresses found in message header
plesk sendmail[2576]: sendmail unsuccessfully finished with exitcode 75

Maybe somebody has idea how figure out this code?

A: You're trying to write on stdout which is open only for reading.
stdout contains the printed output of the new process, you must write to stdin to send it data.
popen2 is returning a tuple (stdout, stdin), that's why the commented code works.
https://docs.python.org/2/library/popen2.html
Just invert the order in your tuple and it will work:
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE, close_fds=True)
(out, s) = (p.stdout, p.stdin)
s.write(data)
s.close()
sys.stdout.flush()

A: You could use .communicate() method to pass data to the child process:
cmd = '/usr/sbin/sendmail -t -i'.split()
if len(sys.argv) > 2:
  cmd += ["-f", sys.argv[2]]
p = Popen(cmd, stdin=PIPE, close_fds=True)
p.communicate(data)

Notice that you don't need shell=True here.
I've removed stdout=PIPE because I don't see the output used in your code. If you want to suppress the output; see How to hide output of subprocess in Python 2.7.


text:
Q: CkEditor5 insertContent Function not working I am trying to use insertContent method but getting some error.
Here is my implementation

This is the editor content.

<button onclick="update()">update</button>

update method should update the editor source with given content, but I am getting an error
Error on the console:

Uncaught TypeError: e.is is not a function
      at xc.Nm (converters.js:777)
      at xc.fire (emittermixin.js:209)
      at xc. [as insertContent] (observablemixin.js:259)
      at update (ck5.html:19)
      at HTMLButtonElement.onclick (ck5.html:4)

Can anyone please help in sorting out this issue?

A: This error appears to be caused by trying to use the insertContent method to insert HTML - this method seems to expect a plain text string by default, although we can make it accept HTML with a few extra steps.
First of all, you'll need to grab the HTML Data Processor:
const htmlDP = editorInstance.data.processor;

Next you need to convert your HTML string into a viewFragment using the HTML Data Processor that we just obtained:
const viewFragment = htmlDP.toView("
Test Content
");

Last of all, we need to convert the viewFragment to a modelFragment:
const modelFragment = editorInstance.data.toModel( viewFragment );

Now we can pass the modelFragment to the insertContent method:
editorInstance.model.insertContent(modelFragment);

This should remove the error and allow the mark-up string to be inserted into the editor


text:
Q: Git reset and revert I have accidentally merged the wrong branch into master, and pushed to origin.
The problem is, that i have resetted the masterbranch to the last before commit-hash with git reset --hard xxx and also the origin with git push origin master --force but now the merge-commit is always there.
The better solution is to use git revert -m 1 <merge-commit>, but I have not :/
Now, from this state, how can i undo the merge an clear the history?
Maybe, merge again and revert!?

A: you are doing
git log --oneline

see the commits before the merge
then just reverting to that commit before merging WITHOUT any reseting!!! After push again to origin as a new commit.
Reverting means that your next snapshot would be equally the same as the one before merging, but your mistaken merge-commit will be saved in overall commits history - which is better to leave there. Avoid git reset hard as much as possible.

A: There's no need to revert anything here. You almost had the right solution, but your reset to the incorrect commit. The way to fix this is to run:
git reset --hard <pre-merge commit hash>

This will reset your master branch to the commit prior to the merge. From here, you can run:
git push origin master --force

to reset your remote master branch as you had done before. The command that you ran erroneously pointed the master branch to the merge commit hash.
For your own background knowledge, if you take a look in .git/refs/heads you'll see a list of files with the same names as your branches. The contents of these files are just the hashes of each of the commits that they point to. And that's literally all a branch is: a reference to a commit.
When you ran git reset --hard <merge commit hash>, you made the master branch (which is just this very simple reference file) point to the merge commit. By pointing it to the commit before the merge, you'll update this simple master branch reference to point to the hash of the commit before the merge.


text:
Q: How to print only a selection of the map using MapFish Printing Module? I am working on a GIS API that uses OpenLayers 2. I want to make snapshots of a selected region. For example. I draw a rectangle, and the MapFish Printing Module would print only the selected region.

I have been trying to use the bbox property, but I get the wrong image, i.e., instead of a rectangle near Lisbon, I get a rectangle with south Europe and North/Center Africa.
Here are my print options:
var printOptions = {
    units: 'm',
    srs: 'EPSG:900913',
    layout: options.layout,
    dpi: '300',
    mapTitle: options.mapTitle,
    comment: options.comment,
    layers: [
        {
            baseURL: 'http://a.tile.openstreetmap.org/',
            opacity: 1,
            singleTile: false,
            type: 'OSM',
            maxExtent: [-20037508.3392, -20037508.3392, 20037508.3392, 20037508.3392],
            tileSize: [256, 256],
            extension: 'png',
            resolutions: [156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135]
        }
    ],
    pages: [
        {
            bbox: [-1050091.8944356, -990623.88643799, 4675576.582525099, 4733515.8499572]
        }
    ]
};

I am assuming that the bbox array is defined like this: [minX, maxX, minY, maxY].
Is this correct?

I managed to make it work using Thomas B's answer.
I draw a box, I get the bounds of it, and then I get the BBOX value in an array, like this:
var printBbox = geometry.getBounds().toArray();

And the, in the printing module definitions, I do this:
pages: [
    {
        bbox: printBbox
    }
]

A: "Normally" the bbox should be:
left, bottom, right, top
west, south, east, north
minX, minY, maxX, maxY
so I would try:
bbox: [-1050091.8944356, 4675576.582525099, -990623.88643799, 4733515.8499572]

PS: there is a nice BBOX-Cheatsheet:
https://github.com/perrygeo/bbox-cheatsheet/blob/master/reference.md
Even if OpenLayers/Geoserver is missing there I think it can be helpful sometimes.


text:
Q: How to Give int-string-int Input as Parameter for Matlab's Matrix? I would like to have short-hand form about many parameters which I just need to keep fixed in Matlab 2016a because I need them in many places, causing many errors in managing them separately.
Code where the signal is 15x60x3 in dimensions
signal( 1:1 + windowWidth/4, 1:1 + windowWidth,: );

Its pseudocode
videoParams = 1:1 + windowWidth/4, 1:1 + windowWidth,: ;
signal( videoParams );

where you cannot write videoParams as string but should I think write ":" as string and everything else as integers.
There should be some way to do the pseudocode.
Output of 1:size(signal,3) is 3 so it gives 1:3. I do not get it how this would replace : in the pseudocode.
Extension for horcler's code as function
function videoParams = fix(k, windowWidth)
videoParams = {k:k + windowWidth/4, k:k + windowWidth};
end

Test call signal( fix(1,windowWidth){:}, : ) but still unsuccessful giving the error

()-indexing must appear last in an index expression.

so I am not sure if such a function is possible.

How can you make such a int-string-int input for the matrix?

A: This can be accomplished via comma-separated lists:
signal = rand(15,60,3); % Create random data
windowWidth = 2;
videoParams = {1:1+windowWidth/4, 1:1+windowWidth, 1:size(signal,3)};

Then use the comma-separated list as such:
signal(videoParams{:})

which is equivalent to
signal(1:1+windowWidth/4, 1:1+windowWidth, 1:size(signal,3))

or
signal(1:1+windowWidth/4, 1:1+windowWidth, :)

The colon operator by itself is shorthand for the entirety of a dimension. However, it is only applicable in a direct context. The following is meaningless (and invalid code) as the enclosing cell has no defined size for its third element:
videoParams = {1:1+windowWidth/4, 1:1+windowWidth, :};

To work around this, you could of course use:
videoParams = {1:1+windowWidth/4, 1:1+windowWidth};
signal(videoParams{:},:)


text:
Q: Weird dots underneath the Related section Not sure if this is browser related and not fixable.
I'm using Firefox 3.6.13.
Screen resolution 1680 x 1050.
When I scroll to bottom of the window, then back to top then down to the bottom I get a series of ' and . underneath the Related section. They disappear if I resize the window or use Fireshot.
I am getting this on most questions unless the Related section is very long.
The question in the image below is this one.

A: Adding this as an answer so I can post a picture. The screenshot is from this question.
I have no clue what's causing this, but it seems that as you scroll down the page, the pattern is static, then when you get nearer to the bottom, it scrolls with the page.
I tried selecting one to see if it's part of a text element, but it doesn't get put into a selection at all.

Linked and related questions (the screenshots overlap a bit):


text:
Q: How do I make a deb in windows? I need too install a broadcom sta wireless driver and since the internet doesn't work without it I figured I'll have to make a deb.
How can I make a .deb in windows precisely?

A: It is not advised to do this as many things can go wrong, as fossfredom said it's much better installing broadcom via offline method.
Although if you really need there are two ways, the reliable one, although it spends more time, and the fast one, although not the most reliable:
Use a Virtual Machine
Reliable method
Install Ubuntu on a Virtual Machine, if don't know how to do it, see This Guide.
Then just create your .deb, if don't know how to do it, see This Guide.
Use PyPackager
Fast method
Download PyPackager and then create the .deb file using it, if in doubt see This Page.

See that if you are not familiar to creating .deb files it will be very complicated, difficult and frustrating accomplishing what you want to.
If you don't feel very confident about creating .deb files you shouldn't opt for the Fast method.
In addition I guess that if you try to install your drivers in a LiveUSB (it can´t be a CD/DVD, and the LiveUSB needs to be created with some space to store changes made) and then install Ubuntu through the LiveUSB you will have your drivers installed easily, but it´s just a shot, not sure if it would work.


text:
Q: How do I find the bounds of this particular integral? I want to convert this integral to Polar Coordinates to solve it: $\int_{0}^{2}\int_{0}^{\sqrt{y}}4xy^{2} \, dx \, dy$
What would be the bounds of $r$ and $\theta$ be?
I know how to solve the integral and all, and I also know how to generally find the bounds but I have been at it for more than an hour and tried every permutation on Wolfram Alpha, but I can't seem to find the correct bounds.
If someone could help me that would be awesome.
P.S. I know this integral is easier calculated using Cartesian Coordinates, I was just curious about how to do it using Polar Coordinates.

A: We can see that our region of integration is given by $D = \{\,(x,y) \mid 0 \le x \le \sqrt{y}, y \in [0,2]\,\}$.
We can partition this region into disjoint subregions $D_1 = \{\,(x,y) \mid \frac{\sqrt{2}}{2}y \le x \le \sqrt{y}, y \in [0,2]\,\}$ and $D_2 = \{\,(x,y) \mid 0 \le x \le \frac{\sqrt{2}y}{2}, y \in [0,2]\,\}$.
Then, for $D_1$, our polar region of integration will be such that $x \le \sqrt{y}\,$:
$$x \le \sqrt{y} \, \longrightarrow \, r^2\cos^2 \theta \le r\sin \theta \, \longrightarrow \, r \le \frac{\sin \theta}{\cos^2 \theta} = \tan{(\theta)} \sec{(\theta)}$$
And $\frac{\sqrt{2}}{2}y \le x\,$:
$$\frac{\sqrt{2}}{2}y \le x \, \longrightarrow \, \frac{y}{x} \le \sqrt{2} \, \longrightarrow\, \theta \le \arctan{(\sqrt{2})}$$
Thus, in polar coordinates, we have ${D_1}' = \{\, (r, \theta) \mid 0 \le r \le \tan{(\theta)} \sec{(\theta)}, \theta \in [0,\arctan{(\sqrt{2})}]\,\}$
For $D_2$, we have $y \le 2\,$:
$$y \le 2 \, \longrightarrow \, r \sin \theta \le 2 \, \longrightarrow \, r \le 2 \csc \theta$$
Thus, in polar coordinates, we have ${D_2}' = \{\,(r, \theta) \mid 0 \le r \le 2\csc \theta, \theta \in [\arctan{(\sqrt{2})}, \frac{\pi}{2}]\,\}$.
And so, finally,
$$\begin{aligned}\int_{0}^{2}{\int_{0}^{\sqrt{y}}{4xy^{2} \, \mathrm{d}x} \, \mathrm{d}y} &= 4\int_0^{\arctan{(\sqrt{2})}}{\int_0^{\tan{(\theta)} \sec{(\theta)}}{r^4 \cos{(\theta)}\sin^2{(\theta)} \, \mathrm{d}r} \, \mathrm{d}\theta}\\ &+4\int_{\arctan{(\sqrt{2})}}^{\frac{\pi}{2}}{\int_0^{2 \csc\theta}{r^4 \cos{(\theta)}\sin^2{(\theta)} \, \mathrm{d}r} \, \mathrm{d}\theta} \end{aligned}$$
Alternatively, you could define a function $\rho \colon [0,\frac{\pi}{2}] \to \mathbb{R}$ by
$$\rho(\theta) = \begin{cases}\tan{(\theta)}\sec{(\theta)}, &\theta \in [0, \arctan{(\sqrt{2})}[\\
2\csc \theta, & \theta \in [\arctan{(\sqrt{2})}, \frac{\pi}{2}] \end{cases}$$
And then rewrite the integral as
$$=4\int_0^{\frac{\pi}{2}}{\int_0^{\rho{(\theta)}}{r^4 \cos{(\theta)}\sin^2{(\theta)} \, \mathrm{d}r} \, \mathrm{d}\theta}$$


text:
Q: Android JSON crashes NetworkOnMainThreadException I have my project, everything is great, but there is one problem. I gave my app to friend, to test it. Then she said that it crashes. We found out that app crashes here:
            isInternetPresent = cd
            isInternetPresent = cd.isConnectingToInternet();

            if (isInternetPresent) {

                JSONParser jParser = new JSONParser();

                JSONObject json = jParser
                        .getJSONFromUrl(CONTROL_URL);

                try {
                    control = json.getInt("value");

                } catch (JSONException e) {
                    // TODO Auto-generated catch
                    // block
                    e.printStackTrace();
                }

                if (control == 1) {
                        new AttemptLogin().execute();

                } else {
                    //I'm showing something when there is not allow to use it
                }
            } else {
                //I'm showing something when there is no Internet connection
            }

And my class for sending values to database:
class AttemptLogin extends AsyncTask<String, String, String> {

        @Override
        protected void onPostExecute(String file_url) {
            // TODO Auto-generated method stub
            super.onPostExecute(file_url);
            pDialog.dismiss();

        }

        @Override
        protected String doInBackground(String... args) {
            // TODO Auto-generated method stub
            position += 1;
            String pos = position.toString();

            int success;
            try {
                List<NameValuePair> params = new ArrayList<NameValuePair>();
                params.add(new BasicNameValuePair("pos", pos));

                JSONObject json = jsonParser.makeHttpRequest(VOTE_URL, "POST",
                        params);

                success = json.getInt(TAG_SUCCESS);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub
            super.onPreExecute();
            pDialog = new ProgressDialog(Dalyvis.this);
            pDialog.setMessage("Siunčiame balsą...");
            pDialog.setIndeterminate(false);
            pDialog.setCancelable(true);
            pDialog.show();

        }

    }

I don't know why, but for emulator everything was great. I really know that my friend have internet connection. Could anyone help me?
EDIT:
I guess exception is a NetworkOnMainThreadException. Because later, I had first getting control value and then checking if device has internet connection. I replaced it. Then at first was check for internet connection and then for control value. For emulator everything was okay. Check my previous question and the right answer: JSON can't get Int value from php
In fact my app crashes here:
                isInternetPresent = cd.isConnectingToInternet();
                if (isInternetPresent) {
                    JSONParser jParser = new JSONParser();
                    JSONObject json = jParser.getJSONFromUrl(CONTROL_URL);

                    try {
                        control = json.getInt("value");

                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }


text:
Q: Image of a subgroup under the projection to the projective general linear group is isomorphic to the group quotiented by its centre Let $(V,\rho)$ be a finite, irreducible representation of a finite group $G$, where $V$ is a finite-dimensional vector space. So:
$$
\rho: G \to \textrm{GL}(V)
$$
is a homomorphism.
Let $Z(V)$ denote the centre of $\textrm{GL}(V)$, and define the projective general linear group as the quotient:
$$
\textrm{PGL}(V) = \textrm{GL}(V)/Z(V)
$$
and the corresponding canonical projection:
$$
\pi: \textrm{GL}(V) \to \textrm{PGL}(V).
$$
I want to show that, if $Z(\rho(G))$ is the centre of $\rho(G) < \textrm{GL}(V)$, then:
$$
\pi(\rho(G)) \cong \rho(G)/Z(\rho(G)).
$$
I have been told that this follows immediately from Schur's lemma, but I do not see how.
I suppose that by arguing by induction on the order of $G$, we could assume that $\rho$ is faithful, so that we have $\rho(G)/Z(\rho(G)) \cong G/Z(G)$.
As the centre of the group is Abelian, it would follow from Schur's lemma that the restriction of $\rho$ to $Z(G)$ is the sum of irreducible degree 1 characters, but I do not see how this applies to the above.
All help would be highly appreciated.

A: I'll make a try. From first isom. theorem we have $$\pi(\rho(G))\cong \rho(G)/ker\pi|_{\rho(G)}$$
It suffies to show that $ker\pi|_{\rho(G)}=Z(\rho(G))$. It is $$ker\pi|_{\rho(G)}=\{\rho(g)\in \rho(G)|\ \rho(g)\in Z(V)\}=\\ =\{\rho(g)\in \rho(G)|\ \rho(g)=k\cdot Id\}=\\=Z(\rho(G))$$
where the second equality folllows from Schur's Lemma.


text:
Q: how do I do global substitutions? In vsvim for visual studio, I can highlight a selection and type :s/hello/world/g to get all occurrences of hello inside my selection with world but this isn't working in VsCode Vim, is this a feature not in this version of vim or is the special key sequence different?

A: After selecting some lines and pressing : you should find that the Vim command line has been defaulted to '<,'> - this is a Vim range that refers to the selected lines. You need to keep this range as part of the command and type the s/... afterwards i.e.
:'<,'>s/hello/world/g

or if you just want to replace all occurrences across the whole file you can skip highlighting the lines and use the % range which indicates the whole file:
:%s/hello/world/g

If curious, you can learn more about some of the other ranges that can be used.


text:
Q: rack session resets/expires Currently I am using enable :sessions for my sinatra webserver. But I need to move into a memory based session management
When I use Rack::Session::Pool, it runs although my session seems to expire on page reload, or even on a new Ajax Call being made.

A: If you are using Passenger or one of the other webservers, it's because a new thread gets created.  If you reload on your page quickly you'll probably get expired sessions with a new thread being created (it's in memory on a specific webserver thread)
If you reload your page slowly it shouldn't expire the session because your still on the same webserver thread.

A: Nick is correct about the threading issue that Passenger brings to light.
Redis is a great in-memory solution. It is incredibly lightweight. You can find out more here: http://redis.io/.
I use the Redis adapter for Rack::Session.
You can find more about it here: http://redis-store.org/redis-rack/
It is pretty easy. Just include gem redis-rack in your Gemfile and do this in your sinatra app
require 'redis-rack'
disable :sessions
use Rack::Session::Redis


text:
Q: Forwarding display in batch context I have Linux compute server A on which I would like to execute an application, say HV (I use this HV application to render a CAE model and capture the image). Eventhough I run this HV in batch mode, from putty terminal, it requires X windows. That is I need to run Xming and forward the display from server A, else it exits with error "No valid fonts - exiting". (In this case I am connecting to server A from my windows laptop using putty)
Instead of using Xming, the workaround I use is Xvfb. This works great in 90% of the cases. In the remaining 10% cases, few of the objects are not rendered in the captured image file.
Is there any alternate to Xvfb. There are few mention on net about Xdummy, but not much details. Or, it there any way to pass the relevant font, without forwarding the display?
My actual use case is, I have web application running on another Linux server, let us call it Server B. When I trigger the event from the client browser, the Server B connects to Linux Server A via ssh and executes the HV application. Even in this scenario, I tried ssh -X instead of just ssh for the connection between B and A. Still the application is exiting error "No valid fonts - exiting" if I don't use Xvfb.

A: We had the similar issue with xvfb not working consistent and contacted the vendor, their suggestion was to upgrade graphics drivers to the latest version. It did the trick. Xvfb created consistent  size images.
Thanks,
anony


text:
Q: Deconvolution to extract the latent kernel Suppose  A * X = B is a full-convolution; therefore, if matrix A is N x N and matrix X is M x M, matrix B must be (N+M-1) x (N+M-1). I do know A and B, but not X; so I would like to find it.
Since deconvolution by Fourier transform wants all involved matrices to be of same size, we pad A with zeros to become (N+M-1) x (N+M-1).
This is easily done in Python,
import numpy as np
from numpy.fft import fft2, ifft2

shape = B.shape
X_pre = ifft2(fft2(B, shape) / fft2(A, shape)).real

X = X_pre[:??, :??] # what do I put here to extract the latent kernel X?

The problem is that the size of X_pre is (N+M-1) x (N+M-1), but I would like to get X which is of size M x M. Knowing that M is much smaller than N, how would I extract the latent kernel X?
Thanks in advance...


text:
Q: Why do we need Tokenzier if we have Vectorizer In the ML learning textbook I am working through, it says, that for NLP we construct a feature vector from the Text via the Bag of Words model.
For that, we are using
from sklearn.feature_extraction.text import CountVectorizer
count = CountVectorizer(ngram_range=(1,1))
docs = np.array(["The sun is shining",
                 "The weather is sweet",
                 "The sun is shining and the weather is sweet"])
bag = count.fit_transform(docs)

From this we can get an array with the number of words for each Sentence and a dictionary to look up the indices of each word in this array
Now later, the book says, we also need a Tokenizer like this
def tokenizer(text):
     return text.split()

(or optional with a stemmer)
which simply takes a text, and splits it into an array, where each element contains a word.
I don't really get why we need to do this though, since if we apply the tokenizer first, we just have a long array of words, and not as in the example of the CountVectorizer, an array of sentences

A: A CountVectorizer first tokenizes the text, then count tokens. It therefore needs to have a Tokenizer, as you can see for example in sklearn.feature_extraction.text.CountVectorizer, which takes a tokenizer as argument :
class sklearn.feature_extraction.text.CountVectorizer(input=u'content',
encoding=u'utf-8', decode_error=u'strict', strip_accents=None,
lowercase=True, preprocessor=None, tokenizer=None, stop_words=None,
token_pattern=u'(?u)\b\w\w+\b', ngram_range=(1, 1), analyzer=u'word',
max_df=1.0, min_df=1, max_features=None, vocabulary=None, binary=False,
dtype=<type 'numpy.int64'>)


text:
Q: Which js files are required to implement jqGrid witrh subgrid I am trying to implement subgrid in jqGrid.
I added grid.subgrid.js in js lib but still in browser console I see error on console
"Uncaught TypeError: Object # has no method 'extend'"
/**
 * jqGrid extension for SubGrid Data
 * Tony Tomov tony@trirand.com
 * http://trirand.com/blog/
 * Dual licensed under the MIT and GPL licenses:
**/
"use strict";
**$.jgrid.extend({
Uncaught TypeError: Object #<Object> has no method 'extend'**
setSubGrid : function () {
    return this.each(function (){
        var $t = this, cm,