text:
Q: Get spring-data-mongodb to honor getter/setter without backing field? I have a general-purpose POJO:
public class Thing {
    private String name;
    private String etc;

    public String getName() {
        return name;
    }
    // other getters and setters
}

I'm using Spring 4.3.9 and Spring-data-mongodb 1.10.4. I want to store instances of this POJO in Mongodb, but I have some constraints:

*

*I can't add Spring annotations to the base class (but I can subclass Thing and annotate that).

*I want to use the name field as the Mongodb unique ID (mainly to avoid creating a separate unique index for it).

*I want to (redundantly) store the name field as an actual field named "name", so that other consumers of the collection don't have to know that "name" is stored in the _id.

I started out trying this:
public class SpringThing extends Thing {
    @Id
    @Override
    public String getName() {
        return super.getName();
    }
    @Override
    public void setName(String name) {
        super.setName(name);
    }
}

This causes spring to use the value of name for _id, but of course it doesn't store a field named "name" in Mongodb. The documentation says that spring will use a "property or field" named "id" or annotated with @Id. So I tried defining a redundant getter/setter which accesses the name field:
public class SpringThing extends Thing {
    @Id
    public String getId() {
        return super.getName();
    }
    public void setId(String id) {
        super.setName(id);
    }
}

Unfortunately, spring ignores getId and setId here, and stores the object with an autogenerated ID. I also tried creating redundant getters/setters annotated with @Field("name"), but spring seems to ignore any getter/setter pair without an actual field.
Adding an actual ID field and storing a copy of the name there does work:
public class SpringThing extends Thing {
    @Id
    private String id;

    @Override
    public void setName(String id) {
        this.id = id;
        super.setName(id);
    }
}

But it requires defining a pointless field named "id".
Is there a more reasonable way to get what I want? Is what I'm trying to do reasonable to begin with?

A: Thanks to a hint by @mp911de, I ended up creating a subclass of Thing that looks like this:
@TypeAlias("thing")
@Document(collection = "things")
public class SpringThing extends Thing {

    @Id
    @AccessType(Type.PROPERTY)
    @JsonIgnore
    public String getId() {
        return super.getName();
    }

    public void setId(String taskName) {
        super.setName(taskName);
    }
}

*

*The @TypeAlias annotation overrides the name which spring would use for the type, to cover up the fact that I've created a subclass just to add annotations.

*@Id says that this is the getter for _id.

*@AccessType says to access this field through the getter and setter rather than by directly accessing the field. This is what I needed; without it, spring looks for a private member variable named something like id.

*@JsonIgnore is the Jackson (JSON library that we're using) annotation to prevent including the id field when serializing these objects to JSON.


text:
Q: Add Variation Gallery Images Upload Field under each Variation (Backend) I'm working on a custom WooCommerce powered ecommerce store where I want if I could get an images upload field that allows me to upload multiple images inside each variation (mostly for color variations, to change default gallery images when a color variation is selected).
Currently, I am focusing on at least achieving this in backend.
There are multiple plugins available to get that result, but they have limitations on free and I don't have budget to buy any. Also, I want to keep my theme lite and easily accessible to customize and code.
I downloaded some of those plugins and some other StackOverflow answers and came up with this code. But this does not seem to be working in backend at all.
add_action( 'woocommerce_product_after_variable_attributes', 'wc_variation_gallery_images', 10, 3 );
add_action( 'woocommerce_save_product_variation', 'wc_save_variation_gallery_images', 10, 2 );

function wc_variation_gallery_images( $loop, $variation_data, $variation ) {
    $variation_id = $variation->ID;
    $variation_gallery_images = get_post_meta( $variation_id, 'variation_gallery_images', true ); ?>

        <?php
        foreach ( $variation_gallery_images as $gallery_image_id ):
        $image = wp_get_attachment_image_src( $gallery_image_id ); ?>

        <img src="<?php echo esc_url( $image[ 0 ] ) ?>">
        <input type="hidden" name="variation_gallery[<?php echo esc_attr( $variation_id ) ?>][]" value="<?php echo esc_attr( $gallery_image_id ) ?>">

        <?php endforeach; ?>

<?php }

function wc_save_variation_gallery_images( $variation_id, $loop ) {
    if ( isset( $_POST['variation_gallery'] ) ) {
        if ( isset( $_POST['variation_gallery'][ $variation_id ] ) ) {
            $gallery_image_ids = array_map( 'absint', $_POST['variation_gallery'][ $variation_id ] );
            update_post_meta( $variation_id, 'variation_gallery_images', $gallery_image_ids );
        }
        else {
            delete_post_meta( $variation_id, 'variation_gallery_images' );
        }
    }
    else {
        delete_post_meta( $variation_id, 'variation_gallery_images' );
    }
}

Maybe, I have done something wrong with the code and that is the reason why I am not able to make it work. Can you please help me make this work. All I want is, to be able to upload multiple gallery images per variation. By default, there is only one featured image allowed per variation.
All I want is, to be able to upload multiple gallery images per variation. By default, there is only one featured image allowed per variation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Simultaneously multiple copies of each of a set of substrings of a string. For any string $S$ and substring $u \leqslant S$ define $n_S(u) = \max \{ n : \alpha_0 u \alpha_1 \cdots u \alpha_n = S $ for some $\alpha_i \leqslant S\}$.  That is $n_S(u) = $ the maximum number of disjoint copies of $u$ that we can squeeze into $S$.
Now let $C_S = \{ u \leqslant S : |u| \geq 2 $ and $n_S(u) \geq 2 \}$.
I want to define special subsets of $C_S$, $A$, such that simultaneously $n_S(u) \geq 2$ for all $u \in A$.  How can we accomplish that formula-wise without getting too complicated?
By simultaneous I mean for example $\alpha u \beta v \alpha' u \beta' v \leqslant S \implies$ "$n_S(u), n_S(v) \geq 2$ simultaneously".

A: Such a set of substerings $A$ is identified by:
There exists a decomposition $S = \sigma_1 \cdots \sigma_n$ such that
$$
\forall u \in A, \exists 1\leq i \lt j \leq n: \sigma_i = u = \sigma_j
$$


text:
Q: Refit Xamarin Newtonsoft.Json.JsonReaderException expecting JSON receiving HTML instead Newtonsoft.Json.JsonReaderException I am receiving an error when calling an API and it returns HTML(error occured) instead of JSON which causes the Xamarin app to crash. I realize this is not ideal for the API to return this, but what I am working with.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
IMyApi Class
Task<ApiResponse<ContentModel>> GetContentModel();
MyService Class
            try
            {
                var response = await MyAPI.GetContentModel();

                if (response.IsSuccessStatusCode)
                {
                    return response.Content;
                }

                HandleApiErrors(response);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(TAG, ex.ToString());
            }

Exception

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0.
at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in <2073514815234917a5e8f91b0b239405>:0
at Newtonsoft.Json.JsonTextReader.Read () [0x0004c] in <2073514815234917a5e8f91b0b239405>:0
at Newtonsoft.Json.JsonReader.ReadAndMoveToContent () [0x00000] in <2073514815234917a5e8f91b0b239405>:0
at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x0004a] in <2073514815234917a5e8f91b0b239405>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <2073514815234917a5e8f91b0b239405>:0
at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00054] in <2073514815234917a5e8f91b0b239405>:0
at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <2073514815234917a5e8f91b0b239405>:0
at Newtonsoft.Json.JsonSerializer.Deserialize[T] (Newtonsoft.Json.JsonReader reader) [0x00000] in <2073514815234917a5e8f91b0b239405>:0
at Refit.NewtonsoftJsonContentSerializer.DeserializeAsync[T] (System.Net.Http.HttpContent content) [0x000a6] in //Refit/NewtonsoftJsonContentSerializer.cs:53
at Refit.RequestBuilderImplementation.DeserializeContentAsync[T] (System.Net.Http.HttpResponseMessage resp, System.Net.Http.HttpContent content) [0x002a8] in //Refit/RequestBuilderImplementation.cs:314
at Refit.RequestBuilderImplementation+<>c__DisplayClass14_02[T,TBody].<BuildCancellableTaskFuncForMethod>b__0 (System.Net.Http.HttpClient client, System.Threading.CancellationToken ct, System.Object[] paramList) [0x002be] in /_/Refit/RequestBuilderImplementation.cs:258  at ContentService.GetContent () [0x0002e] in /Users/ContentService.cs:28 : ContentService Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: <. Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in <2073514815234917a5e8f91b0b239405>:0  at Newtonsoft.Json.JsonTextReader.Read () [0x0004c] in <2073514815234917a5e8f91b0b239405>:0  at Newtonsoft.Json.JsonReader.ReadAndMoveToContent () [0x00000] in <2073514815234917a5e8f91b0b239405>:0  at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x0004a] in <2073514815234917a5e8f91b0b239405>:0  at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <2073514815234917a5e8f91b0b239405>:0  at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00054] in <2073514815234917a5e8f91b0b239405>:0  at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <2073514815234917a5e8f91b0b239405>:0  at Newtonsoft.Json.JsonSerializer.Deserialize[T] (Newtonsoft.Json.JsonReader reader) [0x00000] in <2073514815234917a5e8f91b0b239405>:0  at Refit.NewtonsoftJsonContentSerializer.DeserializeAsync[T] (System.Net.Http.HttpContent content) [0x000a6] in /_/Refit/NewtonsoftJsonContentSerializer.cs:53  at Refit.RequestBuilderImplementation.DeserializeContentAsync[T] (System.Net.Http.HttpResponseMessage resp, System.Net.Http.HttpContent content) [0x002a8] in /_/Refit/RequestBuilderImplementation.cs:314  at Refit.RequestBuilderImplementation+<>c__DisplayClass14_02[T,TBody].b__0 (System.Net.Http.HttpClient client, System.Threading.CancellationToken ct, System.Object[] paramList) [0x002be] in /_/Refit/RequestBuilderImplementation.cs:258


text: Q: Cropping image in ovalShape in Android I am taking the image from the gallery. my app I have man image, now I need to convert the shape of image which I took from the gallery as oval so that this image is replaced the head part of the man image in my app. I don't know how to crop the the imageview as shape like man face. Do I need to use layer drawables? or layerlist? How to do that?


