text:
Q: FirebaseAuth with Google Sign failed to handle onActivityResult when handling the return of sign google activity i have the following error:

02-13 23:53:33.729 14395-14395/br.com.easytrip E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   Process: br.com.easytrip, PID: 14395
                                                                   java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=711, result=-1, data=Intent { (has extras) }} to activity {br.com.easytrip/br.com.easytrip.features.login.view.LoginGoogleActivity}: com.google.android.gms.common.api.ApiException: 8:
                                                                       at android.app.ActivityThread.deliverResults(ActivityThread.java:4130)
                                                                       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4173)
                                                                       at android.app.ActivityThread.-wrap20(ActivityThread.java)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:154)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:6165)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
                                                                    Caused by: com.google.android.gms.common.api.ApiException: 8:
                                                                       at com.google.android.gms.common.internal.zzb.zzy(Unknown Source)
                                                                       at com.google.android.gms.auth.api.signin.GoogleSignIn.getSignedInAccountFromIntent(Unknown Source)
                                                                       at br.com.easytrip.features.login.view.LoginGoogleActivity.onActivityResult(LoginGoogleActivity.kt:46)
                                                                       at android.app.Activity.dispatchActivityResult(Activity.java:6946)
                                                                       at android.app.ActivityThread.deliverResults(ActivityThread.java:4126)
                                                                       at android.app.ActivityThread.handleSendResult(ActivityThread.java:4173)
                                                                       at android.app.ActivityThread.-wrap20(ActivityThread.java)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:154)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:6165)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)

My code snippet for onActivityResult:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    super.onActivityResult(requestCode, resultCode, data)

    if (resultCode == Activity.RESULT_OK && requestCode == GOOGLE_SIGN_IN_REQUEST) {
        data?.let {
            val signedInAccountFromIntent = GoogleSignIn.getSignedInAccountFromIntent(intent)
            presenter.handleGoogleLogin(signedInAccountFromIntent)
        } ?: handleGoogleSignInError()
    } else {
        handleGoogleSignInError()
    }
}

My code snippet for google sign in Intent:
private fun setUp() {
    val googleSignInOptions = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(getString(R.string.default_web_client_id))
            .requestEmail()
            .build()

    googleSignInClient = GoogleSignIn.getClient(this, googleSignInOptions)

    val account = GoogleSignIn.getLastSignedInAccount(this)
    if (account != null && account.idToken != null) {
        account.idToken?.let{
            setResult(it)
        } ?: showGenericError()
    } else {
        val signInIntent = googleSignInClient.signInIntent
        startActivityForResult(signInIntent, GOOGLE_SIGN_IN_REQUEST)
    }
}

I have added a sha1 debug key in firebase console.


text:
Q: Partial derivatives and differentiability, continuity Function $f : \mathbb{R}^3 \rightarrow \mathbb{R}$ has in every $x$ of domain partial derivatives $\frac{\partial f}{\partial x_1}(x) =x_2$, $\frac{\partial f}{\partial x_2}(x) =x_1$, $\frac{\partial f}{\partial x_3}(x) =x_3$. Determine whether

*

*a) $f$ is continous

*b) $f$ is differentiable

How to do that without knowing $f$'s formula?

A:
Theorem: $f:\mathbb R^n\to\mathbb R$ is $\mathcal C^1$ (continuously differentiable) $\iff$ $f$ has continuous partial derivatives.

Proof of Sufficiency: Proof that continuous partial derivatives implies differentiability

Conclusion

$f$ is differentiable.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Password protection on flatpak apps I found a bash script to password protect one of my flatpak apps but it doesn't seem to work, please tell me where I got it wrong
script->
#!/bin/bash
read -s -p "Enter password: " PASSWORD
flatpak run com.example.app --password="$PASSWORD"

now since I wanted this script to run every time I open the app, I found out that I need to do changes in the .desktop file of that app, so I changed the Exec line in that file accordingly
Exec=/home/user/scripts/password-script.sh flatpak run com.example.app

I tried running this, but it didn't work, is there anything that I am missing? My OS is Ubuntu 22.04 and the app is saved in the .local/share/flatpak/app directory since I made a user installation. Any help would be appreciated.


text:
Q: Issue inserting localdate type field using JDBI I am currently using JDBI to persist my POJO into my database. I am using MS SQL Server as my database. I am currently not able to insert a row into the table because of an issue with mapping no value for LocalDate variable.
scoreDate field is LocalDate type, is non mandatory and I am not passing any value for this field. But while trying to run the below test I get the below error.
Please can you advise what the issue could be and how it can be fixed?
Test Class
@Test
    public void testInsertClientScore() throws Exception {
        final DBI dbi = databaseResource.getDBI();
        final ClientScoreDao clientScoreDao = dbi.onDemand(ClientScoreDao.class);

        final ClientScore clientScore = ImmutableClientScore.builder()
                .id(1L)
                .ClientName("TESTCLIENT")
                .build();

        assertEquals(1,clientScoreDao.insert(clientScore));

    }

ERROR TRACE
org.skife.jdbi.v2.exceptions.UnableToExecuteStatementException: com.microsoft.sqlserver.jdbc.SQLServerException:
Implicit conversion from data type varbinary to date is not allowed. Use the CONVERT function to run this query. [statement:"insert into ICEBERG.ClientScore (scoreId, clientname, scoredate) values (:id, :ClientName, :scoreDate)", located:"insert into ICEBERG.ClientScore (scoreId, clientname, scoredate) values (:id, :ClientName, :scoreDate)", rewritten:"insert into ICEBERG.ClientScore (scoreId, clientname, scoredate) values (?, ?, ?)", arguments:{ positional:{}, named:{ClientName:'TESTCLIENT',id:1,scoreDate:null}, finder:[]}]

    at org.skife.jdbi.v2.SQLStatement.internalExecute(SQLStatement.java:1338)
    at org.skife.jdbi.v2.Update.execute(Update.java:56)
    at org.skife.jdbi.v2.sqlobject.UpdateHandler$2.value(UpdateHandler.java:67)

.....
....

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Implicit conversion from data type varbinary to date is not allowed. Use the CONVERT function to run this query.
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:217)

Database Table definition
-- ClientScore table
CREATE TABLE ICEBERG.ClientScore (
   ScoreId                 INTEGER                                         NOT NULL,
   ClientName              VARCHAR(50)                                  NOT NULL,
   ScoreDate               DATE                                            NULL,
   CONSTRAINT PK_CLIENTSCORE_TEST PRIMARY KEY (ScoreId)
)

POJO
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mercuria.dali.jdbi.Jdbi;
import com.mercuria.dali.jdbi.JdbiOptions;
import org.immutables.value.Value;

import javax.annotation.Nullable;
import java.io.Serializable;
import java.time.LocalDate;

@Value.Immutable
@Jdbi(tableName = "ICEBERG.ClientScore")
@JsonSerialize(as = ImmutableClientScore.class)
@JsonDeserialize(as = ImmutableClientScore.class)
public interface ClientScore extends Serializable {

    @JsonProperty("scoreid")
    @JdbiOptions(columnName = "scoreId")
    Long id();

    @JsonProperty("clientname")
    @JdbiOptions(columnName = "clientname")
    String ClientName();

    @JsonProperty("scoredate")
/*    @JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)*/
    @JdbiOptions(columnName = "scoredate")
    @Nullable
    LocalDate scoreDate();
}

I have mappers setup for LocalDate data type while configuring my JDBI connection.
 public static void configureDbi(DBI dbi) {
        // Register argument factories
        dbi.registerArgumentFactory(new NullDoubleArgumentFactory());
        dbi.registerArgumentFactory(new UuidArgumentFactory());
        dbi.registerArgumentFactory(new LocalDateArgumentFactory());
        dbi.registerArgumentFactory(new InstantArgumentFactory(Optional.of(TimeZone.getTimeZone("UTC"))));
        dbi.registerColumnMapper(new InstantMapper(Optional.of(TimeZone.getTimeZone("UTC"))));

        dbi.registerArgumentFactory(new OptionalArgumentFactory("com.microsoft.sqlserver.jdbc.SQLServerDriver"));
        dbi.registerArgumentFactory(new OptionalIntArgumentFactory());
        dbi.registerArgumentFactory(new OptionalDoubleArgumentFactory());

        // Register column mappers
        dbi.registerColumnMapper(new UuidColumnMapper());
        dbi.registerColumnMapper(new LocalDateMapper());
    }

A: I ran into his issue as well and discovered that the way the Dropwizard LocalDateArgumentFactory class determines whether or not to create the Argument class to deal with the value is using instanceof check:
public boolean accepts(Class<?> expectedType, Object value, StatementContext ctx) {
    return value instanceof LocalDate;
}

Since value is null it returns false, I worked around the issue by creating this:
public class NullAwareLocalDateArgumentFactory extends LocalDateArgumentFactory {
    @Override
    public boolean accepts(Class<?> expectedType, Object value, StatementContext ctx) {
        if(value == null){
            //Look at the expected type. Tbh. not sure why it isn't simply doing this by default ...
            return LocalDate.class.isAssignableFrom(expectedType);
        }
        else {
            return super.accepts(expectedType, value, ctx);
        }
    }
}


text:
Q: Get InvalidOperatorException was unhandled upon compiling Everything was compiling just fine until validation for text fields was implemented.
Why won't it compile?

An error occurred creating the form.
  See Exception.InnerException for
  details. The error is: External
  component has thrown an exception.

