text:
Q: jQuery doesn't change Css of tags or maybe can't find the tags I have the code below which I use clone() and delegate().
The code is being load in a jQuery UI dialog with a link.
the problem is Ajax being triggered properly, and it calls to success methods as it supposed but none of Ok or noOk divs are being shown, I mean the alerts trigger but the css of divs don't change, Where do you think my problem is? is there something wrong with selectors? thanks
    <input id="TaskId" name="TaskId" type="hidden" value="18" />

                <select id="Tasksess">
                    <option value="">لطفاً کار را انتخاب کنيد</option>
                    <optgroup label="کار های جديد">
                            <option value="16"style="">q3fe</option>
                            <option value="18"style="">fjhv j</option>
                            <option value="19"style="">wref</option>
                            <option value="25"style="">ff</option>
                    </optgroup>
                    <optgroup label="کار های در دست اقدام">
                            <option value="13"style="">rr</option>
                            <option value="15"style="">yy</option>
                    </optgroup>
                    <optgroup label="کار های تمام شده">
                            <option value="14"style="">tt</option>
                            <option value="18"style="">fjhv j</option>
                    </optgroup>
                </select>

                <select id="Statusess" name="Statusess">
                    <option value="">لطفاً وابستگی را انتخاب کنيد</option>
                    <option value="1">پيشنياز</option>
                    <option value="2">همنياز</option>
                </select>

                ok

                تکراری

A: I cannot say for sure this is the issue, but it is certainly something you should correct. If I understand your code correctly, you are cloning the #toClone div. However, within that div are numerous children with id's, including your #Ok and #noOk. Id's are supposed to be unique to a page, so once you clone, you no longer have unique items. Therefore, you should change them all to classes:

*

*id="toClone" to class="toClone"

*id="Tasksess" to class="Tasksess"

*id="Statusess" to class="Statusess"

*id="Ok" to class="Ok"

*id="noOk" to class="noOk"