text:
Q: SQL Server secure connection using Windows Azure Connect I am setting up a system that runs on Azure but needs to access an on-premises SQL Server.  I've built it out as detailed in this article.  This calls for me opening port 1433 to the world which looks like a serious security problem.  Is there any way to open that port and still have it secure (I know that I can have complex user ids and passwords and everything, but is there a better way to secure SQL Server)

A: The connection between your on-premises DB and Windows Azure Connect will be secure by default via the IPSEC protocol

"Windows Azure Connect uses industry-standard end-to-end IPSEC
  protocol to establish secure connections between on-premise machines
  and roles in the cloud. Unlike a traditional Virtual Private Network
  (VPN), which establishes secure connectivity at gateway level, Windows
  Azure Connect offers more granular control by establishing secure
  connections at a machine and role level."

http://blogs.msdn.com/b/usisvde/archive/2012/03/14/windows-azure-security-best-practices-part-6-how-azure-services-extends-your-app-security.aspx
Your DB won't be publicly available, only VM's on the Azure Connect will be able to see it.
Your traditional firewall and on-premises security policies and procedures will still hide your DB in your Enterprise Environment, all you are doing is giving Windows Azure VM (Roles) the ability to see it.

A: I saw the comment discussion on @user728584's answer about opening port 1433. Port 1433 has nothing to do with Azure Connect, which is essentially a VPN tunnel between on-prem boxes and a collection of Windows Azure role instances. Azure Connect requires an agent to be installed on any on-prem server you're adding to the Connect Group and doesn't require an inbound port to be opened. In your case, you'd add the agent to your SQL Server box, which would then be part of the connect group and accessible directly from your Windows Azure Role instances (for the roles you add to the group). The Connect Agent then establishes the tunnel.
The Connect Agent has a special key baked in, generated for you, making it unique. But even if someone somehow obtained the installer for your specific Connect Agent, it wouldn't help at all, as you still need to add that node to the Connect Group. So, this is a secure setup.


text:
Q: What are the differences between the Angular 2 development bundle and the normal bundle? Angular 2 publishes to npm a series of bundles, for example the angular2.js and the corresponding angular2.dev.js.
The dev bundle is clearly meant for development mode, but what are the features that it contains to help development?
I think I heard in some talk that in development mode the bindings are checked twice? I think I read somewhere that its for improved stacktraces, which seems odd as in production we would benefit from those also.
is it safe/recommendable to use it in production.
What are the specific features that the development bundle contains over the normal bundle?


text:
Q: Is it OK to use regression when analysing a difference of variables? Consider an experiment where we want to check if the change in a variable X between 2 time periods (X1 at t=1, X2 at t=2) is caused by independent variable A or B (which do not change over time).
Would the following analysis make sense: a regression where DX = X2 - X1 is the dependent variable and A & B are the independent variables? Or can you not take the regression of a difference of variables?

A: Yes that could make sense.  But you are making more assumptions that if you treat X1 as a baseline variable and fit a model like Y ~ X1 + B.  This allows the slope of X1 on Y to be something other than 1.0, which happens when you have measurement error or regression to the mean.  More about this is in the transformation and change chapter of BBR.

A: You should look at panel data to think about other possibilities.
If A and B are constants, $\Delta A$ and $\Delta B$ will be zero too, and constants in your model will not help you.
There are methods for analysis of time change, like first difference estimator or fixed effects, but them will not help you if you hope to find causality in a model made only by constants as independent variables.
First difference estimator will clear your mind:

The estimator is obtained by running a pooled OLS estimation for a
  regression of $\Delta y_{it}$ on $\Delta x_{it}$ [...]

Doing that eliminates changes that are constant from any $t-1$ to $t$
In your example, the variables probably will be not even correlated... so you have to model your experiment differently.


text:
Q: How convert many AsyncTasks to Rx Observables in Android? I'm using Facebook Graph API to find users that liked my posts. All logic implements in few steps:

*

*Find all posts by making request to API in AsyncTask

*Convert this AT to Rx.Observable

*Map Observables GraphResponse to List(Post is POJO)

*Call FlatMap operator and in it body call method that iterate each post and make asyncTask, then convert it into Observable and put in Array.

*Merge Array of Observables in One Observable.

*Map its GraphResponse to Liked Profile

*Subscribe and render Likers List

*PROFIT!

And I have some little problem at step #4-5. Please, look at method 'likes' in repository. In comments i wrote problems
Hint: I'm using MVP + Clean Architecture with Repository(data layer) and Interactor(business layer)
class FacebookRepository {

    private val facebook = Facebook.instance()
    private val gson = GsonBuilder().create()

    fun posts(): Observable<GraphResponse>? {

        return RxDecorator<GraphResponse>().decorate(Observable.defer({
            val request = GraphRequest(
                    facebook.token,
                    "/me/posts",
                    null,
                    HttpMethod.GET,
                    GraphRequest.Callback { /* handle the result */ }
            )

            Observable.just(request.executeAndWait())
        }))

    }

    fun setFaceBookAccessToken(currentAccessToken: AccessToken?) {
        facebook.token = currentAccessToken
    }

    fun logout() {
        facebook.logout()
    }

    fun token(): String? {
        return facebook.token?.token
    }

    fun likes(posts: List<Post>?): Observable<List<Profile>> {

        Log.d("observables:posts", posts.toString())

        val p = iterateObservables(posts) // STOP HERE and WAIT to complete this method.

        // Then p is composite - merge and return
        return Observable.merge(p).map {
            Log.d("merge:posts", it.toString())
            val profiles = gson.fromJson<List<Profile>>(
                    it.jsonObject["data"].toString(),
                    object : TypeToken<List<Profile>>() {}.type
            )

            return@map profiles
        }
    }

    private fun iterateObservables(posts: List<Post>?): MutableList<Observable<GraphResponse>>? {
        val observables: MutableList<Observable<GraphResponse>>? = null

        Log.d("iterateObs:posts", posts.toString())
        Log.d("posts_not_null", (posts != null).toString())
        Log.d("posts.size", posts?.size.toString())

        if (posts != null) {
            for (post in posts) {

                Log.d("iterateObs:post", post.toString())

                val request = GraphRequest(
                            AccessToken.getCurrentAccessToken(),
                            "/${post.id}/likes",
                            null,
                            HttpMethod.GET,
                            GraphRequest.Callback { Log.d("fb:post:id", "${post.id}: ${it.jsonObject}")
                        }).executeAsync()

                Log.d("obs:after:post", observables.toString())
            }
        }

        return observables
    }
}

And this is Interactor
class FacebookInteractor {

    private val callbackManager = com.facebook.CallbackManager.Factory.create()
    private val repository = FacebookRepository()

    fun facebookAuth(view: IMainView) {
        LoginManager
                .getInstance()
                .logInWithReadPermissions(
                        view.getContext() as MainActivity,
                        Arrays.asList("user_friends", "user_likes", "user_posts", "public_profile", "email")
                )
    }

    fun onFacebookLoginResult(requestCode: Int, resultCode: Int, data: Intent) {
        callbackManager.onActivityResult(requestCode, resultCode, data)
    }

    fun facebookAccessTokenChanged(oldAccessToken: AccessToken?, currentAccessToken: AccessToken?) {
        if(oldAccessToken?.token != currentAccessToken?.token) {
            repository.setFaceBookAccessToken(currentAccessToken)
        }
    }

    fun likes(): Observable<List<Profile>>? {
        return repository.posts()?.map {
            val gson = GsonBuilder().create()
            val posts = gson.fromJson<List<Post>>(
                    it.jsonObject["data"].toString(),
                    object : TypeToken<List<Post>>() {}.getType()
            )

            return@map posts
        }?.flatMap {
            return@flatMap repository.likes(it)
        }
    }

    fun logout() {
        repository.logout()
    }

    fun isLogined(): Boolean {
        return repository.token() != null
    }

}

I'm Using Kotlin as development language.

A: Thanks EveryOne!) But answer was in another case) Problem was in logic, not in implementation) Facebook SDK has RequestBatch And no need in Future or stoping Threads)
package com.github.scrobot.likes_listener.data.facebook

import android.util.Log
import com.facebook.*
import com.github.scrobot.likes_listener.data.facebook.models.Facebook
import com.github.scrobot.likes_listener.data.facebook.models.Post
import com.github.scrobot.likes_listener.data.facebook.models.Profile
import com.google.gson.GsonBuilder
import com.google.gson.reflect.TypeToken
import rus.pifpaf.client.util.rx.RxDecorator
import rx.Observable
import java.util.*

/**
 * Created by aleksejskrobot on 07.12.16.
 */
class FacebookRepository {

    private val facebook = Facebook.instance()
    private val gson = GsonBuilder().create()

    fun posts(): Observable<GraphResponse>? {

        return RxDecorator<GraphResponse>().decorate(Observable.defer({
            val request = GraphRequest(
                    facebook.token,
                    "/me/posts",
                    null,
                    HttpMethod.GET,
                    GraphRequest.Callback { /* handle the result */ }
            )

            Observable.just(request.executeAndWait())
        }))

    }

    fun setFaceBookAccessToken(currentAccessToken: AccessToken?) {
        facebook.token = currentAccessToken
    }

    fun logout() {
        facebook.logout()
    }

    fun token(): String? {
        return facebook.token?.token
    }

    fun likes(posts: List<Post>?): Observable<List<Profile>> {

        val batch = GraphRequestBatch()

        posts?.mapTo(batch) { post ->
            GraphRequest(
                    facebook.token,
                    "/${post.id}/likes",
                    null,
                    HttpMethod.GET,
                    GraphRequest.Callback { Log.d("fb:post:id", "${post.id}: ${it.jsonObject}") }
            )
        }

        return RxDecorator<List<GraphResponse>>().decorate(rx.Observable.defer({
            rx.Observable.just(batch.executeAndWait())
        })).map {
            Log.d("batchResponse:it", it.toString())

            val list = ArrayList<Profile>()

            for (i in it) {
                list.addAll(gson.fromJson<List<Profile>>(
                        i.jsonObject["data"].toString(),
                        object : TypeToken<List<Profile>>() {}.type
                ))
            }

            list.filter {
                list.contains(it)
            }

            return@map list
        }
    }
}