The source:
Public Class frmAddStudent
    Dim aryData(6) As String
    Public Shared newStudentRecord As String

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.DialogResult = DialogResult.Cancel
    End Sub

    Private Sub btnAddStudent_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddStudent.Click
        'place all the student field data into the array of elements
        aryData(0) = txtFirstName.Text
        aryData(1) = txtLastName.Text
        aryData(2) = txtMajor.Text
        aryData(3) = txtPhone.Text
        aryData(4) = txtEmail.Text
        aryData(5) = txtGPA.Text

        'join the array elements and place the result into a string variable
        newStudentRecord = Join(aryData, " ")

        'create a link between the form and the file with streamwriter and write to the text file
        If System.IO.File.Exists(frmMain.FILE_NAME) = True Then
            Dim objWriter As New System.IO.StreamWriter(frmMain.FILE_NAME, True)
            objWriter.WriteLine(newStudentRecord)
            objWriter.Close()
        End If
        Me.DialogResult = DialogResult.OK
    End Sub

    Private Sub txtFirstName_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtFirstName.Validating
        If txtFirstName.Text.Contains(" ") Or txtFirstName.Text.Length = 0 Or Not System.Text.RegularExpressions.Regex.IsMatch(txtFirstName.Text, "[a-z|A-Z]+$") Then
            ErrorProvider1.SetError(txtFirstName, "First Name can't contain spaces or be of zero length and must consist of only letters")
            e.Cancel = True
        Else
            ErrorProvider1.SetError(txtFirstName, "")
        End If
    End Sub

    Private Sub frmAddStudent_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ErrorProvider1.BlinkStyle = ErrorBlinkStyle.NeverBlink
    End Sub

    Private Sub txtLastName_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtLastName.Validating
        If txtLastName.Text.Contains(" ") Or txtLastName.Text.Length = 0 Or Not System.Text.RegularExpressions.Regex.IsMatch(txtLastName.Text, "[a-z|A-Z]+$") Then
            ErrorProvider1.SetError(txtLastName, "Last Name can't contain spaces or be of zero length and must consist of only letters")
            e.Cancel = True
        Else
            ErrorProvider1.SetError(txtLastName, "")
        End If
    End Sub

    Private Sub txtMajor_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles txtMajor.Validating
        If txtMajor.Text.Length > 0 Then
            If Not System.Text.RegularExpressions.Regex.IsMatch(Strings.Left(txtMajor.Text, 1), "[a-z|A-Z]+$") Then
                ErrorProvider1.SetError(txtMajor, "Major course code is incorrect")
            Else
                ErrorProvider1.SetError(txtMajor, "")
            End If
        Else
            ErrorProvider1.SetError(txtMajor, "Major cant' be zero length")
        End If
    End Sub
End Class

EDIT: Here's also a link to a PrtSc of the problem: http://img88.imageshack.us/i/imageqc.gif/


text:
Q: The Walking Dead: Wifi & Pilots? How come in gated communities like Alexandria where there's electricity and normal appliances there is no computer with a wifi connection? Telecomm companies might have been zombie infested but that doesn't explain how or why no one has an internet connection. Furthermore, airports might have stopped operating but it's not like the landing strips aren't there. It's as if they are suggesting all pilots and private jet owners have died or zombified. All those semi-peaceful days in Alexandria  you'd think they'd try to get in contact with similar communities around the world and bring civilization and peace back.

