text:
Q: Show NSStatusItem menu only if App is active I'm using this method to show the NSStatusItem menu only if application is Active.
-(void)menuWillOpen:(NSMenu*)menu{
    if(![NSApp isActive]){
        [menu cancelTracking];
    }
    [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
    [window makeKeyAndOrderFront:self];
}

It perfectly works, but cancelTracking seems to block the blue highlight of the NSStatusItem. So when i click on status menu item it doesn't show the submenu and it presents the main window, but the icon is not highlighted.
Is there a way to make it happen ?

A: I suggest creating a custom view if you need more precise control over when the status item highlights itself. Then you can use mouseDown: etc. This is a good example of putting your custom view in a status item.


text:
Q: On click get JSON data into DIV On click I am trying to get data from JSON via an URL into a <div>.
My JSON returns a single id and content I am trying to get content into div #west-container.
Can someone tell me what I am doing wrong?
My JSON Found at the url = [{"id":"2","title":"Generic Overview","content":"This is content here"}]
$('#jqxTree').bind('select', function (event) {
var loadPages = jQuery.parseJSON(
        jQuery.ajax({
            url: 'university/article/3',
            async: false,
            dataType: 'json'
        }).responseText
    );

for(i=0; i < loadPages.length ; i++){
    var current = loadPages;
    $("#west-container").load(current.content);
}
});

A: You can try this one:
 $('#jqxTree').bind('select', function (event) {
   jQuery.ajax({
       url: 'university/article/3',
       async: false,
       dataType: 'json',
       success:function(data){
           $.each(data, function(i, item){
               $("#west-container").html(item.content);
           });        //-----------------^^^^^^^^^^^^---This will fetch you the
       }              //--------------------------------content from json
   });                //-------------------------"content":"This is content here"
});

A: $.getJSON( 'university/article/3', function(data) {
 // Do stuff here

 var oDiv = $( 'west-container' ).html( '' );

 for( var i in data ) {
  oDiv.append( data[i].content );
 }
} );

A: use
    $.ajax({
        url: "url",
        type: 'POST',
        contentType: 'application/json; charset=utf-8',
        data:json,
        dataType:'text',
        async: false,
    }).done(function( data1 ) {
        data=jq.parseJSON(data1);
    });

in order to use the data, use "data.id, data.title" etc.
in order to push data to a div, use
$('#DivId').test(data.id);

redpajama_set_name: RedPajamaStackExchange


text:
Q: ColdFusion Dropbox - How to get the token from the response URI I am trying to implement the OAuth with Dropbox from a ColdFusion application, and I managed how to call the Dropbox method to generate the access token, but... I don't know how to get the generated TOKEN from the response URI. I am getting something like this from Dropbox:
http://localhost/dropbox/generate_token.cfm#access_token=AAAAAAAAYVM_XdCYlbTz0gQOwQkWlg6TDXf84_5h4giikg6J-7Man&token_type=bearer&uid=267693&account_id=dbid%3AAABeDMm-BN0n1DofLZz9kPZAipnQ

How to I retrieve the URL variables in this case? I mean if I do a
<cfdump var="#URL#">

I am getting an empty struct. If I do a
<cfdump var="#CGI#">

I still don't see any of the URL retrieved parameters in the structure. How do I get the variables and their values from the Dropbox response?

A: UPDATED
At some point I thought I found a way to read the URL but now - for no reason - this doesn't work anymore! I didn't change anything but the solution below doesn't work anymore.
I can read the full URL with JavaScript using document.location but this means to do an extra submit to a ColdFusion page and I don't want to do this. I want to get the Dropbox token from the URL and save it to the database directly in this page...
Any new ideas please?

SOLUTION THAT SEEMED TO WORK AT SOME POINT ...
I found a way to get the URI string using this:
<cfset objRequest = GetPageContext().GetRequest().getParameterMap() />

<cfdump var="#objRequest#">

<cfoutput>
<cfloop collection="#objRequest#" item="i">
    <p>
        #i# - #objRequest[i][1]#
    </p>
</cfloop>
</cfoutput>

From now on, I know how to get the values returned by Dropbox.

A: I found a way to get the returned parameters by reading the browser URL with JavaScript, so in two steps: first, parse and extract the full URL including the part after the # sign (I found this has a name and it is called the "URL fragment") and second, create a JavaScript form with parsed parameters and resubmitted to the server. Here is the code:
<cfparam name="FORM.action" default="">

<cfif FORM.action IS "save_token">

    <cfdump var="#FORM#">

<cfelse>

    <form name="main" id="main" method="post">
    <input type="hidden" name="action" id="action" value="save_token">
    </form>

    <script type="text/javascript" language="javascript">
    <!--
        var parameters = window.location.hash.substr(1).split("&");

        function addHidden(theForm, key, value) {
            // Create a hidden input element, and append it to the form:
            var input = document.createElement("input");
            input.type = "hidden";
            input.name = key;
            input.value = value;
            theForm.appendChild(input);
        }

        // Form reference:
        var theForm = document.forms["main"];

        for (var i=0; i<parameters.length; i++) {
            // Add data:
            addHidden(theForm, parameters[i].split("=")[0], parameters[i].split("=")[1]);
        }

        theForm.submit();
    //-->
    </script>

</cfif>


text:
Q: Why shadow is toggling in turnjs? I can't get, why shadow of pages is toggling when page is being turned. Why this could happen?
I tried to write minimal script to reproduce the issue:
http://warp-dev.alvass.in/products/image/


text:
Q: Web Python instead of addslashes i am familiar with php. but new to python. in php i will use addslashes() and stripslashes() method. instead of this what solution is there in python for avoiding sql conflicts.

A: The solution is parameterized statements, where you will do something like this:
db.execute('SELECT * FROM users WHERE username=:user;', {'user': 'john'})

Your SQL client library will handle the quoting and escaping for you. The exact details depend on the library you use (for example, if your RDBMS is PostgreSQL, the library could be psycopg2).


text:
Q: Relation between irreducible polynomial and dimension I found the following in my textbook:
Consider the field extension $\mathbb{Q} \subset \mathbb{Q}(\alpha_1)=:K$ ($\alpha_1$ is a root). Since $f=x^4-2$ is irreducible by Eisenstein's criterion or by reducing $f$ modulo $5$, we find that $[\mathbb{Q}(\alpha_1):\mathbb{Q}]=4$.
I don't understand how the dimension follows from the fact that $f$ is irreducible. Could somebody explain this to me? Thanks!

A: Consider a monic irreducible polynomial $f(x)$ of degree $n$ in the ring $k[x].$ Given a root $\alpha$ of $f(x)$ in some field extension of $k,$ observe that the evaluation homomorphism $\operatorname{ev}_\alpha : k[x] \to k(\alpha)$ defined by $\operatorname{ev}_\alpha(p(x)) = p(\alpha)$ is surjective by definition of $k(\alpha).$ Considering that $\ker \operatorname{ev}_\alpha$ is an ideal of the principal ideal domain $k[x],$ it follows that $\ker \operatorname{ev}_\alpha = (p(x))$ for some monic polynomial $p(x).$ Consequently, we have that $p(x) \,|\, f(x).$ By hypothesis that $f(x)$ is a monic irreducible polynomial, we conclude that $p(x) = f(x)$ so that $\ker \operatorname{ev}_\alpha = (f(x)).$
By the First Isomorphism Theorem, we conclude that $k[x] / (f(x)) \cong k(\alpha).$ Considering that $$k[x] / (f(x)) = \{a_0 \overline 1 + a_1 \overline x + \cdots + a_{n - 1} \overline x^{n - 1} \,|\, a_i \in k \}$$ is a $k$-vector space, it follows that its dimension over $k$ is $n,$ hence we have that $[k(\alpha) : k] = n.$

A: Since the polynomial is of degree 4, a basis of $K$ over $\mathbb{Q}$ is $1, \alpha, \alpha^2, \alpha^3$ (since $\alpha^4=2\in \mathbb{Q}$).

A: Since , the minimal polynomial is of degree 4, hence the elements of the field can be expressed as linear combination of four basis elements of 1,a,a²,a³ over $\mathbb{Q}$ ,where a is the root(a⁴=2). You can think also it as vector space with basis {1,a,a²,a³} over $\mathbb{Q}$.(since, any field is a vector space over any of it's subfield).


text:
Q: How to center linearlayout with 6 buttons on the center on portrait and landscape orientation? What I want to achieve: Center layout with both orientation.
    <ScrollView
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#fffffce0">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="#fffffce0"
    android:weightSum="1">

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="121dp"
        android:background="#fffffce0"
        android:layout_marginTop="42dp"
        android:id="@+id/linearLayout"
        android:gravity="center_horizontal"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true">

        <Button
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:id="@+id/button9"
            android:background="@drawable/custom_button_square"
            android:text="@string/a_d"
            android:textColor="#ffff"
            android:textSize="35sp"
            android:onClick="goToAd"/>

        <Button
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:id="@+id/button10"
            android:background="@drawable/custom_button_square"
            android:text="@string/e_h"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:layout_below="@+id/linearLayout"
        android:layout_centerHorizontal="true"
        android:gravity="center_horizontal"
        android:background="#fffffce0"
        android:id="@+id/linearLayout2">

        <Button
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:id="@+id/button11"
            android:background="@drawable/custom_button_square"
            android:text="@string/i_l"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:id="@+id/button12"
            android:background="@drawable/custom_button_square"
            android:text="@string/m_p"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:layout_below="@+id/linearLayout2"
        android:layout_centerHorizontal="true"
        android:background="#fffffce0"
        android:gravity="center_horizontal">

        <Button
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:id="@+id/button13"
            android:background="@drawable/custom_button_square"
            android:text="@string/m_p"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:id="@+id/button14"
            android:background="@drawable/custom_button_square"
            android:text="@string/q_t"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>

</RelativeLayout>

PROBLEM:
Everything was ok, until the moment  i was tested my app on tablet with bigger screen. When orientation is landscape, everyting is ok, but when i rotate screen, then it looks like that:
http://zapodaj.net/b2780f7e637ab.png.html
I tried to set my gravity i Llayout to center, but it didnt work.

A: because of the different screen resolutions, try not to use those hard-coded digits like android:layout_height="70dp" for example. You can set the layout parameters programmatically for each element of your layout respectively to the actual screen resolution and in this case it will work on every screen size and oriantation. Try with something like this:
//declare two global variables that will have the width and height values
private int width;
private int height;

//define a method that will set the values to the both variables
private static void getScreenResolution(Context context){
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    DisplayMetrics metrics = new DisplayMetrics();
    display.getMetrics(metrics);
    width = metrics.widthPixels;
    height = metrics.heightPixels;
}

In your onCreate() method first call the method above to get the values and then set the layout params (just a simple example):
getScreenResolution(this); //if you are in a fragment, type getActivity() instead of this
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,                             LayoutParams.MATCH_PARENT);
layoutParams.setMargins(width/10, height/15, 0 ,0);   //left, top, right, bottom
yourLinearLayout.setLayoutParams(layoutParams);

Hopefully this helps you to create more general designs in the future :)

