text:
Q: Could not find or load main class when running Java after a project is built using {mvn clean package} It is an IBM MQ challenge and I have applied the provided instructions, however, I faced the ClassNotFound exception after the project is built using maven.
I noticed the following line in the result of mvn clean package command
[WARNING] JAR will be empty - no content was marked for inclusion!
POM.XML
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.ibm.mq</groupId>
  <artifactId>TicketGenerator</artifactId>
  <version>1.4</version>

  <name>mq-dev-badge-sample</name>
  <url>https://github.com/ibm-messaging/mq-dev-badge-sample</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.7</maven.compiler.source>
    <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

  <dependencies>
    <!-- https://mvnrepository.com/artifact/com.ibm.mq/com.ibm.mq.allclient -->
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>com.ibm.mq.allclient</artifactId>
        <version>9.3.0.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.jms/javax.jms-api -->
    <dependency>
        <groupId>javax.jms</groupId>
        <artifactId>javax.jms-api</artifactId>
        <version>2.0.1</version>
    </dependency>

    <dependency>
        <groupId>jakarta.xml.bind</groupId>
        <artifactId>jakarta.xml.bind-api</artifactId>
        <version>3.0.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core -->
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>3.0.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->
    <dependency>
        <groupId>com.sun.xml.bind</groupId>
        <artifactId>jaxb-impl</artifactId>
        <version>3.0.0</version>
        <scope>runtime</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.sun.istack/istack-commons-runtime -->
    <dependency>
        <groupId>com.sun.istack</groupId>
        <artifactId>istack-commons-runtime</artifactId>
        <version>4.0.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/jakarta.activation/jakarta.activation-api -->
    <dependency>
        <groupId>jakarta.activation</groupId>
        <artifactId>jakarta.activation-api</artifactId>
        <version>2.0.1</version>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.7.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.2.4</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>com.ibm.mq.badge.Manager</mainClass>
                </transformer>
              </transformers>
              <filters>
                  <filter>
                      <artifact>*:*</artifact>
                      <excludes>
                          <exclude>META-INF/*.SF</exclude>
                          <exclude>META-INF/*.DSA</exclude>
                          <exclude>META-INF/*.RSA</exclude>
                      </excludes>
                  </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>

Result of mvn clean package:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.ibm.mq:TicketGenerator >---------------------
[INFO] Building mq-dev-badge-sample 1.4
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ TicketGenerator ---
[INFO] Deleting E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ TicketGenerator ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ TicketGenerator ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ TicketGenerator ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ TicketGenerator ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ TicketGenerator ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) @ TicketGenerator ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target\TicketGenerator-1.4.jar
[INFO]
[INFO] --- maven-shade-plugin:3.2.4:shade (default) @ TicketGenerator ---
[INFO] Including com.ibm.mq:com.ibm.mq.allclient:jar:9.3.0.0 in the shaded jar.
[INFO] Including org.bouncycastle:bcprov-jdk15to18:jar:1.71 in the shaded jar.
[INFO] Including org.bouncycastle:bcpkix-jdk15to18:jar:1.71 in the shaded jar.
[INFO] Including org.bouncycastle:bcutil-jdk15to18:jar:1.71 in the shaded jar.
[INFO] Including org.json:json:jar:20220320 in the shaded jar.
[INFO] Including javax.jms:javax.jms-api:jar:2.0.1 in the shaded jar.
[INFO] Including jakarta.xml.bind:jakarta.xml.bind-api:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.activation:jakarta.activation:jar:2.0.0 in the shaded jar.
[INFO] Including org.glassfish.jaxb:jaxb-core:jar:3.0.0 in the shaded jar.
[INFO] Including org.glassfish.jaxb:txw2:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.xml.bind:jaxb-impl:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.xml.bind:jaxb-core:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.istack:istack-commons-runtime:jar:4.0.1 in the shaded jar.
[INFO] Including jakarta.activation:jakarta.activation-api:jar:2.0.1 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] TicketGenerator-1.4.jar, bcpkix-jdk15to18-1.71.jar, bcprov-jdk15to18-1.71.jar, bcutil-jdk15to18-1.71.jar, com.ibm.mq.allclient-9.3.0.0.jar, istack-commons-runtime-4.0.1.jar, jakarta.activation-2.0.0.jar, jakarta.activation-api-2.0.1.jar, jakarta.xml.bind-api-3.0.0.jar, javax.jms-api-2.0.1.jar, jaxb-core-3.0.0.jar, jaxb-core-3.0.0.jar, jaxb-impl-3.0.0.jar, json-20220320.jar, txw2-3.0.0.jar define 1 overlapping resource:
[WARNING]   - META-INF/MANIFEST.MF
[WARNING] istack-commons-runtime-4.0.1.jar, jakarta.activation-2.0.0.jar, jakarta.activation-api-2.0.1.jar, jakarta.xml.bind-api-3.0.0.jar, jaxb-core-3.0.0.jar, jaxb-core-3.0.0.jar, jaxb-impl-3.0.0.jar, txw2-3.0.0.jar define 2 overlapping resources:
[WARNING]   - META-INF/LICENSE.md
[WARNING]   - META-INF/NOTICE.md
[WARNING] jakarta.activation-2.0.0.jar, jakarta.activation-api-2.0.1.jar define 31 overlapping classes:
[WARNING]   - jakarta.activation.ActivationDataFlavor
[WARNING]   - jakarta.activation.CommandInfo
[WARNING]   - jakarta.activation.CommandInfo$Beans
[WARNING]   - jakarta.activation.CommandInfo$Beans$1
[WARNING]   - jakarta.activation.CommandMap
[WARNING]   - jakarta.activation.CommandObject
[WARNING]   - jakarta.activation.DataContentHandler
[WARNING]   - jakarta.activation.DataContentHandlerFactory
[WARNING]   - jakarta.activation.DataHandler
[WARNING]   - jakarta.activation.DataHandler$1
[WARNING]   - 21 more...
[WARNING] jaxb-core-3.0.0.jar, jaxb-core-3.0.0.jar define 128 overlapping classes and resources:
[WARNING]   - META-INF.versions.9.org.glassfish.jaxb.core.StackHelper
[WARNING]   - META-INF/maven/org.glassfish.jaxb/jaxb-core/pom.properties
[WARNING]   - META-INF/maven/org.glassfish.jaxb/jaxb-core/pom.xml
[WARNING]   - org.glassfish.jaxb.core.Locatable
[WARNING]   - org.glassfish.jaxb.core.StackHelper
[WARNING]   - org.glassfish.jaxb.core.Utils
[WARNING]   - org.glassfish.jaxb.core.WhiteSpaceProcessor
[WARNING]   - org.glassfish.jaxb.core.annotation.OverrideAnnotationOf
[WARNING]   - org.glassfish.jaxb.core.annotation.XmlIsSet
[WARNING]   - org.glassfish.jaxb.core.annotation.XmlLocation
[WARNING]   - 118 more...
[WARNING] jaxb-core-3.0.0.jar, txw2-3.0.0.jar define 55 overlapping classes and resources:
[WARNING]   - META-INF/maven/org.glassfish.jaxb/txw2/pom.properties
[WARNING]   - META-INF/maven/org.glassfish.jaxb/txw2/pom.xml
[WARNING]   - com.sun.xml.txw2.Attribute
[WARNING]   - com.sun.xml.txw2.Cdata
[WARNING]   - com.sun.xml.txw2.Comment
[WARNING]   - com.sun.xml.txw2.ContainerElement
[WARNING]   - com.sun.xml.txw2.Content
[WARNING]   - com.sun.xml.txw2.ContentVisitor
[WARNING]   - com.sun.xml.txw2.DatatypeWriter
[WARNING]   - com.sun.xml.txw2.DatatypeWriter$1
[WARNING]   - 45 more...
[WARNING] istack-commons-runtime-4.0.1.jar, jaxb-core-3.0.0.jar define 25 overlapping classes and resources:
[WARNING]   - META-INF.versions.9.com.sun.istack.logging.StackHelper
[WARNING]   - META-INF/maven/com.sun.istack/istack-commons-runtime/pom.properties
[WARNING]   - META-INF/maven/com.sun.istack/istack-commons-runtime/pom.xml
[WARNING]   - com.sun.istack.Builder
[WARNING]   - com.sun.istack.ByteArrayDataSource
[WARNING]   - com.sun.istack.FinalArrayList
[WARNING]   - com.sun.istack.FragmentContentHandler
[WARNING]   - com.sun.istack.Interned
[WARNING]   - com.sun.istack.NotNull
[WARNING]   - com.sun.istack.Nullable
[WARNING]   - 15 more...
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target\TicketGenerator-1.4.jar with E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target\TicketGenerator-1.4-shaded.jar
[INFO] Dependency-reduced POM written at: E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\dependency-reduced-pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.547 s
[INFO] Finished at: 2022-08-12T00:20:42+03:00
[INFO] ------------------------------------------------------------------------

Result of IBM Instructed java -cp target\TicketGenerator-1.4.jar; com.ibm.mq.badge.Manager
Error: Could not find or load main class com.ibm.mq.badge.Manager
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.badge.Manager

Please advise folks

A: As suggested by @slindenau,  I removed the link files and moved the com folder into src/main/java and run mvn and the JAR file is build successfully and java application worked fine.


text:
Q: why can't I open a windows azure media services account in north america? Does anyone know why the only region options for creating a Windows Azure Media Services are: Southeast Asia; East Asia; Japan West?  I am in the US and would like to pick the region I am in.

A: Please open a support ticket to enable additional regions.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How did we first discover oxygen exists as $\rm O_2$ and not just $\rm O$? How did we first discover oxygen exists as $\rm O_2$ and not just $\rm O$ ? (similarly hydrogen as $\rm H_2$ and not $\rm H$)
I vaguely remember knowing a story about how the chemical formula of water can be calculated.
This is quick. Doing electrolysis, we see two kinds of gases. One gas occupies twice the volume of the other gas. Assuming any gas occupying the same volume contains the same number of molecules, we conclude that the chemical formula of water is $\rm H_2O$.

Suppose hydrogen exists as $H$ and oxygen exists as $O$. To reverse above experiment, we can think of taking $1L$ oxygen and $2L$ hydrogen :
$$O+2H\rightarrow H_2O $$
I don't see anything wrong with above equation and electrolysis seem to confirm above equation, so I'm tempted to conclude that hydrogen exists as $H$ and oxygen as $O$. What am I missing ?


text:
Q: How to bind Selected Value of dropdown to my model with angularjs I want to Bind Dropdown selected countryId to my class CountryId and Selected Stateid Value to StateId using angularjs.
My Country and State Dropdown has been loaded successfully.
This is my Model:
public partial class Friends
    {
        public int Id { get; set; }
        public string firstname { get; set; }
        public string lastname { get; set; }
        public string address { get; set; }
        public string postalcode { get; set; }
        public string notes { get; set; }
        public Nullable<int> CountryId { get; set; }
        public Nullable<int> StateId { get; set; }
    }

This is my View:
 <select data-ng-model="newfriend.country2" data-ng-options="c as c.Name for c in allItems" data-ng-change="">
                <option value="">-- Select Country --</option>
            </select>

            <label>State:</label>
            <select data-ng-model="newfriend.state2" data-ng-disabled="!newfriend.country2" data-ng-options="s.Id as s.Name for s in newfriend.country2.State">
                <option value="">-- Select State --</option>
            </select>

This is my controller method to get both Country State in one method:
public JsonResult GetCountryState()
        {
            var Data = db.Country.Select
                                (
                                    d => new CountryModel
                                    {
                                        Id = d.Id,
                                        Name = d.Name,
                                        State = d.State.Select
                                        (
                                             x => new StateModel
                                             {
                                                 Id = x.Id,
                                                 Name = x.Name
                                             }
                                        ).ToList()
                                    }
                                ).ToList();
            return Json(Data, JsonRequestBehavior.AllowGet);
        }

This is my call to Add Controller method:
$http.post('../Home/AddFriends', this.newfriend).success(function (data) {}

My Controller Method in which i want to bind my values to FriendsModel):
 public ActionResult AddFriends(Friends FriendsModel)
        {
         }

Can anybody help me???

A: I have a created a basic plunker
http://plnkr.co/edit/Wylq6UOuh7XBV7aX7OAL?p=preview
$scope.states=[{id:1,name:'state1'}, {id:2,name:'state2'}, {id:3,name:'state3'}, {id:4,name:'state4'}]

<select data-ng-model="selectedState">
  <option data-ng-repeat="state in states" value="{{state.id}}">{{state.name}}</option>
</select>

Initialise the selectedState in your controller fo eg: $scope.selectedState =1; this will make state1 as default selected option.


text:
Q: Word for Majboor - A person who is forced to do something because of the circumstances. We use "majboor" in Hindi to describe such a person.
Google says that "helpless" means unable to defend oneself or to act without help.
Is that the word for the same or there  is something else?

A: I can't think of a word to describe a third person in this situation. We do have expressions that people use when they find themselves in such a situation, to excuse their behavior. I might say, "my hands are tied" to mean that I must perform my duties whether I want to or not. I also might say "I have no choice" to indicate the same thing.

A: Somebody in such a position might be said to be constrained or under straitened circumstances, the latter particular if operating under financial restrictions.
Dictionary.com  defines constrained as:

constrained
  [kuh n-streynd]
  adjective

*

*forced, compelled, or obliged:
  a constrained confession.

*stiff or unnatural; uneasy or embarrassed:
  a constrained manner.

and Merriam-Webster defines straiten as:

straiten
  [streyt-n]
  verb (used with object)

*

*to put into difficulties, especially financial ones:
  His obligations had straitened him.

*to restrict in range, extent, amount, pecuniary means, etc:
  Poverty straitens one's way of living.

*Archaic.
  to make narrow.
  to confine within narrow limits.

A: I have found two words for describing such a situation.
If I have to perform a task which I personally find against my will but the situation and the circumstances demand it to be performed or the law or morality demands me to do it
I would express it by saying
I was compelled to do so.
or
I was obligated to do so.

A: Predetermined, predestined could be acceptable.


text:
Q: Using Shopware "Add to shopping cart" button in plugin I'm writing a custom plugin for Shopware 5.
How do I display the "Add to shopping cart" button on a page for an arbitrary article?
Currently I'm fetching some existing articles directly from the database. I then assign these articles to a custom frontend tpl file (which extends a default tpl file). Now I want the button to be displayed for one of these fetched articles.
I found the smarty block that holds the button (frontend_detail_buy_button in themes/Frontend/Bare/frontend/detail/buy.tpl), but I don't know how to extend/change it to my needs.
My Shopware version is 5.2.8.

A: Not sure, I right understand your question, but in case you need to add add to cart button you need to transfer full sAddToBasket form.
<form name="sAddToBasket" method="post" action="{url controller=checkout action=addArticle}" class="buybox--form" data-add-article="true" data-showOverlay="false" data-eventName="submit"{if $theme.offcanvasCart} data-showModal="false" data-addArticleUrl="{url controller=checkout action=ajaxAddArticleCart}"{/if}>
{if $sArticle.sConfigurator&&$sArticle.sConfiguratorSettings.type==3}
    {foreach $sArticle.sConfigurator as $group}
        <input type="hidden" name="group[{$group.groupID}]" value="{$group.selected_value}"/>
    {/foreach}
{/if}

<input type="hidden" name="sActionIdentifier" value="{$sUniqueRand}"/>
<input type="hidden" name="sAddAccessories" id="sAddAccessories" value=""/>

<input type="hidden" name="sAdd" value="{$sArticle.ordernumber}"/>

{$sCountConfigurator=$sArticle.sConfigurator|@count}

{if (!isset($sArticle.active) || $sArticle.active)}
    {if $sArticle.isAvailable}
        <div class="buybox--button-container block-group{if $NotifyHideBasket && $sArticle.notification && $sArticle.instock <= 0} is--hidden{/if}">

                {$maxQuantity=$sArticle.maxpurchase+1}
                {if $sArticle.laststock && $sArticle.instock < $sArticle.maxpurchase}
                    {$maxQuantity=$sArticle.instock+1}
                {/if}

                <select name="sQuantity" class="quantity--select">
                    {section name="i" start=$sArticle.minpurchase loop=$maxQuantity step=$sArticle.purchasesteps}
                        <option value="{$smarty.section.i.index}">{$smarty.section.i.index}{if $sArticle.packunit} {$sArticle.packunit}{/if}</option>
                    {/section}
                </select>

            {* "Buy now" button *}
            {if $sArticle.sConfigurator && !$activeConfiguratorSelection}
                <button class="buybox--button block btn is--disabled is--icon-right is--large" disabled="disabled" aria-disabled="true" name="{s name="DetailBuyActionAdd"}{/s}"{if $buy_box_display} style="{$buy_box_display}"{/if}>
                    {s name="DetailBuyActionAdd"}In den Warenkorb{/s}
                </button>
            {else}
                <button class="buybox--button block btn is--primary is--icon-right is--center is--large" name="{s name="DetailBuyActionAdd"}{/s}"{if $buy_box_display} style="{$buy_box_display}"{/if}>
                    {s name="DetailBuyActionAdd"}In den Warenkorb{/s}
                </button>
            {/if}

    {/if}
{/if}
</form>

You can see how it work on real site there.
Depends of your needs you can use sAddAccessories and sAddAccessoriesQuantity inputs for add the list of products to basket, example you can see there.
In case you can show your site I can provide to you more suitable solution for your case. Don't forget about configurator and variations when you will apply custom add to cart button.
I hope you deems this answer helpful.

A: I'm not sure if i understand it right, but you can look on the detail page how shopware add an article to the basket. Than change sBasket with s article. shopware use severals parameters.
For extending use:
{extends file="parent:frontend/detail/index.tpl"}

With {$smarty.block.parent} inside a block, will fill the Block on your Plugin template with there Default content.
P.d.: Sorry for my english


text:
Q: SSL and 401.3 on IIS 7.5 I have an asp.net 4 site running on IIS 7.5.
If I browse to the home page using http it works fine. However, when I browse to the same page using https I get a 401.3 error. Using fiddler 2 I can see that the 401.3 error is being returned when the server tries to access this such as the CSS file and images which are held in sub directories of the website root.
I have the wesbite configure to run under a new app pool, which is configured to run under a Windows account. I've checked this account has access to the website root and all sub directories
I don't have much experience of SSL. Can anyone please explain what'd going wrong here.
Many thanks,
Rob

A: Turns out this wasn't related to ssl. I need to edit the "Anonymous user identity" to the Application pool identity rather than the default specific user of IUSR


text:
Q: How do you add an include directory to Go/LiteIDE? I'm attempting to use LiteIDE to run the program:
// cudatest
package cudatest

import (
    "fmt"
    "github.com/barnex/cuda5/cu"
)

func main() {
    fmt.Println("Hello, your GPU is:", cu.Device(0).Name())
}

All I get is:
c:/go/bin/go.exe build -i [C:/godev]
# github.com/barnex/cuda5/cu
c:\GoDev\src\github.com\barnex\cuda5\cu\context.go:5:18: fatal error: cuda.h: No such file or directory
//#include <cuda.h>
           ^
compilation terminated.
Error: process exited with code 2.

I have the latest CUDA SDK from NVIDIA installed.  What do I need to do in order to make the Go compiler see it?

A: It looks like your C compiler doesn't know what directory has the cuda header file. You can tell go to give the C compiler extra options using the CGO_CPPFLAGS environment variable. You probably want to set it to something like
CGO_CPPFLAGS="-isystem /path/to/dir/with/cuda/header/in/it"

See https://golang.org/cmd/cgo/


text:
Q: Resize buttons styled with AppBarButtonStyle I like the AppBarButtonStyle idea of using font character as button icon because of its scaling abilities, but it is of no use if i cannot resize them properly.
Changing Width or Height of button does not work, because AppBarButtonStyle only resizes padding between button icon and button borders. Changing FontSize of button does not work either.
Is there any way of resizing buttons styled with AppBarButtonStyle in WinRT application? I dont mind if i have to override or modify AppBarButtonStyle, as long as it preserves the ability to use font character as button icon.
Any useful advices will be appreciated!

A: You can easily create your own custom button from AppBarButtonStyle from the original in the standardstyles.xaml .
I did so to create a custom smaller button with no text and the only hard part was aligning everything: you're not adding shapes, you're adding a character, so it may not be as aligned as you think. Default Buttons contain 3 charatctes: outline, fill and glyph.
If you want, I can share my simplified code for the control.


text:
Q: Getting error when changing a dropdown box for second time So I have two dropdown boxes and the first dropdown box response is being generated at loading of the page and the second dropdown responce is generated on changing of the first dropdown response

    <select name="country_city" class="inputbox" required ng-model="frm.country_city" ng-change="state_city()">
        <option ng-repeat="country in country_city track by $index" value="{{country.id}}">{{country.name}}</option>
    </select>

    <select name="state_city" class="inputbox" required ng-model="frm.state_city">
        <option ng-repeat="state in state_city track by $index" value="{{state.id}}">{{state.name}}</option>
    </select>

$scope.state_city = function() {
    console.log("in state city");
    $scope.frm.country_city;
    $http.get(url, {
        params: {
            action: 'get_state_city',
            country_id: $scope.frm.country_city
        }
    }).success(function(data, status, headers, config, jsonp) {
        $scope.state_city= data;
        console.log($scope.state_city);
    });
};

The problem is that when I change the response of the first dropdown box for a second time it gives me an error. The images are to help. The third image shows the error

The images show the selection of india country and Maharastra state as response but when selecting USA just to change the response  give the error

A: The problem is your scope function name and scope variable name are same:
$scope.state_city = function() {
    console.log("in state city");
    $scope.frm.country_city;
    $http.get(url, {
        params: {
            action: 'get_state_city',
            country_id: $scope.frm.country_city
        }
    }).success(function(data, status, headers, config, jsonp) {
        $scope.state_city= data; => Issue is here
        console.log($scope.state_city);
    });
};

You are creating a function $scope.state_city() and then inside your success function you are doing this $scope.state_city= data;, from the next time your state_city become a variable with response data and no more a function.

A: Try changing to:
 $scope.change_state_city = function() {
            $http.get(url, {
            params: {
                action: 'get_state_city',
                country_id: $scope.frm.country_city
            }
        }).success(function(data, status, headers, config, jsonp) {
            $scope.state_city= data;
            console.log($scope.state_city);
        });
    };

    <select name="country_city" class="inputbox" required ng-model="frm.country_city" ng-change="change_state_city()">
        <option ng-repeat="country in country_city track by $index" value="{{country.id}}">{{country.name}}</option>
    </select>

    <select name="state_city" class="inputbox" required ng-model="frm.state_city">
        <option ng-repeat="state in state_city track by $index" value="{{state.id}}">{{state.name}}</option>
    </select>


text:
Q: i don't know how to access to my drupal website ubuntu I don't know much about Drupal and Drush, but I followed all the instructions and  i was able to put a Drupal project on one of my  servers. The problem now is that I don't know how to access
to the Drupal WebSite.
Does it have a Port number that I should put after localhost or is there another way ??

A: A simple youtube/google search came up with this, walk through this 15 min tutorial and you should have Drupal and Nginx set up correctly.

A: Look in your HTTP-Server settings on which ports the server is listening.
Example on nginx-server: /etc/nginx/nginx.conf
You can check and find listening ports:
shell:
netstat -nal | grep LISTEN

tcp46      0      0  *.443         *.*              LISTEN
tcp46      0      0  *.80          *.*              LISTEN


text:
Q: UML Sequence Diagram Occurrence Count So I ran into a multiple-choice question about sequence diagrams, where one has to count the number of occurrences.
You will find in the attached image a diagram. The question is how many occurrences are there in the following Sequence Diagram?
In any case, in no way I of counting do I get to the desired result of 14 (12 is what I get ;) ) and I wonder which type of occurrence I may be missing.
Does anybody have the clarity to deliver a detailed analysis?

(from UML 2.5.1)

A: Soo. Hopefully this will help somebody in the future. I asked around everywhere and found somebody with an explanation that fits the answer 14.

*

*Every execution (vertical rectangles) has a start and end occurrence. There are three executions -> 3*2 = 6

*Every message (or function call) also has 2 occurrences: A send and receive occurrence. We count 4 calls, each with a send and return -> 4 * 2 = 8

*Summing up: 6+8 = 14


text:
Q: Why do I get "Usage: JSON::XS::new(klass)" error? This line
my $json = new JSON(autoconv => 0);  # <-- line X
raises this error
Usage: JSON::XS::new(klass) at (...) line X

What's wrong?
It's a follow up to my question Is there a way to force quotation of numbers in JSON 1.x Perl module?

A: The API for the JSON module changed substantially between 1.15 and 2.00.  Code written for JSON 1.x won't necessarily work with JSON 2.x.  In particular, the 1.x constructor took optional parameters.  The 2.x constructor takes no parameters; instead, you use mutator functions after construction.
If you must support both JSON 1.x and 2.x for some reason, you'll need to check if JSON->VERSION < 2 (actually JSON->VERSION < 1.99 if you count the development releases of the 2.x API) and have two versions of your code, one for the 1.x API and one for 2.x.

A: Try:
my $json = JSON::XS->new;

I don't see any autoconv anywhere in either JSON or JSON::XS, but JSON does say this:

$JSON::AUTOCONVERT
Needless. JSON backend modules have the round-trip integrity.


text:
Q: Помогите спарсить этот xml в android Есть такой xml файл. Как его можно спарсить?
<ArrayOfProduct
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://schemas.datacontract.org/2004/07/ApiSolution.Data.Entity">
    <Product>
        <Id>2</Id>
        <Name>Iphone</Name>
        <Price>30</Price>
        <Qty>3</Qty>
    </Product>
    <Product>
        <Id>3</Id>
        <Name>Samsung</Name>
        <Price>12</Price>
        <Qty>4</Qty>
    </Product>
    <Product>
        <Id>4</Id>
        <Name>LG</Name>
        <Price>21</Price>
        <Qty>7</Qty>
    </Product>
</ArrayOfProduct>

A: DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
InputSource inputSource = new InputSource();
inputSource.setCharacterStream(new StringReader(xml));
Document doc = builder.parse(inputSource);

NodeList nList = doc.getElementsByTagName("Product");
Log.d("TAG", "----------------------------");
    for (int i = 0; i < nList.getLength(); i++) {
        Node nNode = nList.item(i);

        Log.d("TAG", "\nCurrent Element :" + nNode.getNodeName());

        if (nNode.getNodeType() == Node.ELEMENT_NODE) {
            Element eElement = (Element) nNode;
            Log.d("TAG", "Id: " + eElement.getElementsByTagName("Id").item(0).getTextContent());
            Log.d("TAG", "Name: " + eElement.getElementsByTagName("Name").item(0).getTextContent());
            Log.d("TAG", "Price: " + eElement.getElementsByTagName("Price").item(0).getTextContent());
            Log.d("TAG", "Qty: " + eElement.getElementsByTagName("Qty").item(0).getTextContent());
         }
     }


text:
Q: Linq - How to store "where condition" in variable its possible to store Where condition in this linq statement in variable?
Func<NutritionValues, bool> condition;
if (isBarcode)
   condition = f => f.barcode == name;
else
   condition = f => f.food == name;

var foods = context.NutritionValues.Where(condition).
                                    Select(f => new SerializableFood
                                    {
                                         Name = f.food,
                                         Calories = f.energy_kcal,
                                         Carbohydrates = f.carbohydrates,
                                         Fats = f.fats,
                                         Proteins = f.protiens
                                    });

Condition is 100% right. If I write condition f => f.barcode == name directly into the Where function it works, but this way not. This code return empty set. Please, do you know why?

A: You're probably using LINQ to SQL or something similar.
You should change your variable to an Expression<Func<NutritionValues, bool>>; this will allow the query provider to parse your condition.

A: Oh my, there could be a lot going on here. First, you should type condition as an Expression<Func<NutritionValues, bool>>. This will let your query provider parse it properly.
Second, you're capturing a variable (name) and if you modify the value of that variable between the time of capture and the time that the query is actually executed (note that the query is not executed until you iterate over foods, it has not been executed in any of the code that you've shown us), you will see different results than you might expect. For more on this topic, see Closing over the loop variable considered harmful.


text:
Q: Yarn shows more resources than cluster have I start an EMR cluster with 3 m3.xlarge instance (1 master & 2 slaves) and i have some troubles.
From aws documentation a m3.xlarge instance has 4 vcpu ( https://aws.amazon.com/ec2/instance-types/ ) . What does it means? This means 4 threads or 4 core with 2 thread each core? I ask you that, because when i open hadoop UI(port 8088) appear to be 8 available vcore per instances, but from what i experienced, cluster behave like a 2 instances with 4 vcore per instances. Am i wrong? Or it's a bug from Amazon or yarn?

A: The value 8 vcores comes from the default Yarn property
<property>
    <name>yarn.nodemanager.resource.cpu-vcores</name>
    <value>8</value>
    <description>Number of vcores that can be allocated for containers. This is used by the RM scheduler when allocating resources for containers. This is not used to limit the number of physical cores used by YARN containers.</description>
</property>

Though it is defined to an higher value than the actual number of vcores in the instance, the containers will be created based on the number of vcores   actually available per nodemanager instance.
Modify the value of this property in yarn-site.xml as per the instance vcores.


text:
Q: Show positivity of a function of two variables in the unit square. Let $$
f(x,y) =  x^3 (1 + y + y^2) + y^2 \Big[x^2  (5 + 2 y) + x  (-6 - 4 y + y^2) +  (1 + 3 y + y^2)\Big]
$$
Show that $f(x,y) \ge 0 $ for $0\le x \le 1$ and $0\le y \le 1$.
Numerical evaluations seem to support the claim.  This is a cubic function in $x$ with one negative coefficient in the linear term, all other coefficients are positive. Since $f(x=0) > 0$, the last two terms guarantee positivity for  $0 < x < 1/6$. The last three terms show a quadratic function which has its minimum always for $x^* \in [0 \quad 1]$,  namely at $x^* = \frac{6 + 4 y - y^2}{10 + 4 y }$ ; however, for small $y$, the value of the sum of the three last terms is negative at $x^*$. How to continue?

A: The global minimum of $f$ in the compact set $D=\{(x,y): 0\leq x\leq 1, 0 \leq y \leq 1\}$ will be attained in a stationary point in the interior of $D$ or in a boundary point.
The only stationary point in the interior of $D$ is the point $(0,0)$ and, regarding the boundary,
$$
f(x,0) = x^3 \ge 0, \quad 0\leq x\leq 1$$
$$
f(0,y) = y^2 \left(y^2+3 y+1\right) \ge 0, \quad 0\le y \leq 1
$$
$$
f(x,1) = 3 x^3+7 x^2-9 x+5 \ge 0, \quad 0 \leq x \leq 1
$$
$$
f(1,y)=\left(2 y^2+y\right) y^2+y^2+y+1 \ge 0, \quad 0\leq y \leq 1.
$$
This shows that $f(x,y) \ge 0$ on $D$.
Notes:

*

*It is not trivial to show that $(0,0)$ is the only stationary point in the interior of $D$.

*You still need to solve the one dimensional problems in each portion of the boundary of $D$.

*This way you can also conclude that $f(x,y)\leq 6$ on $D$.

A: We have
\begin{align*}
 f &= (x+1)y^4 + (2x^2 - 4x + 3)y^3 + (x^3 + 5x^2 - 6x + 1)y^2 + x^3y + x^3\\
 &\ge (x+1)y^4 + (2x^2 - 4x + 3)y^4 + (x^3 + 5x^2 - 6x + 1)y^2 + x^3y^2 + x^4 \tag{1}\\
 &= (2x^2 - 3x + 4)y^4 + (2x^3 + 5x^2 - 6x + 1)y^2 + x^4\\
 &\ge (2-x)^2 y^4 + (2x^3 + 5x^2 - 6x + 1)y^2 + x^4\tag{2}\\
 &\ge 2\sqrt{(2-x)^2y^4\cdot x^4} + (2x^3 + 5x^2 - 6x + 1)y^2\tag{3}\\
 &= y^2(3x-1)^2\\
 &\ge 0.
\end{align*}
Explanations:
(1): $(2x^2 - 4x + 3)y^3 \ge (2x^2 - 4x + 3)y^4$ and $x^3y \ge x^3y^2$ and $x^3 \ge x^4$.
(2): $2x^2-3x+4 \ge (2-x)^2$.
(3): AM-GM.


text:
Q: Background image resizing when the mobile browser's address bar is toggled I have a cover with a background image:

CSS:
#cover {
  height: calc(60vh - 50px);
  height: calc(var(--cover-height, 60vh) - 50px);
  background: url("");
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
}

There is a problem on mobile browsers when the address bar is hidden or shown. The background images resizes, I suppose because of the cover size trying to fill in the added/removed space but it creates a really awkward jump effect.
I have tried this and this. Neither worked. The background image still jumps. I'm testing this on Android Google Chrome.
I tried my own solution, which didn't work neither:
let vh = window.innerHeight * 0.6;
document.documentElement.style.setProperty('--cover-height', `${vh}px`);

The idea is to calculate the initial height in pixels and set the cover's height to that fixed value so it doesn't change again, that way the background image wouldn't get resized. Well, for some reason I cannot figure out it just doesn't work. The jump effect remains.


text:
Q: How i can get value from Edit control from other form MFC file DoAnMFC.h
public:
    CString user;
    CString pass;
    bool isAdmin;
    bool isLogin;
    afx_msg void OnBnClickedLoginBtn();
    afx_msg void OnBnClickedCancleBtn();
    afx_msg void showwithAdmin();
    afx_msg void showwithEmployee();
    afx_msg void ghiLog();
    afx_msg bool CheckLogin(CString username,CString password);
    CListCtrl m_ListControl;
    CEdit m_EditControl;
    afx_msg void OnSystemChangepassword();
    afx_msg void OnSystemExit();
    afx_msg void OnToolsCreateaccount();
    afx_msg void OnToolsEditaccount();
    afx_msg void OnToolsFindaccount();
    afx_msg void OnToolsDeleteaccount();
    CEdit m_ControlUser;
    CEdit m_ControlPassword;

This is event click a button to change Password
void ChangePassword::OnBnClickedOkBtn()
    {
        UpdateData(true);
        CDoAnMFCDlg d;
        CString loginPassword;
        d.m_ControlPassword.GetWindowText(loginPassword);
        if( d.pass.Compare(loginPassword)==0 && m_NewPassword.Compare(m_ConfirmPassword)==0 )
            {...........}
    }

How to compare data form ChangePassword with data from form DoAnFMC ? This line have result is false
d.pass.Compare(loginPassword)==0


text:
Q: Lookup table for unhashable in Python I need to create a mapping from objects of my own custom class (derived from dict) to objects of another custom class. As I see it there are two ways of doing this:

*

*I can make the objects hashable. I'm not sure how I would do this. I know I can implement __hash__() but I'm unsure how to actually calculate the hash (which should be an integer).

*Since my objects can be compared I can make a list [(myobj, myotherobj)] and then implement a lookup which finds the tuple where the first item in the tuple is the same as the lookup key. Implementing this is trivial (the number of objects is small) but I want to avoid reinventing the wheel if something like this already exists in the standard library.
It seems to me that wanting to look up unhashables would be a common problem so I assume someone has already solved this problem. Any suggestions on how to implement __hash()__ for a dict-like object or if there is some other standard way of making lookup tables of unhashables?

A: Mappings with mutable objects as keys are generally difficult. Is that really what you want? If you consider your objects to be immutable (there is no way to really enforce immutability in Python), or you know they will not be changed while they are used as keys in a mapping, you can implement your own hash-function for them in several ways. For instance, if your object only has hashable data-members, you can return the hash of a tuple of all data-members as the objects hash.
If your object is a dict-like, you can use the hash of a frozenset of all key-value-pairs.
def __hash__(self):
    return hash(frozenset(self.iteritems()))

This only works if all values are hashable. In order to save recalculations of the hashes (which would be done on every lookup), you can cache the hash-value and just recalculate it if some dirty-flag is set.

A: A simple solution seems to be to do lookup[id(myobj)] = myotherobj instead of lookup[myobj] = myotherobj. Any commente on this approach?

A: The following should work if you're not storing any additional unhashable objects in your custom class:
def __hash__(self):
    return hash(self.items())

A: Here is an implementation of a frozendict, taken from http://code.activestate.com/recipes/414283/:
class frozendict(dict):
    def _blocked_attribute(obj):
        raise AttributeError, "A frozendict cannot be modified."
    _blocked_attribute = property(_blocked_attribute)

    __delitem__ = __setitem__ = clear = _blocked_attribute
    pop = popitem = setdefault = update = _blocked_attribute

    def __new__(cls, *args):
        new = dict.__new__(cls)
        dict.__init__(new, *args)
        return new

    def __init__(self, *args):
        pass

    def __hash__(self):
        try:
            return self._cached_hash
        except AttributeError:
            h = self._cached_hash = hash(tuple(sorted(self.items())))
            return h

    def __repr__(self):
        return "frozendict(%s)" % dict.__repr__(self)

I would replace tuple(sorted(self.items())) by frozenset(self.iteritems()) as in Spacecowboy's answer.  And consider adding __slots__ = ("_cached_hash",) to the class.


text:
Q: how to get selected date from Kal control? 1- i want to get selected date from Kal control.
(https://github.com/klazuka/Kal)
i added the codes to my controller:
kal = [[KalViewController alloc] init];
kal.delegate = self;
navController = [[UINavigationController alloc] initWithRootViewController:kal];

In which event can i read the selected date?
2- i don't want to show bottom tableview, is it possible?
i just need calendar view.

A: in KalViewController.m
search for the following function:
-(void)didSelectDate:(KalDate *)date
{
self.selectedDate = [date NSDate];
NSDate *from = [[date NSDate] cc_dateByMovingToBeginningOfDay];
NSDate *to = [[date NSDate] cc_dateByMovingToEndOfDay];
[self clearTable];
[dataSource loadItemsFromDate:from toDate:to];
[tableView reloadData];
[tableView flashScrollIndicators];
}

running     NSLog(@"%@",[date NSDate]); in didSelectDate from  KalViewController.m returned the date selected from the kal calendar.
OUTPUT:
2011-11-23 14:51:00.345 xx[23467:207] 2011-11-27 08:00:00 +0000
2011-11-23 14:51:01.234 xx[23467:207] 2011-11-28 08:00:00 +0000
2011-11-23 14:51:01.728 xx[23467:207] 2011-11-27 08:00:00 +0000

A: NSLog(@"Selected date: %@",to);


text:
Q: ¿Como guardar una encuesta socioeconómica? Tengo un proyecto donde se guarda la información de una encuesta socio económica ya la tengo de esta manera

La encuesta es de 28 preguntas.
Todo funciona bien, la el gran problema que tengo es que por la gran cantidad de personas encuestadas, las consultas tardan demasiado en generarse, consulta de 500 personas tarda un aproximado de 1 minuto.
Entonces mi pregunta es como optimizar el guardado de información para que las consultas sean más rápidas.
El servidor que uso, es el de google cloud bitnami. tiene un CPU y 1.7GB de RAM. en las estadísticas no consume ni el 10% de CPU.
este es el resultado de la consulta explain

Esta es la consulta sql
SELECT
    usuario.id_usuario,
    usuario.usuario,
    usuario.nombre,
    usuario.apellido_paterno,
    usuario.apellido_materno,
    usuario.genero,
    catalogo_usuario_rol.id AS id_rol,
    catalogo_usuario_rol.nombre AS nombre_rol,
    usuario_informacion.calle,
    usuario_informacion.num_ext,
    usuario_informacion.num_int,
    usuario_informacion.calle2,
    usuario_informacion.referencia,
    usuario_informacion.telefono_fijo,
    usuario_informacion.celular,
    usuario_informacion.cp,
    usuario_informacion.fecha_nacimiento,
    usuario_informacion.entidad_nacimiento,
    usuario_informacion.clave_elector,
    usuario_informacion.curp,
    usuario_informacion.ocr,
    usuario_informacion.zona,
    usuario_informacion.seccion,
    catalogo_colonias.nombre AS nombre_colonia,
    (
    SELECT
        id_subdirector
    FROM
        relacion_coordinador_zona
    WHERE
        id_coordinador_zona = usuario.id_usuario
) AS id_subdirector,
(
    SELECT
        id_coordinador_zona
    FROM
        relacion_liderer_activo
    WHERE
        id_lider_activo = usuario.id_usuario
) AS id_coordinador_zona,
(
    SELECT
        id_lider_activo
    FROM
        relacion_ciudadano_activo
    WHERE
        id_ciudadano_activo = usuario.id_usuario
) AS id_lider_activo,
(
    SELECT
        id_ciudadano_activo
    FROM
        relacion_beneficiario
    WHERE
        id_beneficiario = usuario.id_usuario
) AS id_ciudadano_activo,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Personas migrantes" WHEN respuesta = 2 THEN "Sexualidad" WHEN respuesta = 3 THEN "Salud" WHEN respuesta = 4 THEN "Madre / Padre soltero(A)" WHEN respuesta = 5 THEN "Comunidades indigenas" WHEN respuesta = 6 THEN "Adulto Mayor" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 1
) AS p1,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Soltero" WHEN respuesta = 2 THEN "Casado" WHEN respuesta = 3 THEN "Unión libre" WHEN respuesta = 4 THEN "Viudo" WHEN respuesta = 5 THEN "Separado" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 2
) AS p2,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Analfabeta" WHEN respuesta = 2 THEN "Primaria" WHEN respuesta = 3 THEN "Secundaria" WHEN respuesta = 4 THEN "Preparatoria" WHEN respuesta = 5 THEN "Carrera técnica" WHEN respuesta = 6 THEN "Licenciatura" WHEN respuesta = 7 THEN "Maestría" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 3
) AS p3,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Empleado sector privado" WHEN respuesta = 2 THEN "Empleado gobierno municipal" WHEN respuesta = 3 THEN "Gobierno estatal" WHEN respuesta = 4 THEN "Gobierno federal" WHEN respuesta = 5 THEN "Obrero" WHEN respuesta = 6 THEN "Secretaria" WHEN respuesta = 7 THEN "Negocio propio" WHEN respuesta = 8 THEN "Comerciante / Ventas" WHEN respuesta = 9 THEN "Desempleado" WHEN respuesta = 10 THEN "Agrcolas/Pecuarias" WHEN respuesta = 11 THEN "Artesano" WHEN respuesta = 12 THEN "Hogar" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 4
) AS p4,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Si" WHEN respuesta = 2 THEN "No" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 5
) AS p5,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 6
) AS p6,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Mayor a 1500" WHEN respuesta = 2 THEN "Menor a 1500" ELSE ""
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 7
) AS p7,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 8
) AS p8,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Si" WHEN respuesta = 2 THEN "No" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 9
) AS p9,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 10
) AS p10,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "IMMS" WHEN respuesta = 2 THEN "ISSEMYM" WHEN respuesta = 3 THEN "ISSSTE" WHEN respuesta = 4 THEN "Seguro popular" WHEN respuesta = 5 THEN "Servicio particular" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 11
) AS p11,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 12
) AS p12,
(
    SELECT
        GROUP_CONCAT(
            (
                CASE WHEN respuesta = 1 THEN "Afore" WHEN respuesta = 2 THEN "Aguinaldo" WHEN respuesta = 3 THEN "Infonavit" WHEN respuesta = 4 THEN "Prima vacacional" WHEN respuesta = 5 THEN "Pensión" WHEN respuesta = 6 THEN "Seguro de vida" WHEN respuesta = 7 THEN "Vacaciones" ELSE "Error de captura"
            END
        )
)
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 13
) AS p13,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 14
) AS p14,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 15
) AS p15,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Si" WHEN respuesta = 2 THEN "No" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 16
) AS p16,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Agricola" WHEN respuesta = 2 THEN "Asentamiento irregular" WHEN respuesta = 3 THEN "Residencia" WHEN respuesta = 4 THEN "Rural" WHEN respuesta = 5 THEN "Semi rural" WHEN respuesta = 6 THEN "Urbana" WHEN respuesta = 7 THEN "Semi urbana" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 17
) AS p17,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Compartida" WHEN respuesta = 2 THEN "Familiar" WHEN respuesta = 3 THEN "Prestada" WHEN respuesta = 4 THEN "Propia" WHEN respuesta = 5 THEN "Rentada" WHEN respuesta = 6 THEN "Otro" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 18
) AS p18,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 19
) AS p19,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 20
) AS p20,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Adobe" WHEN respuesta = 2 THEN "Cemento" WHEN respuesta = 3 THEN "Lamina" WHEN respuesta = 4 THEN "Madera" WHEN respuesta = 5 THEN "Loseta" WHEN respuesta = 6 THEN "Piedra" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 21
) AS p21,
(
    SELECT
        GROUP_CONCAT(
            (
                CASE WHEN respuesta = 1 THEN "Agua potable" WHEN respuesta = 2 THEN "Drenaje" WHEN respuesta = 3 THEN "Gas" WHEN respuesta = 4 THEN "Internet" WHEN respuesta = 5 THEN "Cable TV" WHEN respuesta = 6 THEN "Teléfono fijo" WHEN respuesta = 7 THEN "Seguridad (Alarmas, cámaras)" WHEN respuesta = 8 THEN "Luz electrica" WHEN respuesta = 9 THEN "Alumbrado público" WHEN respuesta = 10 THEN "Transporte publico" WHEN respuesta = 11 THEN "Recolección de basura" WHEN respuesta = 12 THEN "Otro" ELSE "Error de captura"
            END
        )
)
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 22
) AS p22,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 23
) AS p23,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Si" WHEN respuesta = 2 THEN "No" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 24
) AS p24,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 25
) AS p25,
(
    SELECT CASE WHEN
        respuesta = 1 THEN "Si" WHEN respuesta = 2 THEN "No" ELSE "Error de captura"
END AS respuesta2
FROM
    usuario_encuesta_socioeconomica
WHERE
    id_usuario = usuario.id_usuario AND pregunta = 26
) AS p26,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 27
) AS p27,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 28
) AS p28,
(
    SELECT
        respuesta
    FROM
        usuario_encuesta_socioeconomica
    WHERE
        id_usuario = usuario.id_usuario AND pregunta = 29
) AS p29
FROM
    usuario
JOIN usuario_informacion ON usuario.id_usuario = usuario_informacion.id_usuario
JOIN catalogo_colonias ON usuario_informacion.colonia = catalogo_colonias.id
JOIN catalogo_usuario_rol ON usuario.rol = catalogo_usuario_rol.id
ORDER BY usuario.rol DESC;


text:
Q: $k^{\text{th}}$ maxima of $n$ i.i.d chi-square random variables I am trying to study the asymptotic behavior of $k^{th}$ order statistic of $n$ i.i.d chi-square distribution. Let $X_1, \cdots , X_n$ be i.i.d $\chi^2_1$ random variables and $X_{(k:n)}$ be the $k^{th}$ order statistic of these random variables. I do know that,
$$
\frac{X_{(n:n)}}{\log n} \overset{p}{\to} 2\; \text{as $n \to \infty$}.
$$
But now I am interested in studying the behavior of $X_{(k:n)}$ where $\frac{k}{n}\to 1$ as $n \to \infty$. My conjecture is that,
$$
\frac{X_{(k:n)}}{\log n} \overset{p}{\to} 2 \; \text{as $n \to \infty$}.
$$
My idea is to show that $P( \frac{X_{(k:n)}}{\log n} <a  ) \to 0$ if $a<2$ and $P( \frac{X_{(k:n)}}{\log n} <a  ) \to 1$ if $a>2$. Any help will be appreciated.

A: $\newcommand{\ep}{\varepsilon}
\newcommand{\pp}{\overset p\to}$Let $Y_k:=X_{(k:n)}$, where $n-1\ge k\sim n$. The correct asymptotics for $Y_k$ is as follows:
\begin{equation*}
    Y_k/l_{n,k}\pp2,\tag{1}
\end{equation*}
where
\begin{equation*}
    l_{n,k}:=\ln\frac n{n-k},
\end{equation*}
so that $l_{n,k}\to\infty$.
In particlular, if $n-k=O(n^\ep)$ for each $\ep>0$, then (1) does imply $Y_k/\ln n\pp2$.
To prove (1), note first that for all real $x>0$
\begin{equation*}
    P(Y_k\le x)=P(N_x\le n-k),\tag{1.5}
\end{equation*}
where
\begin{equation*}
    N_x:=\sum_{i=1}^n 1(X_i>x),
\end{equation*}
so that the random variable $N_x$ is binomial with parameters $n$ and
\begin{equation*}
    p:=P(X_1>x)=2(1-\Phi(\sqrt x)),
\end{equation*}
where $\Phi$ is the standard normal cdf, so that
\begin{equation*}
    p=e^{-x/(2+o(1))}\to0 \tag{2}
\end{equation*}
as $x\to\infty$.
Fix any real $a>0$. Choosing then $x=a\,l_{n,k}$ and using (2), we see that
$np<<n-k$ if $a>2$ and
$np>>n-k$ if $a<2$;
we write $A<<B$ and $B>>A$ if $A/B\to0$.
So, if $a>2$, then, by Markov's inequality,
\begin{equation*}
    P(N_x\le n-k)=1-P(N_x>n-k)\ge1-\frac{np}{n-k}\to1.
\end{equation*}
If now $a<2$, then, by Chebyshev's inequality,
\begin{equation*}
    P(N_x\le n-k)=P(N_x-np\le-(np-(n-k))
    \le\frac{np(1-p)}{(np-(n-k))^2}\sim\frac{np}{(np)^2}\to0.
\end{equation*}
So, for $x=a\,l_{n,k}$, in view of (1.5), $P(Y_k\le x)$ converges to $1$ or $0$ depending on whether $a>2$ or $a<2$. Thus, (1) is proved.

A: The behavior of the order statistics is different than you predicted: Suppose that $k=n-\ell$, where $\ell=\ell(n)$ satisfies $\ell/n \to 0$. Denote by $Z$ a standard normal variable.
Then for $b \in (0,1)$ we have
\begin{align}
P[X_{(k:n)}>2b \log(n)]
&\le {n \choose \ell} P[Z^2> 2b \log(n)]^{\ell} \\
&\le (\frac{ne}{\ell})^{\ell} \exp(-\ell b \log n) \\
&=\exp(\ell \cdot [\log (ne/\ell)-b\log n])\,,
\end{align}
which tends to zero if $\ell>n^r$ with $r>1-b$.


text:
Q: Orthogonal Eigenvector Matrices which are Symmetric What (extra) conditions must be satisfied by a real symmetric matrix, $A$, with distinct eigenvalues, so that its orthogonal matrix of eigenvectors V, can be arranged to also be symmetric? I.e. if $A^T=A=V \Lambda V^T$, where $V^{-1}=V^T$, and $\Lambda$ is a diagonal matrix of (distinct) eigenvalues, what additional condition(s) on $A$ are required so that $V=V^T$?

A: I don't think there's any special characterization of such matrices. As a rule of thumb, the "natural" properties of a matrix are those invariant under change of basis, i.e., those that can be inferred from the eigenvalues alone.


text:
Q: Deploy Apache Camel on(with or without spring boot) on wildfly server We have use case where we need to develop integration on Apache camel.
However, from deployment point of view we have Wildly server where so far we have deployed varous Java spring boot Microservices.
Also, wehave another environment where these Java spring boot service are deployed on Openshift inside JBoss EAP conatiner.
Now, quuestion is how can I deploy apache camel routes/jar in similar way on Wild fly or Joss.
Few options , I can think of but not sure hows it possible.Need technical guidance.
Options
1. Create camel jar and deploy on Widlfly- I dont know how it works.
2. Create apache camel integration using spring boot . As per documentation ,it will work . my question in how it will be deployed on widlfly or open shift.
Also, can I use spring DSL in that?


text:
Q: Publishing HTML private repository using GitLab I want to publish an HTML static website from gitlab. Is it possible? Using GitHub, I published some free websites but GitHub isn't free for private repositories.

A: Yes. There is a similar to GitHub Pages product from GitLab.
Here you can see the examples of statically generated sites using this feature.


text:
Q: Define a generator which updates global variables before the first __next__() call Given the following function in python I would like to update the global variable before calling "next()". Let me show it to you with an example.
# some script happening before

# a (global) variable is created
L = 0

def generate(batch=128, ID=0, YIND=0):

  # just a call to a global dictionary
  x_, y_ = global_dict[id_to_keys[ID]]

  # update global variable please
  global L
  L = len(x_)

  X,Y=[],[]
  counter=0

  for i,x in enumerate(x_):

    counter+=1
    X.append(x)
    Y.append(y_[i])

    if counter==batch:

      counter=0
      yield np.asarray(X[-batch:]), np.asarray(Y[-batch:])

Then you can run:
print(L)
g = generate()
print(f'I would like this to output some number but it outputs ',L)
_ = g.__next__()
print(f'I would like this to output some number and it outputs ',L)

Which outputs the following:
I would like this to output some number but it outputs 0
I would like this to output some number and it outputs 12312

Finally: please note that there is a way of doing this via a class definition that has a class variable, but I'm currently wondering for a full "functional" implementation.
Thank you for your time

A: I'm not entirely sure if I understand correctly what you are trying to do. But the thing is that a generator function in Python only starts to execute once the generator is being enumerated:
def gen():
    print('before 1')
    yield 1
    print('before 2')
    yield 2
    print('after 2')

>>> g = gen()
>>> next(g)
before 1
1
>>> next(g)
before 2
2
>>> next(g)
after 2
Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    next(g)
StopIteration

So if you want to run code before the generator is being enumerated, you cannot have that code be part of the generator function itself.
What you can do instead is to have a normal function that does something and then returns a created generator:
def gen_internal():
    yield 1
    print('before 2')
    yield 2
    print('after 2')

def gen():
    print('before 1')
    return gen_internal()

>>> g = gen()
before 1
>>> next(g)
1
>>> next(g)
before 2
2
>>> next(g)
after 2

Since you apparently only set L once, before the first yield, this might be what you want to do.


text:
Q: GKE cluster Restore for deleted backup paln I have created a backup plan for a test cluster and created a manual backup of cluster. I have restored the cluster to another cluster when cluster is alive with restore plan. when I have to test for disaster scenario, I have deleted original cluster, the backup plan associated with cluster also got deleted but backups are present.
when i tried to create a new restore plan it says only alive cluster backup plans will be selected. I have a backup of cluster but i can not restore into another cluster.
Any other solution to restore cluster with GKE Backup-restore agent in GCP in above scenario where backups are present but backup plans are not there.


text:
Q: mono - the requested feature is not implemented - what feature? I'm receiving this error when I start my application but I have NO idea what feature isn't implemented.  It doesn't print anything to the console or tell me what isn't implemented.
Is there a way to figure this out? The only thing I have to go on is this error message that appears in a window:

Interestingly enough my application does start after I click ok, but I'd like to figure out what the problem is.

A: Minimize to systray is my first guess. That wasn't implemented last time I looked.
But you might be able to find a stack trace in Windows' Event Viewer -- Application Log


text:
Q: Jasper Report Crosstab with ArrayList of Data I am trying to create Jasper Report with crosstab by writing JRXML with DTOs.
I am trying to create rows dynamic number of chargeCodes and their total. It looks something like this:

jobNo
chargeCodeA
chargeCodeB
Total

jobNoABC
100.10
300.30
400.40

jobNoDEF
200.20
400.40
600.60

In my Java backend, I have DTO which looks like this
class MyDTO {
private String jobNo;
private List <String> chargeCode = new ArrayList <> ();
private List <BigDecimal> chargeCodeTotal = new ArrayList <> ();
}

where the list codeCode contains chargeCodeA, chargeCodeB for jobNoABC
and chargeCodeTotal contains 100.10, 300.30 for jobNoABC also.
In my JRXML, I have this:
<?xml version="1.0" encoding="UTF-8"  ?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd"
        name="vendorBillingCompletedJobReport" leftMargin="5" rightMargin="5">

    <parameter name="lblJobNo" class="java.lang.String" isForPrompting="false"/>

    <field name="jobNo" class="java.lang.String"/>

    <field name="chargeCode" class="java.util.List"/>
    <field name="chargeCodeTotal" class="java.util.List"/>
  <summary>
    <band height="60">
      <crosstab>
        <reportElement width="782" y="0" x="0" height="60" />
        <rowGroup name="jobNo" width="100" totalPosition="End">
          <bucket>
            <bucketExpression class="java.util.List">
              <![CDATA[$F{jobNo}]]>
            </bucketExpression>
          </bucket>
          <crosstabRowHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <textField>
                <reportElement width="100" y="0" x="0" height="20" />
                <textElement textAlignment="Right" verticalAlignment="Middle" />
                <textFieldExpression>
                  <![CDATA[$V{jobNo}]]>
                </textFieldExpression>
              </textField>
            </cellContents>
          </crosstabRowHeader>
          <crosstabTotalRowHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <staticText>
                <reportElement x="0" y="0" width="60" height="20" />
                <textElement verticalAlignment="Middle" />
                <text>TOTAL</text>
              </staticText>
            </cellContents>
          </crosstabTotalRowHeader>
        </rowGroup>
        <columnGroup name="chargeCode" height="20" totalPosition="End">
          <bucket>
            <bucketExpression class="java.util.List">
              $F{chargeCode}
            </bucketExpression>
          </bucket>
          <crosstabColumnHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <textField isStretchWithOverflow="true">
                <reportElement width="60" y="0" x="0" height="20" />
                <textElement verticalAlignment="Bottom" />
                <textFieldExpression>
                  <![CDATA[$V{chargeCode}]]>
                </textFieldExpression>
              </textField>
            </cellContents>
          </crosstabColumnHeader>
          <crosstabTotalColumnHeader>
            <cellContents>
              <box>
                <pen lineColor="black" lineWidth="1"/>
              </box>
              <staticText>
                <reportElement width="60" y="0" x="0" height="20" />
                <textElement verticalAlignment="Bottom" />
                <text>TOTAL</text>
              </staticText>
            </cellContents>
          </crosstabTotalColumnHeader>
        </columnGroup>
        <measure name="chargeCodeTotalCount" class="java.math.BigDecimal" calculation="Sum">
          <measureExpression>$F{chargeCodeTotal}</measureExpression>
        </measure>
        <crosstabCell height="20" width="60">
          <cellContents backcolor="#FFFFFF">
            <box>
              <pen lineColor="black" lineWidth="1"/>
            </box>
            <textField>
              <reportElement x="5" y="0" width="55" height="20" />
              <textElement textAlignment="Left" verticalAlignment="Bottom" />
              <textFieldExpression class="java.math.BigDecimal">
                $V{chargeCodeTotalCount}
              </textFieldExpression>
            </textField>
          </cellContents>
        </crosstabCell>
      </crosstab>
    </band>
  </summary>
</jasperReport>

But I am getting error:

java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Comparable
at org.apache.commons.collections.comparators.ComparableComparator.compare(ComparableComparator.java:91)

I am not sure how to create infinite number of chargeCodes using JRXML.
And I cannot use Dynamic Jasper. I can only think of crosstab. Please help. Thanks.


text:
Q: When saving PDF via PyPDF2 it's making hidden layers visible while saving via PDFFileWriter() of PyPDF2 the output file has all previously hidden layers visible. Is there a possibility to delete them from file or at least still hide them?
with open(self.file.path,"rb") as f:
   inputpdf = PdfFileReader(f)
   output = PdfFileWriter()
   output.addPage(inputpdf.getPage(pagenumber))
   output.write(outputStream)

Otherwise, is there another library which supports hidden layers?
best regards

A: I dont think you there is a way to solve it with pyPDF2 can do that, it cannot remove or hide layers. you  can check out this post for more:
Remove PDF Layer(s) from PDF Using PyPDF2
Im not sure if there are any alternatives


text:
Q: How to force Unity Editor to use OpenGl single-threaded rendering I need Unity to run with single threaded Opengl rendering on Windows.  There is a command line option in the player and in the editor to do this (-force-opengl -force-gfx-direct).  However, it appears as though it is just there for developer debugging since it is only a command line option (not available in Player Settings anymore) and I need it in production.
Question 1: Is there a way to bake single threaded opengl rendering into the windows player so I don't have to create a windows shortcut to launch it?
Question 2: Any idea if this option is going to disappear soon? Given that it is no longer on the Player Settings dialog for Windows, I'm nervous that it is being deprecated...
More background on why:
I'm writing a native plugin to Unity 2019.2 that does OpenGL calls AND calls back into Unity methods that are marked as [MonoPInvokeCallback] to perform things like loading resources.
My problem is that Unity does multithreaded rendering for OpenGL by default, so you need to perform your OpenGL calls on their rendering thread (how to do that is described here).
BUT: The Unity scripting APIs throw exceptions if you access them outside of the "main unity thread" and my code needs to do things like load a resource using a MonoPInvokeCallback AND make an OpenGL call in one function. Thus the need to shut off multi-threaded rendering.


text:
Q: What does input/output error mean with Disk Utility I began trying to backup my dvd collection to an external hard drive. I do this my making disk images(.iso) from the dvds. To do this I use disk utility > new image > save as dvd/cd master. Started with some Battlestar Galactica. First 6 disks of season 1 went fine. Next 3 disks of season 2 went fine. First disk of season 2.5 I get an input/output error about 75% through the process. Any ideas?

A: Disc might be spoilt or faulty most probably. Clean the disc, enable any error-correction on your image conversion software, and give it a go again.

A: This could be a problem with the drive, or (more likely) a problem with the DVD. Perhaps there's a scratch on it, or maybe just a smudge. It's tough to say.
If you copy the files directly, you can still play it with VLC.
Also Disk Utility is not your only choice for backing up DVDs. I will point to MactheRipper or Handbrake for other options.


text:
Q: AlertDialog Builder setSingleChoiceItems from enum I have a simple AlertDialog with a setSingleChoiceItems list of two elements which works fine.
final CharSequence[] blackwhite = {"White", "Black"};

AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);

    alertDialogBuilder.setTitle("Title");
    alertDialogBuilder
            .setCancelable(false)
            .setSingleChoiceItems(blackwhite, -1,null)
            .setPositiveButton("Start", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    ListView lw = ((AlertDialog) dialog).getListView();
                    Object checkedItem = lw.getAdapter().getItem(lw.getCheckedItemPosition());

                     // Do something with checkedItem
                }
            })
            .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                }
            });

    AlertDialog alertDialog = alertDialogBuilder.create();
    alertDialog.show();

In the rest of the code, these two items actually correspond to an enum:
public enum Player {
    WHITE, BLACK
}

Is there an elegant way of using the enum directly in setSingleChoiceItems without manually converting to String/CharSequence? For instance if I later decide to change "WHITE" to "GREEN" in the enum only, this should automatically show up in the alert dialog as well.

A: You can obtain the String value of a Player using the toString() method.
Player.WHITE.toString(); // returns "WHITE"

You could do something like:
public enum Player {

  WHITE, BLACK, GREEN, PURPLE

  public static String[] getValues() {
    String[] strs = new String[Player.values().length];
    int i = 0;

    for (Player p: all)
      strs[i++] = p.toString().toLowerCase();

    return strs; // ["white", "black", "green", "purple"]
  }
}

I hope it helps!


text:
Q: Nodejs: How to use async/await when trying to rate limit number of requests to the server I am trying to use the geocode API to get the json object by limiting the number of requests to 1 per second. I need to use async/await and this is what I have
const requester = {
    lastRequest: new Date(),
    makeRequest: async (url) => {
        var timestart = new Date()
        // first check when last request was made
        var timeSinceLast = (timestart).getTime() - this.lastRequest.getTime();
        if (timeSinceLast < 1000) {
            await new Promise(resolve => setTimeout(resolve, timeSinceLast));
        }
        const response = await fetch(url);
        const json = await response.json();
        return json;
        // make request here and return result
    }
};
var requestResponse = requester.makeRequest('https://geocode.xyz/?
     locate=Warsaw,Poland&json=1')

With this I am getting the following errors:

UnhandledPromiseRejectionWarning: TypeError: Cannot read property
  'getTime' of undefined
UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
  error originated either by throwing inside of an async function
  without a catch block, or by rejecting a promise which was not handled
  with .catch(). (rejection id: 1)

I tried to find why this is happening and when just print the requester object, I don't get the gettime() undefined error. Am I using async/await and promises correctly? What am I doing wrong?
EDIT: Based on the answers below, I no longer see the error, however I see 'Request Throttled'
const requester = {
   lastRequest: new Date(),
   makeRequest: async function(url){
       var timestart = new Date()
       // first check when last request was made
       var timeSinceLast = (timestart).getTime() - this.lastRequest.getTime();
       if (timeSinceLast < 1000) {
           await new Promise(resolve => setTimeout(resolve, timeSinceLast));
       }
       const response = await fetch(url);
       const json = await response.json();
       return json;
       // make request here and return result
   }
};
requester.makeRequest('https://geocode.xyz/?locate=Warsaw,Poland&json=1')
.then(console.log)

This is what I am seeing now:
{ success: false,
 error: { code: '006', message: 'Request Throttled.' } }

Do I need to await for the response?

A: Arrow functions don't have this, so this.lastrequest.getTime is undefined.
Use a normal function instead:

const requester = {
    lastRequest: new Date(),
    makeRequest: async function(url){
        var timestart = new Date()
        // first check when last request was made
        var timeSinceLast = (timestart).getTime() - this.lastRequest.getTime();
        if (timeSinceLast < 1000) {
            await new Promise(resolve => setTimeout(resolve, timeSinceLast));
        }
        const response = await fetch(url);
        const json = await response.json();
        return json;
        // make request here and return result
    }
};
requester.makeRequest('https://geocode.xyz/?locate=Warsaw,Poland&json=1') //Don't write strings in two lines
.then(console.log)

And if you add a then(console.log), you can see the result!

A: Don't use => arrow functions inside object methods as the this is not what you think it is.
The this within the arrow function is the one that was in the current context where you defined the object, in your case it is pointing to the global object which has no lastRequest property.
That is why this.lastRequest is evaluating to undefined.
You need to replace it with an anonymous function to correctly point to the this.lastRequest property.
Also you won't get the data you want by simply returning it from the object method and assigning it to a variable as the value returned from your method is wrapped in a promise (due to the async keyword) so you need to call then on it to actually capture the data from the service.

const requester = {
    lastRequest: new Date(),
    makeRequest: async function(url) {
        var timestart = new Date();
        // first check when last request was made
        var timeSinceLast = timestart.getTime() - this.lastRequest.getTime();
        if (timeSinceLast < 1000) {
            await new Promise(resolve => setTimeout(resolve, timeSinceLast));
        }
        const response = await fetch(url);
        const json = await response.json();
        return json; //wrapped in a promise
        // make request here and return result
    }
};
var requestResponse = requester.makeRequest('https://geocode.xyz/?locate=Warsaw,Poland&json=1').then((data)=>{
   console.log(data);
})

Some resources to look at:
Arrow functions as object methods
Async function

A: According to geocode pricing options

Throttled API access is free. Rate limit: up to 1 API call per sec.  API (Throttled to no more that 1 request per second for all free port users combined. eg., if 2 free requests come at the same time, each gets throttled to 2 seconds per request).

SO this would mean that as a free user you don't have control whether the limit would be 1 second or something else.


text:
Q: How to Solve Equations with java? I have three equations like the following ones:

*

*x + y + z = 100;

*x + y - z = 50;

*x - y - z = 10;

How can I find the values of x, y, and z with Java?
String equation1="x+y+z=100;";
String equation2="x+y-z=50;";
String equation3="x-y-z=10;";

int[] SolveEquations(equation1,equation2,equation3) {
   // to do
   // how to do?
}

Do you have any possible solutions or other common frameworks?

A: you can use the java matrix package JAMA. See the full page of this example below here

/*
 *Solving three variable linear equation system
 * 3x + 2y -  z =  1 ---> Eqn(1)
 * 2x - 2y + 4z = -2 ---> Eqn(2)
 * -x + y/2-  z =  0 ---> Eqn(3)
 */