text:
Q: How to get count with pagination in a single query The query that I'm using for getting total count with pagination is:
SELECT *
FROM (SELECT r.*, ROWNUM RNUM, COUNT(*) OVER () RESULT_COUNT
      FROM (SELECT t0.ABC_SEQ_ID AS c0, t0.FIRST_NAME, t1.SCORE
            FROM ABC t0, XYZ t1
            WHERE (t0.XYZ_ID = 751)
            AND t0.XYZ_ID = t1.XYZ_ID
            ORDER BY t0.RANK ASC) R)
WHERE RNUM between 1 and 15

Obviously it won't return any row when pagination values are out of range (greater than the data size). The question is how do I get total count with pagination using a single query when the pagination values are out of range? Is it possible using a single query?
EDIT
For example:
Total rows for a particular criteria are 20. And pagination values are from 25 to 30. Now want to send the total row count to the client but this query won't return any row. How do I tackle this case.

A: WITH R AS
(SELECT r.*, ROWNUM RNUM, COUNT(*) OVER () RESULT_COUNT
      FROM (SELECT t0.ABC_SEQ_ID AS c0, t0.FIRST_NAME, t1.SCORE
             FROM ABC t0, XYZ t1
            WHERE (t0.XYZ_ID = 751)
             AND t0.XYZ_ID = t1.XYZ_ID
           ORDER BY t0.RANK ASC
           )
 )
 SELECT c0,FIRST_NAME,score,RESULT_COUNT  FROM R WHERE RNUM between 25 and 30
 UNION
 SELECT null,null,null
       ,NVL((SELECT result_count FROM R WHERE ROWNUM=1),0) result_count
 FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM R WHERE RNUM between 25 and 30);

This query is not optimized ,but still it will gave you the count ,if the condition are not matched  i.e 0

A: Since this is a special case, why not handle it special if you need?
Leave your query as it is, but if no row is returned, query again with RNUM between 1 and 1.
You can use the same view/function/prepared statement for this, and the performance of your original query is not affected.


