text:
Q: Audience value not exporting to output file in XSLT transform I'm having trouble getting the value in the audience tag to appear in my output file while running an XSLT transform on a DITA map.
This is the snippet of my input with audience="Alaska":
<topicgroup>
            <topichead navtitle="Alaska Property and Casualty Adjuster Law" locktitle="yes" audience="Alaska">
                <topicgroup>
                    <mapref href="Qbank/maps/Adj_Unit_AK.ditamap" format="ditamap"/>
                </topicgroup>
            </topichead>
        </topicgroup>

Here's the portion of my XSLT script that contains the <!--Add audience--> section:
<xsl:template match="topichead">
        <xsl:param name="all_topic_refs" select="topicref[@type='topic' or @type='concept']" as="element()*"/>
        <xsl:param name="all_question_refs" select="topicref[@type='question']" as="element()*"/>
        <xsl:param name="all_exam_refs" select="topicref[@type='exam']" as="element()*"/>
        <xsl:param name="audience" select="topichead[@audience='property' or @type='concept']" as="element()*"/>
        <xsl:param name="all_exam_maps" select="descendant-or-self::examMap" as="element()*"/>

                <xsl:copy>
                    <xsl:attribute name="navtitle">
                        <xsl:choose>
                            <xsl:when test="navtitle">
                                <xsl:apply-templates select="navtitle"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="@navtitle"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>

                    <!--Add audience-->

                    <xsl:attribute name="audience">
                          <xsl:value-of select="@audience"/>
                    </xsl:attribute>

                    <xsl:apply-templates select="*[not(self::examMap[@assessment_type='test-exam-primary']) and not(self::navtitle)]">
                        <xsl:with-param name="all_topic_refs" select="$all_topic_refs"/>
                        <xsl:with-param name="all_question_refs" select="$all_question_refs"/>
                        <xsl:with-param name="all_exam_refs" select="$all_exam_refs"/>
                        <xsl:with-param name="all_exam_maps" select="$all_exam_maps"/>
                    </xsl:apply-templates>
                </xsl:copy>
    </xsl:template>

The output is giving me this with empty quotes in the Audience tag:
<topichead navtitle="Alaska Property and Casualty Adjuster Law" audience="">
         <topicref href="questions/inslic_assess_Adj_AK.dita"/>
      </topichead>

It pulls over the navtitle correctly but I can't figure why it won't pull over the audience input. Any help would be most appreciated.
Here's the full input file:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE bookmap PUBLIC "-//OASIS//DTD DITA BookMap//EN" "bookmap.dtd" []>
<bookmap>
    <booktitle>
        <mainbooktitle>Property & Casualty Insurance Adjuster Qbank</mainbooktitle>
    </booktitle>
    <bookmeta>
        <category>course</category>
        <!-- <category> will describe type of map it is (qbank, course w/final exam, final exam, etc) -->
        <prodinfo>
            <prodname>Insurance Adjuster Licensing</prodname>
            <vrmlist>
                <vrm version="2022"/>
            </vrmlist>
            <brand>lic</brand>
            <series>adjqbank</series>
        </prodinfo>
        <bookid>
            <bookpartno>00012345</bookpartno>
        </bookid>
    </bookmeta>

    <!--
        # Transform Type: LMS_Transform
        # DITAVAL: USstate_National_Short_Adjuster_Digital_InsLic.ditaval
        # File Path to Final Zip: G:\Shared drives\DITA Zip Files\Insurance Licensing\Property & Casualty\20535_National Insurance Adjuster Solution
        # Reltable: N
        # Glossary notes: Y/N
        # Run from main folder?: N
        # PDF: Standard
    -->

    <chapter href="Qbank/topics/Adj_Qbank_1.dita" locktitle="yes">

        <topicmeta>
            <navtitle>Property & Casualty Insurance Adjuster</navtitle>
        </topicmeta>

        <topicgroup>
            <topichead navtitle="Introduction to Insurance" locktitle="yes">
                <topicgroup>
                    <mapref href="Qbank/maps/Adj_Unit_1.ditamap" format="ditamap"/>
                </topicgroup>
            </topichead>
        </topicgroup>

        <topicgroup>
            <topichead navtitle="Contracts" locktitle="yes">
                <topicgroup>
                    <mapref href="Qbank/maps/Adj_Unit_2.ditamap" format="ditamap"/>
                </topicgroup>
            </topichead>
        </topicgroup>

    </chapter>
    <chapter href="Qbank/topics/Adj_Qbank_State_Specific.dita" locktitle="yes">
        <topicmeta>
            <navtitle>State Regulations</navtitle>
        </topicmeta>
        <topicgroup>
            <topichead audience="Alabama" navtitle="Alabama Property and Casualty Adjuster Law" locktitle="yes">
                <topicgroup>
                    <mapref href="Qbank/maps/Adj_Unit_AL.ditamap" format="ditamap"/>
                </topicgroup>
            </topichead>
        </topicgroup>
        <topicgroup>
            <topichead navtitle="Alaska Property and Casualty Adjuster Law" locktitle="yes" audience="Alaska">
                <topicgroup>
                    <mapref href="Qbank/maps/Adj_Unit_AK.ditamap" format="ditamap"/>
                </topicgroup>
            </topichead>
        </topicgroup>
        <topicgroup>
            <topichead navtitle="Arizona Property and Casualty Adjuster Law" locktitle="yes" audience="Arizona">
                <topicgroup>
                    <mapref href="Qbank/maps/Adj_Unit_AZ.ditamap" format="ditamap"/>
                </topicgroup>
            </topichead>
        </topicgroup>
    </chapter>
</bookmap>

Here's the full script with the non-related stuff removed:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:functx="http://www.functx.com"
    xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
    exclude-result-prefixes="xs functx ditaarch" version="2.0">

    <xsl:import href="functx-1.0.xsl"/>
    <xsl:import href="new_topic_task.xsl"/>

    <xsl:param name="BASE_DIR"/>
    <xsl:param name="OUT_DIR"/>

    <xsl:output encoding="UTF-8" method="xml" indent="yes"
        doctype-public="-//OASIS//DTD DITA Map//EN" doctype-system="map.dtd"/>

    <xsl:strip-space elements="*"/>

    <!-- Create a global variable so that we can refer back to the supermap. -->
    <xsl:variable name="supermap" select="/supermap" as="element()*"/>

    <!-- Create a global variable so that we can refer back to the los. -->
    <xsl:variable name="los_summary" select="/supermap/los_summary" as="element()*"/>

    <xsl:template match="/">
        <xsl:apply-templates select="supermap"/>
    </xsl:template>

    <xsl:template match="supermap">
        <map>
            <xsl:attribute name="title">
                <xsl:value-of select="@title"/>
            </xsl:attribute>
            <xsl:attribute name="id">
                <xsl:value-of select="@id"/>
            </xsl:attribute>

            <!-- Handle topicheads. -->
            <xsl:apply-templates select="topichead"/>

            <!-- Create the final exam map outside all other topic heads. -->
            <xsl:apply-templates select="topichead[@unit_map_type='final-exam']/examMap">

            </xsl:apply-templates>

            <!-- Handle LOS. -->
            <xsl:apply-templates select="los_summary"/>

        </map>
    </xsl:template>

    <!-- Top level topichead. -->
    <xsl:template match="topichead">

        <!-- Made these parameters so that subordinate topicheads behave correctly...I think. -->
        <xsl:param name="all_topic_refs" select="topicref[@type='topic' or @type='concept']" as="element()*"/>
        <xsl:param name="all_question_refs" select="topicref[@type='question']" as="element()*"/>
        <xsl:param name="all_exam_refs" select="topicref[@type='exam']" as="element()*"/>
        <xsl:param name="audience" select="topichead[@audience='property' or @type='concept']" as="element()*"/>
        <!-- Added for QBank -->
        <xsl:param name="all_exam_maps" select="descendant-or-self::examMap" as="element()*"/>

        <!-- [SP] 2015-01-13: Don't display topichead in qbank output. -->
        <xsl:choose>
            <xsl:when test="@unit_map_type = 'qbank'">
                <xsl:apply-templates select="*[not(self::examMap[@assessment_type='test-exam-primary'])]">
                    <xsl:with-param name="all_topic_refs" select="$all_topic_refs"/>
                    <xsl:with-param name="all_question_refs" select="$all_question_refs"/>
                    <xsl:with-param name="all_exam_refs" select="$all_exam_refs"/>
                    <xsl:with-param name="all_exam_maps" select="$all_exam_maps"/>

                </xsl:apply-templates>
            </xsl:when>
            <xsl:otherwise>
                <xsl:copy>
                    <xsl:attribute name="navtitle">
                        <xsl:choose>
                            <xsl:when test="navtitle">
                                <xsl:apply-templates select="navtitle"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <xsl:value-of select="@navtitle"/>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:attribute>

                    <!--Add audience-->

                    <xsl:attribute name="audience">
                          <xsl:value-of select="@audience"/>
                    </xsl:attribute>

                    <xsl:apply-templates select="*[not(self::examMap[@assessment_type='test-exam-primary']) and not(self::navtitle)]">
                        <xsl:with-param name="all_topic_refs" select="$all_topic_refs"/>
                        <xsl:with-param name="all_question_refs" select="$all_question_refs"/>
                        <xsl:with-param name="all_exam_refs" select="$all_exam_refs"/>
                        <xsl:with-param name="all_exam_maps" select="$all_exam_maps"/>
                    </xsl:apply-templates>
                </xsl:copy>

            </xsl:otherwise>
        </xsl:choose>

    </xsl:template>

    <xsl:template match="@*">
        <xsl:copy/>
    </xsl:template>

</xsl:stylesheet>

A: I will assume your XSLT stylesheet is applied at a certain stage from a plugin when publishing the DITA XML content using the DITA Open Toolkit. You can add an xsl:message inside the xsl:template which matches the topichead:
 <xsl:message><xsl:copy-of select="."/></xsl:message>