import Jama.Matrix;
import java.lang.Math.*;
public class Main {
    public Main() {
        //Creating  Arrays Representing Equations
        double[][] lhsArray = {{3, 2, -1}, {2, -2, 4}, {-1, 0.5, -1}};
        double[] rhsArray = {1, -2, 0};
        //Creating Matrix Objects with arrays
        Matrix lhs = new Matrix(lhsArray);
        Matrix rhs = new Matrix(rhsArray, 3);
        //Calculate Solved Matrix
        Matrix ans = lhs.solve(rhs);
        //Printing Answers
        System.out.println("x = " + Math.round(ans.get(0, 0)));
        System.out.println("y = " + Math.round(ans.get(1, 0)));
        System.out.println("z = " + Math.round(ans.get(2, 0)));
    }

    public static void main(String[] args) {
        new Main();
    }
}

A: You can also use Commons Math. They have a section of this in their userguide (see 3.4)

A: Create a parser using ANTLR. Then evaluate the AST using Gaussian elimination.

A: Use Gaussian_elimination it's incredibly easy, but there are some values you may have hard life calculating.
Code example

A: try this, please:
import org.apache.commons.math3.linear.*;
import org.junit.Assert;
import org.junit.Test;

/**
 * Author: Andrea Ciccotta
 */