A: Several studies I've read a while ago indicated that it's the internet network which is most resistant to all kinds of disasters. That is not to say that it will stay up no matter what, just that the losses in the infrastructure will be the least of all communication methods and will be easiest and fastest to have it back up.
The Last Ship, for example, featured communications via network of mobile phones with bluetooth (not sure if it wasn't wifi too) to send messages over state lines even. Not much of an example to address your question, but illustrates possibilities.
However, as Gallifreyan says in a comment, there must be someone to maintain the network, and even without that damage would be extensive. I did not watch the series beyond first season (I find all zombie things boring after reading "The Black Tide" series by John Ringo... or stupidly ridiculous like the iBrain or something), but I find remarkably low damage level in it. There should be a lot of buildings burned down, for example, burned cars, destroyed infrastructure, including relay stations and exchange cabs etc. And by a lot I mean at least 50%.
And, of course, satellite network is now sufficiently sophisticated to allow for internet connection. I'm surprised no one really uses satellite phones - you can buy an iPhone add-on to convert it to sat phone for less than $200 (i think), and having a smartphone is half-way-there to the IoT.


text:
Q: Rewriting 2nd parameter in query string Like so many I am struggling with what ought to be a simple rewrite
The initial form is something like:
http://cassie-family.co.uk/individual.php?pid=I807&ged=Cassy%20Family%20History.ged

The last parameter only needs rewriting, as in:
http://cassie-family.co.uk/individual.php?pid=I807&ged=Cassie%20-%20Cassy%20Family%20History

I have tried to trap the first parameter using:
RewriteCond %{QUERY_STRING} ^pid=([^&]+)    [NC]

The nearest (incorrect) RewriteRule is:
RewriteRule ^(.*)$ individual.php&pid=%1&ged=Cassie%20-%20Cassy%20Family%20History [L, NC, R=301]

The moment I try to replace the '&' after individual.php with the correct '?' the URL is written as:
http://cassie-family.co.uk/individual.php

So.. the parameter is being trapped correctly but the rewrite rule is clearly mangled. The error lies in here:
^(.*)$ individual.php&

What construct should I be using to replace only the 2nd (passed-in) parameter value (which is always the same fixed string) with a different 2nd value (which is always the same but slightly different fixed string)? Adding a B flag seems to make no difference.
All suggestions welcome,
Thanks,
Ric


text:
Q: Late Nite Teacher Problems: Linking stylesheet my web page isn't linking the stylesheet. Not sure what's going on this is my first time using style sheets. Need to understand if I'm just missing something. Willing to send the whole document if it would assist in understanding where my error would be coming from. I have. pathways are all in root folder. Not sure what I'm missing. HELPPP!!
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>REID RULES IT</title>
<meta charset="utf-8" />

</link rel="stylesheet" href="style.css" type="text/css"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body class="body">
....
..
.
</body>
</html>

CSS
body {
background-image: url('img/logo.jpg');
color:#000305;
font-size: 87.5% /* base font size is 14px */
font-family: Arial, 'Lucida Sanas Unicode';
line-height: 1.5;
text-align: left;
}

 a {
     text-decoration: none;
 }

 a:link, a:visited {
 }

 a:hover, a:active {
 }

 .body {
   margin: 0 auto;
   width: 70%;
   clear:both;
 }

 .mainHeader img{
     width: 30%;
     height: auto;
     margin: 2% 0;
 }

.mainHeader nav {
    background-color: #666;
    height:40px;
    border-radius:5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;

.mainHeader nav ul {
    list-style: none;
    margin: 0 auto;
}

 .mainHeader nav li {
    float: left;
    display: inline;
 }

A: You have a simple typo. It should be <link and not </link
Using a validator such as http://validator.w3.org would find you this issue in a second:

Error: Stray end tag link.


text:
Q: Wrapping text in a JavaFX TableView editable TextFieldTableCell My TableView consists of several columns and wraps the text with the following cellfactory:
private void setWrapCellFactory(TableColumn<CustomObject, String> table) {
    table.setCellFactory(tablecol -> {
        TableCell<CustomObject, String> cell = new TableCell<>();
        Text text = new Text();
        cell.setGraphic(text);
        text.wrappingWidthProperty().bind(cell.widthProperty());
        text.textProperty().bind(cell.itemProperty());
        return cell;
    });
}

This works perfectly for showing uneditable text.
The last column has to be editable and could span across several rows (not TableView rows). To prevent the ellips I would like to wrap the new edited text.
After hours of trying I still can't seem to get it working. I have the following code to edit my cell and a non-working attempt to wrap it.
Non-working method to wrap my edited text:
private void setWrapCellFactoryEditable(TableColumn<CustomObject, String> table) {
    table.setCellFactory(tablecol -> {
        TableCell<CustomObject, String> cell = new TextFieldTableCell<>(new DefaultStringConverter());
        Text text = new Text();
        text.setText(text.toString());
        text.wrappingWidthProperty().bind(cell.widthProperty());
        return cell;
    });
}

The following code is the column setup:
feedbackCol.setCellValueFactory(ev -> new ReadOnlyStringWrapper(ev.getValue().getLastFeedback()));
    setWrapCellFactoryEditable(feedbackCol);
    feedbackCol.setOnEditCommit((CellEditEvent<CustomObject, String> ev) -> {
        int id = ((CustomObject) ev.getTableView().getItems().get(
                ev.getTablePosition().getRow())).getId();
        dc.addTempFeedback(id, ev.getNewValue());
    });

For the regular non-editable text I'm using a TableCell, for editable text I'm using a TextFieldTableCell. I don't know why the wrapping isn't working with editable cells.

A: You need to create your own class extending TextFieldTableCell. It should override cancelEdit() and updateItem() methods to change cell graphic to Text component (equal to one you used for non-editable cells) when editing is finished.
public class WrappingTextFieldTableCell<S> extends TextFieldTableCell<S, String> {

    private final Text cellText;

    public WrappingTextFieldTableCell() {
        super(new DefaultStringConverter());
        this.cellText = createText();
    }

    @Override
    public void cancelEdit() {
        super.cancelEdit();
        setGraphic(cellText);
    }

    @Override
    public void updateItem(String item, boolean empty) {
        super.updateItem(item, empty);
        if (!isEmpty() && !isEditing()) {
            setGraphic(cellText);
        }
    }

    private Text createText() {
        Text text = new Text();
        text.wrappingWidthProperty().bind(widthProperty());
        text.textProperty().bind(itemProperty());
        return text;
    }
}

A:   public static class TextAreaTableCell<S> extends TextFieldTableCell<S, String> {
    private final IntFunction<ObservableValue<Boolean>> editableExtractor;
    private TextArea textArea;
    private final Text cellText;

    public TextAreaTableCell(IntFunction<ObservableValue<Boolean>> editableExtractor, StringConverter<String> converter) {
        super(converter);
        this.editableExtractor = editableExtractor;
        this.cellText = createText();
    }

    @Override
    public void updateIndex(int i) {
        super.updateIndex(i);
        if (i == -1)  {
            editableProperty().unbind();
        } else {
            editableProperty().bind(editableExtractor.apply(i));
        }
    }

    public static <S> Callback<TableColumn<S, String>, TableCell<S, String>> forTableColumn(IntFunction<ObservableValue<Boolean>> editableExtractor) {
        return forTableColumn(editableExtractor, new DefaultStringConverter());
    }

    public static <S> Callback<TableColumn<S, String>, TableCell<S, String>> forTableColumn(IntFunction<ObservableValue<Boolean>> editableExtractor,
            final StringConverter<String> converter) {
        return list -> new TextAreaTableCell<>(editableExtractor, converter);
    }

    private void createTextArea() {
        textArea = new TextArea(getString());
        textArea.setWrapText(true);
        textArea.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
        textArea.focusedProperty().addListener(
                (ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
                    if (!newValue) {
                        commitEdit((String)textArea.getText());
                    }
                });
    }

    private String getString() {
        return getItem() == null ? "" : (String) getItem();
    }

    @Override
    public void startEdit() {
        if (!editableProperty().get()) {
            return;
        }
        if (!isEmpty()) {
            super.startEdit();
            createTextArea();
            setText(null);
            setGraphic(textArea);
            textArea.selectAll();
        }
    }

    @Override
    public void cancelEdit() {
        if (!editableProperty().get()) {
            return;
        }
        super.cancelEdit();
        setText((String) getItem());
        setGraphic(cellText);
    }

    @Override
    public void updateItem(String item, boolean empty) {
        if (!editableProperty().get()) {
            return;
        }
        super.updateItem(item, empty);
        if (empty) {
            setText((String)item);
            setGraphic(null);
        } else {
            if (isEditing()) {
                if (textArea != null) {
                    textArea.setText(getString());
                }
                setText(null);
                setGraphic(textArea);
            } else {
                setText(getString());
                setGraphic(cellText);
            }
        }
    }

     private Text createText() {
        Text text = new Text();
        text.wrappingWidthProperty().bind(widthProperty());
        text.textProperty().bind(itemProperty());
        return text;
    }

}

and use:
colDiagnose.setCellFactory(TextAreaTableCell.forTableColumn(i -> Bindings.valueAt(editable, i).isEqualTo(Boolean.TRUE)));


text:
Q: How can I find if one or more array elements match in lodash find Using lodash _.find(), we can see if there's a matching object in a collection.
var users = [
  { 'user': 'barney',  'age': 36, 'active': true,  arr: [2, 3, 6, 9] },
  { 'user': 'fred',    'age': 40, 'active': false, arr: [2, 3, 6, 9] },
  { 'user': 'pebbles', 'age': 1,  'active': true,  arr: [2, 3, 6, 9] }
];

You can provide an array, and an object matches if all values in that array are present in the collection. Notice the arr.
_.result(_.find(users, { 'age': 1, 'active': true, 'arr': [2, 9] }), 'user');
// Result: "pebbles"

How can I match objects that have one (or more) matching array items for any array in the match object? (In this case arr.) Something similar to the $in query from MongoDB.
_.result(_.find(users, { 'age': 1, 'active': true, 'arr': [2, 4] }), 'user');
// Result: undefined
// Expected: "pebbles"

A: From the fine manual:

If an object is provided for predicate the created _.matches style callback returns true for elements that have the properties of the given object, else false.

and _.matches does element-by-element equality tests with arrays so you can't use an object predicate for what you want to do. However, you don't have to pass an object to _.find, you can pass a function:

Iterates over elements of collection, returning the first element predicate returns truthy for. The predicate is bound to thisArg and invoked with three arguments: (value, index|key, collection).

The object form of _.find that you're using just builds a predicate function behind the curtains. You can always supply your own predicate function if you need to:
_.find(users, function(value) {
    if(value.age !== 1)
        return false;
    if(!value.active)
        return false;
    if(_.intersection(value.arr, [2, 4]).length <= 0)
        return false;
    return true;
})

Of course, if your arrays aren't really sets (i.e. there could be duplicates or order matters) then you'd have to replace with _.intersection test with something that matches your specific requirements.
Demo: http://jsfiddle.net/ambiguous/vo72Lyce/
If you want this to work for arbitrary objects then you'd write your own version of _.matches (probably by starting with the current implementation) that does what you want; then you could use your version of _.matches to build the predicate function for _.find.

A: As far as I know, you cannot do that in lodash.
What fuzzyMatcher does is create an array of functions where each function corresponds to a single property in the object you are trying to match on. Those functions will return true if that property matches the property in the user object. Then fuzzyMatcher runs each of those functions and gets the count of the functions which returned true. Then it returns true if the number of matching functions is greater than or equal the number of desired matches (1 in your case).
This seems to work pretty well:
function fuzzyMatcher(collection, matchObj, minSimilarProps) {
    var matchFns = [];

    _.forOwn(matchObj, function(value, key) {
        matchFns.push(_.matchesProperty(key, value));
    });

    return _.find(collection, function(u) {
        return _.filter(matchFns, function(fn) {
            return fn(u);
        }).length >= minSimilarProps;
    });
}

//matches 1 properties
fuzzyMatcher(users, { 'age': 1, 'active': true, 'arr': [2, 4] }, 1);

//or matches 2 properties
fuzzyMatcher(users, { 'age': 1, 'active': true, 'arr': [2, 4] }, 2);

Or in your case:
_.result(fuzzyMatcher(users, { 'age': 1, 'active': true, 'arr': [2, 4] }, 2), 'user');

Also I think you need to reword what you want to say "two or more" since once or more would match barney since active=1 in both cases.


text:
Q: VBA Word Macro to find text in footer(Achieved) and print to text file(Not quite working) I am adding to some code I previously requested help with, trying to give it the function of editing a revision number in a footer, Which works up until I try to get it to print the section and page to a text document. Then it give the last result found in the previous search, and breaks the loop?
Here is the code in full.
Sub MegaMacro()

    sword = InputBox("Enter the Rev. no.", "Rev. No.", "")
    Dim doc As Word.Document, rng As Word.Range
    Dim FileNum As Integer
    Dim oFile As String

    On Error GoTo ERRORHANDLER
    Set doc = ActiveDocument
    Set rng = doc.Content

    FileNum = FreeFile()
    oFile = doc.Path & "\AuthorTec_Edits.txt"
    If Dir(oFile, vbNormal) <> vbNullString Then
        Kill oFile
    End If
    Open oFile For Append As #FileNum
    Print #FileNum, "Extra spaces between words on Section:Page:"
    With rng.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        'Here is where it is actually looking for spaces between words
        .Text = " [ ]@([! ])"
        'This line tells it to replace the excessive spaces with one space
        .Replacement.Text = " \1"
        .MatchWildcards = True
        .Wrap = wdFindStop
        .Format = False
        .Forward = True
        'execute the replace
        While .Execute
           Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
           rng.Collapse Word.WdCollapseDirection.wdCollapseEnd
        Wend
    End With

        ' Remove white space at the beginning of lines
    Print #FileNum, "Extra white space at beginning of lines on Section:Page:"
    Set rng = doc.Content
    With rng.Find
        .Text = "^p^w"
        .Replacement.Text = "^p"
        While .Execute
           Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
           rng.Collapse Word.WdCollapseDirection.wdCollapseEnd
        Wend
    End With

' Removes spaces in first line
    Print #FileNum, "Removed spaces in first line on Section:Page:"
    Set rng = doc.Content
    With rng.Find
        .Text = " {3,}"
        .Replacement.Text = ""
        While .Execute
           Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
           rng.Collapse Word.WdCollapseDirection.wdCollapseEnd
        Wend
    End With

    Print #FileNum, "Removed excessive spaces after a paragraph mark on Section:Page:"
    Set rng = doc.Content
    With rng.Find
        'This time its looking for excessive spaces after a paragraph mark
        .Text = "^p "
        'What to replace it with
        .Replacement.Text = "^p"
        .MatchWildcards = False
        .Wrap = wdFindStop
        .Format = False
        .Forward = True
        While .Execute
           Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
           rng.Collapse Word.WdCollapseDirection.wdCollapseEnd
        Wend
    End With

    'search for bullet1s with full stops
    Print #FileNum, "Removed Bullet 1s on Section:Page:"
    Set rng = doc.Content
    With rng.Find
        .ClearFormatting
        .Style = ActiveDocument.Styles("Bullet 1")
        .Replacement.ClearFormatting
        .Text = ".^p"
        .Replacement.Text = ".^p"
        .Forward = True
        .Wrap = wdFindStop
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        While .Execute
           Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
           rng.Collapse Word.WdCollapseDirection.wdCollapseEnd
           Wend
        End With

               'search for bullet2s with full stops
    Print #FileNum, "Removed Bullet 2s on Section:Page:"
    Set rng = doc.Content
    With rng.Find
        .ClearFormatting
        .Style = ActiveDocument.Styles("Bullet 2")
        .Replacement.ClearFormatting
        .Text = ".^p"
        .Replacement.Text = ".^p"
        .Forward = True
        .Wrap = wdFindStop
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        While .Execute
           Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
           rng.Collapse Word.WdCollapseDirection.wdCollapseEnd
        Wend
    End With

    Dim myStoryRange As Range

        Print #FileNum, "Replaced Rev. No's on Section:Page:"
        For Each myStoryRange In ActiveDocument.StoryRanges
        With myStoryRange.Find
            .Text = "Rev. ^?^?.^?^?"
            .Replacement.Text = "Rev. " & sword
            .Wrap = wdFindStop
            While .Execute
           Print #FileNum, myStoryRange.Information(wdActiveEndSectionNumber) & ":" & myStoryRange.Information(wdActiveEndAdjustedPageNumber)
           Wend
        End With
        Do While Not (myStoryRange.NextStoryRange Is Nothing)
            Set myStoryRange = myStoryRange.NextStoryRange
            With myStoryRange.Find
                .Text = "Rev. ^?^?.^?^?"
                .Replacement.Text = "Rev. " & sword
                .Wrap = wdFindStop
                While .Execute
                Print #FileNum, myStoryRange.Information(wdActiveEndSectionNumber) & ":" & myStoryRange.Information(wdActiveEndAdjustedPageNumber)
                Wend
            End With
        Loop
    Next myStoryRange

ERRORHANDLER:
    If Err.Number <> 0 Then
        MsgBox Err.Number & vbCr & Err.Description, vbCritical
        Err.Clear
    Else
        MsgBox "Action Complete"
    End If
    If FileNum <> 0 Then Close #FileNum

End Sub

And this part is not working as intended, although if I remove the while loop and instead have .Execute Replace:=wdReplaceAll it works as intended without any reporting.
    Dim myStoryRange As Range

        Print #FileNum, "Replaced Rev. No's on Section:Page:"
        For Each myStoryRange In ActiveDocument.StoryRanges
        With myStoryRange.Find
            .Text = "Rev. ^?^?.^?^?"
            .Replacement.Text = "Rev. " & sword
            .Wrap = wdFindStop
            While .Execute
           Print #FileNum, myStoryRange.Information(wdActiveEndSectionNumber) & ":" & myStoryRange.Information(wdActiveEndAdjustedPageNumber)
           Wend
        End With
        Do While Not (myStoryRange.NextStoryRange Is Nothing)
            Set myStoryRange = myStoryRange.NextStoryRange
            With myStoryRange.Find
                .Text = "Rev. ^?^?.^?^?"
                .Replacement.Text = "Rev. " & sword
                .Wrap = wdFindStop
                While .Execute
                Print #FileNum, myStoryRange.Information(wdActiveEndSectionNumber) & ":" & myStoryRange.Information(wdActiveEndAdjustedPageNumber)
                Wend
            End With
        Loop
    Next myStoryRange

Any help is appreciated.

A: Try something like this:
Dim doc As Word.Document
Dim rng As Word.Range
Dim Sec As Word.Section
Dim HF As Word.HeaderFooter

Set doc = ActiveDocument
For Each Sec In doc.Sections
    For Each HF In Sec.Footers
        If HF.LinkToPrevious = False Then
            Set rng = HF.Range
            With rng.Find
                .ClearFormatting
                .Text = "Rev. ^?^?.^?^?"
                .Forward = True
                .Wrap = wdFindStop
                .MatchWildcards = True
                .Execute
                If .found Then
                    rng.Text = "New Rev Text"
                    Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
                End If
            End With
        End If
    Next
Next

Edit: by Original question poster
I have created a seperate macro just for this example, using the code above.
Sub RevReplacer()

Dim doc As Word.Document
Dim rng As Word.Range
Dim Sec As Word.Section
Dim HF As Word.HeaderFooter
Dim oFile As String
sword = InputBox("Enter the Rev. no.", "Rev. No.", "")
Set doc = ActiveDocument

FileNum = FreeFile()
oFile = doc.Path & "\AuthorTec_Edits.txt"
If Dir(oFile, vbNormal) <> vbNullString Then
Kill oFile
End If

Open oFile For Append As #FileNum
For Each Sec In doc.Sections
    For Each HF In Sec.Footers
        If HF.LinkToPrevious = False Then
            Set rng = HF.Range
            With rng.Find
                .ClearFormatting
                .Text = "Rev. ^?^?.^?^?"
                .Forward = True
                .Wrap = wdFindStop
                .MatchWildcards = False
                .Execute
                If .Found Then
                    rng.Text = "rev. " & sword
                    Print #FileNum, rng.Information(wdActiveEndSectionNumber) & ":" & rng.Information(wdActiveEndAdjustedPageNumber)
                End If
            End With
        End If
    Next
Next

End Sub

It correctly performs the replace, but still doesn't print anything at all to the text file, I feel like i'ts calling the wrong objects with the print function?
@RichMichaels Response ...
Remove the If HF.LinkToPrevious ... statement and also remove the closing End If. For some unknown reason, this is causing the routine to skip First Page Only and Even Page Footers.
Change the Print statement to something like the following:
Print #FileNum, "Section " & Sec.Index & " Revision Date Changed Page: " & HF.Index


text:
Q: ggplot using facet_wrap of multiple data.frame with different length in R? I am trying to achieve the attached hand drawn figure using the code below but its showing white spaces for all the years that i do not have data for. Any help would be appreciated.
library(lubridate)
library(tidyverse)

set.seed(123)

D1 <- data.frame(Date = seq(as.Date("2001-07-14"), to= as.Date("2001-07-21"), by="day"),
           A = runif(8, 0,10),
           D = runif(8,5,15)) %>%
    gather(-Date, key = "Variable", value = "Value")

D2 <- data.frame(Date = seq(as.Date("1998-07-14"), to= as.Date("1998-08-30"), by="day"),
                 A = runif(48, 0,10),
                 D = runif(48,5,15)) %>%
    gather(-Date, key = "Variable", value = "Value")

D <- bind_rows(D1,D2) %>% mutate(Year = year(Date))

my_linetype <- setNames(c("dashed", "solid"), unique(D$Year))

ggplot(data = D, aes(x = Date, y = Value, color = as.factor(Year), linetype = as.factor(Year)))+
  geom_line(size = 1.1)+ facet_wrap(~Variable,  scales = "free_y", nrow=2)

Desired Out

A: You can make a dummy Date variable in your data.frame where the year is equal among different groups. In the example below this added in the mutate() statement under the Unyear variable.
D <- bind_rows(D1,D2) %>% mutate(Year = year(Date),
                                 Unyear = {year(Date) <- 0; Date})

my_linetype <- setNames(c("dashed", "solid"), unique(D$Year))

ggplot(data = D, aes(x = Unyear, y = Value, color = as.factor(Year), linetype = as.factor(Year)))+
  geom_line(size = 1.1)+ facet_wrap(~Variable,  scales = "free_y", nrow=2)


text:
Q: Passing variable 'chart' from controller to view I am trying to create charts on my application. I have the following error when I am trying to pass a variable to a view:

Undefined variable: chart (View:
  /Users/ZK/Desktop/project/resources/views/home.blade.php)

I have pasted my controller code below;
<?php

namespace App\Http\Controllers\Admin;

use Charts;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class DashboardController extends Controller
{
    public function index()
    {
        $chart = Charts::new('link', 'highcharts')
            ->setTitle("My Chart")
            ->setLabels("A", "B", "C")
            ->setValues([100, 50, 25])
            ->setElementLabel(["Total Users"]);

        return view('home', [ 'chart' => $chart ]);

    }

home.blade.php code;
@extends('layouts.app')

@section('content')

Dashboard

                    {!! $chart->render() !!}

@endsection

Within my layouts.app I have also added the assets for my chart in the header;
 {!! Charts::assets() !!}

Can anyone suggest what I might be doing wrong?
Thanks


text:
Q: How to set a specific height/width for all elements in a WPF grid? I have a custom ListBox where each item has a Grid defined where I display boxes. I can set the widths to be the same length by using the SharedSizeGroup property. However, how do I share this property for all these items within the parent ListBox element?
I tried setting the property on the ListBox element also but this did not work.
<ListBox
    ItemContainerStyle="{StaticResource MyStyle}"...>

<Style x:Key="MyStyle" TargetType="ListBoxItem">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="ListBoxItem">
                <Grid Grid.IsSharedSizeScope="True">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" SharedSizeGroup="Box" />
                        <ColumnDefinition Width="Auto" SharedSizeGroup="Box" />
                        <ColumnDefinition Width="Auto" SharedSizeGroup="Box" />
                    </Grid.ColumnDefinitions>
                    <Border Grid.Column="0">
                        <TextBlock Text="{Binding PropertyA}" />
                    </Border>
                    <Border Grid.Column="1">
                        <TextBlock Text="{Binding PropertyB}" />
                    </Border>
                    <Border Grid.Column="2">
                        <TextBlock Text="{Binding PropertyC}" />
                    </Border>
                </Grid>

A: Instead of setting property Grid.IsSharedSizeScope="True" on Grid, set it on Listbox like this -
 <ListBox Grid.IsSharedSizeScope="True">

and remove it from the Grid.
This will make all the listboxItems to share the same size instead for an individual item.


text:
Q: Unfortunately app has stopped working on Android emulator I've already tried Jack instructions but I'm still getting this error
I've posted new logcat below
05-28 21:10:08.603: A/GmsApplication(3335): Unable to install secure provider, due to exception:
05-28 21:10:08.603: A/GmsApplication(3335): java.lang.SecurityException: attempting to read gservices without permission: Neither user 10007 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.
05-28 21:10:08.603: A/GmsApplication(3335):     at android.app.ContextImpl.enforce(ContextImpl.java:1914)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1943)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.content.ContextWrapper.enforceCallingOrSelfPermission(ContextWrapper.java:600)
05-28 21:10:08.603: A/GmsApplication(3335):     at com.google.android.gsf.e.c(SourceFile:107)
05-28 21:10:08.603: A/GmsApplication(3335):     at com.google.android.gms.common.security.ProviderInstallerImpl.insertProviderGated(SourceFile:90)
05-28 21:10:08.603: A/GmsApplication(3335):     at com.google.android.gms.common.app.GmsApplication.onCreate(SourceFile:85)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1012)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4556)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.app.ActivityThread.access$1500(ActivityThread.java:151)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.os.Handler.dispatchMessage(Handler.java:102)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.os.Looper.loop(Looper.java:135)
05-28 21:10:08.603: A/GmsApplication(3335):     at android.app.ActivityThread.main(ActivityThread.java:5257)
05-28 21:10:08.603: A/GmsApplication(3335):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
05-28 21:10:08.603: A/GmsApplication(3335):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
05-28 21:10:08.940: E/AndroidRuntime(3335): FATAL EXCEPTION: main
05-28 21:10:08.940: E/AndroidRuntime(3335): Process: com.google.android.gms.persistent, PID: 3335
05-28 21:10:08.940: E/AndroidRuntime(3335): java.lang.RuntimeException: Unable to create service com.google.android.location.internal.GoogleLocationManagerService: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10007 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2774)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.app.ActivityThread.access$1800(ActivityThread.java:151)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1386)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.os.Handler.dispatchMessage(Handler.java:102)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.os.Looper.loop(Looper.java:135)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.app.ActivityThread.main(ActivityThread.java:5257)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at java.lang.reflect.Method.invoke(Native Method)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at java.lang.reflect.Method.invoke(Method.java:372)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
05-28 21:10:08.940: E/AndroidRuntime(3335): Caused by: java.lang.SecurityException: attempting to read gservices without permission: Neither user 10007 nor current process has com.google.android.providers.gsf.permission.READ_GSERVICES.
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.app.ContextImpl.enforce(ContextImpl.java:1914)
05-28 21:10:08.940: E/AndroidRuntime(3335):     at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1943)
05-28 21:10:08.940: E/AndroidRuntime(3335):     ... 9 more
05-28 21:10:16.483: E/libEGL(934): called unimplemented OpenGL ES API
05-28 21:10:16.483: E/SurfaceFlinger(934): glCheckFramebufferStatusOES error 1395899833
05-28 21:10:16.483: E/SurfaceFlinger(934): got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot

A: The exception details are clearly mentioned in the logcat like
 The meta-data tag in your app's AndroidManifest.xml does not have the right value.  Expected 7327000 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

Change your manifest meta-data tag according to the above details.

A: insert your manifest file
 <activity
        android:name=".Yourclassname"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="7327000" />

A: You must have the following
 declaration within the AndroidManifest. Xml
<application> element: <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

It is said in the logcat


text:
Q: Soap php Microsoft Dynamics crm online 2011 i'm having errors using nusoap to talk to microsoft dynamics crm online 2011.
This is some debug info
 Error: wsdl error: Getting https://testserver2013.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0 - HTTP ERROR: no proper separation of headers and document

Debug

2013-02-22 09:13:58.670652 nusoap_client: ctor wsdl=wsdl timeout=0 response_timeout=30
endpoint=string(16) "organization.xml"
2013-02-22 09:13:58.676050 nusoap_client: will use lazy evaluation of wsdl from organization.xml
2013-02-22 09:13:58.676090 nusoap_client: setCredentials username=testserver2013.onmicrosoft.com\matthewhudghton authtype=ntlm certRequest=
array(0) {
}
2013-02-22 09:13:58.676141 nusoap_client: setUseCURL(1)
2013-02-22 09:13:58.676169 nusoap_client: useHTTPPersistentConnection
2013-02-22 09:13:58.676367 nusoap_client: call: operation=Create, namespace=http://schemas.microsoft.com/crm/2007/WebServices, soapAction=http://schemas.microsoft.com/crm/2007/WebServices/Create, rpcParams=, style=rpc, use=encoded, endpointType=wsdl
params=string(223) "<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"></soap:Envelope>"
headers=array(3) {
  ["SOAPAction"]=>
  string(56) "http://schemas.microsoft.com/crm/2007/WebServices/Create"
  ["Content-Type"]=>
  string(23) "text/xml; charset=utf-8"
  ["Content-Length"]=>
  int(1095)
}
2013-02-22 09:13:58.676435 nusoap_client: instantiating wsdl class with doc: organization.xml
2013-02-22 09:13:58.676539 wsdl: ctor wsdl= timeout=0 response_timeout=30
2013-02-22 09:13:58.676578 wsdl: parse and process WSDL path=
2013-02-22 09:13:58.676632 wsdl: setCredentials username=testserver2013.onmicrosoft.com\matthewhudghton authtype=ntlm certRequest=
array(0) {
}
2013-02-22 09:13:58.676679 wsdl: parse and process WSDL path=organization.xml
2013-02-22 09:13:58.676713 wsdl: parse WSDL at path=organization.xml
2013-02-22 09:13:58.676785 wsdl: getting WSDL file organization.xml
2013-02-22 09:13:58.693021 wsdl: Parse WSDL
2013-02-22 09:13:58.708375 wsdl: parsing import http://schemas.microsoft.com/xrm/2011/Contracts/Services - https://testserver2013.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0 (1)
2013-02-22 09:13:58.708615 wsdl: current service: OrganizationService
2013-02-22 09:13:58.708834 wsdl: current port: CustomBinding_IOrganizationService
2013-02-22 09:13:58.709290 wsdl: Parsing WSDL done
2013-02-22 09:13:58.709414 wsdl: parse WSDL at path=https://testserver2013.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0
2013-02-22 09:13:58.709482 wsdl: getting WSDL http(s) URL https://testserver2013.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0
2013-02-22 09:13:58.709646 soap_transport_http: ctor url=https://testserver2013.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0 use_curl=1 curl_options:
array(0) {
}
2013-02-22 09:13:58.709750 soap_transport_http: parsed URL scheme = https
2013-02-22 09:13:58.709814 soap_transport_http: parsed URL host = testserver2013.api.crm4.dynamics.com
2013-02-22 09:13:58.709865 soap_transport_http: parsed URL path = /XRMServices/2011/Organization.svc
2013-02-22 09:13:58.709916 soap_transport_http: parsed URL query = wsdl=wsdl0
2013-02-22 09:13:58.709984 soap_transport_http: set header Host: testserver2013.api.crm4.dynamics.com
2013-02-22 09:13:58.710126 soap_transport_http: set header User-Agent: NuSOAP/0.9.5 (1.123)
2013-02-22 09:13:58.710205 soap_transport_http: setCredentials username=testserver2013.onmicrosoft.com\matthewhudghton authtype=ntlm digestRequest=
array(0) {
}
2013-02-22 09:13:58.710270 soap_transport_http: certRequest=
array(0) {
}
2013-02-22 09:13:58.710334 soap_transport_http: Authorization header not set for ntlm
2013-02-22 09:13:58.710398 soap_transport_http: set header Accept-Encoding: gzip, deflate
2013-02-22 09:13:58.710452 soap_transport_http: set header Connection: close
2013-02-22 09:13:58.710512 soap_transport_http: entered send() with data of length: 0
2013-02-22 09:13:58.710583 soap_transport_http: connect connection_timeout 0, response_timeout 30, scheme https, host testserver2013.api.crm4.dynamics.com, port 443
2013-02-22 09:13:58.710662 soap_transport_http: connect using cURL
2013-02-22 09:13:58.750685 soap_transport_http: setCurlOption option=10002, value=
string(93) "https://testserver2013.api.crm4.dynamics.com:443/XRMServices/2011/Organization.svc?wsdl=wsdl0"
2013-02-22 09:13:58.750843 soap_transport_http: setCurlOption option=52, value=
int(1)
2013-02-22 09:13:58.750920 soap_transport_http: setCurlOption option=42, value=
int(1)
2013-02-22 09:13:58.750993 soap_transport_http: setCurlOption option=19913, value=
int(1)
2013-02-22 09:13:58.751065 soap_transport_http: setCurlOption option=13, value=
int(30)
2013-02-22 09:13:58.751133 soap_transport_http: set cURL SSL verify options
2013-02-22 09:13:58.751186 soap_transport_http: setCurlOption option=64, value=
int(0)
2013-02-22 09:13:58.751255 soap_transport_http: setCurlOption option=81, value=
int(0)
2013-02-22 09:13:58.751326 soap_transport_http: set cURL username/password
2013-02-22 09:13:58.751385 soap_transport_http: setCurlOption option=10005, value=
string(62) "testserver2013.onmicrosoft.com\matthewhudghton:fakepassword"
2013-02-22 09:13:58.751519 soap_transport_http: set cURL for NTLM authentication
2013-02-22 09:13:58.751574 soap_transport_http: setCurlOption option=107, value=
int(8)
2013-02-22 09:13:58.751644 soap_transport_http: cURL connection set up
2013-02-22 09:13:58.751721 soap_transport_http: HTTP request: GET /XRMServices/2011/Organization.svc?wsdl=wsdl0 HTTP/1.1
2013-02-22 09:13:58.751791 soap_transport_http: HTTP header: Host: testserver2013.api.crm4.dynamics.com
2013-02-22 09:13:58.751845 soap_transport_http: HTTP header: User-Agent: NuSOAP/0.9.5 (1.123)
2013-02-22 09:13:58.751897 soap_transport_http: HTTP header: Accept-Encoding: gzip, deflate
2013-02-22 09:13:58.751950 soap_transport_http: HTTP header: Connection: close
2013-02-22 09:13:58.752017 soap_transport_http: Skip cURL header Host: testserver2013.api.crm4.dynamics.com
2013-02-22 09:13:58.752091 soap_transport_http: Skip cURL header Connection: close
2013-02-22 09:13:58.752145 soap_transport_http: setCurlOption option=10023, value=
array(2) {
  [0]=>
  string(32) "User-Agent: NuSOAP/0.9.5 (1.123)"
  [1]=>
  string(30) "Accept-Encoding: gzip, deflate"
}
2013-02-22 09:13:58.752243 soap_transport_http: set cURL HTTP headers
2013-02-22 09:13:58.752369 soap_transport_http: set cURL payload
2013-02-22 09:13:58.752444 soap_transport_http: send and receive with cURL
2013-02-22 09:14:09.725981 soap_transport_http: No cURL error, closing cURL
2013-02-22 09:14:09.726600 soap_transport_http: Found HTTP header to skip
2013-02-22 09:14:09.726673 soap_transport_http: Found HTTP header to skip
2013-02-22 09:14:09.726727 soap_transport_http: no proper separation of headers and document
2013-02-22 09:14:09.726758 soap_transport_http: end of send()
2013-02-22 09:14:09.726804 wsdl: Getting https://testserver2013.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0 - HTTP ERROR: no proper separation of headers and document
2013-02-22 09:14:09.726898 nusoap_client: checkWSDL
2013-02-22 09:14:09.726932 nusoap_client: got wsdl error: Getting https://testserver2013.api.crm4.dynamics.com/XRMServices/2011/Organization.svc?wsdl=wsdl0 - HTTP ERROR: no proper separation of headers and document
string(0) ""