text:
Q: Search multiple strings in a excel workbook I am trying to design a macro to search for multiple strings in an excel.
I have the following code which searches for the word "techno" in an excel but, I need to include a variable into the code so that I can search for multiple words such "Techno", "electromagnetic", "waves", etc. at once.  I am unable to create a loop for this condition.
Can anyone suggest a solution to this problem? The below code works fine but, only a tweak is required to include multiple strings in the search.
Sub SearchFolders()
    Dim xFso As Object
    Dim xFld As Object
    Dim xStrSearch As String
    Dim xStrPath As String
    Dim xStrFile As String
    Dim xOut As Worksheet
    Dim xWb As Workbook
    Dim xWk As Worksheet
    Dim xRow As Long
    Dim xFound As Range
    Dim xStrAddress As String
    Dim xFileDialog As FileDialog
    Dim xUpdate As Boolean
    Dim xCount As Long

    myArray = Array("techno", "magnetic", "laser", "trent")
    On Error GoTo ErrHandler
    Set xFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
    xFileDialog.AllowMultiSelect = False
    xFileDialog.Title = "Select a forlder"
    If xFileDialog.Show = -1 Then
        xStrPath = xFileDialog.SelectedItems(1)
    End If
    If xStrPath = "" Then Exit Sub
    xUpdate = Application.ScreenUpdating
    Application.ScreenUpdating = False
    Set xOut = Worksheets.Add
    For myCounter = 0 To UBound(myArray)
        MsgBox myCounter & " is the Count No."
        xStrSearch = myArray(myCounter)
        MsgBox xStrSearch & " is the Value fr String search"
        xRow = 1
        With xOut
            .Cells(xRow, 1) = "Workbook"
            .Cells(xRow, 2) = "Worksheet"
            .Cells(xRow, 3) = "Cell"
            .Cells(xRow, 4) = "Text in Cell"
            Set xFso = CreateObject("Scripting.FileSystemObject")
            Set xFld = xFso.GetFolder(xStrPath)
            xStrFile = Dir(xStrPath & "*.xls*")
            Do While xStrFile <> ""
                Set xWb = Workbooks.Open(Filename:=xStrPath & "\" & xStrFile, UpdateLinks:=0, ReadOnly:=True, AddToMRU:=False)
                For Each xWk In xWb.Worksheets
                    Set xFound = xWk.UsedRange.Find(xStrSearch)
                    MsgBox xFound & " is the strings found"
                    If Not xFound Is Nothing Then
                        xStrAddress = xFound.Address
                    End If
                    Do
                        If xFound Is Nothing Then
                            Exit Do
                        Else
                            xCount = xCount + 1
                            MsgBox xCount & " is the count of strings"
                            xRow = xRow + 1
                            .Cells(xRow, 1) = xWb.Name
                            .Cells(xRow, 2) = xWk.Name
                            .Cells(xRow, 3) = xFound.Address
                            .Cells(xRow, 4) = xFound.Value
                        End If
                        Set xFound = xWk.Cells.FindNext(After:=xFound)
                        MsgBox xFound & " next string"
                        MsgBox xStrAddress & " is the address "
                        MsgBox xFound.Address & " is the address found"
                    Loop While xStrAddress <> xFound.Address 'To check how xStrAddress is populated or do we need to declare it as a help from excel pointed out
                    myCounter = myCounter + 1
                Next
                xWb.Close (False)
                xStrFile = Dir
            Loop
            .Columns("A:D").EntireColumn.AutoFit
        End With
    Next myCounter
    MsgBox xCount & "cells have been found", ,
    ExitHandler:
    Set xOut = Nothing
    Set xWk = Nothing
    Set xWb = Nothing
    Set xFld = Nothing
    Set xFso = Nothing
    Application.ScreenUpdating = xUpdate
    Exit Sub
    ErrHandler:
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
End Sub

A: If the strings you are searching will always be the same, hard code them into an array and Loop through the array elements to search each string, like so:
Dim myArray as Variant
Dim myCounter as Long

myArray = Array("techno", "electromagnetic", ...etc.)

For myCounter = 0 To UBound(myArray)
    ... 'your code here
   xStrSearch = myArray(myCounter)
    ... 'the rest if your code here
Next myCounter


text:
Q: Different views in layout for different screen I have app designed for tablet and now I want to make layout for phone, but my phone layout has different views and at some points different functionality and I'm facing such problem: layout-sw600dp/layout_a.xml(for tablet) has 2 buttons and layout-sw320dp/layout_a.xml(for phone) has just one now in code I set two listeners and app crashes with null pointer exception because second button is missing from layout. Any suggestions how can I implement different functionality for these screens?

A: Set a boolean flag (eg isUsingTabletLayout) and when you load the tablet layout wrap the binding of the views and the setting of the listeners inside that boolean check. If it's false the code will skip the views that are not present in the phone

A: First step :. Know which layout is loaded, you can do it using below mention way
Link : How can I detect which layout is selected by Android in my application?
Step two :
By knowing which layout s  loaded , you can enable codes for button.
If ( layout == tablayout ){
      Load button 1, and button 2.
}else {
  load button 1 only.
}
Hope, this will work.
Thank you.

A: Use getIdentifier() method. If it returns a non zero value, the resource exists, otherwise it doesn't exist.
String button_id="your_button_id";
//where button id is defined as android:id="@+id/your_button_id"

String resource_type= "id";

getResources().getIdentifier(button_id, resource_type, getApplicationContext().getPackageName());


text:
Q: How to dispaly Json Formatted DateTime into Angular Data I have Datetime in my sqldb when im fetching data from database using Json formatted im Getting Datetime as a "/Date(820434600000)/"
Here im having some code which i copied from stackoverflow but not working please Guide me
 app.filter("DateFilter", function () {
        var re = /\/Date\(([0-9]*)\)\//;
        return function (x) {
            var m = x.match(re);
            if (m) return new Date(parseInt(m[1]));
            else return null;
        };
    });
    {{eee.DataofJoin | DateFilter | date: 'yyyy-MM-dd HH:mm'}}

A: So you are getting from database a instance of Date object, so if you bind the
date to new Date got from DB as follows:
$scope.date = new Date(820434600000);
(will result in this "1995-12-31T18:30:00.000Z") and using angular filters for date you can display in any format you want;
In HTML you do this:

{{date | date: 'yyyy-MM-dd HH:mm'}}

This will result in displaying
1995-12-31 20:30
Angular takes care of that with built-in filters, no need for custom one. Though it's not best practice what you do, try using only the timestamp stored in DB.


text:
Q: Behaviour of direct limit with matrices I am trying to understand direct limits in the category of $C^*$-algebras by self reading. My last question was also related to direct limits. Here is another of my doubts:

Let $(A_n,f_n)$ be a direct sequence of $C^*$-algebras. Does the direct limit behave well with matrices i.e. $$\lim_{\rightarrow} M_2(A_n)=M_2(\lim_{\rightarrow} A_n)$$
  Where for the system $M_2(A_n)$ the connecting maps are the natural maps obtained using $f_n$ componentwise.

I do feel like the result should be true, but I don't really have an argument. Any ideas?

A: You're asking whether the functor $M_2$ on Banach spaces preserves colimits of direct sequences.
(In case you're not familiar with the categorical terminology I'm using here, don't be put off — it's not very deep, it's just useful packaging-up of the kind of properties you're discussing in the question, and hopefully this answer will give an idea of why this sort of categorical language is helpful.)
The forgetful functor $U$ from C*-algebras to Banach spaces preserves and reflects limits, so it's enough to check the isomorphism $\varinjlim M_2(A_n) \cong M_2(\varinjlim A_n)$ on the underlying Banach spaces.
But at the level of Banach spaces, $U(M_2(A)) \cong U(A) \oplus U(A) \oplus U(A) \oplus U(A)$ — i.e. the coproduct of 4 copies of $U(A)$.  So it's enough to show that the functor $X \mapsto X \oplus X \oplus X \oplus X$ on Banach spaces preserves colimits of direct sequences.
But this is automatic, because colimits commute with colimits: concretely, check the universal properties a sequential colimit of coproducts, versus a coproduct of sequential colimits, and notice that they agree.


text:
Q: How to update mongodb array values I have a document stored in mongodb like this
"Fiction" : [
           {
                   "SNo": "1",
                   "authorName" : "Enid Blyton",
                   "bookName" : "Secret series",
                   "Amount" : 115
           },
           {
                   "SNo": "2",
                   "authorName" : "Enid Blyton",
                   "bookName" : "Mystery series",
                   "Amount" : 150
           }
   ]

I would like to update the amount from 115 to 135.
I tried to update the value like this.
db.fiction.update({"Fiction.SNo":"1"},{$set:{"Fiction.Amount":135}})

But I get a error.
The error is
cannot use the part (Fiction of Fiction.Amount) to traverse the element

Can anyone help on this, I need to implement this to work from python.

A: Use the $ positional operator in your update as this identifies the element in an array to update without explicitly specifying the its position in the array:
db.fiction.update({"Fiction.SNo":"1"},{$set:{"Fiction.$.Amount":135}})

A: The $ operator is used to iterate through the array list while updating.
Your query would be :
db.Fiction.update({"Fiction.SNo":"1"},{$set:{"Fiction.$.Amount" : 135}})


text:
Q: "Dependency could not be resolved" deploying ASP.NET 5 website to Azure I have a ASP.NET 5 website with 3 subprojects. The subprojects have a reference to EF 6.1. Locally everything works fine, but when I try to deploy the website to azure using the assistant, I get the error message

Dependency EntityFramework >= 6.1.3 could not be resolved in
  XXX\wrap\PDWeb.Application\project.json   22

The generated project.json of the PDWeb.Application subproject is
{
  "version": "1.0.0-*",
  "frameworks": {
    "net452": {
      "wrappedProject": "../../Application/PDWeb.Application/PDWeb.Application.csproj",
      "bin": {
        "assembly": "../../Application/PDWeb.Application/obj/{configuration}/PDWeb.Application.dll",
        "pdb": "../../Application/PDWeb.Application/obj/{configuration}/PDWeb.Application.pdb"
      },
      "dependencies": {
        "PDWeb.Model": "1.0.0-*"
      }
    },
    "net45": {
      "wrappedProject": "../../src/Application/PDWeb.Application/PDWeb.Application.csproj",
      "bin": {
        "assembly": "../../src/Application/PDWeb.Application/obj/{configuration}/PDWeb.Application.dll",
        "pdb": "../../src/Application/PDWeb.Application/obj/{configuration}/PDWeb.Application.pdb"
      },
      "dependencies": {
        "PDWeb.Model": "1.0.0-*",
        "EntityFramework": "6.1.3",
        "PDWeb.Services": "1.0.0-*"
      }
    }
  }
}

The complete build output can be found here

A: I solved the problem by converting my subprojects to *.xproj...

A: I had exactly the same issue, when I tried to publish my dnx project.
I run "dnu restore" in every subfolder into the wrap folder and the problem was solved.
In your solution folder is a wrap folder. In this folder are subfolders with project.json files. Open command prompt, go to every subfolder and execute "dnu restore"


text:
Q: How to use a foreach loop with AJAX call? I have a foreach loop that is called from my AJAX code. It appears that the foreach loop is being skipped right over. I would ultimately like to make it so that the foreach loop will execute a query using each value in the array, but I am first trying to test the the foreach loop works (which it does not). The alert (from my AJAX) that I am receiving is just the original array and not the one with the added items.
PHP:
   $data = array();
   if(isset($_POST['myArray']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']){
    $data = $_POST['myArray'];
    foreach ($data as $item) {
        $data[] = $item;
    }
    echo json_encode($data);
    die();
}

AJAX:
$(document).ready(function(){
    $('#btn-addkegs').click(function() {
        var arr = kegs;
        var myArray =  JSON.stringify(arr);

        $.ajax({
            url: "addkegs.php",
            method: "POST",
            dataType: "json",
            data: {myArray: myArray},
            success: function (result) {
            alert("Your kegs have been added! These include: " + result);
            textarea.value = "";
            kegs = [];
         }
                    });

            });
        });

As for the line var arr = kegs;, the value of the array 'kegs' is set through an input field and other AJAX, but all that works fine. I think that my problem is with my PHP code.

A: If you are send via post only values... like in comments : 1,2,3
your $_POST['myArray'] was receive literaly what you sent to.
So, data variable will receive the array that seems like this ['1','2','3']
Well... Since you are not creating a variable $data as an Array, and yes, only putting an array inside it.
The PHP doesnt consider the $data[] variable as same as $data.
So, the PHP was magicaly overwriting the values from each same values.
So, I think if you want to repeat the values in the same array, you must reference the array with the array_push
$data = $_POST['myArray'];
foreach ($data as $item) {
    array_push($data, $item);
}

Now when you return this array, you will have a response like {1,2,3,1,2,3}

A: Answer from a comment by @David:

In your browser's debugging tools, take a look at the network requests. Examine the AJAX request and its response. If the result is entirely wrapped in quotes, then it's just a string and not an array. You may need to JSON-decode $_POST['myArray'] server-side to interpret it as an array.

I needed to change $data = $_POST['myArr']; to $data = json_decode($_POST['myArr']);.


text:
Q: Flask, one flash message not getting displayed I know flash is set up properly as all other flash messages are being displayed correctly.
I have updated one view. It used to call the flask route from a javascript window.location function but now am using $.post() to send parameters to the route.
The location of the flash call hasn't changed (I put a print statement just before it and that executes so I know the interpreter gets to the flash call).
All code in the route's method executes correctly but the flash message does not show and I am at a loss. Nothing coming up from Google searches.
Here are the last 3 lines in the route method
db.session.commit()
flash('Database Updated')
return redirect(url_for('index'))

A: I think (but I'm not sure, because you didn't include the code of index), that the template in index doesn't include the flash.  You need to format the index page (or the base template) to display the flash.
Check the examples in: http://flask.pocoo.org/docs/0.12/patterns/flashing/, practically:
{% with messages = get_flashed_messages() %}
  {% if messages %}

    {% for message in messages %}

{{ message }}

    {% endfor %}

  {% endif %}
{% endwith %}


text:
Q: how to set unique id for every element in html using jQuery i have lots of classes in my html but i want every class(or id if i have to change) be unique.here this code should work. i have lots of class="answer-to-q" in my code and when i click on specific one, that
 should slide down not others.

please log in

jquery:
 $(".answer-to-q").click(function () {
       $(".post-a-answer-div").slideDown("slow");
  });

A: Ideally I think you should to set the IDs when you're generating the HTML, but if that's not possible, something like this could work? I'm using data attributes instead of IDs because that seems more appropriate but it could be modified to work with IDs if you really need to use 'em.
// Add data attributes
var count = 1;
$('.answer-to-q').each(function(){
  $(this).attr('data-q', count);
  $('body').find('.post-a-answer-div:not([data-a])').first().attr('data-a', count);
  count++;
});

// Toggle on click
$('.answer-to-q').click(function(){
  var target = $(this).attr('data-q');
  $('[data-a="'+target+'"]').toggle();
});

Example:
https://codepen.io/anon/pen/xzaBgM


text:
Q: C - creating a packet using char and int I'm looking to build a binary string that consists of hex values... I've learned sprintf is not the correct way to accomplish this. I've got a real simple gui to collect configuration settings that need to be sent a device. The values can be signed and will always be numerical. I have a set of values like:
#define PKTHEAD 0xA5
#define VALONE  0xA0
#define VALTWO  0xA1
#define VALTHREE 0xA2
#define PKTTAIL 0x5A

signed int val1 = 10000; //0x2710
signed int val2 = -84;   //0xFFAC
signed int val3 = -175001 //0xFFFD5467

My end goal is to have a packet that would resemble "PKTHEAD|PKTHEAD|PKTHEAD|VALONE|val1|VALTWO|val2|VALTHREE|val3|PKTTAIL|PKTTAIL|PKTTAIL", and the hex representation would be A5A5A5A000002710A1FFFFFFACA2FFFD54675A5A5A.
Right now I'm doing this:
int main(int argc, char *argv[])
{
    int numBytes = 10;
    signed char *tmp;
    signed char *pyld;
    pyld = calloc(numBytes, sizeof(char));

    signed int val1 = 10000; //0x2710
    signed int val2 = -84;   //0xFFAC
    signed int val3 = -175001 //0xFFFD5467

    tmp = pyld;

    *(tmp + (numBytes - 1)) = DACHEAD;
    *(tmp + (numBytes - 2)) = DACHEAD;
    *(tmp + (numBytes - 3)) = DACHEAD;
    *(tmp + (numBytes - 4)) = VALONE;
    *(tmp + (numBytes - 5)) = val1;
    printf("payload = %hhx%hhx%hhx%hhx%hx%hx%hhx%hx\n", pyld[9], pyld[8], pyld[7], pyld[6], pyld[5], pyld[4], pyld[3], pyld[2], pyld[1], pyld[0]);
}

The output is: "payload = a5a5a5a0100a1ffac"
My val1 value is incorrect and I'm wondering if there is a better way to compose this packet. Should I be doing bit shifts instead?
Any help is greatly appreciated.
Thanks!

A: A better way of sending data over network is using a serialization library. For example, see this question
Also, if you do not want to use external libraries you should first understand integer sizes that you need, either it is 16 bit or 32 bit, the endianness (and convert accordingly) that your device uses and always prefer using memcpy for putting values of correct size into binary buffer.


text:
Q: trouble with angular and flask - error message vauge Not able to get angular to read in an object fetched via service. Error message in brower is really vauge, doesn't reference any of my code lines. I checked via Chrome Developer tools and the api call is getting made. Any ideas?
Error message:
TypeError: undefined is not a function
    at copy (http://127.0.0.1:5000/static/lib/angular/angular.js:593:21)
    at http://127.0.0.1:5000/static/lib/angular/angular-resource.js:410:19
    at wrappedCallback (http://127.0.0.1:5000/static/lib/angular/angular.js:6846:59)
    at http://127.0.0.1:5000/static/lib/angular/angular.js:6883:26
    at Object.Scope.$eval (http://127.0.0.1:5000/static/lib/angular/angular.js:8057:28)
    at Object.Scope.$digest (http://127.0.0.1:5000/static/lib/angular/angular.js:7922:25)
    at Object.Scope.$apply (http://127.0.0.1:5000/static/lib/angular/angular.js:8143:24)
    at done (http://127.0.0.1:5000/static/lib/angular/angular.js:9170:20)
    at completeRequest (http://127.0.0.1:5000/static/lib/angular/angular.js:9333:7)
    at XMLHttpRequest.xhr.onreadystatechange (http://127.0.0.1:5000/static/lib/angular/angular.js:9303:11)

Service:
angular.module('angularFlaskServices', ['ngResource'])
  .factory('Pic', function($resource) {
    return $resource('/api/pic/:picId', {}, {
      query: {
        method: 'GET',
        params: { picId: '' },
        isArray: true
      }
    });
  })
;

Angular Controller:
function ProfileController($scope, Pic) {
    var picsQuery = Pic.get(function(pics) {
        $scope.pics = pics;
    });
}

Flask View:
@app.route('/api/pic/')
def on_recent():
    if not session.has_key('access_token'):
        return 'Missing Access Token'
    try:
        api = client.InstagramAPI(access_token=session['access_token'])
        recent_media, next = api.user_recent_media()
        print recent_media
        photos = []
        for media in recent_media:
            if (media.type != "video"):
                photos.append({"picId": 1, "url": media.get_low_resolution_url()})
    except Exception as e:
        print(e)
    return json.dumps(photos)

A: Your service code looks good but I am not sure if you have all of your dependencies injected properly.
var app = angular.module('myApp', ['angularFlaskServices']);
app.controller('ProfileController', [
  '$scope',
  'Pic',
  function($scope, Pic) {
     var picsQuery = Pic.get(function(pics) {
       $scope.pics = pics;
     });
}]);


text:
Q: What is the gdbserver used when running linux kernel on qemu? I am new to kernel debugging using gdb. Few days back I read that we can turn on KGDB which is a gdb server running in the kernel . We can connect to this gdbserver on kernel using the gdb client on host machine used for development.
Today I came across a different solution where we run the kernel on a virtual environment on qemu. There we do not turn on the KGDB still we can connect to the qemu using gdb client. I think "gdbstub" acts as the gdbserver here and gdb client connects to QEMU and not the kernel. Is my understanding correct? This setup is somewhat similar to using a JTAG to control the cpu rather than the kernel. Is this correct?

A: Yes, that's right. QEMU includes a built-in gdbstub which allows you to connect a debugger to it to get "system-level" debugging somewhat analagous to a JTAG level debugger on real hardware. This means that you don't need any support in the guest code for debugging, and you can debug situations where the guest code is broken to the point where its built-in debug support might be non-functional; and of course it works for guest OSes which have no low-level debug support of their own. On the other hand, it means that the debug stub has no understanding of the guest OS and so it cannot present you with any information about guest OS internals like processes and it can't provide OS-aware debug actions like "debug this guest OS userspace process only".
Whether the guest Linux KGDB support or QEMU's gdbstub is more useful to you will depend on the particular situation and requirements you have.

A: It's better to build your custom guest Linux kernel with debug info (symbols) available then run it in the guest, then when you use gdbstub in QEMU, you can load the symbols from the host gdb.


text:
Q: On gnome (wayland), how to swap ctrl and alt on both sides? gnome-tweak-tools provides an option to swap left ctrl and alt, but not right ctrl and alt. How should I swap ctrl and alt on both sides?

A: I ended up by editing /usr/share/X11/xkb/keycodes/evdev and swap the keycode of ctl and alt. However, this change may be lost every time a relevant system package upgrades.


text:
Q: Don't know how to edit overflowing list item I have a question about list items. How can I code that 3 list items are on top and 3 at the bottom. It just overflowing to the right site.

İnternetim neden yavaş?

Herkes internet dehası değildir, ancak hiç kimse sayfaların yüklenmesini, videoların oynatılmasını veya sosyal medyadan en son bilgileri almayı beklemeyi sevmez. İnternetiniz yavaşsa, bunun olmasının birkaç nedeni olabilir. Sorunun internetiniz mi yoksa bilgisayarınızla ilgili bir sorun mu olduğunu belirlemenin en kolay yolu hızınızı test etmektir. Buna iki kısım dahildir: yükleme hızı, bir web sitesine resim ve video yükleme hızı ve indirme hızı, başka bir yerden ne kadar hızlı bilgi aldığınız. Hiç kimse bir video arabelleğini saatlerce tekrar tekrar izlemek istemez. En sevdiğiniz resimleri sosyal medyaya yükleyememenin hayal kırıklığını hepimiz biliyoruz. Sorunun internet hizmetinizde olup olmadığını anlamak için hızınızı test etmeniz gerekir.

Ne yapmalıyım?

İlk ve en önemli adım internet hızınızı test etmektir; bu, sorunun bilgisayarınız, ağınız veya internet servis sağlayıcınızla ilgili olup olmadığını anlamanıza yardımcı olacaktır. Bir hız testi çözümü seçerken güvenilir bir hizmet seçmek önemlidir, çünkü yanlış sonuçlar daha fazla hayal kırıklığına neden olabilir ve üretkenliği geciktirebilir. Hız Testi Me, internet hızınızı ölçmek için içeriğe hızlı erişim sağlar, bu da sonuçları indirme ve yükleme hızlarına doğru bir şekilde bölerek yalnızca ana soruna odaklanmanıza olanak tanır.

İnternet Hızı Neden Bu Kadar Önemli?

İnternet hızı, çalışmanın, alışveriş yapmanın veya sadece çevrimiçi eğlenmenin kritik bir bileşenidir. İnternet hızınızı arada bir internet hız testi ile kontrol etmek, internet bağlantınızın ödediğiniz internet hızıyla aynı hizada olduğundan emin olmak önemlidir. İnternet hızınızın ne kadar hızlı olduğu, fotoğrafları ne kadar hızlı görüntüleyebileceğinizi, dosya yükleyebileceğinizi, ekleri indirebileceğinizi ve genellikle çevrimiçi olarak yaptığımız günlük aktivitelerin birçoğunu belirleyecektir.

Neden bu hız testini kullanmalısınız?

Tüm DSL hızlarını ücretsiz ölçün. 60 saniye içinde bir indirme testi gerçekleştirilir. Bunu yaparken, rastgele boyuttaki veri paketleri, bağlantınız aracılığıyla ev bilgisayarına aktarılır. Buradan hesaplanan indirme hızı, kontrol edilen bağlantıya ulaşılabilecek hız hakkında bilgi sağlar. DSL veya ISDN bağlantınız olup olmadığına bakılmaksızın - hız testi sırasında bağlantının gereksiz programlar tarafından mümkün olduğunca az yüklenmesi önemlidir.

DSL testi ne için kullanılamaz?

Hat testimiz %100 doğru sonuçlar veremez. Bununla birlikte, transfer oranlarının nispeten iyi bir tahmini için değerler çok yardımcı olabilir. Bunun temel nedeni, ölçüm üzerinde az çok büyük etkisi olan birçok parametrenin sürekli değişebilmesidir. Ölçüm sonucu, DSL sağlayıcınız için kanıt olarak kullanılamaz. Ölçüm sonuçları için garanti verilmez. Hizmet kalıcı olarak mevcut değildir.

Bant genişliği nedir?

Bant genişliği, internet dünyasında verilerin aktarılma, yüklenme veya indirilme oranını ifade etmek için kullanılan bir terimdir. Ancak bilgisayarınızın gerçek hızı yalnızca bant genişliğine değil, işlemcisine de bağlıdır. Yavaş bir işlemci ile yüksek bant genişliği, düşük performans anlamına gelir. Yavaş bant genişliğine sahip yüksek işlemci kalitesi de düşük performans anlamına gelir. Müşterilerin internet bağlantılarının hızını düzenli olarak kontrol edebilmeleri için bant genişliği hız testi sunan birçok çevrimiçi mağaza var. Sadece ücretsiz olarak tekliflerinden yararlanın ve bilgisayarınızın neler olduğunu görün.

A: You can use css flex (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox).
Youll need to set your ul to become a flex element and allow flex content to break into new lines.
display: flex;
flex-wrap: wrap;

Then set the flex property of your li to make the li's take 1/3rd of the width:
flex: 0 0 33.3333%;

For completeness, flex: 0 0 33.3333%; is a shorthand for:
flex-shrink: 0;
flex-grow: 0;
flex-basis: 33.3333%;

Also reset the browser default margin on blockquote to make everything fit nicely.
I put everything together in a snippet down below.

ul {
  display: flex;
  flex-wrap: wrap;
}

ul li {
  flex: 0 0 33.33%;
}

blockquote {
  margin: 0;
}

İnternetim neden yavaş?

Herkes internet dehası değildir, ancak hiç kimse sayfaların yüklenmesini, videoların oynatılmasını veya sosyal medyadan en son bilgileri almayı beklemeyi sevmez. İnternetiniz yavaşsa, bunun olmasının birkaç nedeni olabilir. Sorunun internetiniz
        mi yoksa bilgisayarınızla ilgili bir sorun mu olduğunu belirlemenin en kolay yolu hızınızı test etmektir. Buna iki kısım dahildir: yükleme hızı, bir web sitesine resim ve video yükleme hızı ve indirme hızı, başka bir yerden ne kadar hızlı bilgi
        aldığınız. Hiç kimse bir video arabelleğini saatlerce tekrar tekrar izlemek istemez. En sevdiğiniz resimleri sosyal medyaya yükleyememenin hayal kırıklığını hepimiz biliyoruz. Sorunun internet hizmetinizde olup olmadığını anlamak için hızınızı
        test etmeniz gerekir.

Ne yapmalıyım?

İlk ve en önemli adım internet hızınızı test etmektir; bu, sorunun bilgisayarınız, ağınız veya internet servis sağlayıcınızla ilgili olup olmadığını anlamanıza yardımcı olacaktır. Bir hız testi çözümü seçerken güvenilir bir hizmet seçmek önemlidir,
        çünkü yanlış sonuçlar daha fazla hayal kırıklığına neden olabilir ve üretkenliği geciktirebilir. Hız Testi Me, internet hızınızı ölçmek için içeriğe hızlı erişim sağlar, bu da sonuçları indirme ve yükleme hızlarına doğru bir şekilde bölerek yalnızca
        ana soruna odaklanmanıza olanak tanır.

İnternet Hızı Neden Bu Kadar Önemli?

İnternet hızı, çalışmanın, alışveriş yapmanın veya sadece çevrimiçi eğlenmenin kritik bir bileşenidir. İnternet hızınızı arada bir internet hız testi ile kontrol etmek, internet bağlantınızın ödediğiniz internet hızıyla aynı hizada olduğundan emin
        olmak önemlidir. İnternet hızınızın ne kadar hızlı olduğu, fotoğrafları ne kadar hızlı görüntüleyebileceğinizi, dosya yükleyebileceğinizi, ekleri indirebileceğinizi ve genellikle çevrimiçi olarak yaptığımız günlük aktivitelerin birçoğunu belirleyecektir.

Neden bu hız testini kullanmalısınız?

Tüm DSL hızlarını ücretsiz ölçün. 60 saniye içinde bir indirme testi gerçekleştirilir. Bunu yaparken, rastgele boyuttaki veri paketleri, bağlantınız aracılığıyla ev bilgisayarına aktarılır. Buradan hesaplanan indirme hızı, kontrol edilen bağlantıya
        ulaşılabilecek hız hakkında bilgi sağlar. DSL veya ISDN bağlantınız olup olmadığına bakılmaksızın - hız testi sırasında bağlantının gereksiz programlar tarafından mümkün olduğunca az yüklenmesi önemlidir.

DSL testi ne için kullanılamaz?

Hat testimiz %100 doğru sonuçlar veremez. Bununla birlikte, transfer oranlarının nispeten iyi bir tahmini için değerler çok yardımcı olabilir. Bunun temel nedeni, ölçüm üzerinde az çok büyük etkisi olan birçok parametrenin sürekli değişebilmesidir.
        Ölçüm sonucu, DSL sağlayıcınız için kanıt olarak kullanılamaz. Ölçüm sonuçları için garanti verilmez. Hizmet kalıcı olarak mevcut değildir.

Bant genişliği nedir?

Bant genişliği, internet dünyasında verilerin aktarılma, yüklenme veya indirilme oranını ifade etmek için kullanılan bir terimdir. Ancak bilgisayarınızın gerçek hızı yalnızca bant genişliğine değil, işlemcisine de bağlıdır. Yavaş bir işlemci ile
        yüksek bant genişliği, düşük performans anlamına gelir. Yavaş bant genişliğine sahip yüksek işlemci kalitesi de düşük performans anlamına gelir. Müşterilerin internet bağlantılarının hızını düzenli olarak kontrol edebilmeleri için bant genişliği
        hız testi sunan birçok çevrimiçi mağaza var. Sadece ücretsiz olarak tekliflerinden yararlanın ve bilgisayarınızın neler olduğunu görün.


text:
Q: Abrikosov's Vortex Lattice (Beta Parameter) In order to find the correct vortex lattice configuration (i.e. ground state) in Ginzburg-Landau theory (or the Abelian Higgs Model), it is standard practice to minimize the beta parameter:
$\beta=\frac{\langle |\phi|^{4}\rangle}{\langle |\phi|^{2}\rangle}$.
What is the difference between minimizing $\beta$ and minimizing $\langle |\phi|^{4}\rangle$? Why are they not equivalent?

A: The answer can be found in Abrikosov's paper: Sov. Phys. JETP 5 1174 (1957). The free energy for the vortex lattice is
$F=H_{0}^{2}-\frac{(H_{c}+H_{0})(H_{c}-H_{0})}{\beta(2\chi^{2}-1)}$, where $H_{0}$ is the external magnetic field, $H_{c}\equiv\chi$ is the critical field above which the vortex lattice is unstable and the ground state is the normal vacuum, $\beta_{A}$ is the Abrikosov parameter that determines the lattice structure and $\chi$ is the only free parameter in the theory. The minimum value $\beta$ can take is $1.1596$ for a hexagonal lattice. This assertion is valid for $\chi>\frac{1}{\sqrt{2}}$. Therefore, minimizing $\beta$ gives the correct ground state, it is not equivalent to minimizing $\langle |\phi|^{4}\rangle$.


text:
Q: Understanding load cell I am trying to understand how load cell works and which one to choose for my project.
For example lets say I use this load cell.

*

*List of properties in case the link won't work:
Weight Capacity Max 5 kg
Zero Balance ± 75 g
Cell Non-Linearity Max   2.5 g
Rated Output 1 mV/V
Rated Output Error Max   ± 150 μV/V
Supply Voltage Max   5 V DC
Let's say I give 5 V to it from an Arduino [I know it will be a lower voltage but I am trying to make it simple for my own understanding].

*

*How can I know  what will be the output/kg? i.e what will be the voltage output for 100 gram, 1kg, 5kg?

*What is the minimum difference I can notice? I mean how much I need to increase the weight in order to get a noitceable increase in voltage output?

A: Strain gauges are small precious metal conductors usually stretched to measure strain in a bridge configuration. There is good detail here: http://www.ni.com/white-paper/3642/en/   ....and here: http://www.omega.com/toc_asp/frameset.html?book=Pressure&file=strain-gage-position_REF
Every strain gauge is individually calibrated since it is affected by the strain (in itself) when glued to a surface providing the measurement lever. Phidgets seem to provide extensive details on the units they manufacture.
Since the strain gauge is an analog sensor the resolution is essentially infinite. For example if the strain gauge is glued to a thin metal strip, then the strip will deflect with very small applied forces/weight. It's only when you digitize the output you get a digital resolution implied (well explained by Phidget).

A: There are a lot of factors which should be considered when working with load cells. But let's start with the load cell itself.
The output sensitivity and the error are usually given in full-scale as a function of the supply voltage. In case of the one you have linked it means that the load cell max voltage change can be calculated as follows:
$$ V_{max} = rated\;output \times supply\; voltage$$
$$ V_{max} = \frac{1\;mV}{V} \times 5\;V = 5\; mV $$
So with a 5 kg load, the output will be 5 mV. The error can be calculated similarly:
$$ V_{maxerror} = ± \frac{150\;\mu V}{V} \times 5\;V = 750\;\mu V = 0.75\;mV $$
So the error with 5 kg is 0.75 mV. That means with 5 kg load, in theory the output can be anything between 4.25 mV and 5.75 mV. Note that the error might be smaller, it is a worst case value.
Theoretically you can say that if the output is 5 mV at 5 kg, then it should be 1 mV at 1 kg. But unfotunately it won't be because of the non-lineraity, drift and other errors.
(The non-linearity means that the resolution of the load cell is not exactly \$ \large \frac{1\;kg}{1\;mV} \$)

But it is completely unnecessary to talk about output voltages right now, because these voltages are too small for the Arduino's ADC (and for other microcontrollers as well). First, they have to be amplified with an instrumentation amplifier into a measurable range. Here is an article about how to choose an instrumentation amplifier for a load cell application. You can also buy pre-made ones as well.

Now, let's assume that the 0 - 5 mV range is now amplified in the range of 0 - 5 V, so with 5 kg load the output will be 5 V (±error). This is a range that the Arduino can measure without any difficulties. Now to start answering you questions.

What is the minimum difference I can notice?

It depends on the resolution of the ADC you are measuring the voltage with. The Arduino's ADC has a 10 bit resolution and 5 V analog voltage reference, so the minimal detectable step will be:
$$ V_{step} = \frac{5\;V}{2^{10} - 1} = \frac{5\;V}{1023} = 4.89\;mV$$
How much is it in weight? Can't say for sure because the errors are there and the errors are amplified as well. (Also there can be external noise sources as well) But you know that it is the smallest voltage difference that can be measured. (Note that the supply voltage has some error, the ADC has some error as well so it will be probably a bit worse than this.)

How can I know what will be the output/kg? i.e what will be the voltage output for 100 gram, 1kg, 5kg?

As it had been told in the other answer you have to perform calibration to know exactly your scale's transfer factor, which will be used to convert votlage values into gram or kilogram. You have to do measurements with reference weights. Measure the output with known weights, for example 50 g, 100 g, 150 g, 200 g, 250 g, and draw up a charateristic, then determine how much is the voltage change between each step. This will give you a value \$ \large \frac{X\;mV}{50\;g} \$, if X is quite bigger than 4.89 mV you can calibrate in 10 g steps and see if it is still good and the values are distinguishable (if it is smaller then 4.89 mV then a larger step should be used). So you can decide 100 % from the measured values that it was 10 g or 20 g.
Of course you can (and should) perform averaging in software to reduce error.

A rather long reading but very detailed is: A Reference Design for High-Performance, Low-Cost Weigh Scales, I strongly recommend it. Also read about Wheatstone-bridges.
(I have used coins as reference weights, their value is easily accessible and they were accurate enough for me.)


text:
Q: Unknown Method – yii\base\UnknownMethodException Calling unknown method: yii\web\Request::post() I am new to yii2 and I have created a form, however it is showing the following error while loading the page:
Unknown Method – yii\base\UnknownMethodException
Calling unknown method: yii\web\Request::post()
The code in studController
public function actionStudform()
    {
        $data = Stud::find()->asArray()->all();

        $model = new Stud;
        if(($model->load(Yii::$app->request->post())) && $model->validate())
        {
              echo "validate";
        }
        else
        {
            return $this->render('studform',['model'=>$model,'data'=>$data]);
        }
    }

A: ok
i also faced that problem and i had sorted out also
in yii2 you have to check that if form is posted or not ?
if form posted then you have to fetch data or print data
try my code it working in my case with same error
public function actionStudform()
    {
        $data = Stud::find()->asArray()->all();

        $model = new Stud;
        $request = Yii::$app->request;
        if($request->isPost)
        {
            if(($model->load($request->post)) && $model->validate())
            {
                print_r($request->post['Stud']);
            }
            return $this->render('studform',['model'=>$model,'data'=>$data]);
        }
        else
        {
            return $this->render('studform',['model'=>$model,'data'=>$data]);
        }
    }

A: Check namespace use Yii in your controller
OR

I think this is again the composer dependency resolver doing unexpected things:

*

*you require yiisoft/yii2 in your composer.json but do not have the composer asset plugin installed.

*then the dependency resolver does not find packages with vendor bower-asset so it looks for other versions of yiisoft/yii2 that do not have conflict

*The result is to install the beta version of yii2 to be installed

The correct solution as already mentioned is to install the composer-asset-plugin:
php composer.phar global require "fxp/composer-asset-plugin:1.0.*@dev"


text:
Q: height of imageview in in listview good morning i tried to create a custom listview that contains in every item an imageview.
My pb is that in result the imageview doesn't cover the hole item.
I had a padding in bottom and in the front of the item.
this the xml file for the item row
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <ImageView
        android:id="@+id/bgitem"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:minHeight="?android:attr/listPreferredItemHeight"/>

</RelativeLayout>

and the xml code of the activity that contains the listview
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                 android:orientation="horizontal"
                 android:layout_width="fill_parent"
                 android:layout_height="fill_parent"
>
 <ListView
                 android:id="@+id/listView2"
                 android:layout_width="fill_parent"
                 android:layout_height="match_parent"
 />
             </LinearLayout>

i hope that someone help me
this is the item image you see the black padding in the bottom

A: use following code in xml .....
<ImageView
    android:id="@+id/bgitem"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:scaleType="fitXY"
    />

hope this will work...


text:
Q: Modulus division returns an integer? Does modulus division only return integers? I need a float return. See the following:
var_dump(12 % 10); // returns 2, as expected
var_dump(11.5 % 10); // returns 1 instead of 1.5?

A: Yes.  the % operator returns an integer.
If you want a floating point result, use the fmod() function instead.

A: See the manual.

Operands of modulus are converted to integers (by stripping the
  decimal part) before processing.

11.5 becomes 11.
11 % 10 = 1 remainder **1**
Your solution: fmod(), as tom_yes_tom suggests.

A: Quoting the documentation page:

"Operands of modulus are converted to integers (by stripping the
  decimal part) before processing."

A:
Is there any workaround for this?

mathematics...
11.5 - floor(11.5 / 10) * 10 == 1.5


text:
Q: laravel 5.3: ErrorException in UrlGenerator.php line 314: Route [produce.reduceByOne] not defined Here my routes code in web.php
Route::get('/reduce/{id}',[
    'uses'  => 'ProductController@getReduceByOne',
    'as'    => 'product.reduceByOne'
]);

Controller method:
public function getReduceByOne($id)
{
    $oldCart = Session::has('cart') ? Session::get('cart') : null;
    $cart = new Cart($oldCart);
    $cart->reduceByOne($id);

    Session::put('cart', $cart);
    return redirect()->route('product.shoppingCart');
}

View Pages
Reduce by 1

A: you need to give the route a name in order to use it via the route function
like below
Route::get('/reduce/{id}','ProductController@getReduceByOne')->name('product.reduceByOne');

then you can use it like below
return redirect(route('product.reduceByOne'));
in your case
Reduce by 1


text:
Q: Build URL Using GA Attributes Good Day All
I am completely new to this type of query but is it possible to define a url on a button click on a page that populates the/a URL with information form the Google Tag stack? e.g. Campaign, Source etc?
Sorry for the vague question.

A: Here are the two method that you can use to create a GA Attributes tagged url
https://support.google.com/analytics/answer/1033867?hl=en
&
http://www.utm.io/


text:
Q: How to manage loading dynamic views from utility class I am working on a wpf dll which contains a number of views with accompanying view models to satisfy MVVM.
In my project I have a class which acts as my "view manager" which handles binding each view to their correct view model.
namespace ControlsAndResources
{
    public class View
    {
        private static readonly ViewModelLocator s_viewModelLocator = new ViewModelLocator();

        public static readonly DependencyProperty ViewModelProperty = DependencyProperty.RegisterAttached("ViewModel", typeof(string),
            typeof(ViewModelLocator), new PropertyMetadata(new PropertyChangedCallback(OnChanged)));

        public static void SetViewModel(UserControl view, string value) => view.SetValue(ViewModelProperty, value);

        public static string GetViewModel(UserControl view) => (string)view.GetValue(ViewModelProperty);

        private static void OnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            UserControl view = (UserControl)d;
            string viewModel = e.NewValue as string;
            switch (viewModel)
            {
                case "TestViewModel":
                    view.DataContext = s_viewModelLocator.TestViewModel;
                    break;
                case "FooViewModel":
                    view.DataContext = s_viewModelLocator.FooViewModel;
                    break;
                default:
                    view.DataContext = null;
                    break;
            }
        }
    }
}

Then I do the binding on each of my xaml declarations (here is one example)
<UserControl x:Class="Foo.Bar.TestView"
             ...
             ...
             xmlns:controls="clr-namespace:Foo.Bar.ControlsAndResources"
             controls:View.ViewModel="TestViewModel"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800">
  <Grid>
    ...
    ...
  </Grid>
</UserControl>

And this works perfectly. But now what I would like to do is, in my MainView.xaml, include a ContentControl or an ItemControl and use Binding to update my views from my View class. How do I go about doing that?

A: Here's what I would do: I would write a MainViewModel that implements INotifyPropertyChanged. I'd give it a SelectedChild property. I'm going to make some assumptions about the INotifyPropertyChanged implementation you've got. Let me know if those assumptions are off base, and we can get it working with what you've got.
MainViewModel.cs
private Object _selectedChild;
public Object SelectedChild
{
    get => _selectedChild;
    set => SetProperty(ref _selectedChild, value);
}

MainViewModel will be the DataContext of our main view, probably MainWindow.
MainWindow.xaml.cs
public MainWindow()
{
    InitializeComponent();

    //  More about this guy later
    DynamicDataTemplateCreator creator = this.FindResource("DynamicDataTemplateCreator")
        as DynamicDataTemplateCreator;

    //  This gibberish is a stand in for whatever information the template creator
    //  may need to figure out what type of view belongs to what type of viewmodel.
    creator.ViewLookupInformation =
        "My expatriate aunt Sally ate nine autumnal polar bears in Zanzibar.";

    DataContext = new MainViewModel();
}

In MainWindow's XAML, we'll put a ContentControl bound to SelectedChild, and we'll create an instance of a template selector (see below) that will be used to create the template that displays SelectedChild:
MainWindow.xaml
<Window.Resources>
    <local:DynamicDataTemplateCreator x:Key="DynamicDataTemplateCreator" />
</Window.Resources>
<Grid>
    <ContentControl
        Content="{Binding SelectedChild}"
        ContentTemplateSelector="{StaticResource DynamicDataTemplateCreator}"
        />

DynamicDataTemplateCreator.cs
And here's how we create DataTemplates to display viewmodels with views whose type is determined at runtime.
public class DynamicDataTemplateCreator : DataTemplateSelector
{
    //  If mainwindow or the main viewmodel has information that we need about the
    //  dynamically loaded views, pass that information via this property. It can be any
    //  type you want, preferably the exact type of the information you are passing.
    public object ViewLookupInformation { get; set; }

    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        //  item is the viewmodel.
        Type viewType = null;

        //  A quickie UserControl I wrote for testing.
        //viewType = typeof(VMView);

        /*
         * logic here to determine the type of view we want. Assign that Type to viewType
         *  If you need extra information from the main program, smuggle it in to here via
         *  ViewLookupInformation
         */

        return new DataTemplate
        {
            VisualTree = new FrameworkElementFactory(viewType)
        };
    }
}


text:
Q: Netbeans "waiting for connection (netbeans-xdebug)" on Mac 10.8.5 I've setup Netbeans & Xdebug several times on a windows machine, but this is my first time on a mac. Should be pretty much the same, but I can't get it going.
My php.ini settings:
zend_extension="/opt/local/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
1922 [xdebug]
1923 xdebug.remote_autostart=0
1924 xdebug.remote_enable=1
1925 xdebug.remote_handler="dbgp"
1926 xdebug.remote_mode="req"
1927 xdebug.remote_port=9002
1928 xdebug.remote_host=127.0.0.1
1929 xdebug.profiler_enable=0
1930 xdebug.profiler_output_dir="/tmp/"
1931 xdebug.idekey="netbeans-xdebug"
1932 xdebug.remote_log="/home/mmutrux/xdebug.log"

This loads up in the phpinfo:

My Netbeans settings use the same port (9002)

What did I miss?

A: It turns out that Xdebug will only connect if I run it on my index.php file.
I started with a plain index.html file and a getData.php file.  Running the debugger on getData.php did not work until i added an index php page and ran the debugger on that.  From that point on (with the debugger running) I could set breakpoints on all other php files and get the expected behavior.


text:
Q: Fatal error: Call to a member function on user I would like to use the get method from a User class inherit from FOSUserBundle. but i have an error :

Fatal error: Call to a member function getNom() on a non-object.

My User Class :
<?php
namespace Olr\LoanBundle\Entity;

use FOS\UserBundle\Entity\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="fos_user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=255)
     *
     */
    protected $nom;

    /**
     * @ORM\Column(type="string", length=255)
     *
     */
    protected $prenom;

    /**
     * @ORM\Column(type="string", length=50)
     *
     */
    protected $adresse;

    /**
     * @ORM\Column(type="string", length=50)
     *
     */
    protected $adresse2;

    /**
     * @ORM\Column(type="string", length=5)
     *
     */
    protected $cp;

    /**
     * @ORM\Column(type="string", length=50)
     *
     */
    protected $ville;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set nom
     *
     * @param string $nom
     */
    public function setNom($nom)
    {
        $this->nom = $nom;
    }

    /**
     * Get nom
     *
     * @return string
     */
    public function getNom()
    {
        return $this->nom;
    }

    /**
     * Set prenom
     *
     * @param string $prenom
     */
    public function setPrenom($prenom)
    {
        $this->prenom = $prenom;
    }

    /**
     * Get prenom
     *
     * @return string
     */
    public function getPrenom()
    {
        return $this->prenom;
    }

    /**
     * Set adresse
     *
     * @param string $adresse
     */
    public function setAdresse($adresse)
    {
        $this->adresse = $adresse;
    }

    /**
     * Get adresse
     *
     * @return string
     */
    public function getAdresse()
    {
        return $this->adresse;
    }

    /**
     * Set adresse2
     *
     * @param string $adresse2
     */
    public function setAdresse2($adresse2)
    {
        $this->adresse2 = $adresse2;
    }

    /**
     * Get adresse2
     *
     * @return string
     */
    public function getAdresse2()
    {
        return $this->adresse2;
    }

    /**
     * Set cp
     *
     * @param string $cp
     */
    public function setCp($cp)
    {
        $this->cp = $cp;
    }

    /**
     * Get cp
     *
     * @return string
     */
    public function getCp()
    {
        return $this->cp;
    }

    /**
     * Set ville
     *
     * @param string $ville
     */
    public function setVille($ville)
    {
        $this->ville = $ville;
    }

    /**
     * Get ville
     *
     * @return string
     */
    public function getVille()
    {
        return $this->ville;
    }
}

from my controler :
public function invitationAction($token)
{
    $em = $this->getDoctrine()->getEntityManager();
    $entity = $em->getRepository('OlrLoanBundle:User')->findBy(array('salt'=>$token));

    return $this->render('OlrLoanBundle:Tribu:invitation.html.twig',
        array('nom'=>$entity->getNom(),
              'prenom'=>$entity->getPrenom(),
            ));
}

A: findBy() returns an array, so you cannot invoke methods on it.


text:
Q: How to control a motor with Arduino? I have two of these 12 V motors and a 12V battery.
I want to know what is the best solution to control the motor with an Arduino Uno. Does the motor controller need to be 100 ampere proof?
I though of a 100 ampere transistor connected to the PWM pin of Arduino, and then, it will control the motor with PWM.
Is a voltage regulator better than PWM?

A: The motor in the link is of different kind. I am not sure about it whather it is used as a generator or motor. Please specify your application. It is preferable that you first check the basics. you have 12 V motor and 12V battery, however the current capacity of the battery is not specified (ampere hours.)
In the question you have asked about how to control a motor from Arduino. Assuming that the motor is a simple DC motor, you can simply control it by interfacing a external H-bridge driver (IC) to your Arduino UNO or you can simply use Arduino Leonardo-compatible with L298P motor controller which has the same driver on board.
PWM is easier to control in a digital environment, the efficiency of PWM is way better than voltage regulation.


text:
Q: How can i drop the event if multiple id's are there $(".draggable").bind('drag',function(event)
                    {
                        data1=event.target.id;
                    });
                $("#div1").on("dragover", function(event)
                {
                        event.preventDefault();
                        event.stopPropagation();
                });

                $("#div1").on("dragleave", function(event)
                {
                         event.preventDefault();
                         event.stopPropagation();
                });

                $("#div1").on('drop',function(event)
                                {
                                    event.preventDefault();
                                    var d=document.getElementById(data1).innerHTML;
                                    event.target.innerHTML=event.target.innerHTML+d;
                                });

In this we are dropping the dragged event to only one div tag...but if we have multiple div targets tags how to use drop event


text:
Q: how to check con 1 and (con 2 or con 3) so my code is
wh = []
wh.append("2")
wh.append("lodw")
if wh[0] == "1" and wh[1] == "lol" or wh[1] == "lodw":
 print("da")
else:
 print("net")

the problem is it gives me true even if wh at 0 isnt "1"

A: Your if clause is equal to :
if (wh[0] == "1" and wh[1] == "lol" )or wh[1] == "lodw":

Therefore, the statement is true
Set paranthisis if you want to achieve False:
if wh[0] == "1" and (wh[1] == "lol" or wh[1] == "lodw"):

A: Since you check the value of wh[1] is a specific string you can do
if wh[0] == "1" and wh[1] in ("lol", "lodw"):

Or to use any with all
if all((wh[0] == "1", any((wh[1] == "lol", wh[1] == "lodw")))):


text:
Q: Google Apps Enable SSL Issue am getting an unclear error , while enabling SSL for custom domain in google apps, i clicked enable billing, and according to new Appengine pricing , 5 Solts of SNI SSL Certificates are free, after enabling ssl, i got the following error
<--app name here--> has insufficient budget to add additional SSL resources. Increase the application's daily budget to be able to allocate VIPs or SNI certificate slots.
appengine console says  $0.00 per 5 certificates per month (its free)
i even raised my daily budget to $10 but am still getting the same error, does anyone have any idea ?

A: Try after 24 hours, It ll be resolved .
We face such random issue in google App engine setup/admin panel.


text:
Q: Promise in for loop returns wrong value This might be a silly question. Below is a stripped down version of my code.
for (var i = 0; i < objects.length; i++) { // objects.length = 10
    CuQuery.count().then(function(result){
      Cucount = result;
      console.log("i value = "+i);
    }, function(error) {
        response.error(error);
    });
}

In console, I get i value = 10, 10 times as output.
I expected it to print value 1 to 10. What am I doing wrong ? or Is it the correct behavior ?


text:
Q: Reference on spectral theory for selfadjont non-compact operators I cant find any book which treats spectral theory for selfadjont non-compact operators and in particular existance of eigenvectors.
I had a look in Krein and Gohberg's book from -69 but I cant find a desierd result.

A: As soon as you loose compactness the spectral theorem doesn't just talk about eigenvalues, but the entire spectrum, which may now contain a continuous part. So there is a leap from the simple compact operator spectral theorem to the spectral theorem for bounded operators.
I personally like the treatment in say M. Reed & B. Simon "Methods of modern mathematical physics - functional analysis" (pg. ~225). Another good book is W. Rudin "Functional Analysis" (see pg. 321).
Also have a look here for the spectal theorem for bounded oparators.
Addition:
Seems like you are interested in eigenvalues. A word of caution must be given here. A bounded self adjoint operator may have no eigenvalues. Consider for instance $M \colon L^2([0,1]) \to L^2([0,1])$ given by $(Mf)(x) = xf(x)$ has no eigenvalues.
If you are interested in Schrödinger type operators i suggest (as FreeziiS.) that you look at volume IV of Reed & Simons book (it is presented as an area known as perturbation theory). Also T. Kato's book "Perturbation Theory" is worth looking at.

A: IMHO, good references for this subject are:
"J. Blank, P. Exner, M. Havlíček, Hilbert Space Operators in Quantum Physics"
"Brian C. Hall, Quantum Theory for Mathematicians"
You may also have a look here: References

A: This was mentioned in the comments, but you didn't answer those comments, so I'm still not sure if you are aware that "eigenvalue" and "eigenvector" are almost useless notions when dealing with non-compact operators. Below are some examples.

*

*Some selfadjoint operators have a spectral decomposition in terms of eigenvalues. For instance,  $P:\ell^2(\mathbb N)\to\ell^2(\mathbb N)$, given by
$$
P(a_1,a_2,a_3,\ldots)=(a_1,0,a_3,0,a_5,0,\ldots)
$$
is selfadjoint, has eigenvalues $0$ and $1$, and it has a spectral decomposiion
$$
P=1\,P+0\,(I-P).
$$
So the eigenspaces for $P$ are
$$
\{a_1,0,a_2,0,a_3,0,\ldots):\ a\in\ell^2\},\ \ \text{ and } \{(0,a_1,0,a_2,0,\ldots):\ a\in\ell^2\}
$$
and it is possible to construct a basis of eigenvectors.

*Consider, for $f\in L^\infty[0,1]$, the operator $T_f:L^2[0,1]\to L^2[0,1]$ given by $T_fg=fg$. It is not hard to show that $M_f$ is bounded with norm $\|f\|_\infty$, and it is selfadjoint. Its spectrum is the essential range of $f$. For $T_f$ to have an eigenvalue $\lambda$, we would need the equality
$$
\lambda g=T_fg=fg
$$
for some $g\in L^2[0,1]$.
It follows that $f=\lambda$ wherever $g\ne0$, and one can deduce that $f$ would have to be of the form $\lambda\,1_E+h\,1_{E^c}$. So, for example, we could have

*

*$T=M_f$ with $f=1_{[0,1/2]}$, and then $f$ has eigenvalues $0,1$ and it admits a basis of eigenvectors (this is exactly the same example as in 1.).

*$T=M_f$ with $f=1_{[0,1/2]}+x\,1_{1/2,1]}$. Here $1$ is an eigenvalue, and any function supported in $[0,1/2]$ is an eigenvector. But there are no other eigenvalues, and $T$ does not admit a basis of eigenvectors.

*As already mentioned in the comments, if $T=M_f$ with $f$ the identity function $f(x)=x$, then $T$ has no eigenvalues at all.

A: I found a result that coverd my needs, in the last chapter of Conways "A course in F.A".
If $N$ is normal and $\lambda$ is in the complement of the essential spectra then it is a eigenvalue of finite multiplicity.
Which is what I needed. I wasnt awere of that this is essentially the "compact" part of the operator. The general case is very involved.


text:
Q: Read gRPC metadata in Python server I have client like this:
def run():
    channel = grpc.insecure_channel('localhost:50051')
    stub = helloworld_pb2_grpc.GreeterStub(channel)
    metadata = [('key', "value")]
    response = stub.SayHello(
        helloworld_pb2.HelloRequest(name='you'),
        metadata=metadata
    )
    print("Greeter client received: " + response.message)

And server:
class Greeter(helloworld_pb2_grpc.GreeterServicer):
    def SayHello(self, request, context):
        return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name)

So, in server, how can I read metadata sent by client?

A: https://grpc.io/grpc/python/grpc.html#grpc.ServicerContext.invocation_metadata
We can use context.invocation_metadata() to access client's metadata

A: Just to add a bit on top of the right answer for --
You can retrieve the data like a dictionary e.g
metadict = dict(context.invocation_metadata())
userid = metadict['userid']

Also, I would highly recommend checking out gprc example repo for more advanced use cases -here- using ServerInterceptor