public class LinearSystemTest extends Assert {

    /**
     * Ax = B
     * 2x + 3y - 2z = 1
     * -x + 7y + 6x = -2
     * 4x - 3y - 5z = 1
     * <p>
     * it will use the LUDecomposition:
     * LU decomposition:
     * 1. find A = LU where LUx = B
     * 2. solve Ly = B
     * 4. solve Ux = y
     */
    @Test
    public void linearSystem3x3Test() {
        final RealMatrix coefficients = new Array2DRowRealMatrix(new double[][]{{2, 3, -2}, {-1, 7, 6}, {4, -3, -5}});
        final DecompositionSolver solver = new LUDecomposition(coefficients).getSolver();

        final RealVector constants = new ArrayRealVector(new double[]{1, -2, 1}, false);
        final RealVector solution = solver.solve(constants);
        final double[] arraySolution = solution.toArray();

        assertEquals(arraySolution[0], -0.36986301369863006, 0);
        assertEquals(arraySolution[1], 0.1780821917808219, 0);
        assertEquals(arraySolution[2], -0.6027397260273972, 0);
    }

}

A: You can use determinant to calculate values of x y and z.
Logic can be found out here http://www.intmath.com/Matrices-determinants/1_Determinants.php
And then you need to implement it in java using 3 dimensional arrays.