And this is my current code:
   <?php
require_once('lib/nusoap.php');

$login ='testserver2013.onmicrosoft.com\matthewhudghton'; // crm login name
$pass ='fakepassword';
$useCURL = 1;

$client = new nusoap_client("organization.xml", 'wsdl');
$client->setCredentials($login, $pass, 'ntlm');
$err = $client->getError();
if ($err) {
echo '
Constructor error

' . $err . '
';
echo '
Debug

' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '
';
exit();
}
$client->setUseCurl($useCURL);
$client->useHTTPPersistentConnection();

// Prepare values for the new contact.
$firstname = "112";
$lastname = "123";
$donotbulkemail = "true";
$address1_stateorprovince = "MT";
$address1_postalcode = "99999";
$address1_line1 = "23 Market St.";
$address1_city = "Sammamish";

// This exact header was recieved from GenerateAuthenticationHeader() JScript function.
$authenticationHeader = '<soap:Header><CrmAuthenticationToken xmlns="http://schemas.microsoft.com/crm/2007/WebServices"><AuthenticationType xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">1</AuthenticationType><OrganizationName xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">personal</OrganizationName><CallerId xmlns="http://schemas.microsoft.com/crm/2007/CoreTypes">00000000-0000-0000-0000-000000000000</CallerId></CrmAuthenticationToken></soap:Header>';

