text:
Q: R shiny: reset plot to default state This is a follow up to my question here.
I have a plot that is displayed when I start the shiny app, then I want to run some code which "animates" some sampling from the data.
I would like to implement a reset/clear button to reset the plot to it's original state (i.e. as if I had just started the app again). Any ideas?
Working example of my current code:
library(shiny)
library(ggplot2)

invalidateLaterNew <- function (millis, session = getDefaultReactiveDomain(), update = TRUE)
{
    if(update){
        ctx <- shiny:::.getReactiveEnvironment()$currentContext()
        shiny:::timerCallbacks$schedule(millis, function() {
            if (!is.null(session) && session$isClosed()) {
                return(invisible())
            }
            ctx$invalidate()
        })
        invisible()
    }
}

unlockBinding("invalidateLater", as.environment("package:shiny"))
assign("invalidateLater", invalidateLaterNew, "package:shiny")

data <- data.frame(ID=1:60,
                   x=sort(runif(n = 60)),
                   y=sort(runif(n = 60)+rnorm(60)))

ui <- fluidPage(
    sidebarPanel(
        sliderInput("n",
                    "Number of samples:",
                    min = 10,
                    max = nrow(data),
                    value = 20),

        sliderInput("surveys",
                    "Number of surveys:",
                    min = 1,
                    max = 10,
                    value = 5),

        actionButton("button", "Go!"),
        actionButton("reset", "Reset")
    ),
    # Show the plot
    mainPanel(
        plotOutput("plot1")
    )
)

server <- function(input, output, session) {

    plot1 <- NULL
    count <- 0

    output$plot1 <- renderPlot({
        plot1 <<- ggplot(data, aes(x=x, y=y)) + geom_point(colour="red") + theme_bw()
        plot1 <<- plot1 + geom_vline(xintercept = mean(data$x), size=1.1, colour="red")
        plot1
    })

    observeEvent(input$button,{

        count <<- 0
        output$plot1 <- renderPlot({

            count <<- count+1
            invalidateLater(500, session,  count < input$surveys)
            data$sampled <- "red"
            sample.rows <- sample(data$ID, input$n)
            data$sampled[sample.rows] <- "green"

            plot1 <<- plot1 + geom_point(x=data$x, y=data$y, colour=data$sampled, size=2)

            sample.mean.x <- mean(data$x[sample.rows])

            plot1 <<- plot1 + geom_vline(xintercept = sample.mean.x, colour="green")

            plot1

        })
    })
}

# Run the application
shinyApp(ui = ui, server = server)

I have tried wrapping the first renderPlot({...}) call in an observeEvent call with a reset button input, but no good. I have also tried creating a third renderPlot({...}) call which has an observeEvent.
I have even tried copying the "original" plot1 to a second variable and recalling that on the reset button, but no luck.

A: As per my comment in your previous question I have done the changes by adding plot1<<-NULL inside the observeEvent and then again render the original plot.
server <- function(input, output, session) {

    plot1 <- NULL
    count <- 0

    output$plot1 <- renderPlot({
      plot1 <<- ggplot(data, aes(x=x, y=y)) + geom_point(colour="red") + theme_bw()
      plot1 <<- plot1 + geom_vline(xintercept = mean(data$x), size=1.1, colour="red")
      plot1
    })

    observeEvent(input$button,{
      plot1 <<- NULL

      output$plot1 <- renderPlot({
        plot1 <<- ggplot(data, aes(x=x, y=y)) + geom_point(colour="red") + theme_bw()
        plot1 <<- plot1 + geom_vline(xintercept = mean(data$x), size=1.1, colour="red")
        plot1
      })

      count <<- 0
      output$plot1 <- renderPlot({

        count <<- count+1
        invalidateLater(500, session,  count < input$surveys)
        data$sampled <- "red"
        sample.rows <- sample(data$ID, input$n)
        data$sampled[sample.rows] <- "green"

        plot1 <<- plot1 + geom_point(x=data$x, y=data$y, colour=data$sampled, size=2)

        sample.mean.x <- mean(data$x[sample.rows])

        plot1 <<- plot1 + geom_vline(xintercept = sample.mean.x, colour="green")

        plot1

      })
    })
  }

In the above case you do not need the reset button. In case if you want a reset button you can put the plot<<-NULL and renderPlot inside the observeEvent of the reset button. Something like this:
 server <- function(input, output, session) {

    plot1 <- NULL
    count <- 0

    output$plot1 <- renderPlot({
      plot1 <<- ggplot(data, aes(x=x, y=y)) + geom_point(colour="red") + theme_bw()
      plot1 <<- plot1 + geom_vline(xintercept = mean(data$x), size=1.1, colour="red")
      plot1
    })

    observeEvent(input$button,{

      count <<- 0
      output$plot1 <- renderPlot({

        count <<- count+1
        invalidateLater(500, session,  count < input$surveys)
        data$sampled <- "red"
        sample.rows <- sample(data$ID, input$n)
        data$sampled[sample.rows] <- "green"

        plot1 <<- plot1 + geom_point(x=data$x, y=data$y, colour=data$sampled, size=2)

        sample.mean.x <- mean(data$x[sample.rows])

        plot1 <<- plot1 + geom_vline(xintercept = sample.mean.x, colour="green")

        plot1

      })
    })

    observeEvent(input$reset,{

      plot1<<- NULL

      output$plot1 <- renderPlot({
        plot1 <<- ggplot(data, aes(x=x, y=y)) + geom_point(colour="red") + theme_bw()
        plot1 <<- plot1 + geom_vline(xintercept = mean(data$x), size=1.1, colour="red")
        plot1
      })

    })

  }

Hope this helps!


text:
Q: Combine duplicate rows into single row In Excel, I need to combine duplicate rows as shown in Step 1 and combine into single row as shown in Step 2. How do I accomplish using VBA?
Please help.
Step:1
=======
| a | b | cat
----------------
| a | b | dog
----------------
| c | d | tiger
----------------
| e | f | lion
----------------
| c | d | deer
----------------

Step:2
=======
| a | b | cat,dog
---------------------
| c | d | tiger,deer
---------------------
| e | f | lion
---------------------

A: This will do what you want.
Sub Macro()
Dim lngRow As Long
For lngRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
If StrComp(Range("A" & lngRow), Range("A" & lngRow - 1), vbTextCompare) = 0 And StrComp(Range("B" & lngRow), Range("B" & lngRow - 1), vbTextCompare) = 0 Then
    If Range("C" & lngRow) <> "" Then
        Range("C" & lngRow - 1) = Range("C" & lngRow - 1) & "|" & Range("C" & lngRow)
    End If
Rows(lngRow).Delete
End If
Next
End Sub

A: I would use a PivotTable. The advantages of using such an approach over running some custom VBA that someone provides are:

*

*if you later update from A, B and C, you don't need to change your code,

*each item is sorted, but stays in separate cell so it can be easily accessed,

*you can reuse this approach in other scenarios.

Highlight your table and click Insert | PivotTable. When the PivotTable appears, drag all of the fields to the box "Rows".
Right-click on tag 'a' and choose Field settings | Layout & Print, then click 'Show labels in tabular form'. Click OK.
Repeat this for tag 'b'. You can also remove sub-totals by right-clicking on the sub-total and unchecking 'Subtotal xxx'.
I've included a screenshot below which should help.

redpajama_set_name: RedPajamaStackExchange


text:
Q: printing child tags in xml file I have an xml file with data that looks like this:
 <SpeechSegment spkid="S0">
  <Word dur="0.22" stime="0.44">oh</Word>
  <Word dur="0.27" stime="1.67">bedankt</Word>
  <Word dur="0.3" stime="2.03">voor</Word>
  <Word dur="0.53" stime="2.61">deelname</Word>
 </SpeechSegment>

What I want to do is count the words per segment and, if there are more than three words insert another "SpeechSegment" tag. So my preferred output is like this:
 <SpeechSegment spkid="S0">
  <Word dur="0.22" stime="0.44">oh</Word>
  <Word dur="0.27" stime="1.67">bedankt</Word>
  <Word dur="0.3" stime="2.03">voor</Word>
  #count is more than 3
  </SpeechSegment><SpeechSegment spkid="S0">
  <Word dur="0.53" stime="2.61">deelname</Word>
 </SpeechSegment>

I try to accomplish this using the following code:
import xml.etree.ElementTree as ET
raw = ET.parse("Interview_short.xml")
root = raw.getroot()
for child in root:
 print(child)

 count_list = 0
 for item in child:
   print(item)
   count_list = count_list + 1
   if count_list > 2:
    #add speech segment tag

I have the problem however that
 print(child)

gives me this:
 <Element 'SpeechSegment' at 0x20e3cf8>.

While I am looking for
 <SpeechSegment spkid="S0">.

Adding .text after item does not work. Any thoughts on what goes wrong here?

A: You can access the attributes of a tag by calling .attrib on the elements. In your case child.attrib will return the dictionary {'spkid': 'S0'}.
Now you can access the keys and values in the dictionary in the normal way for python.
child.attrib['spkid']

Hope that helps.
If you were also asking how to add the new tags as well, please specify that in your question.


text:
Q: matplotlib: scatter() on imshow() show points on shrunk coordinates I have a 2D array img_pseudo_df that I plot by imshow() and represents some pseudo fluorescence data where the center of each florescence spot represents a cell:
img = plt.imshow(img_pseudo_df.T, cmap=plt.cm.gray, interpolation='none', extent=(0.0,N_pixels,0.0,N_pixels))

In the above I am fixing a priori the size of the figure to N_pixels and I am transposing the image for my convenience.
The resulting figure looks like for example:

On top of this figure, I want to overlay a scatter() plot where each point represents a cell. I am passing to scatter x and y coordinates in pixel values (each within the interval [0,N_pixels]):
plt.scatter(x,y)

However for some reason these coordinates seem shrunk with respect to the coordinates of the fluorescence in the figure:

I cannot figure out what I am doing wrong and how to get matching of imshow coordinates with those of my points. This is apparently a common problem with imshow() but I could not find an answer that works for me so far.
In particular, x and y contain the index values for the row columns of img_pseudo_df array. This array is created originally by
img_pseudo_df = zeros((N_pixels,N_pixels))

Then pixels (x,y) in img_pseudo_df are assigned a certain signal value and convolved by a 2D gaussian filter (to create the pseudo fluorescence appeareance):
for cell,pixel in enumerate(zip(x,y)):
    img_pseudo_df[pixel] = signals[cell] # signals contains N cells values and there are N cells (x,y) pairs
img_pseudo_df = convolve2d(space, gaussian_kern(20), mode='valid')

As the filter is centered around zero and is built by:
def gauss_kern(size, sizey=None):
""" Returns a normalized 2D gauss kernel array for convolutions """
size = int(size)
if not sizey:
    sizey = size