A: Since you're writing Java, you can use the JAMA package to solve this.  I'd recommend a good LU decomposition method.
It's a simple linear algebra problem.  You should be able to solve it by hand or using something like Excel pretty easily.  Once you have that you can use the solution to test your program.
There's no guarantee, of course, that there is a solution.  If your matrix is singular, that means there is no intersection of those three lines in 3D space.

A: There are many ways to solve linear system equations. There is a simplest way to perform this. In the example the java code solve for two variables USING Matrix method  but you can modify to perform 3 variables calculations.
import java.util.Scanner; //OBJETO SCANNER

public class SYS2 {

    public static void main (String args[]) {

        //VARIABLE DECLARATION SPACE
        int i=0,j = 0;
        float x,y;
         Scanner S = new Scanner (System.in);

         int EC3[][]= new int [2][3]; //ARRAY TO STORE EQUATION 2X3

         float DET1=0;
        float DET2 =0;

        float DETA=0;
         float DETB=0;

        //END VARIABLE DECLARATIONS
       System.out.println("Enter Equation System : ");

for (i=0; i< 2; i++) {
                for (j=0; j< 3; j++)
                        EC3[i][j] = S.nextInt();
                }

                System.out.println("SISTEMA DE ECUACION LINEAL: "); //THIS SENTENCE ONLY PRINT THE CATCHED VALUES OF EQUATION

                for (i=0; i< 2; i++) {
                        for (j=0; j< 3; j++)

                              System.out.print(EC3[i][j] + "  ");

                            System.out.println();

                }

           //    System.out.print("Determinante A de la Matriz: ");

             //    System.out.print((EC3[0][2] * EC3[1][1]) - (EC3[0][1]*EC3[1][2]) );

                for (i=0;i<2;i++) {
                        for (j=0; j<2;j++)
                                DET1=  ((EC3[0][2] * EC3[1][1]) -( EC3[0][1]*EC3[1][2]));
                }

                           //    System.out.print(DET1 );
                            //       System.out.println();

                                 for (i=0;i<2;i++) {
                                        for (j=0; j<2;j++)
                                         DET2=  ((EC3[0][0] * EC3[1][1]) - (EC3[0][1]*EC3[1][0]));
                }

                               // System.out.print("Determinante B de la Matriz: ");
                               //  System.out.println(DET2 );

    x = (DET1 / DET2);

    System.out.println();
    System.out.println("X = " + x);
    System.out.print("=======================");
    //FIN PARA VALOR DE X

    //COMIENZO DE VALOR DE Y

  //  System.out.print("Determinante A de la Matriz Y: ");

                                    for (i=0;i<2;i++) {
                                            for (j=0; j<2;j++)
                                         DETA=  EC3[0][0] * EC3[1][2] - EC3[0][2]*EC3[1][0];

                                        //    System.out.print(DETA );
                                          //  System.out.println();
                }

                                     for (i=0;i<2;i++) {
                                            for (j=0; j<2;j++)
                                         DETB=  EC3[0][0] * EC3[1][1] - EC3[0][1]*EC3[1][0];

                }

                                   // System.out.print("Determinante B de la Matriz Y: ");
                                   //  System.out.println(DETB );
                                    y = DETA / DETB;

                                    System.out.print("=======================");
                                    System.out.println();

                                    System.out.println("Y = " + y);
                                    System.out.print("=======================");
    }
}