// Prepare the SOAP message.
$xml = "<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" .  $authenticationHeader . "<soap:Body><Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'><entity xsi:type='contact'><address1_city>" . $address1_city . "</address1_city>" .  "<address1_line1>" . $address1_line1 . "</address1_line1>" .  "<address1_postalcode>" . $address1_postalcode . "</address1_postalcode>" .  "<address1_stateorprovince>" . $address1_stateorprovince . "</address1_stateorprovince>" .  "<donotbulkemail>" . $donotbulkemail . "</donotbulkemail>" .  "<firstname>" . $firstname . "</firstname>" .  "<lastname>" . $lastname . "</lastname>" .  "</entity>" .  "</Create>" .  "</soap:Body>" .  "</soap:Envelope>";

$headers = array('SOAPAction' => 'http://schemas.microsoft.com/crm/2007/WebServices/Create', 'Content-Type' => 'text/xml; charset=utf-8', 'Content-Length' => strlen($xml));

$xml = '<?xml version="1.0" encoding="utf-8"?>' .
    '<soap:Envelope' .
        ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' .
        ' xmlns:xsd="http://www.w3.org/2001/XMLSchema"' .
        ' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' .
    $soapHeader .
    $soapBody .
    '</soap:Envelope>';

//SOAP call
$result = $client->call('Create', $xml, 'http://schemas.microsoft.com/crm/2007/WebServices', 'http://schemas.microsoft.com/crm/2007/WebServices/Create', $headers);

if ($client->fault) {
    echo '
Fault: ';
    print_r($result);
    echo '
';
} else {
    // Check for errors
    $err = $client->getError();
    if ($err) {
        // Display the error
        echo '
Error: ' . $err . '
';
        echo '
Debug

' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '
';
    } else {
        // Display the result
        print_r($result);
    }
}

var_dump($client->response);

?>

any ideas? Not sure what "HTTP ERROR: no proper separation of headers and document" but feel it may just be because itas failing to authenticate for some reason.
Is my username in the correct format?
Thanks


text: Q: Kafka: Producing files continuously and consuming them into files I'm new to Kafka and I'm writing an application which reads files from a directory continuously (Files are scp'd into this directory continuously) and produce them to one topic and on the consumer side, they have to be put into different files just like the source had. How do I go about this? Thank you in advance!


text:
Q: Difference Between Media Plugin and Media Capture Plugin I want to record audio from user using cordova. On research I found two plugins which seems to do the job. First media plugin and other media capture plugin. Now my question is can I record audio from both plugin or the media plugin is only for recording from existing audio file? If I can do recording from both which one should I use?

A: The function media.startRecord from the media plugin allows to record audio from within your application whereas the function capture.captureAudio from media capture plugin will start the default audio capture app of your device and let you access the recorded data once you exit that app.
So with media plugin the user will stay in your UI and with media capture plugin the user will switch from your app to a capture app and back to your app.


text:
Q: Bootstrap popover with grails and ajax just trying to use ajax formRemote in a BS popover.
A simple form works, but the ajax implementation not:
1)  gsp code

            <%--<g:message code="folder"  args="[entityName]" default="New Folder"/>--%>

        <form class="form-inline" style="width:280px;">
        <g:formRemote name="createRootFolder" url="[controller:'folders',action:'create']" onLoading="showModalSpinnerNewFolder();" onComplete="hideModalSpinnerNewFolder();" onSuccess="doResponseNewFolder(data);" >
              <g:textField  name="folderName" class="input-small" type="text" placeholder="New folder"/>
              <input type="submit" value="Create" class="btn btn-info" />
              Cancel
        </g:formRemote>
</g:formRemote>
    </form>

2) Popover call with jquery
$('#nrfolder').popover({placement:'right',title:'New Root Folder',html:true,content: function() { return $('#newRootFolder').html();} });

3) jquery success event: doResponseNewFolder function
function doResponseNewFolder(data) {
        alert('toto' + data.success);
        if (data.success == 'true') {
            var msg = data.msg;
            // reload tree view
            $('#tree').dynatree('getTree').reload();
        } else {
            var msg = $('
');
            for (var i = 0; i < data.errorList.length; i++) {
                msg.append('
' + data.errorList[i] + "
");
            }
        }
        $('#new_folder_msg').html(msg);
        $('#new_folder_msg').show();
    }

Any idea?

A: It seems you're messing up with forms, let me explain: Grails' g:formRemote is a helper for making ajax web forms, so if you look at the resulting HTML there will be a form generated at the call.
The fact is that you already opened a form, which isn't valid HTML syntax. That first form should not exist. You can give its attributes to your g:formRemote though and Grails will pass them to your generated form:
<g:formRemote class="form-inline" style="width:280px;" name="createRootFolder" url="[controller:'folders',action:'create']" onLoading="showModalSpinnerNewFolder();" onComplete="hideModalSpinnerNewFolder();" onSuccess="doResponseNewFolder(data);" >
      <g:textField  name="folderName" class="input-small" type="text" placeholder="New folder"/>
      <input type="submit" value="Create" class="btn btn-info" />
      Cancel
</g:formRemote>

This, with no other forms imbricated, will be enough.


text:
Q: use d3js to update text in div tag In the html, I labeled a div tag

Head count:

My goal is to update the count according to user driven events. In the js file, I have
d3.select('#count')
  .append('text')
  .text(users.length);

Here users.length changes upon user driven events. This is not what I want though. What I want is not 'append' but 'update' the text. How can I achieve that?

A: You could use the text() function on the #count selector.
d3.select('#count')
    .text('Head Count: ' + users.length);

A:

setTimeout(function(){
  d3.select('#count')
  .html("Head count: 10; Updated");
},500);

Head count:


text:
Q: Android Null Pointer Exception on Spinner The code Below worded just fine to get my spinner to change the Selection on specific items, however as I started Android Studio today it gives me a NullPointerException:
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new MainFragment())
                .commit();
    }

    final Spinner spinnercurent = (Spinner)findViewById(R.id.spinnerCurrentStation);
    //this line produces the error
    spinnercurent.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {

            if (id == 0) {
                spinnercurent.setSelection(1);
            } else if (id == 20) {
                spinnercurent.setSelection(21);
            } else if (id == 41) {
                spinnercurent.setSelection(42);
            } else if (id == 63) {
                spinnercurent.setSelection(64);
            } else if (id == 84) {
                spinnercurent.setSelection(85);
            }

            StationName = spinnercurent.getSelectedItem().toString();
            Log.d("Output", StationName);

        }

        @Override
        public void onNothingSelected(AdapterView<?> parentView) {

        }

    });

The XML:
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/scrollView"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="0dp"
    android:layout_alignParentTop="true"
    android:layout_marginTop="0dp">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="@string/akt_stat"
            android:id="@+id/textViewNext" />

        <Spinner
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/spinnerCurrentStation"
            android:spinnerMode="dialog"
            android:entries="@array/ubahn_stationen_alle"
            android:paddingLeft="20dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="@string/ubahn_richtung"
            android:id="@+id/textViewLinie"
            android:paddingTop="20dp" />

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/button"
            android:id="@+id/button"
            android:onClick="onButtonLineClick" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="@string/ubahn_station"
            android:id="@+id/textViewRechtsLinks"
            android:paddingTop="20dp" />

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/button"
            android:id="@+id/button2"
            android:onClick="onButtonStationClick" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="@string/direction"
            android:id="@+id/textView"
            android:paddingTop="20dp" />

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/button"
            android:id="@+id/button3"
            android:onClick="onButtonDirectionClick" />
    </LinearLayout>
</ScrollView>
</RelativeLayout>

And here is the LogCat Message
Process: at.trumpstuff.parkour, PID: 4260
java.lang.RuntimeException: Unable to start activity ComponentInfo{at.trumpstuff.parkour/at.trumpstuff.parkour.MainActivity}: java.lang.NullPointerException
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2215)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
        at android.app.ActivityThread.access$800(ActivityThread.java:145)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:136)
        at android.app.ActivityThread.main(ActivityThread.java:5081)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:515)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:781)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
        at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.NullPointerException
        at at.trumpstuff.parkour.MainActivity.onCreate(MainActivity.java:35)
        at android.app.Activity.performCreate(Activity.java:5231)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2265)
            at android.app.ActivityThread.access$800(ActivityThread.java:145)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1206)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5081)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)

A: spinnerCurrentStation has the right id as a parameter of findView method. It is probably a reference error. Try to clean your project and re create the references.


text:
Q: Compare String without Case Sensitivity Check I am trying to compare my string like below.
$recieved = "SR1";
if ($recieved == "SR1" || $recieved == "SR2"|| $recieved == "SR3"|| $recieved == "SR4"){
    echo "matching";
}
else{
    echo "not matching";
}

This is working fine but I want to ignore case sensitivity checking like below
sr1
Sr1
sR1

I don't have idea how can i achieve this?

A: So you could achieve that by using strtoupper function, also, I would suggest to use in_array like so:
$recieved = "SR1";
if (in_array(strtoupper($recieved), ['SR1', 'SR2', 'SR3', 'SR4'])) {
    echo "matching";
} else {
    echo "not matching";
}

I hope that works well for you.

A: We can try using preg_match in case insensitive mode:
$received = "sR1";
if (preg_match("/sr1/i", $received, $matches)) {
    echo "match";
}

This approach would also be a good starting point if you might have the need to match sR1, SR1, etc., as it appears inside a larger string.  In that case, we could try searching for \bsr1\b using preg_match in case insensitive mode.