*id="loadingGif" to class="loadingGif"
(I do question, however, if you actually want Ok, noOk, and loadingGif to be children of the toClone div, or if you just want them to be unique children of the MainDiv. Your code seems so. If the latter, then you need to change your closing
 tag for your toClone div to not be wrapping the unique Ok, noOk, and loadingGif elements. In such a case, you could leave the id's for those unique children.)
Once changed, you will need to change the rest of your code to select for classes, not ids; but also for the specific classes that are children of the new clone. Changing to classes may resolve your issue, because the multiple id items created by the clone could be making it so your jquery is not finding the items.

A: I believe your main problem is in your selectors, yes. You can add extra alerts to spit out values at each reference to see where it goes wrong.
I got irritated with that method so I made some changes to your setup and (aside from the ajax piece that I can't test without having your AskTaskDependancy file) got it working I believe as you expected.
First off, the jsFiddle
Note: I changed all the text to english. This has no bearing on your code, I'm just illiterate in not-english, so feel free to change it back as it has no effect on the code.
The change log

*

*Added error alert()s if a select's value is empty

*$(this).find(":selected").val() to simply $(this).val()

*several of the reference names to camelCase

*all IDs inside the MainDiv to classes

*moved class name from the select elements to the div holding each

*.parent.prev() to .parent.children(".tasksess") (and similar reference scheme for other elements)

*set a var for easy reference to each div/select

*changed css() to attr() (for hiding/showing ok/notOk)

*I built the ajax url on separate lines for easier reading.

*Moved the clone() outside of the ajax request to verify that it works (feel free to move it back as needed - be aware the loadingGif which remains shown in each copy if you don't hide it first)

*commented out the ajax request for testing

The new HTML
<input id="TaskId" name="TaskId" type="hidden" value="18" />

            <select name="tasksess">
                <option value="">Select a Task</option>
                <optgroup label="Group 1">
                        <option value="16"style="">q3fe</option>
                        <option value="18"style="">fjhv j</option>
                        <option value="19"style="">wref</option>
                        <option value="25"style="">ff</option>
                </optgroup>
                <optgroup label="Group 2">
                        <option value="13"style="">rr</option>
                        <option value="15"style="">yy</option>
                </optgroup>
                <optgroup label="Group 3">
                        <option value="14"style="">tt</option>
                        <option value="18"style="">fjhv j</option>
                </optgroup>
            </select>

            <select name="statusess">
                <option value="">Select a Status</option>
                <option value="1">opt8</option>
                <option value="2">opt9</option>
            </select>

            Everything looks good!

            Something went wrong!

            Loading...

The new jQuery/JavaScript
$(document).ready(function () {

    var Maindiv = $("#MainDiv");
    var toClone = $(".toClone");

    $("#MainDiv").delegate('.statusess', 'change', function () {
        var thisSel = $(this).children("select");
        var prevSel = $(this).parent().children(".tasksess").children("select");
        var divOk = $(this).parent().children(".ok");
        var divNotOk = $(this).parent().children(".notOk");
        var divLoad = $(this).parent().children(".loadingGif");

        if (thisSel.val() != "") {
            console.log("status changed to val " + thisSel.val());
            if (prevSel.val() != "") {
                console.log("task is val "+prevSel.val());

                divLoad.attr("style", "display: inline;");
                var url = '/ProjectAdmin/Project/AddTaskDependency';
                url += '?MainTaskId=' + $("#TaskId").val();
                url += '&DependentTaskId=' + prevSel.val();
                url += '&Status=' + thisSel.val();
                console.log("URL= "+url);
                /*
                $.ajax({
                    url: url, type: 'GET',
                    success: function (data, status) {
                        if (data != "0") {
                            divOk.attr("style","display:inline;");
                            divNotOk.attr("style","display:none;");
                        }
                        else if (data == "0") {
                            divOk.attr("style","display:none;");
                            divNotOk.attr("style","display:inline;");
                        }
                    }
                });
                */
                divLoad.attr("style", "display: none;");
                var div = $('div:eq(0)', Maindiv).clone();
                Maindiv.append(div);

            } else { alert("Select 1 val is empty"); }
        } else { alert("Select 2 val is empty"); }
    });

});

A: The following line is incorrect:
$$("#MainDiv").delegate('#Statusess', 'change', function () {

Change $$("#MainDiv") to $("#MainDiv").


text:
Q: Arc Length in 3D space So given a function $$f(x,y)=x^3+30xy+2y^3,$$ I am able to find the maximum value in a specific region. However, I need to be able to calculate the distance that would be traversed by a particle moving between the origin and the maximum, as if it were hypothetically climbing and descending the function.
Basically I need to find the arc length of the function, along the path between the origin and the maximum point. How would I go about doing this?
Any help would be appreciated

A: If you're not interested in any particular path on the surface joining $(0,0,f(0,0))$ to the point on the surface where $f$ achieves its maximum value, then let's just consider a straight line in the plane that joins $(0,0)$ to $(a,b)$, where I'm assuming that it's at $(a,b)$ where $f$ achieves its maximum value.  Here's our line, parametrically: $c(t):=(at,bt)$ for $0\leq t\leq 1$.  Then $$\tilde{c}(t):=(at,bt, (at)^{3}+30abt^{2}+2(bt)^{3})$$ is a path on the graph of $f$ that joins $(0,0,f(0,0))$ to the highest point on the graph.  Find the length of this curve by computing the following, using standard calculus $1$ methods (you may or may not need trig substitution; I haven't worked it out that far): $$\int_{0}^{1}||\tilde{c}'(t)||dt=\int_{0}^{1}\sqrt{a^{2}+b^{2}+[3(at)^{2}+60abt+6(bt)^{2}]^{2}}dt$$

redpajama_set_name: RedPajamaStackExchange


text:
Q: Bulk Raster combining in MapInfo? I am running mapinfo 15.2 (64bit). I have downloaded multiple Landsat 8 scenes with multispectral data. I can combine the bands of a single scene into a single mrr file using the Raster combine function.
Is there any way to process all scenes at once?

A: You can automate this task using the Raster SDK that also comes with MapInfo Pro Advanced.
Have a look in the folder Raster\Documentation\API in the MapInfo Pro installation folder. Here you will find the help system for the Raster SDK and also a number of samples.
I wrote a very basic article some time back for The MapInfo Pro Journal on how to get started with the MapInfo Raster SDK.


text:
Q: How to find a research question and relevant materials I am a PhD student working in Spectral Graph Theory.
Can anyone please help me solve the following questions:

*

*How to find a research question?I contacted my advisor,he says he does not know how to find one as he has not read anything about the subject.Asked me to look at recent papers.

*Where should I look for research materials?
I read books on Spectral Graph Theory and solved questions at the back on my own but how to find research materials?

My advisor is involved in administrative matters and he does not seem interested at my research at all.Recently I found he is applying to other Universities for higher pay also.
Can someone please suggest something ?
Is there any website which gives research questions?Where do people find research questions?


text:
Q: Android WebView content display issue I have text loaded into WebView
String html = "
1
\n" +
                "
2
\n" +
                "
3
\n" +
                "
4
\n" +
                "
5
\n" +
                "
6
\n" +
                "
7
\n" +
                "
8
\n" +
                "
9
\n" +
                "
10
\n" +
                "
11
\n" +
                "
12
\n" +
                "
13
\n" +
                "
14
\n" +
                "
15
\n" +
                "
16
\n" +
                "
17
\n"+
                "
18
\n";
        questionTextView.loadDataWithBaseURL("file:///android_asset/", html, "text/html", "UTF-8", null);

when I have 17 paragraphs the everything is displayed ok but when I add 18 and more all text disapears and I just see scroll line.
This is WebView setting
if (Build.VERSION.SDK_INT >= 11) {
        questionTextView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
  final WebSettings webSettings = questionTextView.getSettings();
        //float fontSize = getResources().getDimension(R.dimen.practice_text_size);
        //webSettings.setDefaultFontSize((int) fontSize);
        webSettings.setDefaultTextEncodingName("utf-8");
        webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        webSettings.setBlockNetworkImage(true);
        webSettings.setGeolocationEnabled(false);
        webSettings.setNeedInitialFocus(false);

WebView xml

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1">

    <ImageView
        android:id="@+id/question_flag"
        android:layout_width="24dip"
        android:layout_height="24dip"
        android:layout_gravity="top|left"
        android:layout_marginLeft="4dp"
        android:layout_marginTop="4dp"
        android:scaleType="centerInside" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true">

        <LinearLayout
            android:id="@+id/question_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:orientation="vertical">

            <de.phase6.vtrainer.custom.FlowLayout
                android:id="@+id/question_images"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dip"
                android:layout_marginRight="10dip"
                android:orientation="horizontal"
                android:visibility="gone" />

            <WebView
                android:id="@+id/question_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:paddingLeft="8dp"
                android:paddingRight="8dp" />

            <LinearLayout
                android:id="@+id/question_sounds_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="8dp"
                android:gravity="center"
                android:orientation="horizontal"
                android:visibility="gone" />

        </LinearLayout>
    </ScrollView>

    <ImageButton
        android:id="@+id/btn_undo"
        style="@style/BorderlessButton"
        android:layout_width="48dip"
        android:layout_height="48dip"
        android:layout_gravity="bottom|start"
        android:longClickable="true"
        android:src="@drawable/back"
        android:visibility="invisible" />

    <ImageButton
        android:id="@+id/btn_send_back"
        style="@style/BorderlessButton"
        android:layout_width="48dip"
        android:layout_height="48dip"
        android:layout_gravity="bottom|end"
        android:longClickable="true"
        android:src="@drawable/send_back" />

</FrameLayout>

<View style="@style/DividerHorizontal" />

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom">

    <LinearLayout
        android:id="@+id/input_answer_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/light_grey_ddd"
        android:padding="@dimen/practice_input_padding"
        android:orientation="vertical"
        android:visibility="visible">

        <TextView
            android:id="@+id/user_answer_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/your_answer"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textAllCaps="true"
            android:textColor="@color/grey" />

        <EditText
            android:id="@+id/input_answer"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@color/transparent"
            android:focusableInTouchMode="true"
            android:focusable="true"
            android:ems="10"
            android:imeOptions="actionDone"
            android:singleLine="true"
            android:inputType="textNoSuggestions" />
    </LinearLayout>

    <Button
        android:id="@+id/btn_see_answer"
        style="@style/BorderlessButton"
        android:layout_width="match_parent"
        android:layout_height="48dip"
        android:textAllCaps="true"
        android:text="@string/show_answer" />

</FrameLayout>

A: After investigation I discovered that this issue is reproducing when you put your WebView into ScrollView and set
if (Build.VERSION.SDK_INT >= 11) {
        webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

And amount of the information on the screen is approximately two screens or more then WebView become blank.
To fix this do not set LayerType or set webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);


text:
Q: how to install amazon jdk on centos 7? I am trying to install the rpm package java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm on centos 7 OS.
I have downloaded the rpm java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm from https://docs.aws.amazon.com/corretto/latest/corretto-8-ug/downloads-list.html
When trying to install using the command
rpm -ivh java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm
I get the following error:
warning: java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID c87f5b1a: NOKEY
error: Failed dependencies:
    java-1.8.0-amazon-corretto(x86-64) = 1:1.8.0_192.b12-1.amzn2 is needed by java-1.8.0-amazon-corretto-devel-1:1.8.0_192.b12-1.amzn2.x86_64
    libX11.so.6()(64bit) is needed by java-1.8.0-amazon-corretto-devel-1:1.8.0_192.b12-1.amzn2.x86_64
    libawt.so()(64bit) is needed by java-1.8.0-amazon-corretto-devel-1:1.8.0_192.b12-1.amzn2.x86_64
    libawt_xawt.so()(64bit) is needed by java-1.8.0-amazon-corretto-devel-1:1.8.0_192.b12-1.amzn2.x86_64
    libawt_xawt.so(SUNWprivate_1.1)(64bit) is needed by java-1.8.0-amazon-corretto-devel-1:1.8.0_192.b12-1.amzn2.x86_64
    libjava.so()(64bit) is needed by java-1.8.0-amazon-corretto-devel-1:1.8.0_192.b12-1.amzn2.x86_64
    libjvm.so()(64bit) is needed by java-1.8.0-amazon-corretto-devel-1:1.8.0_192.b12-1.amzn2.x86_64

Any idea how to download the rpm's that are required by  java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm ? I tried with yumdownloader but it didn't work.
yumdownloader --destdir=. --resolve java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm
Loaded plugins: fastestmirror, ovl
Determining fastest mirrors
 * base: ftp.heanet.ie
 * extras: ftp.heanet.ie
 * updates: ftp.heanet.ie
No Match for argument java-1.8.0-amazon-corretto-devel-1.8.0_192.b12-1.amzn2.x86_64.rpm
Nothing to download

Thank you

A: There are two packages, one providing the JDK and one providing the JRE. If you want the JDK, you'll also need to install the JRE.

*

*Download both RPMs from Amazon Corretto's downloads page.

*Install both simultaneously using yum localinstall:
sudo yum localinstall -y java-1.8.0-amazon-corretto*.rpm


text:
Q: Combination of tests and custom build directory I'm running into an issue with autotools.
I need both the support for tests and custom build directory (other then the main source directory). Autotools seems to complain:
src/lib/Libattr/test/attr_atomic/Makefile.am:18: error: using '$(top_srcdir)' in TESTS is currently broken: '$(top_srcdir)/src/test/coverage_run.sh'
Apparently the same thing is true for $(srcdir). The unit test needs to have manually set includes and source paths as it requires headers and files from different locations in the source tree.
How do I refer to the root of the source tree if I can't use $(srcdir) and $(top_srcdir)?

A: I suspect the problem is that your autotooled test harness plays by the
rules of the Older (and discouraged) serial test harness
and that the solution is to play by the rules of the newer and correspondly
encouraged Parallel Test Harness
In the latter, as you'll gather from the example code at the link, you don't mention $(top_srcdir) et al in TESTS. You
mention them in AM_TESTS_ENVIRONMENT:
Here's an illustrative Makefile.am fragment to hand that works fine for me:
...
CORE_TESTS = coan_case_tester.py coan_bulk_tester.py coan_spin_tester.py \
coan_symbol_rewind_tester.py coan_softlink_tester.py
if MAKE_CHECK_TIMING
TESTS = $(CORE_TESTS) coan_test_metrics.py
else
TESTS = $(CORE_TESTS)
endif

AM_TESTS_ENVIRONMENT = COAN_PKGDIR=$(top_srcdir); \
    COAN_BUILDDIR=$(top_builddir); TIMING_METRICS=$(TIMING_METRICS_ENABLED); \
    rm -f coan.test_timer.time.txt; \
    export COAN_PKGDIR; export COAN_BUILDDIR; export TIMING_METRICS;
LOG_COMPILER = python


text:
Q: How to get FutureBuilder return value to variable? How to get X value from FutureBuilder?
final url = FutureBuilder<List<Url>>(
    future: getUrlFromCache(),
    builder: (context,snapshot){var x = snapshot.data[1].uniform_resource_locator;},
    );

A: I think using 'x' will cause 'x' always will be equal to 'null'. It is possible to return it dynamically this way:
return ListTile(

            title: FutureBuilder(
              future: pair,
              builder: (context, snapshot) {
                if (snapshot.hasData) {
                  return Text( snapshot.data.title);
                } else {
                  return Text( 'Loading...');
                }
              },
            ),

          );

FutureBuilder always returns Widget type. Put your functionality inside the FutureBuilder.
In my case it returns Text widget. It is assigned to 'title:' and dynamically displayed on the screen as a ListTile.
Just replace the Text widget with the required widget that will use the data.

A: check this out : FutureBuilder
you can initilaize a global variable then assign a value inside the FutureBuilder but I dont know it's a good aproach doing this inside FutureBuilder.
// instead of creating dynamic types try to create static types.
var x;

FutureBuilder<String>(
  future: _calculation, // a previously-obtained Future<String> or null
  builder: (context, snapshot) {
    switch (snapshot.connectionState) {
      case ConnectionState.none:
        return Text('Press button to start.');
      case ConnectionState.active:
      case ConnectionState.waiting:
        return Text('Awaiting result...');
      case ConnectionState.done:
        if (snapshot.hasError)
          return Text('Error: ${snapshot.error}');
        x = snapshot.data[1].uniform_resource_locator;
        return Text('Result: ${snapshot.data}');
    }
    return null; // unreachable
  },
)


text:
Q: celery how to terminate and start again task I want to use celery to do something like this:
1. I send message to start task, task is starting
2. If in task some condition is true then task should be terminated (canceled) and "returned" back to messages queue that other worker can take and do it.
and now I don't know how to terminate task from worker function. I was trying to do something like that in this called function:
if condition == true:
    revoke(current_task.request.id, terminate=True)

and in app when message is send I was trying to connect signal 'task_revoke' in that way:
@task_revoked.connect
def do_something_when_revoke(terminated, signum, expired):
    do_something_here...

but it is not working for me good. So maybe You can help me with that and tell me what I'm doing wrong or maybe what is different way to do something like that :)
Thanks in advance

A: Possibly an easier way to achieve this would be to implement that logic inside the task itself:

*

*You don't have to revoke the Task, just don't do anything in it

*Your Task can just submit a new, updated, Task to the Queue


text:
Q: How to make logger.trace() and logger.info() work together I have an issue logging TRACE function in distinct file from INFO function, i prepared a classic log4j.xml file containing all the required configuration.
logger.info() is working.
logger.trace() is not working.
         <appender name="file" class="org.apache.log4j.FileAppender">
            <param name="append" value="true" />
            <param name="file" value="C:/logs/transaction.log" />
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
            </layout>
            <filter class="org.apache.log4j.varia.LevelRangeFilter">
                <param name="LevelMin" value="TRACE" />
                <param name="LevelMax" value="TRACE" />
                <param name="AcceptOnMatch" value="true" />
            </filter>
        </appender>

        <appender name="fileINFO" class="org.apache.log4j.FileAppender">
            <param name="append" value="true" />
            <param name="file" value="C:/logs/server.log" />
            <layout class="org.apache.log4j.PatternLayout">
                <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
            </layout>
            <filter class="org.apache.log4j.varia.LevelRangeFilter">
                <param name="LevelMin" value="INFO" />
                <param name="LevelMax" value="INFO" />
                <param name="AcceptOnMatch" value="true" />
            </filter>
        </appender>

        <logger name="ma.prg.net">
            <level value="trace" />
            <appender-ref ref="file" />
        </logger>

        <logger name="ma.prg.net">
            <level value="info" />
            <appender-ref ref="fileINFO" />
        </logger>

logger.trace() was working fine before i added fileINFO appender.
Thanks in advance.

A: You cannot configure the same logger twice. Just change your logger configuration to:
<logger name="ma.prg.net">
  <level value="trace" />
  <appender-ref ref="file" />
  <appender-ref ref="fileINFO" />
</logger>

With this you send the logging message to both appenders. But as you already configured each appender individually with LevelMin and LevelMax, each filters out the messages it should print.


text:
Q: Forgot Username and Password on Linux Mint I have Linux Mint 17.3 on VM Virtual Box. Unfortunately, I forgot my username and password. Can someone tell me the steps on how to reset my username and password?

A: You could boot it into single user mode (if you don't know how to do it, just Google it) then enter this command:
mount -uw /

(In some cases, this command varies from system to system, so you may have to try some other command to make the filesystem writeable.)
Then type passwd then type what you want 'the root password' to be (just make sure it's a very secure password!) Then 'the root user' will be enabled, then log into 'root' then you'll have admin privileges and you can then reset your password, but while logged in as root, be careful, because while you're root, you have infinite privilege on the computer and you could easily accidentally delete an important system file without it even asking 'are you sure'.

A: On Arch Linux, you could boot a live image of the OS, arch-chroot and then run passwd.
Maybe you could do something similar on Linux Mint.

A: Reboot your guest OS and press F12 or ESC key to load boot menu
Step 1. Select Recovery Menu
Step 2. In Recovery Menu select below option

Step 3. You are now logged in as root, change any user credentials using passwd command


text:
Q: Error when I put the Form elements from React Native Elements I'm making a LoginScreen but when I try to put the Form elements, that launch me an error.
Here's the code:
import React, { Fragment, Component } from 'react';
import { StyleSheet, Image, StatusBar, View, Text } from 'react-native';
import { FormLabel, FormInput, FormValidationMessage } from 'react-native-elements'
import normalize from '../components/Utils';

class LoginScreen extends Component{
    render(){
        return(
            <Fragment>
                <StatusBar backgroundColor="#14246C" barStyle="light-content" style={{ flexDirection: 'column' }} />
                <Image source={require('../img/background-login.jpg')} style={styles.backgroundImage}/>

                <View style={styles.loginForm}>
                    <Text style={styles.loginTitle}>Inicio de sesión</Text>

                    <FormLabel>Usuario</FormLabel>
                    <FormInput onChangeText="Tu nombre de usuario"/>
                    <FormValidationMessage>Error message</FormValidationMessage>
                </View>
            </Fragment>
        );
    }
}

The error:
Invariant violation: Element type is invalid: expected a string  (for built-in components) or a class/function (for composite components) but got undefined. You likely forgot to export your component from the file it's defined in, or you might mixed up default and named imports.

A: Issue is not with the "react-native-elements" but you need to export the component either for named or default.
export default class <className> extends Component{
 render(){
   return(
     <your component>
   )
 }
}


text:
Q: How to list all users As part of an exercise I am trying to list all users email from my database on one page. So far the closest i've got is
$user = mage::getModel('customer/customer')->getCollection()->getData();
returns
array
0 =>
array
  'entity_id' => string '1' (length=1)
  'entity_type_id' => string '1' (length=1)
  'attribute_set_id' => string '0' (length=1)
  'website_id' => string '1' (length=1)
  'email' => string 'john.doe@example.com' (length=20)
  'group_id' => string '1' (length=1)
  'increment_id' => string '000000001' (length=9)
  'store_id' => string '1' (length=1)
  'created_at' => string '2007-08-30 23:23:13' (length=19)
  'updated_at' => string '2008-08-08 12:28:24' (length=19)
  'is_active' => string '1' (length=1)
  'disable_auto_group_change' => string '0' (length=1)
1 =>
array
  'entity_id' => string '2' (length=1)
  'entity_type_id' => string '1' (length=1)
  'attribute_set_id' => string '0' (length=1)
  'website_id' => string '1' (length=1)
  'email' => string 'tony09uk@gmail.com' (length=18)
  'group_id' => string '1' (length=1)
  'increment_id' => null
  'store_id' => string '1' (length=1)
  'created_at' => string '2013-07-19 14:31:00' (length=19)
  'updated_at' => string '2013-07-19 14:31:00' (length=19)
  'is_active' => string '1' (length=1)
  'disable_auto_group_change' => string '0' (length=1)

but I only want their emails to be listed I have tried the magic getters and setters but noluck (or at least not the way ive used them). I have also tried
    $user = mage::getModel('customer/customer')->getCollection()->load();

and
    $user = mage::getModel('customer/customer')->getCollection()
                                               ->addAttributeToSort('email', 'ASC');

and
$user = mage::getModel('customer/customer')->getCollection()->getEmail()->getData();

and
$user = mage::getModel('customer/customer')->getCollection()->getData();
echo $user->getEmail();

as well as several other variations, now I have got to the point that i am just randomly sticking commands in in the the hope they work, which I do not like doing.
How do I display the email for all my users? (I hope i'm not to far off the mark)

A: You're actually almost there but it's important to know whats happening.
If you using the getCollection method you're actually building a query. Go ahead and try the following
$collection = mage::getModel('customer/customer')->getCollection();
var_dump((string)$collection->getSelect());

which will return you to following

SELECT e.* FROM customer_entity AS e WHERE (e.entity_type_id
  = '1')

This is the default query for a customer collection. As you might notice without specifying fields to retrieve it retrieves everything. So lets add some fields!
$collection = mage::getModel('customer/customer')->getCollection()
   ->addAttributeToSelect('email')
   ->addAttributeToFilter('firstname', 'sander')
   ->addAttributeToSort('email', 'ASC');
var_dump((string)$collection->getSelect());

This will print the following query

SELECT e.*, at_firstname.value AS firstname FROM
  customer_entity AS e INNER JOIN customer_entity_varchar AS
  at_firstname ON (at_firstname.entity_id = e.entity_id) AND
  (at_firstname.attribute_id = '5') WHERE (e.entity_type_id =
  '1') AND (at_firstname.value = 'sander') ORDER BY e.email ASC

As you can see Magento builds to correct query for you depending on the attributes you add to filter, select, order or whatever you want to do. Check out the Magento Collection wiki page for more on collections because there are a LOT of options you can use.
In your case you just need to specify the addAttributeToSelect so it only retrieves that field. On non EAV collections use addFieldToSelect.
$users = mage::getModel('customer/customer')->getCollection()
           ->addAttributeToSelect('email');

foreach ($users as $user)
   var_dump($user->getData());


text:
Q: CASE WHEN case in BigQuery comparing value in the same field I need your help in BigQuery. I'm trying to do CASE WHEN using several conditional within the same field. Here's the data:

In this case I wanna have one aggregated output that says TRUE when 'Resurrected' movement_type happens AFTER 'Churned' movement_type based on its month_key (regardless of the gap in between them).
So, from that data I want the output to be:
+----------+-----------+
| group_id | condition |
+----------+-----------+
| A12345   | TRUE      |
+----------+-----------+

I've tried using LEAD but had no luck finding the right answer. Thank you.

A:
wanna have one aggregated output that says TRUE when 'Resurrected' movement_type happens AFTER 'Churned' movement_type based on its month_key

Just use aggregation:
select group_id,
       (max(case when movement_type = 'Resurrected' then month_key end) >
        max(case when movement_type = 'Churned' then month_key end)
       ) as flag
from t
group by group_id;

A: Consider below approach
select group_id, logical_or(flag) as condition
from (
  select group_id,
    countif(movement_type = 'Churned') over prev_rows > 0
    and movement_type = 'Resurrected' as flag
  from `project.dataset.table`
  window prev_rows as (partition by group_id order by month_key)
)
group by group_id


text:
Q: Is a user automatically part of a group of the same name? Consider this situation.
A user called _example is created without assigning him to any group.
A new group is manually added to /etc/group called _example without any users.
Is the _example user automatically part of _example group now or does he still need to be explicitly added to the group?

A: No. Unless the user's group is set to _example (in the password file) or the user is explicitly added to the _example group in /etc/group, the user is not a member of that group.

A: Users must be explicitly added to any group. It is common convention to have a group for named the same as each user. The operable theory is that other users may be added to a particular user's group in an adhoc fashion allowing the user to control which files are exposed to that group.


text:
Q: SQL Database synchronization We are develping an application using PHP and Symfony framework. Ideally the system would run on a remote server, so that it can be available online anywhere. However, there has to be offline availability too.
For this, the system will be running both on a remote server and a local server. By default clients would access the local server, and only working online when outside of the facility.
So we need to implement database synchronization for changes made both on the local and remote database without any kind of client interaction. If possible, it should be a daemon running in the background, synchronizing databases. The master database would be the local one, so it will take priority upon any conflict.
We haven't decide on the DB system to use (we are using Doctrine so any supported DB will do), so we are really looking at the one with the most ready or available solution for our scenario.
The solution can be a dedicated application, commercial or not, as long as it requires no client interaction.

A: I use MySQL's synchronization, it was a snap to set up and has performed flawlessly. In conjunction with phpMyAdmin, which gives you a UI to use, you can literally set this up out-of-the-box in about 6 clicks of the mouse.
http://dev.mysql.com/doc/refman/5.0/en/replication.html
http://www.phpmyadmin.net/home_page/index.php

A: It really depends on your application.
The most robust system would probably be a master master environment with object oriented databases like CouchDB.
There are some that feature great support out of the box, but you can also do it application side which is probably more flexible.
The approach described in this answer however works only well if you can boil down your modifications to document entities.
The procedure kind of goes as follows:

*

*Every document recieves a last_modification timestamp.

*The client stores a timestamp when it was last synchronized with the server.

*Deleted documents dont get deleted right away but recieve a deleted_at timestamp

*When the conneciton gets interrupted the client can continue modify local documents

*When connection is established again every modification on the server and client that occoured after the last synchronization timestamp is fetched.

*Documents get updated in both directions. Conflict resolution on documents that got modified on both sides is done based on the lsat_modification timestmap

*Keep in mind that there may be small offsets in time on server and client, so you cannot 100% rely on it. Synchronization is needed. Also you would loose modifications made by the side that modified first. This however should be a problem that you can deal with in your application (like cvs system conflicts)

*Also document mergin and/or field based modifications timestamps could be an option
As already said it really depends on your application and much more on your data.
Your problem is one that also occours in CVS systems in software developement (SVN revisions and stuff!)
Imagine the always does a svn checkin and then a svn update. Maby this is possible for your appliaction if you store your data in XML files or something similar?
SVN is a bit oldschool and has some disadvantages and is not so reliable so for this case it would be not suitable, but GIT could be very capable of doing the job.
SQL (Mysql etc) based master master replication systems are very powerful too however also quite hard to maintain and not so easy to set up.
I hope this answer is useful because I am not really sure about your use case, but if you put it a bit more detailed I may be able to help you further.


text:
Q: How to solve this equation involving natural log I have $2$ related questions:

*

*I know value of $\ln(x) / \ln(y)$, say it is $v$,  how can I find value of $x/y$?

*If $\ln(x) = v_1$ and $\ln(y) = v_2$ , what is $x/y$ ?
Thanks for your help. Apologies if these are very basic questions.

A: $\frac{\ln x}{\ln y}=v$ implies $\ln x=v \ln y= \ln y^v,$ hence $x=y^v, $ thus $x/y= y^{v-1}.$

A: Note  $ln(x) =v_1\implies x= e^{v_1}$ similarly $y= e^{v_2}$
Thus $x\over y$ $ = \frac{e^{v_1}}{e^{v_2}}=e^{{v_1}-{v_2}}$

A: *

*You can't. Note that $\dfrac{\log(3^2)}{\log(3)}=\dfrac{\log(2^2)}{\log(2)}=2$, but $\dfrac{3^2}3\ne\dfrac{2^2}2$.

*$\dfrac xy=\dfrac{e^{v_1}}{e^{v_2}}$


text:
Q: HTML5 Game code with Canvas I want to create a tile based 'whack a mole' game in HTML 5. Also at every instance a new mole appears at a given tile an audio prompt needs to given indicating where the mole is(this is so that visually impaired individuals can also play it ). Additionally on hover over each tile its location needs to be said aloud (eg.(3,4)). Now the problem is I am not sure how do I start programming this in HTML5. Please can someone help me.

A: you may want to try panda.js it is a html5 game engine for mobile and desktop
and it has video tutorial
the showcase itself had whack a mole like game
http://www.pandajs.net/showcase/
(full disclosure: I've used pandajs myself)

A: Start with the basics in javascript. You'll need this to do anything in HTML5 canvas:
http://www.w3schools.com/js/default.asp
Then proceed learning about HTML5 canvas:
http://www.html5canvastutorials.com/tutorials/html5-canvas-tutorials-introduction/


text:
Q: How to parse xml file which is in directory? can you please tell me how to parse xml file in java .
Hi Have an xml file I want to print all author and title of every elemet .
I done like that but not got any success .
<?xml version="1.0"?>
<catalog>
   <book id="bk101">
      <author>Gambardella, Matthew</author>
      <title>XML Developer's Guide</title>
      <genre>Computer</genre>
      <price>44.95</price>
      <publish_date>2000-10-01</publish_date>
      <description>An in-depth look at creating applications
      with XML.</description>
   </book>
   <book id="bk102">
      <author>Ralls, Kim</author>
      <title>Midnight Rain</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2000-12-16</publish_date>
      <description>A former architect battles corporate zombies,
      an evil sorceress, and her own childhood to become queen
      of the world.</description>
   </book>
   <book id="bk103">
      <author>Corets, Eva</author>
      <title>Maeve Ascendant</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2000-11-17</publish_date>
      <description>After the collapse of a nanotechnology
      society in England, the young survivors lay the
      foundation for a new society.</description>
   </book>
   <book id="bk104">
      <author>Corets, Eva</author>
      <title>Oberon's Legacy</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2001-03-10</publish_date>
      <description>In post-apocalypse England, the mysterious
      agent known only as Oberon helps to create a new life
      for the inhabitants of London. Sequel to Maeve
      Ascendant.</description>
   </book>
   <book id="bk105">
      <author>Corets, Eva</author>
      <title>The Sundered Grail</title>
      <genre>Fantasy</genre>
      <price>5.95</price>
      <publish_date>2001-09-10</publish_date>
      <description>The two daughters of Maeve, half-sisters,
      battle one another for control of England. Sequel to
      Oberon's Legacy.</description>
   </book>
   <book id="bk106">
      <author>Randall, Cynthia</author>
      <title>Lover Birds</title>
      <genre>Romance</genre>
      <price>4.95</price>
      <publish_date>2000-09-02</publish_date>
      <description>When Carla meets Paul at an ornithology
      conference, tempers fly as feathers get ruffled.</description>
   </book>
   <book id="bk107">
      <author>Thurman, Paula</author>
      <title>Splish Splash</title>
      <genre>Romance</genre>
      <price>4.95</price>
      <publish_date>2000-11-02</publish_date>
      <description>A deep sea diver finds true love twenty
      thousand leagues beneath the sea.</description>
   </book>
   <book id="bk108">
      <author>Knorr, Stefan</author>
      <title>Creepy Crawlies</title>
      <genre>Horror</genre>
      <price>4.95</price>
      <publish_date>2000-12-06</publish_date>
      <description>An anthology of horror stories about roaches,
      centipedes, scorpions  and other insects.</description>
   </book>

</catalog>

I do like this ..
private class Connection extends Thread {
    private String element;
    public Connection() {
        super();
    }
    public void run() {
        StreamConnection conn;
        String str=null;
        try {
            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
                    .newInstance();
            DocumentBuilder docBuilder = docBuilderFactory
                    .newDocumentBuilder();
            docBuilder.isValidating();
            InputStream inputStream = getClass().getResourceAsStream("/a.xml");

            Document document = docBuilder.parse(inputStream);
            document.getDocumentElement().normalize();

            NodeList list = document.getElementsByTagName("catalog");
            element = new String();
            // this "for" loop is used to parse through the
            // XML document and extract all elements and their
            // value, so they can be displayed on the device
            for (int i = 0; i < list.getLength(); i++) {
                Node value = list.item(i).getChildNodes().item(0);
                element = value.getNodeValue();
                synchronized (UiApplication.getEventLock()) {

                    add(new RichTextField("Title : " + element));
                 add(new SeparatorField());
                }
            }// end for
                                      //      screen.add(new RichTextField(str));
        }// end try
            // will catch any exception thrown by the XML parser
        catch (Exception e) {
           add(new RichTextField("Error : " + e.toString()));
        }
    }// end connection function
}// end connection class

connection = new Connection();
connection.start();//

A: Have a look at my code here
I have done this job last year, let me know for any other issues. You can specify your path to file in url="cust.xml" portion . It is done in Jsp but better if you do this all in  Action class(In case of using Struts) or in Servlet program.
For a better way to do this refer this link

A: XPath is probably the most straightforward here. Give this a go...
Test.java

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathConstants;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

public class Test {

  public static void main(String[] args) throws Exception {

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse("file:///C:/path/to/books.xml");
    XPathFactory xPathfactory = XPathFactory.newInstance();
    XPath xpath = xPathfactory.newXPath();
    XPathExpression expr = xpath.compile("//book/author|//book/title");
    NodeList nl = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
    for (int i = 0; i < nl.getLength(); i++) {
        Node currentNode = nl.item(i);
        if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
            System.out.println(currentNode.getTextContent());
        }
    }

  }

}

javac -classpath jaxp-api-1.4.jar Test.java
java Test

Gambardella, Matthew
XML Developer's Guide
Ralls, Kim
Midnight Rain
Corets, Eva
Maeve Ascendant
Corets, Eva
Oberon's Legacy
Corets, Eva
The Sundered Grail
Randall, Cynthia
Lover Birds
Thurman, Paula
Splish Splash
Knorr, Stefan
Creepy Crawlies

A: It seems that your problem is that you are selecting catalog instead of book as NodeList. This way your list will have only one element instead of 8. Try maybe with this code (I print output to console but you can use it whatever you like)
NodeList list = document.getElementsByTagName("book");
for (int i = 0; i < list.getLength(); i++) {
    NodeList childs = list.item(i).getChildNodes();

    //iterate over all child nodes like author/title/description
    for (int j = 0; j < childs.getLength(); j++) {
        Node child = childs.item(j);
        //if node is the one we are looking for print it
        if (child.getNodeName().equals("author"))
            System.out.println("author : "+child.getTextContent());
        if (child.getNodeName().equals("title"))
            System.out.println("title : "+child.getTextContent());
    }
    System.out.println("------------");//
}// end for

Another approach would be using some other parsers. I like Jsoup which is mainly used to parse HTML but it also have XML parser. its code could look like this
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Parser;

...

    InputStream xml = new FileInputStream("input.txt");
    Document doc = Jsoup.parse(xml, "utf-8", "", Parser.xmlParser());
    for (Element e : doc.select("book author, book title")) {
        System.out.println(e.nodeName() + ": " + e.text());
    }

A: You are getting a handle to the catalog node. The following line in your code gets first child from the list of all child nodes under catalog node. It will point to the first book node.
Node value = list.item(i).getChildNodes().item(0);

The value of this node is blank as this is not a text node. You need to get a handle to the title node and then print its value. You can do that by getting a list of all book nodes and then get to the title node. Note that the index for title node is 2 as index 0 will be the attribute node for book element.
NodeList list = document.getElementsByTagName("book");
        element = new String();
        // this "for" loop is used to parse through the
        // XML document and extract all elements and their
        // value, so they can be displayed on the device
        for (int i = 0; i < list.getLength(); i++) {
            Element thisNode = (Element)list.item(i);
            Node value = (Node)(list.item(i).getChildNodes().item(2));
            System.out.println(value.getTextContent() +"-");

        }// end for

I do not recommend that you use this approach. Better way is to use XPath as previously answered or you can use JAXB, in case you are updating the data and regenerating XML.


text:
Q: SharePoint 2010 - 404 Not Found After a migration from 2007, and navigating to the default.aspx page I am getting a 404 Not Found error.
I am unable to determine where this is coming from.  I have looked in the event viewer as well as the ULS logs but cannot isolate the cause of this problem.
Any ideas on how to locate this problem?
thx

A: Dave - I see your other question also. Maybe this will address both of them. By default, SharePoint 2010 makes a page named Home.aspx the home page.  It is in a page library called "SitePages" which is kind of like a wiki library. You can pretty easily make any page in that library the home page. Since you did a database attach upgrade, though, I'm not sure this is what is happening to you.
When you did your upgrade, did you also do the visual upgrade to update your site to the new user interface?
Did you follow all the steps listed here?

A: It could be a missing/unavailable page layout or masterpage, which was linked in SP2007, but not in SP2010 anymroe. If one of those isn't available, you'll probably see the 404 message.


text:
Q: How to get the src element where the src element contains text "viewPdf"? Below is the part of the inspect element output...

....
.....

There are many src elments in the entire html.
How to get this particular src element where it contains the text "viewPdf" ?
Basically i would like to extract the id associated in the above link.
Not sure what should be the xpath in the below
IWebElement element = driver.findElement(By.xpath("....."));

string path = element.GetAttribute("src");

Thanks.

A: List<WebElement> elements = driver.findElements(By.xpath("//*[contains(@src,'viewPdf')]");

This Xpath will give you all elements whose src attribute contains viewPdf


text:
Q: JSON work with PHP like a array I got the following code is there anyway to work with that like an array?
$var =
"{"uid":"cb463625fc9dde2d82207e15bde1b674513094011b2976.06073807","name":"marius"}{"uid":"2393d7a6a3258894acc34581978453fa513094011b2ab8.28630478","name":"buenyamin"}";

to print it out like
echo $var[0].uid."
";
echo $var[1].uid;

A: Try this :
$array = json_decode($var,true);

echo "
";
print_r($array);

NOTE : the second parameter true in json_decode is needed to get the out put as array, else the output will be object
ref: http://php.net/manual/en/function.json-decode.php

A: Use json_decode to decode a string into a PHP array.
$var =
"{"uid":"cb463625fc9dde2d82207e15bde1b674513094011b2976.06073807","name":"marius"}{"uid":"2393d7a6a3258894acc34581978453fa513094011b2ab8.28630478","name":"buenyamin"}";
echo '
' . print_r(json_code($var, true)) . '
';


text:
Q: Extracting part of an src using split jquery I;m trying to exract part of an src with jquery:

I want to extract the youtube id '4PzoS6ZgDsw':
This is how far I've got:
$youtubeVid =

var youtubeVid = '<?php echo $youtubeVid; ?>';
var urlsplit = youtubeVid.split("/");
var youtubeID = urlsplit[4];

This returns: 4PzoS6ZgDsw?HD=1;rel=0" frameborder="0" allowfullscreen><
Any help muchly appreciated

A: Try this:
var urlsplit = youtubeVid.split("?")[0];
var youtubeID = urlsplit.split('/')[4]

A: var urlsplit = youtubeVid.split("/");
var youtubeID = urlsplit[4];
var tmp = urlsplit[4].split("?");

-> tmp[0]..


text:
Q: php mysql move selected tag In my Database I have this column called className which contains a piece of text that should decide it's color.
It's names like this bgm-orange, bgm-red, bgm-teal etc.

What I want is to move the "selected" tag to what information it gets from the className column to the specific productid in the database.
productid 1 is might bgm-orange so it moves the selected tag to bgm-orange.
productid 2 is might bgm-orange so it moves the selected tag to bgm-red etc.
Hope there is someone that can help me with this

A: I think u want something like this:

       <span data-tag="bgm-teal" class="bgm-teal <?php if($product['className']=='bgm-teal'){echo "selected"; }?>">
       <span data-tag="bgm-orange" class="bgm-orange <?php if($product['className']=='bgm-orange'){echo "selected"; }?>">
       <span data-tag="bgm-red" class="bgm-red <?php if($product['className']=='bgm-red'){echo "selected"; }?>">


text:
Q: Click an element within section tag The Element is inside  tag but many ways tried couldn't click on it.
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@value='Login to Register']"))).click();

and
WebElement element = driver.findElement(By.xpath("//input[@value='Login to Register']"));
JavascriptExecutor jsEx= (JavascriptExecutor)driver;
jsEx.executeScript("arguments[0].click();", element);

Here is the html:

        <input class="btn btn-primary" style="width: 100% !important;" type="button" value="Login to Register"></input>

A: Can you give a try with the below code.
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.elementToBeClickable(By.id("requestLocationLogin"))).click();

A: I suppose you are facing this issue on chrome.
Try this, it works for me.
element.sendKeys(Keys.RETURN);

Its just hitting the "Enter" button on the element.

A: To click() on the element with text as Login to Register as the element is AJAX enabled element you have to induce WebDriverWait for the elementToBeClickable() and you can use either of the following Locator Strategies:

*

*cssSelector:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("a.use-ajax.login-popup-form#requestLocationLogin>input.btn.btn-primary[value='Login to Register']"))).click();

*xpath:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//a[@class='use-ajax login-popup-form' and @id='requestLocationLogin']/input[@class='btn btn-primary' and @value='Login to Register']"))).click();


text:
Q: Mobilefirst - Get push notification payload when application is closed When i receive a push notification when the application is closed and i click on it, only the application open and nothing happen,
it only show me popup when application is open or reduced
What to do ?
thanks

A: This appears to be a defect in the product - you need to open an IBM PMR (support ticket) in order for the development team to investigate and possibly provide a fix.

A: I had the same issue with Worklight 6.2, using Unicast Push Notifications.
I think the problem is that the Push Notification Listener gets initialized after the payload is actually processed.
The workaround I found is to force a (even fake) notification subscription after the application connects to the Worklight Server (which means on the success of WL.Client.connect or on the response of the first adapter call).
 WL.Client.Push.subscribe("myPush", {
        onSuccess : doSubscribeSuccess,
        onFailure : doSubscribeFailure
 });

Note that this will not work if you are using EventSource based notifications, but only Broadcast, Unicast and Tag. I think you can make it work also with EventSource, but it would be a bit more complicated as you will have to also handle the registration to the event.


text:
Q: Is momentum conserved in a traversable wormhole? Wikipedia says:

A wormhole (Einstein-Rosen bridge) is a hypothetical structure connecting disparate points in spacetime, and is based on a special solution of the Einstein field equations.

If a traversable wormhole existed, could its ends move relatively to each other in space? What would be the momentum of the energy-matter escaping from one end, in relation to the momentum of the energy-matter entering the other end?
Imagine there is a traversable wormhole, with two ends, A and B, each in a separate galaxy A* and B* where these ends do not move relative to its galaxy but the galaxies A* and B* are moving (through space) away from each other with speed v=1000 m/s. When I enter the end A with speed v=1 m/s, will I emerge from end B moving relatively to galaxy B* with speed v=1000 m/s or with speed v=1 m/s?
Can the same question be asked about white hole/black hole pair?

A: General relativity with one test particle (i.e you) can be described by an action principle. The action only depends on the metric and your position, so it's translationally invariant. Hence by Noether's theorem, it has four symmetries, corresponding to translation in space and time. The conserved quantities associated with space translation can be reasonably associated with the total momentum of you and the gravitational field. So yes, for an appropriate definition of momentum, any scenario in GR such as a wormhole will conserve momentum.


text:
Q: TypeError: 'int' object is not subscriptable in my line of code i am trying to make a bubble sorting mechanism, but when ium tryinbg to make the part where i want to swap two characters inside of the variable i get the error, and thats why i need help
number = '562374'
for x in range(0,7,1):
    y = x+1
    if(number[x] > number[y]) :
        number = int(number)
        number[x], number[y]= number[y],number[x]
        number = str(number)
    print(number)

i expect the outcome to be 526374 / 623674 / 623647
but i get the error saying TypeError: 'int' object is not subscriptable in line 6

A: You can't use subscripts with numbers. You also can't assign to subscripts of strings, because Python strings are immutable.
What you need to do is convert the string to a list at the beginning. Then you can swap the list elements and join them back at the end.
number = '562374'
digits = list(number)
for x in range(len(digits)-1):
    y = x+1
    if(digits[x] > digits[y]) :
        digits[x], digits[y] = digits[y], digits[x]
        number = "".join(digits)
    print(number)


text:
Q: How to insert Data into sql server database I'm trying to insert data into my SQL Server 2014 database, but I get an error

Incorrect syntax near ')'.

My table matches the types of data I put in, for example, I'm put an int into a int.
Here is my code:
string ip = Request.UserHostAddress;
string name = "Jesus said: Love your Enemies (V.S.)";

int blueq = Convert.ToInt32(TextBox1.Text);
int redq = Convert.ToInt32(TextBox2.Text);
int whiteq = Convert.ToInt32(TextBox3.Text);
int blackq = Convert.ToInt32(TextBox4.Text);
int whiteqr = Convert.ToInt32(TextBox9.Text);
int redqr = Convert.ToInt32(TextBox10.Text);
int sn = 600;
int price = total_jslye;

string size;

if (RadioButton1.Checked == false)
{
    size = "11x35";
}
else
    size = "18x50";

try
{
    string conn = System.Configuration.ConfigurationManager.ConnectionStrings["SQLCS"].ConnectionString;
    var cmd = "INSERT INTO cartsigns (@SignNumber, @redquantity, @bluequantity, @whitequantity, @blackquantity, @whitereflectivequantity, @redreflectivequantity, @size, @SignName, @ipaddress, @price)";

    using (SqlConnection com = new SqlConnection(conn))
    {
        using (SqlCommand cmds = new SqlCommand(cmd, com))
        {
            cmds.Parameters.AddWithValue("@SignNumber", sn);
            cmds.Parameters.AddWithValue("@redquantity", redq);
            cmds.Parameters.AddWithValue("@bluequantity", blueq);
            cmds.Parameters.AddWithValue("@whitequantity", whiteq);
            cmds.Parameters.AddWithValue("@blackquantity", blackq);
            cmds.Parameters.AddWithValue("@whitereflectivequantity", whiteqr);
            cmds.Parameters.AddWithValue("@redreflectivequantity", redqr);
            cmds.Parameters.AddWithValue("@size", size);
            cmds.Parameters.AddWithValue("@SignName", name);
            cmds.Parameters.AddWithValue("@ipaddress", ip);
            cmds.Parameters.AddWithValue("@price", price);

            com.Open();
            cmds.ExecuteNonQuery();
        }
    }
}

So please help, thanks

A: Your insert syntax is not correct. you have not given column names also keyword "Values" is missing in your query

A: Your parameter names can not have brackets or spaces in them in SQL Server.  So rename them all to @SignNumber, @redquantity, @bluequantity... etc.

A: Try this code. you will get your desired result. The issue that you were getting in your code is because parameters are not supposed to have any spaces or brackets or any characters that makes the parameter names not well formed. A parameter name must begin with "@" character, and should follow the rules for object identifiers. Check the link for further details.
    string ip = Request.UserHostAddress;
    string name = "first sign";
    int blueq = Convert.ToInt32(TextBox1.Text);
    int redq = Convert.ToInt32(TextBox2.Text);
    int whiteq = Convert.ToInt32(TextBox3.Text);
    int blackq = Convert.ToInt32(TextBox4.Text);
    int whiteqr = Convert.ToInt32(TextBox9.Text);
    int redqr = Convert.ToInt32(TextBox10.Text);
    int sn = 600;
    int price = total_jslye;

    string size;
    if (RadioButton1.Checked == false)
    {
        size = "11x35";
    }
    else
        size = "18x50";

        try
        {
            string conn = System.Configuration.ConfigurationManager.ConnectionStrings["SQLCS"].ConnectionString;

            var cmd = "INSERT INTO cartsigns ([Sign Number],[red quantity],[blue quantity],[white quantity],[black quantity],[white reflective quantity],[red reflective quantity],[size],[Sign Name],[ipaddress],[price]) values (@[Sign_Number],@[red_quantity],@[blue_quantity], @[white_quantity],@[black_quantity],@[white_reflective_quantity],@[red_reflective_quantity],@[size],@[Sign_Name],@[ipaddress],@[price])";

            using (SqlConnection com = new SqlConnection(conn))
            {
                using (SqlCommand cmds = new SqlCommand(cmd, com))
                {
                    cmds.Parameters.AddWithValue("@[Sign_Number]", sn);
                    cmds.Parameters.AddWithValue("@[red_quantity]", redq);
                    cmds.Parameters.AddWithValue("@[blue_quantity]", blueq);
                    cmds.Parameters.AddWithValue("@[white_quantity]", whiteq);
                    cmds.Parameters.AddWithValue("@[black_quantity]", blackq);
                    cmds.Parameters.AddWithValue("@[white_reflective_quantity]", whiteqr);
                    cmds.Parameters.AddWithValue("@[red_reflective_quantity]", redqr);
                    cmds.Parameters.AddWithValue("@[size]", size);
                    cmds.Parameters.AddWithValue("@[Sign_Name]", name);
                    cmds.Parameters.AddWithValue("@[ipaddress]", ip);
                    cmds.Parameters.AddWithValue("@[price]", price);

                    com.Open();
                    cmds.ExecuteNonQuery();

                }
            }
        }
        catch
        {
            throw;
        }


text:
Q: How to fix 500 Internal Server Error in rails I have been developing app using Ruby on Rails. I put the csv download button so when I click this button, then csv file will download as I want. For this, I defined 3 models. First model name is unit.rb, second is prisoner.rb and third is volunteer.rb. And I made an association for 3 models.
In the unit.rb, belongs_to :course belongs_to :prisoner belongs_to :volunteer, and in the prisoner.rb, has_many :units, inverse_of: :prisoner, dependent: :destroy has_many :volunteers, through: :units , and in the volunteer.rb, has_many :units, inverse_of: :volunteer has_many :prisoners, through: :units.
But when I click the download button, I'm facing 500 internal error
def self.to_csv
attributes = %w{course sub_course prisoner volunteer mailing_date return_date reader_mailing_date reader_return_date created_at}

CSV.generate(headers: true) do |csv|
  csv << attributes

  all.each do |unit|
    csv << attributes.map do |attr|
      if attr == 'course'
        unit.course.try(:title)
      elsif attr == 'sub_course'
        unit.sub_course
      elsif attr == 'prisoner'
        unit.prisoner.name
      elsif attr == 'volunteer'
        unit.volunteer.name
      elsif attr == 'mailing_date'
        unit.mailing_date
      elsif attr == 'return_date'
        unit.return_date
      elsif attr == 'reader_mailing_date'
        unit.reader_mailing_date
      elsif attr == 'reader_return_date'
        unit.reader_return_date
      else
        unit.created_at
      end
    end
  end
end

end
Please help me if anyone knows this problem. Thanks.

A: I kept seeing '500 Internal Server Error' when testing stripe webhooks with ngrok, the problem seems to be that I had
status 200
# Gives: 500 Internal Server Error

but what I needed was
head 200
# Gives: 200 OK


text:
Q: Compare two lists of custom objects by an int property I'm attempting to find the differences between two objects in two different lists by an int property. How can I do this most efficiently?
I have a class named Item.
public class Item
{
    public string ItemNumber;
    public string OptionNumber;
    public int Count;
}

I have two lists of Items - expected and actual.
List<Item> expected = new List<Item>();
List<Item> actual = new List<Item>();

If the item number and option exists in the actual and expected list, return actual count minus expected count.
If the item number and option exists in the actual count and not expected list, return the actual count.
If the item number and option exists in the expected list only, return the negative value of the expected count.
Example expected and actual values.
expected.Add(new Item() { ItemNumber = "123456", OptionNumber = "123", Count = 1 });
expected.Add(new Item() { ItemNumber = "123456", OptionNumber = "126", Count = 2 });
expected.Add(new Item() { ItemNumber = "112233", OptionNumber = "111", Count = 1 });
expected.Add(new Item() { ItemNumber = "112244", OptionNumber = "222", Count = 4 });

actual.Add(new Item() { ItemNumber = "123456", OptionNumber = "123", Count = 1 });
actual.Add(new Item() { ItemNumber = "123456", OptionNumber = "126", Count = 2 });
actual.Add(new Item() { ItemNumber = "998877", OptionNumber = "111", Count = 1 });
actual.Add(new Item() { ItemNumber = "112244", OptionNumber = "222", Count = 0 });

From the above example, I'm trying to get the following output:
List<Item> output = new List<Item>();

output.Add(new Item() { ItemNumber = "123456", OptionNumber = "123", Count = 0 });
output.Add(new Item() { ItemNumber = "123456", OptionNumber = "126", Count = 0 });
output.Add(new Item() { ItemNumber = "112233", OptionNumber = "111", Count = -1 });
output.Add(new Item() { ItemNumber = "998877", OptionNumber = "111", Count = 1 });
output.Add(new Item() { ItemNumber = "112244", OptionNumber = "222", Count = -4 });

A: Try this:
List<Item> output = expected
    .Select(x => new Item()
    {
        ItemNumber = x.ItemNumber,
        OptionNumber = x.OptionNumber,
        Count = (x.Count - (actual.FirstOrDefault(y => y.ItemNumber == x.ItemNumber
        && y.OptionNumber == x.OptionNumber)?.Count ?? 0)) * -1
    })
    .Concat(actual
        .Where(x => !expected.Any(y => y.ItemNumber == x.ItemNumber && y.OptionNumber == x.OptionNumber)))
        .Select(x => new Item()
        {
            ItemNumber = x.ItemNumber,
            OptionNumber = x.OptionNumber,
            Count = x.Count
        })
    .ToList();

It subtracts the actual number from the expected and create new Item objects with the Count property set to the difference.


text:
Q: How can we show that if $f$ is convex, then $\liminf_{|x|\to\infty}\frac{x\cdot\nabla f(x)}{|x|}>0$? Let $d\in\mathbb N$ and $f:\mathbb R^d\to\mathbb R$ be convex with $$\int e^{-f(x)}\:{\rm d}x<\infty\tag1.$$ How can we show that $$\liminf_{|x|\to\infty}\frac{x\cdot\nabla f(x)}{|x|}>0?$$ $f$ should only be differentiable outside a countable set. Why this is not an issue?

A: $\newcommand{\R}{\mathbb{R}}
\newcommand{\ep}{\varepsilon}
$
For any $x\in\R^d$, let us understand $\nabla f(x)$ as any one of the subgradients of the convex function $f$ at point $x$ (so, we will not have to worry about differentiability of $f$).
To obtain a contradiction, suppose that the desired conclusion does not hold. Then for some sequence $(x_n)$ in $\R^d$ such that $t_n:=|x_n|\to\infty$ and for some $\ell\in[-\infty,0]$ we have
\begin{equation}
u_n\cdot\nabla f(x_n)\to\ell \tag{1}
\end{equation}
where $u_n:=x_n/t_n$. By the compactness of the unit sphere $S^{d-1}$ in $\R^d$, without loss of generality (wlog) $u_n\to u$ for some $u\in S^{d-1}$.
For any $w\in\R^d$, consider the convex function $g_w\colon\R\to\R$ defined by the condition that $g_w(t)=f(tw)$ for all real $t$. Let $g'_w$ denote the left derivative of $g_w$. Then $g'_{u_n}(t_n)\le u_n\cdot\nabla f(x_n)$. So, in view of (1), wlog $g'_{u_n}(t_n)\to m$ for some $m\in[-\infty,\ell]\subseteq[-\infty,0]$.
So, for any $t\in[0,\infty)$ and any real $\ep>0$ there is some natural $n_{t,\ep}$ such that for all natural $n\ge n_{t,\ep}$ we have $t_n\ge t$ and $g'_{u_n}(t_n)\le\ep$, so that (by the convexity of $g_{u_n}$) $g'_{u_n}\le\ep$ on $[0,t_n]$ and hence on $[0,t]$, which yields $g_{u_n}(t)\le g_{u_n}(0)+\ep t$, that is, $f(tu_n)\le f(0)+\ep t$. Since $f$ is convex and real-valued, it is continuous. Therefore, $f(tu)\le f(0)+\ep t$, for all $t\in[0,\infty)$ and all real $\ep>0$. Thus, $f(tu)\le f(0)$ for all $t\in[0,\infty)$; that is, $f\le f(0)$ on $R_u:=\{tu\colon t\in[0,\infty)\}$.
Also, by the mentioned continuity of $f$, for some real $b$ we have $f\le b$ on $B:=\{x\in\R^d\colon|x|\le1\}$. So, $f\le \max[f(0),b]=b<\infty$ on the convex hull (say $C$) of $R_u\cup B$. The Lebesgue measure $|C|$ of $C$ is $\infty$. So,
\begin{equation}
 \int e^{-f}\ge\int_C e^{-f}\ge|C|e^{-b}=\infty,
\end{equation}
which contradicts the first display in the OP. $\Box$
Notes added in response to a comment by the OP:

*

*The OP commented: "I'm not familiar with the concept of a subgradient. From Wikipedia, $\nabla f(x)$ is actually a set." Response: $\nabla f(x)$ was the notation you used, incorrectly. To make sense of such usage, I suggested: "let us understand $\nabla f(x)$ as any one of the subgradients".

*The OP commented: "And we clearly need that each $\nabla f(x)$ is nonempty." Response: It is a well known fact that, for any real-valued convex function $f$ on $\R^d$ and any $x\in\R^d$, the subdiferential of $f$ at $x$ (which is the set of all subgradients of $f$ at $x$) is nonempty. See e.g. Theorem 23.4 or Proposition 2. Also, any real-valued convex function $f$ on $\R^d$ is continuous (and even locally Lipschitz continuous) -- see e.g. Theorem 10.1 or Theorem 3.3.1.

A: We first show that $\liminf_{|x|\to \infty} \frac{f(x)}{|x|} > 0$. Indeed, denote $ a = \max\{f(0)+1,1\}$, then the set $A =\{x: f(x) < a\}$ is a convex set and
$$|A| = \int_A dx \leq \int_A e^{-f(x) + a}dx \leq e^a \int_{\mathbb R^n} e^{-f} dx < \infty.$$
The function $f$ is continue at $0$ and $f(0) < a$, then there exists $r >0$ such that $f(x) < a$ for all $x\in B_r(0)$ with center at $0$ and radius $r$. For any $x \in A$, $x\not=0$, the convex hull of $x$ and the ball $B_r(0)\cap x^{\perp}$, hence
$$|A| \geq \frac {\omega_{n-1}} n |x| r^{n-1},$$
where $\omega_{n-1}$ is the volume of $n-1$ dimensional unit ball. Therefore $A$ is bounded. Let $R >0$ such that $A \subset B_R(0)$. Hence $B_R(0)^c \subset \{f(x) \geq a\}$. For any $x$ with $|x| > R$, we have $\frac R{|x|} x = \frac R{|x|} x + (1 -\frac R{|x|}) 0$ and by using the convexity,we get
$$a \leq f\left(\frac R{|x|} x\right) \leq \frac R{|x|} f(x) + \left(1-\frac R{|x|} \right) f(0).$$
From this we have
$$\liminf_{|x|\to \infty} \frac{f(x)}{|x|} \geq \frac{a}{R} >0.$$
Again by the convexity, we have $f(0) \geq f(x) + \langle \nabla f(x), 0-x\rangle$ which implies
$$\liminf_{|x|\to \infty} \frac{\langle \nabla f(x),x\rangle}{|x|} \geq \liminf_{|x|\to \infty} \frac{f(x) -f(0)}{|x|} >0.$$


text:
Q: Looking for an CMS that can be plugged into a Spring MVC Application I am looking for a simple CMS that can be pluged in into a Spring MVC Application, in contrast to a CMS where I can plugin a Spring Application.
Let me first explain what I NOT want: I do not want a CMS like Magnolia/Blossom where I can add some Spring Plugins into the CMS.
What I NEED, is the other way around; I need some CMS that is controlled by MY application.  (The CMS is only a very small part of it, not the main part.)
Assume this two use cases:

*

*(Static Pages) I have Spring Web Application, and now need some function where a (Admin)-User can update the "terms and condition" page, modify some content (Text and Image)on the start page... – so almost editing "static" pages.

*(Content for Domainobjects) My Application has some domain objects, and a User needs to add some large description (Text and Images) for this domain objects.  An Example would be: Some kind of a shop system where the shop owner wants to have fancy and individual Description pages for every product.

Does anybody know such a CMS?

A: Walrus CMS is very simple and is based on Spring, Tiles, Hibernate, and Freemarker.  It allows an admin user to edit the website directly in-place.  It's lean on features, but seems exactly what you are seeking.

A: I don't have any direct experience with it (yet), but this SO dicussion from a couple of years ago recommends Riot CMS, which is built on Spring, and appears to be designed to be embedded, rather than used as a stand-alone application.
I spent a couple of minutes with the demo, and it looks pretty good. I'll definitely be checking it out in more detail.


text:
Q: How to hide Google Charts hours from hAxis Im using line chart from Google Charts. I show date on hAxis (horizontal). My major gridlines show date normally. But there are time labels between date labels. And i dont want time labels.

I tried to put that property in hAxis on chart options but nothing changed
minorGridlines:{textPosition: 'none' }
hAxis options;
hAxis: {titleTextStyle: {color: '#0000ff'},
            slantedText:true, slantedTextAngle:60,format: 'd/M/yy',minorGridlines:{textPosition: 'none' },gridlines: {
              count: -1,
              units: {
                days: {format: ['d.MM']},
                hours: {format: ['HH:mm']},
              }
             }
},

is there anyone who knows the solution?

A: first, remove the options for gridlines.
however, this could cause the same date labels to repeat.
to prevent from repeating,
you can provide your own ticks.
the hAxis.ticks option takes an array, in this case, of dates.
to build the ticks array, we can use data table method --> getColumnRange(colIndex)
this will return the min & max values of the column.
then we can to build our ticks array.
// build hAxis ticks
var hAxisTicks = [];
var dateRange = data.getColumnRange(0);
var oneDay = (24 * 60 * 60 * 1000);
for (var i = dateRange.min.getTime(); i <= dateRange.max.getTime(); i = i + oneDay) {
  hAxisTicks.push(new Date(i));
}

see following working snippet...

google.charts.load('current', {
  packages: ['corechart']
}).then(function () {
  var data = new google.visualization.DataTable();
  data.addColumn('date', 'Date');
  data.addColumn('number', 'Y');
  data.addRows([
    [new Date(2019, 0, 1, 0), 10],
    [new Date(2019, 0, 1, 6), 20],
    [new Date(2019, 0, 1, 12), 30],
    [new Date(2019, 0, 1, 18), 40],
    [new Date(2019, 0, 2, 0), 10],
    [new Date(2019, 0, 2, 6), 20],
    [new Date(2019, 0, 2, 12), 30],
    [new Date(2019, 0, 2, 18), 40],
    [new Date(2019, 0, 3, 0), 10],
    [new Date(2019, 0, 3, 6), 20],
    [new Date(2019, 0, 3, 12), 30],
    [new Date(2019, 0, 3, 18), 40],
    [new Date(2019, 0, 4, 0), 10],
    [new Date(2019, 0, 4, 6), 20],
    [new Date(2019, 0, 4, 12), 30],
    [new Date(2019, 0, 4, 18), 40],
  ]);

  // build hAxis ticks
  var hAxisTicks = [];
  var dateRange = data.getColumnRange(0);
  var oneDay = (24 * 60 * 60 * 1000);
  for (var i = dateRange.min.getTime(); i <= dateRange.max.getTime(); i = i + oneDay) {
    hAxisTicks.push(new Date(i));
  }

  var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
  chart.draw(data, {
    hAxis: {
      format: 'd/M/yy',
      ticks: hAxisTicks
    }
  });
});

EDIT
building the ticks manually will cause a performance hit,
but only by a couple milliseconds, which is nothing.
see following working snippet,
540 rows are drawn, the milliseconds it takes to build the ticks are shown in the console...

google.charts.load('current', {
  packages: ['corechart']
}).then(function () {
  var data = new google.visualization.DataTable();
  data.addColumn('date', 'Date');
  data.addColumn('number', 'Y');

  for (var i = (new Date(2019, 0, 1)).getTime(); i <= (new Date(2019, 3, 1)).getTime(); i = i + (4 * 60 * 60 * 1000)) {
    data.addRow([new Date(i), i]);
  }

  // build hAxis ticks
  var test = new Date();
  console.log('rows', data.getNumberOfRows());
  var hAxisTicks = [];
  var dateRange = data.getColumnRange(0);
  var oneDay = (24 * 60 * 60 * 1000);
  for (var i = dateRange.min.getTime(); i <= dateRange.max.getTime(); i = i + oneDay) {
    hAxisTicks.push(new Date(i));
  }
  console.log('milliseconds', ((new Date()).getTime() - test.getTime()));

  var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
  chart.draw(data, {
    hAxis: {
      format: 'd/M/yy',
      ticks: hAxisTicks
    }
  });
});


text:
Q: Where/how does Skype queue group chat messages when users are offline? In this SuperUser.com question and elsewhere, I've read that Skype doesn't store your historical chat messages on their servers in a way that's user-accessible. (Of course, what they do for internal archival and analytical purposes is a different story -- as reflected by their privacy policy).
But the user experience for group chats is: when you've been offline and you sign back into Skype... all the messages you missed appear. Even if it's been a while and there are a lot of messages. (I don't know if there are limits on how long or how many.)
So: how is this UX implemented if the messages don't come from Skype servers?
I've read this offhand description which states:

Syncing of group chats ("More than 2 people in a chat") is done by chat sync partners in those chats, and not provided by Skype servers.

If that's correct, I'd love more details about how this works, like:

*

*Has the protocol been specified or reverse-engineered?

*Is it available through an API?

*Are requests routed through Skype, or is it direcly peer-to-peer?

*If peer-to-peer, how are requests authenticated?

*My experience is I can only "see" history back to the time when I joined a chat; can a client request or receive messages farther back in the history?

I understand some of of the protocols are currently in flux -- so, bonus points if you can explain whether/how these details are changing.

A: When you login your client has the last recieved id of that conversation.
Sends it to the other clients. The client who recieves the id looks up all messages after that one, and then sends it back to you.
That way they don't have to store the messages on their servers.


text:
Q: Loop not working as it should Below is a broad overview of my environment
Databases:

*

*Tsql Database = SysAid

*MySql Database = Bounties

*MySql Database = Gamification

So what the code does is:

*

*Manager loads bounty for SysAid request on bounty database, it gets a   status 1 if active 0 if not active, and 0 for incomplete.

*Code checks this and displays bounty on screen (different code)

*User claims bounty by completing the request on SysAid

*Code checks sysaid if request is completed and then updates the bounty  database to say it is completed and mark it as inactive.

However for some reason everytime the cron runs this piece of code to check if the bounty is completed it marks it as inactive even though it is still incomplete.
Here is my code below, it should check for a closed status on sysaid and then update the table. however it just changes the status without the ticket being closed.
    <?php
$servername = "*.*.*.*.";
$username = "*";
$password = "*";
$dbname = "Gamification";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection Failed : " . $conn->connect_error);
}

$sql = "SELECT * FROM performance_bounties";
$result = $conn->query($sql);

while ($row = $result->fetch_assoc()) {
    $ticket_number = $row['ticket_number'];
    $bounty_value = $row['bounty_value'];
    $bounty_completed = $row['completed'];
    $bounty_completed_by = $row['completed_by'];
    $bounty_enabled = $row['enabled'];
    check_sysaid($ticket_number, $bounty_value, $bounty_completed,     $bounty_completed_by, $bounty_enabled);
}

function check_sysaid($ticket_number, $bounty_value, $bounty_completed, $bounty_completed_by, $bounty_enabled) {

    $servername = "*.*.*.*";
    $username = "*";
    $password = "*";
    $dbname = "Gamification";

    $conn2 = new mysqli($servername, $username, $password, $dbname);
    if ($conn2->connect_error) {
        die("Connection Failed : " . $conn2->connect_error);
    }

    putenv("TDSVER=80");
    putenv("FREETDSCONF=/etc/freetds/freetds.conf");
    putenv("ODBCSYSINI=/etc/odbcinst.ini");
    putenv("ODBCINI=/etc/odbc.ini");

    $myServer = "TS";
    $username = "*";
    $password = "*";
    $database = "SYSAID";

//connection to the database
    $dbhandle = mssql_connect($myServer, $username, $password)
    or die("Couldn't connect to SQL Server on $myServer");

//select a database to work with
    $selected = mssql_select_db($database, $dbhandle)
    or die("Couldn't open database $myDB");

    $sysaidcheckquery = "
  SELECT id, substring(responsibility,11,11) as responsibility, status from service_req where id = '" . $ticket_number . "'";

    $sysaidcheckresult = mssql_query($sysaidcheckquery);
    $numRows = mssql_num_rows($sysaidcheckresult);

    while ($sysaidrow = mssql_fetch_array($sysaidcheckresult)) {
        echo $ticketstatus;
        $ticketid = $sysaidrow['id'];
        $ticketresponsibility = $sysaidrow['responsibility'];
        $ticketstatus = $sysaidrow['status'];

    if ($ticketstatus = "27") {
        $bountysqlupdate = "UPDATE performance_bounties SET enabled = '0', completed = '1', completed_by = '" . $ticketresponsibility . "' WHERE ticket_number = " . $ticket_number;
        $performanceupdate = "UPDATE performance_q3_2018 SET bounties = '" . $bounty_value . "' where user_name = '" . $ticketresponsibility . "'";

        if ($conn2->query($bountysqlupdate) === TRUE) {
            echo "Record updated successfully";
        } else {
            echo "Error updating record: " . $conn2->error;
        }

        if ($conn2->query($performanceupdate) === TRUE) {
            echo "Record updated successfully";
        } else {
            echo "Error updating record: " . $conn2->error;
        }
    }

    }

}

?>

A: You're assigning (=) instead of comparing (==).
$ticketstatus = "27"

will always evaluate to true. It should be
if ($ticketstatus == "27") {


text:
Q: Delphi : How to work with two Forms In my Delphi program I need two Forms. One with main program and one with settings for first Form. In the Settings Form I need to rewrite variables from Main Form and in Main Form I need to know values of variables and objects (like Buttons, RadioBoxes, CheckBoxes) from Settings Form. How can I declare both of Forms?

A: You can declare units after keyword  "implementation"
For example
unit Unit1;
interface
uses Classes, Forms ...;

type
  TForm1=class(TForm)
  .....
  end;

  implementation
  uses Unit2;

  TForm1.Method;
  begin
    Form2.value := something;
  end;

in second unit
unit Unit2;
interface
uses Classes, Forms ...;

type
  TForm2=class(TForm)
  .....
  end;

  implementation
  uses Unit1;

  TForm2.Method;
  begin
    Form1.value := something;
  end;


text:
Q: StatusBar - Alterar a cor com a rolagem em um CollapsingToolbar Atualmente eu tenho uma imagem em uma tela de perfil e StatusBar está "transparente". Funcionando certinho!!
Problema:
O problema está na rolagem da tela, pois nesse caso eu já consegui fazer com que a cor da StatusBar fique na cor PrimaryDark - ao rolar (pra cima).
Código: Estou utilizando esse modelo
AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout_edit_profile);
        appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
            boolean isShow = false;
            int scrollRange = -1;

            @Override
            public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
                if (scrollRange == -1) {
                    scrollRange = appBarLayout.getTotalScrollRange();
                }
                if (scrollRange + verticalOffset == 0) {
                      Window window = activity.getWindow();
                      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

                      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                      window.setStatusBarColor(activity.getResources().getColor(R.color.primary_color));

                    isShow = true;
                } else if (isShow) {
                    collapsingToolbarLayout.setTitle(" ");
                    isShow = false;
                    Window w = activity.this.getWindow();
                    w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                }
            }
        });

O que não funciona: Ao rolar a tela (pra baixo) eu tenho uma Toolbar que fica fixa. Quando termina de carregar os dados do RecyclerView, ai sim volta ao estado original. (com transparência)
Porém está com uma certa transparência, nessa rolagem de volta. (prints abaixo)
Preciso de alguma forma identificar quando acontece a rolagem de retorno e setar a corPrimaryDark.
Ex:

*

*Expanded:

*

*Collapsed:


text:
Q: Default PHP Config File I'm looking to find a copy of the default php.ini file for PHP 5.2.17.
Does anyone know where I can get a copy to download?

A: http://php.net/releases/index.php
Download: PHP 5.2.17 (tar.bz2) PHP 5.2.17 (tar.gz)

*

*http://museum.php.net/php5/php-5.2.17.tar.bz2

*http://museum.php.net/php5/php-5.2.17.tar.gz
It's in the base directory (extracted).
"php.ini-dist" or "php.ini-recommended"

A: There's a php.ini-dist and php.ini-recommended in the src, you may want to try that:
http://us.php.net/get/php-5.2.17.tar.gz/from/a/mirror

A: PHP Versions can be downloaded here: http://php.net/releases/index.php
You could also take a look at old versions of the GitHub repository: https://github.com/php
You are looking for the file php.ini-dist or php.ini-recommended.


text:
Q: Adding column to aspnet_users table I am using aspnet db for my usermanagement.I added a column named companyID to the aspnet_Users table.Also altered the coresponding stored procedures.I want  to pass the companyID to the database when i click on the createUser Button. Currently showing some error that the procedure expect the parameter @CompanyID.How can i save the companyID to the aspnet_users table by an effective methode.
I am using ASP.net 2010 with VB.
Please help to resolve the problem.Thanks in Advance..


text:
Q: Perl Hash with dynamic key values...Getting wiered results! Please advice I'm trying to build a hash with variable key values and the keys are same as values and then I'm trying to retreive a specific value for a specific key.here is the code and I'm getting exactly what I want.
My porblem is when I try to keep the peice of the code in a subroutine and call it from there I'm getting null! can someone expian why?
Here is the working code;
 my @ary = qw(apple mango orrange grape);

 my %dir;
 foreach my $list (@ary) {
    $dir{$list} = "$list";
 }

  my $file = $dir{mango};
  print("$file\n");

getiing the result : mango as expected:
Here is the code which is not working:
( which is in the main porgram)
  my %dir;

  foreach my $list ( @show ) {
     $dir{$list} = "$list";
     # print $dir{$list} . "\n";
  }

  while ( my ($key,$value ) = each %dir ) {
     print("$key -> $value\n");
  }

  ### I'm genuinley getting the key values as expected#####

  my $file1 = $dir{apple};
  my $file2 = $dir{mango };
  print("Required files is : $file1" . "\n" . $file2 ."\n");

getting nothing!!!

A: I assume this is your code:
my @show = qw(apple mango orrange grape);

my %dir;

  foreach my $list ( @show ) {
     $dir{$list} = "$list";
     # print $dir{$list} . "\n";
  }

my $file1 = $dir{apple};
  my $file2 = $dir{mango};
  print("Required files is : $file1" . "\n" . $file2 ."\n");

You should get a value print out. The only time you wouldn't get anything is if your @show array is initialized with something else(no mango, no apple).


text:
Q: ¿Se puede ordenar una columna CLOB que contiene objetos? Tengo una columna tipo CLOB que almacena un arreglo de objetos que contienen la siguiente estructura:
{"id": 1, "nombre": "auditiva"}
Entonces suponer que tengo la siguiente columna de registros CLOB:

*

*[{"id": 21, "nombre": "fisica"}, {"id": 16, "nombre": "auditiva"}]

*[{"id": 16, "nombre": "auditiva"}]

*[{"id": 4, "nombre": "intelectual"}, {"id": 21, "nombre": "fisica"}]

y asi con varios registros que su arreglo en el CLOB como minimo contiene un objeto; entonces supongamos que tengo los anteriores registros, ¿es posible ordenar esa columna por el nombre de cada primer objeto de cada registro? ejemplo del resultado deseado

*

*[{"id": 16, "nombre": "auditiva"}]

*[{"id": 21, "nombre": "fisica"}, {"id": 16, "nombre": "auditiva"}]

*[{"id": 4, "nombre": "intelectual"}, {"id": 21, "nombre": "fisica"}]

A: Podrías obtener la 5ta ocurrencia de " en el campo CLOB y el caracter siguiente del CLOB y luego ordenar por eso, en tu caso si tienes los registros que dices quedaría:
[{"id": 21, "nombre": "fisica"}, {"id": 16, "nombre": "auditiva"}]      > "f
[{"id": 16, "nombre": "auditiva"}]                                      > "a
[{"id": 4, "nombre": "intelectual"}, {"id": 21, "nombre": "fisica"}]    > "i

Y luego ordenar por este campo para que quede:
1) "a
2) "f
3) "i