text:
Q: What happens if I replace $\ge$ by $\gt$ in limits? $\lim_\limits{x \to a}f(x)=L \ and \lim_\limits{x \to a}g(x)=K \ and  \ f(x) \ge g(x) \implies L\ge K$
What if I replace $\ge$ with $\gt$? Would it still be valid?
If no I'm looking for an example that would hold true for this.

A: No. You have to include the case of equality whenever you take limits on both sides of an inequality, regardless of whether the inequality is $>$ or $≥$.
Formally, for any $x$ in a deleted neighborhood of $a$,$$\left[f(x)> g(x) \right] \vee \left[f(x)≥g(x) \right] \Rightarrow \lim\limits_{x \to a} f(x) ≥ \lim\limits_{x \to a}g(x)$$


text:
Q: Vuejs Datepicker enable a disabled element I have 2 instances of the <date-picker>, in which the first captures the start date (starts_at) and the second captures the end date (ends_at).
As per the design I have in mind, I would like to disable the ends_at instance and then re-enable it once the starts_at has been applied.
This is my starts_at instance:
<date-picker v-model="starts_at" @input="enableEndsAt()" valueType="format"></date-picker>

This is my ends_at instance:
<date-picker id="endsAt" v-model="ends_at" disabled @input="checkDate()" valueType="format"></date-picker>

