text:
Q: XSL how to calculate the sum of the product of the attribute values of each element i have this xml
<Process>
    <name>name1</name>
    <ListOfItems>
        <item name="name2" price="10" quantity="1" value=""></item>
        <item name="name7" price="10" quantity="2" value=""></item>
        <item name="name12" price="10" quantity="3" value=""></item>
        <item name="name17" price="10" quantity="4" value=""></item>
    </ListOfItems>
    <taxType>TEN</taxType>
</Process>

and i want an output of
<ProcessResponse>
    <name>name1</name>
    <ListOfItems>
        <item name="name2" price="10" quantity="1" value="10"></item>
        <item name="name7" price="10" quantity="2" value="20"></item>
        <item name="name12" price="10" quantity="3" value="30"></item>
        <item name="name17" price="10" quantity="4" value="40"></item>
    </ListOfItems>
    <totalAmount>100</totalAmount>
    <taxAmount>10</taxAmount>
    <grandTotal>110</grandTotal>
</ProcessResponse>

its an invoice purpose, some extra info :

*

*value is the item cost (price x quantity)

*totalAmount is sum(value)

*taxAmount is (if taxType = AAA, taxAmount = totalAmount x (some fixed number / 100) )

*finally grandTotal = totalAmount + taxAmount

*GENERATED BY ORACLE XSL MAPPER 11.1.1.6.0(build 111214.0600.1553)

*stylesheet version="1.0"

i've done so much of research since 2 days and used some templates
to get the totalAmount but it worked on browser tester but not in the "jdeveloper" transformation.
and i fount the problem is at template match
in browser <xsl:template match="/Process/ListOfItems"> worked but not in jdev
even the <xsl:template match="/"> not works
please help to solve this problem,
Thanks in advance.

A: Within XSLT 2.0 it would be a lot easier to calculate the sum() of the values, but within XSLT 1.0 it is a bit tricky, see next XSLT:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

    <!-- Identity template -->
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>

    <!-- Rename root node -->
    <xsl:template match="Process">
        <ProcessResponse>
            <xsl:apply-templates select="@*|node()" />
        </ProcessResponse>
    </xsl:template>

    <!-- Match on ListOfItems, to add new elements after it -->
    <xsl:template match="ListOfItems">
        <!-- Copy existing -->
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>

        <!-- Create the new elements -->
        <xsl:apply-templates select="item[1]" mode="sumValue" />
    </xsl:template>

    <!-- Match on item element to do the calculation of value attribute -->
    <xsl:template match="item">
        <xsl:copy>
            <!-- Copy existing attributes -->
            <xsl:apply-templates select="@*" />

            <!-- Actual calculation -->
            <xsl:attribute name="value">
                <xsl:value-of select="@quantity * @price" />
            </xsl:attribute>

            <!-- Copy rest of nodes -->
            <xsl:apply-templates select="node()" />
        </xsl:copy>
    </xsl:template>

    <xsl:template match="item" mode="sumValue">
        <xsl:param name="currentSumValue" select="0" />

        <!-- Variable to store the updated sum value -->
        <xsl:variable name="updatedSumValue" select="$currentSumValue + (@quantity * @price)" />

        <!-- Proceed summing with the next item-->
        <xsl:apply-templates select="following-sibling::item[1]" mode="sumValue">
            <xsl:with-param name="currentSumValue" select="$updatedSumValue" />
        </xsl:apply-templates>

        <!-- No more items. Summing is complete, we can display the totalAmount and calculate the rest -->
        <xsl:if test="not(following-sibling::item)">
            <totalAmount><xsl:value-of select="$updatedSumValue"/></totalAmount>

            <!-- taxAmount -->
            <xsl:variable name="taxAmount">
                <xsl:choose>
                    <xsl:when test="/Process/taxType = 'TEN'">
                        <xsl:value-of select="$updatedSumValue * (10 div 100)" />
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:value-of select="$updatedSumValue" />
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:variable>
            <taxAmount><xsl:value-of select="$taxAmount" /></taxAmount>

            <!-- grandTotal -->
            <grandTotal><xsl:value-of select="$updatedSumValue + $taxAmount" /></grandTotal>
        </xsl:if>
    </xsl:template>

    <!-- Remove element taxType -->
    <xsl:template match="taxType" />
</xsl:stylesheet>

When applied on your input XML, the result would be:
<?xml version="1.0" encoding="UTF-8"?>
<ProcessResponse>
    <name>name1</name>
    <ListOfItems>
        <item name="name2" price="10" quantity="1" value="10"/>
        <item name="name7" price="10" quantity="2" value="20"/>
        <item name="name12" price="10" quantity="3" value="30"/>
        <item name="name17" price="10" quantity="4" value="40"/>
    </ListOfItems>
    <totalAmount>100</totalAmount>
    <taxAmount>10</taxAmount>
    <grandTotal>110</grandTotal>
</ProcessResponse>

Hope it helps and that the comments in de XSLT help you on your way...

A: Another version using XSLT 1.0, but it uses an extension function
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ext="http://exslt.org/common"
    exclude-result-prefixes="ext"
    version="1.0">

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

<xsl:variable name="tmpvalue">
    <xsl:for-each select="//item">
        <value><xsl:value-of select="@price*@quantity"/></value>
    </xsl:for-each>
</xsl:variable>

<xsl:variable name="taxAmount">
    <!-- set you tax formula here -->
    <xsl:value-of select="'10'"/>
</xsl:variable>

    <xsl:template match="Process">
        <ProcessResponse>
            <xsl:apply-templates/>
            <totalAmount>
                <xsl:variable name="myValue" select="ext:node-set($tmpvalue)"/>
                <xsl:value-of select="sum($myValue/value)"/>
            </totalAmount>
            <taxAmount><xsl:value-of select="$taxAmount"/></taxAmount>
            <grandTotal>
                <xsl:variable name="myValue" select="ext:node-set($tmpvalue)"/>
                <xsl:value-of select="sum($myValue/value) + $taxAmount"/>
            </grandTotal>
        </ProcessResponse>
    </xsl:template>

    <xsl:template match="item">
        <xsl:copy>
            <xsl:apply-templates select="@*"/>
            <xsl:attribute name="value"><xsl:value-of select="@price*@quantity"/></xsl:attribute>
        </xsl:copy>

    </xsl:template>

</xsl:stylesheet>

A: I would also use the EXSLT node-set() function, only with less templates:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>

<xsl:param name="taxRate" select=".06"/>

<xsl:template match="/Process">
    <ProcessResponse>
        <xsl:copy-of select="name"/>
        <!-- pre-process items -->
        <xsl:variable name="items">
            <xsl:for-each select="ListOfItems/item">
                <xsl:copy>
                    <xsl:copy-of select="@*"/>
                    <xsl:attribute name="value">
                        <xsl:value-of select="@price*@quantity" />
                    </xsl:attribute>
                </xsl:copy>
            </xsl:for-each>
        </xsl:variable>
        <xsl:variable name="total" select="sum(exsl:node-set($items)/item/@value)" />
        <!-- output -->
        <ListOfItems>
            <xsl:copy-of select="$items"/>
        </ListOfItems>
        <totalAmount>
            <xsl:value-of select="$total" />
        </totalAmount>
        <taxAmount>
            <xsl:value-of select="$total * $taxRate" />
        </taxAmount>
        <grandTotal>
            <xsl:value-of select="$total * (1 + $taxRate)" />
        </grandTotal>
    </ProcessResponse>
</xsl:template>

</xsl:stylesheet>

If your processor happens to support the EXSLT dyn:map() extension function, then you have another way to get the expected result:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dyn="http://exslt.org/dynamic"
extension-element-prefixes="dyn">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:param name="taxRate" select=".06"/>

<xsl:template match="/Process">
    <ProcessResponse>
        <xsl:copy-of select="name"/>
        <ListOfItems>
            <xsl:for-each select="ListOfItems/item">
                <xsl:copy>
                    <xsl:copy-of select="@*"/>
                    <xsl:attribute name="value">
                        <xsl:value-of select="@price * @quantity" />
                    </xsl:attribute>
                </xsl:copy>
            </xsl:for-each>
        </ListOfItems>
        <xsl:variable name="total" select="sum(dyn:map(ListOfItems/item, '@price * @quantity'))" />
        <total>
            <xsl:value-of select="$total" />
        </total>
        <tax>
            <xsl:value-of select="$total * $taxRate" />
        </tax>
        <grandTotal>
            <xsl:value-of select="$total * (1 + $taxRate)" />
        </grandTotal>
    </ProcessResponse>
</xsl:template>

</xsl:stylesheet>

If you are only interested in the total value and do not need to process the line items, then you can do without any extensions:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:param name="taxRate" select=".06"/>

<xsl:template match="/Process">
    <ProcessResponse>
        <xsl:copy-of select="name | ListOfItems"/>
        <xsl:variable name="total">
            <xsl:call-template name="process-items">
                <xsl:with-param name="items" select="ListOfItems/item"/>
            </xsl:call-template>
        </xsl:variable>
        <total>
            <xsl:value-of select="$total" />
        </total>
        <tax>
            <xsl:value-of select="$total * $taxRate" />
        </tax>
        <grandTotal>
            <xsl:value-of select="$total * (1 + $taxRate)" />
        </grandTotal>
    </ProcessResponse>
</xsl:template>

<xsl:template name="process-items">
    <xsl:param name="items"/>
    <xsl:param name="total" select="0"/>
    <xsl:choose>
        <xsl:when test="$items">
            <xsl:variable name="item" select="$items[1]" />
            <!-- recursive call -->
            <xsl:call-template name="process-items">
                <xsl:with-param name="items" select="$items[position() > 1]"/>
                <xsl:with-param name="total" select="$total + $item/@price * $item/@quantity"/>
            </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$total" />
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

</xsl:stylesheet>

The result here will be:
<?xml version="1.0" encoding="UTF-8"?>
<ProcessResponse>
  <name>name1</name>
  <ListOfItems>
        <item name="name2" price="10" quantity="1" value=""/>
        <item name="name7" price="10" quantity="2" value=""/>
        <item name="name12" price="10" quantity="3" value=""/>
        <item name="name17" price="10" quantity="4" value=""/>
    </ListOfItems>
  <total>100</total>
  <tax>6</tax>
  <grandTotal>106</grandTotal>
</ProcessResponse>


text:
Q: sum of values larger than median of each row in pandas dataframes Is there an efficient way to find the sum of values whose absolute value is larger than the median of the row in a pandas data frame?
For example:
      Monday    Tuesday    Wednesday  Thursday   Friday   Saturday
 0     2.2       4.4       0.5         9         4         3
 1     2         4         1           8         4         5
 2     1.8       4.5       0.9         8         1         15
 3     4         1         5           10        4         5
 …

How to generate the sum of numbers in each row which are larger than the median of the corresponding row? What about 25 percentile or 75 percentile?

A: I think you want this:
In [19]:

df[df.gt(df.median(axis=1), axis=0)]
Out[19]:
   Monday  Tuesday  Wednesday  Thursday  Friday  Saturday