A: Well ! Like This. Try This..
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fffffce0" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#fffffce0"
    android:gravity="center"
    android:layout_gravity="center"
    android:orientation="vertical"
    android:weightSum="1" >

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="match_parent"
        android:layout_height="121dp"
        android:layout_marginTop="42dp"
        android:background="#fffffce0"
        android:gravity="center_horizontal"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button9"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:background="@drawable/ic_launcher"
            android:onClick="goToAd"
            android:text="a_d"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:id="@+id/button10"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:background="@drawable/ic_launcher"
            android:text="e_h"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:background="#fffffce0"
        android:gravity="center_horizontal"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button11"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:background="@drawable/ic_launcher"
            android:text="i_l"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:id="@+id/button12"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:background="@drawable/ic_launcher"
            android:text="m_p"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:background="#fffffce0"
        android:gravity="center_horizontal"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button13"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:background="@drawable/ic_launcher"
            android:text="m_p"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:id="@+id/button14"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:background="@drawable/ic_launcher"
            android:text="q_t"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>
</LinearLayout>

A:    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fffffce0" >

<RelativeLayout android:id="@+id/layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"

    >
<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#fffffce0"
    android:orientation="vertical"
    android:weightSum="3" >

    <LinearLayout
        android:id="@+id/linearLayout"
        android:layout_width="wrap_content"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:background="#fffffce0"
        android:orientation="horizontal"
        android:weightSum="2" >

        <Button
            android:id="@+id/button9"
            android:layout_width="0dip"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:background="@drawable/ic_launcher"
            android:onClick="goToAd"
            android:text="a_d"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:id="@+id/button10"
            android:layout_width="0dip"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:background="@drawable/ic_launcher"
            android:text="e_h"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="wrap_content"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:background="#fffffce0"
        android:orientation="horizontal"
        android:weightSum="2" >

        <Button
            android:id="@+id/button11"
             android:layout_width="0dip"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:background="@drawable/ic_launcher"
            android:text="i_l"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:id="@+id/button12"
            android:layout_width="0dip"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:background="@drawable/ic_launcher"
            android:text="m_p"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:weightSum="2"
        android:background="#fffffce0"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/button13"
            android:layout_width="0dip"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:background="@drawable/ic_launcher"
            android:text="m_p"
            android:textColor="#ffff"
            android:textSize="35sp" />

        <Button
            android:id="@+id/button14"
            android:layout_width="0dip"
            android:layout_height="120dp"
            android:layout_weight="1"
            android:background="@drawable/ic_launcher"
            android:text="q_t"
            android:textColor="#ffff"
            android:textSize="35sp" />
    </LinearLayout>
</LinearLayout>


text:
Q: Attaching my query to a SQL transaction I've often run into this little problem when debugging my code. Let's say I have a C# application that processes a few SQL queries as part of a transaction. To keep it simple, I'll use the following example:
using (SqlTransaction myTransaction = myConnection.BeginTransaction("MyTransactionName"))
{
    using (SqlCommand sqlCommand = new SqlCommand("first command text here", myConnection, myTransaction))
    {
        sqlCommand.ExecuteNonQuery();
    }

    // Breakpoint here at which time I'd like to go check in SQL Management Studio what the state of play is

    using (SqlCommand sqlCommand = new SqlCommand("second command text here", myConnection, myTransaction))
    {
        sqlCommand.ExecuteNonQuery();
    }
}

So, as the code says, between the two SQL commands, I'd like to set a breakpoint in my code and check in SQL Management Studio what values have been affected in what tables. The problem is that I cannot run a query against the DB for as long as the transaction is still open. I have to wait in SSMSE for the transaction started in my code to commit or roll back before I can run any queries against the DB.
I've never really used or understood the purpose of giving transactions names (but I've never really used nested transactions either). But it got me wondering, if the name of the transaction is known, is there not a way in SSMSE to "attach" to an open transaction and then run some queries?

A:
I'd like to set a breakpoint in my code and check in SQL Management Studio what values have been affected in what tables. The problem is that I cannot run a query against the DB for as long as the transaction is still open.

Use (NOLOCK) in the SSMS session to look past the lock:
select top 5 * from Posts with (nolock) where Score < 4

I've never really used or understood the purpose of giving transactions names (but I've never really used nested transactions either).

Firstly, it makes working with intermediate save-points a lot easier, but those are rarely used. But a more important usage: it lets the DBA know who to come and kill when a transaction is blocking and causing problems.

is there not a way in SSMSE to "attach" to an open transaction and then run some queries?

No, there is not; and besides, multiple concurrent SPIDs can use the same transaction name (you kinda expect them to, because usually the concurrent work is similar).


text:
Q: Sorting 2d arrays using Java Comparator I have a 2d array called interval[g][2] where g is some number.
Currently, I'm trying to sort the array first by increasing order in the first element, and if they are equal, sort by decreasing order in the second element.
I've attempted this in two ways:
1) Using Java 8's Comparator.comparing method:
Arrays.sort(interval, Comparator.comparing((int[] arr) -> arr[0]));

2) Using Arrays.sort:
Arrays.sort(interval, new Comparator<int[]>() {
    @Override
    public int compare(int[] s1, int[] s2) {
        if (s1[0] > s2[0])
            return 1;
        else if (s1[0] < s2[0])
            return -1;
        else {
            if(s1[1] < s2[1])
                return 1;
            else if (s1[1] > s2[1])
                return -1;
            else
                return 0;
        }
    }
});

The first method returns a partially sorted list.
[[0, 10], [10, 30], [30, 50]]
[[0, 10], [3, 19], [35, 45]]
[[10, 30], [27, 33], [30, 50]]
[[-10, 10], [0, 20], [35, 45]]
[[10, 30], [20, 40], [30, 50]]
[[0, 20], [8, 28], [37, 43]]
[[0, 20], [15, 35], [37, 43]]
[[0, 0], [8, 28], [10, 40]]

As you can see, it's sorting things in a set of three tuples.
The second method doesn't sort the array at all. Can I not sort using primitive data types? Can anyone advise?

A: I think you're looking for this:
Arrays.sort(interval, Comparator.comparingInt((int[] arr) -> arr[0]).thenComparing(Comparator.comparingInt((int[] arr) -> arr[1]).reversed()));

Or if you want to go with the custom Comparator:
 Arrays.sort(interval, new Comparator<int[]>() {
     @Override
     public int compare(int[] o1, int[] o2) {
         int result = Integer.compare(o1[0], o2[0]);
         if (result == 0) {
             result = Integer.compare(o2[1], o1[1]);
         }
         return result;
     }
 });

A: int[][] interval = new int[][] { {0, 10}, {10, 30}, {30, 50}, {0, 10}, {3, 19}, {35, 45}, {10, 30}, {27, 33}, {30, 50}, {-10, 10}, {0, 20}, {35, 45}, {10, 30}, {20, 40}, {30, 50}, {0, 20}, {8, 28}, {37, 43}, {0, 20}, {15, 35}, {37, 43}, {0, 0}, {8, 28}, {10, 40} };

Arrays.sort(interval, Comparator.<int[]>comparingInt(arr -> arr[0]).thenComparing(arr -> arr[1], Comparator.<Integer>naturalOrder().reversed()));

Stream.of(interval).forEachOrdered(ints -> System.out.println(Arrays.toString(ints)));


text:
Q: How to pass extra data with Intent when using options menu's back arrow button? My "child" activity's options menu has a back arrow button, and my putExtra call isn't correctly saving my ByteArray data "sn" (or else, I'm somehow not passing the intent correctly when the back button is clicked). Here's the child activity's onCreate method:
override fun onOptionsItemSelected(item: MenuItem): Boolean {
    Log.d(TAG, "back button was pressed, writing ${sn.toHexString()}")
    val intent = Intent()
    intent.putExtra(EXTRA_SN, sn)
    setResult(REQUEST_CODE_SN, intent)
    return super.onOptionsItemSelected(item)
}

The Log.d line shows the data is correct above, and here's the parent activity:
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    // THE BELOW LINE CAUSES AN EXCEPTION:
    // getByteArrayExtra(EXTRA_SN) must not be null
    sn = intent.getByteArrayExtra(EXTRA_SN)
    Log.d(TAG, "sn is now ${sn.toHexString()}")
    binding = DataBindingUtil.setContentView(this,
        R.layout.activity_foo
    )
}

What's going wrong?


text:
Q: Array sorting in VBNET I have two dimensional integer array x, y as below
{1160, 0},
{1560, 400},
{11940, 10380},
{12480, 540},
{12540, 60},
{12600, 60},
{12720, 120},
{13120, 400},
{13380, 260},
{13680, 300},
{14000, 320}

I need to pick {13120, 400}. I arrive at this by walking the x values in descending order and taking the first pair where the y value increases from the previous record.

A: Try this:
Function GetLargestPair(ByVal data(,) As Integer) As Integer()

    'First convert to data structure that's easier to use
    Dim records As New List(Of Integer())
    For i As Integer = 0 To data.GetUpperBound(0) - 1
        records.Add(New Integer() {data(i, 0), data(i, 1)})
    Next i

    'Now it's very easy to sort descending by the X values:
    Dim sorted = records.OrderByDescending(Function(r) r(0)).ThenBy(Function(r) r(1))

    'And then use that to find the result
    Dim PrevY As Integer = Integer.MaxValue
    For Each pair As Integer() In sorted
        If pair(1) > PrevY Then Return pair
        PrevY = pair(1)
    Next
    'Not clear what you want in this case. I just returned the overall largest X,
    ' but you might prefer Nothing or throwing an exception
    Return sorted.First()
End Function

Call it like this:
'Sample data
Dim data = {{1160, 0}, {1560, 400}, {11940, 10380}, {12480, 540}, {12540, 60}, {12600, 60}, {12720, 120}, {13120, 400}, {13380, 260}, {13680, 300}, {14000, 320}}