This is what I have tried so far. When you change the input, it calls the enableEndsAt() function, which looks like this:
enableEndsAt(){
  if(this.starts_at === "") {
    return
  }
  var element = document.querySelector('#endsAt')
  element.removeAttribute('disabled')
  console.log(element)
}

A: You can use disabled as a reactive property:
<date-picker id="endsAt"
     v-model="ends_at"
     :disabled="disableDatePicker"
     @input="checkDate()"
     valueType="format"></date-picker>

So, to use this, you could create a property disableDatePicker in your data declaration, and then set it inside your method:
data(){ return { disableDatePicker: false }},
...
methods: { ....
enableEndsAt(){
  if(this.starts_at === "") {
    return
  }
  this.disableDatePicker = true;
}

A: Assuming your <date-picker> can accept disabled property, you can simply bind it to a condition:
<date-picker id="endsAt" v-model="ends_at" :disabled="this.starts_at === ''" @input="checkDate()" valueType="format"></date-picker>

so you don't need to put @input="enableEndsAt()" on your starts_at date picker, and you don't need enableEndsAt() function


text:
Q: Disable external node service accessibility in docker swarm I have a docker swarm with 2 nodes and each node run 2 services in global mode so each node have 2 services running inside it. My problem is how to force ubuntu service in node1 only connect to mysql service in node1 and dont use round-robin method to select mysql service.
so when I connect to mysql from ubuntu in node1 with mysql -hmysql -uroot -p it select only mysql in node1.
here is the docker-compose file which describes my case
version: '3.8'
services:
  mysql:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: password
    networks:
      app-net: {}
    deploy:
      mode: global
  ubuntu:
    entrypoint: tail -f /dev/null
    deploy:
      mode: global
    image: ubuntu:20.04
    networks:
      app-net: {}
networks:
  app-net: {}

with this docker-compose file inside ubuntu container when I try to connect to mysql it selects mysql service in both nodes with round-robin algorithm.
 What I try to achieve is to force each service be only visible to the services inside the same node.

A: I can't think of an easy way to achieve what you want in swarm with an overlay network. However, you can use unix socket instead of network. Just create a volume, mount it both into MySQL and your application, then make MySQL to put its socket onto that volume. Docker will create a volume on each node and thus you'll have your communication closed within node.
If you insist on using network communications, you can mount node's Docker socket into your app container and use it to find name of the container running MySQL on that node. Once you got the name, you can use it to connect to the particular instance of the service. Now, not only it is hard to make, it is also an anti-pattern and a security threat, so I don't recommend you to implement this idea.
At last there is also Kubernetes, where containers inside a pod can communicate with each other via localhost but I think you won't go that far, will you?

A: You should have a look mode=host.

You can bypass the routing mesh, so that when you access the bound port on a given node, you are always accessing the instance of the service running on that node. This is referred to as host mode. There are a few things to keep in mind.

ports:
- target: 80
  published : 8080
  protocol: tcp
  mode: host

A: Unless I'm missing something, I would say you should not use global deploy and instead declare 2 ubuntu service and 2 mysql services in the compose file or deploy 2 separate stacks and in both cases use constraints to pin containers to specific node.
Example for first case would be something like this:
version: '3.8'
services:
  mysql1:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: password
    deploy:
      placement:
        constraints: [node.hostname == node1]
  mysql2:
    image: mysql:5.7
    environment:
      MYSQL_ROOT_PASSWORD: password
    deploy:
      placement:
        constraints: [node.hostname == node2]
  ubuntu1:
    entrypoint: tail -f /dev/null
    image: ubuntu:20:04
    deploy:
      placement:
        constraints: [node.hostname == node1]
  ubuntu2:
    entrypoint: tail -f /dev/null
    image: ubuntu:20:04
    deploy:
      placement:
        constraints: [node.hostname == node2]


text:
Q: Running two Test cases(method) in two same browsers using Parallel testing in TestNG Selenium I am trying to execute parallel testing in tow test cases(methods) in two same browsers.
But when I run, it opens two same browsers but the execution is performed in one browser, means two test methods executed in one browser.
BaseClass.Java
 public class BaseClass {

    public WebDriver driver;
    public FBLoginPage loginPage;

    @BeforeMethod
    public void launch() {

        WebDriverManager.chromedriver().setup();
        driver = new ChromeDriver();

        driver.manage().window().maximize();
        driver.get("http://demo.guru99.com/test/newtours/");

        loginPage = new FBLoginPage();
        PageFactory.initElements(driver, loginPage);
    }

    @AfterMethod
    public void tearDown() {
        driver.quit();
    }
}

FBLoginPage.java (Page Class)
 public class FBLoginPage {

    @FindBy(xpath = "//input[@name='userName']")
    public WebElement userName;

    @FindBy(xpath = "//input[@name='password']")
    public WebElement password;

    @FindBy(xpath = "//input[@name='submit']")
    public WebElement submitButton;

    @FindBy(xpath = "//a[normalize-space()='REGISTER']")
    public WebElement registerLink;

    public void doLogin(String uname, String pwd) throws Exception {

        Thread.sleep(2000);
        userName.sendKeys(uname);
        password.sendKeys(pwd);

        Thread.sleep(2000);
        submitButton.click();
    }

    public void clickOnRegisterLink() throws Exception {

        Thread.sleep(2000);
        registerLink.click();
    }
}

FBLoginTest.java (Test Class)
public class FBLoginTest extends BaseClass {

    @Test(priority = 1)
    public void loginTest_ValidCredential() throws Exception {

        String beforeLoginURL = driver.getCurrentUrl();
        Thread.sleep(1000);
        loginPage.doLogin("abc@gmail.com", "password");

        Thread.sleep(2000);
        String afterLoginURL = driver.getCurrentUrl();

        Assert.assertEquals(true, !(beforeLoginURL.equals(afterLoginURL)), "Login unSuccessful");
    }

    @Test(priority = 2)
    public void clickOnSecurityProject_LoginPage() throws Exception {

        String beforeLoginURL = driver.getCurrentUrl();
        loginPage.clickOnRegisterLink();

        Thread.sleep(2000);
        String afterLoginURL = driver.getCurrentUrl();

        Assert.assertEquals(true, !(beforeLoginURL.equals(afterLoginURL)), "Test case fail");
    }
}

testNG.xml
<suite name="Suite">
    <test thread-count="2" name="Test" parallel="methods">
        <classes>
            <class name="demo.TestCases.FBLoginTest" />
        </classes>
    </test>
</suite>

In the above code, when I run it through xml, then two same(chrome) browser are opening but exction is performed in one browser.
Please help me to solve this problem
Thank You


text:
Q: Mapping NetCDF CF Mercator parameters to GDAL I have coordinates on a mercator grid projection from a NetCDF (CF) file. The metadata attributes in the file include : standard_parallel, longitude_of_projection_origin, earth_shape (spherical), earth_radius.
I want to use the gdal python API to transform the coordinates into lat-long. I need to set up the mercator coordinate system which I presume is best accomplished using SetMercator2SP. It takes arguments StdP1, CenterLat, CenterLong, FalseEasting and FalseNorthing.
How do I map these to the data I have?
I assume StdP1 is the standard parallel.
Is the longitude of projection origin the CenterLong?
What about CenterLat ... is that typically assumed to be zero if not listed?
Do I ignore false easting and northing?

A: Having worked this out, I should point out a flaw in my question: there is no SetMercator2SP in the python bindings. There is only one SetMercator and you use it to emulate SetMercator1SP or SetMercator2SP by choosing arguments. From what I have seen online, it is possible there are some programming mistakes ... not suprising since this isn't the most common projection.
The function SetMercator has arguments CenterLat, CenterLong, Scale, FalseEasting, FalseNorthing. The argument "CenterLat" seems to be the standard parallel (latitude of unit scale) not an origin, and I believe it is mutually exclusive of Scale. The CenterLong is the longitude of origin.  The argument Scale would be ignored if you are emulating the "2SP" arguments, since use of the standard parallel and scale are mutually exclusive.
Note the comment by mdsummer about the only latitude of origin being the equator. My standard parallel was 30 degrees. Since this is substantially above the equator, this means that the data lying right at the standard parallel had a y coordinate significantly greater than zero (zero would be the value of the projection at the equator). However, my data came in this way ... the y coords at the bottom of my grid were appropriately above zero as if the equator were the y origin. Therefore I did not need a FalseNorthing.
Given the ambiguity, in the end I did this directly in proj4:
import pyproj
p=pyproj.Proj(r'+proj=merc +lat_ts=30.0 +lon_0=-128.735 +a=6370997.0 +b=6370997.0')
print p(x_merc,y_merc,inverse=True)

Note that this use of a and b with these values is identical to "+ellps=sphere" which would shorten the command. However, in my case I had a slightly different earth_radius and I had to sub that value in.