0     NaN      4.4        NaN         9       4       NaN
1     NaN      NaN        NaN         8     NaN         5
2     NaN      4.5        NaN         8     NaN        15
3     NaN      NaN          5        10     NaN         5

This uses .gt which is greater than and uses as the value the median (row-wise by passing axis=1).
You can then call sum on this:
In [20]:

df[df.gt(df.median(axis=1), axis=0)].sum()
Out[20]:
Monday        NaN
Tuesday       8.9
Wednesday     5.0
Thursday     35.0
Friday        4.0
Saturday     25.0
dtype: float64

A: And to enhance @EdChum's answer to get the quantiles:
quantile = 0.75  # 0.25, 0.5, 0.75, etc.
df[df.gt(df.quantile(q=quantile, axis=1), axis=0)].sum(axis=1)

Given that there are only seven days in a week, I'm not sure if this will do as intended unless you have more columns than shown.  Do you want the quantiles by column instead of row?

A: Since you want to sum values in each row which is greater then median, and if you want to preserve Day values, below approach works fine
def func(row):
    return row[row>np.percentile(row, 50)].sum()

func function will be now applied on df
In [67]: df['rule'] = df.apply(func, axis=1)

In [68]: df
Out[68]:
   Monday  Tuesday  Wednesday  Thursday  Friday  Saturday  rule
0     2.2      4.4        0.5         9       4         3  17.4
1     2.0      4.0        1.0         8       4         5  13.0
2     1.8      4.5        0.9         8       1        15  27.5
3     4.0      1.0        5.0        10       4         5  20.0

And, for different quantiles, you could use [25, 50, 75] in np.percentile(row, x)

redpajama_set_name: RedPajamaStackExchange


text:
Q: "Can't connect to local MySQL server through" socket error I install mysql and try start
/usr/local/mysql/bin# ./mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
/usr/local/mysql/bin#

Any Idea?

A: Ubuntu 11.10:    sudo dpkg-reconfigure mysql-server-5.1
Ubuntu 12.04:    sudo dpkg-reconfigure mysql-server-5.5
Follow instruction then reboot.
This problem may happen when you upgrade from one ubuntu version to another and config gets messed up somehow. Usually the related to the startup process of mysql daemon mysqld)

A: I see you are using /tmp/ for the mysql.socket so either you are not installing the mysql 5.1 that comes from ubuntu by default or you are installing mysql 5.5.x (which you need to mention in your question if this is the case). Anyway some of the things you can do are:

*

*Verify that mysql is not already running: ps -e|grep -i 'mysqld' if it appears then kill it. sudo killall -9 mysqld . If it does not die grab the pid from the ps you made here and kill -9 PID

*"Try" to run mysql via /etc/init.d/mysql start if it gives you the exact same error from above then you need to copy the mysql.server file from the mysql you downloaded which can be found in the support-files folder inside the mysql folder you downloaded or in the /usr/local/mysql folder and copy it to /etc/init.d/mysql (Example: cp mysql.server /etc/init.d/mysql and give it a executable permission chmod +x /etc/init.d/mysql then run it again.

*If it still gives you a problem then edit the config file in /etc/my.cnf (if you have 5.5 installed) or /etc/mysql/mysql.conf (if you have 5.1 installed) and change ALL the /tmp/mysql.socket lines to /var/run/mysqld/mysqld.sock. Note that the config file can also be in /etc/mysql/my.cnf.
Test this but please ADD what mysql you are using, either 5.1 or 5.5. I mention 5.5 here because 5.5 is the one that uses /tmp and 5.1 uses the default /var/run
If by any change you happen to be using 5.5 then remember to delete the directories of old 5.1 from /etc/mysql, /var/lib/mysql and /user/lib/mysql

A: Change the server name from "localhost" to "127.0.0.1" in your connection params, Im sure it will do the trick.

A: mysql can be started from upstart. Basically you install mysql-server package. You can easily search for mysql-server package in synaptic and install it. You will be prompted for root password during installtion[i.e.mysql user root password] . After that in terminal just do
sudo start mysql
or
sudo service mysql start
Mysql usually is started on boot so you may have it running as well.
Just ps aux | grep mysql to see if it is running.


text:
Q: Why is this simple AngularJS ng-show is not working to show sublist? I cannot understand why this AngularJS app not working as intended. "showPanelSubSystem" is supposed to show each sublist when its value is true, but it doesnt work.I have to show a Panel list of each Item I get from querystring to my page.So I have a TarrifTopSystemList that comes from Backend hard code.Then I add a ng-repeat in my div tag to show the main list . for showing the div I use ng-show = "topSystem.showPanel" . and for showing the subList of TarrifTopSystemList That I mentioned as a SubSystemList I use ng-show = "ng-show="subSystem.showPanelSubSystem" .
html :

                                             {{topSystem.TopSystemName}}

                                                                        {{subSystem.SubSystemName}}

                                                                                Payment Code
                                                                                Payment Type
                                                                                Amount

                                                                                <tr ng-repeat="paymentType in subSystem.PaymentTypeList"
                                                                                ng-class="{'succeedColor': paymentType.PaymentTarrifCodeInfo.IsPaid == true &&
                                                                                ((paymentType.PaymentTarrifCodeInfo.IsOnline && paymentType.PaymentTarrifCodeInfo.BankResultCode == 0) ||
                                                                                ((!paymentType.PaymentTarrifCodeInfo.IsOnline && paymentType.PaymentTarrifCodeInfo.BankResultCode == 2))),
                                                                                'pendingColor': paymentType.PaymentTarrifCodeInfo.BankResultCode == 1,
                                                                                'rejectedColor':(paymentType.PaymentTarrifCodeInfo.BankResultCode == 3 ||
                                                                                paymentType.PaymentTarrifCodeInfo.BankResultCode == -1)}">

                                                                                <input type="checkbox" name="select"
                                                                                ng-model="paymentType.IsSelected" />

                                                                                {{paymentType.PaymentTypeId}}

                                                                                {{paymentType.PaymentTypeName}}

                                                                                {{paymentType.Amount}}

                                                                                <button ng-click="showModalPayment($index,$parent.$index,$parent.$parent.$index)"
                                                                                class="btn btn-success"
                                                                                ng-disabled="!paymentType.IsSelected"
                                                                                ng-show="!paymentType.PaymentTarrifCodeInfo.IsPaid &&
                                                                                paymentType.PaymentTarrifCodeInfo.BankResultCode != 2">
                                                                                پرداخت
                                                                                </button>

                                                                                <button ng-click="onShowPayStatus($index,$parent.$index,$parent.$parent.$index)"
                                                                                class="btn btn-info"
                                                                                ng-show="paymentType.IsSelected &&
                                                                                paymentType.PaymentTarrifCodeInfo.PaymentId">
                                                                                استعلام پرداخت
                                                                                </button>

js :