text:
Q: React forms change I'm trying to create a form that when I click a button, after replace with another form. I tried to use "Link to" for this, but after click the button the another form appears inside the first form. How to change my code to correct this?
My App.js:
import React, { Component } from 'react';
import './App.css';
import Login from "./Login";

class App extends Component {
  render() {
    return (

        <Login />

    );
  }
}

export default App;

My Login.js:
import React from 'react';
import CreateUser from "./CreateUser";
import GetUser from "./GetUser";
import { BrowserRouter as Router, Link, Route} from 'react-router-dom';

export default class Login extends React.Component {
  state = {
    email: '',
    password: '',
  };

  change = e => {
    this.setState({
      [e.target.name]: e.target.value
    });
  };

  onSubmit = (e) => {
    e.preventDefault();
    console.log(this.state);
  };

  render() {
    return (
      <form>

        Login

        <input
        name="email"
        placeholder='email'
        value={this.state.email}
        onChange={e => this.change(e)}
        />

        <input
        name="password"
        type='password'
        placeholder='password'
        value={this.state.password}
        onChange={e => this.change(e)}
        />

        <Router>

        <button onClick={e => this.onSubmit(e)}>
        <Link to="/GetUser">Login</Link>
        <Route exact path="/GetUser" component={GetUser}/>
        </ button>

        <button onClick={e => this.onSubmit(e)}>
        <Link to="/CreateUser">Sign Up</Link>
        <Route exact path="/CreateUser" component={CreateUser}/>
        </button>

        </Router>
  </form>
    );
  }
}

When I click Login button, GetUser form appears inside the Login form, but I want the GetUser form to replace Login form.
Thx all,
Eduardo Gris

A: The Route renders exactly where you put it in the component.  When it finds a match it replaces the Route with the component GetUser.  So whereever you want the GetUser to render is where you define the route.  There is no need to colocate Links and Routes as you are doing.
So for a common layout with a view that gets replaced with different components that view should be represented as a Switch and the first route that matches will be rendered: https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Switch.md
In your case you need a parent component that has a switch statement that renders login as well as the other routes, you don't want to try to do everything in the Login component.


text:
Q: How to build and include a 3rd party C library in Xcode 6.0 I'm trying to build a 3rd party C library and include it in my project. The library is the Swiss Ephemeris and I'm trying to use the preconfigured Xcode project here https://github.com/dwlnetnl/SwissEphemeris.
I can get the framework to build properly, but I don't know how to include it in my project. Ideally, I want to store the framework within the project so that I can commit it to a repository and have developers check out the file, and build the project without the need to have the framework installed locally first. I'm not sure if that's possible?
So, if someone can explain:

*

*How to include the built framework into my project

*How to 'embed' it
within the project so that the framework can be stored within the
project.

it would be greatly appreciated.

A: Static libraries are unsupported in Swift 1. You can use Objective-C to call the library.


text:
Q: How can i Wrap a list of Widgets?  I have this but when i show on the screen, it shows everything in vertical no wrap. and i need it to show like a row everything. i am creating a list of widgets first with all the information that i need for presenting the information with a wrap widget but went i take the list it shows all the information but no wraping.
Widget _calcularPrecios(int i, double valor) {
      double trimestral = valor *3;
      double semestral = trimestral *2;
      double anual = semestral *2;
      double contado = anual-anual*0.12;
      if(i==1) {
        return Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: 5,
              height: 50,
              color: Color(0xFF1BB394),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Color(0xFFE0F7FA)
              ),
              width: 120,
              height: 50,
              child: Padding(
                padding: const EdgeInsets.only(left: 10.0),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text('Mensual', style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.bold),),
                    Text('\$'+valor.toStringAsFixed(2), style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.w500))
                  ],
                ),
              ),
            )
          ],
        );
      }else if(i==2) {
        return Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: 5,
              height: 50,
              color: Color(0xFF1BB394),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Color(0xFFE0F7FA)
              ),
              width: 120,
              height: 50,
              child: Padding(
                padding: const EdgeInsets.only(left: 10.0),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text('Trimestral', style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.bold),),
                    Text('\$'+trimestral.toStringAsFixed(2), style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.w500))
                  ],
                ),
              ),
            )
          ],
        );
      }else if(i==3) {
        return Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: 5,
              height: 50,
              color: Color(0xFF1BB394),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Color(0xFFE0F7FA)
              ),
              width: 120,
              height: 50,
              child: Padding(
                padding: const EdgeInsets.only(left: 10.0),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text('Semestral', style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.bold),),
                    Text('\$'+semestral.toStringAsFixed(2), style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.w500))
                  ],
                ),
              ),
            )
          ],
        );
      }else if(i==4) {
        return Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: 5,
              height: 50,
              color: Color(0xFF1BB394),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Color(0xFFE0F7FA)
              ),
              width: 120,
              height: 50,
              child: Padding(
                padding: const EdgeInsets.only(left: 10.0),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text('Anual', style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.bold),),
                    Text('\$'+anual.toStringAsFixed(2), style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.w500))
                  ],
                ),
              ),
            )
          ],
        );
      }else if(i==5) {
        return Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              width: 5,
              height: 50,
              color: Color(0xFF1BB394),
            ),
            Container(
              decoration: BoxDecoration(
                  color: Color(0xFFE0F7FA)
              ),
              width: 120,
              height: 50,
              child: Padding(
                padding: const EdgeInsets.only(left: 10.0),
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text('Contado', style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.bold),),
                    Text('\$'+contado.toStringAsFixed(2), style: TextStyle(
                        fontSize: 15, fontWeight: FontWeight.w500))
                  ],
                ),
              ),
            )
          ],
        );
      }
    }

    List <Widget> _calcular(double valor){
      List<Widget> temporal =[];
      for(var i = 1; i<6;i++){
        temporal.add(_calcularPrecios(i,valor));
      }
      return temporal;
    }

(_calcular(valor).isNotEmpty)? Wrap(
                        children: _calcular(valor),
                      ): Center(child: Text('Presione boton calcular')),

A: I fixed the problem was that all the widgets in the list takes the size of the screen width
so all the rows in the list i put in a SizedBox


text:
Q: Exiting a thread in c I am currently working on a some C code, very new to C, so apologize if this is a bit basic or a stupid question.
I have the following code which is executed within a thread using pthread_create().
if (ps.status == completed)
        {
            LOG(LOG_AUDIO, "evsafewait_sm_play_tone:\tPlay tone complete");
            if (e2)
            {
                LOG(LOG_MUST, "Failed to free tone event. Result: %i", e2);
            }

            pccb->playToneComplete = 1;
            LOG(LOG_AUDIO, "Detatching thread ID %x", manageToneParms->toneManagerThread);
            //pthread_detach(manageToneParms->toneManagerThread);

            int retVal;
            pthread_exit(&retVal);
            LOG(LOG_AUDIO, "THREAD TERMINATED WITH RESULT %i", retVal);
            LOG(LOG_AUDIO, "Freeing memory");

            free(manageToneParms->playToneParms);
            free(manageToneParms);
            return 0;
        }

Before the structures are free and the method returns I am trying to exit the thread using pthread_exit() but when this is called, everything below it is skipped, no errors are displayed, as far as I can see anyway.
I have tried debugging it with GDB and when pthread_exit() is called the next thing it prints out is siglongjmp, I have no idea what this is, I don't believe it's in the C code, at least not in the changes that I have been making to it.
How can I exit this thread? I've also tried pthread_exit(NULL) and pthread_kill(threadID, SIGKILL) but then this kills the whole program not just the thread.

A: pthread_exit() returns from the thread at the point of the call. Any code after pthread_exit() will not be executed.
You should be sure to release any memory allocated in the thread before calling pthread_exit().
Have you tried something like this:?
int retVal;

/* free resources -- make sure all resources allocated in thread
   function are released
*/
free(manageToneParms->playToneParms);
free(manageToneParms);

LOG(LOG_AUDIO, "THREAD TERMINATED WITH RESULT %i", retVal);
LOG(LOG_AUDIO, "Freeing memory");
pthread_exit(&retVal);


text:
Q: using php code inside html page I have problem I use several php codes inside html page and it gave me wrong result like this code

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form</title>

<form method="post">

<input type="text" name="int1" />
+
<input type="text" name="int2" />
=
<?php
if (isset($_POST)) {
    $int1 = $_POST['int1'];
    $int2 = $_POST['int2'];
    echo $int1 + $int2;
}
?>

<input type="submit" value="Get Sum" />

</form>

the right result is calculate the numbers and display it here is no thing display
the other code

<?php for($i=1;$i<=5;$i++){ ?>

Menu Item <?php echo $i; ?>

<?php } ?>

the right result to display like this
Menu Item 1
Menu Item 2
Menu Item 3
Menu Item 4
Menu Item 5

but when I display the page just display like this
Menu Item

that is meaning the php code didn't work in the page
I don't know what is the solution I want to use php code and php functions inside html page
because phonegap.com not accept php page

A: You cannot run PHP in PhoneGap. PhoneGap loads a local html file in a native webview. You need to have PHP installed to run PHP and this not possible from a mobile device, even if you use native code.
You need to use JavaScript for the typr of processing you are looking for.

A: PHP code is processed only in PHP files ( files with .php extentions). If your file is .html, try to rename it. In your case the PHP not processed and you see anly first li.
Also I recommend to you set error_reporting = E_ALL in php.ini config and restart server. And then you will see what happened with your script
and better use:

<?php for ($i=1; $i<=5; $i++) : ?>

Menu Item <?php echo $i; ?>

<?php endfor; ?>

A: Your first code does not return anything because your isset is not set.
First code:
<?php
if (isset($_POST['int1']) && isset($_POST['int2'])) {
    $int1 = $_POST['int1'];
    $int2 = $_POST['int2'];
    echo $int1 + $int2;
}
?>

Second code:

<?php
for($a = 1; $a <=5; $a++){
echo "
Menu Item ".$a."
";
}
?>

A: EDIT: After closer inspection it looks as though your code is not being parsed, rename your index.html to index.php
If you view the source you can see the PHP code.