Dim result = GetLargestPair(data)
'result should now contain {13120, 400}


text:
Q: vue-reCAPTCHA no funciona Hola estoy utilizando el paquete de vue-reCAPTCHA para insertar una.
Esta capcha es un sub componente por lo que para utilizarlo dentro del sub componente hago lo siguiente.
Este es el script:
import VueRecaptcha from 'vue-recaptcha';
export default {
     components: {
         VueRecaptcha
     }
}

El componente:
<vue-recaptcha ref="recaptcha"
     @verify="onCaptchaVerified"
     @expired="onCaptchaExpired" size="invisible"
     sitekey="mi llave">

  <v-btn :loading="loader" :disabled="loading" color="secondary" @click="loader = true">
           Accept Terms
  </v-btn>
</vue-recaptcha>

Pero me sale el error:
Error para el propietario del sitio: La clave de sitio no es válida
me di cuenta que al:

No aparece en el dom

A: Tienes que agregar esto en tu index.html

En la documentación te lo indica en el AQUI


text:
Q: Issue while adding toolchain in IBM Bluemix Dedicated I am using IBM Bluemix Dedicated. I want to edit code and found the Add toolchain option, but when I click it, it opens a new pop-up with the following error:
404: resource not found
Note that I was to share the code repository with another developer.

A: ADD TOOLCHAIN is a function offered by Bluemix DevOps Services to associate your application with a continuous delivery toolchain.
Now, this button shouldn't have been surfaced yet, as DevOps Services are still being configured in this environment.
Sorry for the inconvenience (just avoid pressing this button for now).
We'll resolve this shortly.


text:
Q: Adding Arrows inside itemize in latex I want to add a long left right arrow inside itemize.
At the moment I use:
\begin{itemize}
\item DNS <-> check\_dns
\item DHCP <-> check\_dhcp
\end{itemize}

But I want something like ↔ instead of <->.
Unfurtunatly I can't use "\longleftrightarrow" cause i get "\item invalid in math mode" if I try.
any ideas?

A: The answer to your question is quite simple. The command "\longleftrightarrow" only works in math mode.
The solution is thus to use inline math mode by using \( \longleftrightarrow \) or $ \longleftrightarrow $.
Your code then changes to:
\begin{itemize}
    \item DNS **\(\longleftrightarrow\)** check\_dns
    \item DHCP **\(\longleftrightarrow\)** check\_dhcp
\end{itemize}

Note: if you are a new latex user and you want more information about the concept math mode, then this link could be interesting: wikibooks about latex


text:
Q: double to hex. How It's Made? 157,453796 = hex 18068A
157,455093 = hex 180697
71,5037    = hex E91D00
71,506104  = hex E93500
71,507103  = hex E93F00
0          = hex 000000
I know exactly what it is not IEEE 754

A: The following depends on the byte-order of your processor architecture and thus can't be read back on every system:
double f = 10020.2093;
char acz[sizeof(double)+1] = '\0';
std::copy((char*)(&f), ((char*)&f)+sizeof(double), acz);


text:
Q: CAST ERROR IN R Error in `[.data.frame`(data, , variables, drop = FALSE) : undefined columns selected I am getting this error in R when casting data using package "Reshape":
"Error in `[.data.frame`(data, , variables, drop = FALSE) :
  undefined columns selected"

Waterquality Data look like this:
   year turbid.ave.mo month2
16 2002     926.66667   JUNE
23 2002     493.66667   JULY
29 2002     107.10000    AUG
37 2002     295.80000   SEPT
46 2002     528.28000    OCT
53 2002     266.20000    NOV
56 2002      73.80000    DEC
1  2003     115.00000    JAN