Then look in the console output when publishing to see exactly on what XML element the template is applied.
The DITA Open Toolkit publishing engine has a pre-processing step which applies filtering and removes all profiling attributes from all elements.
https://www.dita-ot.org/dev/reference/preprocess-debugfilter.html
To preserve the profiling attributes when publishing you need to specify a DITAVAL filter file which specifies that the profiling attributes should pass through to the published output. Something like:
<val>
   <prop action="passthrough" att="audience"/>
</val>

https://www.oxygenxml.com/dita/1.3/specs/langRef/ditaval/ditaval-prop.html


text:
Q: How do I bin my PCA results i.e., 120 equal bins of my large data set? I am a new researcher in Japan and working on my project. I am lost after reading one paper, the paper is from very good general he uses the technique of binning of PCA but I don't know how what does that mean how they do this.
Subsequently, we predicted PC1 and PC2 scores for each pixel across the entire NAM for baseline and end‐of‐century conditions. Finally, PC1 and PC2 scores were partitioned into 120 equal bins to obtain a stratification of the climate space into smaller homogeneous units  This approach corresponds to a relatively conservative stratification of the climate gradient and therefore of associated velocity and analogue estimates. We used a 120‐bins stratification to perform the climate exposure assessment presented here (see below), but as the precision of the climate, space stratification can largely influence climate analogue and velocity computations we also used climate stratifications of 40 and 200 bins to evaluate the sensitivity of the results to bin size.
If anyone please guide me, would be great favour on me.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Draggables Jquery UI with start & stop Read the doc on JQuery UI's & I am using draggable() function from this plugin & I am able to drag & drop a div.
But now I want to drag a thumbnail (#b1) & on my drop my div (#d) should appear.
I got to know there is an currentTarget in event which is calling the thumbnail.
What I know is I have to change
 var objArr = new Array();

  $(function() {
  $( "#b1" ).draggable({
  start: function(event, ui) {

  },
  stop: function(event, ui) {

        $(".box").append('
  <textarea rows="2" class="txt" id="TextBox'+objArr.length+'" cols="2"></textarea>
');
        var tmpObj = $("#box"+objArr.length)
        tmpObj.offset().top = event.clientY
        tmpObj.offset().left = event.clientX
        objArr.push(tmpObj)

  }
});

How to do that I don't know.
Please help.

A: Here is an example of what you want to do:
JQuery
$("#one").data("fullImageSrc", "http://cdn.asriran.com/files/fa/news/1389/10/27/162857_203.jpg");
$("#two").data("fullImageSrc", "http://far30.net/wp-content/uploads/2012/05/03.jpg");
$(".draggable").draggable({
    cursor: "crosshair",
    revert: "invalid"
});
$("#drop").droppable({
    accept: ".draggable",
    drop: function (event, ui) {
        console.log("drop");
        $(this).removeClass("border").removeClass("over");
        var dropped = ui.draggable;
        var droppedOn = $(this);
        var fullImageUrl = $(dropped).data("fullImageSrc");
        var imgSrc = $(dropped).attr("src");
        $(dropped).detach().css({
            top: 0,
            left: 0
        }).hide().attr("src", fullImageUrl).data("fullImageSrc", imgSrc).load(function () {
            $(this).show();
        }).appendTo(droppedOn);
    },
    over: function (event, elem) {
        $(this).addClass("over");
        console.log("over");
    },
    out: function (event, elem) {
        $(this).removeClass("over");
    }
});
$("#drop").sortable();
$("#origin").droppable({
    accept: ".draggable",
    drop: function (event, ui) {
        console.log("drop");
        $(this).removeClass("border").removeClass("over");
        var dropped = ui.draggable;
        var droppedOn = $(this);
        var fullImageUrl = $(dropped).data("fullImageSrc");
        var imgSrc = $(dropped).attr("src");
        $(dropped).detach().css({
            top: 0,
            left: 0
        }).hide().load(function () {
            $(this).show();
        }).attr("src", fullImageUrl).data("fullImageSrc", imgSrc).appendTo(droppedOn);
    }
});

DEMO

A: Try this.
$("[myThumbnail]").draggable({

    start:function(event, ui){
        // get thumbnail
        var myThumbnail = $(this);
    },
    stop:function(event, ui){
        // get div
        // cannot!!!
    }

});

$( "[myDiv]" ).droppable({

  drop: function(event, ui) {
      var myThumbnail = ui.draggable;
  }

});


text:
Q: Difference of two kind of Selecting all columns in SQL Server? What is the difference in this two SQL queries besides the lenght of the code?
SELECT * from tblPerson

SELECT id, name age from tblPerson

NOTE: I am selecting all columns in here, in the second code, that is all the columns of the table, I am not selecting specific locations.

A: One obvious difference is indeed the length of the code. Another difference is the maintaineability (don't know how to write that word) i.e. adding a column later to 'tblPerson' will change the result.

A: There is no difference.
SELECT * means that you are selecting all columns to show on the result list.
SELECT col1, ... specifies only the column you want to be shown.


text:
Q: UIToolBar Not Appearing on iPhone 6 and 6 Plus I am trying to add a UIToolBar but it does not appear on iPhone. It shows up on an iPad though. What am I doing wrong?
UIToolbar *webToolBar = [[UIToolbar alloc]init];

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
    {
        fixedSpace.width = 20.0;

        [webToolBar setItems:[NSArray arrayWithObjects:backButton, forwardButton, flexibleSpace, refreshButton, fixedSpace, stopButton, nil]animated:NO];

        webToolBar.frame = CGRectMake(0, [[UIScreen mainScreen]bounds].size.height - 44, [[UIScreen mainScreen]bounds].size.width, 44);
    }
    else
    {
        UIBarButtonItem *fixedSpaceiPad =  [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
        fixedSpaceiPad.width = 460.0;

        fixedSpace.width = 50.0;

        webToolBar.frame = CGRectMake(0, 660, 703, 44);
        [webToolBar setItems:[NSArray arrayWithObjects:backButton, forwardButton, fixedSpaceiPad, refreshButton, fixedSpace, stopButton, nil]animated:NO];
    }

    webToolBar.delegate = self;
    [webToolBar setBarStyle:UIBarStyleDefault];
    webToolBar.tintColor = kfbBlue;
    webToolBar.hidden = NO;
    [webToolBar sizeToFit];
    [self.view addSubview:webToolBar];

I've also tried placing it like this. With this implementation, it shows in the correct location on iPhone 4S, 5, and 5S, but it doesn't show at all on 6 or 6 Plus.
CGSize result = [[UIScreen mainScreen] bounds].size;
        NSInteger y = [[UIScreen mainScreen]bounds].size.height - 44;
        NSInteger screenWidth = [[UIScreen mainScreen]bounds].size.width;

        NSLog(@"Screen height = %f", [[UIScreen mainScreen]bounds].size.height);
        NSLog(@"y = %ld and width = %ld", y, screenWidth);

        fixedSpace.width = 20.0;

        // webToolBar.frame = CGRectMake(0, y, screenWidth, 44);

        [webToolBar setItems:[NSArray arrayWithObjects:backButton, forwardButton, flexibleSpace, refreshButton, fixedSpace, stopButton, nil]animated:NO];

        if (result.height == 480)
        {
            webToolBar.frame = CGRectMake(0, 372, 320, 44);
        }
        else if (result.height == 568)
        {
            webToolBar.frame = CGRectMake(0, 460, 320, 44);
        }
        else if (result.height == 667) {
            webToolBar.frame = CGRectMake(0, 623, 375, 44);
        }
        else if (result.height == 736) {
            webToolBar.frame = CGRectMake(0, 692, 414, 44);
        }


text:
Q: Android App not running on any device I'm having trouble running ANY app on both an emulator and a device. Just running the simple "Hello World" app is not working. The app gets installed on the emulator but never executes. I can find it when I go Menu -> Manage Apps but the only thing I can do from there is uninstall it. It seems there is a setting that is not forcing it to run automatically.
Also, something that was weird was my computer would never let me install the new updates. It would just say "Downloading ....." but nothing ever happened. I fixed the problem by going into Safe Mode with Networking but I can still not run any app. Any ideas???
Here is what it says when I go to Run as -> Android App
[2012-08-31 08:17:52 - at] New emulator found: emulator-5554
[2012-08-31 08:17:52 - at]   Waiting for HOME ('android.process.acore') to be launched... [2012-08-31 08:19:13 - at] HOME is up on device 'emulator-5554'
[2012-08-31 08:19:13 - at] Uploading at.apk onto device 'emulator-5554'
[2012-08-31 08:19:13 - at] Installing at.apk...
[2012-08-31 08:20:03 - at] Success!
[2012-08-31 08:20:03 - at] \at\bin\at.apk installed on device
[2012-08-31 08:20:03 - at] Done!

Here is my Manifest File:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="c.panic"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="parent" />
    </activity>
</application>

Thanks.

A: You've to change your main activity's <intent-filter> tag filter in AndroidManifest.xml file.
<application android:name="......"
    android:icon="@drawable/app_icon"
    android:label="@string/app_name" >
        <activity android:name=".yourActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Means, you've to change your activity's <action> and <category>
Edit
Just change like below in your manifest file. It will launch your application.
<activity
    android:name=".MainActivity"
    android:label="@string/title_activity_main" >
    <meta-data
        android:name="android.support.PARENT_ACTIVITY"
        android:value="parent" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>


text:
Q: Pandas and Python3.4 co existing with Python 2.7 I have pandas installed with python2.7. I also have python 3.4 installed.
I can't load pandas in python3
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pandas'
>>>

I understand I need to install it separately. How do I go about having pandas in both python 2.7 and 3.4 ? I am using a mac by the way.

A: You might find that you have a script called "pip3" on you system as python3.4 bundles pip in along side of python.
$ pip3 install pandas

A: Figured it out.
python3 -m pip install pandas

A: In addition to the fine answers above, please note that pandas 0.24.x releases will be the last to support Python 2!
pandas 0.24.x release notes
Quote:
"Warning The 0.24.x series of releases will be the last to support Python 2. Future feature releases will support Python 3 only"
So, co-existence, it seems, would be limited to the 0.24.x version as a common version for both python 2 and 3.


text:
Q: How can i update a specific data in my sqlite DB?
*

*This is my Database class.
public boolean updatePrediction(String item_ean,String prediction)
{
SQLiteDatabase db=this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(ITEM_EAN, item_ean);
contentValues.put(PREDICTION_TYPE,prediction);
db.update(TABLE_REPORT,contentValues,PREDICTION_TYPE+"="+,null);
return true;

*This is the activity class code snippet.
toggleButton.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
if (((ToggleButton) v).isChecked()) {
booleanisUpdated=dbcontroller.updatePrediction(editText.getText().toString(),"4");
Toast.makeText(getBaseContext(), "Toggle is  on"+isUpdated, Toast.LENGTH_LONG).show();

} else {
Toast.makeText(getBaseContext(), "Toggle is off",Toast.LENGTH_LONG).show();

}
}
});

When i switch the toggle button the specific data in my case item_ean's prediction_type should change.

A: execSQL is for execute a single SQL statement that is NOT a SELECT/INSERT/UPDATE/DELETE.
For UPDATE statements, use any of the following instead.

*

*update(String, ContentValues, String, String[])

*updateWithOnConflict(String, ContentValues, String, String[], int)

You must use update for your case like this :
public boolean updatePrediction(String item_ean,String prediction){
   SQLiteDatabase db=this.getWritableDatabase();
   ContentValues contentValues = new ContentValues();
   contentValues.put(ITEM_EAN, item_ean);
   String[] args = new String[]{prediction};
   db.update(TABLE_REPORT,contentValues,PREDICTION_TYPE+"=?",args);
   return true;
}


text:
Q: K8s - an NFS share is only mounted read-only in the pod Environment: external NFS share for persistent storage, accessible to all, R/W, Centos7 VMs (NFS share and K8s cluster), NFS utils installed on all workers.
Mount on a VM, e.g. a K8s worker node, works correctly, the share is R/W
Deployed in the K8s cluster: PV, PVC, Deployment (Volumes - referenced to PVC, VolumeMount)
The structure of the YAML files corresponds to the various instructions and postings, including the postings here on the site.
The pod starts, the share is mounted.  Unfortunately, it is read-only. All the suggestions from the postings I have found about this did not work so far.
Any idea what else I could look out for, what else I could try?
Thanks. Thomas

A: After digging deep, I found the cause of the problem. Apparently, the syntax for the NFS export is very sensitive. One more space can be problematic.
On the NFS server, two export entries were stored in the kernel tables. The first R/O and the second R/W. I don't know whether this is a Centos bug because of the syntax in /etc/exports.
On another Centos machine I was able to mount the share without any problems (r/w). In the container (Debian-based image), however, not (only r/o). I have not investigated whether this is due to Kubernetes or Debian behaves differently.
After correcting the /etc/exports file and restarting the NFS server, there was only one correct entry in the kernel table. After that, mounting R/W worked on a Centos machine as well as in the Debian-based container inside K8s.
Here are the files / table:
privious /etc/exports:

/nfsshare    172.16.6.* (rw,sync,no_root_squash,no_all_squash,no_acl)

==> kernel:

/nfsshare       172.16.6.*(ro, ...
/nfsshare       *(rw, ...

corrected /etc/exports (w/o the blank):

/nfsshare    *(rw,sync,no_root_squash,no_all_squash,no_acl)

A: In principle, the idea of using an init container is a good one. Thank you for reminding me of this.
I have tried it.
Unfortunately, it doesn't change the basic problem. The file system is mounted "read-only" by Kubernetes. The init container returns the following error message (from the log):
chmod: /var/opt/dilax/enumeris: Read-only file system


text:
Q: Android: "Build failed" error pointing to DI:dagger while building I'm getting the ""error: @Binds methods' parameter type must be assignable to the return type public abstract com.packagename.HomeRepository bindsHomeRepository(@org.jetbrains.annotations.NotNull()" in my build files while building my android project.

A: example for Kotlin
@Module
abstract class HomeRepositoryModule {
    @Binds
    abstract fun bindHomeRepository(repository: HomeRepository): Repository <--- Check your return type
}

A:
@Binds methods' parameter type must be assignable to the return type

It simply means that your HomeRepository is probably not of type "Repository".
Check that HomeRepository actually extends Repository:
class HomeRepository () : Repository {

}


text:
Q: Finding part of string using regular expressions I'm pretty new in Python and don't really know regex. I've got some strings like:
a = "Tom Hanks XYZ doesn't really matter"
b = "Julia Roberts XYZ don't worry be happy"
c = "Morgan Freeman XYZ all the best"

In the middle of each string there's word XYZ and than some text. I need regex that will find and match this part, more precisely: from XYZ to the end of string.

A: Unles there is a specific requirement to do through Regex, a non-regex solution will work fine here.
There are two possible ways you can approach this problem
1.
Given
a = "Tom Hanks XYZ doesn't really matter"

Partition the string with the separator, preceded with a space
''.join(a.partition(" XYZ")[1:])[1:]

Please note, if the separator string does not exist this will return a empty string.
2.
a[a.index(" XYZ") + 1:]

This will raise an exception ValueError: substring not found if the string is not found

A: Use the following expression
(XYZ.*)

What this does is start capturing when it sees the letters "XYZ" and matches anything beyond that zero or more times.

A: m = re.search("(XYZ.*)", a)

If you want to show that part of the string:
print m.groups()[0]


text:
Q: Selenium C# Error while reading data from Excel for data driven testing I am trying to perform Data driven testing by loading client codes from Excel file to login and perform other operation.I am trying to iterate my test for all clients in the client_code column. I only need to read client_code column and get data to repeat same test with those clients. I am getting Null value when I run below code
Any help with this would be much appreciated thank you.
I am using ExcelDataReader v3.4.0, ExcelDataReader.DataSet v3.4.0, selenium Webdriver v3.11.0
My Excel table looks like below.

client_code  client_name
11111   Client1
22222   Client2
33333   Client3
44444   Client4
55555   Client5

This is my code:
ExcelUtil.cs

using ExcelDataReader;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;

namespace MyDemoAutomation
    {
    public class ExcelUtil
        {
        public DataTable ExcelToDatable(string fileName)
            {
            // open file and returns as stream
            FileStream stream = File.Open(fileName, FileMode.Open, FileAccess.Read);
            // create openXmlReader via ExcelReaderFactory
            IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
            //Set the first row as column name
          var result1 = excelReader.AsDataSet(new ExcelDataSetConfiguration()
                {
                ConfigureDataTable = (_) => new ExcelDataTableConfiguration()
                    {
                    UseHeaderRow = true
                    }
                });

            // Return as dataset
            DataSet result = excelReader.AsDataSet();
            // Get all tables
            DataTableCollection table = result.Tables;
            // Store in Database
            DataTable resultTable = table["Sheet1"];
            // return
            return resultTable;

            }

        List<DataCollection> dataCol = new List<DataCollection>();
        public void PopulateInCollection(string fileName)
            {

            DataTable table = ExcelToDatable(fileName);
            for (int row = 1; row <= table.Rows.Count; row++)
                {

                for (int col = 0; col < table.Columns.Count; col++)
                    {

                    DataCollection dtTable = new DataCollection()
                        {

                        rowNumber = row,
                        colName = table.Columns[col].ColumnName,
                        colValue = table.Rows[row - 1][col].ToString()
                        };
                    dataCol.Add(dtTable);

                    }
                }
            }

        public string ReadData(int rowNumber, string columnName)
            {
            try
                {
                // Retriving data using LINQ to reduce much of iterations
                string data = (from colData in dataCol
                               where colData.colName == columnName && colData.rowNumber == rowNumber
                               select colData.colValue).SingleOrDefault();

                return data.ToString();
                }
            catch (Exception e)
                {
                return null;
                }
            }

        internal class DataCollection
            {
            public int rowNumber { get; internal set; }
            public string colName { get; internal set; }
            public string colValue { get; internal set; }
            }
        }
    }

Test Class :

 [Test]
        public void DataDrivenTest_FromExcel()
            {

   Driver = new ChromeDriver();

            ExcelUtil util = new ExcelUtil();
            util.PopulateInCollection(@"C:\dan\AutomationTest\TestData\test.xlsx");

   Driver.FindElement(By.Id("contentPlaceholder_txtClientCode")).SendKeys(util.ReadData(i));

   Driver.FindElement(By.XPath("//*[@id='btnLogin']")).Click();
   Driver.FindElement(By.XPath("//*[@id='tabContent0']/table/tbody/tr[2]/td[1]")).Click();
   Driver.FindElement(By.Id("contentPlaceholder_txtcloseButton")).Click();

   Driver.Quit

            }

A: you can:
READ EXCEL FILE:
class ExcelReader
 {
 public List<TestCaseData> ReadExcelData(string excelFile, string sheetname)
 {
    string cmdText = "SELECT * FROM [" + sheetname+ "$]";

    if (!File.Exists(excelFile))
        throw new Exception(string.Format("File name: {0}", excelFile), new
    FileNotFoundException());

    string connectionStr =
     string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES\";", excelFile);
    var ret = new List<TestCaseData>();
    using (var connection = new OleDbConnection(connectionStr))
    {
        connection.Open();
        var command = new OleDbCommand(cmdText, connection);
        var reader = command.ExecuteReader();
        if (reader == null)
            throw new Exception(string.Format("No data return from file,
        file name:{0}", excelFile));
        while (reader.Read())
        {
            var row = new List<string>();
            var feildCnt = reader.FieldCount;
            for (var i = 0; i < feildCnt; i++)
                row.Add(reader.GetValue(i).ToString());
            ret.Add(new TestCaseData(row.ToArray()));
        }
    }
    return ret;
}

Your test case will remain like this:
      [TestFixture]
class TC_1
{

  public static IEnumerable<TestCaseData> BudgetData
    {
        get
        {
            List<TestCaseData> testCaseDataList = new ExcelReader().ReadExcelData(//path//document.xlsx",
                "SheetName");
            if (testCaseDataList != null)
                foreach (TestCaseData testCaseData in testCaseDataList)
                    yield return testCaseData;
        }
    }

    [Test]
    [TestCaseSource(typeof(TC_1), "BudgetData")]
    public void TestCase1(string attribbutte1, string .....)
    {
     ........................................

NOTE: You need to install the reference "Acces Database Engine" to Read Excel Files
NOTE2: by default the first row will be of titles, for each new row the TC will be executed

the same code is executed 5 times changing the data

A: Hi @Miguel D'Alessio I tried running the code you provided. Below is the exact copy paste code which I am running with error. Thank you.
ExcelReader Class:

namespace Automation
    {
    class ExcelReader
        {
        public List<TestCaseData> ReadExcelData(string excelFile, string sheetname)
            {
            string cmdText = "SELECT * FROM [" + sheetname + "$]";

            if (!File.Exists(excelFile))
                throw new Exception(string.Format("File name: {0}", excelFile), new
            FileNotFoundException());

            string connectionStr =
             string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=YES\";", excelFile);
            var ret = new List<TestCaseData>();
            using (var connection = new OleDbConnection(connectionStr))
                {
                connection.Open();
                var command = new OleDbCommand(cmdText, connection);
                var reader = command.ExecuteReader();
                if (reader == null)
                    throw new Exception(string.Format("No data return from file, file name:{ 0 }", excelFile));
                while (reader.Read())
                    {
                    var row = new List<string>();
                    var feildCnt = reader.FieldCount;
                    for (var i = 0; i < feildCnt; i++)
                        row.Add(reader.GetValue(i).ToString());
                    ret.Add(new TestCaseData(row.ToArray()));
                    }
                }
            return ret;
            }
        }
    }

Test Class :

namespace Automation
    {
    [TestFixture]
    class Excel_TC_1
        {
        private readonly string testCaseData;

        public static IEnumerable<TestCaseData> BudgetData
            {
            get
                {
                List<TestCaseData> testCaseDataList = new ExcelReader().ReadExcelData(@"C:\Safety_dan\AutomationTest\TestData\test.xlsx",
                    "Sheet1");
                if (testCaseDataList != null)
                    foreach (TestCaseData testCaseData in testCaseDataList)
                        yield return testCaseData;
                }
            }

        [Test]
        [TestCaseSource(typeof(Excel_TC_1), "BudgetData")]
        public void TestCase1(string attribbutte1)
            {
            // Login

            CcLoginPageObject ccPageLogin = new CcLoginPageObject();
            ClientLoginPageObject clientLoginPage = new ClientLoginPageObject();

                ccPageLogin.Login("username", "password");

            // Loading client code:
            Driver.FindElement(By.Id("ClientsSearch")).SendKeys(testCaseData);

            }
        }
        }

Error:

Test Name: TestCase1
Test FullName: Automation.Excel_TC_1.TestCase1
Test Source: C:\Safety_dan\-localRepoVisualStudioC#\Automation\Excel_TC_1.cs : line 32
Test Outcome: Failed
Test Duration: 0:00:00.005

Result StackTrace:
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
   at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()
   at Automation.ExcelReader.ReadExcelData(String excelFile, String sheetname) in C:\Safety_dan\-localRepoVisualStudioC#\Automation\Excel_TC_1.cs:line 27
   at Automation.Excel_TC_1.<get_BudgetData>d__2.MoveNext() in C:\Safety_dan\-localRepoVisualStudioC#\Automation\Excel_TC_1.cs:line 20
   at NUnit.Framework.TestCaseSourceAttribute.GetTestCasesFor(IMethodInfo method) in C:\src\nunit\nunit\src\NUnitFramework\framework\Attributes\TestCaseSourceAttribute.cs:line 177
Result Message: System.InvalidOperationException : The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.


text:
Q: CKEditor no space on buttons I'm using the CKEDITOR.inline(element) feature of CKEditor (contenteditable=true) in a "WYSIWYG" content editor that I'm working on.  The thing works great for all kinds of tags that I've tested with except on:
When I go to edit a <button>, I can edit the text inside of the tag, just fine, except for "space".
When I hit the spacebar, instead of getting a space character inserted in the text, the button attempts to be "pressed", since, I'm assuming the default functionality of the browser is to try and "press" a button that is focused.
So.. I tried to "highjack" the $(element).on('keydown') event and checked for keycode 32 to apply preventDefault to the event.  That technically worked to do the "highjacking" (I can see the below console.log), but I still don't get a "space" in the content.
var _fixButtonSpaceKeydown = function(elem, removeBinding){
                console.log("_fixButtonSpaceKeydown()");
                if(removeBinding){
                    jQuery(elem).off('keydown');
                } else {
                    jQuery(elem).on('keydown', function (e) {
                        if (e.keyCode == 32) {
                            console.log('Caught space!');
                            e.preventDefault();
                        }
                    });
                }
            }

Has anyone come across this w/ CKEditor before, and have they found a solution?

A: Below workaround won't stop onclick() on Chrome while focusing on a button and type space. This is a browser issue and it seems there's no way to totally prevent the event. Anyway, we can still add space(Make sure to insert HTML encoding) at the cursor position:
jQuery(contentEditableBtn).attr('onclick','event.preventDefault(); insertSpace();');

function insertSpace(){
 var range, node;
if (window.getSelection && window.getSelection().getRangeAt) {
            range = window.getSelection().getRangeAt(0);
            node = range.createContextualFragment(" ");
            range.insertNode(node);
            window.getSelection().collapseToEnd();
            window.getSelection().modify("move", "forward", "character");
        } else if (document.selection && document.selection.createRange) {
            document.selection.createRange().pasteHTML(" ");
            document.selection.collapseToEnd();
            document.selection.modify("move", "forward", "character");
        };
}

A: Maybe you could manually insert a space after preventDefault().  I'm not sure if this would work, but it's worth a try:
var _fixButtonSpaceKeydown = function(elem, removeBinding){
                console.log("_fixButtonSpaceKeydown()");
                if(removeBinding){
                    jQuery(elem).off('keydown');
                } else {
                    jQuery(elem).on('keydown', function (e) {
                        if (e.keyCode == 32) {
                            console.log('Caught space!');
                            e.preventDefault();
                            e.target.innerHTML += ' ';
                        }
                    });
                }
            }

A: Try this:  I haven't tested it but I'm sure you can add space by getting the cursor position where a char is then add a space before the char and replace the paragraph.
Something like this:
var _fixButtonSpaceKeydown = function(elem, removeBinding){
                console.log("_fixButtonSpaceKeydown()");
                if(removeBinding){
                    jQuery(elem).off('keydown');
                } else {
                    jQuery(elem).on('keydown', function (e) {
                       var p = "";

                        if (e.keyCode == 32) {
                            console.log('Caught space!');
                            e.preventDefault();
                            p = e.target.innerHTML;
                       // get position of cursor
                       var cursorPosition = window.getSelection().getRangeAt(0).startOffset;
                           p.replace(p.charAt(position), " " + p.charAt(position));
                          // replace the content after change
                          e.target.innerHTML = p;
                        }
                    });
                }
            }


text:
Q: Marklogic How to use serialize How to use serialize to get 2000 documents in collection /user/bibliography,then use MLCP to export data.
let $query:=cts:and-query(cts:collection-query("/user/bibliography"))[1 to 2000]

let $serialize := xdmp:quote(
    <query>{$query}</query>/*,
    <options xmlns="xdmp:quote"><indent>no</indent></options>
)
return $serialize

(:serialize return but it is not showing limit 1 to 2000 records.
   <cts:and-query xmlns:cts="http://marklogic.com/cts"><cts:collection-
       query><cts:uri>/user/bibliography</cts:uri></cts:collection-query>
  </cts:and-query>

:)

A: The query itself is just a description of the documents you want. In order to get those documents, you need to pass the query as an argument to the cts:search function.
But you don't need to manually serialize documents if you are using MLCP, which automatically serializes documents when they are written to disk. Also, if you serialize twice, you may end up with double-encoded characters in your output.
If the reason you are serializing this query is to output everything in a single document, then wrap the results of cts:search in a root element and use xdmp:document-insert to insert the (not serialized) output into the database. Then use MLCP to export that. Otherwise, you don't need to write XQuery at all since you should be able to do everything in MLCP using collection filter and limit parameters.


text:
Q: What is the difference between M11 and M21 cells in a transformation Matrix? I need to interpret an SVG input data and identify the displayed points.
In the SVG format, any point may be part of a group (  element ) to which transformations (translate/rotate/scale) may be applied. For every point, I need to bubble up and apply transformation of every ancestor, in order to find the position that the point has in the rendering. After reading some web pages on the subject (and trying to remember from school), I understand that the usual way to do this in .NET is to use 3x3 mathematical matrices, so I try to figure out the System.Windows.Media.Matrix class.
It's been a while since I took Math, and I can't recall this one particular detail.
I typed up the following code in LINQPad:
var matrix = new Matrix(1,1,1,6,0,0);
var matrix2 = new Matrix(2,1,0,6,0,0);
var matrix3 = new Matrix(0,1,2,6,0,0);
var pts = new[]{
        new System.Windows.Point(0,0),
        new System.Windows.Point(1,1),
        new System.Windows.Point(2,2),
        new System.Windows.Point(3,3),
        new System.Windows.Point(4,4),
        new System.Windows.Point(5,5)
        }.ToArray();
pts.Select(org=>new{org,changed=matrix.Transform(org),changed2=matrix2.Transform(org),changed3=matrix3.Transform(org)}).Dump("Transformation Samples");

... and trying out different values in the Matrix constructor.
However it seems that these values have no impact on the final result.
new Matrix(1,1,1,6,0,0);
new Matrix(2,1,0,6,0,0);
new Matrix(0,1,2,6,0,0);
(same is true for arguments 2 and 4)
The only thing that seems to matter is the sum of the two (which in this case is 2). I assume that this is due to my limited input data and that given other input data, some difference could be seen that would make sense in some visual tranformation.
Can anybody help me out here?

A: Perhaps the section in the SVG spec about how transform matrixes work will be of use to you?
http://www.w3.org/TR/SVG/coords.html#TransformMatrixDefined


text:
Q: Unity Destroy GameObject instantiated clone There's something I'm trying to achieve which is destroy an instantiated object (which is a Particle System). After doing some research, I found the way to instantiate and destroy the instantiated object is this:
public class CoinCollider : MonoBehaviour
{
    public Transform coinEffect;

    void OnTriggerEnter(Collider info)
    {
        if (info.name == "Ball")
        {
            GameObject effect = GameObject.Instantiate(coinEffect, transform.position, transform.rotation) as GameObject;

            Destroy(effect);
            Destroy(gameObject);
        }
    }
}

but it seems not to delete it, this object is inherited to one object which is being destroyed. But after making this destroy. it seems to create another gameObject with name "Particle System(clone)" with no parent. How to delete it?

A: Problem
I found your problem and you are a victim of Unity being overprotective. You are trying to destroy the transform component of the clone, but you are not allowed to do that so Unity just ignores you.
Solution
void OnTriggerEnter(Collider info)
{
   if(info.name == "Ball")
      Destroy(Instantiate(coinEffect.gameObject, transform.position, transform.rotation), 5f);
}

So all you only need this one line. You Instantiate the gameObject component of the effect's  transform. Then Destroy it using a timer, I gave it 5f, or else the effect would be destroyed instantaneously.

A: This worked for me.
void DestroyProjectile()
{
Destroy(Instantiate(destroyEffect, transform.position, Quaternion.identity), 3f);


text:
Q: Get name of (external) display I'm trying to get the name of the connected external display with Cocoa or CoreFoundation. With "name" I mean that string that appears in the title bar of the System Preferences window when editing Display preferences.
I couldn't find any API for that in NSScreen or in the Quartz Display Services.
But there has to be a way, because if I access the color space of the display like this:
CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(displayID);

and I log the color space's description I get:
<CGColorSpace 0x100113c20>
(kCGColorSpaceICCBased; kCGColorSpaceModelRGB; DELL 2408WFP)

A: I found a solution in an other thread (I wonder why I didn't find that before...).
I updated it to be ARC compatible:
- (NSString *)screenNameForDisplay:(CGDirectDisplayID)displayID {
    NSString *screenName = @"";
    NSDictionary *deviceInfo = (__bridge NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(displayID), kIODisplayOnlyPreferredName);
    NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]];
    if ([localizedNames count] > 0) {
        screenName = [localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]];
    }
    return screenName;
}


text:
Q: Let $\mathcal{B} = \{\alpha_{1},\alpha_{2},\alpha_{3}\}$ be the basis of $\textbf{R}^{3}$. Find the dual basis of $\mathcal{B}$. Let $\mathcal{B} = \{\alpha_{1},\alpha_{2},\alpha_{3}\}$ be the basis of $\textbf{R}^{3}$ defined by
\begin{align*}
\alpha_{1} = (1,0,-1),\quad\alpha_{2} = (1,1,1),\quad \alpha_{3} = (2,2,0).
\end{align*}
Find the dual basis of $\mathcal{B}$.
MY ATTEMPT
The dual basis $\mathcal{B}^{*}$ of $\mathcal{B}$ is precisely the set of linear functionals $\{f_{1},f_{2},f_{3}\}$ such that $f_{i}(\alpha_{j}) = \delta_{ij}$, since $\dim\textbf{R}^{3} = 3$ over the field of real numbers. To start with, let us consider the equations given by $f_{1}(\alpha_{1}) = 1$, $f_{1}(\alpha_{2}) = 0$ and $f_{1}(\alpha_{3}) = 0$:
\begin{align*}
& f_{1}(\alpha_{1}) = a_{1}\times 1 + b_{1}\times 0 - c_{1}\times 1 = 1 \Longleftrightarrow a_{1} = 1 + c_{1}\\\\
& f_{1}(\alpha_{2}) = a_{1}\times 1 + b_{1}\times 1 + c_{1}\times 1 = 0 \Longleftrightarrow a_{1} + b_{1} + c_{1} = 0\\\\
& f_{1}(\alpha_{3}) = a_{1}\times 2 + b_{1}\times 2 + c_{1}\times 0 = 0 \Longleftrightarrow b_{1} = -a_{1}
\end{align*}
From this systems of equations, one obtains that $a_{1} = 1$, $b_{1} = -1$ and $c_{1} = 0$. Consequently, the matrix representation of the linear functional  $f_{1}$ can be expressed as $[1,-1,0]$. Similarly, one gets the matrix representation $[1,-1,1]$ for $f_{2}$ and $[-1/2,1,-1/2]$ for $f_{3}$.
What concerns me is the basis in which such functionals are represented. As far as I have understood, they are represented in the canonical basis of $\textbf{R}^{3}$ and the basis $\{1\}$ of $\textbf{R}$. Thus, if we want to obtain the coordinates of $\alpha$ in the given basis $\mathcal{B}$, we must calculate $f_{i}(\alpha)$. Hence, if $\alpha = (x,y,z)$ is written in the canonical basis, then its first coordinate in the basis $\mathcal{B}$ is given by $f_{1}(\alpha) = x - y$, its second coordinate is given by $f_{2}(\alpha) = x - y + z$ and its third coordinate is $f_{3}(\alpha) = -x/2 + y - z/2$. When we do the corresponding summation, we get
\begin{align*}
\sum_{i=1}^{3}f_{i}(\alpha)\alpha_{i} & = (x-y,0,y-x) + (x-y+z,x-y+z,x-y+z)\\
& + (-x + 2y - z,-x + 2y - z,0) = (x,y,z)
\end{align*}
which are exactly the coordinates of $\alpha$ in the canonical basis.
I know this question has already been answered here, but since I have additioned some queries, I insist in posting it. Any theoretical clarification would be appreciated.


text:
Q: AWS SecretManager Read and Write concurrency AWS SecretManager Read and Write concurrency.
If I am writing new secret value to a secret and if at the same time read is performed,
does the read call waits for he write calls to complete?
Or read will retrieve some invalid or intermediate value of the keys stored inside the secret?

A: By default, the GetSecretValue API returns the version of the secret that has the AWSCURRENT stage. It also allows you to fetch older versions of a secret by specifying the VersionId. Versions are also immutable and if you call PutSecretValue you create a new version.
You won't get partial versions here - the label AWSCURRENT will only be switched to the new version once the update is complete. Everything else would result in a terrible user experience.


text:
Q: boost flat_map batch insertion I have a C++ program that maintains a boost::flat_map. It receives real-time commands in the form of (key, value). If value is 0, then the flat_map[key] should be deleted if it exists. If value is nonzero, then the flat_map[key] should be set to value in the flat_map if the entry already exists, or it should be inserted if the entry does not already exist.
However, the commands do not come one by one. Instead, they come in batches, and the program only needs the flat_map to be sorted after each entire batch of commands is processed. It does not need the flat_map to be sorted while in the middle of processing a batch of commands.
Given this flexibility, is there a way to reduce processing time by avoiding the flat_map overhead of moving many elements on each insertion/deletion, and only incurring that overhead once at the end of each batch? The program is very latency sensitive.
Appreciate any input you may have!

A: You can use extract_sequence / adopt_sequence to update the underlying vector, and so long as it ends up ordered and uniqued, there's only a pair of vector moves in overhead.
auto underlying = my_map.extract_sequence();

// merge underlying and batch

my_map.adopt_sequence(boost::ordered_unique_range_t{}, std::move(underlying));


text:
Q: I am trying to retrieve the data and displaying in a list view but it is showing an error I am trying to retrieve the data and displaying in a list view but it is showing an error.
The following NoSuchMethodError was thrown building expanse(dirty, dependencies: [MediaQuery], state: _expanseState#6acc3):
The getter 'data' was called on null.
Receiver: null
Tried calling: data

The relevant error-causing widget was:
  expanse file:///C:/Users/sindh/AndroidStudioProjects/final_project/lib/Dashboard.dart:261:91

When the exception was thrown, this was the stack:
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1      _expanseState.build (package:hrms_project/Expenses/expencedashboard.dart:258:39)
#2      StatefulElement.build (package:flutter/src/widgets/framework.dart:4612:27)
#3      ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4495:15)
#4      StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4667:11)

I/flutter (16460): 200
E/flutter (16460): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The getter 'histories' was called on null.
E/flutter (16460): Receiver: null
E/flutter (16460): Tried calling: histories
E/flutter (16460): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
E/flutter (16460): #1      _expanseState.initState.<anonymous closure> (package:hrms_project/Expenses/expencedashboard.dart:24:27)
E/flutter (16460): #2      _rootRunUnary (dart:async/zone.dart:1362:47)
E/flutter (16460): #3      _CustomZone.runUnary (dart:async/zone.dart:1265:19)
E/flutter (16460): #4      _FutureListener.handleValue (dart:async/future_impl.dart:152:18)
E/flutter (16460): #5      Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:704:45)
E/flutter (16460): #6      Future._propagateToListeners (dart:async/future_impl.dart:733:32)
E/flutter (16460): #7      Future._completeWithValue (dart:async/future_impl.dart:539:5)
E/flutter (16460): #8      _completeOnAsyncReturn (dart:async-patch/async_patch.dart:254:13)
E/flutter (16460): #9      Services.getExpense (package:hrms_project/Api.dart)
E/flutter (16460): <asynchronous suspension>

This is json decode code
 import 'dart:convert';
    Expense expenseFromJson(String str) => Expense.fromJson(json.decode(str));
    String expenseToJson(Expense data) => json.encode(data.toJson());

    class Expense {
      Expense({
        this.success,
        this.statusCode,
        this.data,
        this.message,
      });

      bool success;
      int statusCode;
      Data data;
      String message;

      factory Expense.fromJson(Map<String, dynamic> json) => Expense(
        success: json["success"],
        statusCode: json["statusCode"],
        data: Data.fromJson(json["data"]),
        message: json["message"],
      );

      Map<String, dynamic> toJson() => {
        "success": success,
        "statusCode": statusCode,
        "data": data.toJson(),
        "message": message,
      };
    }

    class Data {
      Data({
        this.histories,
      });

      List<History> histories;

      factory Data.fromJson(Map<String, dynamic> json) => Data(
        histories: List<History>.from(json["histories"].map((x) => History.fromJson(x))),
      );

      Map<String, dynamic> toJson() => {
        "histories": List<dynamic>.from(histories.map((x) => x.toJson())),
      };
    }

    class History {
      History({
        this.id,
        this.employeeId,
        this.reference,
        this.categoryId,
        this.currencyId,
        this.amount,
        this.date,
        this.merchant,
        this.description,
        this.attachments,
        this.companyId,
        this.status,

      });

      int id;
      EmployeeId employeeId;
      Reference reference;
      String categoryId;
      String currencyId;
      String amount;
      Date date;
      String merchant;
      String description;
      String attachments;
      CompanyId companyId;
      String status;

      factory History.fromJson(Map<String, dynamic> json) => History(
        id: json["id"],
        employeeId: employeeIdValues.map[json["employee_id"]],
        reference: referenceValues.map[json["reference"]],
        categoryId: json["category_id"],
        currencyId: json["currency_id"],
        amount: json["amount"],
        date: dateValues.map[json["date"]],
        merchant: json["merchant"],
        description: json["description"],
        attachments: json["attachments"],
        companyId: companyIdValues.map[json["company_id"]],
        status: json["status"],

      );

      Map<String, dynamic> toJson() => {
        "id": id,
        "employee_id": employeeIdValues.reverse[employeeId],
        "reference": referenceValues.reverse[reference],
        "category_id": categoryId,
        "currency_id": currencyId,
        "amount": amount,
        "date": dateValues.reverse[date],
        "merchant": merchant,
        "description": description,
        "attachments": attachments,
        "company_id": companyIdValues.reverse[companyId],
        "status": status,

      };
    }

    enum CompanyId { ECS_934284 }

    final companyIdValues = EnumValues({
      "ECS-934284": CompanyId.ECS_934284
    });

    enum Date { THE_00000000 }

    final dateValues = EnumValues({
      "0000-00-00": Date.THE_00000000
    });

    enum EmployeeId { EMPMOB_006 }

    final employeeIdValues = EnumValues({
      "EMPMOB-006": EmployeeId.EMPMOB_006
    });

    enum Reference { USER }

    final referenceValues = EnumValues({
      "user": Reference.USER
    });
    class EnumValues<T> {
      Map<String, T> map;
      Map<T, String> reverseMap;

      EnumValues(this.map);

      Map<T, String> get reverse {
        if (reverseMap == null) {
          reverseMap = map.map((k, v) => new MapEntry(v, k));
        }
        return reverseMap;
      }
    }

This is the API code
    class Services {
      static const String url = 'basic url';

      static Future <Expense> getExpense() async {

          final response = await http.get(Uri.parse('basic url'));
          print(response.statusCode);
          if(200 == response.statusCode){
            final Expense = expenseFromJson(response.body);
            return Expense;
          }else{
            return Expense();
          }

      }
    }

This is the UI
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_session/flutter_session.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:hrms_project/Api.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';

class getdata {
  String category;
  String date;
  String merchant;
  String reference;
  String description;
  String currencytype;
  String amount;
  String tax;

  getdata({
    @required this.category,
    @required this.date,
    @required this.merchant,
    @required this.reference,
    @required this.description,
    @required this.currencytype,
    @required this.amount,
    @required this.tax,

  });
}

class editpage extends StatefulWidget {
  @override
  _editpageState createState() => _editpageState();
}

class _editpageState extends State<editpage> {

  String SelectDate="Click and select date";
  String ctype = "SGD";
  String doller = "1";

  String _category;
  List Category = [
    'Allowance',
    'Dental Claim',
    'Fuel Expense',
    'Home base-Taxi/Car RENTAL',
    'Home base -mileage',
    'IT and Internet Expense',
    'Meals and Entertainment',
    'Medical Claim',
    'Office Supplies',
    'Other Expense',
    'Transport Claims',
    'Travel-Airline',
    'Travel-Overseas Allowance',
    'Travel Claim',
  ];

  String currencychoose;
  List listcurrency = [
    'SGD', 'CNY', 'MYR', 'THB', 'TWD', 'USD', 'VND', 'EUR', 'HKD', 'IDR', 'JPY',
  ];

  String taxchoose;
  List listTax = [
    'GST 0% (0%)',
    'GST 7% (7%)',
    'Service Charge 10% (10%)  ',
  ];

  String Report;
  List report = [
    "PO-0049-Dominic's",
    "PO-0048-April Japan Trip Project",
    "PO-0045-Project A March 2021",
    "PO-0044-Local Transport-SG",
    "PO-0037-Nov2020 Claims",
  ];

  var claimsController = new TextEditingController();
  var currencyController = new TextEditingController();
  var taxController = new TextEditingController();
  var reporttypeController = new TextEditingController();
  var merchantController = new TextEditingController();
  var selectdateController = new TextEditingController();
  var referenceController = new TextEditingController();
  var descriptionController = new TextEditingController();
  var amountController = new TextEditingController();

  void getItemNavigate(BuildContext context) {
    Navigator.pop(context);

    print("Merchant Name is : ${merchantController.text}");
    print("Select Date : ${selectdateController.text}");
    print("Reference Code is : ${referenceController.text}");
    print("Description is : ${descriptionController.text}");
    print("Claims is: ${claimsController.text}");
    print("Select Tax : ${taxController.text}");
    print(" Amount : ${currencyController.text} ${amountController.text}");
    print("Currency Value: ${currencyController.text}");
    print("Report: ${reporttypeController.text}");
  }

  DateTime date = DateTime.now();

  Future DatePicker(BuildContext context) async {
    final DateTime picked = await showDatePicker(
      context: context,
      initialDate: date,
      firstDate: new DateTime(DateTime
          .now()
          .year - 50),
      lastDate: new DateTime(DateTime
          .now()
          .year + 50),
    );
    if (picked != null && picked != date) {
      setState(() {
        date = picked;
        print(date.toString());
        selectdateController.text=DateFormat.yMMMd().format(date).toString();
        SelectDate =DateFormat.yMMMd().format(date).toString();
      });
    }
  }

  File _pickedImage;

  void _pickImageCamera() async{
    final picker= await ImagePicker();
    final pickedImage= await picker.getImage(source:ImageSource.camera);
    final pickedImageFile =File(pickedImage.path);
    setState((){
      _pickedImage =pickedImageFile;
    });
    Navigator.pop(context);
  }

  void _pickImageGallery() async{
    final picker= await ImagePicker();
    final pickedImage= await picker.getImage(source:ImageSource.gallery);
    final pickedImageFile = File(pickedImage.path);
    setState((){
      _pickedImage =pickedImageFile;
    });
    Navigator.pop(context);
  }

  void _Remove(){
    setState((){
      _pickedImage= null;
    });
    Navigator.pop(context);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        toolbarHeight: MediaQuery
            .of(context)
            .size
            .height * 0.1,
        backgroundColor: Colors.lightBlue[300],
        leading: IconButton(icon: Icon(Icons.arrow_back, color: Colors.black),
          onPressed: () {
            Navigator.pop(context);
          },
        ),
        centerTitle: true,
        title: Text('Edit Expense', style: TextStyle(
            fontSize: 20, color: Colors.black, fontWeight: FontWeight.bold),),
      ),
      body: SingleChildScrollView(
        child: Container(
          color:Colors.grey[200],
          child: Container(
            width: MediaQuery
                .of(context)
                .size
                .width,
            margin: EdgeInsets.only(top:20.0,left: 10,right: 10),
            padding: EdgeInsets.all(8.0),
            color:Colors.white,
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  margin: EdgeInsets.only(left: 20),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text('Category', style: TextStyle(fontSize: 16.0,
                        fontWeight: FontWeight.w600,
                        color: Colors.grey[800],)),
                      SizedBox(height: 8.0),
                      Container(
                        margin: EdgeInsets.only(left: 40.0),
                        child: Padding(
                          padding: const EdgeInsets.all(1.0),
                          child: Container(
                            padding: EdgeInsets.only(left: 16.0, right: 16.0),
                            decoration: BoxDecoration(
                              border: Border.all(color: Colors.grey),
                              borderRadius: BorderRadius.circular(5.0),
                            ),
                            child: DropdownButton(
                              hint: Text('Select Category'),
                              icon: Icon(
                                Icons.arrow_drop_down, color: Colors.blue,),
                              iconSize: 30,
                              value: _category,
                              onChanged: (newValue) {
                                setState(() {
                                  _category = newValue;
                                  claimsController.text=_category;
                                });
                              },
                              items: Category.map((valueItem) {
                                return DropdownMenuItem(
                                  value: valueItem,
                                  child: Text(valueItem),
                                );
                              }).toList(),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
                SizedBox(height: 10),
                Radius: BorderRadius.circular(5.0),
                          ),
                          child: ListTile(
                            title: Text("${SelectDate}", style: TextStyle(
                                fontSize: 17, color: Colors.grey[600]),),
                            trailing: Icon(Icons.arrow_drop_down,color: Colors.blueAccent,size:30),
                            onTap: () {
                              DatePicker(context);
                            },
                          ),
                        ),
                      ),
                    ],
                  ),
                ),

                            Container(
                              width: 180,
                              height: 50,
                              child: TextField(
                                controller: amountController,
                                textAlign: TextAlign.end,
                                decoration: InputDecoration(
                                  hintText: "Enter Amount",
                                  border: OutlineInputBorder(
                                  ),
                                ),
                                keyboardType: TextInputType.number,
                              ),
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ),

                        child: Row(
                          children: [
                            Container(
                              width: 70,
                              height: 48,
                              color: Colors.grey[100],
                              child: Center(
                                child: Text('1 ${ctype} =',style:TextStyle(fontSize:16.0,color:Colors.black,)),
                              ),
                            ),
                            Container(
                              width: 140,
                              height: 48,
                              color: Colors.grey[300],
                              child: Center(
                                child: Text('${doller}',style:TextStyle(fontSize:16.0,color:Colors.black,)),
                              ),
                            ),
                            Container(
                              width: 47,
                              height: 48,
                              color: Colors.grey[100],
                              child: Center(
                                child: Text('SGD'),
                              ),
                            ),
                          ],
                        ),
                      ),
                    ],
                  ),
                ),
                SizedBox(height: 10.0),
                Container(
                  margin: EdgeInsets.only(left: 20),
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text('Tax', style: TextStyle(fontSize: 16.0,
                        fontWeight: FontWeight.w600,
                        color: Colors.grey[800],)),
                      SizedBox(height: 6.0),
                      Container(
                        margin: EdgeInsets.only(left: 40.0),
                        child: Padding(
                          padding: const EdgeInsets.all(1.0),
                          child: Container(
                            padding: EdgeInsets.only(left: 16.0, right: 16.0),
                            decoration: BoxDecoration(
                              border: Border.all(color: Colors.grey),
                              borderRadius: BorderRadius.circular(5.0),
                            ),
                            child: DropdownButton(
                              hint: Text('Please select the Tax'),
                              icon: Icon(
                                Icons.arrow_drop_down, color: Colors.blue,),
                              iconSize: 30,
                              value: taxchoose,
                              onChanged: (newValue) {
                                setState(() {
                                  taxchoose = newValue;
                                  taxController.text=taxchoose;
                                });
                              },
                              items: listTax.map((valueItem) {
                                return DropdownMenuItem(
                                  value: valueItem,
                                  child: Text(valueItem),
                                );
                              }).toList(),
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                )
                      Container(
                        margin:EdgeInsets.only(left: 30),
                        child: Row(
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Text('Click and select files-->',style: TextStyle(fontSize: 16.0,color:Colors.red),),
                            RawMaterialButton(
                              elevation: 6.0,
                              child: Icon(
                                Icons.add_a_photo, size: 40, color: Colors.blue,),
                              padding: EdgeInsets.all(8.0),
                              shape: CircleBorder(),
                              onPressed: () {
                                showDialog(context: context,
                                    builder: (BuildContext context) {
                                      return AlertDialog(
                                        title: Text('Choose option', style: TextStyle(
                                          fontWeight: FontWeight.w600,
                                          color: Colors.pinkAccent,),
                                          textAlign: TextAlign.center,
                                        ),
                                        content: SingleChildScrollView(
                                          child: ListBody(
                                            children: [
                                              InkWell(
                                                onTap:_pickImageCamera,
                                                splashColor: Colors.purpleAccent,
                                                child: Row(
                                                  crossAxisAlignment: CrossAxisAlignment
                                                      .center,

                                                ),
                                              ),
                                              SizedBox(height: 5,),
                                              InkWell(
                                                onTap:_pickImageGallery,
                                                splashColor: Colors.purpleAccent,
                                                child: Row(
                                                  crossAxisAlignment: CrossAxisAlignment
                                                      .center,
                                                  children: [
                                                    Padding(
                                                        padding: EdgeInsets.all(8.0),
                                                        child: Icon(Icons.image,
                                                            color: Colors
                                                                .purpleAccent,
                                                            size: 25)
                                                    ),
                                                    Text('Gallery', style: TextStyle(
                                                      fontSize: 18,
                                                      color: Colors.black,)),
                                                  ],
                                                ),
                                              ),
                                              SizedBox(
                                                  height: 5
                                              ),
                                              InkWell(
                                                onTap:_Remove,
                                                splashColor: Colors.purpleAccent,
                                                child: Row(
                                                  crossAxisAlignment: CrossAxisAlignment
                                                      .center,
                                                  children: [
                                                    Padding(
                                                      padding: EdgeInsets.all(8.0),
                                                      child: Icon(Icons.remove_circle,
                                                          color: Colors.purpleAccent,
                                                          size: 25),
                                                    ),

                                                  ],
                                                ),
                                              )
                                            ],
                                          ),
                                        ),
                                      );
                                    });
                              },
                            ),
                          ],
                        ),
                      ),
                      SizedBox(height:10.0),
                      Divider(height: 0.1,thickness: 1,color: Colors.grey[200],),
                      SizedBox(height:5.0),
                      FlatButton(
                        color: Colors.lightGreen,
                        shape:
                        RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(5.0),
                        ),
                        child:Text('Save',style: TextStyle(fontSize: 18.0,color:Colors.white),),
                        onPressed: () async {
                          var claims = claimsController.text;
                          var tax = taxController.text;
                          var reporttype = reporttypeController.text;
                          var merchant = merchantController.text;
                          var selectdate = selectdateController.text;
                          var description = descriptionController.text;
                          var amount = amountController.text;

                          var rsp = await claim(claims, amount, selectdate, merchant, tax, description, reporttype);
                          print(rsp);

                          if (rsp.containsKey('success') == true) {
                            print(rsp);
                            if (rsp['success'] == true) {

                              Fluttertoast.showToast(
                                  msg: "saved",
                                  toastLength: Toast.LENGTH_SHORT,
                                  gravity: ToastGravity.BOTTOM,

                                  backgroundColor: Colors.white,
                                  textColor: Colors.green,
                                  fontSize: 16.0
                              );

                            }

                            }
                          }
                        },
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

A: var result = jsonDecode(response.body);
return Expense.fromJson(result);

try changing it.


text:
Q: Introduction to php I am studying php basics and am having difficulties getting this exercise right
    please any body help? I appreciate your help in advance
    Daniel.
Note that I am only allowed to do the exercise using if...elseif...else-statement
Write a PHP script that prints a statement like below based on the information inputted in the form.
    male 0-55 years: "You're a man in his prime!"
    male over 55 years: "You are a wise man!"
    female 0-55 years: "You are a damsel at her most beautiful!"
    female over 55 years: "You look young for your age!".
The form that sends the information looks like this:
<form action="printinfo.php" method="get">
Choose your gender: <input type="radio" value="male" name="gender" checked>male
<input type="radio" value="female" name="gender">female

Write your age:
<select name="age">
<option value=1 selected>0-55</option>
<option value=2>Over 55</option>
</select>

<input type="submit" value="Send">
</form>

Example output
You're a man in his prime!

My scripts is:
<?php
$male=$_GET["male"];
$female=$_GET["female"];
if($male > 55){
echo "You're a man in his prime!";

}else if ($male <= 55){

echo "You are a wise man!";

}else if ($female <= 55){

echo "You are a damsel at her most beautiful!";

}else if ($female > 55){

echo "You look young for your age!";

?>

A: You access your global GET variables the wrong way:
$gender = $_GET['gender'];
$age = $_GET['age'];

if($gender == 'male' && $age == '0-55')
    echo "You're a man in his prime!";

Now adapt this for the rest of your code.

A: <?php
    $gender = $_GET["gender"];
    $age=$_GET["age"];
    if($gender == 'male' && $age == 2)
    {
    echo "You're a man in his prime!";

    }
    else if ($gender == 'male' && $age == 1)
    {

    echo "You are a wise man!";

    }
    else if ($gender == 'female' && $age == 1)
    {

    echo "You are a damsel at her most beautiful!";

    }
    else if ($gender  == 'female' && $age == 2)
    {

    echo "You look young for your age!";
    }
?>

HTML:

<form action="printinfo.php" method="get">
Choose your gender: <input type="radio" value="male" name="gender" checked>male
<input type="radio" value="female" name="gender">female

Write your age:
<select name="age">
<option value=1 selected>0-55</option>
<option value=2>Over 55</option>
</select>

<input type="submit" value="Send">
</form>

You forgot the use the age radio button..
And you're if else statement aren't correct use like this.
In your If statements you aren't using the age of this 'person' as you can see, the code shall never work because there is no link between '55' and you're option. Your $male and $female
is weird, they have no value.. The cause of this,
<input type="radio" value="male" name="gender"

You need to use 'name="gender"' instead of 'value="male/female"'

A: <?php
    if(isset($_GET['gender'])){
    $gender=$_GET['gender'];
    }

    if($gender = 'male' && $_GET['age'] > 55){
    echo "You're a man in his prime!";

    }else if ($gender = 'male' && $_GET['age'] <= 55){

    echo "You are a wise man!";

    }else if ($gender = 'female' && $_GET['age'] <= 55){

    echo "You are a damsel at her most beautiful!";

    }else if ($gender = 'female' && $_GET['age'] > 55){
    echo "You look young for your age!";
    }
    ?>

A: I hope you'll help a little with the analysis of this task
(also apologize for my clumsy English).
Firstly the variables you want to get in his PHP script have names that you specify for the "name" tag the "input"
Now when getting values can first check the existence of a variable if (isset($_GET['gender']))
and then perform all your operations with application instructions switch
Here is the sample code:
    <?php

//new variable for age
$age_human = $_GET['age'];

// for example
//if (!isset($age_human, $_GET['gender'])) die "Empty value";

// male or female
switch($_GET['gender'])
{
    case "male": echo "male ";
             if($age_human > 55)
             {
            echo "You're a man in his prime!";
             }
                     else if ($age_human <= 55)
             {
            echo "You are a wise man!";
                     }
                     else if ($age_human <= 55)
                     {
            echo "You are a damsel at her most beautiful!";
             }
                     else if($age_human > 55)
                     {
                        echo "You look young for your age!";
                     }
                 break;

    case "female": echo "female ";
             if($age_human > 55)
             {
            echo "You're a man in his prime!";
             }
                     else if ($age_human <= 55)
             {
            echo "You are a wise man!";
                     }
                     else if ($age_human <= 55)
                     {
            echo "You are a damsel at her most beautiful!";
             }
                     else if($age_human > 55)
                     {
                        echo "You look young for your age!";
                     }
                     break;
}

?>


text:
Q: How do I center a  when the button is altering the padding in the same ? I'm creating an HTML table with JSP and the styles are using Bootstrap.  I have two columns, one with a button and the other with text.
They're both intended to have the same padding in the table, 12px top and bottom.  The button column does have that padding on both the top and the bottom, but the text part does not.
I think what's happening is that the second column's top padding gets set up the way it's intended, and then the rest of the padding just sort of fills in.  I have two images and the code below.
The first image shows the padding around the button, and the second image shows the padding around the text.

    <c:forEach items="${results.items}" var="result">

                <form action method="post" accept-charset="UTF-8">

                        <input name="itemUri" value="${result.uri}">

                        <input class="btn btn-info"  type="submit" value="See">

                </form>

                Green Eggs and Ham

    </c:forEach>

A: This won't change the padding, but the padding is ok for the button so you can hopefully just adjust the centering of the text.
Bootstrap add vertical-align: top to tds. You can adjust with
vertical-align: inherit
or
vertical-align: middle

The text still might not appear vertically centered, but it is aligned with the button's text. i think it then becomes of question of the button's padding and/or line-height.


text:
Q: Split String in a Tuple In a function def a(l: List[(Int, String)]): List[(Int, String)] = ??? I want to split a String into their words in lower case. Commas etc. should be ignored, so I guess I need replaceAll("[^A-Za-z]+", " ").toLowerCase() somewhere? The Int value should stay the same as in the sentence.
Example how it should work:
val example = List((11, "That is great!"), (12, "Wow, impossible!"))
print(a(example))

Result
List((11, "that"),(11, "is"),(11, "great"),(12, "wow"),(12, "impossible"))

A: You can use flatMap for that:
val example = List((11, "That is great!"), (12, "Wow, impossible!"))
example.flatMap { case (int, str) =>
  str
    .replaceAll("[^A-Za-z]+", " ")
    .toLowerCase()
    .split(' ')
    .map((int, _))
}

Yields:
res0: List[(Int, String)] = List((11,that), (11,is), (11,great), (12,wow), (12,impossible))

A: This is strictly equivalent to Yuval's answer, but probably more approachable when starting with Scala
for {
  (int, str) <- example
  word <- str.replaceAll("[^A-Za-z]+", " ").toLowerCase().split(' ')
} yield (int, word)


text:
Q: How to print vector's data I've searched a lot over the internet, and couldent find simple examples to print vector's data..
I tried to print it like an array, though it didnt worked...
Here's what I tried :
using namespace std ;
.....
const int MAX = 255 ;

vector <string> testersName[MAX];
cout << testersName[i] << endl;

The error is only in the cout line, the first line is getting complied and everything goes well..
I got data inside testersName, though Im getting this error :

"Error 1   error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::vector<_Ty>' (or there is no acceptable conversion)"

A: vector <string> testersName[MAX]; declares an array of vectors, try simply vector <string> testersName(MAX); - this declares a vector with MAX elements.

A: You have to iterate over the vector's elements and then brint each one :
vector <string> testersName;
// Fill your vector
for (int i = 0; i < testersName.size(); ++i) {
    cout << testersName[i] << endl;
}

Moreover, I don't think the line vector <string> testersName[MAX]; does what you think it does. It is not necessary to give a size to the vector because it grows dynamically when you fill it. If you still want to give a size, use parenthesis : (MAX)

A: I found the best way to print a vector is to use some kind of wrapper:
Let's start off with:
template< typename T >
class ConstVecFormat
{
   private:
      std::vector<T> const& vec_;
      const std::string prefix_, delim_, suffix_;

   public:
      explicit ConstVecFormat( std::vector<T> const& vec, prefix="", delim=",", suffix="" ) :
          vec_(vec), prefix_(prefix), delim_(delim), suffix_(suffix_)
      {
      }

      std::ostream& print( std::ostream& os ) const
      {
         typename std::vector<T>::const_iterator iter = vec_.begin(), end=vec_.end();
         os << prefix_;
         if( iter != end )
              os << *iter;
         else
           while( ++iter != end )
           {
             os << delim_ << *iter;
           }

         os << suffix_;
         return os;
      }
 };

 template< typename T >
 std::ostream & operator<<( std::ostream & os, ConstVecFormat<T> const& format )
 {
     return format.print( os );
 }

This is heading towards being a duplicate of a previous topic where we enhanced this template a lot to produce one more generic for printing collections.


text:
Q: SQL Function output as a list - Python I have a function to query the data and return the output
import sqlite3
def viewdata(number):
    conn = sqlite3.connect("alpha.db")
    cursor = conn.cursor()
    cursor.execute(("SELECT Alpha,beta,gamma, number FROM alphanum WHERE number=?"),(number,))
    data=cursor.fetchall()
    conn.close()
    return data

i want the values to be stored in a list so that the Alpha becomes the first value in that list, beta becomes the second value and gamma is the third so i did this
import sqlite3
def viewdata(number):
    data=[]
    conn = sqlite3.connect("alpha.db")
    cursor = conn.cursor()
    cursor.execute(("SELECT Alpha,beta,gamma, number FROM alphanum WHERE number=?"),(number,))
    data.append(cursor.fetchall())
    conn.close()
    return data

it is not working as expected, it throws index out of range error if i use this function and try to fetch [1] value . How can i get this to work

A: The problem is not the list but rather the nested tuple.
You have something like
data = [(('f00', 1, 'bla'), (...))]

So you cannot do data[1].
Instead of .append(), use
data = cursor.fetchall()

and do not initialize it (data = []), there is no need for that.

A: I have used the list comprehension like this
def viewdata(number):
import sqlite3
conn = sqlite3.connect("alpha.db")
cursor = conn.cursor()
cursor.execute(("SELECT Alpha,beta,gamma, number FROM alphanum WHERE number=?"),(number,))
data=[i for i in cursor.fetchall()]
conn.close()
return data

and while accessing the data i am using like this
viewdata(2)[0][0]


text:
Q: ElasticSearch: Ids ending in period/dot We are experiencing quite an interesting situation these days. We had ElasticSearch 6.2 previously and upgraded it to 7.1. It looks like some data that was saved with the old version is not compatible anymore with the new and I am looking for a solution.
This is an example of a record saved with the old version:
        "_index" : "products-0_v7",
        "_type" : "_doc",
        "_id" : "18442_Product one.",
        "_score" : 11.565834,
        "_source" : {
          "description" : "",
          "priceExVat" : 15.65
        }```

The problem is that this value can no longer be retrieved by the Nest library:
_client.Get<Product>(productId, x => x.Index(index))

When debugging the call, the period sign is stripped. The same thing happen during an Index operation:
var indexRequest = new IndexRequest<InvoicableProduct>(product, aliasErpimport, new Id(product.Id));

var ret = _client.Index(indexRequest);

Any idea on how to solve this? Is it possible to have the period not stripped at all? It works if you index a value such as "Product one. " (with an extra space) but that will create a duplicate since the original record has no trailing space.

A: After a few days of investigating the problem I came to a solution. After creating a new project from scratch and running the same code it worked so I had to figure out what was breaking it in the current code.
Web.config had a line of code similar to this one:
<httpRuntime maxRequestLength="2147483647" maxQueryStringLength="32768" maxUrlLength="65536" />
The problem, turns out, is that httpRuntime is lacking the targetFramework property.
This fixed it:
<httpRuntime targetFramework="4.8" maxRequestLength="2147483647" maxQueryStringLength="32768" maxUrlLength="65536" />


text:
Q: how to calculate amount of angular bindings which was made on a page I implementing angularjs application and need to know, how much angular bindings I currently have on my page. How can I calculate it?

A: From a debug/understanding/performance point of view, I recommend you try out the AngularJS Batarang Chrome Extension. You install the extension, load up your angular application in Chrome, hit F12 to bring up developer tools, and then go to the "AngularJS" tab that the extension creates. The Performance page specifically will tell you about your bindings - it lists out all of your watch expressions and how long they are taking to calculate.


text:
Q: Dynamically change the size of embeded flash file in html object using javascript based on viewing area I have a page with a small one line header and a video on it.  I need the video to not be so large that it goes "over-the-fold".
I'm embedding the Flash video into a webpage using the following embed-code:
<object type="application/x-shockwave-flash" data="AdobeCaptions_controller.swf" width="800" height="722">
<param name="quality" value="best" />
<param name="bgcolor" value="#1a1a1a" />
<param name="allowfullscreen" value="true" />
<param name="scale" value="showall" />
<param name="allowscriptaccess" value="always" />
<param name="flashvars" value="autostart=false&thumb=FirstFrame.png&thumbscale=45&color=0x1A1A1A,0x1A1A1A" />

Unfortunately some of my coworkers are a bit on the elderly side and have zoomed their browsers in to ridiculously small sizes.  I know how to use javascript to determine the viewing area of their browser, but I can't seem to control the width and height values in the html with this.  I'm sure I'm missing one of the simplest details.  Any help would be greatly appreciated.

A: Update:
I figured out what I was doing wrong.  For anyone who stumbles across this post in the future, I found that you can't dynamically resize flash content without re-embedding a new object.  I was able to obtain a satisfactory result with the following:
<script type="text/javascript">
var vid_width = 800;
var vid_height = 722;
if (window.innerWidth){ //if browser supports window.innerWidth
    var width = window.innerWidth;
    var height = window.innerHeight;
}
else if (document.all){ //else if browser supports document.all (IE 4+)
    var width = document.body.clientWidth;
    var height = document.body.clientHeight;
}
if(height<(vid_height+40)){//if window is not tall enough
    var scale_factorH = (height-40)/vid_height;
    vid_height = vid_height * scale_factorH;
    vid_width = vid_width * scale_factorH;
}
if(width<vid_width){//if window is not wide enough
    var scale_factorW = width/vid_width;
    vid_height = vid_height * scale_factorW;
    vid_width = vid_width * scale_factorW;
}
</script>
<script type="text/javascript">
document.write("<object ");
document.write(" width = '"+vid_width+"' ");
document.write(" height = '"+vid_height+"' ");
document.write("id='csSWF'>");
</script>