Con esta consulta podrías lograrlo:
select columnaCLOB from Tabla
order by SUBSTR(To_Char(columnaCLOB),INSTR(To_Char(columnaCLOB),'"',1,5),2)

Si quisieras tomar uno o dos caracteres más desde el " solo sería cuestión de aumentar el número X:
select columnaCLOB from Tabla
order by SUBSTR(To_Char(columnaCLOB),INSTR(To_Char(columnaCLOB),'"',1,5),X)


text:
Q: How to synchronize data received from remote parts connected by serial ports I have a WinCE master board wich is connected by serial ports to several remote slave boards. These slaves boards measures potentials.
The communication protocol between master ans slaves is based upon MODBUS.
The master request a measure to one different slave every 300ms. The slave targetted is changed for each request.
My problem is that I have to timestamp the received measures. So, how can I synchronize all slave boards to have an identical time reference for all ? The synchronisation have to pass through the serial commuinication which is not real time determined !

A: A lot depends on the rest of your hardware, really. Ideally you have a clock signal going from the master to each board which keeps all of the local clocks on the same time reference. As an initial synchronization mechanism, you can send down a MODBUS register write to preload a future time and then use one of the other serial port lines (DTR, CTS, etc.) as a trigger to load that time into the clock on the slave board.


text:
Q: How i can avoid the distinct() of watchdog? I want to avoid using distinct() in my code. I want some help in order to create a table that will keep the values that are taken from the db table watchdog and check if the next value has been taken. If the next value is in the table this value then will not insert in the table...I need a really help because i will end my module if i solve this think.Thanks in advance!!
// Begin building the query.
  $query = db_select('watchdog', 'th')
    ->extend('PagerDefault')
    ->orderBy('wid')
    ->distinct()
    ->fields('th', array('variables', 'type', 'severity', 'message', 'wid'))
    ->limit(2000);

  // Fetch the result set.
  $result = $query  -> execute();

  // Loop through each item and add to $row.
  foreach ($result as $row) {
    blablablabla($row);
  }
}