define(['app'], function (app) {
    app.register.controller('TarrifPaymentListController',
        [
            '$scope',
            '$window',
            '$translate',
            'dataService',
            '$routeParams',
            '$rootScope',
            'toaster',
            '$location',
            'modalService',
            '$timeout',

            function ($scope, $window, _, dataService, $routeParams, $rootScope,
                toaster, $location, modalService, $timeout) {
                $scope.viewModel = {};
                var requestId = $location.search().id;
                var refCode = $location.search().ReferenceCode;
                var requestPrefix = refCode.split("-")[0];
                var requestType;
                if (requestPrefix == "AMO") {
                    requestType = 1
                }
                else if (requestPrefix == "MF") {
                    requestType = 0
                }
                else if (requestPrefix == "MG") {
                    requestType = 3
                }
                else {
                    requestType = 4
                }
                var getTarrifList = function (requestId, requestType) {

                    var en = {
                        ReuestId: requestId,
                        ReuestType: requestType
                    };
                    dataService.save(en, 'api/RequestPayment/GetTarrifCodeList/')
                        .then(function (data) {
                            if (data.Succeed) {
                                $scope.TarrifTopSystemList = data.TarrifTopSystemList;
                                $scope.TarrifTopSystemList[0].showPanel = true;
                                if (requestType == 1) {
                                    $timeout(function () {

                                 $scope.TarrifTopSystemList[0].SubSystemList[0].showPanelSubSystem = true;

                                    });
                                }
                                else if (requestType == 0) {
                                    $timeout(function ($scope) {
                                        debugger;

                                 $scope.TarrifTopSystemList[0].SubSystemList[1].showPanelSubSystem = true;

                                    },);
                                }

                            } else {

                                toaster.pop('error', _("Dataservice_TTL_Save"), data.Message);
                            }
                        });
                };

A: $scope.TarrifTopSystemList[0].SubSystemList[0].showPanelSubSystem = true
It seemed that you set only first item whether show or unshow.
If you'd like to set each panel show or unshow in TarrifTopSystemList using ng-repeat,
you should set each TarrifTopSystemList to set.
$scope.TarrifTopSystemList[0].SubSystemList[0].showPanelSubSystem = true; $scope.TarrifTopSystemList[1].SubSystemList[0].showPanelSubSystem = false;
If you post your hope layout image and current actual image,
we can make sense easily and response correctly
because your question is about GUI layout.


text:
Q: ListenableFuture - finish after message in cluster is received and time consuming code is executed At first I just want to say that I'm new to akka and Futures. So be gentle :).
I have init method in some class which returns ListenableFuture<Boolean>. This method should execute some time consuming code in separate thread and create akka actor which is listening to some messages in akka cluster. Future returned by init method should be completed after this actor receives certain message AND that time consuming code is finished.
How can I achieve this using ListenableFuture from Guava?

A: Refer to Akka documentation about futures: http://doc.akka.io/docs/akka/current/java/futures.html
You can create 2 different futures, one executing the time consuming code:
Future<String> f1 = future(new Callable<String>() {
  public String call() {
    return "Hello" + "World";
  }
}, system.dispatcher());

And another one sending a message to an actor with an ask:
Timeout timeout = new Timeout(Duration.create(5, "seconds"));
Future<Object> f2 = Patterns.ask(actor, msg, timeout);

Finally you can use Future.sequence to create a single future that gets completed when both your futures are completed.
Iterable<Future<Integer>> listOfFutureInts = source;
Future<Iterable<Integer>> futureListOfInts = sequence(listOfFutureInts, ec);

A: I solved it like this. I created ListenableFuture containing time consuming code. At the end of this furute I created CountDownLatch and passed it (using creator) to akka actor. This listenable future was then blocked by countDownLatch.await(). Created actor with injected latch then listened to certain message in cluster. After consuming this certain message I called countDownLatch.countDown(). This unblocks future, where was await() called and future finished and returned value.


text:
Q: An inner product on the quotient space $F/\text{Ker}(M)$ Let $\mathcal{B}(F)$ the algebra of all bounded linear operators on a complex Hilbert space $(F,\langle\cdot,\cdot\rangle)$. Let $M\in \mathcal{B}(F)^+$ (i.e. $\langle Mx\;, \;x\rangle\geq 0$ for all $x\in F$). Then
$$\langle\cdot,\cdot\rangle_{M}:F\times F\longrightarrow\mathbb{C},\;(x,y)\longmapsto\langle Mx, y\rangle,$$
is a semi-inner product.

I see in a paper that $\langle\cdot,\cdot\rangle_M$ induces an inner product on the quotient space $F/\text{Ker}(M)$. I don't understand how to construct this inner product?

A: Check yoursef that
$$\langle[x],[y]\rangle = \langle Mx,y\rangle$$
($[\cdot] =$ class of equivalence) is well-defined.


text:
Q: How to determine if an activex checkbox is checked? I have 98 checkboxes embedded in my worksheet (Orders).
I want to select certain checkboxes then click a command button that will iterate through the checkboxes. If checked, I want to send the information in that line to the next blank line on another worksheet (Sub COMPLETE). Then I want to clear the information on that line and move the lines after that up a line.
When I step through the sub, I get:

error 1004 'Application-defined or object-defined error'

at the If statement.
Private Sub cmbupdate_Click()
    Dim i As Long

    For i = 1 To 98
        If CheckBoxes("CheckBox" & i).Value = True Then
            Range("A" & (i + 3), "K" & (i + 3)).Select
            Selection.Copy
            COMPLETE
            Selection.ClearContents
            Range("A" & (i + 3).Select
            ActiveCell.Offset(1).Select
            Orders.Range(Selection, Selection.Offset(10)).Select
            Orders.Range(Selection, Selection.End(xlDown)).Select
            Selection.Cut Range("A" & (i + 3))
            Range("A5", "K101").Select
            AddBorder
            Range("A4").Select
            CheckBoxes("Checkbox" & i).Value = False
        End If
    Next
End Sub

A: The CheckBoxes() function wants an index instead of a name. Try to only use the number of i to check. Also an if statement allready checks if a statement is true , so the "= true" is not needed.
If CheckBoxes(i).Value Then


text:
Q: Why do Windows Forms / Swing frameworks favour inheritance instead of Composition? Today a professor of mine commented that he found it odd that while SWT's philosophy is one of making your own controls by composition, Swing seems to favour inheritance.
I have almost no contact with both frameworks, but from what I remember in C#'s Windows Forms one usually extends controls, just like Swing.
Being that generally people tend to prefer composition over inheritance, why didn't Swing/Windows Forms folks favour composition instead of inheritance?

A: JComponent exposes a lot of functionality. If JComponent was an interface and components were implemented with composition, simple components would need to have dozens of trivial method wrappers, e.g.
class MyComponent implements JComponent {
    JPanel panel;
    public boolean contains(int x, int y) {
        return panel.contains(x, y);
    }
    ...
}

There's also an efficiency reason to prefer inheritance over composition -- overriding costs nothing (assuming no super call), while composition costs an extra INVOKEVIRTUAL. I don't know if this influenced the design of Swing, but it's a big concern for collection classes.

A: The Swing Framework is actually designed in accordance with the Composite Design Pattern. Granted that there is a lot of inheritance in there, but you would usually compose your own forms using composition. That is, a form is a composition of intermediate level containers and controls.

A: With Java, its a lot easier to end up using inheritance just because everything is virtual.  Need to fix a "feature" in JTable/JFrame?  Extend it, override the problem methods, and then use your Table/Frame everywhere instead.
I think with things like WPF, where data binding is a primary feature of the design, makes it a lot easier to do composition instead of inheritance.

A: In Effective Java, Item 17, Bloch mentions that a class designed for inheritance "must
document its self-use of overridable methods." A hallmark of this is the phrase this implementation. You'll see it in classes like JTable and JInternalFrame. It's one measure of inheritance by design in Swing.

A: From C# 3.5, we have a concept called as Extension Methods which allows the concept of composition than inheritance.
In this process, we implement an extended functionality to an existing class just by adding an extension class which renders the new feature to the existing class.
You can refer here for more details


text:
Q: Condition for existence of a zero energy eigenvalue for a particle in an infinite well with delta potential There is this rather elementary question that I can't figure out. Consider a particle of mass $m$ in 1D which is confined to the following potential:
$V(x)=\begin{cases}
  \lambda\delta(x-a) & \text{for }0<x<b\\
  +\infty    & \text{otherwise}
\end{cases}$
where $\lambda$ is a real constant and $0<a<b$. Let $\xi=2m\lambda/\hbar^2$. Find conditions on $a$ and $\xi$ such that zero is an energy eigenvalue for this system. Show that this happens when $\xi \leq \xi_*$ and determine $\xi_*$.
My attempt:
The time-independent Schrodinger equation  for $0<x<a$ (region $1$) and $a<x<b$ (region $2$) gives:
$\frac{\partial^2\psi}{\partial x^2}=\frac{-2mE}{\hbar^2}\psi$
For scattering states we should solve for $E>0$ which gives complex exponential functions and for bound states we should solve for $E<0$ which results in real exponential functions. For $E=0$ we get:
$\frac{\partial^2\psi}{\partial x^2}=0$
which gives:
$\psi = Ax+B$
For each respective region. The boundary conditions give:
$\psi_1(0)=0 \implies B_1=0, \qquad \psi_2(b)=0 \implies A_2=\frac{-B_2}{b}$
Therefore the wave function becomes:
$\psi(x)=\begin{cases}
  A_1x & \text{for }0<x<a\\
  A_2(x-b) & \text{for }a<x<b\\
  0    & \text{otherwise}
\end{cases}$
Integrating the time-independent Schrodinger equation around $a$ results in another boundary condition:
$-\frac{\hbar^2}{2m}\frac{\partial \psi}{\partial x}|_{a-\epsilon}^{a+\epsilon} + \lambda = 0$
in which $\epsilon$ is an infinitesimally small number. Substituting the expression for wave function we get:
$A_2-A_1=\frac{2m\lambda}{\hbar^2}=\xi$
Now everything can be expressed in terms of $A_1$ (or $A_2$).
$\psi(x)=\begin{cases}
  A_1x & \text{for }0<x<a\\
  (A_1+\xi)(x-b) & \text{for }a<x<b\\
  0    & \text{otherwise}
\end{cases}$
Continuity of wave function at $x=a$ gives:
$A_1a=A_1(a-b)+\xi(a-b) \implies \xi=\frac{A_1b}{(a-b)}$
We can find $A_1$ by enforcing normalization. But the problem is that, doing so we don't get an inequality. We will get a strict equality.
$\int_{-\infty}^{+\infty}|\psi(x)|^2 dx=1 = A_1^2\int_0^a x^2dx+(A_1+\frac{A_1b}{a-b})^2\int_a^b (x-b)^2 dx$
Doing the integrations and substituting $\xi$ we get:
$A_1^2\frac{a^3}{3}-A_1^2(\frac{a}{a-b})^2\frac{(a-b)^3}{3}=1$
Simplifying and solving for $A_1$ we get:
$A_1 = \sqrt{\frac{3}{a^2b}}$
Finally the wave function becomes:
$\psi(x)=\begin{cases}
  \sqrt{\frac{3}{a^2b}}x & \text{for }0<x<a\\
  \frac{\sqrt{3/b}}{a-b}(x-b) & \text{for }a<x<b\\
  0    & \text{otherwise}
\end{cases}$
And the parameter $\xi$ becomes:
$\xi=2m\lambda/\hbar^2=\frac{\sqrt{3b}}{a(a-b)}$
which puts a restriction to the value of $\lambda$ if we were to have a zero energy eigenvalue or restricts $a$ and $b$ given $\lambda$ depending on how you look at the problem. The whole problem is solved and there is no inequality in sight! So I don't know what I'm doing wrong, how this problem can be resolved and how to find $\xi_*$.
Another strategy can be solving for a non-zero energy eigenvalue and taking the limit as energy goes to zero. Let's assume $E>0$. We will have:
$\frac{\partial^2\psi}{\partial x^2}=\frac{-2mE}{\hbar^2}\psi=k^2\psi$
The general solution can be written as:
$\psi(x)=Asin(kx+\phi)$
Applying boundary conditions we get:
$\psi(x)=\begin{cases}
  A_1sin(kx) & \text{for }0<x<a\\
  A_2sin(kx-kb) & \text{for }a<x<b\\
  0    & \text{otherwise}
\end{cases}$
Continuity at $x=a$ gives:
$A_1sin(ka)=A_2sin(ka-kb)$
Integrating Schrodinger equation and evaluating around $x=a$:
$A_2cos(ka-kb)-A_1cos(ka)=\frac{\xi}{k}$
Putting the previous two equations together we get a transcendental equation for the energy eigenvalues:
$A_1[sin(ka)cot(ka-kb)-cos(ka)]=\frac{\xi}{k}$
Taking the limit $E \rightarrow 0$ and hence $k \rightarrow 0$ gives us nothing as you can see. The value of $A_1$ can be calculated by enforcing normalization which also doesn't have anything to do with the mentioned inequality.

A: There is a mistake in your calculations. The correct form of equality obtained by integrating the Schrodinger equation around $a$ is
$$
-\frac{\hbar^2}{2m}\left(\psi'(a+\varepsilon) - \psi'(a-\varepsilon)\right) + \lambda\psi(a) = 0
$$
This equation leads to the following relation for $A_1$ and $A_2$:
$$
-\frac{\hbar^2}{2m}(A_2-A_1)+\lambda A_1 a = 0.
$$
Last equation, together with the continuity condition
$$
A_1a = A_2(a-b),
$$
allows finding required relation between $\xi$ and $a$:
$$
\xi = -\frac{b}{a(b-a)}.
$$
For a fixed value of $b$, the following inequality is valid:
$$
\xi\leq \xi_{*} = \left. -\frac{b}{a(b-a)}\right|_{a = b/2} =-\frac{4}b.
$$


text:
Q: How to access a SQL Anywhere Server without a database to create one? is it possible to connect to a SQL Anywhere Server without an existing database to create one. In SQL Anywhere Studio i always have to define an existing database.
Regards
Martin

A: You can use the dbinit utility to create a database without connecting to one. If you really want to connect to a SQL Anywhere server and execute the CREATE DATABASE statement yourself (which is all dbinit does), you can start the personal server (dbeng17) and use the utility database, which is a "virtual" database that always exists. To do this, specify "DBN=utility_db" in your connection string.


text:
Q: Issue when deploying mysql db (utf8mb4_unicode_520_ci -> utf8mb4_unicode_ci) I started working on a wordpress on my dev machine. mysql version is 5.6, and worpdress is 4.7 so its already using the utf8mb4_unicode_520_ci encoding if it detects its possible.
My problem is that on my hosting (mysql 5.5) utf8mb4_unicode_520_ci is not recognized as a valid encoding. So I'm trying to target utf8mb4_unicode_ci encoding as my hosting knows about this one, and if I understand correctly, this would - in opposition to going to utf8 - allow me to keep the 4 bytes.
I tried several different combinaison of encoding and collation set up for the db, but nothing successful (from here How to convert an entire MySQL database characterset and collation to UTF-8?).
I tried several combination of encoding and collation in the wp-config, but nothing.
Everything that is coming from the database (like post titles and post contents displays badly encoded char for all diatrics, anything else is displayed appropriately )
menu label from the database display incorrectly, where the hardcoded/translated label display correctly
I think I need to convert the actual content of the database, changing charset and collation does not seems to be enough.
I found this but it does not address my problem directly, or if it does I missed it.
Any help would be appreciated
————————————————————————————————
UPDATE :
here is the precise procedure I went through:
Initial situation:
I installed a wordpress (4.6.1) locally (on my dev machine, mysql 5.6.28).
  I worked on the theme and plugin locally
(at this moment I have, locally, a database that is utf8_general_ci and tables that are utf8mb4_unicode_520_ci
Problem:
I want to deploy my wordpress on my hosting (mysql: 5.5 - db collation seems to be utf8mb4_unicode_ci).
  I mysqldump the db locally, then try to import it on my hostings' phpmyadmin.
  This gives error :
Unknown collation: 'utf8mb4_unicode_520_ci'
solution 1 change the tables charset to utf8mb4_unicode_ci:
On my hosting sql server, utf8mb4_unicode_520_ci is not available and I can't get a more recent version of mysql.
utf8mb4_unicode_ci seems like the closest and is available on my hosting sql server.
from various so question, I adapt a bash script to change charset and collation of my tables
for tbl in wp_sij2017_commentmeta wp_sij2017_comments wp_sij2017_cwa wp_sij2017_links wp_sij2017_options wp_sij2017_postmeta wp_sij2017_posts wp_sij2017_term_relationships wp_sij2017_term_taxonomy wp_sij2017_termmeta wp_sij2017_terms wp_sij2017_usermeta wp_sij2017_users wp_sij2017_woocommerce_api_keys wp_sij2017_woocommerce_attribute_taxonomies wp_sij2017_woocommerce_downloadable_product_permissions wp_sij2017_woocommerce_order_itemmeta wp_sij2017_woocommerce_order_items wp_sij2017_woocommerce_payment_tokenmeta wp_sij2017_woocommerce_payment_tokens wp_sij2017_woocommerce_sessions wp_sij2017_woocommerce_shipping_zone_locations wp_sij2017_woocommerce_shipping_zone_methods wp_sij2017_woocommerce_shipping_zones wp_sij2017_woocommerce_tax_rate_locations wp_sij2017_woocommerce_tax_rates; do
 mysql --execute="ALTER TABLE wp_sij_2017_original_copy.${tbl} CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
done

I run this script on the local db
I now have all my tables set to collation utf8mb4_unicode_ci
My db collation is still utf8
I mysqldump the db, then import it to my hosting and...
Import is successful.
I search and replace siteurl in the db.
I then visit the online website, I got SOME diatrics that renders a "question mark char"
Any text coming from the db has decoding issue AT SOME POINT
The source/html markup also has those "question mark char"
I have no idea where to look or what to do next

A: Clarification:  CHARACTER SETs utf8 and utf8mb4 specify how characters are encoded into bytes.  COLLATIONs *_unicode_*, etc, specify how those character compare.
The encoding for utf8mb4_unicode_ci and utf8mb4_unicode_520_ci are the same because they are encoded in the character set utf8mb4.
"database that is utf8_general_ci and tables that are utf8mb4_unicode_520_ci" -- that probably means that new tables in that database, unless specifically stated, will be CHARACTER SET utf8 COLLATION utf8_general_ci.  That is the database setting is just a default for CREATE TABLE.  Since your tables are already CHARACTER SET utf8mb4 COLLATION utf8mb4_unicode_520_ci, the database default is not relevant to them.
As long as the CHARACTER SET stays utf8mb4, no Emoji, Chinese, etc will be lost or otherwise mangled.
Do not use mysql40; it did not know about any CHARACTER SETs.  Do not use CONVERT or CAST.  Etc.
I assume the 520 is coming from the output of mysqldump?  Do you have an editor that can handle a file that big?  If so, simply edit it to change utf8mb4_unicode_520_ci to utf8mb4_unicode_ci throughout.  Then load the dump.  Problem solved?
Your fix
You did ALTER ... CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci on your local machine.  That is probably an even better way -- since it will put your dev and prod machine in line with each other.  That should have worked.  Don't worry about what the "database" claims.

A: I'm find 'utf8mb4_unicode_520_ci' and replace with 'utf8mb4_unicode_ci' in .sql file.
Its simplest why to solve this.


text:
Q: MySQL between query returning redundant results SELECT webcal_entry.cal_id, webcal_entry.cal_name , webcal_entry.cal_priority,
webcal_entry.cal_date , webcal_entry.cal_time , webcal_entry_user.cal_status,
webcal_entry.cal_create_by , webcal_entry.cal_access, webcal_entry.cal_duration ,
webcal_entry.cal_description , webcal_entry_user.cal_category
FROM webcal_entry, webcal_entry_user
WHERE webcal_entry.cal_date BETWEEN '20090601' AND '20090631'

When I execute that query php throws back:
mysql_query(): unable to save result set
MySQL client ran out of memory

When I limit the results I see that it is pulling some 2.8 million results back. This table has 7,241 rows.
I realize I could use LIKE, but I really don't want to go that route.
Thanks for any help!

A: You are joining the webcal_entry and webcal_entry_user tables in your FROM clause but you do not have any JOIN ON or WHERE conditions constraining which rows from webcal_entry_user to return. The result will be the cartesian product of the two tables, which basically means you'll get back each webcal_entry row that has a valid cal_date, multiplied by the number of rows in the webcal_entry_user table.
In other words, if you webcal_entry_user has 400 rows you'll get back 400*7241 = 2.8 million rows! Yikes!

A: You're doing a cartesian join. Basically, for each row in the first table you're joining against all the rows in the second. If the first table has 4 rows and the second 10 the result set will have 40 (4x10)

A: You need to add the key you're joining on that exists in both tables to the WHERE clause. Something like:
AND   webcal_entry.user_id = webcal_entry_user.user_id


text:
Q: Deployed wordpress is now showing basic auth popup instead of login page for wp-admin I have a wordpress website that hasn't been logged into for awhile, and it appears some auto-update change happened. The wp-admin login screen is now blocked by a basic auth popup. The admin and user credentials we thought were still good are no longer working, and because this pop-up blocks the load of the login page there's no way to reset a password.
Anyone else seen a wordpress update force a basic-auth window to replace the login page? I've seen some notes about fixing it via an .htaccess file but there isn't one in place, so I'm not even sure what caused this change.

A: This does not sound normal and Wordpress updates do not automatically install what you just described.
If you are seeing an additional popup when you try to load your wp-admin screen, chances are your host added in that security measure. Send a ticket to your host and there is a 99% chance they will be able to advise you.
Also, check your emails, I had that experience before where a host added that extra security measure, and they simply sent an email informing clients about that and the login credentials. It is not the same login credentials as your actual wp-admin too, and that is why you are unable to access or get past it.


text:
Q: Моментальное изменение параметров в css анимации Есть анимация
@keyframes slidein {
  0% {
    width: 100%;
  }
  50% {
    width: 0
  }
  100% {
    width:0;
  }
}

И я хочу, например, после 50% моментально применить width: 100% и ещё пару параметров, color, background. Я понимаю, что можно сделать, например, так:
50.001% {
  width: 100%;
}

Но можно ли избежать такого... колхоза? Заранее спасибо.


text:
Q: What are CGroup Slices Used For Just been paying attention to systemctl status' branching structure. I realized I was making up stories to explain why it looked like that but had no clue of what it meant. I can't find much info on slices.
My story is that they are sliced off into isolation. And add security from reading the wrong address... that they probably constantly use the same virtually sliced addys.

Can you give me some insight into what that illustration means from the OS perspective? Or your perspective...?

A: Slices are a systemd concept.  Systemd uses cgroups for low level implementation of slices.   This is unrelated to memory protection.  All processes have their own isolated memory without slices.
cgroups is part of the low level implementation of the container system, which allows putting limits on the resources a group of processes can use, allowing a hard division of system resources.  This is a resource allocation issue, not a memory sharing issue, and being in the same slice does not cause memory to be shared between processes.
The systemd slice system (with the help of services and scopes) allows grouping related processes together (for instance, a user's session or a system service composed of multiple processes).  Each slice can have maximum cpu and memory resources allocated to it, which can prevent a single slice from causing a denial of service attack on other slices by running the system out of resources.  But also, it allows grouping processes together so that they can all be killed at once, for instance, when a user logs out (this is not enabled by default).
The man page for systemd.slice details this.  The man page for systemd.resource-control lists the resources that can be limited within a slice.

A: The hypothetical proposition "I want to make use of kernel cgroups, how do I do this in the new world order?" is used to explain how scope needs to be managed, and how slices play a role in this for systemd: The New Control Group Interfaces
It highlights the ability to define constraints to members of a slice that trump the predefined allowances granted the the member's author. Kind of like a cool handcuff feature.


text:
Q: What is the intention of "on went" in the sentences?
On went her old brown jacket; on went her old brown hat. With a whirl
  of skirts and with the brilliant sparkle still in her eyes, she
  fluttered out the door and down the stairs to the street. (From: The
  Gift of the Magi. by O. Henry)

What is the intention of "on went" in the sentences? Does it mean "wear"?

A: The style of "on went" suggests that the person who is donning these articles of clothing is being quick about it. Compare "a whirl of skirts".
If someone were slowly removing articles of clothing, in a seductive way, for example, one would not write "off went the hat, off went the skirt, off went the blouse..."

A: It means that she put them on. First she put on her old brown jacket. Then she put on her old brown hat. Finally, she walked out the door and down the street.

A: Just to clarify michelle's "put them on" answer (which is correct), "to put an article of clothing on" means to dress in that article.  A single English verb for this would be to "don" an article of clothing, but that expression is slightly formal/antiquated these days.
I'd disagree with TRomano's comment on the implied quickness, however.  The "whirl of her skirts" bit could potentially imply quickness, but simply saying "on went her jacket" does not.  In fact, I'd question whether the "whirl of her skirts" is intended to imply quickness -- it could imply a joyful, lighthearted motion.  This also works with "fluttering" down the steps, and the sparkle in her eyes.
Further, I absolutely disagree with the assertion that one wouldn't use "off went her [x]" in a seductive way... A long string of those statements tied together would leave me feeling with a slow, steady, almost rhythmic progression.  Again, though, that's due to the use of the phrase in a specific way; I'd say that by itself, "on went [x]" doesn't imply slow or fast action.


text:
Q: Configuring SDI input/output for passthru input card->gpu->output card I'm using the Quadro SDI SDK along with my Quadro K6000+ SDI Input & output cards and have converted the included cudaDVP SDK sample to send raw image buffers directly to the GPU from the SDI input card.
In the next step I display the data via opengl bindings. Finally I want to output the same identical data to my output card, and this is where I'm having troubles.
I am getting correct input data and I do manage to output to the screen but there appears to be some data modifications happening in the SDI output pipeline as the outgoing image is not quite correct (wrong colors etc). I'm passing the raw input buffer as can be seen below.
Which output card configuration should I use to match my input settings (see below)?
Which if any modifications to the OpenGL output texture configuration are required (see below)?
Input/output Capture/receive options & GL bindings in order of being called in the application:
........
 Display *dpy = XOpenDisplay(NULL);
 //scan the systems for GPUs
int num_gpus = ScanHW(dpy,gpuList);

if(num_gpus < 1)
    exit(1);

//grab the first GPU for now for DVP
HGPUNV *g = &gpuList[0];

////////////////////////////////////////////////////////////////////////////////////////////////
/// Input related SDI settings and OpenGL settings

// Query input , in our case Video format: NV_CTRL_GVIO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL
XNVCTRLQueryTargetAttribute(dpy, NV_CTRL_TARGET_TYPE_GVI, 0, 0, NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT, &m_videoFormat);

//
 // Set desired parameters
//
// Signal format.
XNVCTRLSetTargetAttribute(dpy, NV_CTRL_TARGET_TYPE_GVI, 0, 0, NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT, m_videoFormat);
//Bits per component - 10 bits
XNVCTRLSetTargetAttribute(dpy, NV_CTRL_TARGET_TYPE_GVI, 0, 0, NV_CTRL_GVI_REQUESTED_STREAM_BITS_PER_COMPONENT, NV_CTRL_GVI_BITS_PER_COMPONENT_10);
// Component sampling -422
XNVCTRLSetTargetAttribute(dpy, NV_CTRL_TARGET_TYPE_GVI, 0, 0,   NV_CTRL_GVI_REQUESTED_STREAM_COMPONENT_SAMPLING, NV_CTRL_GVI_COMPONENT_SAMPLING_422);
// Chroma expansion OFF
XNVCTRLSetTargetAttribute(dpy, NV_CTRL_TARGET_TYPE_GVI, 0, 0, NV_CTRL_GVI_REQUESTED_STREAM_CHROMA_EXPAND,   NV_CTRL_GVI_CHROMA_EXPAND_FALSE);

// Query the width and height of the input signal format
XNVCTRLQueryAttribute(dpy, g->deviceXScreen, value, NV_CTRL_GVIO_VIDEO_FORMAT_WIDTH, &m_videoWidth);
XNVCTRLQueryAttribute(dpy, g->deviceXScreen, value, NV_CTRL_GVIO_VIDEO_FORMAT_HEIGHT, &m_videoHeight);

    ....
GLuint m_videoSlot; // Video slot number
GLuint m_vidBuf;  // Video capture buffers
GLint m_bufPitch; // Buffer pitch
GLuint m_vidTex;  // Video capture textures

m_videoSlot = 1;
//////////////////////////////////////
////////// OpenGL related settings
// No video color conversion desired ( we want the raw data, NULL )
glVideoCaptureStreamParameterfvNV(m_videoSlot, 0, GL_VIDEO_COLOR_CONVERSION_MATRIX_NV, NULL);
glVideoCaptureStreamParameterfvNV(m_videoSlot, 0,GL_VIDEO_COLOR_CONVERSION_MAX_NV, NULL);
glVideoCaptureStreamParameterfvNV(m_videoSlot, 0,GL_VIDEO_COLOR_CONVERSION_MIN_NV, NULL);
glVideoCaptureStreamParameterfvNV(m_videoSlot, 0,GL_VIDEO_COLOR_CONVERSION_OFFSET_NV, NULL);

// Set the buffer object capture data format. - IE number of components in a pixel
glVideoCaptureStreamParameterivNV(m_videoSlot, 0, GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV, &GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV);
// Get the video buffer pitch
glGetVideoCaptureStreamivNV(m_videoSlot, 0,  GL_VIDEO_BUFFER_PITCH_NV, &m_bufPitch);
// Bind the buffer
glBindBufferARB(GL_VIDEO_BUFFER_NV, m_vidBuf);
// Allocate required space in video capture buffer
glBufferDataARB(GL_VIDEO_BUFFER_NV, m_bufPitch * m_videoHeight, NULL, GL_STREAM_READ_ARB);
// Bind the buffer to the video capture device.
glBindVideoCaptureStreamBufferNV(m_videoSlot, 0, GL_FRAME_NV, 0);

////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////
/// SDI Output card settings
GLuint m_CudaOutTexture;                // Texture to send to the output device
GLuint m_CudaOutBuffer;                 // Texture to send to the output device
GLuint m_OutTexture;

// Set video format - same as input - NV_CTRL_GVIO_VIDEO_FORMAT_576I_50_00_SMPTE259_PAL
XNVCTRLSetAttribute(dpy, m_outputOptions.xscreen, 0, NV_CTRL_GVO_OUTPUT_VIDEO_FORMAT, m_videoFormat);

// Set data format format.
// Attempted several different settings here....
data_format = NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB422;
//data_format = NV_CTRL_GVO_DATA_FORMAT_X10X10X10_422_PASSTHRU;
//data_format = NV_CTRL_GVO_DATA_FORMAT_X8X8X8_422_PASSTHRU;
//data_format = NV_CTRL_GVO_DATA_FORMAT_R10G10B10_TO_YCRCB422;
//data_format = NV_CTRL_GVO_DATA_FORMAT_X12X12X12_422_PASSTHRU;
//data_format = NV_CTRL_GVO_DATA_FORMAT_Y10CR10CB10_TO_YCRCB444;
//data_format = NV_CTRL_GVO_DATA_FORMAT_X10X8X8_422_PASSTHRU;
//data_format = NV_CTRL_GVO_ENABLE_RGB_DATA_DISABLE
XNVCTRLSetAttribute(dpy, m_outputOptions.xscreen, 0, NV_CTRL_GVO_DATA_FORMAT,  data_format);
// Set sync mode
XNVCTRLSetAttribute(dpy, m_outputOptions.xscreen, 0, NV_CTRL_GVO_SYNC_MODE, NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING);

// Set sync source
XNVCTRLSetAttribute(dpy, m_outputOptions.xscreen, 0, NV_CTRL_GVO_SYNC_SOURCE, NV_CTRL_GVO_SYNC_SOURCE_SDI);
// Set flip queue length
XNVCTRLSetAttribute(dpy, m_outputOptions.xscreen, 0, NV_CTRL_GVO_FLIP_QUEUE_SIZE, 5);

    .....

///////////////////////////////////////////////////////////////////
// OpenGL related settings for output
//Setup the output after the capture is configured.
glGenTextures(1, &m_OutTexture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_OutTexture);
glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA8, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0 );

////////////////////////////////////////////////////////
//Setup GL output from cuda
// Create and initialize a texture objects.
glGenBuffersARB(1, &m_CudaOutBuffer);
assert(glGetError() == GL_NO_ERROR);
glBindBufferARB(GL_VIDEO_BUFFER_NV, m_CudaOutBuffer);
assert(glGetError() == GL_NO_ERROR);
// Allocate required space in video capture buffer
glBufferDataARB(GL_VIDEO_BUFFER_NV, pitch * height, NULL, GL_STREAM_COPY);
glGenTextures(1, &m_CudaOutTexture);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_CudaOutTexture);
glTexParameterf(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
assert(glGetError() == GL_NO_ERROR);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_RGBA8, width,height,
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
//register the buffer objects
cudaRegisterBuffers();
....

  ////////////////////////////////////////////////////////////////
  /////////// Data transfer from GPU to output device buffer (to be outputted to the SDI output card)

GLint inBuf = m_vidBuf;
// Map buffer(s) into CUDA
cudaError_t cerr;
unsigned char *inDevicePtr;
cerr = cudaGLMapBufferObject((void**)&inDevicePtr, inBuf);
cudaCheckErrors("map");
unsigned char *outDevicePtr;
cerr = cudaGLMapBufferObject((void**)&outDevicePtr, m_CudaOutBuffer);
cudaCheckErrors("map");

//
// Dummy CUDA operation:
// Perform CUDA Operations here such as  a kernel call with outDevicePtr and inDevicePtr.
//
unsigned int pitch = m_SDIin.getBufferObjectPitch(0);
unsigned int height = m_SDIin.getHeight();
cudaMemcpy(outDevicePtr,inDevicePtr,pitch*height,cudaMemcpyDeviceToDevice);

  ////////////////////////////////////////////////////////
  /////// output

GLboolean C_cudaDVP::OutputVideo()
{
    if(!m_SDIoutEnabled)
        return GL_FALSE;
    //send the texture to SDI out.
    glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_OutTexture);
    glEnable(GL_TEXTURE_RECTANGLE_NV);

    glPresentFrameKeyedNV(1, 0,
                0, 0,
                GL_FRAME_NV,
                GL_TEXTURE_RECTANGLE_NV, m_OutTexture, 0,
                GL_NONE, 0, 0);

     GLenum l_eVal = glGetError();
    glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);

    if (l_eVal != GL_NO_ERROR) {
        fprintf(stderr, "glPresentFameKeyedNV returned error: %s\n", gluErrorString(l_eVal));
        return FALSE;
    }

    return GL_TRUE;
}

.....

// After which we call:

// To skip a costly data copy from video buffer to texture we
// can just bind a video buffer to GL_PIXEL_UNPACK_BUFFER_ARB and call
// glTexSubImage2D referencing into the buffer with the PixelData pointer
// set to 0.
glBindTexture(GL_TEXTURE_RECTANGLE_NV, m_CudaOutTexture);
//glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_SDIin.getBufferObjectHandle(0));
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, m_CudaOutBuffer);
glPixelStorei(GL_UNPACK_ROW_LENGTH,pitch/4);
glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);

//////////////////////////////////////////////////////


text:
Q: Mysqli select query based on two different fields Here is My Table Structure
Table : sales
invoice_no  prd_code    quantity    unit_price  discount    tax total_tax   date    delet
   135          1          1            120         0        5      0     1/8/2016      1
   135          1          1            120         0        5      0     1/8/2016      0
   135          2          3            30          0        0      0     1/8/2016      0
   135          3          1            165         0        5      0     1/8/2016      0
   136          2          4            30          3        5      0     1/16/2016     0
   136          1          2            120         0        0      5     1/16/2016     0
   136          1          2            120         0        0      5     1/16/2016     1
   136          1          2            120         0        0      5     1/16/2016     1
   137          1          2            120         0        0      0     1/15/2016     0
   137          1          2            120         0        0      0     1/15/2016     0
   138          2          12           30          0        0      6     1/16/2016     0
   138          3          10           165         0        0      6     1/16/2016     0

Here is my Html Code
<input type = "date" id = "fmdte" name = "fmdte" class = "form-control" />
<input type = "date" id = "todate" name = "todate" class = "form-control" />
<input type = "text" id = "tax" name = "tax" class = "form-control" />
<input type = "submit" id = "ser" name = "ser" value = "Search" />

Here is my PHP Code:
if (isset($_POST['ser']))
{
   $fmdt = $_POST['fmdte'];
   $todt = $_POST['todate'];
   $tax_ser = $_POST['tax'];
   $purqry = $db->execute("select * from sales where date BETWEEN '$fmdt' and '$todt' and (tax='$tax_ser' OR total_tax='$tax_ser') and delet='0'"); //,order_no
}

In this table there is two fields one is tax and other one is total_tax the tax field is used to store item wise tax and the total_tax is used to store total tax in an invoice.
Initially default value of two fields are Zero if a value store in tax field (!=0) total_tax value store as Zero, if a value store in total_tax field (!=0) tax field value store as Zero some time no values stored in tax and total_tax fields  so its default value is Zero. I want to Search Zero Tax items combine tax and total_tax fields
How to search tax=0 and total_tax=0 (avoid tax>0 and total_tax>0)

A: let try it
    if (isset($_POST['ser']))
    {
         $fmdt = $_POST['fmdte'];
         $todt = $_POST['todate'];
         $tax_ser = $_POST['tax'];

         //use concat when passing variable value
         $purqry = $db->execute("select * from sales ".
         "where (date BETWEEN '". $fmdt ."' and '". $todt ."') ".
         "and (tax= ". $tax_ser ." OR total_tax= ". $tax_ser .") and delet='0' "); //,order_no
    }

A: I find a solution..
if (isset($_POST['ser'])) {
    $fmdt = $_POST['fmdte'];
    $todt = $_POST['todate'];
    $tax_ser = $_POST['tax'];
    if ($tax_ser == '0') {
        $purqry = $db->execute("select * from sales where date BETWEEN '$fmdt' and '$todt' and (tax='$tax_ser' and total_tax='$tax_ser') and delet='0'");
    }
    else {
        $purqry = $db->execute("select * from sales where date BETWEEN '$fmdt' and '$todt' and (tax='$tax_ser' OR total_tax='$tax_ser') and delet='0'");
    }
}


text:
Q: Parsing The Response From Fetch Backbone I am not able to get the response string from the fetch method in my view render method.
The Collection Class Goes here.
 Collection = (function(){

    var Events;

    Events = Backbone.Collection.extend({

        url:function(){
           //alert(urlOptions);
         return this.urlParam;
           // alert('API call :'+urlOptions);
        },

        initialize: function(models, options){
            this.urlParam = options.urlParam || "";
        },

        parse: function( response ){
            var parsed = Jath.parse(
                [ '//notes', {

                } ], response );
            console.log(parsed);
            return parsed;

        }
        });

    return {
        newInstance : function(models,options) { return new Events(models,options); }
    };
})();

The View Goes Here

    View = (function() {
  'use strict';

  var
    htmlTemplate = _.template( $('#eventGridTemplate' ).html() ), // See templatesSearch.jsp
    expanded = true, // By default the Events Grid extends to the bottom of the browser window.
    BackboneView, applyStyles;

  /**
   * Apply CSS specific to this view
   * Unfortunately, this View needs to modify its parent wrapper element.
   * Otherwise the layout will break when it's resized.  See templatesSearch.jsp.
   * @param {Object} $elmt
   * @param {Boolean} expand
   */
  applyStyles = function( $elmt, expand ) {

    var
      top   = '2px',
      left  = '2px',
      pos   = 'absolute',
      right = '2px';

    if ( expand ) {

      $elmt.css({
        "position" : pos,
        "top"      : top,
        "left"     : left,
        "right"    : right,
        "bottom"   : "2px"
      });

      $elmt.parent().css( 'bottom', '2px' );

    } else {

      $elmt.css({
        "position" : pos,
        "top"      : top,
        "left"     : left,
        "right"    : right,
        "bottom"   : "50%"
      });

      $elmt.parent().css( 'bottom', '50%' );
    }
  };

  // See 'http://backbonejs.org/#View-constructor' for more info
  BackboneView = Backbone.View.extend({

    onAiringsBtn : function( event ) {

      // If the Events Grid container was expanded, contract it.
      // If it was contracted, expand it.
      expanded = expanded ? false : true;
      applyStyles( this.$('div'), expanded );
},

    initialize : function() {
  this.render();
    },

    render : function() {
      // this.$el is the jQuery version of this.el
      // Which is populated by options.el
      // Which is part of the options object passed into the constructor
      //alert('Start Date:' +$('#datepicker').datepicker('getDate'));
       var eventsCollection = Collection.newInstance([],{urlParam:'http://localhost:8080/adtglobal/2.0/api/events?startDate=2013-11-05T00:00:00-0400&endDate=2013-11-06T00:00:00-0400'});
       //console.log(eventsCollection.url());
        eventsCollection.fetch({
             success : function(eventsCollection , response){
                 console.log(eventsCollection.toJSON());
                 alert(eventsCollection.toJSON());
             }
                   });
        this.$el.html( htmlTemplate );
        applyStyles( this.$('div'), true );
    }
  });

  //-------------------------------------------------------------------------------------------------------------------
  // Public API
  //-------------------------------------------------------------------------------------------------------------------

  return {
    newInstance : function(options) { return new BackboneView(options); }
  };

})();

I get The response as success and i see the xml in the browser console, but how do i parse it here ??
The response is here
<Events xmlns="urn:api:2.0">
<PageNavigation showing="45"></PageNavigation>
<Event id="400515625" href="400515625" source="SDR">
<OrgHierarchy>
<level id="56" typeId="100" title="Soccer" description="Sport" href="../sporthierarchy?levelId=56&levelTypeId=100"></level>
<level id="2902" typeId="101" title="UEFA" description="Confederation" href="../sporthierarchy?levelId=2902&levelTypeId=101" parentId="56" parentType="100"></level>
</OrgHierarchy>
<EventType id="1">Standard Event</EventType>
<League id="1860">UEFA > Polish Orange Ekstraklasa</League>
<EventTitleText>Ruch Chorzow vs. Zawisa Bydgoszcz</EventTitleText>
<CompetitionType id="1">Team vs Team</CompetitionType>
<EventCompetitors>
<Teams>
<HomeTeam id="73960" href="../teams/73960">Ruch Chorzow</HomeTeam>
<AwayTeam id="107278" href="../teams/107278">Zawisa Bydgoszcz</AwayTeam>
</Teams>
</EventCompetitors>
</Event>
</Events>

A: well, it seems you are not using Jath correctly.
you need to define a template that matches your XML.
I have not used Jath before, but I will try to create a simple template for you:
//in your parse
var template = [ "//Events", {id: "@id", eventType: 'EventType'}];

return Jath.parse(template, response );

try this first and see if you have something in your collection.
it seems you have nested resources in your response, so you will have to complete the template.
or, if you don't have to use Jath, try something simpler: here's an example jsfiddle, you should be able to see the parsed JSON in the console.
http://jsfiddle.net/5j57T/
EDIT: xml to json code is from: http://davidwalsh.name/convert-xml-json
NOTE: you need to parse that json again into an array of objects you need, in order to make your app work!
=====================
EDIT: another example (works better than the previous fiddle)
http://jsfiddle.net/5j57T/1/
uses a jquery library http://www.fyneworks.com/jquery/xml-to-json/
there's only one issue, since there's only one event in your events, it cannot be parsed to an array by default, you will have to do that manually. If, there's always only one event per response, you can do something like this:
parsed = [$.xml2json(xmlDoc.getElementsByTagName('event')[0])]

or you can just do
parsed = $.map(xmlDoc.getElementsByTagName('event'), function(eventXml) {
  return $.xml2json(eventXml);
});

working jsfidde: http://jsfiddle.net/5j57T/2/
==========================
EDIT:
I think by default, backbone is expecting a JSON response from the server. You will have to overwrite it's fetch() function so support XML. so in your collection definition, add this:
fetch: function (options) {
  options = options || {};
  options.dataType = "xml";
  return Backbone.Collection.prototype.fetch.call(this, options);
}

here's a working jsfiddle: http://jsfiddle.net/5j57T/4/
Ignore the 'data' and 'type' options I passed to fetch(), and the url, all of that are just to make Ajax request work on jsfiddle. You shouldn't have those in your app.
In this demo, when the XML is returned, it's parsed into the collection correctly. You should be able to see your collection in the console.
======
If all of your backend services return XML only. I'd suggest overwrite the Backbone.sync function to make it work for other methods like save().


text:
Q: working with custom Types to replaces string parameters if you don't need the backround for this question then skip to the question below.
as you could see in first code block , I am using constants as parameters passed to the Style Dictionary.
since I know (by now), that types are vastly used in .net,  i would like to find out,  how to specify that the dictionary will accept parameter passed as dedicated types, rather than a string type.
and that will also  be another small lesson for me, about types .
                         //string                //string
html.StyleDict.Add(Stl.Prop.BgColor, Stl.Vals.Clr.Aquamarine);

up until now, I was passing it (the style dictionary) strings,  to be used as parameters, so i could make it do the job, while keeping it simple... as I am still fresh with .net, and back then... when I've created this class, I couldn't even think of learning what types are, or how to work with them .
so ...as for this scenario, the implementation and usage should be quite a simple task (for some of you ...well actually most of you if not all(: ) to convet implementation by using custom types instead of strings .
Question is : How To Create the style class?
... so eventually it will be passing strings for that C# styling task, but the dictionary will allow you to pass parameters as types of style,  that's because the html css styling is done through code behind is via strings values. though I would use my custom Style class when populating  the style dictionary.
                     //styleType                //styleType
html.StyleDict.Add(Stl.Prop.BgColor, Stl.Vals.Clr.Aquamarine);

for example.
This is the class i am using to make alternation of backround for element
by using a loop that generates html markup , so i am passing in the counter of loop along with other style properties for current element in the loop
(a little off topic but i had to give a usage example to ilustrate the meaning of this question)
...also that's the spot where the dictionary of style comes to use.
public sealed class html
{
      //  current Typless Dictionary
    public static Dictionary<string, string> StyleDict = new Dictionary<string, string>();

        // future dictionary (: , naturally it wouldnt work with the parameters as it is now (see relevant Styles Class
    public static Dictionary<Styles.Prop, Styles.Vals> StyleDict = new Dictionary<Stl.Prop, Stl.Vals>();
    public static string DynamicStyle_Generator
    (
        int LoopCounter = -1,
        Dictionary<string, string> StyleAttributeDict = null
    )
    {
        string BaseStyle = "", Terminator = "'", BgCol = "";

        StringBuilder StylerSB = new StringBuilder();

        BgCol = "";
        bool bgcolAlternator;

            if (LoopCounter >= 0)
            {
                LoopCounter++ ;
                bgcolAlternator = (RowCounter % 2) == 0;

                    if (bgcolAlternator)
                        BgCol = "#70878F";

                    else BgCol = "#E6E6B8";
             }

        BaseStyle = string.Format("style='background-color:{0};", BgCol);
        return string.Concat(BaseStyle, StyleDict, Terminator);

    }

        Lsts.StlsDict.Add(Stl.Prop.BgColor, Stl.Vals.Clr.Aquamarine);

        public Dictionary<Stl.Prop, Stl.Vals> StlsDict = new Dictionary<Stl.Prop, Stl.Vals>();

    public static class Styles
    {

        public sealed class Props
        {
            public static string pBgUrl1(string fileName)
            {
                return "url('images/" + fileName + "')";
            }
            /// <summary>
            /// Specifies the HTML backgroundimage style.
            /// </summary>
            public static readonly string BgColor = "Background-Color ",

            /// <summary>
            ///     Specifies the HTML backgroundimage style.
            /// </summary>
            BackgroundImage = "Background-image ",

            /// <summary>
            ///     Specifies the HTML bordercollapse style.
            /// </summary>
            BorderCollapse = "BorderCollapse ",

            /// <summary>
            ///     Specifies the HTML bordercolor style.
            ///</summary>
            BorderColor = "BorderColor ",

            /// <summary>
            ///     Specifies the HTML borderstyle style.
            ///     </summary>
            BorderStyle = "BorderStyle ",
     }

        public sealed class Vals
        {

            public class fontNames
            {
                public const string Aharoni = "Aharoni",
                                    Andalus = "Andalus",
                                    AngsanaNew = "Angsana New",
                                    AngsanaUPC = "AngsanaUPC",
                                    Aparajita = "Aparajita";
            }

            public class Color
            {
                public const string AliceBlue = "AliceBlue";
                public const string AntiqueWhite = "AntiqueWhite";
                public const string Aqua = "Aqua";
                public const string Aquamarine = "Aquamarine";
                public const string Azure = "Azure";
            }
       }
}

another way i could use to have my own type passed( condition is to use same dictionary)
only thing i could come up with is using default values set to parameters
while writing this , i could have thought of this actually

Dictionary<T,T> StyleDict = new Dictionary<T, T>();

than just convert to string ! (not working )
    public static string DynamicStyle_Generator
    (
        int LoopCounter = -1,
        Dictionary<Styles.Props, Styles.Vals.Color> StyleColor = null
        Dictionary<Styles.Props, Styles.Vals.fontNames> StylefontNames = null
    )
    {

here there's no need unless you want the fonts but not the color you will have to be uncomfertable by calling like this

DynamicStyle_Generator(counterhere , null, DictionaryOfFonts);

otherwise
DynamicStyle_Generator(counterhere , DictionartyColors, DictionaryOfFonts);

then this will do it's job regardless to the values same way (null or not)
        return string.Concat(BaseStyle, DictionartyColors, DictionaryOfFontsm, Terminator);

A: This looks to me like a case of over-engineering.  There is a reason that System.Web.UI.WebControls.WebControl exposes its Style property which internally works with strings for both the keys and the values.  You are wanting to supply a list of constants for keys, which is ok,  a list of constants for the values won't.

A: An enum in C#  is used to represent a set of fixed distinct values
http://www.codeproject.com/Articles/20805/Enhancing-C-Enums
based on your comment, i think this is what you are looking for:
http://weblogs.asp.net/ralfw/archive/2006/01/07/434774.aspx
from the above link:
public enum Colors
{
   red, blue, green
}

Set<Colors> sc = new Set<Colors>();
sc.Add(Colors.red);
sc.Add(Colors.green);

Set<Colors> sc2 = new Set<Colors>();
sc2.Add(Colors.blue);

sc.Add(sc2); // union

Console.WriteLine(sc); // prints: [red,blue,green]


text:
Q: Click on a button to chance textfield 50% chance im very new to java & android development,
I want a textfield that changes 50% to "You win!" or 50% to "You Lose!" when i click/tap a button.
And a image rotating randomly, like it is 0° then it will get a number between 0 and 100 (higher then 50 is clockwise lower then 50 is counter-clockwise)
i might be asking to much xD but i really dont know how i do this.
How do i do this ?
I actually dont want very advanced answers because im very new to java.
Theres is pretty much nothing in my code except for a button and a textfield.

A: Math.random() method gives you a floating point number between 0-1 but not included 1.
All you have to do is:
int randomNumber = (int)(Math.random()*101);
if(randomNumber < 50)
    ...
else
    ...

A: Here a little help to start off.
First you should add an OnClickListener to your button:
yourButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            handleButtonClick();
        }
    });

The handleButtonClick()-method could look like this:
private void handleButtonClick() {
    // Here we get a random integer between 0 and 99 (including 0 and 99)
    int randomNumber = new Random().nextInt(100);
    // Here we check if the random number is even
    boolean isEven = randomNumber % 2 == 0;
    // Now you can do stuff depending on the integer itself (rotation)
    // and depending on whether it's even or not.
    if(randomNumber < 50){
      // do this
    } else {
      // do that
    }

    if(isEven){
      // do this
    } else {
      // do that
    }

}

To change the text you use:
yourText.setText(...);

But this is really basic stuff you could read on Android TextView
And rotating images was discussed here Android: Rotate image in imageview by an angle
Please read tutorials or refer to this before asking every little thing you could easily look up. Feel free to ask again when you get stuck.
Good luck.


text:
Q: Cannot register COM assembly during BUILD I have several Programs that are COM dlls. I am setting up my development environment on a new computer. When I build some DLLs they build successfully. Others do not build successfully.
Cannot Build
I have tried opening visual studio with "run as administrator". However when I do this on this new computer, I cannot see the mapped drives.
Mapped Drives missing
Staying with Cannot register, I notice in the image that the project that will not build references a URL in the error message. The project that builds successfully references a mapped drive.
For troubleshooting I would like to replace the URL with the mapped drive. I opened the project (opened .vbproj, not .sln) that does not build by navigating to the mapped drive but still when it was built, the URL appears in the Error window.
How do I get the mapped drive to be used during Build rather than the URL? Where can I change that reference?
Not knowing if my troubleshooting idea above will work, let me ask the more general question. How do I eliminate the Cannot register error?
The best solution for me would be to have the mapped drives appear when I select "run as administrator". I know this is possible because on a different computer at different location with a different IT staff, the mapped drives appear. How do I get the mapped drives to appear when I "run as administrator"
Thank you,
pat
The image to my comment regarding the Registry fix.
Fix Mapped links


text:
Q: VLOOKUP, For Each loop - write result to cell I have the following table in Excel.
The result column is calculated by the formula:
IF(ISERROR(VLOOKUP(A2,$B$2:$B$8,1,0)),"new","old")
ID1 | ID2 | Result
------------------
 1  |  1  | Old
 2  |  5  | New
 3  |  6  | New

Problem: convert the formula to VBA. I don't know how to write result to Result column.
What I have:
Sub Macro()
    Dim result As Variant
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim table1 As Range
    Dim table2 As Range

    Set wb = ActiveWorkbook
    Set ws = wb.Sheets(1)
    Set table1 = ws.Range("A2:A8") ' ID1 column
    Set table2 = ws.Range("B2:B8") ' ID2 column

    For Each cell In table1
        On Error GoTo ErrorHandler
            result = Application.WorksheetFunction.VLookup(cell, table2, 1, False)

        If IsNumeric(result) Then
            result = "old"
        End If

        MsgBox result
    Next cell

ErrorHandler:
    If Err.Number = 1004 Then
        result = "new"
    End If
    Resume Next
End Sub

A: Use IsError on application.match or application.vlookup, not application.worksheetfunction.vlookup.
dim result as variant
For Each cell In table1
    result = "old"
    If IsError(Application.match(cell, table2, 0)) then
        result = "new"
    end if
    MsgBox result
    cell.offset(0, 2) = result
Next cell


text:
Q: Trusting an IIS self-issued certificate So I'm using a self-signed certificate on my localhost for HTTPS.
I'm running my Web Api 2 web service on it for testing while I develop a client website that links into the api but the client website can't establish a connection with the api because of trust issues concerning the certificate is self-signed and thus, not to be trusted.
Here's what Firefox says when I browse to the web service:

The client website is developed using MVC. So far I'm using WebClient to query data from the web service.
The code I'm currently working on to access the web server is a simple login. The MVC site sends the login data to the web service which uses it to select a record from the database. It sends the record back to the MVC site if it gets one.
Here's the code:
    private bool DoLogin(string EmailAddress, string Password)
    {
        WebClient client = new WebClient();
        NameValueCollection credentials = new NameValueCollection
        {
            { "EmailAddress", EmailAddress },
            { "Password", Password }
        };
        client.QueryString = credentials;
        string result = client.DownloadString(new Uri("https://localhost/mywebservice/api/User/"));

        // just return true so we can debug to see values
        return true;
    }

Currently I'm only getting a non-descript WebException that just says "Internal Server Error" (Status Code 503).
Its my understanding now that I need to use a certificate that isn't self-signed, but I can't create one in IIS. I'm trying to create a domain certificate but I'm confused about the Certification Authority and from what I understand, this isn't going to help me get my web app to accept the certificate anyway.
Anyway, as an alternative, I'm looking at this MSDN blog and I've done all those things to get it right (see screenshot below) but it doesn't seem to have helped anything as I still get the untrusted connection screen in my browser.
I'm pretty much at a loss what I should do now...


text:
Q: Display message if there are no applications available I want to display a message that says "No Notifications Available".  I want this to be displayed if no apps are contained on the page.  So if the page is black then the message should be displayed.  I currently have the message set up in the HTML, but it just isn't displaying properly.
Controller
$scope.dismissNotifications = function(app, ev) {
  var confirm = $mdDialog.confirm()
    .title('Confirm Dismiss All')
    .content('Are you sure you want to dismiss notifications?')
    .ariaLabel('Confirm Dismiss All')
    .ok('Confirm')
    .cancel('Cancel')
    .targetEvent(ev);

  $mdDialog.show(confirm).then(function() {
    var notifications = app.notifications;
    for (var id in notifications) {
      Service.dismissNotification(notifications[id].id).then(function(notificationId) {
        return function (response) {
          delete app.notifications[notificationId];
        }
      });
    }
  }, function() {
    return false;
  });
};

$scope.init = function () {
  Service.getUserAppsByEmail(SecService.secState.username).then(function (response) {
    var apps = response.applications;
    $scope.appList['alerts'] = {
      name: 'Alerts',
      notifications: {}
    } ;
    for(var i = 0; i < apps.length; i++) {
      $scope.appList[apps[i].appId] = {
        name: apps[i].name,
        icon: apps[i].icon,
        notifications: {}
      }
    }

HTML
<md-content flex="100">

No Notifications Available

 0">

        <md-icon style="width: 36px; height: 36px; color: #FFFFFF;" md-svg-icon="images/icons/error.svg" ng-hide="app.icon"></md-icon>

{{app.name}}

        <md-icon class="rotate-clockwise-45 no-outline" style="color: #FFFFFF; cursor: pointer;" md-svg-icon="images/icons/add_circle.svg" ng-click="dismissNotifications(app, $event)"></md-icon>

{{notification.message}} -

        <md-icon style="color: #FFFFFF; cursor: pointer;" class="no-outline" md-svg-icon="images/icons/close.svg" ng-click="dismissNotification(notification)"></md-icon>

</md-content>

A: This will fix what I was trying to accomplish.  Adding a filter is the easiest fix in this case.
Add this in the HTML

No Notifications or Alerts Available

Add this filter in the Controller
angular.module('notifications').filter('NotificationsExistFilter', function () {
return function (apps) {
if (!apps) {
  return false;
}

var retVal = false;
angular.forEach(apps, function (app, index) {
  if (!retVal) {
    angular.forEach(app.notifications, function (value, index) {
      if (!retVal) {
        retVal = true;
      }
    })
  }
});

return retVal;
};

A: you can use a ng-hide tag into your script to push a div to run.
Here's an example with
*
http://jsfiddle.net/mrajcok/k4u5z/
In
Nothing here!
  the boolean hide true/false is set by the number of items in the list.  in your case, if you add this
 in your html (or another div or whatever you want), and set ng-hide="appList.length", you will get the result you want.

A: //In your html outside of ng-repeat

No Notifications or Alerts Available

//in your controller(place if statement inside of your init function)
$scope.appListEmpty = false;
if(appList.length < 1){
$scope.appListEmpty = true;

}


text:
Q: NAT routing based on DNS name (reverse TCP proxy?) Introduction
I have one router, running pfSense (can be anything since it's a virtual machine on VMware, so if the solution requires anything else, that's fine by me) and behind it I have multiple virtual machines (NAT).
What I'd like to accomplish
I'd like to use a proxy of some sort to use multiple services with 1 IP, preferably based on DNS. For example; running a mail server (and website for webaccess) on mail.domain.com and running a website on www.domain.com and running a FTP server on ftp.domain.com, but all are a different virtual machine.
So basically:
Hostname          Internal NAT IP     Port

www.domain.com    192.168.1.10        80
mail.domain.com   192.168.1.11        25
mail.domain.com   192.168.1.11        80
mail.domain.com   192.168.1.11        443
ftp.domain.com    192.168.1.12        21

So I thought of using HAProxy, but HAProxy only allows this for HTTP traffic and not for "regular" TCP traffic (based on DNS name). I'd like to have all ports (both TCP and UDP, but if TCP is only possible then it's fine aswell) to be redirected to the respective virtual machine.

A: Doing any kind of proxying based on the DNS hostname used also requires that the application protocol carries the host header in some way.
To my knowledge there are no such headers involved in FTP, so I don't see how this will be possible. Maybe with a custom FTP proxy, that sends you to different servers based on the username or something like that.
TLDR: I don't think your end goal is possible. You need more than one external IP address.


text:
Q: Is there any way to work around `PATH_MAX` in macOS for long paths in a git repo? In macOS, paths cannot be longer than 1024 bytes:
command cc -dM -E -xc - <<< '#include <sys/syslimits.h>' | grep -i ' [NP]A.._MAX'

#define NAME_MAX 255
#define PATH_MAX 1024

What can I do to clone a git repo that has paths longer than this limit?

A: You can clone such a repository, but you won't be able to check it out on macOS.  PATH_MAX, if defined, specifies the maximum length of a path that the operating system supports.  It may be the case that APFS does not itself have a maximum path length, but macOS does.  If, somehow, you could mount this file system on Linux, you'd be able to take advantage of its longer PATH_MAX.
You can use a Linux VM to work with this repository, or you can operate on a bare repository using Git plumbing commands or libgit2 to avoid needing to check it on your system, if that's an option on your use case.


text:
Q: What is the practice for handling Vuex action outcomes I'm creating a login system using Vue and Vuex following this guide
https://scotch.io/tutorials/handling-authentication-in-vue-using-vuex#toc-setup-components
This have the login action return a promise, which I was told does not follow the Flux Pattern which Vuex is based on.
So I've changed it up a bit and done the following:
// This is the action from my "auth store"
login: ({commit}, userData) => {
  commit('auth_request')
  Api.post('login', userData)
  .then(res => {
    const token = res.data.data.token
    localStorage.setItem('token', token)
    Api.defaults.headers.common['Authorization'] = "Bearer " + token
    commit('auth_success', token)
  })
  .catch(err => {
    commit('auth_error')
    console.log("Failed to login, check your username or password")
  })
}

This is all fine and dandy, but when I press my login button in my application I see all the commits come through, auth_request, auth_success and the store gets filled with user data from that auth_success.
But since I now does not return a promise, how can I now ask the router to change the view? I have no "feedback" on when the system is done loading? What is the best practice for acknowledging a successful or failed login?

A: The idea that it's an anti-pattern to return from a Promise is something that was a React driven ideology to push the idea of Flux. The piece of the puzzle that you would be missing is the dispatcher to listen to when an action finally calls it.
You would listen to it like an event listener, something like`:
this.$flux.on('login', (data) => {
  //login was called here
})

And you would dispatch it something like:
this.$flux.emit('login', data)

The idea is that you're not wholly reliant on a single piece of architecture which may in fact have side-effects, or, alternatively, may actually represent changes all over your system.
The down side to this is that you're adding another layer of data management to your application. You can completely forego this in smaller app's and just use async/await with try/cache and return a Promise.resolve/reject. However, maybe you want to learn the Flux pattern. It's super simple in Vue.
Make a new File called bus.js. Inside of this file, we'll actually just create a new Vue instance and export it:
import Vue from 'vue'

const Bus = new Vue({})

export default Bus

Now we can go ahead and import that, say in our login page:
import Bus from 'bus'

And in our mounted function, we can add a listener:
Bus.$on('login.success', this.loginHappened)

And in our methods in that Login component, we can define loginHappened.
loginHappened (data) {
  console.log(data)
}

Now we just dispatch it from our Action:
// store

import Bus from 'bus'

login: async ({ commit }, userData) => {
  try {
    const res = await Api.post('login', userData)

    const token = res.data.data.token
    localStorage.setItem('token', token)
    Api.defaults.headers.common['Authorization'] = "Bearer " + token
    commit('auth_success', token)

    Bus.$emit('login.sucesss', res.data.data)
  } catch (err) {
    Bus.$emit('login.failure', err.response.data)
  }
}

Oh, you'll also want to watch that failure:
Bus.$on('login.failure', this.loginFailed)

And now in that same Login component, or anywhere really, you can define that method:
loginFailed (error) {
  console.log(error) // the server side data from axios.
}

Now we have a system where actions are completely asynchronous and decoupled, and we rely on event dispatching and listeners in order to react to asynchronous actions.
Of course all of this is completely overkill for a 3 page SPA.


text:
Q: Java String.contains vs String.contentEquals What is the real difference between these two methods?
Both have the same signature and return true if the string contains the CharSequence given as a parameter and false if it doesn't.
Methods:
boolean contains(CharSequence string)

boolean contentEquals(CharSequence string)

A: With contentEquals() the parameter has to be exactly equals to the string; with contains() instead is sufficient that the parameter is inside the string, the string can cointain also other characters.
String foo = "foo";
StringBuffer str = new StringBuffer("foofoo");
StringBuffer str2 = new StringBuffer("foo");
foo.contains(str); // false
str.contains(foo); // true
foo.contentEquals(str) // false
foo.contentEquals(str2) // true


text:
Q: Flair avatar wrong size I was about to link to my flair, when I noticed my avatar doesn't quite fit...

This looks like a bug with the new upload-your-own feature; you are not using a Gravatar image, and that's where this is going wrong

Screencap:

Flair as seen by others here on Meta (no image at all):

A: This will be status-completed... probably, with the next build.
We couldn't quite reproduce this, but we narrowed it down to a possibly buggy line of code.  Having fixed that up, this is most likely fixed.  We'll know in a day or so (after the next build) when flair starts getting re-rendered as it falls out of cache.


text:
Q: Installing cloudera Hadoop without internet connection Actually I am trying to install cloudera hadoop cluster with few VMs with CentOS but this  project is under secure environment where I can't use internet.I tried with various tutorial but each and every tutorial needed internet connection at some point of time. Few things I have downloaded instead of wget command.But still I couldn't make it.
Can any once share with me how can I do that either using cloudera Manager or manually (without need of any internet connection)??

A: You can do that by selecting the path B Manual installation of cloudera specified here which provide you the option of downloading the parcels online or specifying them from local repository.
OR
You can install the packages individually by using the path C for installation which is explained here on cloudera documentation.


text:
Q: Embed html into javascript file This is the script for closing and opening the moda. It is called when I trigger the event on click. And I want to have some html in order to render that on the screen.

I want to include a pice of html and css into a js file.
I am not sure exactly how to do it.

        ×

Some random text....

A: Use jQuery and get the html by selecting it through using and ID selector:

var html_content = $('#share-post')[0];
console.log(html_content);

        ×

Some random text....

you can use the variable html_content which contains the HTML. You can use this variable within your modal.


text:
Q: Cells are showing up Empty I've been struggling with this for about an hour now and don't understand why my cells aren't showing up in my tableview.I followed a tutorial and did exactly what he mentioned to do, but still having issues. I have set the reuse identifier to main, my delegate and dataSource are both set to self. I'm not getting any errors in the console and my data is coming through from my server. I printed out the title, description, etc. and it was all there. Help
#import "HTTPService.h"
#import "ViewController.h"
#import "VideoCell.h"
#import "Video.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic,strong) NSArray *videoList;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.tableView.dataSource = self;
    self.tableView.delegate = self;

    self.videoList = [[NSArray alloc]init];

    [[HTTPService instance]getTutorials:^(NSArray * _Nullable
dataArray, NSString * _Nullable errMessage)
     {
         if(dataArray){
             NSMutableArray *arr = [[NSMutableArray alloc]init];

             for (NSDictionary *d in dataArray){
                 Video *vid = [[Video alloc]init];
                 vid.videoTitle = [d objectForKey:@"title"];
                 vid.videoDescription = [d objectForKey:@"description"];
                 vid.thumbnailURL = [d objectForKey:@"thumbnail"];
                 vid.videoIFrame = [d objectForKey:@"iframe"];

                 [arr addObject:vid];
             }

             self.videoList = arr;
             [self updateTableData];

         }
        else if(errMessage)
            NSLog(@"Alert to user: %@",errMessage);
    }];

}

-(void) updateTableData{
    dispatch_async(dispatch_get_main_queue(), ^{
        [self.tableView reloadData];
    });
}

- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView
cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {

    VideoCell *vCell = (VideoCell*)[tableView
dequeueReusableCellWithIdentifier:@"main"];

    if(!vCell)
        vCell = [[VideoCell alloc]init];
    NSLog(@"here heree");
    return vCell;
}

- (NSInteger)tableView:(nonnull UITableView *)tableView
numberOfRowsInSection:(NSInteger)section {
    NSLog(@"hererrrr");
    return self.videoList.count;
}

-(void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:
(nonnull NSIndexPath *)indexPath{

}

-(void)tableView:(UITableView*)tableView willDisplayCell:(nonnull
UITableViewCell *)cell forRowAtIndexPath:(nonnull NSIndexPath
*)indexPath{
    NSLog(@"Im in this bitch");
    Video *vid = [self.videoList objectAtIndex:indexPath.row];
    VideoCell *vidCell = (VideoCell*)cell;
    [vidCell updateUI:vid];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

@end

Let me know if you need to see any of the import files!

A: Your code is fine, except for one thing. You forgot to register your cell to your tableView. Just put
[self.tableView registerNib:[UINib nibWithNibName:@"VideoCell" bundle:nil] forCellReuseIdentifier:@"main"];

in your viewDidLoad and everything will be fine.
It is a common mistake that we all do.