It could be your first section failing..
$_POST is always set but it can be empty
Try this
<?php
if (isset($_POST['int1'], $_POST['int2'])) {
    $int1 = $_POST['int1'];
    $int2 = $_POST['int2'];
    echo $int1 + $int2;
}
?>

isset() can take multiple arguments


text:
Q: Problem installing VMWare Tools on Linux Guest I am trying to install VMWare tools on a Fedora 10 guest (Windows Vista host) and running into problems. I am logged in as root. Upon attempting to install, I get a message saying "Guest operating system has locked CD-ROM...). Various forums recommend overriding this message so I did so but the system simply hangs. Anyhow, went to VMWare help (http://www.vmware.com/support/ws55/doc/ws_newguest_tools_linux.html) on this subject. In attempting to understand/resolve this mounting problem, I tried mount /dev/cdrom /mnt/cdrom upon which I get a message saying "block device /dev/sr0 is write protected mounting read only". Not sure if this is the cause of the problem. But now I am stuck and confused. Can anyone enlighten me on what all this means and how I can resolve this installation problem? Thanks much.
Just adding new details:  I have to be in text mode to install the tools. So, I did so. Logged in as root, did the umount. STILL get the cd locked message, override, and start getting a slew of SQUASHFS errors upon which things hang. If I try and quit the install do an ls (for example), I get input/output errors reported.
As suggested by someone, I downloaded open-vm-tools but when I do a ./configure, there is a whole slew of missing libraries I have been patiently trying to install (yum update hangs).  yum install gcc glib2-devel pam-* xorg-x11-* libX* uriparser* libpng* gtk+-devel. Now when I get to install gtk2-devel, I get a rpmdb bus error and all is shot. So, I install gcc-c++ (yes I am pulling threads now) and re-try. Now it does a successful transaction test, starts transaction and hangs. I am so far in that I don't want to give up, but I am at a loss as to what I need to be doing here because I cannot believe this install could be this convoluted (or is it?)

A: May I suggest trying open-vm-tools?  I've actually found them to be better than VMwares proprietary tools in most cases.

A: The message "block device /dev/sr0 is write protected mounting read only" is normal, it means that you can't write files on your CD-ROM with the current media.

A: It sounds like your Fedora 10 guest already has the CD-ROM mounted when you're trying to install the tools. Try this:

*

*Boot the guest normally.

*Logon as root and run the command "umount /dev/cdrom".

*In the VMware menu, attempt the guest installation.

Step 2 insures tht the CD-ROM isn't mounted and, as such, VMware should have no problem "inserting" the VMware tools ISO into the virtual CD-ROM.

A: Cancel the vmtools install from vmware(if it didn't do it automatically), do a: umount /dev/cdrom, disconnect any cdroms you have attached to the guest OS, and then retry the vmtools install.


text:
Q: Возможно ли OrthographicCamera в libgdx настроить так, чтобы вместо всего экрана она применялась к конкретной области экрана? Возможно ли OrthographicCamera в libgdx настроить так, чтобы вместо всего экрана она применялась к конкретной области экрана? То есть важно, чтобы вся система координат, заданная мною, работала внутри этой области, чтобы все элементы рисовались внутри этой области и чтобы viewport также обрезал или масштабировал внутри этой области

A: В общем, определился.
Например, если мой экран 300 на 300, а область находится в точке 100х100 и размером 100х100, а внутри области система координат, например, 500х500, то я вычисляю коэффициент - во сколько раз система координат отличается от размера экрана, то есть 500/100 для ширины и 500/100 для высоты, потом создаю камеру размером 300*5 для ширины и 300*5 для высоты, и передвигаю камеру в позицию, в которой начинается система координат моей области: 100*5 для ширины и 100*5 для высоты. В коде это выглядит так:
float k_width=width/this.width, k_height=height/this.height;
this.camera.setToOrtho(false, screenWidth*k_width,
    screenHeight*k_height);
this.camera.translate(-x*k_width, -y*k_height);

А вот как настроить viewport, прикреплённый к камере, я пока не разобрался


text:
Q: Были ли переданные данные на сервер? Такая ситуация - на сайте я хотела оформить заказ, аккаунта не создавала, хотела заказать как гость поэтому отметила галочку где стоял этот пункт "Заказать как гость", заполнила форму с данными (имя, фамилия, адрес, дата рождения), нажала "Далее", дальше был способ выбора оплата и кнопка "Далее", дальше я не нажала эту кнопку, вернулась назад, удалила все с корзины. В этом случае мои данные, которые я заполнял на первой страницы были отправлены на сервер или нет? Сайт оказался мошенническим, поэтому и волнует этот вопрос. На почту ничего не приходило.

A: Мошеннические сайты устроены так, что всеми силами стремятся заполучить все данные, в то числе айпи адрес, версию браузера, ОС, возможно считывало нажатия напрямую, возможно нет , не зная адреса сайта никто и не скажет насчёт механизма передачи данных

A: Всё зависит от того, как этот сайт написан. Если мошенникам не нужны ваши данные, а только номер карты и CVV/CVC, то нет, данные не были отправлены, если мошенникам для чего-то нужны ваши данные, то были отправлены.
P.S. чтобы купить тапочки нужно заполнить день рождения, класс!


text:
Q: How to intervene CreateUSerWizard, memebership provider to add User.Identity.Name to Users table I am using the ASP.NET application service; Membership to manage sign-up and login for users in website.
So after calling: Install-Package Microsoft.AspNet.Providers
I Added a Login control and CreateUSerWizard control; each in a separate aspx page.
The Provider creates the necessary tables in the database (Users, Roles, Applications, ...)
The Users table has this definition:
CREATE TABLE [dbo].[Users] (
    [UserId]           UNIQUEIDENTIFIER NOT NULL,
    [ApplicationId]    UNIQUEIDENTIFIER NOT NULL,
    [UserName]         NVARCHAR (50)    NOT NULL,
    [IsAnonymous]      BIT              NOT NULL,
    [LastActivityDate] DATETIME         NOT NULL,
    PRIMARY KEY CLUSTERED ([UserId] ASC),
    CONSTRAINT [User_Application] FOREIGN KEY ([ApplicationId]) REFERENCES [dbo].[Applications] ([ApplicationId])
);

GO
CREATE NONCLUSTERED INDEX [IDX_UserName]
    ON [dbo].[Users]([UserName] ASC);

I am planning to add a column - named UserIdentity - that will hold the value of the User.Identity.Name for the signed-up users.
By default signed-up users are logged in automatically.
[UserIdentity]    nvarchar(256) NOT NULL,
I want to list user names from this table and make something special for the name that belongs to the current logged in user. So I can retrieve UserIdentity and check if it matches the current user User.Identity.Name
The Question is: How to add User.Identity.Name to the UserIdentity column. I am using the default CreateUSerWizard control. Is there a way to intervene and make this Add.


text:
Q: Meaning of < in file path in dovecot configuration file? I am updating SSL certificates of Dovecot. One of the configuration lines contains text:
#ssl_ca = </path/to/ca

What is the meaning of that < sign?

A: According to Dovecot manual, the var_name = </path/to/file syntax reads the file contents into the variable.


text:
Q: Put a case value in the middle of a sentence (formula) i have a little trouble with excel
i dont knonw if it possible but i wanna add a cell value in the middle of my sentence
it goes like this
this is my case E61
I have =(E60) cars

and in the case E60 i can put 1 - 2- 3- 4
is there any way to do this with a formula? i cant use macro or vba stuff
thanks for your time it realy apreciated

A: You need string concatenation.
="I have " & E60 & " cars"


text:
Q: Weighted cox regression: test for goodness of fit? I want to do a weighted Cox regression analysis (coxphw command in R) since there is violation of proportional hazards assumption in standard Cox model shown by Schoenfeld residuals. What would be the test/metric for goodness of fit in a weighted Cox regression?
Thank you!

A: As AdamO commented, the coxphw() function is essentially the coxph() function with a particular set of weights. The weights, however, are a function of event times rather than fixed for each case. For the default AHR (average hazard ratio) setting, the weight for all cases at risk at an event time t is set to the product of the estimated survival probability and the inverse of the estimated probability of censoring at that time. That gives a particular type of "average hazard ratio" that has a reasonable interpretation even if proportional hazards (PH) doesn't hold.
The first implication is that there is no need to test for PH if you use coxphw() with the AHR setting. The PH assumption is irrelevant to interpretation of the coefficients.
Second, the "average hazard ratio" for coxphw() is closely related to the concordance metric for model performance; from page 8 of Dunkler et al:

in a two-group comparison, average hazard ratios approximate the odds of concordance $OC = c/(1 − c) = P(T_A < T_B)/P(T_B < T<A)$ very well, $T_A$ and $T_B$ being the survival times of two randomly chosen subjects of groups $A$ and $B$. Intuitively, this can be explained as each pairwise comparison of a subject that fails with all subjects still at risk being given equal importance.

It is not, however, suitable for predictions as functions of time (Table 4 of Dunkler et al). That would suggest a measure of concordance as most appropriate for testing goodness of fit. The coxphw package does provide a concord() function to provide a generalized measure of concordance for each predictor in the model, based on the cases that went into the model.
What would be more satisfying would be a way to validate the model in a way similar to what's done in the rms package: for example, fitting a model to multiple bootstrapped samples of the data, and testing performance of each of those models on the whole data set. That gives a reasonable idea of how well the results would apply to a new sample from the underlying population.
The coxphw package doesn't make that easy, as it seems to have only limited ability to predict outcomes on cases not included in the model. A work-around would be to use the regression coefficients returned by coxphw() to calculate the linear predictor from the covariate values of cases not in the model, and see how frequently the order of linear predictor values agrees with the order of event times between comparable pairs of cases (all pairs of cases with event times; pairs of censored/event cases with censored time greater than event time).
If times to events are important, you could consider spending more time working around the PH problem. For example, if your model has the wrong functional form for a continuous covariate, that could show up as non-PH. Depending on your goals and those of your audience, understanding the nature of any non-PH behavior might end up being more important than just reporting an average hazard ratio.