i want the distinct values of the variables column. I do not want a theme table i just want a table with some values.

A: Make some empty array before the loop. Inside the loop check if the unique value exists in it. If it does just skip that loop iteration (continue). And if it doesn't store it in the array and do your blablabal();
    // query without distingc
//  print_r($results); print out array of results to see what field to take as unique

      $already_processed = array();

  foreach ($result as $row) {
    $unique_value = $row['some_unique_field'];
    if (in_array($unique_value, $already_processed)) continue;
    $already_processed[] = $unique_value;
    blablabla($row);
  }

Something like that.


text:
Q: Argument of type '(event: string) => void' is not assignable to parameter of type 'EventListenerOrEventListenerObject I have added an event listener to my div.
componentWillMount() {
    document.addEventListener('keyPress', this.handleKey, false)
  }

componentWillUnmount() {
    document.removeEventListener('keyPress', this.handleKey, false)
  }

Here is my function:
handleKey = (event: string) => {
   console.log(event)
  }

render(){
  return(
      <div className={classes.scAccountDropDown} onKeyDown={(event: any) => this.handleKey(event.key)}>
)

But after compiling I'm getting  "Argument of type '(event: string) => void' is not assignable to parameter of type 'EventListenerOrEventListenerObject."

A: The issue here is that inside render you are passing string as a parameter to handleKey function:
onKeyDown={(event: any) => this.handleKey(event.key)}

But, both in componentWillMount and componentWillUnmount you are passing the actual KeyboardEvent event to the handleKey function, which is causing this issue. You can fix this by updating them like:
componentWillMount() {
  document.addEventListener('keyPress', (e: any) => this.handleKey(e.key), false)
}

componentWillUnmount() {
  document.removeEventListener('keyPress', (e: any) => this.handleKey(e.key), false)
}

You can also update handleKey() function to make it clear that you are getting key as a param to this function, not the actual event.
handleKey = (key: string) => {
   console.log(key)
}


text:
Q: ReferenceError: "bot" is not defined (Eris) - in my commands I am in the process of creating a Discord bot, and I have gotten pretty far. However, I keep getting this error when I try to connect my bot:

ReferenceError: bot is not defined

My main file's code is here. I have defined the constant variable bot to require the Eris library.
However, when I try to run the code, my command code throws the error mentioned above. I have tried to use multiple versions of module.exports but nothing seems to work. My command's code is located here.

A: The bot constant will only exist in the main file, so you'll need a way to pass it over to the commands file. You could export a function from the commands file with bot as a parameter
const Permissions = require('eris').Constants.Permissions;

module.exports = function(bot){
    // paste in the rest of the commands code
};

And then run the function in the main file
require('../src/commands/loader')(bot);


text:
Q: How to render a cross as a highcharts marker? I'm trying to extend highcharts to include a cross symbol. My svg path is rendering a triangle and I'm not sure why.
Since highcharts does not accept actual svg paths, this task is more challenging than rendering a horizontal line and a vertical line.
The path I have should do this :

*

*Start at top middle

*line to bottom middle

*line to center

*line to left middle
$.extend(Highcharts.Renderer.prototype.symbols,
{
    Cross: function (x, y, w, h)
    {
    var trianglesArray = [];

    trianglesArray.push('M');
    trianglesArray.push(x + (w * .5));
    trianglesArray.push(y);

    trianglesArray.push('L');
    trianglesArray.push(x + (w * .5));
    trianglesArray.push(y + h);

    trianglesArray.push('L');
    trianglesArray.push(x + (w * .5));
    trianglesArray.push(y + (h * .5));

    trianglesArray.push('L');
    trianglesArray.push(x);
    trianglesArray.push(y + (h * .5));

    trianglesArray.push('L');
    trianglesArray.push(x + w);
    trianglesArray.push(y + (h * .5));

    trianglesArray.push('z');

    return trianglesArray;
  }
});

A: You can use prepare cross as image and then use it as symbol like in the example with other image:
http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/spline-symbols/
 marker: {
                    symbol: 'url(http://www.highcharts.com/demo/gfx/snow.png)'
                }