I want to cast so that month is column header (one row per year with JAN to DEC as column headers.
Code I tried:
casted = cast(Waterquality [ ,c(1:3)], year + turbid.ave.mo ~ month2, mean, fill =0, value = "turbid.ave.mo")

Error: Error in [.data.frame(data, , variables, drop = FALSE) :
  undefined columns selected
Anybody tell me what I am doing wrong?  Thanks in advance!!

A: Don't include the value in the formula:
cast(Waterquality [ ,c(1:3)], year ~ month2, mean, fill =0, value = "turbid.ave.mo")

  year   AUG  DEC JAN     JULY     JUNE   NOV    OCT  SEPT
1 2002 107.1 73.8   0 493.6667 926.6667 266.2 528.28 295.8
2 2003   0.0  0.0 115   0.0000   0.0000   0.0   0.00   0.0

A: Here's a much cleaner tidyr solution:
library(tidyr)

spread(Waterquality, month2, turbid.ave.mo, fill = 0)
# year        Apr      Aug       Feb        Jan         Jul      Jun        Mar       May
# 1 2002 -0.2798722 0.000000 -0.901421 -0.9576323 -0.07627388 0.652116 -0.3758433 0.9795479
# 2 2003  0.0000000 1.047832  0.000000  0.0000000  0.00000000 0.000000  0.0000000 0.0000000

A: Had the same issue. Initially had the data as :(Id,Value,Variable)
Just re-arranged the order to (Id,Variable,Value).
    cast (tmp, id ~ delivery_month)


text:
Q: Using Cramer's Method How do I use Cramer's method to solve the following system of equations ?
2x+2=10
2y=2
2-3y=6x
I've solved for y using standard simultaneous equations but this didn't help

A: The the system of equations be the matrix A. Note that you want the determinant of A to be non-zero. This implies that your system has a unique solution.
Cramer's Rule says that you can calculate your (x,y,z) solution by determinants.
x= det(M1)/det(A), y= det(M2)/det(A), z=det(M3)/det(A)
Now M1-M3 represent your regular matrix but only your solution (right hand side of original system) is replaced in column 1,2 and 3 respectively while the rest of the matrix the same. Once you compute these you have your answer.
Now if we look at your equations and form a matrix and find the determinate we see that det(A)=0 which means we cannot use Cramer's Rule on you system.
So to answer your question, you can't use Cramer's Rule to solve the system.


text:
Q: When we are walking or running, which friction is exerted on our feet? Kinetic or static? As already mentioned in the title, when we are walking or running on the floor, which friction is exerted on our feet? Kinetic friction or static friction?
In my understanding, the answer is static friction because our feet do not slide on the floor. Is my understanding correct?

A: Yes, it is correct. Kinetic friction acts when sliding only. Of course there is an instant of time where your feet slide. But you can despise that...


text:
Q: Is there any data structures to add a number and query sum of the smallest k numbers? Is there any data structures with the support of the below 2 operations?

*

*Add a integer to the collection

*Query the sum of the smallest k numbers in the collection, where k is given with the query and can be as big as the size of the collection.
Both operations should have a time complexity of no more than O(logn) where n is the size of the collection.

A: You can do it with a variation of index statistics tree (AKA ranked tree), where in each node, in addition to storing number of nodes in this subtree, you also store sum of nodes. This can be calculated per node trivially with self.subtree_sum = left.subtree_sum + right.subtree_sum + self.value.
Then, finding the sum of all elements up to the kth is done identically to finding the kth element in order statistics tree, but in addition you also sum the values in addition to the number of nodes.

A: I think an augmented BST should do the trick here. Take your favorite balanced binary search tree (red/black, AVL, scapegoat, etc.) and have each node store two extra fields:

*

*How many nodes are in the node's left subtree.

*The sum of all values in the node's left subtree.

These properties can be maintained as you perform insertions and deletions in time O(log n) each. (If you haven't seen how to do this, check out CLRS for details. It's a cool construction!)
Once you've done this, insertions can be done in time O(log n) by doing a regular insert followed by fixing up all the updates cached values, which takes a total of O(log n) time.
To get the sum of the k smallest values, you can do a recursive walk of the tree. Specifically, look at the root node. Then:

*

*If the root node has exactly k - 1 elements in its left subtree, the sum of the k smallest elements can be found by returning the root's cached sum (of the k-1 elements to its left) plus the root's value.

*If the root has k or more elements in its left subtree, recursively descend to the left subtree and return the sum of its k smallest elements.

*If the root has m < k - 1 elements in its left subtree, return the root's cached sum plus the (recursive) sum of the k - m - 1 smallest elements in the root's right subtree.

This makes a single root-to-leaf pass down the tree, which will take time O(log n).


text:
Q: Remote Notification Ios I have implemented Push Notification in my application.
I am receiving aps as follow's:
{
    aps =     {
        alert = "Bhai kaisa hai notification a rha hai!";
        customtitle = "Customtitle here";
        keyid = 8;
        sound = default;
    };
}

I want to pass keyid and customtitle to a view controller my code:
  NSString * titletopass = [userInfo objectForKey:@"customtitle"];
    NSString * keytopass = [userInfo objectForKey:@"keyid"];

    //NSString *titletopass=[getpass objectForKey:@"customtitle"];
    PostsDetailsViewController *obj = [[PostsDetailsViewController alloc]init];

    obj.Viewtitle = titletopass;
    obj.key=keytopass;

   NSString *identifier;
    identifier=@"postsdetails";
    UIStoryboard *    storyboardobj=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
    obj = [storyboardobj instantiateViewControllerWithIdentifier:identifier];
    [self.window setRootViewController:obj];

It doesn't pass the data to viewcontroller, and keytopass + titletopass is empty as well.
Thanks in advance..

A: After you set obj to an instance of PostDetailsViewController you are then setting obj to the postdetails view controller instantiated from the storyboard.
If your intention is to use the storyboard, you should only create the instance from that. Once you have your instance you can set your properties.
For example:
NSString * titletopass = [[userInfo objectForKey:@"aps"] objectForKey:@"customtitle"];
NSString * keytopass = [[userInfo objectForKey:@"aps"] objectForKey:@"keyid"];

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PostsDetailsViewController *obj = (PostDetailsViewController *)[storyboard instantiateViewControllerWithIdentifier:@"postdetails"];

obj.Viewtitle = titletopass;
obj.key=keytopass;

[self.window setRootViewController:obj];


text:
Q: How to pass collection to GET method I've this GET method in my MVC Web Api:
public IQueryable<Employee> GetEmployeeByJobTitle(List<string> jobTitles)
{
    var employeeByJobTitle = from e in db.Employee
                             where jobTitles.Contains(e.JobTitle)
                             select e;
    return db.Employee;
}

because I need to get a set of employees by job titles. So if I want all employees with job Title in "Production Technician - WC60" and "Production Supervisor - WC60", I need to call this URI

http://localhost:60054/api/Employee/GetEmployeeByJobTitles/?jobTitles[0]=%22Production%20Technician%20-%20WC60%22&jobTitles[1]=%22Production%20Supervisor%20-%20WC60%22

As you can see the query string is huge and complex. Now, I need to call this method from a client console using HttpClient class from Web.API.Client.Libraries. Is there an easy way to create a method builting the above query string starting from the object:
var jobTitles = new List<string>
{
    "Production Technician - WC60",
    "Production Supervisor - WC60"
};

Something like
string BuiltUriFromObject(List<string> jobTitles){};

A: This situation suits the FromUri attribute which will create the specified model from the querystring.
Declare the controller like this
[HttpGet]
public IHttpActionResult GetEmployeeByJobTitle([FromUri]string[] jobTitles)
{
    var employeeByJobTitle = from e in db.Employee
                             where jobTitles.Contains(e.JobTitle)
                             select e;
    return Ok(employeeByJobTitle.ToArray());
}

Call this method by adding as many titles you like but declare all titles to the same parameter name jobTitles="CIO"&jobTitles="CTO" then the FromUri will create a list with List<string>{"CIO", "CTO"}.
In your case, something like this
api/Employee?jobTitles=%22Production%20Technician%20-%20WC60%22&jobTitles=%22Production%20Supervisor%20-%20WC60%22


text:
Q: How to get value of array by checking its value How can i get the object which has the value of [existence] == 1
If [existence] == 1 I want to get all the object that has [existence] == 1
and remove all [existence] == 0
This is my array .
Array
(

    [0] => Array
        (
            [id] => 3
            [accountcode_naisen] =>
            [extentype] => 0
            [extenrealname] =>
            [name] => 0090000270
            [extenktaiemail] =>
            [secret] => Myojyo42_f
            [username] => 0090000270
            [guestIpAddr] => 192.168.236.15
            [participantSetting] => Array
                (
                    [id] => 13
                    [existence] => 1
                    [leader] => 1
                    [simultaneous] =>
                )

        )

)

This is my code so far
 foreach ($participants as $participant=>$c) {

            if ($c['existence'] != 1) {
              unset($participants[$participant]);
            }

          }

and i am getting this error message **********

[30-Sep-2015 15:42:38] PHP Notice:  Use of undefined constant
  participantSetting - assumed 'participantSetting' in index.php on line
  253

A: You could use something more efficient than a loop. You could use array_filter() with an anonymous function as callback. Something like this
$participants = array_filter(
    $participants,
    function($element) { return $element['participantSetting']['existence'] == 1; }
);

A: i think this is working
foreach ($participants as $participant=>$c) {

   if ($c['participantSetting']['existence'] != 1) {
          unset($participants[$participant]);
        }
}

A: The following code might help you..
foreach ($participants as $key => &$participant)
{
     if ($participant['existence'] != 1)
     {
          unset($participant[$key]);
     }
}

When you print the array after the above iteration you will get your expected output.


text:
Q: mySQL Returning the top 5 of each category I want to be able to return 5 menuitem per menu. I've tried this several script but had no luck. here are the tables
menus
-------
menuid int()
profileName varchar(35)

menuitems
-----------
itemid int()
name varchar(40)

Here what I have now. I'm getting the error message with the script below. Error: Subquery returns more then 1 row.
SELECT m.profilename, name
FROM menus m
WHERE (SELECT name
        from menuitems s
        where m.menuid = s.menuid
        limit 5)

Any suggestion is great appreciated.

A: You have to use side effecting variables for this
SELECT profilename, name
FROM
(
    SELECT m.profilename, s.name,
        @r:=case when @g=m.profilename then @r+1 else 1 end r,
        @g:=m.profilename
    FROM (select @g:=null,@r:=0) n
    cross join menus m
    left join menuitems s on m.menuid = s.menuid
) X
WHERE r <= 5

A: SELECT TOP 5 m.profilename, s.name
FROM menus m INNER JOIN menuitems s ON m.menuID = s.menuid


text:
Q: Unlock other levels/maps in Nintendo land Wii U I am playing the new Nintendo land game on the Wii U and getting frustrated with just 2/3 maps for each mini game?
Is there some way to open more levels for each mini game?

A: You can unlock the following extra stages:

*

*Pikmin Adventure

*

*Challenge maps: Complete all maps (in single or multiplayer) and you'll earn access to 6 extra, harder maps which can be played solo or co op.

*Versus maps: Play 5 games on each level to unlock the next challenge level. There's only 3 levels that I'm aware of. You can unlock this with a single player using both wiimote and gamepad, just wait for the clock to run out 5 times.

*Luigi's Ghost Mansion:  Play 20 games. Which level you play doesn't matter. Quickest way to do this is to just kill the ghost immediately with the flashlight. A single player (with a Wiimote AND gamepad) is all you need to unlock, too, so you can spare your friends the grief of grinding if you don't want to play 20 levels organically.

There might be more I don't know of yet. I believe if you beat the courses in Donkey Kong's Crash Course a number of times you'll unlock more courses, but I haven't beaten the first course yet.

A: If you play Luigi's Ghost Mansion for around hour, you unlock two bonus stages: the store room with knights that make your Wii remote vibrate to throw you off, and the roof level (which has like 8 Monita robots).

A: Donkey Kong Crash Cource ~ Beat A Level Twice To Unlock The Next Level. There Are Four Total


text:
Q: Closed Convex Hull Let $X$ be a topological vector space. For a countable subset subset $(a_n)_n\subset X$, can one describe the closed convex hull of $(a_n)_n$ as the set $\{\sum_{n=1}^{\infty}c_na_n: 0\leq c_n\leq 1, \ \text{and} \ \sum_{n=1}^{\infty}c_n=1\}$ where the series converges?

A: No.
Let $X=\Bbb R$ and $a_n=1/n$ for $n\ge1$. The closed convex hull of the $a_n$ is $[0,1]$, but it's clear that $0\ne\sum c_na_n$ with $c_n\ge0$, $\sum c_n=1$.


text:
Q: ось Y только с положительными целыми значениями. Chart.js 3.5 + react-chartjs-2 У меня есть график, который в реальном времени показывает значения Y. Они могут быть только положительными. Проблема в следующем: по умолчанию chart.js строит мне график следующим образом:

Если я ограничиваю отрицательные значения Y с помощью опций: min: 0, то я получаю "обрезанные значения" на графике, как показано ниже:

Единственный раз, когда я получал график с видом как мне нужно был когда я сделал ему ограничение по max y, но оно мне как раз не нужно, но внешний вид мне необходим именно такой:

Примечание: я не знаю какое значение y может быть максимальное, и просто задать какое то большое значение тоже не вариант. значение y отслеживается в реальном времени, поэтому часто пользователь может видеть график, где все y будут 0.
Мои Options:
const LineChartOptions: ChartOptions = {
        plugins: {
            legend: {
                display: false,
            },
        },
        scales: {
            y: {
                stacked: true,
                max: 1,
                ticks: {
                    stepSize: 1,
                },
            },
        },
    };

Так же есть ещё 1 проблема: после обновления chart.js с 2.х на 3.х цвет подписей к шкалам стал "мыльным", как видно на картинках. Я не могу разобраться, как это исправить.
Должны быть атрибуты на подобии scaleFontColor, scaleLineColor, но не понял куда их нужно прописывать.

A: Разобрался. Оptions должны выглядеть следующим образом:
const LineChartOptions: ChartOptions = {
        plugins: {
            legend: {
                display: false,
            },
        },
        scales: {
            y: {
                beginAtZero: true,
                ticks: {
                    stepSize: 1,
                },
            },
        },
    };


text:
Q: QuickFIXJ setting SendingTime in messages I have a FIX application which is connected to several price providers. It distributes the data it received to our inner applications. When it is sending the received messages from the price providers to the target applications, it modifies the SendingTime(52) field in FIX header which is not acceptable. The inner applications want to get the original SendingTime value. How can I say to the QuickFIXJ engine not to assign a timestamp value?
Thanks

A: What you desire... is kind of wrong.  Header fields are to be used by the engine, and for application data (which is what this relayed SendingTime kind of is on the second leg).  Your inner FIX connection should not be clobbering the SendingTime field.  You might need the actual SendingTime field if you are diagnosing problems with your inner connection!
What you really need is a second SendingTime field.  You should edit the DD of your inner FIX applications to add another field for which to store the old SendingTime value.  Tell your inner target apps to refer to that field.
NOTE: You probably don't want to use OrigSendingTime (tag 122) for this.  That field has a very specific usage already.  Name your new field something else.

A: FIX Market Data messages (35=W, 35=X) usually have MDEntryDate (#272) and MDEntryTime (#273) fields to represent the timestamp of the market data price. If it is related to Quote/trade messages, you may have the TransactTime (#60) field.
It worth keep the SendingTime (#52) and MDEntryDate MDEntryTime/TransactTime separated, you can compare the difference between the price's timestamp and the counter party's infra structure timestamp (sending time). It would help to identify delay between the systems.
If the message you are handling does not have any Application DateTime field, you can pick one. which its value would be the SendingTime for the original FIX message you've received.
You can either select and use an existent field (http://www.onixs.biz/fix-dictionary/4.4/fields_by_name.html) or you can create your own user defined field.
Once you decided to create your own field, it is a good practice to check the oficial Global Technical Committee user defined fields list at https://www.fixtrading.org/standards/user-defined-fields/ and using the user defined fields range.
Sites

*

*Fields by message: https://www.onixs.biz/fix-dictionary.html

*User defined fields: https://www.fixtrading.org/standards/user-defined-fields/


text:
Q: Is there a way to get the TID (thread id) in powershell foreach-object -parallel? Just wondering if I could get like a $TID for thread id, just like a $PID or process id, with foreach-object -parallel in powershell 7 or pwsh (https://github.com/PowerShell/PowerShell#-powershell).  I can run this and see a bunch of threads with a TID column in sysinternals procexp (https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer), in the pwsh.exe properties, Threads tab.
 1..20 | foreach-object -Parallel { start-sleep (5*$_) } -ThrottleLimit 20

A: Unlike for the process ID ($PID), there is no automatic PowerShell variable reflecting the thread ID (as of PowerShell 7.2).
If getting the managed (as opposed to the native) thread ID is sufficient, you can use .NET APIs (System.Threading.Thread.CurrentThread):
1..2 | % -Parallel { [System.Threading.Thread]::CurrentThread.ManagedThreadId }

To get the native thread ID you need platform-specific solutions via P/Invoke; e.g., for Windows, using the GetCurrentThreadId() WinAPI function:
# For Windows
Add-Type -Name WinApi -Namespace demo -MemberDefinition @'
  [DllImport("Kernel32.dll")]
  public static extern uint GetCurrentThreadId();
'@

1..2 | % -Parallel { [demo.WinApi]::GetCurrentThreadId() }


text:
Q: How do I run NetBeans from the terminal? I have installed a JDK + NetBeans bundle from the downloaded .sh file.
Now I have the NetBeans shortcut on my desktop but I can't run NetBeans from the terminal.
When I run:
sudo dpkg --get-selections

NetBeans is not on the list and also I can't find it in the Ubuntu Software Center.

*

*How do I run it from the terminal and how do I find it in the system?

*When I installed Emacs using apt-get it appeared in the main menu and I could launch it from the terminal straight away. How do these two installations differ?

A: dpkg is a debian package manager, since you have installed Nebeans by a (presumably local) script, it will not be listed in dpkg -l.
Retrieve an application's command from it's desktop file:
When you have an application installed of which you don't know the command, but you do have a desktop file, you can read it from the desktop file's content. The link you have on your desktop is a desktop file. Look for a line, starting with "Exec=". What comes after that string is the command you are looking for.
Make the application available in Dash:
Normally, applications install a desktop file in /usr/share/applications (like emacs does). If a desktop file is located in either that location or in ~/.local/share/applications, it appears in Dash automatically, so if you copy the desktop file into ~/.local/share/applications, it will appear in Dash after next log in.
Open an application by (only) it's binary file name (or not):
Netbeans did not open on the command netbeans because the shell does not know the path to your binary file. If binary files are located in /usr/bin (the default path to application's binary files) they will open right away, without the path-prefix. That is the case for example with emacs.
If an application does not install its binary file in /usr/bin, there are three possibilities; either the application's desktop file's execute line includes the path to the file, as you can see for example in the execute line of the file-explorer indicator's desktop file: /opt/indicator-file-explorer/bin/indicator-file-explorer, or the path to the binary file is added to $PATH (/etc/environment), so the shell will search for binary files in that directory too, or the application installs a link to the binary file in /usr/bin. All three options do occur, no matter the way an application is installed.
If you installed your application locally, it would be a bad idea to (try to-) create a link to the application's binary file from a global directory, such as /usr/bin; other users would be stuck with a dead link, because they have no valid permissions in your home directory. Therefore, the easyest way is to create a local bin directory (~/bin) and create a link to the local binary file from that directory (ln -sf). That way you can run your locally installed Netbeans by the single command netbeans.

A: Assuming you downloaded the 7.4 version
If you installed netbeans from .sh installer using sudo then the default command to run netbeans is :
/bin/sh "/usr/local/netbeans-7.4/bin/netbeans"

if you installed netbeans without sudo then the default command is :
~/netbeans-7.4/bin/netbeans

A: Don't know if this might help but what works for me is assuming you are the the current home directory of your user
./netbeans-8.0.2/bin/netbeans

I installed netbeans by downloading the sh installer from their website. Just curious on how to run netbeans via terminal and this worked for me.

A: in Linux Mint 19 Cinnamon
use  sh netbeans
for example ~/netbeans-8.2/bin$ sh netbeans


text:
Q: Add UILabel to UITextView I have Multiple UITextView's that I have created with a for-loop programmatically. I'm trying to add a UILabel to the upper left corner of each UITextView also.
How can I do that?
My UITextView code:
for (int i = 0; i < 10; i++){
    UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0, yPos, 375,height)];
    [textView setBackgroundColor:[UIColor lightGrayColor]]; //set different property like this
    UIColor *borderColor = [UIColor colorWithRed:204.0/255.0 green:204.0/255.0 blue:204.0/255.0 alpha:1.0];
    textView.layer.borderColor = borderColor.CGColor;
    textView.layer.borderWidth = 1.0;
    textView.layer.cornerRadius = 5.0;
    textView.textAlignment=NSTextAlignmentRight;
    textView.editable=NO;

    [CommentScrooll addSubview:textView ];
    // CommentScroll Is the name of my viewcontroller
    yPos += (height + padding);
}

A: Objective-c code:-
UILabel *cust_Label = [[UILabel alloc] initWithFrame:CGRectMake(Your_X, Your_Y, Your_Width,Your_Height)];
cust_Label.text=@"Your Text";
[textView addSubview: cust_Label];

A: I've never added a UILabel to a UITextView before but I just tested this and it worked. This is the general idea:
let label = UILabel(frame: CGRect(x: 0, y: 0, width: 100, height: 20))
label.text = "My Label"
textView.addSubview(label)


text:
Q: What does colon mean in jQuery when used inside of .trigger? I looked at http://api.jquery.com/trigger/ and the examples did not answer my question. I am looking at some code and would like to know what this block of code is doing.
$(document).on('click', '#SubmitQuery', function(event) {
            event.preventDefault();
            $(document).trigger('filter:submit');
        });

Specifically, what does the colon inside of that trigger function do? For complete context, here is what filter is (I assume that the 'filter' inside of the trigger function refers to that filter object):
var filter = {
    init: function() {
        $(document).on('keypress', '#Filter', debounce(function(event) {
            if (event.keyCode == 13) {
                $(document).trigger('filter:text');
            }
        }, 300));

        $(document).on('click', '#ClearFilter', function(event) {
            event.preventDefault();
            $('#FilterText').val('');
            $('#FilterText').focus();
            $(document).trigger('filter:clear');
        });

        $(document).on('change', '.filterSection [type=checkbox]', function(event) {
            var group = $(this).parents('[data-filter-group]').attr('data-filter-group');
            var $checkboxes = $('[data-filter-group=' + group + '] [type=checkbox]');

            if ($checkboxes.length > 0) {
                if ($checkboxes.filter(':checked').length === 0) {
                    $(this).prop('checked', true);
                }
            }
        });

        $(document).on('click', '#SubmitQuery', function(event) {
            event.preventDefault();
            $(document).trigger('filter:submit');
        });

        $("#Filter").focus();
    }
};

A: The colons specifies custom events, essentially creating namespaces for events you can call later without overriding default events or having to create multiple listeners on the same event.
You can find more information here: https://learn.jquery.com/events/introduction-to-custom-events/


text:
Q: Lifetime of the returned range-v3 object in C++ I want to make a function that works like np.arange(). With range-v3, the code is
auto arange(double start, double end, double step){
    assert(step != 0);
    const auto element_count = static_cast<int>((end - start) / step) + 1;

    return ranges::views::iota(0, element_count) | ranges::views::transform([&](auto i){ return start + step * i; });
}

and to use it,
auto range = arange(1, 5, 0.5);
for (double x : range){
    std::cout << x << ' '; // expect 1 1.5 2 2.5 3 3.5 4 4.5 5
}

However, the result told me a dummy value. I think the lifetime of returned range object is expired, and I found that by making them to vector can pass the result well. (And it will cause overhead for constructing vector.)
Is there any way to return range itself without expired lifetime ?

A: You fell victim to Undefined Behaviour due to capturing of local variables via [&].
If you capture by value [start, step](auto i){ return start + step * i; }, the code will work correctly.
Note that views are always non-owning, can be copied around and are generally O(1) in their storage. Since iota is a generating view and stores its full state inside itself, the code is safe.


text:
Q: How does GAP calculate 2-closure? GAP software has a method for calculating the two closure of a (permutation) group? how does it do that calculation?

A: You can find the actual code in the file lib/stbcbckt.gi in the GAP distribution. The algorithm performs a backtrack search through the symmetric group, searching for permutations that preserve the orbits of $G$.
The crucial (but very technical) bit is to only test one element in each coset of the subgroup found so far, and to avoid testing elements that one can deduce a priori will not satisfy the condition. (Example: if $a$ satisfies but $b$ does not, the $ab$ cannot satisfy either.)
This clearly does not scale well with the degree, as the run time might be exponential or worse.
Addendum (prompted by comment):
When calculating the 2-closure of $U$, the process maintains a subgroup $S$, consisting of the part of the 2-closure found already. This subgroup is initialized initially with $U$ and is changed whenever new elements are found. Now if testing one element $a$ for being in the 2-closure, the same result will hold for all elements in the coset $Sa$ (and even in the double coset $SaS$). Thus it is sufficient to test one element in each coset only. In practice this is done by discardiong elements that are known cheaply to not be lexicographically minimal in their coset.


text:
Q: vb.net alternatives to php file handeling functions? i need vb.net equivlants of php fopen, fseek, and fwrite... also, i need to read and write data, not just text. I need to write data at specific byte position to x amount of bytes, as well as read at byte position to x amount of bytes...

A: Yes look at the System.IO.File class.
use the 'Open' method to get a FileStream. This has the functions your looking for i.e. seek,read,write
http://msdn.microsoft.com/en-US/library/system.io.file_members(v=vs.80).aspx
http://msdn.microsoft.com/en-US/library/system.io.filestream.write(v=vs.80).aspx


text:
Q: ODI date format I am trying to resolve a date from a flat file, but I haven't been successful with setting the right date format. Do you have any idea what's wrong with this one?
ODI-40469: Value was incorrect for column 0: Could not transform "2021-04-30T00:00:00Z" to date using pattern yyyy-MM-dd'T'HH:mm:ss'Z' at position 1

Thank you

A: Well, you've probably fixed this by now but anyhow... The HH:mm:ss should be HH24:mi:ss for starters.
Additionally, as a query, I had to use double quotes for T and Z rather than single quotes as per below:
select to_date('2021-04-30T00:00:00Z','yyyy-MM-dd"T"HH24:mi:ss"Z"') as my_date from dual;


text:
Q: How to force djCurrencyTextBox to show currency symbol in read mode? It is shown when the document is in edit mode. Setting constraints symbol="$" doesn't help.
<xe:djCurrencyTextBox id="budget" value="#{document1.budget}" defaultValue="0">
    <xe:this.constraints>
        <xe:djNumberConstraints
            currency="USD" type="currency" fractional="false">
        </xe:djNumberConstraints>
    </xe:this.constraints>
    <xp:this.converter>
        <xp:convertNumber></xp:convertNumber>
    </xp:this.converter>
</xe:djCurrencyTextBox>

A: Add parameter showReadonlyAsDisabled="true" to your djCurrencyTextBox control:
<xe:djCurrencyTextBox
    id="budget"
    value="#{document1.budget}"
    defaultValue="0"
    showReadonlyAsDisabled="true">

It will show your currency value with "$" symbol in read mode.


text:
Q: Using Subversion with Flex 4 - problem importing services I'm using the Subversive plugin for Eclipse/Flex and I can commit the files correctly, but I have to rebuild Data/Services each time and reconfigure return types for each, etc. Does Subversion not provide a way to check/in out Data/Services or must these be rebuilt each time?

A: If I understand your comment to your question correctly, then it seems to me that it's not a problem of Subversion/Subversive, but a problem of Flash Builder's code generator which is generating/overriding your customized return types.

A: Maybe there are some Flex project settings files that are not committed. That would explain why you need to rebuild Data/Services each time you open the project.
By the way, if you do commit the project settings files, make sure all the paths are relative paths, so that the project settings can be shared among several developers.
You might find value in this Adobe devnet article about Flex project settings

A: My partner and I had different local names for the project we were working on so we had conflicts with the settings file.


text:
Q: Apply KeyPath in map() in simplest form let test = [4, 5, 3, 1, 3]
print(
    test.map { $0 }
)
print(
    test.map(\.self)  // Doesn't compile
)

Error:

Type of expression is ambiguous without more context

Why doesn't it work? Seems like it should.
If isn't this way, how else can we rid of the ugly { $0 } here?
Maybe an example with compactMap will make more cense))
let test = [4, 5, nil, 3, 1, nil, 3]
print(
    test.compactMap { $0 }
)
print(
    test.compactMap(\.self)  // Doesn't compile
)

Error:

Cannot convert value of type 'WritableKeyPath<_, _>' to expected
argument type '(Int?) throws -> ElementOfResult?'

A:
Why doesn't it work? Seems like it should.

You are right. Both of your examples should compile because

*

*SE-0227 Identity Keypath has been implemented in Swift 5, and

*SE-0249 Key Path Expressions as Functions has been implemented in Swift 5.2.

In fact the latter proposal explicitly mentions an example similar to yours. However, that does not compile (as of Xcode 11.7 and Xcode 12 beta):
[1, nil, 3, nil, 5].compactMap(\.self)
// error: generic parameter 'ElementOfResult' could not be inferred

That is a bug. It has already been reported as

*

*SR-12897 - ".self" not working with keypath-as-function - Examples in Key Path Expressions as Functions proposal don't compile.

The bug report mentions a custom extension as a possible workaround:
extension Optional { var mySelf: Self { self } }

[1, nil, 3, nil, 5].compactMap(\.mySelf)


text:
Q: Finding the eigenvectors associated with the eigenvalues
The matrix $A = \begin{bmatrix}5&0&0\\-7&-2&0\\12&2&0\end{bmatrix}$ has eigenvalues $-2,0, $ and $5$. Find its associated eigenvectors for each eigenvalue

So I started with $\lambda_1 = -2$ to get $\begin{bmatrix}5-(-2)&0&0\\-7&-2-(-2)&0\\12&(2--2)&0\end{bmatrix}$ ~ $\begin{bmatrix} 7&0&0\\-7&0&0\\12&4&0\end{bmatrix}$
So I know I have
$7x = 0$ which doesn't tell me anything
so I see that $12x +4y = 0 \implies 12x = -4y \implies x = 1, y = -3$ so I thought that a eigenvector associated with the eigenvalue $\lambda_1 = -2$ would be $(1,-3,0)$ but for some reason I am incorrect. Am i in error in my method? Is there a difference between a corresponding eigenvector and a associated eigenvector? I was under the impression they were the same thing
UPDATE (Had subtracted lambda from the wrong row/column)
Now I get: $\begin{bmatrix} 7&0&0\\-7&0&0\\12&2&-2\end{bmatrix}$
so $7x = 0 \implies x = 0$ so then I have $2y = 2z \implies y = 1, z = 1$  so that the eigenvector associated with $-2$ is $(1,1,0)$ ? But that is incorrect also, where am I in error?

A: So, if $A = \begin{bmatrix}5&0&0\\-7&-2&0\\12&2&0\end{bmatrix}$ we want to find its associated eigenvectors for each eigenvalue.
Let's start with $\lambda_1 = -2$. We find that the matrix ($A-\lambda_1Id$) where $Id = \begin{bmatrix}1&0&0\\0&1&0\\0&0&1\end{bmatrix}$ is
$A_1 = \begin{bmatrix}7&0&0\\-7&0&0\\12&2&2\end{bmatrix}$ (pay attention, it's 2 on $a_{33}$ not -2 because you are subtracting -2).
We now find that it must be $x=0$, $y=-z$. So the eigenvector corresponding to $\lambda_1$ is $(0,1,-1)$.
We do the same with the other eigenvalues, $\lambda_2=0$ and $\lambda_3=5$.
$A_2 = \begin{bmatrix}5&0&0\\-7&-2&0\\12&2&0\end{bmatrix}$
From which we see that $x=0, y=0, z=\alpha$ with $\alpha\in K$ where $K$ is the field you are considering. So the eigenvector corrisponding to $\lambda_2$ is $(0,0,\alpha)$.
$A_3 = \begin{bmatrix}0&0&0\\-7&-7&0\\12&2&-5\end{bmatrix}$
From which we see $x=-y, z=2x$ so the eigenvector related to $\lambda_3$ is $(1,-1,2)$.


text:
Q: A More Elegant Way to Handle Filtering Values in Angular App I am running into some issues with data in a tabular display reloading several times in my Angular 2 app. I'm thinking the main issue with that is related to the fact that, upon initial component loading, I am sending data for a series of filters along as network requests.
Basically we're making use of a Mongo/Mongoose feature that lets us pass key/value pairs in the object body of a post request, which then returns a filtered dataset based on those passed-in values. This code looks like this:
private processType(name: string, value: any, body)
{
    if (this.body[name] && !value) {
            delete this.body[name];
        } else {
            this.body[name] = { $in: value };
        }
}

All that's working as expected. However, what feels less than ideal in my current implementation is that on initial component load I am passing an array of all possible values for each of those filters. And from there a user can change what's passed and filtered-on via a UI filter list. I am passing the entire array of possible values for each filter on initial component load, because if I pass in an empty array NOTHING will match. However, it seems like there should be a better way to handle my initial request.
I'd ideally like my initial request to be, effectively, "don't initially filter on anything", rather than "filter initially on everything", as I'm doing now. I've done it this way for now, because it's a little tricky to handle both the condition on initial load, AND in a situation where a user removes a filter, or all filters. Right now, in either of those scenarios, I'm just passing in the array of all possible values again. What I have works, but it doesn't seem as elegant as it could be. Since this is all being passed as an object in the body of the post request, is there a way I could just delete the object rather than passing an object with arrays of all values?
This is what the rest of my relevant code looks like:
public initLanguageFilterOptions(): void
{
    this.languageFilterOptions = new FilterOptions([
        { value: 'English', toString: () => 'English' },
        { value: 'Spanish', toString: () => 'Spanish' },
        { value: 'Mandarin', toString: () => 'Mandarin' }
    ]);

    let arr = [];

    // Update array when filter selection is made
    arr.push(this.languageFilterOptions.addEventListener(FilterOptions.CHANGE_EVENT, () => this.sendLangSelections(true)));

    // Update array when filter options are loaded from URL parameters
    arr.push(this.languageFilterOptions.addEventListener(FilterOptions.URL_LOAD_EVENT, () => this.sendLangSelections(true)));

    // Clean up after component is no longer used
    this.addEventListener('ngOnDestroy', function ()
    {
        arr.forEach(s => s()); // Remove all listeners
        return true;
    }.bind(this));

}

/**
* Handles the emitting of the selected values to the API
*/
private sendLangSelections(languageFilterOptions) {
    const origLangArray = ['English', 'Spanish', 'Mandarin'];
    if (languageFilterOptions)
        {
            let selectionsArray = this.languageFilterOptions.selection;
            let values = selectionsArray.map((a) => { return a.value; });
            if (values && values.length > 0)
                {
                    this.sendLanguage.emit(values);
                }
            else if (values && values.length < 1)
                {
                    this.sendLanguage.emit(origLangArray);
                }
        }
}

This is what my API call to our Mongo/Mongoose/Node backend looks like:
// A POST request to work with observables
public obsPost(strReq, page, pagesize, body, sort?) {
    const headers = new Headers({ 'Content-Type': 'application/json' });
    const options = new RequestOptions({ headers: this.headers });
    return this.http.post
    (`${API.URL}/${API.VER}${strReq}?apikey=${API.KEY}&page=${page}&pagesize=${pagesize}`,
    body, options)
        .map((res: Response) => res.json())
        .catch(this.filterErrorHandler);
}
    filterErrorHandler(error: Response) {
    console.error(error);
    return Observable.throw(error.json().error || 'Server error');
}

A: To make this work, it's a matter of adding some more conditional logic to when a value gets passed via { $in: value }. Since the errors that were popping up were because of formatting issues with { $in: value }, the key was to make sure this is triggered only when there is a value to be passed.
So, in the end, to get this to work - without having to pass in an array of all possible values, which was not an elegant nor performant solution - I changed this:
private processType(name: string, value: any, body)
{
    if (this.body[name] && !value) {
            delete this.body[name];
        } else {
            this.body[name] = { $in: value };
        }
}

... to this:
private processType(name: string, value: any, body)
{
    if (this.body[name] && !value || this.body[name] && value.length < 1) {
            delete this.body[name];
        } else if (value) {
            this.body[name] = { $in: value };
        }
}

What this does is basically ensure that an array of at least one value is available when the { $in: value } is triggered.
The only other change necessary was the one involving what gets emitted when a user has de-selected all values. I handled that, this way:
private sendLangSelections(languageFilterOptions) {
    const origLangArray = ['English', 'Spanish', 'Mandarin'];
    if (languageFilterOptions)
        {
            let selectionsArray = this.languageFilterOptions.selection;
            let values = selectionsArray.map((a) => { return a.value; });
            if (values && values.length > 0)
                {
                    this.sendLanguage.emit(values);
                }
            else if (values && values.length < 1)
                {
                    this.sendLanguage.emit(this.obj = undefined);
                }
        }
}


text:
Q: Spring Prototype bean with different parameters I want to inject a prototype scoped bean into a singleton.  This prototype bean should only be created once for each Singleton it is injected in (which is the case by default as far as I understand).  However, I do want a slightly different bean each time, so I want to be able to annotate the injection point with a custom annotation which is used when constructing the prototype bean.
The problem is, how do I find out what annotations are on the injection point?
Here's some code to see what I want to achieve:
@Component
public class X {
    @Inject
    @CustomAnnotation("Hi")
    private PrototypeBean bean;
}

Where PrototypeBean is provided by a bean method:
@Bean
public PrototypeBean prototypeBean(CustomAnnotation customAnnotation) {
    return new PrototypeBean(customAnnotation);
}

The idea is here that everywhere this PrototypeBean is injected, a new instance is created which behaves slightly differently based on the value of CustomAnnotation.
I know you can do this using the ApplicationContext (well, passing extra parameters that is, not annotations), but I'd like to keep it light-weight with simple annotations.

A: Perhaps what you need is a custom BeanPostProcessor. Section "3.2 Data Access" in this blog post, "A Spring Custom Annotation for a Better DAO" looks very similar to what you're trying to do.


text:
Q: How would I combine these phrases? Putting boxes on a truck, removing boxes from a truck The original sentence:
"The movers are putting boxes on a truck and removing boxes from a truck."
To shorten the sentence, I want to combine these two actions:
"The movers are putting and removing boxes [ on / from ] the truck."
But I don't know whether to use the proposition associated with putting (on), or the preposition associated with removing (from).
AKA, which of these are right?

*

*The movers are putting and removing boxes on the truck.

*The movers are putting and removing boxes from the truck.

*The movers are removing and putting boxes on the truck.

*The movers are removing and putting boxes from the truck.

What are the rules in determining which preposition to use when combining other such sentences?
Clarification: I am not looking for different words for putting and removing. I am just trying to understand how I would combine both of those into one phrase when they use different prepositions 'towards' the object (truck).

A: Parallelism is all about removing identical pieces of a sentence.  Since your prepositions are not identical, you cannot remove them.  You've already removed "the movers are" from the second part of the sentence, so the only thing you can simplify further is "a truck":

The movers are putting boxes on a truck and removing boxes from a truck.
   becomes
  The movers are putting boxes on and removing boxes from a truck.

A: You could consider using on-loading and offloading as your action verbs. This would eliminate the need of a preposition.
The sentence would read, "The movers were on-loading and offloading the truck."

A: From your comments, I think what you are trying to do is not proper grammar.
Consider a case where the two propositions are complete opposites.  For example (and just to brighten your day) think of penguins jumping back and forth between the sea and an ice floe.  You can say

Some penguins were jumping off the ice and others were jumping on the ice.

You can also combine the objects of the prepositions and say

Some penguins were jumping on and off the ice.

However, there is no way to say

The penguins were jumping ______ the ice.

With any one word that means "on and off."


text:
Q: [eslint]'react-redux' should be listed in the project's dependency+unable to resolve path to module 'react-redux' I'm following an Udemy course on react native, and the instructor has just introduced Redux. I did followed his instructions and typed in

npm install --save redux react-redux.

in the command window. However, in my text editor I get these two error messages (error message from ESlint).
I tried to google what dependencies are, and from what I understood they are modules that are required for the app to run. Regardless, I tried

npm i -S react-redux

as well as reinstalling, but it did not work.(message from Command Center)
May somebody explain to me how I can solve these errors and what those messages in command center mean?

A: I added "import/no-extraneous-dependencies" : ["error", {"devDependencies": true}] in my .eslintrc and it got rid of the error.

A:
ENOENT: no such file or directory, open 'C:\Users\admin\package.json'

says that the project folder is not having "package.json" which will be available only in project's root folder
Please make sure you do npm install in project's root folder


text:
Q: Can one use an expression and not a string as the parameter in an ASP.NET 5 TagHelper I have the following code calling the default ASP.NET MVC  html helper
@Html.LabelFor(model => model.PersonName, htmlAttributes: new { @class = "control-label col-md-2" })

that I have changed for my ASP.NET 5 project to
<label asp-for="PersonName" class="col-md-2 control-label"></label>

If I mistype PersonName  I get a red line below the name however I can still build my project successfully.
For the HTML Helper I always use intellisense by typing model. so I can't misspell the name.
With the TagHelper I don't have this option as it is a string field.
Is there a way use the same intellisense with the TagHelper as I don't want to discover typing mistakes at runtime.

A: As part of a View, TagHelpers are not not compiled at compile time, only runtime. IE, until an HttpRequest is made. Then, the related View is parsed and injected into the HttpResponse by the Controller. No code in your View will prevent your project from building.
To accomplish this, you'll need to create a build action that will specifically compile your Views at compile time. Because of the change in project structure, there don't appear to be any resources available yet that accomplish this.  You may want to start here in your research Compile Views in ASP.NET MVC
If you just need IntelliSense, beta8 already has it. Make sure you've installed the Beta8 Visual Studio Web Developer Tools


text:
Q: Transfer a parameter to Lambda via ssm document I am looking for a way to transfer a parameter to a lambda function from a ssm document.
The below setup works if I am using a simple string, but when I use a parameter in the format of {{InstanceId}} I get an error - parameter is not defined.
What  is the correct format for passing a parameter via ssm document  ?
parameters:
  InstanceId:
    type: String
mainSteps:
  - name: stepName
    action: 'aws:invokeLambdaFunction'
    inputs:
      InvocationType: RequestResponse
      FunctionName: Name_Function
      InputPayload: InstanceId:{{InstanceId}}
    timeoutSeconds: 120

A: So, I found it:
This is how to do it , for those who struggle with it...
 Payload: '{"InstanceId": "{{InstanceId}}"}'


text:
Q: How does one get the app access token for debug_token inspection on Facebook? It is suggested that whether your app uses code or token as your response_type you should perform an automated check on the access_token to confirm that the token belongs to the person the app expects it to belong to and that it was your app that generated the token.
You are supposed to do this on
GET graph.facebook.com/debug_token?
 input_token={token-to-inspect}
 &access_token={app-token-or-admin-token}

where app-token is app_id|app_secret and token-to-inspect is the user's access_token. Also, I think from reading the documentation you can retrieve an app-token by doing a client-credentials call with the app_id and app_secret.
This is fine with an authorization flow implemented server-side, but what if you're using the implicit method and chose response_type as token (and for whatever reason aren't using FB's javascript SDK)? How do you safely get that app-token without leaking your app_secret? How does FB's SDK do it?

A: You can generate an app_token in your Facebook developer panel here
 and then simply save it into a config file server side. From the developer's page:

App tokens do not expire and should be kept secret as they are related to your app secret.

On my page, I use the following flow:

*

*The user authenticates with the Facebook JS SDK, and then sends his
token + uid to the server.

*The server validates that the given token
is related to the given person via a call to the "debug_token"
method, that you spoke of.

*If the token + uid combination is valid,
it authenticates the user server side.

I hope this helps.


text:
Q: Sequelize: Storing dates in JSON columns and comparing them to dates in where clauses I am using PostgreSQL and sequelize. I have a model column "checkedAt" for storing multiple dates. I want to be able to compare the different dates from the column data.
The issue with this is that the dates are stored as strings since it is not a Date but a JSON DataType.
Here is how I defined the model
const Notification = sequelize.define("Notification", {
    checkedAt: {
      type: DataTypes.JSON,
      defaultValue: {
        bySomeJob: new Date(),
        bySomeOtherJob: new Date()
      }
    }
});

how I try to query with no success
const someDate = new Date();

await db.Notification.findAll({
   where: {
     checkedAt: {
        bySomeJob: {
            $lte: someDate
        }
     }
   }
});

I've used this method before for integers and booleans but not with a date.
I found this function to turn strings into date format
sequelize.fn('date', sequelize.col('checkedAt'))

But not sure if and how could it be used for a property of the column.
I expect to be able to query the model by comparing a Date object to a transformed value from the property of a JSON object column.

A: If you need to associate multiple dates to a notification, then you may be better off creating a new model used specifically for storing checkedAt dates, and creating an association between notifications and checkedAt dates. Something like Notification.hasMany(Dates);
This way when you query for notifications you can include the Dates table, and then be specific about what dates to include from that table, like with using $lte, which is what you were trying.
It might look something like this
await db.Notification.findAll({
    include: [
        {
            model: db.Date,
            where: {
                checkedAt: {
                    bySomeJob: {
                        $lte: someDate
                    }
                }
            }
        }
    ]
});


text:
Q: Purpose of conditional in context What is the purpose of the conditional here?

It is often said that mathematics is the language of science. If this is true, then an essential part of the language of mathematics is numbers.

That numbers are an essential part of mathematics surely holds regardless of whether mathematics is the language of science, no?

A: If can mean allowing that or on the assumption that (m-w) and not only in the event that used for a hypothetical. For example the mother hears her child at the front door and calls out "If you are going out, take your jacket!"  meaning "Since/assuming you are going out, take your jacket!" or "If you are going to use that kind of language, I'm leaving" ("Since/because you are using that kind of language, I'm leaving").
I interpret your second sentence as:

[Given/since/assuming/accepting that mathematics is the language of science and delving
further since we want to do science, we see/should recognize that] an
essential part of the language of mathematics is numbers.

or, more briefly:

Assuming this is true, we can go on to say that an essential part of
the language of mathematics is numbers.

A: We have to assume that mathematics is a language in order to say that numbers are a part of that language:

If it is true that mathematics is a language, then an essential part of that language is numbers.

If it's a language, it has grammar and syntax — with numbers instead of, say, nouns. If it's not a language, we have nothing to talk about here. We would just say that an essential part of math is numbers.
"Not everyone agrees that mathematics is a language," says Anne Marie Helmenstine, Ph.D., in ThoughtCo's Why Mathematics Is a Language.


text:
Q: WMI class properities return different values with C# and VBS...which one is correct? I have a class in C# which fetches properity with Name SKU  from WMI class "root\\Microsoft\\SqlServer\\ComputerManagement11:SqlServiceAdvancedProperty"
as

PropertyName : SKU  PropertyNumValue : 2702571241

But when i fetch the same property through VB Script the result is as follows.

PropertyName: SKU PropertyNumValue: -1592396055

Which is the correct value?
What is the conversion happening with it?

A: The values are the same, a four-byte (DWORD) value which appears as A115F6E9 in hex.
Your C# code treats this either as an unsigned integer  while your VBScript treats this as an signed integer. You can use both values in their respective languages.
If you want to compare the result against a constant though, you should define the constant using HEX notation in both languages, eg 0xA115F6E9 in C# and &HA115F6E9 in VBScript
In fact, Eric Lippert wrote an article about this a while ago, explaining how to convert from the negative number to the Hex value in VBScript.


text:
Q: Export of GraphicsRow to PDF is ugly I have a problem with exporting GraphicsRow[{Plot, Plot, Plot,...}] object to pdf.
The line is like
GraphicsRow[
    {pFit11, pFit12, pFit13, pFit14, pFit15}
  , PlotLabel -> "-2≤lγ≤2, w=5.9, θ=0.07"
  , Spacings -> 10
  , ImageSize -> Full
  , PlotRange -> All
]

what I see in the output is

But what appears in the pdf after I export it as
Export["...\Plot.pdf", #];

is this ugly thing:

How can I fix it taking into consideration that I am restricted with converting only in PDF?
Thanks!


text:
Q: Multiplying two 32 bit numbers without using 64 bit int We are doing some 32bit * 32bit multiplication using the following algorithm
Let us we want to multiply a (32 bit) with b (32 bit), both signed,
a = ah * 2^16 + al [ah - Higher 16 bits, al - Lower 16 bits]
b = bh * 2^16 + bl [bh - Higher 16 bits, bl - Lower 16 bits]
We are effectively doing
Result = (al * bl) + (((ah * bl) + (al * bh)) * 2^16) + ((ah * bh) * 2 ^ 32) ~~~

My question,
Is their any better way to do this?

A: In any mainstream compiler, the emulation of 64-bit ints on a 32-bit platform will be about as efficient as doing the mutli-step math yourself.  But it will be much more reliably correct.
When doing simple arithmetic with values large enough to overflow, even the most highly tuned math library that I've seen just uses int64.

A: Google "Karatsuba multiplication".
OIh, and in your code, change the constant 2^15 (it appears twice) to 2^16.

A: The answer is no there isn't a better way of doing things, apart from using bit shifting and and masks instead of 2^n. Namely:
a * 2^n <=> a << n

Secondly, are your ints signed or unsigned? If they're signed then that changes things.
Third, I'm not sure your 2^15 is right. If it's unsigned at least, you want to shift bits by 16 not 15.
Lastly, you have to watch out for integer overflow in the low order int. If you add together numbers in the low order int that overflow it's capacity you need to correctly increment the high order int.

A: You need to know (specify) how the 64-bit value is to be stored - presumably, it is a pair of 32-bit values, possibly two elements of an array, or two elements of a structure.  You also need to consider how the sign information is going to be stored in the result.
Mechanically, you probably want to convert both signed values to unsigned, and then do the split and reassemble along the lines you showed, being careful to ensure that carries from the low order 32-bit value are managed properly in the high order 32-bit value.
Depending on your initial design decisions, you may also need to fettle the representation of the sign of the result, and maybe even all the other bits.
Similar comments apply to multiplying two 16-bit numbers without any 32-bit results, something that was once important but most people don't have to worry about.


text:
Q: C# convert String into TextBox name
Possible Duplicate:
C# Get control by name

I have been looking around for an answer for this now for a while and was wondering if someone would help me please.
I would like to convert a type String into type TextBox so say below.
String text = "textBox" + number;

TextBox tb = text;

I would like to do this so I receive the number and then I know which textBox to write to.
Any help would be most appreciated! :)

A: String text = "textBox" + number;
TextBox tv = (TextBox)FindControl(text);

A: Well, you could get the variable using reflection, but what I think that you really want to is to just find the actual control.
Use the FindControl method to get a reference to the actual textbox:
TextBox tb = FindControl("textBox" + number.ToString()) as TextBox;

A: Do you have an array of text boxes?
Is that windows form / web?
Basically what you can to is find to go through the Controls collection of the container and find an element with the the ID.
Note that my answer is pretty wide and not accurate on all cases. If you'll provide more details I'll help you further.


text:
Q: setInterval() to loop after some idle timeout and reset when mouse move or touch So what i am trying to achieve is if no one moves the mouse or click or touch (basically if there is no activity on the website) after some time (5 minutes) to start with text animation but text should loop every 15 seconds until someone starts poking around on website again.
And i have this function so far working to some point
        $(function(){
          var idleTimer;
          var idleInterval;
          function resetTimer(){
            clearTimeout(idleTimer);
            clearInterval(idleInterval);
            idleTimer = setTimeout(idleloop,30 * 1000);
          }
          $(document.body).bind('mousemove keydown click',resetTimer); //space separated events list that we want to monitor
          resetTimer(); // Start the timer when the page loads
        });

        function idleloop() {
            idleInterval = setInterval(whenUserIdle,15 * 1000);
        }
        function whenUserIdle(){
            if(isOpened) {
                goHome();
            } else {
                if(isBurst) {
                    Partallan.start();
                } else {
                    Partallan.stop();
                }
            }
        };

But when using this, loop interval is is not reset, clearInterval should stop interval loop but when i start browsing website again after some time of inactivity the setInterval loop just interrupts me and continues to loop every 15 seconds.
I can't figure out how to stop everything when there is activity on the website, and continue when there is no activity.

A: Please check this fiddle - https://jsfiddle.net/q4500voy/
Here I have added event on document instead of document.body
      $(document).bind('mousemove keydown click',resetTimer);

It seemed that document.body selector worked for only keydown event.


text:
Q: Inheriting rt.jar source in GWT module I need to include/inherit javax.xml.datatype.XmlGregorianCalendar in my GWT module.
I have a proxy gxt.xml called XmlDatatype.gwt.xml, placed within my src tree
src/java/xml/datatype
with the contents:
<module>
    <source path="" />
</module>

However, java/xml/datatype with the actual source found in ~/java/jdk6/src.zip, which is associated with the JDK1.6 rt.jar of the library path eclipse.
Is there any way around having to unzip src.zip into my project source folder?
1.
Do I really have to unzip that zip file and place them into a source folder visible to my eclipse project? Doesn't GWT know how to look at my rt.jar associated source src.zip and eat the javax.xml.datatype source of that zip?
2.
What about source code which is spontaneously brought in thro maven? Doesn't GWT compiler know how to look into Maven and pull that source from maven? Do I really have to download the source and stick it into a source folder visible to my project?

A: *

*GWT always needs the source because the java code gets compiled into javascript. The automatic "looking for source" that you're asking could possibly be done by the GWT eclipse plugin but really doesn't have anything to do with the GWT compiler.

*Really the same issue as 1.

I think you'll find what you're trying to do to be difficult or impossible because any dependencies from javax.xml.datatype.XmlGregorianCalendar will also need the source included for GWT to try and compile into javascript. This can be tricky when grabbing "any old java lib" because that lib will need to have all its dependencies source included as well. In addition some of those dependencies may not be compatible with browser javascript, such as IO libs, as an example.


text:
Q: Access printer using SQL Server Stored Procedure? How can I access my printer using SQL Server Stored Procedure?

A:
Stored procedures are great for manipulating data, but they are very
  limited when it comes to interacting with system resources outside the
  database. Even writing to a file can be awkward, never mind printing.

If still you want to print the document from Stored Procedure, you can follow this steps from this article
Step 1:
At first, let's build a simple VB DLL (ActiveX component) that would handle the actual printing using Microsoft Word. In ActiveX component, add a method that would print a document using Microsoft Word:
Public Sub PrintDocumentFromWord(ByVal DocumentFileName As String)

    On Error GoTo Err_Error

    Dim MethodName As String
    MethodName = ".PrintWebDocumentFromWord()"

    Dim strMessage As String

    Dim blnResult As Boolean

    Dim objWord As New Word.Application
    'Dim objWord As Object
    'Set objWord = CreateObject("Word.Application")

    Const wdAlertsNone = 0
    objWord.DisplayAlerts = wdAlertsNone

    'objWord.Activate
    'objWord.PrintOut FileName:=DocumentFileName
    Dim objDocument As Word.Document

    Set objDocument = objWord.Documents.Open(DocumentFileName)

    objDocument.Activate

    objDocument.PrintOut

    objDocument.Close

    objWord.Quit

Exit_Procedure:
    Set objDocument = Nothing
    Set objWord = Nothing

    Exit Sub

Err_Error:

    'handle error here
    Call HandleError("PrintWebDocument", ApplicationName, MethodName, VBA.Error)

    If Not objWord Is Nothing Then
        objWord.Quit
    End If

    Resume Exit_Procedure

End Sub

Compile and build ActiveX component. ActiveX component will reside on the same machine where SQL Server instance is running.
Step 2: Next, create a stored procedure that calls ActiveX component and passes file name of the document to be printed:
CREATE procedure sp_Print_Letter_File
(
    @file_name varchar(333)
    ,@debug_mode char(1)=''
)
as
    set nocount on

    declare @return int

    declare @print_document int
    declare @hr int
    declare @src varchar(255), @desc varchar(255)

    exec @hr = master.dbo.sp_OACreate 'PrintDocument.clsPrintDocument', _
    @print_document OUT
    if @hr <> 0    -- error creating instance!
    begin
           exec master.dbo.sp_OAGetErrorInfo  @print_document, @src out, @desc out
        select 'Creating Instance', hr=convert(varbinary(4),@hr), _
        source=@src, description=@desc
        set @return = -1
        goto error
    end

if @debug_mode<>''
    print '1. created'

    exec @hr = sp_OAMethod @print_document, 'PrintDocumentFromWord',_
    null,@file_name, @debug_mode
    if @hr <> 0
    begin
           exec sp_OAGetErrorInfo @print_document, @src OUT, @desc OUT
        select 'Call to Method', hr=convert(varbinary(4),@hr), _
    Source=@src, Description=@desc

        exec @hr = sp_OADestroy @print_document
        if @hr <> 0
        begin
            exec sp_OAGetErrorInfo @print_document, @src out, @desc out
            select 'Destroing Instance',hr=convert(varbinary(4),@hr), _
        source=@src, description=@desc
            --return
        end
        set @return = -2
        goto error

    end

if @debug_mode<>''
    print '2. send to object'

error:

    exec @hr = sp_OADestroy @print_document
    if @hr <> 0
    begin
        exec sp_OAGetErrorInfo @print_document, @src out, @desc out
        select 'Destroing Instance',hr=convert(varbinary(4),@hr), _
        source=@src, description=@desc
        set @return = -3
    end

if @debug_mode<>''
    print '3. done!'

set nocount off

GO

And that's it. Don't forget to register your ActiveX component (I usually do it with Component Services MMC snap-in).