else:
    sizey = int(sizey)
x, y = mgrid[-size:size+1, -sizey:sizey+1]
g = exp(-(x**2/float(size)+y**2/float(sizey)))
return g / g.sum()

I would expect the fluorescence point to be center at the cell locations (x,y).
Thanks in advance for your help.
Cheers,
M

A: Ok, there was indeed an error in the convolution. The right option was mode='same' so as to make the resulting figure match the originally empty `img_pseudo_df'.
Cheers,
M


text:
Q: creating invoice is not working through Paypal REST API I am facing the problem to create the PayPal invoice through the REST API. I got the access token by using auth API of https://api.sandbox.paypal.com/v1/oauth2/token. I am passing the token in the HEADER to create an invoice in the create invoice API of https://api.sandbox.paypal.com/v1/invoicing/invoices/.
Header:

Below is my JSON body.
{
  "merchant_info": {
    "email": "krpdas-facilitator@gmail.com",
    "first_name": "prabhu",
    "last_name": "kr",
    "business_name": "prabhu kr",
    "phone": {
      "country_code": "91",
      "national_number": "2222233333"
    },
    "address": {
        "line1": "xxxxxxxxxxx,xxxxxxx",
        "city": "xxxxxxx",
        "state": "xxxxxx",
        "postal_code": "888888",
        "country_code": "IN"
    }
  },
  "billing_info": [
    {
      "email": "lalith-facilitator@abacies.com",
        "business_name": "test facilitator",
        "additional_info": "test facilitator's Test Store",
        "address": {
            "line1": "1 Main St",
            "city": "San Jose",
            "state": "CA",
            "postal_code": "95131",
            "country_code": "US"
        }
    }
  ],
  "shipping_info": {
    "first_name": "Lalith",
    "last_name": "Kumar",
    "address": {
      "line1": "1234 Main Street",
      "city": "Anytown",
      "state": "CA",
      "postal_code": "98765",
      "country_code": "US"
    }
  },
  "items": [
    {
      "name": "Zoom System wireless headphones",
      "quantity": 2,
      "unit_price": {
        "currency": "USD",
        "value": "120"
      },
      "tax": {
        "name": "Tax",
        "percent": 8
      }
    },
    {
      "name": "Bluetooth speaker",
      "quantity": 1,
      "unit_price": {
        "currency": "USD",
        "value": "145"
      },
      "tax": {
        "name": "Tax",
        "percent": 8
      }
    }
  ],
  "discount": {
    "percent": 1
  },
  "shipping_cost": {
    "amount": {
      "currency": "USD",
      "value": "10"
    }
  },
  "note": "Thank you for your business.",
  "terms": "No refunds after 30 days."
}

I tried with changing the access token and merchant email ids. But always I am getting the same error as 401 unauthorized. I am following the documentation of https://developer.paypal.com/docs/api/invoicing/.
ERROR:
{
    "name": "AUTHORIZATION_ERROR",
    "message": "Authorization error occurred.",
    "information_link": "https://developer.paypal.com/docs/api/invoicing/#errors",
    "debug_id": "f89a30f937ced"
}

Scope:
"scope": "https://api.paypal.com/v1/payments/.*
https://uri.paypal.com/services/payments/refund
https://uri.paypal.com/services/applications/webhooks
https://uri.paypal.com/services/payments/payment/authcapture
https://uri.paypal.com/payments/payouts https://api.paypal.com/v1/vault/credit-card/.*
https://uri.paypal.com/services/disputes/read-seller
https://uri.paypal.com/services/subscriptions
https://uri.paypal.com/services/disputes/read-buyer
https://api.paypal.com/v1/vault/credit-card openid
https://uri.paypal.com/services/disputes/update-seller
https://uri.paypal.com/services/payments/realtimepayment",


text:
Q: Swift Protocol as Generic Parameter to Class I am trying to create a class (ProtocolPrinter) that takes a protocol as a generic parameter. Why won't this compile?
import Foundation

@objc protocol MyProtocol {
    func foo()
}

class MyConformingClass: MyProtocol {
    func foo() {
        print("Foo!")
    }
}

class ProtocolPrinter<T: Protocol> {
    func printT() {
        print("T: \(T.self)")
    }

    func dosomethingWithObject(_ object: T) {
        if let object = object as? MyProtocol {
            object.foo()
        } else {
            print("I don't know what object this is: \(object).")
        }
    }
}

let x = MyConformingClass()
x.foo() // Foo!

let myProtocolMeta: Protocol = MyProtocol.self // No error.

ProtocolPrinter<MyProtocol>()                        // 'ProtocolPrinter' requires that 'MyProtocol' inherit from 'Protocol'
ProtocolPrinter<MyProtocol.self>()                   // (treats "<" and ">" as operators)
ProtocolPrinter<MyProtocol.Type>()                   // 'ProtocolPrinter' requires that 'MyProtocol.Type' inherit from 'Protocol'
ProtocolPrinter<MyProtocol.Type.self>()              // (treats "<" and ">" as operators)
ProtocolPrinter<MyProtocol.Protocol>()               // type 'MyProtocol.Protocol' does not confor
ProtocolPrinter<MyProtocol.Protocol.self>()          // (treats "<" and ">" as operators)
ProtocolPrinter<MyProtocol.Protocol.Type>()          // type 'MyProtocol.Protocol.Type' does not conform to protocol 'MyProtocol'
ProtocolPrinter<MyProtocol.Protocol.Type.self>()     // (treats "<" and ">" as operators)
ProtocolPrinter<MyProtocol.Protocol.Protocol>()      // cannot use 'Protocol' with non-protocol type 'MyProtocol.Protocol'
ProtocolPrinter<MyProtocol.Protocol.Protocol.Type>() // cannot use 'Protocol' with non-protocol type 'MyProtocol.Protocol'

A: It turns out that all you need to specify a single @objc protocol that all of your other protocols (which must also be @objc protocols) conform to, for example:
import Foundation

@objc protocol SuperProtocol {}
@objc protocol MyProtocol: SuperProtocol {
    func foo()
}

class MyConformingClass: MyProtocol {
    func foo() {
        print("Foo!")
    }
}

class ProtocolPrinter<T: SuperProtocol> {
    func printT() {
        print("T: \(T.self)")
    }

    func dosomethingWithObject(_ object: T) {
        if let object = object as? MyProtocol {
            object.foo()
        } else {
            print("I don't know what object this is: \(object).")
        }
    }
}

let x = MyConformingClass()
x.foo() // Foo!
MyProtocol.Protocol.self
let myProtocolMeta: Protocol = MyProtocol.self

ProtocolPrinter<MyProtocol>().dosomethingWithObject(MyConformingClass()) // Foo!


text:
Q: Get VirtualMachineScaleSet instanceview for a ResourceGroup I am trying to get instanceview objects(VirtualMachineScaleSetInstanceViewInner) of all Azure's VirtualMachineScaleSets under a Subscription and this requires both ResourceGroup Name and Vmss name together.
azureResourceManager.virtualMachines().manager().serviceClient().getVirtualMachineScaleSets().getInstanceView(resourceGroupName, virtualMachineScaleSet.name(), Context.NONE);

How do I get specific VirtualMachineScaleSets under a ResourceGroup? I only see AzureResourceManager.ResourceGroups() and AzureResourceManager.virtualMachineScaleSets(), but nothing that gets virtualMachineScaleSets under a ResourceGroup.
Thanks

A: I have tried to get the VMSS instance in a Resource group by using the below RestApi:
 GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}?api-version=2022-08-01

output:

Body:

    {
      "name": "rajtestVMSS",
      "id": "/subscriptions/*********/resourceGroups/abcaaaa/providers/Microsoft.Compute/virtualMachineScaleSets/rajtestVMSS",
      "type": "Microsoft.Compute/virtualMachineScaleSets",
      "location": "westus2",
      "tags": {
        "azsecpack": "nonprod",
        "platformsettings.host_environment.service.platform_optedin_for_rootcerts": "true"
      },
      "sku": {
        "name": "Standard_D2s_v3",
        "tier": "Standard",
        "capacity": 2
      },
      "properties": {
        "singlePlacementGroup": false,
        "upgradePolicy": {
          "mode": "Manual"
        },
        "scaleInPolicy": {
          "rules": [
            "Default"
          ]
        },
        "virtualMachineProfile": {
          "osProfile": {
            "computerNamePrefix": "rajtestvm",
            "adminUsername": "rajtest",
            "windowsConfiguration": {
              "provisionVMAgent": true,
              "enableAutomaticUpdates": true,
              "enableVMAgentPlatformUpdates": false
            ------------------
            ------------------
            ------------------

You can use the below java code to get the VirtualMachine ScaleSet instanceview for a ResourceGroup.
 import com.azure.core.util.Context;

 public final class Main {
     public static void getAVirtualMachineScaleSet(com.azure.resourcemanager.AzureResourceManager azure) {
         azure
             .virtualMachines()
             .manager()
             .serviceClient()
             .getVirtualMachineScaleSets()
             .getByResourceGroupWithResponse("myResourceGroup", "myVirtualMachineScaleSet", null, Context.NONE);
     }
 }

Thanks to @XiaofeiCao for the github link to know more about Azure Resource Manager client library for Java.


text:
Q: Header of NavigationView not showing unless there is margin to top I am creating an Android app which got a navigation drawer in a layout:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include
        layout="@layout/navigation_select_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/navigation_drawer_header_layout"
        app:menu="@menu/main_drawer_options" />
</android.support.v4.widget.DrawerLayout>

the navigation_drawer_header_layout:
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textViewButtonCloseDrawer"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignParentRight="true"
        android:gravity="center"
        android:text="X"/>
</RelativeLayout>

The header layout is added but not showing unless I add either a top margin for the TextView or some padding to the RelativeLayout which pushes the TextView down.
Why won't it show as defined in the header layout? Why is the need to push the layout in order for it to be shown?

A: As understood from the comments, you got a ToolBar which hides the content instead of staying above it at all times. Check out this answer here which might solve your problem:
Display content under toolbar


text:
Q: Allocating memory for Heap with mallocs I'm having problems declaring a new heap, empty, with max size "capacity".
Heap struct:
typedef struct {
    /* number of elements on vector */
    int size;
    /* vector max size */
    int capacity;
    /*vector of pointers for elements*/
    element_t** elements;
} heap;

Element_t struct:
typedef struct element_
{
    char nameItem[100];
    char expirationDate[11];
    int qty;
    int sellRate;
    float priorityVal;
} element_t;

The function that I need to create the heap is declared like that, where the argument capacity is the heap capacity.
heap* new_heap(int capacity){

Function that insert elements in Heap:
int heap_insert(heap *h, element_t* elem)
{
    element_t * aux;
    int i;
    //gilc
    if(!h) return 0;
    /* if heap is full, dont insert element */
    if (h->size >= h->capacity)
        return 0;

    if (!elem)
        return 0;

    /* insert element in the end of the heap */
    h->size++;
    i = h->size;
    h->elements[i] = elem;

    /* while element has more prioritary than his father, trade them */
    while (i != ROOT && bigger_than(h->elements[i], h->elements[FATHER(i)]))
    {
        aux = h->elements[FATHER(i)];
        h->elements[FATHER(i)] = h->elements[i];
        h->elements[i] = aux;
        i = FATHER(i);
    }
    return 1;

    //Default
    return 0;
}

FATHER and ROOT is defined like that (I don't understand what that means, was pre-defined for the project too)
#define FATHER(x)       (x/2)
#define ROOT        (1)

and bigger_than like this:
int bigger_than(element_t* e1, element_t* e2)
{
    if (e1 == NULL || e2 == NULL)
    {
        return 0;
    }

    return e1->priorityVal > e2->priorityVal;
}

What malloc calls do I need to use? The function new_heap must allocate all memory necessary for the number of elements specified as argument capacity.

A: heap *new_heap(int capacity) {
    heap *h = malloc(sizeof(heap));
    h->size = 0;
    h->capacity = capacity;
    h->elements = malloc(capacity * sizeof(element_t *));
    return h;
}

The first malloc will make enough space for your heap structure. The second is for "vector" (as you called it) of pointers to elements, since these need to be stored in a separate spot in memory (based on your declaration of heap). Together, this allocates all the memory you need for the heap. I'm assuming you'll also have a new_element function that will handle allocating the memory for an individual element for you whenever you want to add something to the heap.


text:
Q: How to insert data with SQLAlchemy I have trouble inserting data into a database with SQLAlchemy.
I use scoped_session with a context manager (class implementation):
class Session:
    def __init__(self):
        pass

    def __enter__(self):
        engine = create_engine("sqlite:///test.db", echo = True)
        self.connection = engine.connect()
        self.session = scoped_session(\
                sessionmaker(\
                autocommit=True,\
                autoflush=False,\
                bind=engine))
        return self.session

    def __exit__(self, type, value, traceback):
        self.session.close()
        self.connection.close()

My inserting function:
def insert_value(a, b, c)
    with db_session() as db:
        db.add(Value(a = a, b = b, c = c))

The value is not properly added to the database even after the commit but for some reason, it works with a query().filter().update().
The db.add() doesn't produce any log and the documentation of SQLAlchemy is no help.
EDIT:
The problem is with db.add() as select, update and delete operations are done through queries (e.g. db.query().all(), db.query().values() or db.query().delete()) and work fine.
EDIT 2:
Some precision about how I instance the class and engine
Base = declarative_base()

class Value(Base):
    __tablename__ = "values"

    a = ...
    b = ...
    c = ...

Base.metadata.create_all(create_engine(...))

A: https://docs.sqlalchemy.org/en/14/orm/session_transaction.html
Based on the above documentation, I guess autocommit has been deprecated. They have a session.begin() method now for auto commiting.
So you can use it this way:
with db_session.begin():
      foo

A: I fixed the issue.
I think causes of the issue were:

*

*the use of autocommit

*I initiated an engine twice, once for the Session and once for the base classes.

engine = create_engine(...) // Initiated once and for all

Base = declarative_base()

class Value(Base):
    __tablename__ = "values"

    a = ...
    b = ...
    c = ...

Base.metadata.create_all(engine)

class DbSession:
    def __init__(self):
        pass

    def __enter__(self):
        self.connection = engine.connect() // Reuse the engine instead of creating a new one
        self.session = scoped_session(\
                sessionmaker(\
                autocommit=False,\
                autoflush=False,\
                bind=engine))
        return self.session

    def __exit__(self, type, value, traceback):
        self.session.commit()
        self.session.close()
        self.connection.close()

def insert_value(a, b, c):
    with DbSession() as db:
        db.add(Value(a = a, b = b, c = c))


text:
Q: Refactoring a series of nested try except blocks I have a class called bit that codes for an svg rectangle.  The class is instantiated with a variable saying what color the svg rectangle should be.  I want it to accept colors in four styles.  hex, rgb percent triplet, rgb integer triplet, and named.  The init function then converts the color value to hex.  I've got it working but it relies on a nested try except block and the exceptions thrown by the webcolors module.  If one conversion fails it tries the next, and so on until it either succeeds or raises a final exception.
import svgwrite
from webcolors import name_to_hex, normalize_integer_triplet, rgb_percent_to_hex, normalize_hex, normalize_percent_triplet, rgb_to_hex

dwg = svgwrite.Drawing('qr.svg')

class Bit:
    def __init__(self, bit_color:str, spec:str='css3'):
        self.bit_type=1
        self.spec=spec
        try:
            self.bit_color=name_to_hex(bit_color,spec)
        except (ValueError, AttributeError):
            try:
                self.bit_color=rgb_to_hex(normalize_integer_triplet(bit_color))
            except (ValueError, TypeError):
                try:
                    self.bit_color=rgb_percent_to_hex(normalize_percent_triplet(bit_color))
                except ValueError:
                    try:
                        self.bit_color=normalize_hex(bit_color)
                    except ValueError:
                        raise ValueError('Color not recognized!')

While this works and lets the user enter a color in the most common ways, it looks pretty ugly to me.  Is there a way to refactor this?

A: One possibility:
        try:
            self.bit_color=name_to_hex(bit_color, spec)
            return
        except (ValueError, AttributeError):
            pass

        try:
            self.bit_color=rgb_to_hex(normalize_integer_triplet(bit_color))
            return
        except (ValueError, TypeError):
            pass

        try:
            self.bit_color=rgb_percent_to_hex(normalize_percent_triplet(bit_color))
            return
        except ValueError:
            pass

        try:
            self.bit_color=normalize_hex(bit_color)
        except ValueError:
            raise ValueError('Color not recognized!')


text:
Q: Running programs on Ubuntu Does Ubuntu run just about any program I can run on windows?
I'm not a coder, can I still effectively use Ubuntu?

A: Ubuntu is a Debian based Linux operating system.
That means you can install Debian software packages which will run natively on it and of course you can also run all kinds of scripts. However, the Windows binary executable format (PE) is incompatible with the one Linux systems support (ELF).
Ubuntu has a huge software repository where you can find tons of free applications written for Ubuntu, including many apps you know from Windows like Firefox, Thunderbird, VLC, GIMP, etc. Check out your Software Center application to browse the repositories.
If you need to run Windows applications, because it is a special software which did not get ported to Linux and does not have a Linux alternative, you have three options:

*

*Install Ubuntu in dual-boot with Windows, that way you have two OS installed on your computer and can chose which one to load on every boot.

*Virtualize one system, you can either run an Ubuntu VM on Windows or a Windows VM on Ubuntu. That way the guest OS runs inside a virtualization application on the host system. It will be slow though, but you can quickly switch and run stuff in parallel.

*Use the compatibility layer Wine to run Windows executables directly on Linux. It is not a virtual machine but translates the system calls the Windows executables want to make to match the Linux interface. This is slower than a native application, but usually faster than a full VM. However, not all applications are compatible with Wine, some work better and some don't work at all. There's a list of tested applications which you can check before trying a piece of software in Wine.


text:
Q: How to calculate speed using accelerometer in ios I want to implement a functionality to calculate the speed of moving object, but I don't want to use GPS(CLLocationManager).
Any suggestions on other ways to calculate speed?

A:
I want to implement a functionality to calculate speed of moving object, but I don't want to using GPS(CLLocation).

An object traveling at constant velocity doesn't experience any forces for the accelerometer to measure, so the accelerometer alone isn't enough to determine velocity -- you can only measure changes in velocity. If you know the initial velocity, like if the user tells you that the phone is at a standstill, then you can monitor acceleration and use that to determine velocity. That's likely to be quite error-prone, however, and the error will accumulate over time so that your velocity measurement will become less and less accurate.
There might be other ways to measure speed, like taking several photos with the camera and trying to determine speed from the changes in the images. Or you could measure average speed between two known points by observing the time between leaving one known wifi SSID and reaching another. But the right way to determine velocity is really to use the Location Manager.


text:
Q: text box does not show the error  I am trying to validate two data of birth text box fields if the member does not enter  in
these two boxes an error message will popped out like "pls enter valid date format"
by using the following code
       if (tbStartDate.Text != "0" && tbEndDate.Text != "0")
       {

        string dob = tbStartDate.Text;
        DateTime dv = DateTime.Parse(dob);
        string format1 = dv.ToString("yyyy-MM-dd");
        string dob2 = tbEndDate.Text;
        DateTime dt2 = DateTime.Parse(dob2);
        string format2 = dt2.ToString("yyyy-MM-dd");
     }
      else
     {
            MessageBox.Show("pls enter valid date ");

     }

when i am trying to save with out entering the  textbox values it was showing  error like this
  "String was not recognized as a valid DateTime".
can any one help on this....
this is modified code still it was showing error at Datetime DV;
         private void btnCTimetablessave_Click(object sender, EventArgs e)
    {
        string dob = tbStartDate.Text;
        DateTime dv;
        if (!DateTime.TryParse(dob, out dv))
        {

            MessageBox.Show("pls enter a valid  start date");
            return;
        }

        string format1 = dv.ToString("yyyy-MM-dd");
        string dob2 = tbEndDate.Text;
        DateTime dt2;
        if (!DateTime.TryParse(dob2, out dt2))
        {
            MessageBox.Show("pls enter valid end date");
            return;
        }

        string format2 = dt2.ToString("yyyy-MM-dd");

still it was showing error like this   "String was not recognized as a valid DateTime" at datetime Dv;
and this is modified code third time
       private void btnCTimetablessave_Click(object sender, EventArgs e)
      {
         string dob = tbStartDate.Text;
        DateTime dv;
        if (!DateTime.TryParse(dob, out dv))
        {

            MessageBox.Show("pls enter a valid  start date");
            return ;
        }

        string format1 = dv.ToString("yyyy-MM-dd");
        string dob2 = tbEndDate.Text;
        DateTime dt2;
        if (!DateTime.TryParse(dob2, out dt2))
        {
            MessageBox.Show("pls enter valid end date");
            return;
        }

        string format2 = dt2.ToString("yyyy-MM-dd");
     }

A: Don't use DateTime.Parse. Use DateTime.TryParse instead. The result is a boolean value that returns true if the parsing was successfully.
Update
As requested in your comment:
DateTime dv;
if(!DateTime.TryParse(dob,out dv)){
   MessageBox.Show("Please enter a valid date");
   return;
}
....

Cleary, you also can use Parse and catch the exception, but this would be bad style. Better to use TryParse. I have only checked for one date value. You can extend the logic for your needs. Hope this helped.

A: It is because an empty textbox returns an empty string when you access the Text property and  DateTime.Parse() will throw that exception if passed an empty string.

A: Check using string.IsNullOrEmpty(tbStartDate.Text) whether its blank or not.
I would recommend using a DatetimePicker for selecting the date's which will return you a valid DateTime value which you can use for further processing

A: You have to use Datetime.TryParse like this
if(!DateTime.TryParse(dob))

A: I suggest you to use try catch block to catch FormatException so that if user doesn't enter date in proper format it will catch the exception and give message of your choice
try
{
    string dob = tbStartDate.Text;
    DateTime dv = DateTime.Parse(dob);
    string format1 = dv.ToString("yyyy-MM-dd");
    string dob2 = tbEndDate.Text;
    DateTime dt2 = DateTime.Parse(dob2);
    string format2 = dt2.ToString("yyyy-MM-dd");
}
catch (System.FormatException)
{
    MessageBox.Show("pls enter valid date format");
}

OR
using  DateTimePicker is Always a better and user friendly approach


text:
Q: What is the correct way to call a C++ template base class's constructor I have an issue related to calling a constructor in the template base class from a derived class.
template <typename Curve> struct LogNormalCurve: TEvolveCurve<Curve, QMaths::LNProcess>
{
#ifndef _MSC_VER
    LogNormalCurve(std::shared_ptr<Curve> curve) : TEvolveCurve<Curve, QMaths::LNProcess>(curve) {}
#else
    LogNormalCurve(std::shared_ptr<Curve> curve) : TEvolveCurve(curve) {}
#endif
};

So LogNormalCurve derives from TEvolveCurve where it's a template class with two arguments.
I need to insert an ugly _MSC_VER to the code because Visual Studio 2013 only compiles with "TEvolveCurve(curve)" while XCode is only able to compile with "TEvolveCurve<Curve, QMaths::LNProcess>".
I'm using the default C++11 compilers.


text: Q: Inserting references into xtable in Rmd document I'm embedding an xtable-formatted table into a paper where I need to include citations. For example, check out this table. In the second row it has "Baxter (23)" where the 23 is the reference number. When we made that table, we hard coded the reference number (code here). Is there a direct way to do this within knitr if we put the table inside the manuscript Rmd file? When I do this and instead of the 23 put" [@SchlossXXXX]" it renders as [@SchlossXXXX].


text:
Q: Proof subextension of Abelian extension is also abelian This is a property listed on MathWorld:

One nice property of an Abelian extension $K$ of a field $F$ is that
  any intermediate subfield $E$, with $F \subset E \subset K$, must be a
  Galois extension field of $F$ and, by the fundamental theorem of
  Galois theory, also an Abelian extension

What specifically about the fundamental theorem of Galois Theory shows that? To my knowledge, it only shows a one-to-one correspondence from the Galois subgroups and the intermediate fields. How does that make it abelian?
Thanks!

A: The fundamental theorem tells you that $E/F$ is Galois and that $\text{Gal}(E/F)$ is a quotient of $\text{Gal}(K/F)$--and quotients of abelian groups are abelian.


text:
Q: Intro to stats probability inequality question y    :  10      20     25       30      45    50
p(y) :0.155   0.237   0.184   0.122     ?    0.258
a. Find p(45).
b. Find P(Y ≥ 25) and P(Y > 25).
c. Find the probability Y is divisible by 10.

A: The possible values of your random variable are:
$$y = (10, 20, 25, 30, 45, 50)$$ and the respective
probabilities in the PDF are
$$p = (0.155, 0.237, 0.184, 0.122, 0.044, 0.258),$$
where the ? is replaced by 0.044 in order for the
probabilities to add to $1,$ as they must.
Then $p(45) = 0.044.$ Also,
$$P(Y \ge 25) = 0.184 + 0.122 + 0.044 + 0.258.$$
And so on.
Note: Maybe the next step in your study of random variables is to find the mean of this one:
$$\mu = 10(0.155) + 20(0.237) + \dots + 50(0.258) = 29.43.$$
Below is a bar graph of your 'probability distribution function'
(or 'point mass function'). Does it look to you as if this graph 'balances' at
$\mu = 29.43$?

A: I shall only provide hints.
A. If $f(y)$ is a probability mass function for a discrete random variable, then
$$ \sum_{y \in Y} f(y) = 1 $$
i.e., all the probabilities sum to $1$. Add the given values and subtract from $1$.
B. The expression $P(Y \geq y)$ means that you are finding the probability that $Y$ is larger than $y$. Add the probabilities for any $y$ that satisfy this condition. The second part is similar but the inequality is strict.
C. Similar to B, except the condition is divisibility. Which $y$ satisfy the condition? Add.


text:
Q: NSComboBox not showing current selected value in dropdown So new to programming Mac apps and am running into a problem. On my NSComboBoxes they do not highlight the currently selected item when reopening the dropdown. I might just be blind or maybe the default highlight color is transparent. I just don't know. See the below image for what I am getting.

At this point I have very little code written and everything is being done on my Storyboard. Just a little confused why it isn't doing something that should be quite simple. Guess I spent too much time in iOS land.
So decided to recreate the entire project as just one single sample NSCombobox to demonstrate that this happens on something simple for me while running Xcode 9.2.

The only outlet I have hooked up are the delegates and datasource for the NSComboBox. And the only settings changed on the NSComboBox are to enable datasource, and to change the behavior toe Selectable. The code to run this combo is just as simple:
import Cocoa

class ViewController: NSViewController, NSComboBoxDelegate,   NSComboBoxDataSource {
    @IBOutlet weak var combo: NSComboBox!
    var dataSource: [String] = ["Off"]

    override func viewDidLoad() {
        super.viewDidLoad()

        for index in 1...512 {
            dataSource.append("\(index)")
        }
        combo.reloadData()
        combo.selectItem(at: 0)
    }

    func comboBox(_ comboBox: NSComboBox, objectValueForItemAt index: Int) -> Any? {
        return dataSource[index]
    }

    func numberOfItems(in comboBox: NSComboBox) -> Int {
        return dataSource.count
    }
}

According to Apple documentation here the dropdown should show the selected item: Apple NSComboBox Docs

A: The list opens where you left it. Implement the NSComboBoxDataSource method
optional func comboBox(_ comboBox: NSComboBox, indexOfItemWithStringValue string: String) -> Int

to let the combobox know which row to select.

Return Value
The index for the item that matches the specified string, or NSNotFound if no item matches.
Discussion
An NSComboBox object uses this method to synchronize the pop-up list's selected item with the text field's contents. If you don't implement this method the receiver does not synchronize the pop-up list's selected item with the text field's contents.

A: If the comboBox already has a selectedIndex (either initialized or subsequently selected), then wouldn't this work:
func comboBox(_ comboBox: NSComboBox, indexOfItemWithStringValue string: String) -> Int {
     return comboBox.indexOfSelectedItem
}


text:
Q: How can I use Powershell's ExitCode to restart a Client/Server pair that I shut down? I have a simple Java client-server application (code linked on previous Stack question here), that I can run all together with the following Powershell code:
Start-Process java "-cp .;.\lib\commons-io-2.4.jar  FixedMessageSequenceServer"
Start-Sleep -Seconds 1
$JavaClient = Start-Process java "-cp .;.\lib\commons-io-2.4.jar FixedMessageSequenceClient -Wait -PassThru"

This works fine. However, I want to add either Powershell code or Java code that would restart the above Powershell code if we force shutdown ( by  CTRL-C ) the application (from the Server-side).
I thought that I should be apple to use this code :
if($JavaClient.ExitCode)
{
    # exit code is non-zero, better retry
    Start-Process java "-cp .;.\lib\commons-io-2.4.jar  FixedMessageSequenceServer" -Wait
    Start-Process java "-cp .;.\lib\commons-io-2.4.jar FixedMessageSequenceClient -Wait -PassThru"
}

However this does not do anything when I run it. Would I need to append some Java ProcessBuilder code to achieve desired functionality ?  Do we need to do processing of the $JavaClient.ExitCode ?
thanks

A: If you're only evaluating on a single if statement you have a small window for when it can restart even if that code you have did work.
I suggest you create a small polling script that will check the status of a certain process every 10 seconds, 1 minute, etc. and if it isn't running it can start it that way. You could nest this in an infinite loop if the java client should be running at all times, or you could use scheduled tasks to kick off the script if it should be running at a consistent interval/trigger (i.e. top of every hour, etc.)
Try something like this:
if(![bool](get-process java -ErrorAction SilentlyContinue)){
    start-process java "-cp .;.\lib\commons-io-2.4.jar FixedMessageSequenceClient -Wait -PassThru"
}

A: The following code I have works, but it's not very graceful way of doing it:
This is my Java class :
import java.io.*;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class FixedMessageRunner{

public static void main(String[] args) {

  //  File file = new File("C://Java_Scratch_//Autonomic_Using_Batch//someFile.txt" );

  try {
   /* StackOverflow code */

    for  (  ;  ; )  {
     ProcessBuilder pb = new ProcessBuilder("Powershell ", "WindowsTaskSchedulerPS.PS1");
     pb.directory(new File("C://Java_Scratch3_new_cleaned_Mar12//"));
     Process p = pb.start();
     p.waitFor();
    }
  /* end - StackOverflow code */

  }
  catch (IOException i) {
    i.printStackTrace();
  }

  catch (InterruptedException i) {
    i.printStackTrace();
  }

 // end-count_func

}

}

And here is my powershell code, the standard one :
# exit code is non-zero, better retry
Start-Process java "-cp .;.\lib\commons-io-2.4.jar  FixedMessageSequenceServer"
Start-Sleep -Seconds 1
Start-Process java "-cp .;.\lib\commons-io-2.4.jar FixedMessageSequenceClient"

When I run the Java code, I need to kill Powershell.exe from the Windows Task Manager, in order to trigger that above waitFor()


text:
Q: What data are safe to publish from the "config.log" and what not? I am totally new to programming world and I don't succeed in finding a solution to download Ruby.
The question I asked isn't answered so far. Therefore I want to publish my config.log. But I really dunno if it is safe to publish all from the config.log.
Can anyone tell me what is safe to publish?
Well maybe it is dangerous but this is the config.log and I at least deleted my computer name:
TThis file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was
$ ./configure --prefix=/Users//.rbenv/versions/2.6.3 --with-openssl-dir=/usr/local/opt/openssl
---------
Platform.
---------
hostname = MacBook-Pro-van-J.local
uname -m = x86_64
uname -r = 18.6.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X     = unknown
/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = Mach kernel version:
     Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 8.00 gigabytes
Default processor set: 402 tasks, 1379 threads, 4 processors
Load average: 1.90, Mach factor: 2.09
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown
PATH: /usr/local/Cellar/rbenv/1.1.2/libexec
PATH: /Users//.rbenv/plugins/ruby-build/bin
PATH: /Users//.rbenv/shims
PATH: /Users//.rbenv/shims
PATH: /Users//.rbenv/shims
PATH: /Users//.rbenv/shims
PATH: /Users//.rbenv/shims
PATH: /Users//.rbenv/shims
PATH: /Users//anaconda3/bin
PATH: /Users//anaconda3/condabin
PATH: /Library/Frameworks/Python.framework/Versions/3.7/bin
PATH: /usr/local/bin
PATH: /usr/local/sbin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
-----------
Core tests.
-----------
configure:2996: checking for ruby
configure:3014: found /usr/bin/ruby
configure:3027: result: /usr/bin/ruby
configure:3105: checking build system type
configure:3119: result: x86_64-apple-darwin18.6.0
configure:3207: checking host system type
configure:3220: result: x86_64-apple-darwin18.6.0
configure:3240: checking target system type
configure:3253: result: x86_64-apple-darwin18.6.0
configure:3905: checking for C compiler version
configure:3914: x86_64-apple-darwin13.4.0-clang --version >&5
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
InstalledDir: /Users//anaconda3/bin
configure:3925: $? = 0
configure:3914: x86_64-apple-darwin13.4.0-clang -v >&5
clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix
InstalledDir: /Users//anaconda3/bin
configure:3925: $? = 0
configure:3914: x86_64-apple-darwin13.4.0-clang -V >&5
clang-4.0: error: argument to '-V' is missing (expected 1 value)
clang-4.0: error: no input files
configure:3925: $? = 1
configure:3914: x86_64-apple-darwin13.4.0-clang -qversion >&5
clang-4.0: error: unknown argument: '-qversion'
clang-4.0: error: no input files
configure:3925: $? = 1
configure:3945: checking whether the C compiler works
configure:3967: x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe  -I/Users//.rbenv/versions/2.6.3/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -L/Users//.rbenv/versions/2.6.3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs conftest.c  >&5
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
configure:3971: $? = 1
configure:4009: result: no
configure: failed program was:
| /* confdefs.h /
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| / end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:4014: error: in /var/folders/19/1hf7txt144z0k3flz7fy50y40000gn/T/ruby-build.20190610140025.11270/ruby-2.6.3':
configure:4016: error: C compiler cannot create executables
Seeconfig.log' for more details
----------------
Cache variables.
----------------
ac_cv_build=x86_64-apple-darwin18.6.0
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=x86_64-apple-darwin13.4.0-clang
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe '
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-I/Users//.rbenv/versions/2.6.3/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9'
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0'
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=x86_64-apple-darwin13.4.0-clang++
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-L/Users//.rbenv/versions/2.6.3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_cflags_set=
ac_cv_env_cflags_value=
ac_cv_env_cppflags_set=
ac_cv_env_cppflags_value=
ac_cv_env_cxxflags_set=
ac_cv_env_cxxflags_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-apple-darwin18.6.0
ac_cv_path_BASERUBY=/usr/bin/ruby
ac_cv_prog_CC=x86_64-apple-darwin13.4.0-clang
ac_cv_target=x86_64-apple-darwin18.6.0
-----------------
Output variables.
-----------------
ALLOCA=''
AR='/Users//anaconda3/bin/x86_64-apple-darwin13.4.0-ar'
ARCHFILE=''
ARCH_FLAG=''
ARFLAGS=''
AS='/Users//anaconda3/bin/x86_64-apple-darwin13.4.0-as'
ASFLAGS=''
ASMEXT=''
BASERUBY='/usr/bin/ruby --disable=gems'
BOOTSTRAPRUBY=''
BTESTRUBY=''
BUILTIN_ENCOBJS=''
BUILTIN_TRANSOBJS=''
BUILTIN_TRANSSRCS=''
CAPITARGET=''
CC='x86_64-apple-darwin13.4.0-clang'
CCDLFLAGS=''
CC_VERSION=''
CC_VERSION_MESSAGE=''
CC_WRAPPER=''
CFLAGS='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe '
CHDIR=''
COMMON_HEADERS=''
COMMON_LIBS=''
COMMON_MACROS=''
CONFIGURE=''
COUTFLAG=''
CP=''
CPP=''
CPPFLAGS='-I/Users//.rbenv/versions/2.6.3/include -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9'
CPPOUTFILE=''
CROSS_COMPILING=''
CSRCFLAG=''
CXX='x86_64-apple-darwin13.4.0-clang++'
CXXFLAGS='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0'
DEFS=''
DESTDIR=''
DLDFLAGS=''
DLDLIBS=''
DLDSHARED=''
DLEXT2=''
DLEXT=''
DLLWRAP=''
DLNOBJ=''
DOT=''
DOXYGEN=''
DTRACE=''
DTRACE_EXT=''
DTRACE_OBJ=''
DTRACE_OPT=''
DTRACE_REBUILD=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_DEBUG_ENV=''
ENABLE_SHARED=''
ENCOBJS=''
ENCSTATIC=''
EXECUTABLE_EXTS=''
EXEEXT=''
EXPORT_PREFIX=''
EXTDLDFLAGS=''
EXTLDFLAGS=''
EXTOBJS=''
EXTOUT=''
EXTSTATIC=''
GCC=''
GIT='git'
GNU_LD=''
GREP=''
HAVE_BASERUBY='yes'
HAVE_GIT='yes'
INSTALLDOC=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTALL_STATIC_LIBRARY=''
LD='/Users//anaconda3/bin/x86_64-apple-darwin13.4.0-ld'
LDFLAGS='-L/Users//.rbenv/versions/2.6.3/lib -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs'
LDSHARED=''
LDSHAREDXX=''
LIBEXT=''
LIBOBJS=''
LIBPATHENV=''
LIBPATHFLAG=''
LIBRUBY=''
LIBRUBYARG=''
LIBRUBYARG_SHARED=''
LIBRUBYARG_STATIC=''
LIBRUBY_A=''
LIBRUBY_ALIASES=''
LIBRUBY_A_OBJS=''
LIBRUBY_DLDFLAGS=''
LIBRUBY_LDSHARED=''
LIBRUBY_RELATIVE=''
LIBRUBY_SO=''
LIBRUBY_SONAME=''
LIBS=''
LINK_SO=''
LN_S=''
LTLIBOBJS=''
MAINLIBS=''
MAJOR='2'
MAKEDIRS=''
MAKEFILES=''
MANTYPE=''
MATHN=''
MINIOBJS=''
MINIRUBY=''
MINOR='6'
MJIT_CC=''
MJIT_CFLAGS=''
MJIT_DEBUGFLAGS=''
MJIT_HEADER_FLAGS=''
MJIT_HEADER_INSTALL_DIR=''
MJIT_LDSHARED=''
MJIT_OPTFLAGS=''
MJIT_SUPPORT=''
MKDIR_P=''
NM='/Users//anaconda3/bin/x86_64-apple-darwin13.4.0-nm'
NULLCMD=''
OBJCOPY=''
OBJDUMP=''
OBJEXT=''
OUTFLAG=''
PACKAGE=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PKG_CONFIG=''
PLATFORM_DIR=''
POSTLINK=''
PRELOADENV=''
PREP=''
RANLIB='/Users//anaconda3/bin/x86_64-apple-darwin13.4.0-ranlib'
RDOCTARGET=''
RI_BASE_NAME=''
RM=''
RMALL=''
RMDIR=''
RMDIRS=''
RPATHFLAG=''
RUBYW_BASE_NAME='rubyw'
RUBYW_INSTALL_NAME=''
RUBY_API_VERSION='$(MAJOR).$(MINOR)'
RUBY_BASE_NAME='ruby'
RUBY_EXEC_PREFIX=''
RUBY_INSTALL_NAME=''
RUBY_LIB_VERSION=''
RUBY_LIB_VERSION_STYLE=''
RUBY_PROGRAM_VERSION='2.6.3'
RUBY_SEARCH_PATH=''
RUBY_SO_NAME=''
RUBY_VERSION_NAME='${RUBY_BASE_NAME}-${ruby_version}'
RUNRUBY=''
RUNRUBY_COMMAND=''
SET_MAKE=''
SHELL='/bin/sh'
SOEXT=''
SOLIBS=''
STATIC=''
STRIP='/Users//anaconda3/bin/x86_64-apple-darwin13.4.0-strip'
SYMBOL_PREFIX=''
TEENY='3'
TEST_RUNNABLE=''
THREAD_MODEL=''
TRY_LINK=''
UNIVERSAL_ARCHNAMES=''
UNIVERSAL_INTS=''
USE_RUBYGEMS=''
WERRORFLAG=''
WINDRES=''
XCC_WRAPPER=''
XCFLAGS=''
XLDFLAGS=''
XRUBY=''
XRUBY_LIBDIR=''
XRUBY_RUBYHDRDIR=''
XRUBY_RUBYLIBDIR=''
X_FIBER_COROUTINE_H=''
ac_ct_AR=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_NM=''
ac_ct_OBJCOPY=''
ac_ct_OBJDUMP=''
ac_ct_RANLIB=''
arch=''
archincludedir=''
archlibdir=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin18.6.0'
build_alias=''
build_cpu='x86_64'
build_os='darwin18.6.0'
build_vendor='apple'
cflags=''
codesign=''
configure_args=''
cppflags=''
cxxflags=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
debugflags=''
docdir='${datarootdir}/doc/${PACKAGE}'
dsymutil=''
dvidir='${docdir}'
exec=''
exec_prefix='NONE'
host='x86_64-apple-darwin18.6.0'
host_alias=''
host_cpu='x86_64'
host_os='darwin18.6.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libdirname=''
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
optflags=''
pdfdir='${docdir}'
prefix='/Users//.rbenv/versions/2.6.3'
program_transform_name='s&^&&'
psdir='${docdir}'
ridir=''
ruby_pc=''
ruby_version=''
rubyarchdir=''
rubyarchhdrdir=''
rubyarchprefix=''
rubyhdrdir=''
rubylibdir=''
rubylibprefix=''
rubysitearchprefix=''
rubyw_install_name=''
sbindir='${exec_prefix}/sbin'
setup=''
sharedstatedir='${prefix}/com'
sitearch=''
sitearchdir=''
sitearchhdrdir=''
sitearchincludedir=''
sitearchlibdir=''
sitedir=''
sitehdrdir=''
sitelibdir=''
strict_warnflags=''
sysconfdir='${prefix}/etc'
target='x86_64-apple-darwin18'
target_alias=''
target_cpu='x86_64'
target_os='darwin18'
target_vendor='apple'
try_header=''
vendorarchdir=''
vendorarchhdrdir=''
vendordir=''
vendorhdrdir=''
vendorlibdir=''
warnflags=''
-----------
confdefs.h.
-----------
/* confdefs.h */
define PACKAGE_NAME ""
define PACKAGE_TARNAME ""
define PACKAGE_VERSION ""
define PACKAGE_STRING ""
define PACKAGE_BUGREPORT ""
define PACKAGE_URL ""
configure: exit 77


text:
Q: Error Page Exception When I tried to update a name field in my application , I have received error page with this error -

SRVE0260E: The server cannot use the error page specified for your
  application to handle the Original Exception printed below.

Original Exception:
Error Message: java.io.FileNotFoundException: SRVE0190E: File not found: /custnull
Error Code: 404
Target Servlet: customerEstablishment
Error Stack:
java.io.FileNotFoundException: SRVE0190E: File not found: /custnull
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor._processEDR(DefaultExtensionProcessor.java:948)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.processEDR(DefaultExtensionProcessor.java:929)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:483)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1385)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:194)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
at org.springframework.web.servlet.FrameworkServlet.doGet_aroundBody0(FrameworkServlet.java:827)
at org.springframework.web.servlet.FrameworkServlet$AjcClosure1.run(FrameworkServlet.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at au.com.westpac.jcx.sparrow.aspects.performance.HttpServletCorrelation.aroundHttpServletInvocation(HttpServletCorrelation.java:36)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:575)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:307)
at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:562)
at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:255)
at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:259)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
at au.com.wbg.filter.QSParamsFilter.doFilter(QSParamsFilter.java:70)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at au.com.wbg.filter.BranchFilter.doFilter(BranchFilter.java:155)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at au.com.wbg.filter.ResourceAccessFilter.doFilter(ResourceAccessFilter.java:69)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at au.com.wbg.filter.CSRFWebFilter.doFilter(CSRFWebFilter.java:113)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at au.com.wbg.filter.LogbackFilter.doFilter(LogbackFilter.java:81)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at au.com.wbg.filter.SessionFilter.doFilter(SessionFilter.java:85)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at au.com.wbg.filter.XSSFilter.doFilter(XSSFilter.java:60)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:909)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Error Page Exception:
Error Message: java.lang.NullPointerException
Error Code: 0
Target Servlet:
Error Stack:
java.lang.NullPointerException
at au.com.wbg.service.user.UserRoleDivTag.writeTagContent(UserRoleDivTag.java:108)
at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:103)
at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
at _ibmjsp.WEB_2D_INF.jsp._404error._jspx_meth_role_ruleDiv_0(_404error.java:168)
at _ibmjsp.WEB_2D_INF.jsp._404error._jspService(_404error.java:125)
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:307)
at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:562)
at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:255)
at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:259)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1230)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:779)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:122)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.handleRequest(AbstractJSPExtensionServletWrapper.java:216)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:79)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:960)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1385)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:194)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3328)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1095)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:909)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:459)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:526)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:312)
at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:88)
at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)


text:
Q: PySpark-How to find out the top n most frequently occurring value in an array column? For the sample data below, wondering how I can find out the most frequently occurring value in the column colour. The data type of colour is WrappedArray. There could be n number of elements in the array. In this example the colour should be yellow, followed by blue which appeared twice. Many thanks for your help.
Name   Colour
 A      ('blue','yellow')
 B      ('pink', 'yellow')
 C      ('green', 'black')
 D      ('yellow','orange','blue')

A: I would explode the colour column and then simply run groupBy and count to get what you need.
df \
.select(explode('colour').alias('colour')) \
.groupBy('colour') \
.count() \
.orderBy(col('count').desc())


text:
Q: Typesetting boardgame positions using ttf font For presenting positions in the game of backgammon, there is a commercially developed, but free for personal use,
without modifications, font called eXtremeGammon. The ttf font file is available from the eXtreme Gammon site
ttf file. I was hoping to use this font for typesetting notes and references using LaTeX. I took the advice from the
accepted answer to an earlier TeX Stackexchange post, Installing TTF fonts in LaTeX, on using ttf fonts in LaTeX by
using XeTeX rather than LaTeX.
I have two problems with this approach:
1) Some characters in the font are not found by XeLaTeX, eg. digraphs and the £ character. The font does work with these
characters outside TeX and the characters do appear with a symbol when studying the ttf file using FontForge. The
following simple example outputs a pdf file from XeLaTeX, but containins only the symbol for the @-character.
\documentclass{article}
\usepackage{fontspec}
\setromanfont{eXtremeGammon}
\begin{document}
ñ © @ £
\end{document}

The only thing I can understand as related in the log file is these lines:
Missing character: There is no ñ in font eXtreme Gammon/ICU!
Missing character: There is no © in font eXtreme Gammon/ICU!
Missing character: There is no £ in font eXtreme Gammon/ICU!

I tried using the tip from this earlier posting related to inputting characters to XeLaTeX Foreign characters in XeLaTeX, but it did not change anything for me.
2) The goal is to be able to typeset positions with end result as in this picture

which is an image of how browsers render the font. The font works by individual characters being eg. a black disc on the middle fifth of a downward triangle with white background, a white disc on the lowest fifth of an upward triangle with lined background or eg. a part of the playing frame. In order to have the characters "connect" and not have holes in the resulting position I add \offinterlineskip. However, this still leaves very thin horizontal empty lines in the diagram after some lines. Here is a simple example that draws a downward white triangle using the font. The spacing is better but not quite right at all lines, even with \offinterlineskip
\documentclass{article}
\usepackage{fontspec}
\setromanfont{eXtremeGammon}
\begin{document}
\offinterlineskip %% Still leaves thin vertical lines of empty space
                  %% after some lines. Problem in font itself ?
\noindent
A\\
B\\
C\\
D\\
E
\end{document}

Here is image of the triangle in the pdf output with thin empty lines in two spots:

A last note is that the eg. the triangles does not look nearly as "sharp" as in a browser when it is rendered using a CSS sheet with @font-face, so perhaps this overall strategy on how to typeset these positions in TeX is flawed ?
UPDATE: Regarding part 1) I tried running Leo Liu's answer to Generating a table of glyphs with XeLaTeX and it turns out that only for values i in the range from 32 to 160 are there any for which \iffontchar\font\i is true
despite there being more characters with symbols in the ttf font then the number of trues here. I haven't worked much with LaTeX and fonts but I am starting to think if this could be some sort of encoding problem ? The following
post could be relevant Font has glyph but XeLaTeX reports "Missing character". How would I check the following from the last comment in that post: if this font is to old and doesn't use unicode ?

A: I know it's been a while, and this question has even resulted in a new package, which is amazing ;)  However, I just stumbled upon this question and managed to create a beautiful board with the extremegammon font.  One needs the fancyvrb package, which lets you define a new verbatim environment (board) which is basically verbatim without any line height (taken from xelatex — remove line spacing in verbatim environment).  Then, you have to set the mono font to the one offered by extreme gammon (I put the font into ~/.fonts and ran fc-cache).  The whole thing gets compiled with lualatex, I'm currently using the version that comes with TeXLive 2019.  The example board is taken from the website (I added rolls by just using simple numbers for the dice), but you can export a position from extreme gammon into the font.
\documentclass{scrartcl}
% from the fontspec documentation, chp. 4.2: Specifically choosing the NFSS family
\usepackage{fontspec}
\usepackage{fancyvrb}
\fvset{fontfamily=myverbatimfont}
\newfontfamily\verbatimfont[NFSSFamily=myverbatimfont]{eXtreme Gammon}
% create a new verbatim environment that uses the gammon font (with its new name)
\DefineVerbatimEnvironment{board}{Verbatim}{%
  formatcom={\baselineskip=-\maxdimen\lineskip=0pt},
  fontfamily=myverbatimfont
}
\begin{document}
\begin{board}
 ñ¡²±²¢ò
 ðPAZAZA@ @ZAPAFKð
 ðQBGB[B@ @[BGBGBð
 ðRCHC\C@ @\CHCHCð
 ðIDIDID@ @]DIDIDð
 ðJEJEJE@ @ÛEJEJEð
'ð      @ @ 3  1 ð
 ðejejej@ @ejejejð
 ðxididi@ @dididið
 ðwhchmh@ @mhchchð
 ðvgbglg@ @lglgb{ð
 ðupapkf@ @kfkfazð
 ó£´³´¤ô
\end{board}
\end{document}

Here's how it looks:

A: Since I like to play backgammon, this seemed like a useful thing to do.  Here's an initial version of a backgammon display package. This is pretty rough, and I expect to update it, but it's pretty usable in its present state. Obviously it still needs some documentation, and there may be a few features missing.
Update
The package described below is currently being developed and is not yet officially released. The latest version of the code can be obtained from GitHub.  Comments welcome.
tikz-backgammon.sty
Put this in your local texmf folder:
% Copyright 2012 by Alan Munn
%
% This package may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This package has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this package is Alan Munn.
%
% This package consists of the file tikz-backgammon.sty and documentation files
% tikz-backgammon.tex and tikz-backgammon.pdf
%
% Version 0.5 2012/03/20
%
%
\ProvidesPackage{tikz-backgammon}[2012/03/20 Backgammon game display using TikZ v0.5]
\RequirePackage{etoolbox}
\RequirePackage{tikz}
\usetikzlibrary{positioning}

% Construct the board
%
% alternating colours for the board
\newcommand*{\BW}{\pgfmathifthenelse{mod(\x,2)==0}{1}{0}\let\fillstyle\pgfmathresult}
\newcommand*{\WB}{\pgfmathifthenelse{mod(\x,2)==0}{0}{1}\let\fillstyle\pgfmathresult}
% construct a  down point
\newcommand*{\dpoint}{%
\BW
\draw[thick,style=\fillstyle]
     (\x,0) -- (\x+3/2,15) -- (\x+3,0) -- cycle; }
% construct an up point
\newcommand{\upoint}{%
\WB
\draw[thick,style=\fillstyle]
     (\x,32) -- (\x+3/2,17) -- (\x+3,32) -- cycle; }
% set basic tikzparameters
\tikzset{1/.style={fill=\boardblack},
                0/.style={fill=\boardwhite},
                stone/.style={scale=1.35,draw=black,circle},
                sans/.style={font=\footnotesize\sffamily},
                cube/.style={minimum size=.5cm}
                }
% initialization
\def\cubepos{above}
\pgfdeclarelayer{board}
\pgfdeclarelayer{pieces}
\pgfsetlayers{board,pieces,main}
% These should be made internal or key values
\newcommand*{\black}{black} % for the stones
\newcommand*{\white}{white}
\newcommand*{\boardblack}{brown}
\newcommand*{\boardwhite}{olive!50}
\newcommand*{\defaultscale}{.2}
\newlength{\betweengameskip}
\setlength{\betweengameskip}{2\baselineskip}
% initial state of the doubling cube
\newcommand*{\doublestate}{neutral}
\newcommand*{\doublenum}{2}
% create 24 counters for the point counts
% create 24 macros for the point state (black,white,none)
\foreach \x in {1,...,24}{
\newcounter{bk@pt\x}
\expandafter\gdef\csname bk@state\x\endcsname{none}
}

% some debugging commands
\newcommand*\showpoint[1]{\the\csname c@bk@pt#1\endcsname}
\newcommand*\setstate[2]{\expandafter\gdef\csname bk@state#1\endcsname{#2}}
\newcommand*\usestate[1]{\csname bk@state#1\endcsname}

% basic command to draw the board
% all of these numbers probably shouldn't be hard coded
%
\newcommand{\drawboard}{%
  \begin{pgfonlayer}{board}
% draw the boarder and the point numbers
    \draw[line width=4pt] (0,0) -- (0,32) -- (38,32) -- (38,0) -- cycle;
    \foreach \x in {1,...,6}{
       \node[sans] (\x) at (39.5-\x*3,-1.5)  {\x};
        \pgfmathparse{int(\x+6)}\let\nodename\pgfmathresult
        \node[sans] (\nodename) at (25.5-\x*3-6,-1.5)  {\nodename};
        \pgfmathparse{int(25-\x)}\let\nodename\pgfmathresult
        \node[sans] (\nodename) at (39.5-\x*3,33.5)  {\nodename};
        \pgfmathparse{int(\x+12)}\let\nodename\pgfmathresult
         \node[sans] (\nodename) at (25.5+\x*3-27,33.5)  {\nodename};
    }
% now draw the first half points
  \foreach \x in {0,3,...,15}
     \dpoint;
  \foreach \x in {0,3,...,15}
     \upoint;
% draw the bar and set the anchors for bar and the doubling cube
  \draw[very thick,fill=brown](18,0) -- (18,32) -- (20,32) -- (20,0) -- cycle;
  \node (barcenter) at (19,14) {};
  \node (black double) at (40, 2) {};
  \node (white double) at (40, 30) {};
  \node (neutral double) at (40,12.5) {};
% draw the other half of the points
  \foreach \x in {20,23,...,35}
     \dpoint;
  \foreach \x in {20,23,...,35}
     \upoint;
  \end{pgfonlayer}
}
% commands to place markers on a point and set its state
% these are used for setting the initial board and for users
% to make arbitrary board configurations
% placement is still a little off (some overlap)

% first for a black point
\newcommand{\blackpoint}[2]{%
  \global\csname c@bk@pt#1\endcsname #2\relax
  \setstate{#1}{black}
% check to see if we're on an up point or a down point
  \pgfmathparse{ifthenelse(#1>12,"below","above")}\let\pos\pgfmathresult
  \begin{pgfonlayer}{pieces}
    \foreach \x in {1,...,#2}
       \node[fill=\black,style=stone,\pos=.5*\x-.45  of #1]  {};
  \end{pgfonlayer}}
% same again for a white point
\newcommand{\whitepoint}[2]{%
  \global\csname c@bk@pt#1\endcsname #2\relax
  \setstate{#1}{white}
  \pgfmathparse{ifthenelse(#1>12,"below","above")}\let\pos\pgfmathresult
  \begin{pgfonlayer}{pieces}
     \foreach \x in {1,...,#2}
        \node[fill=\white,style=stone,\pos=.5*\x-.45  of #1]  {};
  \end{pgfonlayer}}
% now a generic version of the command for use in displaying the board
% this is really an internal command
\newcommand{\placepoint}[2]{%
  \let\ptname#1
  \ifnumcomp{#2}{<}{1}
     {}
     {\pgfmathparse{ifthenelse(#1>12,"below","above")}\let\pos\pgfmathresult
      \begin{pgfonlayer}{pieces}
         \foreach \x in {1,...,#2}
            \node[fill=\usestate{\ptname},style=stone,\pos=.5*\x-.45  of \ptname]  {};
       \end{pgfonlayer}
      }
}
% command to place pieces on the bar
\newcommand*{\onbar}[2]{%
  \begin{pgfonlayer}{board}
     \foreach \x in {1,...,#2}
         \node[fill=\csname#1\endcsname,style=stone,above=.5*\x-.35 of barcenter)] {};
      \end{pgfonlayer}
}
% user command to set a double
% syntax is \double{<owner>}{amount}
\newcommand*{\double}[2]{%
  \let\doublenum#2
  \ifstrequal{#1}{neutral}
     {\gdef\doublestate{neutral double}}
     {\ifstrequal{#1}{white}
        {\gdef\cubepos{below}\gdef\doublestate{white double}}
        {\gdef\cubepos{above}\gdef\doublestate{black double}}
     }
}
% internal command to place the doubling cube in the correct place
\newcommand*{\placedouble}{
   \node[draw,style=cube, \cubepos=.5cm of \doublestate %
  ,font={\bfseries\sffamily}] {\doublenum};}

% command to set a new game and display it
\newcommand*{\newgame}[1][\defaultscale]{%
  \begin{tikzpicture}[scale=#1]
     \drawboard
         \whitepoint{1}{2}
         \whitepoint{12}{5}
         \whitepoint{17}{3}
         \whitepoint{19}{5}
         \blackpoint{24}{2}
         \blackpoint{13}{5}
         \blackpoint{8}{3}
         \blackpoint{6}{5}
         \double{neutral}{2}
         \placedouble
  \end{tikzpicture}}

% commands to move first black, then white

\newcommand\blackmove[4]{
    \advance\csname c@bk@pt#1\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#1\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#1\endcsname{black}}
    \ifnumcomp{#2}{=}{0}{}{\advance\csname c@bk@pt#2\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#2\endcsname{black}
    \advance\csname c@bk@pt#3\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#3\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#3\endcsname{black}}
    \ifnumcomp{#4}{=}{0}{}{\advance\csname c@bk@pt#4\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#4\endcsname{black}
}

\newcommand\whitemove[4]{
    \advance\csname c@bk@pt#1\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#1\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#1\endcsname{white}}
    \ifnumcomp{#2}{=}{0}{}{\advance\csname c@bk@pt#2\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#2\endcsname{white}
    \advance\csname c@bk@pt#3\endcsname -1\relax
    \ifnumcomp{\the\csname c@bk@pt#3\endcsname}{=}{0}
        {\expandafter\gdef\csname bk@state#1\endcsname{none}}
        {\expandafter\gdef\csname bk@state#3\endcsname{white}}
    \ifnumcomp{#4}{=}{0}{}{\advance\csname c@bk@pt#4\endcsname 1\relax}
    \expandafter\gdef\csname bk@state#4\endcsname{white}
}

% command to display the current state of the board
\newcommand{\displayboard}{%
  \par\vspace{\betweengameskip}
  \begin{tikzpicture}[scale=\defaultscale]
        \drawboard
        \foreach \x in {1,...,24}{
            \placepoint{\x}{\the\csname c@bk@pt\x\endcsname}}
        \placedouble
    \end{tikzpicture}
}
\endinput
% Still to be added:
% Displaying the dice (easy, but I can't be bothered)

Sample document
% This is a test document for the tikz-backgammon package.
\documentclass[12pt]{article}
\usepackage{tikz-backgammon}
\begin{document}
\newgame
\blackmove{13}{8}{8}{5}
\whitemove{1}{7}{1}{7}
\double{white}{4}
\blackmove{24}{18}{24}{18}
\blackmove{8}{2}{8}{2}
\blackmove{8}{4}{13}{10}
\whitemove{12}{16}{12}{15}
\displayboard
\end{document}

Output


text:
Q: ENOENT, stat '-stylus' at Error (native) I've this strange error message while using stylus, first i install nodejs for github on my linux machine, then i ran this command npm install -g stylus autoprefixer-stylus and i got this error log/message
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/autoprefixer-stylus'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, unlink '/usr/local/lib/node_modules/autoprefixer-stylus']
npm ERR!   stack: 'Error: EACCES, unlink \'/usr/local/lib/node_modules/autoprefixer-stylus\'\n    at Error (native)',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/autoprefixer-stylus' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "stylus" "autoprefixer-stylus"
npm ERR! cwd /home/avinashizhere
npm ERR! node -v v0.13.0-pre
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/lib/node_modules/autoprefixer-stylus
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/autoprefixer-stylus'
npm ERR! stack     at Error (native)
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/autoprefixer-stylus'
npm ERR! error rolling back     at Error (native)
npm ERR! error rolling back  { [Error: EACCES, unlink '/usr/local/lib/node_modules/autoprefixer-stylus']
npm ERR! error rolling back   stack: 'Error: EACCES, unlink \'/usr/local/lib/node_modules/autoprefixer-stylus\'\n    at Error (native)',
npm ERR! error rolling back   errno: -13,
npm ERR! error rolling back   code: 'EACCES',
npm ERR! error rolling back   path: '/usr/local/lib/node_modules/autoprefixer-stylus' }
npm ERR! not ok code 0

what is understood is, i've to use sudo to run this, i did add sudo and i got this output
/usr/local/bin/stylus -> /usr/local/lib/node_modules/stylus/bin/stylus
autoprefixer-stylus@0.4.0 /usr/local/lib/node_modules/autoprefixer-stylus
└── autoprefixer-core@4.0.2 (caniuse-db@1.0.30000037, postcss@3.0.7)

stylus@0.49.3 /usr/local/lib/node_modules/stylus
├── css-parse@1.7.0
├── mkdirp@0.3.5
├── sax@0.5.8
├── debug@2.1.0 (ms@0.6.2)
├── source-map@0.1.41 (amdefine@0.1.0)
└── glob@3.2.11 (inherits@2.0.1, minimatch@0.3.0)

now i think i've need package/files with me, now i ran this command stylus -u autoperfixer -stylus -w style.styl and i'm getting this
/usr/local/lib/node_modules/stylus/bin/stylus:625
    if (err) throw err;
                   ^
Error: ENOENT, stat '-stylus'
    at Error (native)

I don't know what is wrong, or is there something i'm missing?

A: You are running a wrong command, to install stylus run on the terminal:
 sudo npm install -g stylus

Then if you want to install autoprefixer-stylus run:
 sudo npm install -g autoprefixer-stylus

A:
now i think i've need package/files with me, now i ran this command stylus -u autoperfixer -stylus -w style.styl and i'm getting this

It's autoprefixer-stylus, not autoperfixer -stylus.


text:
Q: Cant solve reference not set to an instance of an object I'm trying desperately to get my code work. When each ComboBox has its value selected, the values should be divided and the result should get inserted into TextBox.
ComboBoxes --> Körpergröße, Gewicht
TextBox --> BMI
My Code:
private void Körpergröße_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
     int value1, value2;
     if (Körpergröße.SelectedItem.ToString() != "Bitte auswählen..." && Gewicht.SelectedItem.ToString() != "Bitte auswählen...")
     {
         string a = Körpergröße.SelectedItem.ToString();
         string b = Gewicht.SelectedItem.ToString();
         value1 = Int32.Parse(a);
         value2 = Int32.Parse(b);
         fillTextBox(value1, value2);
     }
}

private void fillTextBox(int value1, int value2)
{
     double result = value1 / value2;
     BMI.Text = result.ToString();
}

private void Gewicht_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
     int value1, value2;
     if (Gewicht.SelectedItem.ToString() != "Bitte auswählen..." && Körpergröße.SelectedItem.ToString() != "Bitte auswählen...")
     {
          string a = Körpergröße.SelectedItem.ToString();
          string b = Gewicht.SelectedItem.ToString();
          value1 = Int32.Parse(a);
          value2 = Int32.Parse(b);
          fillTextBox(value1, value2);
     }
}

When I execute the Program, it always gives me the exception at the if-part of both.
I compare it with Bitte auswählen... in order to ensure that this is not selected in the CombobBox, but a value.
Gewicht-ComboBox
<ComboBox Margin="205,77,0,0" Name="Gewicht" HorizontalAlignment="Left"
     VerticalAlignment="Top" Width="123" Height="23"
     SelectionChanged="Gewicht_SelectionChanged">
    <ComboBoxItem Content="Bitte auswählen..." IsSelected="True" ></ComboBoxItem>
    <ComboBoxItem Content="40"></ComboBoxItem>
    <ComboBoxItem Content="41"></ComboBoxItem>
    <ComboBoxItem Content="42"></ComboBoxItem>
</ComboBox>

Körpergröße-ComboBox
<ComboBox Margin="205,50,0,0" Name="Körpergröße" HorizontalAlignment="Left"
     VerticalAlignment="Top" Width="123" Height="23" SelectionChanged="Körpergröße_SelectionChanged" >
    <ComboBoxItem Content="Bitte auswählen..." IsSelected="True"  ></ComboBoxItem>
    <ComboBoxItem Content="150" ></ComboBoxItem>
    <ComboBoxItem Content="151"></ComboBoxItem>
    <ComboBoxItem Content="152"></ComboBoxItem>
</ComboBox>

A: Your way for checking the selected item of combobox is incorrect. It should be like this:
if (((Gewicht.SelectedItem) as ComboBoxItem).Content.ToString() != "Bitte auswählen...")

Also it would be better to just skip the first item and then select the selected item like this:
if (Gewicht.SelectedIndex > 0 && Körpergröße.SelectedIndex > 0)
{
     string a = ((Körpergröße.SelectedItem) as ComboBoxItem).Content.ToString();
     string b = ((Gewicht.SelectedItem) as ComboBoxItem).Content.ToString();
}

A: You should check following before parsing its value to String
Körpergröße.SelectedItem.ToString()

And
Gewicht.SelectedItem.ToString()

If both values is NOT NULL then you can Parse Them ToString()..

A: You are not making sure your combo boxes selected index is NOT -1 before you run all of that code.
The Code is the same so break it out like this:
private void CalculateValues()
{
        int value1, value2;
        if (Gewicht.SelectedItem.ToString() != "Bitte auswählen..." && Körpergröße.SelectedItem.ToString() != "Bitte auswählen...")
        {
            string a = Körpergröße.SelectedItem.ToString();
            string b = Gewicht.SelectedItem.ToString();

            value1 = Int32.Parse(a);
            value2 = Int32.Parse(b);
            fillTextBox(value1, value2);
        }
}

    private void Gewicht_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
if(Gewicht.SelectedIndex > -1 && Körpergröße.SelectedIndex > -1)
{
CalculateValues();
}
}

    private void Körpergröße_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
if(Körpergröße.SelectedIndex > -1 && Gewicht.SelectedIndex > -1 )
{
CalculateValues();
}
}

There is a better way to write that code (for example only updating a class level int value1 or value2 and then calling the CalculateValues() but the code as it is here should work. Notice in the Selected Index Changed event I am checking to make sure it is > - 1: SelectedIndex > -1 because on loading it gets set to -1. And has a change event fired .. and you have NOTHING in -1 index. NULL REFERENCE.

A: There is a possibility that

*

*when you are selecting "Körpergröße", the check for
Gewicht.SelectedItem.ToString() != "Bitte auswählen... in your if block is giving the error as Gewicht combo is still not selected.

*when you are selecting "Gewicht", the check for
Körpergröße.SelectedItem.ToString() != "Bitte auswählen... in your if block is giving the error as Körpergröße combo is still not selected.

To resolve try setting default values in your comboboxes at form initialization.
Hope this helps...


text:
Q: Alfresco: display mltext in ftl -InvalidReferenceException - Expression res.getPropertyValueByQueryName('t.cm:title') is undefined I have a *.get.js webscript which executes a cmis query and result is displayed  in *.html.ftl.
So far it works great with String/Date properties, such as cmis:name, or cmis:creationDate. But I'm not able to display title (cm:title) nor description (cm:description). I guess the problem is because the type of these properties is mltext and ftl wants to treat it some special way. Please note that I joined with cm:titled aspect, so it should be in the result. Also filtering by cm:title or cm:description works (by adding and cm:title like '%test%' to the end of the query).
The exception I have is
freemarker.core.InvalidReferenceException - Expression res.getPropertyValueByQueryName('t.cm:title') is undefined

myScript.get.js:
var query = "select d.*, t.* " +
            "from cmis:document as d join cm:titled as t on d.cmis:objectId = t.cmis:objectId " +
            "where IN_FOLDER(d, 'workspace://SpacesStore/72525f23-5273-11dd-9321-e32454ebec2e') ";

var cmisConnection = cmis.getConnection();
var cmisSession    = cmisConnection.getSession();
var results = cmisSession.query(query, false);

model.results = results.iterator();

myScript.get.html.ftl:

<#list results as res>
    <#assign title = res.getPropertyValueByQueryName('t.cm:title')>
    ${title}
</#list>


text:
Q: Usage of "Arbitrary Rule" I was told today that I was using the phrase "arbitrary rule" incorrectly given the following situation.
My friends and I were setting up a game which involves diplomacy. I was adding a work colleague to the group of casual acquaintances some of whom don't really know others.
My friend decided we should have a rule of "one person per workplace" as I'd see the person at work more and so have more chance for diplomacy. He later added he didn't want to play with people he didn't know.
I pointed out we all have a different level of interpersonal relationship - some hardly know others in the group and indeed he'd suggested we invite someone many in the group don't know. As such, I argued, this is an "arbitrary rule" - based not on reasoned arguments but his personal feelings at the time as shown by inconsistencies in the argument.
He then switched to saying I was using words I didn't understand.
Pettiness of the argument aside (and irony, given we're setting up a game on diplomacy...)- is the term incorrect in this context? Differing definitions online make me question whether I'm correct or not.
The definition which made me doubt myself was:

*

*Based on random choice or personal whim, rather than any reason or system.

Arguably - "whim" implies it's just a passing fancy. There is a stated reason for it, it's just that he's then acting in contrast to that. you could say he was disingenuous with his reason (he really just didn't want people he didn't know) but that the rule wasn't strictly speaking arbitrary.
However, another definition:
1    founded on or subject to personal whims, prejudices, etc.; capricious
Seems more clearly in my favour - it's his prejudice against people he doesn't know that is the real reason behind the rule.

A: Arbitrary can mean the opposite of arbitrary.
Historically, a decision was described as arbitrary if it depended on somebody's  judgement. We still have the word arbitrator which is a person appointed, usually by the agreement of both parties to a dispute, to judge the matter and make a decision.
Constitutional theories about the role of government, as they developed in the seventeenth and eighteenth centuries,  contrasted models of government in which  the king  had absolute discretion to do in any matter whatever he  wished, with models in which the king, and everybody else, was required to obey the law. Every citizen should be treated equally and fairly, according to mutually understood laws.  All should be equal under the law. The government must act according to commonly accepted standards.
The word arbitrary was increasingly used to mean the exercise of power contrary to law and/or custom. Broadly the US placed most emphasis on law and the British Empire most emphasis on custom, but both were held in contrast to the absolute right of government to do as it thought best. The US Declaration of Independence, the English Bill of Rights and the Bonfire Prayers recited by the Church of England on the anniversary of the Gunpowder Plot (and landing of William III), all use arbitrary in the sense of uncontrolled power.
It is this sense of things happening in a way not governed by law,  custom or principle which corresponds to the use of arbitrary today in the sense of purely random, that is not in accordance with any discernible rationale.
The Cambridge dictionary includes a definition of arbitrary as

based on chance rather than being planned or based on reason.

and gives an example

Did you have a reason for choosing your destination or was it arbitrary?

Here the word arbitrary mean without reason of any kind.
Longmans's dictionary includes the following example

This effectively enables the Home Office to make arbitrary decisions, deporting people as they see fit, without any independent inquiry.

Here the Home Office (a UK government department) is said to be able to deport people as they see fit - that is not according to any publically accepted criteria, but as they see fit, which is to say that they have their own criteria. This does not mean they are random, but we do not know why they deport one person and choose to overlook another.
If a company decides to make some of its staff redundant and, as a matter of fact, all the ones made redundant are over 55,  then the management may claim that the decision was purely arbitrary. It is purely by random chance that the people made redundant all happen to be over 55. However they might well be accused of making an arbitrary decision, a decision intentionally flouting discrimination laws and the norms of society.  In this scenario arbitrary is the opposite of arbitrary.
Your friend's decision to oppose some people joining the game, and allow others  may not be based on any accepted principle or custom. In that case he is acting as something of an autocrat, decreeing who he will or will not play with. His proposal of no two people in the same workplace could be described as arbitrary in the sense it does not derive from any accepted principle or custom, but merely from his own discretion. It does not appear to be purely ransom though, he seems to have his own reasons which may be to maximise his chances of winning by not allowing in people who know each other well, and encouraging in those who don't. He is arbitrarily using his influence, but he is not making arbitrary decisions in the sense of random decisions.
Of course I am not attempting to arbitrate as to whether your friend's non-random strategy to increase his chances of winning by making discretionary decisions is, or is not, an arbitrary abuse of his influence. It is, after all, a game of Diplomacy you are arranging.