text:
Q: Converting DEM into areas of "flatness", with arbitrary fill/cut to area ratio? I want to find areas of relative "flatness" in a DEM.
How can I find flat areas?
I want to find a neighbourhood of contiguous cells that have an elevation variance that is within a certain tolerance threshold.
I can use the ESRI suite of tools, or any open source GIS.

A: If you're looking for a region of specific size and area:

*

*As before, classify your cells by the slope.

*Then do a Region Group on the raster. The count value will give you area values for the raster.

*Then if you need regions of a certain width (ie, not something long and thin) run Zonal Geometry with the Thickness option, which will give you the radius of the largest circle that can be drawn within the zone.

A: This problem has many different solutions: it needs further restrictions.  After all, by choosing any value within the range of elevations in the dataset, the contour for that value will be "flat" (and horizontal).  This probably is not the sought-for answer, but it is an answer and it's perfectly valid.  Moreover, among all possible answers, the contour lines will achieve minimal "elevation variance," so arguably they are the best answers--at least until additional criteria are specified.
Typically one restricts such searches to reasonably compact regions by asking that they be circular, rectangular, or perhaps by limiting their tortuosity.  Also, there are many possible definitions of "elevation variance," such as range, standard deviation, IQR, MAD, etc.
As an example of what can easily be done, suppose we want to find circular regions where the elevation range does not exceed some threshold.  (This is useful for implementing local requirements which frequently say a plot of land cannot rise more than z feet over distance x.)  The calculation is dead simple: pick the radius you want to investigate and compute the focal range for a circular neighborhood of that radius.  Every cell in the resulting grid whose value is within the elevation tolerance is the center of a "flat" circle.
There are obvious variations: you can explore a range of radii to search for the largest possible such circle; you can use neighborhoods of different shapes (such as square neighborhoods or even irregular neighborhoods); you can compute focal standard deviations instead of focal ranges.  I believe all these options have been discussed at one time or another on the old ESRI forums.
One huge advantage this approach has over a slope-based solution is that it is immune to the small measurement errors that afflict almost all DEMs.  Consider, for example, a DEM that was computed from a contour map.  Unless the DEM processing was extremely well done, it will still show terrace-like artifacts near the former contour lines.  At those cells, computed slopes can be extreme (but erroneous).  This won't materially affect the elevation-based focal stats technique but it will cause slope-based techniques to give the wrong, or inferior, results.

A: Your best bet would be to first calculate slope, as om_henners has mentioned, then use a focal operator to collapse the result down to the scale you're interested in. I'd recommend using FocalMean, where the neighborhood size matches the scale of 'flat' areas you're interested in. So for example, if you had a raster of 10m resolution, a 5x5 neighborhood would give you the average slope over 2.5 km2 area.
The same analysis could be done in GRASS, with r.mfilter.

A: As far as I understand your question, you might be very interested in the techniques mentioned in this paper:
Gallant, J.C., Dowling, T.I. (2003): 'A multiresolution index of valley bottom flatness for mapping depositional areas', Water Resources Research, 39/12:1347-1359
and implemented in SAGA GIS:
http://www.saga-gis.org/saga_modules_doc/ta_morphometry/ta_morphometry_08.html

A: If you have access to Spatial Analyst you could use Slope instead of cut/fill.

*

*Calculate the slope raster

*Calculate your tolerance based on the maximum rate of change (see the formula on How Slope Works page)

*Do a setnull so that it sets the raster null where the slope values are greater than the tolerance; eg setnull(slope > tolerance, original_values)

A: You could try Landserf.
There is a tool to compute slope maps:
(flat areas are in yellow)

See section 1.6 of the user guide.
An other possibility is to triangulate your DEM and compute the triangle's slopes.


text:
Q: Rescaling an image to match parent width with React Native Coming from native Android, I'm having a hard time styling my layout. What I'm trying to achieve is very simple : center a picture with a height of 1/3 of the screen height and that match the screen width.
I also want to keep the original ratio.
It's working fine on iOS but not on Android.
This is what I get so far :
 'use strict';

 import React,{
 Component,
 View,
 Image,
 Text,
 StyleSheet
 } from 'react-native';

import Dimensions from 'Dimensions';

export default class SplashScreen extends Component {
  render() {
    return(
        <View style={{flex: 1, flexDirection: 'column', justifyContent:'center'}}>
        <View style={this.renderLogoContainerStyle()}>
          <Image
            style={this.renderLogo}
            source={require('./img/cat_logo.gif')}
          />
      </View>
    </View>
   );
  }

  renderLogo(){
    return{
      height: Dimensions.get('window').height / 3,
      width: Dimensions.get('window').width,
      resizeMode: 'contain'
    };
  }
  renderLogoContainerStyle(){
    return{
      borderColor:'red',
      borderWidth:4
    };
   }
  }
}

And a screenshot of the result on an Android device :

Any clue why ? Is it a missing feature on Android ?

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to leave Menu bar from the middle of the page on top while scrolling? I wanted to do something like this mentioned here, so I used the following jsfidlle (that works pretty fine) to create my own http://jsfiddle.net/a2q7zk0m/1/, but with the custom menu included. Now it doesn't work, I guess it's probably because of the error in javascript:
$(document).ready(function() {
    $(window).scroll(function(e) {
        $el = document.getElementById('temp');
        if ($(this).scrollTop() > 100) {
            $el.addClass("fixedNav");
        } else {
            $el.removeClass("fixedNav");
        }
    });
});

that does not recognize the ID of the div and request the class from css, but unfortunately I cannot use class attribute here. Could you help me guys with solving that issue? Thanks!

A: Replace this line:
$el = document.getElementById('temp');

with this:
$el = $('#temp');

JSFiddle

Or wrap the $el into jQuery object:
$el = document.getElementById('temp');
// ...
$($el).removeClass("fixedNav");

JSFiddle

Also, You should move $el declaration outside of the $(window).scroll method (so that the element isn't searched in DOM while scrolling)
$(document).ready(function(){
    var $el = $('#temp');
    $(window).scroll(function (e){
        if ($(this).scrollTop() >= 100 && !$el.hasClass("fixedNav")) {
            $el.addClass("fixedNav");
        }else if($(this).scrollTop() < 100 && $el.hasClass("fixedNav")){
            $el.removeClass("fixedNav");
        }
    });
});


text:
Q: Issue in Parsing JSON response using SSJS I have a JSON Response that I received after performing a HTTP POST call.
{
    "Status": 0,
    "Content": "{
        \"id\": \"73614a0d-39af-48a3-8b95-d221edc39eb7\",
        \"key\": \"aeb932a6-8883-d273-d99e-f9ee8a306305\",
        \"name\": \"test journey dipa\",
        \"lastPublishedDate\": \"2018-07-11T05:31:22\",
        \"description\": \"\",
        \"version\": 1,
        \"workflowApiVersion\" :1.0,
        \"createdDate\": \"2018-07-11T05:30:44.417\",
        \"modifiedDate\": \"2018-07-11T05:31:22.427\"
    }"
}

From this, I wanted to take the value of the name.
var val1 = Content.name;
Write(Stringify(val1));

I used the above code , but i got null value. What is the issue over the parsing?

A: Since it's string, you'll need to make it an actual JSON object/array by parsing it.
Here's the pattern I use:

%%=v(@name)=%%


text:
Q: Centralizer of a Matrix over a Finite Field Let $\mathbb F$ be a finite field. Denote by $M_n(\mathbb F)$ the set of matrices of order $n$ over $\mathbb F$. For a matrix $A\in M_n(\mathbb F)$ what is the cardinality of
$C_{ M_n(\mathbb F)}(A)$, the centralizer of $A$ in  $M_n(\mathbb F)$? There are papers about it?


text:
Q: how to create exe for php standalone application?
How to create .exe for php  standalone application?

I have created application that runs on localhost.This application is developed for local use.so i have look up for that type of setup that:
1.create php setup,
2.create shortcut,
3.install apache and mysql and start mysql and apache server,
4.onclick shortcut,project run in browser

LATER UPDATE
  Is it good way to create batch file that done upper things and is it possible?
  if possible, please suggest some examples.

Thanks in advance.

A: Short answer: Not possible.
Long answer: It depends.
You could install a web- and database server on his machine (or create an installer that does it) and run the application locally on his machine.
or
You keep the application on a server and just provide a launcher that opens his browser and points it to the URL of the application.
It might be a good idea to switch to SQLite instead of MySQL but depending on how your application is written it might require a lot of code and SQL Query changes.
PHP Desktop which allows you to create desktop apps in the same way as you build websites with php/html/js.
The convenient solution is not to convert the website to .exe. I think it will be better if you have portable server/php/mysql and make the website work from a usb or CD with autorun.


text:
Q: Start SSMS for SQL 2012 using CMD I have installed SQL 2008 R2, and then I installed SSMS for that server.
After a few months, I've installed SQL Server 2012 and its SSMS.
Location of theese tools are different in file system, logically.
But, when I type in CMD next command: SSMS.EXE, and hit Enter, I always get SSMS for 2008 opened.
How can I open SSMS for 2012 using cmd? Is there some option which I missing?

A: your system path variable is pointing to the 2008 version, either you change it there or you have to use a full qualified path
i.e. c:\installdir2012\ssms.exe


text:
Q: OnClick() method doesn't work in TextView I have a textView with OnClick method to navigate another activity. But, If i pressed that text it doesn't navigate. But If i used Button instead TextView, it works perfectly. Can't use OnClick method in TextView?
My XML Code;
<TextView
    android:onClick="webClick"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/textView1"
    android:layout_marginLeft="17dp"
    android:layout_marginTop="19dp"
    android:text="Chapter 1"
    android:textSize="25dp" />

My Java Code:
public void webClick(View v) {
    Intent intent = new Intent(this, Webview.class);
    startActivity(intent);
}

A: Add this attribute to textview
       android:clickable="true"

http://developer.android.com/reference/android/view/View.html#attr_android:clickable
android:clickable
Defines whether this view reacts to click events.
Must be a boolean value, either "true" or "false".
This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.
This corresponds to the global attribute resource symbol clickable.
Related Methods
setClickable(boolean)

A: try by adding  android:clickable="true"
<TextView
    android:clickable="true"
    android:onClick="webClick"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/textView1"
    android:layout_marginLeft="17dp"
    android:layout_marginTop="19dp"
    android:text="Chapter 1"
    android:textSize="25dp" />

A: Just replace your code with this
<TextView
    android:id = "+@id/tvName"
    android:clickable="true"
    android:onClick="webClick"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/textView1"
    android:layout_marginLeft="17dp"
    android:layout_marginTop="19dp"
    android:text="Chapter 1"
    android:textSize="25dp" />


text:
Q: Verify that $f_{xy}=f_{yx}$ for the function $  f(x,y) =
\begin{cases}
\frac{(2x-y)}{x+y},  & \text{if } (x,y)\ne (0,0) \\
0, & \text{if } (x,y)=(0,0)
\end{cases}
$
My Attempt:
So according to me, we need to divide this question into two parts and solve these two parts individually. The first part is I did where we need to take the case $(x,y)\ne (0,0)$ and prove $f_{xy}=f_{yx}$ I am facing the problem
in the second case where we need to take $(x,y)=(0,0)$.
When $(x,y)\ne(0,0)$:
$$
f_x=\frac{(3y)}{(x+y)^2}
$$
$$
f_y=\frac{(-3x)}{(x+y)^2}
$$
When $(x,y)=(0,0)$
$$
f_{xy}(0,0)=\lim_{h\to 0}\frac{f_y(h,0)-f_y(0,0)}{h}=\lim_{h\to 0}\frac{-3}{h^2}=\infty
$$
$$
f_{yx}(0,0)=\lim_{k\to 0}\frac{f_x(0,k)-f_x(0,0)}{k}=\lim_{k\to 0}\frac{3}{k^2}=\infty
$$
So how we will prove that $f_{xy}=f_{yx}$ when $(x,y)=(0,0)$.
please help me with this problem. Thank you.

A: First an observation. The function is not defined when $x+y=0$ (with the exception of the point $(0,0)$), so I'll consider the domain of $f$ only on the points where it's defined.
We have $$f_x(x,y) = \frac{3y}{(x+y)^2}$$ for $(x,y)\ne (0,0)$ in the domain,
but for $f_x(0,0)$ we have
$$f_x(0,0) = \lim_{h\to 0} \frac{f(h,0)-f(0,0)}{h} = \lim_{h\to 0} \frac{\frac{2h-0}{h+0}- 0}{h} = \lim_{h\to 0} \frac{2}{h}$$ which doesn't exists.
Since $f_x(0,0)$ doesn't exists it makes no sense to talk about $f_{xy}$ at that point.


text:
Q: Zone Normal range in system with 4G RAM I have a 4GB RAM in my system. Following is my BIOS provided RAM map.
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009d7ff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009d800-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
.
.
.
[    0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000011fdfffff] usable

The last line gives a range greater than 4G and it is mapped as Zone NORMAL.
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x00001000-0x00ffffff]
[    0.000000]   DMA32    [mem 0x01000000-0xffffffff]
[    0.000000]   Normal   [mem 0x100000000-0x11fdfffff]

Output of  cat /proc/meminfo
MemTotal:        3955304 kB
MemFree:         1878108 kB
MemAvailable:    2182668 kB

Where is this 510MB coming from? Or is my system is installed with 4.5 G?
I am using a 64 bit arch linux running 3.16.3.
Help with reference material is also fine.


text:
Q: jQuery height when using stop() in animation or slideUp/slideDown I have a menu with hidden submenus.
I am animating the submenu to open when I mouse-over a menuitem, and close when I mouse-out.
When the user mouses over a lot of menuitems, all the animations get queued.
To fix the queuing problem, I added a stop() before the animation.
This caused an even worse problem with the height of the submenu decreasing to the size it is at when I mouse out.

A: Solved by setting the height to auto after the closing-animation has finished.
function leftMenuOut() {
    var obj = $(this).find(".toggleThisLevel2");
    if (obj.length == 0) {
        return true;
    }
    $(this).removeClass("opened");
    obj.stop().animate({ height: "hide" }, { queue: false, complete: function() { $(this).css("height", "auto"); } });
    return false;
}

If you have a padding on the element that you're hiding, you'll experience that the padding shrinks as well. Just add a containing element around, and change the height of that instead, but don't add any padding or margins to that.

A: This was a bug that has been fixed in jQuery 1.7.2: http://bugs.jquery.com/ticket/8685

A: Why don't you use the toggle function?
I think you have to set the height of your ul elements back to the original height.
At the moment the height stays in style attribute, so your ul has only the height you moved your mouse out of the element.

A: You can store a variable to store whether the menu is open or not.
When you hover over and open the menu set var menuOpening = true; then have a call back on the open animation which sets menuOpening = false; you can then check whether menuOpening and only open a new menu item if it is false.
You can then play with this to get something that looks a lot better.  I've got something similar working before but can't find the code.

A: Since I found this question through Google and none of these fixes worked for me, I should mention how I fixed my problem.
Here was my original code:
elem1.stop().slideUp();
elem2.find("div.page:nth-child(" + myVar + ")").stop().slideDown();

This was causing the height to get cut off when switching back and forth quickly.
I then added .hide() after .stop() on the slideDown
elem1.stop().slideUp();
elem2.find("div.page:nth-child(" + myVar  + ")").stop().hide().slideDown();

And now the height doesn't bounce around nor is it ever cut off. Hope this helps someone in the future!


text:
Q: Ignoring \n in regex even if its tied to the word you are looking for Let's say I have this text:
"""xsdsdsds\ncat xsdhidhf"""

and my regex is:
val myRegex = "\b(?i)cat\b"

This doesn't recognize that the text above has the word cat in it because its tied to the \n character.
How can I change the regex to find a word as a whole (with spaces from both sides) but ignore the \n?

A: You can use
val myRegex = """(?i)(?<=\b|\\n)cat\b"""

Details:

*

*(?i) - case insensitive matching on

*(?<=\b|\\n) - either a word boundary or a \n text must appear immediately on the left

*cat - a string cat

*\b  - a word boundary.

See the regex demo.


text:
Q: I can only install Firefox Developer Edition I installed Firefox  Nightly Developer Edition so I could contribute to some of their open source projects.
I'd like to change back to the original. I've uninstalled Firefox using the following commands:
sudo apt-get install ppa-purge

then
ppa-purge ppa:mozillateam/firefox-next

then
sudo apt-get autoremove

then
sudo apt-get install firefox

But every time I go to install Firefox, either via the terminal or the Ubuntu Software Center, it installs the Developer Edition.
Does anyone know how to install the traditional Firefox? In a perfect world, I'd like to have both so I could still contribute and not need to worry about the bugs when I'm at work.

A: I don't know how I missed it, but this article had what I needed,
If you don't want to click, here is the short answer to properly uninstall:
sudo apt-get install ppa-purge

then
ppa-purge ppa:ubuntu-mozilla-daily/firefox-aurora


text:
Q: Location of Workflow Manager Database References Does anyone know where ArcCatalog references to Workflow Manager Databases are saved?
I am using Workflow Manager in a Citrix virtual desktop. Every time I restart the desktop after closing it, the reference is lost and needs to be re-created. I have not been able to locate any references in my AppData folders, where other ArcCatalog settings are stored.
I'm talking about the Workflow Manager Databases section of ArcCatalog's catalog tree not the Database Connections section.

A: Workflow Manager stores the information I was looking for in C:\ProgramData\ESRI\WMX\10.6\Database. It is possible to change this location using C:\Program Files (x86)\ArcGIS\WMX\Desktop10.6\Bin\WMXAdvancedSettings.exe, but it requires administrative-level access.


text:
Q: Prevent sublime text from extracting keywords in comments for completion How can I prevent sublime text from extracting keywords in comments?
e.g. I have the following javascript source file
// some keyword

I do not want to have either some or keyword to be in the completion list.
Thought it would be a common question but couldn't find anything on it.

A: If you use Sublime Code Intel -  https://github.com/SublimeCodeIntel/SublimeCodeIntel - you can get read suggestions for the correct methods and variables rather that just words that are used in your code.
If you are on ST3 it's a little hard to get up and running, but it's totally doable.
I found these instructions to work https://johnblackbourn.com/sublimecodeintel-st3


text:
Q: How to pass initialization values for the member array in C++ template class arguments? Let's say I have following template C++ class
template<uint32_t FILTER_ORDER, uint32_t BUFFER_LENGTH>
class Filter {
public:

    Filter() {}

private:
    float data_buffer[BUFFER_LENGTH];
    const float filter_coefficients[FILTER_ORDER + 1];
};

I have been looking for a way how I can pass the coefficients of the filter i.e. individual items of the member array filter_coefficients at compile time. My goal is to have the ability to define filter object in following manner
Filter<3, 8, 1.0, 0.3678, 0.1353, 0.04978> filter;

where the last four non-type arguments of the template are the initialization values for the member array filter_coefficients. Does it exist a way how can I do that in C++?

A: Yes, it is possible in C++20, before that float is not allowed as non-type template parameter.
template<uint32_t FILTER_ORDER, uint32_t BUFFER_LENGTH, float...values>
class Filter {
public:

    Filter() {}

private:
    float data_buffer[BUFFER_LENGTH];
    const float filter_coefficients[FILTER_ORDER + 1]{values...};
};

But this embeds the values into the type, is that really what you want? It will prevent storing arrays of these objects because they now have different types.
I would recommend just using constexpr constructor. Why do you need them to be compile-time anyway?
C++14 variant with constexpr constructor:
#include <cstdint>
#include <array>

template<std::uint32_t FILTER_ORDER, std::uint32_t BUFFER_LENGTH>
class Filter {
public:

    Filter() {}

    template<typename...Floats,typename=decltype(std::array<float,FILTER_ORDER+1>{std::declval<Floats>()...})>
    constexpr Filter(Floats...floats):filter_coefficients{floats...}{}

private:
    // Consider using `std::array` here too.
    float data_buffer[BUFFER_LENGTH];
    const float filter_coefficients[FILTER_ORDER + 1];
};

int main(){
    Filter<3, 4> filter{1.0f,2.0f,3.0f,1.0f};
}

There is basic type check to ensure the elements are floats, otherwise this variadic template can shadow some other constructors.


text:
Q: Android Notification is shown and goes away at the same time without doing anything I send push notification to android phone.
Almost phones are receive and show notification except one phone(Samsung Galaxy Note 5).
The phone shows notification icon and goes at the same time.
You can see this issue followed url (refer 7sec and 22sec):
https://youtu.be/J6UZm_6mqP0
Here is AndroidMenifest.xml of my app
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_icon"
        android:resource="@drawable/ic_stat_notification" />
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_color"
        android:resource="@color/colorAccent" />
    <meta-data
        android:name="com.google.firebase.messaging.default_notification_channel_id"
        android:value="@string/default_notification_channel_id" />

    <activity
        android:name=".MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|orientation|screenSize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <service android:name=".FCMInstanceService">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>
    <service
        android:name=".MyFirebaseMessagingService"
        android:enabled="true"
        android:exported="true">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
    </service>
</application>

Where do i start to solve for this problem?
--More--
MyFirebaseMessagingService.java
package com.smartivt.smartivtmessenger;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.support.annotation.Nullable;
import android.util.Log;

import com.google.firebase.messaging.RemoteMessage;

import java.util.List;

public class MyFirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {

    private static final String TAG = "FirebaseMessaging";

    private final String CHANNEL_ID = "DEFAULT_CHANNEL";
    private final String CHANNEL_NAME = "Default Channel";
    private final String GROUP_NAME = "MESSAGE_GROUP";

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        NotificationManager notiMgr = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

        if ( remoteMessage.getData().get("title") != null ) {
            Log.d(TAG, "onMessageReceived: " + remoteMessage.getData().get("title"));
            Log.d(TAG, "onMessageReceived: " + remoteMessage.getData().get("body"));

            if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
                Notification.Builder notify = new Notification.Builder(getApplicationContext(), CHANNEL_ID);

                notify.setSmallIcon(R.drawable.ic_stat_notification);
                notify.setContentTitle(remoteMessage.getData().get("title"));
                notify.setContentText(remoteMessage.getData().get("body"));
                notify.setAutoCancel(true);

                notiMgr.notify(NotificationID.getID(), notify.build());

                /*
                Intent badgeIntent = new Intent("android.intent.action.BADGE_COUNT_UPDATE");

                badgeIntent.putExtra("badge_count", 5);
                badgeIntent.putExtra("badge_count_package_name", getPackageName());
                badgeIntent.putExtra("badge_count_class_name", getLauncherClassName());
                sendBroadcast(badgeIntent);
                */
                Log.d(TAG, "update badge: " + getPackageName() + ", " + getLauncherClassName());
            }
            else {
                Notification.Builder notify = new Notification.Builder(getApplicationContext());

                notify.setSmallIcon(R.drawable.ic_stat_notification);
                notify.setContentTitle(remoteMessage.getData().get("title"));
                notify.setContentText(remoteMessage.getData().get("body"));
                notify.setAutoCancel(true);

                int id = NotificationID.getID();

                Log.d(TAG, "id: " + id);
                notiMgr.notify(id, notify.build());
            }
        }
        else if ( remoteMessage.getNotification() != null ) {
            Log.d(TAG, "onMessageReceived2: " + remoteMessage.getNotification().getTitle());
            Log.d(TAG, "onMessageReceived2: " + remoteMessage.getNotification().getBody());

            if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.O ) {
                Notification.Builder notify = new Notification.Builder(getApplicationContext(), CHANNEL_ID);

                notify.setSmallIcon(R.drawable.ic_stat_notification);
                notify.setContentTitle(remoteMessage.getNotification().getTitle());
                notify.setContentText(remoteMessage.getNotification().getBody());
                notify.setAutoCancel(true);

                notiMgr.notify(NotificationID.getID(), notify.build());
            }
            else {
                Notification.Builder notify = new Notification.Builder(getApplicationContext());

                notify.setSmallIcon(R.drawable.ic_stat_notification);
                notify.setContentTitle(remoteMessage.getNotification().getTitle());
                notify.setContentText(remoteMessage.getNotification().getBody());
                notify.setAutoCancel(true);

                notiMgr.notify(NotificationID.getID(), notify.build());
            }
        }
    }

    @Nullable
    private String getLauncherClassName () {
        Intent intent = new Intent(Intent.ACTION_MAIN);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        PackageManager pm = getApplicationContext().getPackageManager();
        List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0);
        for (ResolveInfo resolveInfo : resolveInfos) {
            String pkgName = resolveInfo.activityInfo.applicationInfo.packageName;
            if ( pkgName.equalsIgnoreCase(getPackageName())) {
                return resolveInfo.activityInfo.name;
            }
        }

        return null;
    }
}

A: You don't need two services now.....
Check this topic:
FirebaseInstanceIdService is deprecated now.
You dont need this.
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />

Use it like this.
AndroidManifest.xml
 <service
        android:name=".MyFirebaseMessagingService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT" />
        </intent-filter>
 </service>

MyFirebaseMessagingService.java
public class MyFirebaseMessagingService extends FirebaseMessagingService {
    public static int NOTIFICATION_ID = 1;

    @Override
    public void onNewToken(String s) {
        super.onNewToken(s);
    }

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
      //Code to create the Notification

    }
}

gradle build
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.0'


text:
Q: Dampened mathematical pendulum I have the system of ODEs
$$\begin{align*}\dot y &= v \\ \dot v &= -\lambda v - q(y) \end{align*}$$
for an increasing function $q$ such that $q(0)=0$ and the energy function $E= \frac 1 2 v^2 +Q(y)$ where $Q$ is an antiderivative of $q$. I want to show that the energy decreases with time.
I tried to differentiate E with respect to time, obtaining
\begin{align*}\dot E &= 2 \dot v v + Q'(y) \dot y \\
&=v(-2\lambda v -2 q(y) + q(y)) \\
&=-v(2\lambda v +q(y))\end{align*}
I don't see how to proceed from here.

A: The derivative of $\quad \frac{1}{2}v^2\quad $ isn't $\quad 2 \dot v v\quad $ but $\quad \dot v v$ :

$$\dot E = -\lambda v^2 \quad\to\quad \dot E<0 \quad \text{ if } \lambda>0$$


text:
Q: WSO2 API Manager Store error when searching for an application I'm using WSO2 API Manager 2.1.0. When I search for an application in the store, the following error occurs from time to time. Once this occurs, any other application cannot be searched and the API Manager needs to be restarted to function normally.
Any supportive step(s) to troubleshoot this issue is highly appreciated.
Thanks in advance.

PS: I have also added the backend logs herewith.
TID: [-1234] [] [2021-06-07 14:02:26,786] ERROR {org.jaggeryjs.jaggery.core.manager.WebAppManager} -  org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from null (/store/site/blocks/application/application-list/ajax/application-list.jag#98) {org.jaggeryjs.jaggery.core.manager.WebAppManager}
org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from null (/store/site/blocks/application/application-list/ajax/application-list.jag#98)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:571)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)
        at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)
        at org.jaggeryjs.jaggery.core.JaggeryServlet.doGet(JaggeryServlet.java:24)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)
        at org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter.doFilter(ContentTypeBasedCachePreventionFilter.java:53)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:120)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
        at org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve$1.invoke(CarbonTomcatValve.java:47)
        at org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)
        at org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)
        at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)
        at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
        at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
        at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1756)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1715)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from null (/store/site/blocks/application/application-list/ajax/application-list.jag#98)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)
        at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)
        at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712)
        at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3725)
        at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1483)
        at org.jaggeryjs.rhino.store.site.blocks.application.application_list.ajax.c0._c_anonymous_1(/store/site/blocks/application/application-list/ajax/application-list.jag:98)
        at org.jaggeryjs.rhino.store.site.blocks.application.application_list.ajax.c0.call(/store/site/blocks/application/application-list/ajax/application-list.jag)
        at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
        at org.jaggeryjs.rhino.store.site.blocks.application.application_list.ajax.c0._c_script_0(/store/site/blocks/application/application-list/ajax/application-list.jag:4)
        at org.jaggeryjs.rhino.store.site.blocks.application.application_list.ajax.c0.call(/store/site/blocks/application/application-list/ajax/application-list.jag)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
        at org.jaggeryjs.rhino.store.site.blocks.application.application_list.ajax.c0.call(/store/site/blocks/application/application-list/ajax/application-list.jag)
        at org.jaggeryjs.rhino.store.site.blocks.application.application_list.ajax.c0.exec(/store/site/blocks/application/application-list/ajax/application-list.jag)
        at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)
        ... 45 more

A: The mentioned Ajax error is a general error if the Application-specific entries are not found in the API Manager or if there are any issues in the network calls when trying to retrieve the Application information.
To investigate further,

*

*You can open the Developer console in the Browser and inspect the Network during the operation. Check whether the operation (network call) related to retrieval (https://<hostname>:<port>/store/site/blocks/application/application-list/ajax/application-list.jag) is having any issues, and please do check the LB and Proxy configurations if those have been configured in your environment.

*Verify whether the errors are populated to only a set of Applications or for all applications randomly. If this is only happening for a set of applications, there can be issues with the data stored in the DB. Either the respective Application has partial data entered, or the APIs that have been subscribed with the application is having partial data

Focus on the URL configurations and LB configurations, as it can be a more general cause for the issue.


text:
Q: Can't change the value of an id within on function I'd like to change the value of a
 with its id within a "on" function but it doesn't change.
Here's the code:

And it's the value of #valueScore that doesn't want to change. I think it it a scope problem but I can't get my way around it.
I can the value of #valueScore in the console or if I put the piece of code $("#valueScore").html(score) somewhere else in my JavaScript.
EDIT : added the whole code

A: The problem is that you're blowing away the DOM of all the elements at line 93-106 and you're re-creating them all. So the element that you're setting the score on is being destroyed and replaced with a completely different
.
Instead of destroying everything (line 82 is where you replace the html of '#boardGame') you need to use JQuery to modify the buttons that already exist to give them the names of the song list.
As an alternative, try doing this:

*

*Give all the multiple-choice buttons a class: '.choice_button'

*Put a
 around all the buttons so that you have something to insert the new buttons into.

*Instead of replacing the HTML for '#boardGame' simply destroy all the buttons: $('#button_wrapper .choice_button').remove()

*Now you can insert the new buttons using that for loop just like you're doing on line 93

*Now $('#valueScore') hasn't been blown away so the score should remain.

I've modified your code to get it to where I think it's what you're after:

A: Oh I think I see the problem. You do not need to use the .html function.
Using jQuery:
$("#valueIter").val(iter+"/10");
$("#valueScore").val(score);

The html function is used to populate an element with raw html. The difference here is that jQuery provides .val() and .text() as getters and setters for any element which equate to the javascript equivelent of
element.value = score;


text:
Q: Python: select points that fall within two arbitrary curves I want to select the points that fall within two arbitrary curves, each defined by an array of points. Below is an example. In reality, the curves I have are not based on a functional form, they are arrays. How can I select only the points that fall within the red and blue curve, and say, color them a different color?
import numpy as np
import matplotlib.pyplot as plt

# generate arrays from gaussian
x = np.linspace(0.5, 3.5, 120)
y = np.exp(-np.power(x - 2, 2.) / (2 * np.power(.8, 2.)))
yy = .5*np.exp(-np.power(x - 2, 2.) / (2 * np.power(.4, 2.)))

# generate random data points
data_x = 4*np.random.rand(1000)
data_y = np.random.rand(1000)

fig = plt.figure()
ax = plt.axes()
ax.scatter(data_x, data_y, c='k', s=.1)
ax.scatter(x,y, s=3)
ax.scatter(x,yy, c='r', s=3)
plt.show()

A: You may use numpy.interp to interpolate the points on the positions of the arrays that define the curves.
c1 = data_y > np.interp(data_x, x,yy)
c2 = data_y < np.interp(data_x, x,y)

Then set the color of the scatter as c=(c1&c2) and select a colormap of choice.
ax.scatter(data_x, data_y, c=(c1&c2), s=1, cmap="summer_r")

Complete example:
import numpy as np
import matplotlib.pyplot as plt

# generate arrays from gaussian
x = np.linspace(0.5, 3.5, 120)
y = np.exp(-np.power(x - 2, 2.) / (2 * np.power(.8, 2.)))
yy = .5*np.exp(-np.power(x - 2, 2.) / (2 * np.power(.4, 2.)))

# generate random data points
data_x = 4*np.random.rand(1000)
data_y = np.random.rand(1000)

c1 = data_y > np.interp(data_x, x,yy)
c2 = data_y < np.interp(data_x, x,y)

fig = plt.figure()
ax = plt.axes()
ax.scatter(data_x, data_y, c=(c1&c2), s=1, cmap="summer_r")
ax.scatter(x,y, s=3)
ax.scatter(x,yy, c='r', s=3)
plt.show()

A: Here is my attempt. It implements numpy interpolating function, np.interp() as mentioned in the comments.
import numpy as np
import matplotlib.pyplot as plt

# generate arrays from gaussian
x = np.linspace(0, 5, 120)

# 2 sets of y's for given x
# these can be any reasonable array of numbers
y = np.exp(-np.power(x - 2, 2.) / (2 * np.power(.8, 2.)))
yy = .5*np.exp(-np.power(x - 2, 2.) / (2 * np.power(.4, 2.)))

fig = plt.figure()
fig.set_size_inches(9, 7)
ax = plt.axes()

# plot curves using interpolating data
numpnts = 60
xs = np.linspace(0, 4, numpnts)
ys1 = np.interp(xs, x, y)
ys2 = np.interp(xs, x, yy)

#ax.scatter(xs,ys1, c='b', s=8)  # blue
#ax.scatter(xs,ys2, c='r', s=8)  # red

# for the reference curves
# better use plot than scatter
ax.plot(xs, ys1, 'b^-', xs, ys2, 'ro-', markersize=4, linewidth=0.3)  # blue

# this function uses the interpolated data just created
# and helps build color array for scatter plot
def in_btw(x, y):
    uppr = np.interp(x, xs, ys1)
    lowr = np.interp(x, xs, ys2)
    tf1 = lowr < y
    tf2 = y < uppr
    colr = 'c'
    if tf1 and tf2:
        colr = 'pink'
    return colr

# generate random data points
data_x = 4*np.random.rand(1200)
data_y = np.random.rand(1200)

clrs = []
for ix,ea in enumerate(data_x):
    #print (ea, in_btw(ea, data_y[ix]))
    ret = in_btw(ea, data_y[ix])
    clrs.append(ret)

# scatter plot of the data points with distinct colors
# color: pink if location is between the 2 curves, else, cyan
ax.scatter(data_x, data_y, c=clrs, s=4)

plt.show()

The resulting image:


text:
Q: Long young(ParNew) GC pauses In one of our application, we are getting long young GC pauses (1-2 seconds long). What could be the reason for such big GC pause? Full GC pauses are under 400ms. Following is the snipped of GC.log for one of the long young GC pause. Java version is Java8. Using CMS Collection. Max heap size is 14G and new generation size is 3GB.
2021-06-03T15:06:20.816+0300: 52799589.155: [ParNew
Desired survivor size 536870912 bytes, new threshold 8 (max 8)
- age   1:   68336720 bytes,   68336720 total
: 1959054K->652397K(2097152K), 2.9693698 secs] 7431291K->6950752K(13631488K)After GC:
Statistics for BinaryTreeDictionary:
------------------------------------
Total Free Space: 543441923
Max   Chunk Size: 200036912
Number of Blocks: 150824
Av.  Block  Size: 3603
Tree      Height: 47
, 2.9720357 secs] [Times: user=5.56 sys=0.00, real=2.97 secs]
Heap after GC invocations=1150824 (full 1366):
 par new generation   total 2097152K, used 652397K [0x0000000440000000, 0x0000000500000000, 0x0000000500000000)
  eden space 1048576K,   0% used [0x0000000440000000, 0x0000000440000000, 0x0000000480000000)
  from space 1048576K,  62% used [0x0000000480000000, 0x00000004a7d1b5f0, 0x00000004c0000000)
  to   space 1048576K,   0% used [0x00000004c0000000, 0x00000004c0000000, 0x0000000500000000)
 concurrent mark-sweep generation total 11534336K, used 6298355K [0x0000000500000000, 0x00000007c0000000, 0x00000007c0000000)
 Metaspace       used 50511K, capacity 52221K, committed 52600K, reserved 1095680K
  class space    used 6106K, capacity 6483K, committed 6552K, reserved 1048576K
}


text:
Q: Codeigniter callbacks affecting required validation I am using codeigniter 3.1.1. I am new to codeigniter and i have ran into a problem i can get figured out. My callback functions seem to affect the required validation in that the required rule seems to be skipped and the callback function gets executed even when the field is empty. Here's my code
$validate_data = array(

        array(

            'field' => 'pages',
            'label' => 'No of pages',
            'rules' => 'trim|required|integer|callback_regex_pages'
            )
  );

  $this->form_validation->set_rules($validate_data);
  $this->form_validation->set_error_delimiters('
','
');

My callback function
   public function regex_pages(){

if(!preg_match('/^\d(\d)?(\d)?$/',$this->input->post('pages'))){

    $this->form_validation->set_message('regex_pages', 'The {field} is not valid!');

    return false;

    }else{

    return true;

    }
   }//end method regex_pages

This is just one of my many callbacks that behave this way. If I remove the callback rule, the required rule gets executed
This is my output below

A: Set the message no matter if the field's value is valid or not.
 public function regex_pages($value){

   //set message anyway
   $this->form_validation->set_message('regex_pages', 'The {field} is not valid!');

   //the rule will be available for any field, not just for pages
   return (bool) preg_match('/^\d(\d)?(\d)?$/',$value);

}

You also can use the Codeigniter regex_match rule. http://www.codeigniter.com/user_guide/libraries/form_validation.html?highlight=form%20validation#CI_Form_validation
'rules' => 'trim|required|integer|regex_match[//]'

A: I suggest you to extend your form validation library by making a new library called "MY_form_validation" which will extend "CI_form_validation" and save it in "libraries" folder; After this, put your all callback functions in MY_form_validation and in this way, you will have global available your callbacks, but keep in mind, you no need to set rule with prefix "callback".
Here is an example:
$validate_data = array(

    array(

        'field' => 'pages',
        'label' => 'No of pages',
        'rules' => 'trim|required|integer|regex_pages'
        )

);
$this->form_validation->set_rules($validate_data);
$this->form_validation->set_error_delimiters('
','
');

So in MY_form_validation you will make the function
public function regex_pages($value_to_be_validated){

if(!preg_match('/^\d(\d)?(\d)?$/',$value_to_be_validated)){

$this->set_message('regex_pages', 'The {field} is not valid!');

return false;

}else{

return true;

}


text:
Q: .net file load exception: nuget .net standard 1.6 vs .net40 client I have a project A, a .net standard 2.0 library,
and project B (Console application 4.5 .net framework) that references project A.
I added library C (FParsecCS 1.03) via nuget to both project A and project B.
Project A and Project B compile.
When running I get:
System.IO.FileLoadException could not load library C  or one of its dependencies. The located assembly's manifest does not match the assembly reference.

The file FParsecCS.dll is in the bin\debug directory!
How can I solve this?  I don't think I need to do any redirection.
I have removed the library, closed the solution,  reopened the solution, re-build, and the problem remains.
Work around:
I found a work around if I go to user folder .nuget \packages\library C\lib\netstandadrd1.6 and copy the dll to the bin\debug of the exe it works.
By default  it seems to copy the lib\net40-client? how can I force it to copy and use the .netstandard1.6?


text:
Q: Swift - Dynamically set UITableView height in Xib I try to set tableView height with dynamically in Xib. But all elements change dynamically in the xib view and I didn't reach "y" position of the last element before tableview.
I tried something like this but it didn't work.It shows on the top of mainView.
techTableView = mainView?.technicalTableView

self.techTableView?.frame = CGRect(
    x: 0,
    y: (self.techTableView?.topAnchor.constraint(equalTo: (mainView?.productInformation.bottomAnchor)!, constant: 25).constant)! ,
    width: self.view.frame.size.width,
    height: 35)

A: Use layout anchors to set the constraints instead of setting the frame. You can do something like this to set your tableview's constraints:
techTableView.translatesAutoresizingMaskIntoConstraints = false

    techTableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor).isActive = true
    techTableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor).isActive = true
    techTableView.topAnchor.constraint(equalTo: mainView.bottomAnchor).isActive = true
    techTableView.heightAnchor.constraint(equalToConstant: 35).isActive = true

A: Your code seems to confusing, you are trying to set the table view frame by using anchors which is not the way of how it works. If you are aiming to do it via setup constraints then you should do it after adding the table view regardless of the value of its frame.
So, after after making sure that techTableView has been added to its superview (for instance: view.addSubview(tableView)) you would need to implement the following:
tableView.translatesAutoresizingMaskIntoConstraints = false

// x axis:
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0.0).isActive = true
// y axis:
tableView.topAnchor.constraint(equalTo: mainView?.productInformation.bottomAnchor, constant: 25.0).isActive = true
// width:
tableView.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 1.0).isActive = true
// height:
tableView.heightAnchor.constraint(equalToConstant: 35.0).isActive = true

At this point it should be displayed as expected, it has been handled by constraints, without the need of editing the frame (it is CGRect.zero by default).


text:
Q: Reduce view and subviews animated I am currently trying to make a UIView containing some UILabel animate to a new size. But doing so I am having some trouble understanding what is really happening with my view. I read some other post about it but I am still unclear about what is really going on.

In my button I added something that just double the size of the right constraint :
[superView layoutIfNeeded];
rightConst.constant *= 2;
[UIView animateWithDuration:3
animations:^{
        [superView layoutIfNeeded];
    } completion:nil];

superView Being the view I wanna animate and rightConst the constraint to the right.
But doing so, the animation starts but it is actually coming from left. I don't understand this part. My goal would be to animate just the right side of the view to show the resize and maybe the bottom part of the view but the top left should be fixed.

Thanks.

A: As described in this document, if you call [aView layoutSubviews], layout of the subviews of aView is forced but layout of aView itself is NOT forced.
You need to call layoutSubviews of the superview of the view you want to animate. In this case, the superview of the superview of the two labels.
Solution is here
UIView *theView;
// theView is the superview of the superview of the two labels.
theView = superView.superview;
[theView layoutIfNeeded];
rightConst.constant *= 2;
[UIView animateWithDuration:3
    animations:^{
        [theView layoutIfNeeded];
    } completion:nil];


text: Q: Inbuilt files of expo getting unreadble and corrupted I am a noob in react-native development. Previously I only had expo-cli, then I came to know that react-native-cli is better so I installed that also. But later on i realised that react-native is not as easier as expo so i made a third app on expo again using expo init appname.I tried uninstalling and installing expo again and again but could not find a solution of this bug. I also tried manually editing the AppEntry.Js file but wasted my time only. If any user find a solution please explain. I also have unanswered questions in django and hadoop. But no one from community even watch my question also. If admin of this site can view my question please suggest why my questions are not getting any answer


text:
Q: Leer código de barras, pasar a TextBox y ejecutar consulta Tengo una aplicación en C# donde escaneo un código de barras y me busca información en la base de datos. Lo que quiero saber es cómo buscar esa información de una forma automática, que cuando yo escanee el número me busque la información sin tener que presionar ningún botón.
Sólo quiero que alguien me guie en cómo hacerlo pues aun no tengo código.

A: Lo primero que tienes que saber sobre los códigos-128(información en inglés) es el formato que tienen (o el que deberían tener) incluye lo siguiente:

*

*A la izquierda, una zona en blanco que debería tener la longitud de dos caracteres.

*El carácter de inicio.

*Un número variable de caracteres ASCII y es lo más útil de este código.

*Un dígito para checkear la integridad de los datos.

*Un carácter de fin o "Stop character"

*A la derecha, una zona en blanco equivalente a dos caracteres.

Aquí te dejo las parte de una manera más gráfica

*

*Zona en blanco

*Carácter de inicio

*Los datos codificados

*Carácter de verificación

*Carácter de parada

*Zona en blanco

Ahora bien, lo más posible es que los datos codificados que leas sean de una longitud fija, por lo tanto, puedes aprovechar esa característica, en el evento TextChanged, puedes verificar la longitud y así en los dos casos funcionaría (sea leido o ingresado por una persona). Aquí te queda información sobre este evento
    private void textBoxConsulta_TextChanged(object sender, EventArgs e)
    {
        if (textBoxConsulta.Text.Length == 10)
        {
            //hacer consulta
        }
    }

Ahora bien, sí la longitud es cambiante, puedes usar el mismo evento del lector de código de barras para hacer la consulta (además de meter el texto en el TextBox, también haces la consulta) y para las personas, puedes agregar una tecla especial que cuando le den click se haga la consulta, por medio del evento KeyPress. Aquí te dejo información sobre este evento
    private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (e.KeyChar == (char)Keys.Enter)
        {
            //hacer consulta
        }
    }

Ahí haces la consulta cuando la persona precione la tecla Enter y así te evitas el botón para hacer la consulta. Aquí te dejo la información sobre las teclas que puedes comparar en C#
También puedes ejecutar la consulta sí se preciona una secuencia de teclas, esto lo logras con el evento KeyUp, aquí te dejo un ejemplo que se ejecutaría al teclear la combinación Ctrl+F
    private void textBox2_KeyUp(object sender, KeyEventArgs e)
    {
        if (Convert.ToInt32(e.KeyData) == Convert.ToInt32(Keys.Control) + Convert.ToInt32(Keys.F))
        {
            //hacer consulta
        }
    }

A: Fácilmente el textbox tiene un evento TextBox.TextChanged, al que puedes suscribirte y de ahi obtener automáticmanete lo que se va llenando en el cuadro.
Ten cuidado, porque se va a ejecutar por cada carácter que se ingrese, con lo cual deberias esperar a que el número este completo para hacer el query.
Una duda que me queda con tu pregunta, es como haces el escaneo, pq también podrías disparar la búsqueda una vez finalizado el escaneo.
Edicion por los comentarios:
Si el codigo es fijo, puedes contar la cantidad de caracteres y no ejecutar el metodo de busqueda hasta que llegues a la cantidad necesaria.


text:
Q: Perl: How is "start perl.exe " different from "perl.exe " I'm quite new to perl, and I've asked a friend about this and he said something about "parlor execution". What does this mean?
EDIT:
This is in Command prompt

A: start causes Windows to create a new command prompt window to run the command, freeing up the original prompt. For example, open a command prompt and compare ping -t 8.8.8.8 to start ping -t 8.8.8.8.


text:
Q: Unable to add button to a custom list I'm trying to add button to a custom list. It seems impossible to me, below is my button definition from elements.xml
<CustomAction Id="CopyTasksButton2" Location="CommandUI.Ribbon"
            RegistrationType="List" RegistrationId="10028">
<CommandUIExtension>
  <CommandUIDefinitions>
    <CommandUIDefinition
      Location="Ribbon.ListItem.New.Controls._children">
      <Button Id="Ribbon.ListItem.New.Controls.ReplacementButton"
        Command="ReplacementButtonCommand"
        Sequence="25"
        Image32by32="/_layouts/1045/images/formatmap32x32.png" Image32by32Top="-320" Image32by32Left="-384"
        Image16by16="/_layouts/1045/images/formatmap16x16.png" Image16by16Top="-160" Image16by16Left="-192"
        LabelText="Replaced Button"
        TemplateAlias="o2" />
    </CommandUIDefinition>
  </CommandUIDefinitions>
  <CommandUIHandlers>
    <CommandUIHandler
      Command="ReplacementButtonCommand"
      CommandAction="javascript:alert('This button has been replaced.');" />
  </CommandUIHandlers>
</CommandUIExtension>

I got this code from some tutorial. Here's link text a similiar post describing the same problem. I tried changing tollbar mode in list definition from Standard to Regular, but the button still don't show up. Anyone knows how to solve it ?
EDIT:
Even more strange thing: it works fine on another custom list (I only changed RegistrationId). The only difference between them is the fact, that the list on which it's working fine was created programatically during deployment.

A: The problem was the fact, that the feature adding custom actions file was not activated on the site I had my list on.


text:
Q: "At no time, was I informed" - looking for an explanation about this sentence I've taken a grammar test on an online site, and I've got 3 choices to choose out of them the correct one:

A. At any time, was I informed
B. At no time, was I informed
C. At no time was informed I

I had no clue about the correct answer because all of them looked quite odd to me. Anyway, when I cheked the correct answer is B: "At no time, was I informed".
Now, since non of them has a question mark at the end of the sentence, I'm really confused what kind of sentence it is, while the lexical verb (was) precedes the pronoun (I), which is typically happens in interrogative sentences. I'd love to get an explanation for that.

A: It is called an inverted sentence, eg.:
-- Never was so much owed by so many to so few.  -- Winston Churchill
-- Beautiful is the princess!
Such sentences are used for emphasis.

A: As what @randomhead has said, the comma should not be there.

B. At no time was I informed.

was is an auxiliary verb,  not a lexical one.
In this example, the subject and the auxiliary verb have been inverted.
Among other uses of subject–auxiliary inversion is the formation of sentences beginning with a negation, as in the following (b) examples from Wikipedia.

a. Sam will relax at no time.
b. At no time will Sam relax. - Negative inversion
a. Jim has never tried that.
b. Never has Jim tried that. - Negative inversion
a. He would do a keg stand at no party.
b. At no party would he do a keg stand. - Negative inversion

When the phrase containing the negation appears in its canonical position to the right of the verb, standard subject-auxiliary word order obtains. When the phrase is fronted, however, as in the b-sentences, subject-auxiliary inversion, (negative inversion) must occur.  [emphasis added]

On the comma matter mentioned earlier, the comma in your original example suggests that the preposition phrase At no time could be removed.  This would lead to *was I informed, which would be incorrect.
Note: Removing phrases separated by bracketing commas should not affect much the rest of a sentence.


text:
Q: EventGrid subscription binding works via ngrok to a local machine, not with a function in Azure I have an Azure Function App that I can create an EventGrid subscription to when it's hosted on a development machine via ngrok, but exactly the same function, when published to Azure, will not accept a subscription.
The error is "The attempt to validate the provided endpoint <> failed".
I have considered obvious things like the length of urls, but this does not seem to be the cause. The only difference between the two urls is the host, as in the host url of the function app, and the ngrok generated host. I have tried both using the portal and CLI to create subscriptions with the same result.
Any ideas how to fix this?

A: I had the same issue using the Azure CLI in powershell. For me the answer was essentially Roman Kiss's comment: Escape the the endpoint URL, because it contains an & symbol.
eg, changing this:
  -endPoint "https://xxxx.azurewebsites.net/runtime/webhooks/EventGrid?FunctionName=xxxx&code=xxxxx"

to this:
  -endPoint "https://xxxx.azurewebsites.net/runtime/webhooks/EventGrid?functionName=xxxx""&""code=xxxx"

The reason it worked using ngrok was because the ngrok endpoint (pointing to a local development function host) doesn't require the &code=xxxx part.

A: there are two kinds of azure function triggers what can be used for event grid subscriber, such as:

*

*HttpTrigger
endpointUrl format = https://{functionApp}.azurewebsites.net/api/{functionName}?code={functionKey}

Note, that the HttpTrigger function has a responsibility for validation of the event grid message. See more details here.

*EventGridTrigger
endpointUrl format = https://{functionApp}.azurewebsites.net/admin/extensions/EventGridExtensionConfig?functionName={functionName}&code={_masterKey}

It looks like, your endpoint doesn't include the url query string.

A: The answer to this is to include the code parameter when accessing the EventGrid subscriber in the cloud, rather than on a development machine. Details are here.
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-grid#create-a-subscription
The text of the above, which is all the documentation there seems to be, does not state that this is specifically required.


text:
Q: Posting a base64Image I'm trying to post two string and a *.jpg (Base64) file to a Spring servlet, and i am getting a http 400 error, i understand that this error is due to the @RequestParam being set to required = true
@RequestMapping(value = "blurred-url/start", method = RequestMethod.POST)
public ResponseEntity<String> start(@RequestParam(value = "base64Image", required = true) final String base64Image,
                                        @RequestParam(value = "transactionId", required = true) final String transactionId,
                                        @RequestParam(value = "counterSignature", required = true) final String counterSignature)

I am using the following code to encode the image File to Base64 ( harded coded for now)
public static String getImage(){

        File file = new File("c://nota.jpg");

        byte[] imageByteArray = null;
        String imageDataString = null;

        try {

            FileInputStream imageInFile = new FileInputStream(file);
            byte imageData[] = new byte[(int) file.length()];

            imageInFile.read(imageData);
            imageDataString = encodeImage(imageData);

        } catch (IOException e) {
            e.printStackTrace();
        }

        return imageDataString;

    }

     /**
     * Encodes the byte array into base64 string
     *
     * @param imageByteArray - byte array
     * @return String a {@link java.lang.String}
     */
    public static String encodeImage(byte[] imageByteArray) {
        return Base64.encodeBase64URLSafeString(imageByteArray);
    }

I already tried with many different approaches using Apache HttpClient, right now i am using MultipartEntityBuilder, but still can't seem to get it working, code below
CloseableHttpClient httpclient = HttpClients.createDefault();

        try {
            HttpPost httppost = new HttpPost("http://localhost:8080/server-name/" +
                    "blurred-url.action");

            StringBody base64Image = new StringBody("123", ContentType.TEXT_HTML);
            StringBody transactionId = new StringBody(jsonObj.get("signature").getAsString(), ContentType.TEXT_PLAIN);
            StringBody signature = new StringBody(jsonObj.get("signature").getAsString(), ContentType.TEXT_PLAIN);

            HttpEntity reqEntity = MultipartEntityBuilder.create()
                    .addPart("base64Image", base64Image)
                    .addPart("counterSignature", signature)
                    .addPart("transactionId", transactionId)
                    .build();

            httppost.setEntity(reqEntity);

            CloseableHttpResponse response = httpclient.execute(httppost);

            try {

                if(response.getStatusLine().getStatusCode() == 200){

                    HttpEntity resEntity = response.getEntity();

                    if (resEntity != null) {
                        System.out.println("Response content length: " + resEntity.getContentLength());
                    }
                    EntityUtils.consume(resEntity);

                    JsonObject jsPost = getJsonObjectFromStream(resEntity.getContent());

                    System.out.println("success: "+jsPost.get("success"));

                }else{
                    HttpEntity resEntity = response.getEntity();

                    StringWriter writer = new StringWriter();
                    IOUtils.copy(resEntity.getContent(), writer,Charset.defaultCharset());

                    System.out.println(response.getStatusLine());
                    System.err.println(writer.toString());
                }
            } finally {
                response.close();
            }
        } finally {
            httpclient.close();
        }

I believe there is something wrong with the size of the file, and i think that because if i just change the image encoded string to a shorter string like "123" the request passes, right now i am working with 400 KB images, any ideas ?


text:
Q: Send midi with AKSequencer over virtual output I'm trying to send a midi data from a .mid file with AKSequencer(), on a virtual output to use it outside the app (more detail below). My problem is my AKSequencer doesn't send midi outside my app like I would like to do with the virtualOuput port.
// My midiOutput is set like this:
    let midiOut = AKMIDI()
    midiOut.createVirtualOutputPort()
    midiOut.openOutput()

//And my AKSequencer connect to the midiOuput like this:
     sequencer.setGlobalMIDIOutput(midiOut.virtualOutput)

*

*I set up an AKSampler() to be sure my AKSequencer work fine.

*I think my issue provide either from my connexion to the midiOutput, either my use of AKSequencer not design to send midi like I imagine.
To enter into details, I'm trying to send MIDI over Bluetooth from an iOS app to a DAW. Thank the CABTMIDILocalPeripheralViewController. it's very easy to set up a connection to send midi when two devices are connected established. I achieve to send midi with AKMIDI().sendNoteOnMessage() so I'm sure the connection is not the problem.

A: Sending MIDI outside with AKSequencer a bit tricky. You need to either use AKMIDICallbackInstrument or your own AKMIDIListener to get MIDI from the sequencer and reroute outside of your app by AKMIDI output.
There is a discussion on this thread:
https://groups.google.com/forum/#!topic/audiokit/6VkayJMpMvY
Also, you may want to check out my MIDISequencer library built top on AKSequencer with iOS and Mac examples:
https://github.com/cemolcay/MIDISequencer


text:
Q: How to set focus in a dynamic graphic with InputFields Happy New Year!
I am trying to set cursor focus in this timetable application.  When the minutes are all entered the activity blocks resize.  Tabbing out of the minutes field moves focus to the activity field, but when resize occurs the focus disappears.  I have tried using a method from this answer: https://mathematica.stackexchange.com/a/81352/363 which does work in isolation, but I can't get it to work within the dynamic timetable.
Clear[timetable, entry, add, activity, mins, entries]

resize[] := Module[{},
  union = Union[Map[Head, minlist = Array[mins, num]]];
  If[union == {Integer},
   (* all times are set; modify go trigger and resize entries *)
   go++;
   entries = Array[entry, num];
   entries[[All, 1, 1, 2, 2, 2]] = -minlist;
   entries = MapThread[#1 /.
       (PlotRange -> {_, {0, _}}) -> (PlotRange -> {{0, 400}, {0, -#2}}) &,
     {entries, minlist}];
   accminlist = Most[Prepend[Accumulate[minlist], 0]];
   entries[[All, {-3, -1}]] = MapThread[{{0, -#1}, {400, #2}} &,
     {accminlist, minlist}];
   Array[(entry[#] = entries[[#]]) &, num]]]

newentry[thisnum_, ypos_] := Inset[Graphics[{ColorData[24][thisnum],
    Rectangle[{0, 0}, {400, -100}],
    Inset[Row[{
       Framed[InputField[Dynamic[mins[thisnum],
          (mins[thisnum] = #;
            resize[];

            MathLink`CallFrontEnd[
             FrontEnd`BoxReferenceFind[
              FE`BoxReference[SelectedNotebook[],
               {{"field" <> ToString[thisnum]}},
               FE`BoxOffset -> {FE`BoxChild[1]},
               FE`SearchStart -> "StartFromBeginning"]]]

            ) &], Number, BaseStyle -> {FontColor -> Black},
         FieldSize -> 3, ImageSize -> {Automatic, 23}],
        FrameStyle -> None, FrameMargins -> {{2, 2}, {5, 0}}],
       Button[" + ", add[thisnum], Appearance -> "Palette"],
       Spacer[30],
       InputField[Dynamic[activity[thisnum]], String,
        BaseStyle -> {FontColor -> Black, FontSize -> 22},
        FieldSize -> 10, BoxID -> "field" <> ToString[thisnum]],
       Spacer[30]
       },
      Alignment -> Center]]
    }, PlotRange -> {{0, 400}, {0, -100}}, ImageSize -> 400],
  {0, ypos}, {0, 0}, {400, 100}]

add[prev_] := Module[{size},
  num = prev + 1;
  size = If[NumberQ[mins[prev]], mins[prev], 100];
  ypos = entry[prev][[-3, 2]] - size;
  Quiet[Clear[entry[num]]];
  entry[num] = newentry[num, ypos]]

num = go = 1;
entry[num] = newentry[num, 0];
timetable = Deploy[Dynamic[show = Graphics[{Yellow,
       (* go needs to be in the enclosing construct to be tracked *)
       go;
       Rectangle[{0, 0}, {400, -500}],
       Array[entry, num]
       }, PlotRange -> {{0, 400}, {0, -500}}, ImageSize -> 400],
    TrackedSymbols :> {num, go}]];


text:
Q: How to insert data in sorted file in C++? I need to insert data in file in C++. I need to insert First and Last Name. All the lines in the file are sorted by the Last Name first, and then by the First Name. So my problem is when i insert new line how to insert on the right place and all the records still be sorted?
With this code i just append data in file, but don't know how to sort
`
string fName,lName;
cout<<"Insert Last Name: "<<endl;
    cin>>lName;

cout<<"Insert First Name: "<<endl;
cin>>fName;

ofstream myfile("sort.dat",ios::app);
myfile<<fName<<" "<<lName;`

A: There are multiple things working even with the code you posted:

*

*You need to check if your input was successful before processing any input. Otherwise you could, e.g., end up with empty strings being inserted into your file, probably corrupting its content.

*You almost certainly need to put a newline into the target file when appending the new content.

That is, your input could, for example, look like this:
std::string fName, lName;
if (std::cout << "Insert last name: "
    && std::cin >> lName
    && std::cout << "Insert first Name: "
    && std::cin >> fName) {
    // now do something with the read values
}
else {
    // deal with the error
}

The next step is "insert into a file": that doesn't work. Sorting a file is bound to work even less! Instead, what you would copy the file to a new destination and insert the record at the opportune location

*

*Read each line of the existing file. If the record is smaller than the new record, write it and go to line 1.

*Write new record.

*Write the already read record.

*Copy the remaining content of the original file.

*Close both files.

*Remove the original file and rename the new file to the name of the original file.

I could type out the code but I don't really need exercise with reading/writing files.


text:
Q: If a function maps $A$ to its PowerSet, is it Surjective? Given an arbitrary set $A$, let $F : A \rightarrow 2^A$ be the function defined for
all $a \in A$ by
$f(a) = \{a\}$
If $A$ maps to its power set, does this make $F$ surjective?
If somebody could help to prove this that would be very helpful

A: No it's not surjective because $ \emptyset $ is not in the range of $f$

A: There is no surjective map from $A \to 2^A$ as Cantor has taught us with his diagonal argument.

A: No. There is no $x$ for which $f(x)=\emptyset$. Surjective means it hits everything in $2^A$ which it doesn't because $\emptyset \in 2^A$.
$f$ is injective though.

A: Let's assume $A$ itself is non-empty so the proposed mapping $f$ has non-empty image. Elements of the power set of $A$ are subsets of $A$. The power set therefore comprises the empty set, "singleton" sets containing exactly one element, sets containing two elements, or three, etc.; if $A$ itself contains infinitely many elements, then $A$ also has subsets containing infinitely many elements, and each is an element of the power set.
In order for a function with codomain $2^{A}$ to be surjective, every subset of $A$ must be in the image.
The image of the mapping $f(a) = \{a\}$ consists of the singleton subsets of $A$. Not every subset of $A$ is a singleton, so $f$ is not surjective.
Perhaps you're conflating the image of $f$ with the union
$$
\bigcup_{a \in A} f(a) = \bigcup_{a \in A} \{a\} = A?
$$


text:
Q: 2D Screen Overlay in Unity for MRTKv2/Hololens2 I want to make a 2D Screen Overlay with Unity on Hololens2.
I created a Unity Canvas set to "Screen Space - Camera" Render Mode and tried to add the Camera provided by the MRTK as the Render Camera. This resulted in the following error:
TargetParameterCountException: Number of parameters specified does not match the expected number.
System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <567df3e0919241ba98db88bec4c6696f>:0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <567df3e0919241ba98db88bec4c6696f>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <567df3e0919241ba98db88bec4c6696f>:0)
Microsoft.MixedReality.Toolkit.Input.MixedRealityCanvasInspector.AllRootCanvases () (at Assets/MixedRealityToolkit.Services/InputSystem/Editor/MixedRealityCanvasInspector.cs:206)
Microsoft.MixedReality.Toolkit.Input.MixedRealityCanvasInspector.OnInspectorGUI () (at Assets/MixedRealityToolkit.Services/InputSystem/Editor/MixedRealityCanvasInspector.cs:334)
UnityEditor.UIElements.InspectorElement+<CreateIMGUIInspectorFromEditor>c__AnonStorey1.<>m__0 () (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorElement.cs:501)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

I don't know if this is a bug or if this is intended. My current workaround would be to calculate the worldspace position and dimensions of the overlay in front of the camera.
Is there any simple way to make the Hololens2 render a 2D Screen Overlay?


text:
Q: Standalone Tikz from tikzplotlib won't compile I'm trying to compile the following standalone tikz picture I exported from a matplotlib python plot with tikzplotlib. It originally had over 4000 data points and I thought it might be related to that, but deleting most of them didn't change anything. My current TexStudio options are set to pdflatex.exe -shell-escape -synctex=1 -interaction=nonstopmode %.tex and the errors I get are:
Missing } inserted. \end{axis}
Missing } inserted. \end{axis}
Missing } inserted. \end{axis}
Package tikz Error: Giving up on this path. Did you forget a semicolon?. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Missing } inserted. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Missing } inserted. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Extra }, or forgotten \endgroup. \end{axis}
Missing } inserted. \end{axis}
Missing } inserted. \end{axis}
Extra }, or forgotten \endgroup. \end{tikzpicture}
Missing } inserted. \end{tikzpicture}
Extra }, or forgotten \endgroup. \end{tikzpicture}
Missing } inserted. \end{tikzpicture}
Extra }, or forgotten \endgroup. \end{tikzpicture}
Improper \prevdepth. \end{tikzpicture}
Missing \endgroup inserted. \end{tikzpicture}
Missing } inserted. \end{tikzpicture}
the current plot has no coordinates (or all have been filtered away)
the current plot has no coordinates (or all have been filtered away)
the current plot has no coordinates (or all have been filtered away)

The document looks like this:
\documentclass[tikz]{standalone}
\usepackage[utf8]{inputenc}
%\usetikzlibrary{matrix,calc,shapes,arrows.meta,chains}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
    % This file was created by tikzplotlib v0.9.4.
    \begin{tikzpicture}

        \begin{axis}[
            legend cell align={left},
            legend style={fill opacity=0.8, draw opacity=1, text opacity=1, draw=white!80!black},
            tick align=outside,
            tick pos=left,
            x grid style={white!69.0196078431373!black},
            xlabel={runtime},
            xmin=-21.78865, xmax=493.66365,
            xtick style={color=black},
            y grid style={white!69.0196078431373!black},
            ylabel={realsum},
            ymin=40062.76, ymax=210447.04,
            ytick style={color=black}
            ]
            \addplot [only marks, mark=*, draw=white, fill=white!75.2941176470588!black, colormap/viridis, forget plot]
            table{%
                x                      y
                5.343 178904
                36.249 111280.1
                15.408 116577.6
                19.829 96333.3
                1.92 177480.8
                62.921 96105.7
                3.629 160828.6
                56.141 109809
                6.374 107856.8
                50.562 96579.8
                7.344 169063.7
                44.529 104101.9
                14.265 110733.9
                26.702 93951.6
                10.736 192417.5
                109.734 118327.8
                10.314 148391.3
                88 102395.1
                6.72 133887.6
                82.218 117045.1
                8.702 166363.5
                31.297 96127.7
                11.889 138228.8
                21.421 113204.8
                3.286 193060.4
                60.342 109896.8
                4.403 161075.7
                60.017 110284.9
                7.388 107470.9
                49.079 95917.6
                6.702 151490.9
                39.797 85394.5
                16.841 114251.2
                19.968 96359.1
                2.888 196647.5
                59.876 110170.9
                4.407 152544.6
                62.281 95858.1
                5.125 131297.6
                53.313 111019.5
                6.188 165340.3
                38.327 95750.9
                10.058 133818
                18.875 111274
                2.377 170262.4
                67.517 84013.3
                3.621 137730.1
                66.108 84102.4
                4.706 131388.5
                51.936 109948.6
                4.17 158531.8
                36.75 87789.1
                13.018 88319.2
                24.204 69131.1
                2.208 163462.5
                59.156 72404.3
                3.941 123789.1
                52.766 66915.8
                3.749 103882.6
                46.625 86194.8
                6.02 149750.1
                16.529 95276.8
                28.123 79030.5
                2.234 171477.8
                3.951 137884.9
                74.938 94466.4
                6.641 92738.2
                63.968 84964.9
                5.5 148785.1
                49.811 81232.5
                12.762 101769.6
                27.704 79641.6
                2.42 172851.9
                73.781 91497.7
                3.941 136970
                75.313 92813.1
                5.671 85936.7
                71.657 69466.3
                3.766 158678.4
                38.22 86517
                12.611 91744.8
                27.42 94709
                2.311 175502.9
                71.53 87648.2
                3.346 129020.9
                69.345 74570.2
                5.579 84816.4
                5.095 147701.6
                36.563 86892
                7.092 115384.1
                24.124 96328.8
                2.422 174374.9
                70.313 86764.8
                3.937 123321.3
                69.75 69681.6
                7.687 92690.8
                65.094 74613.6
                10.686 131328.4
                37.783 64066.9
                14.798 74370.3
                22.157 64229
                1.789 151432.4
                49.328 62859.7
                4.252 110033.7
                44.657 62782.9
                9.015 64516.8
                43.78 63109.2
                12.08 131105.1
                41.515 71267.5
                14.076 80808
                27.17 72962.4
                2.344 152229.2
                95.799 72900.7
                4.246 111841.3
                91.156 71052.4
                9.988 71025.8
                66.643 70888.3
                9.654 129551.7
                38.47 65009.7
                14.843 78930.3
                23.924 65744.7
                1.979 151606
                56.092 67365.3
                4.077 110217.6
                61 65442.5
                8.792 69723.3
                52.672 66347
                10.991 129922
                42.171 64166.5
                15.364 74598.2
                17.639 64359.6
                2.107 151856
                51.203 64431.2
                4.072 110777.8
                45.718 64517.7
                9.467 64422.6
                42.718 64352.8
                7.984 130963.5
                36.25 64215.1
                13.907 74287.8
                20.735 64250.7
                1.921 151622.6
                51.03 64146.9
                3.79 110630.3
                46.156 64184.8
                10.609 64423.6
                41.797 64351
                9.64 120246
                38.954 49026.3
                17.501 64962.1
                17.202 50276.2
                2.75 140314.4
                50.986 47807.5
                3.487 97835.3
                48.704 48735.6
                8.843 58172.9
                44.939 49286.9
                54.36 59887.5
                15.406 69601.3
                31.438 61774.5
                2.644 141789.2
                3.825 101958.7
                104.984 59882.4
                72.624 60840.7
                9.668 120424.7
                53.374 53755.2
                14.378 66518.9
                2.077 140786.9
                71.579 54573.3
                3.56 100846.3
                61.436 55052.6
                13.438 120423.9
                51.656 50559.1
                21.546 51296.6
                1.855 140744.8
                69.673 49555.3
                4.168 100532.1
                73.734 50082.7
                64.938 51577
                10.391 120152.9
                40 50799.6
                20.953 51373
                2.09 140224.1
                57.484 48960.3
                4.19 101050.2
                58.171 53320.7
                47.454 49540.5
                12.516 145374.7
                54.062 84815.9
                16.954 100843.6
                30.736 85095.1
                2.967 183566.5
                86.686 112620.5
                5.017 156999.5
                75.061 113684.6
                8.002 125468.2
                71.171 115398.7
                7.765 173789.1
                53.061 120127.3
                16.673 135653.4
                30.75 120339.3
                3.23 182778.9
                91.561 118134
                4.622 136859.9
                111.093 107277.9
                9.42 126950
                72.156 118798.4
                9.58 145193.6
                14.722 134310.4
                28.893 115481.7
                2.533 161442.9
                79.406 86168.6
                4.688 123516.8
                74.968 85514.1
                7.36 93635.1
                62.374 87139.1
                8.751 155295.5
                56.485 96856.4
                14.892 133876.4
                26.811 115166.7
                2.244 161850.4
                76.313 83979.2
                6.628 159945
                83.547 111402
                8.689 104691.7
                54.531 94375.7
                10.376 158081
                53.953 96992
                17.41 132879.7
                28.313 115133.5
                3.372 183708.9
                86.845 113845.9
                6.214 155185.7
                79.345 111874.3
                8.353 105550.5
                59.217 94599
                6.371 153249.2
                59.344 86750.8
                16.856 110914.2
                32.874 93089.3
                3.482 164461.4
                82.42 85861.2
                3.842 110009.8
                55.795 64958.8
                7.114 101302.5
                61.954 89339.5
                7.545 154466.5
                76.44 96848.2
                12.964 112069.1
                41.234 97894.3
                3.367 165032.6
                110.251 95149.5
                4.403 112568.9
                112.5 80438
                7.029 80362.7
                100.251 80294.7
                9.296 130211.1
                15.436 85504.2
                3.369 154978.1
                82.374 76983.2
                4.874 114535.6
                78.219 81005.2
                7.45 104005.1
                87.219 95394.5
                10.093 141441.5
                54.015 91370.8
                17.265 85261.8
                32.921 92147.4
                2.629 148563.2
                75.545 70167.6
                4.082 110079.6
                79.079 74309.5
                7.876 102420.5
                89.515 92223.9
                8.472 138955.2
                40.485 73011
                17.97 97246.5
                28.39 76707.9
                3.173 156073.3
                67.732 78762.9
                4.86 115524.8
                71.017 78382.9
                8.687 84879.7
                63.438 78112.6
                5.018 147978.5
                6.658 162200
                4.688 139261.5
                13.314 102010.8
                12.746 102799.6
                10.751 93181.3
                1.846 181264.1
                1.984000001 170576.9
                1.848 181693.7
                3.734 142243.5
                3.188 131713.5
                4.282 154009.7
                9.126 110172.5
                5.578 87493
                7.626 98770.2
                6.985 149219
                4.936 140474
                7.674 162648
                16.017 123769.2
                16.168 102129.4
                14.015 124022.1
                6.75 170341.7
                3.564 161879.3
                6.284 170457.8
                6.705 156986.3
                4.419 132722.4
                5.862 157156.6
                13.617 103279.3
                11.877000001 102693.9
                11.435 103045.6
                5.888 141833
                5.093 139731
                5.075 140498
                10.311 99334.2
                8.514 97670
                10.814 118785.2
                2.44 170330.7
                2.465 180910.1
                2.333 161572.5
                3.44 139442.6
                3.828 133348.5
                3.925 133468.5
                6.675 98967.5
                10.987 112059.6
                4.903 92830.6
                5.359 147567
                4.748999999 139344
                4.515 140193
                9.78 95096.3
                12.563 103473.8
                11.799 115848.4
                2.213 181367.4
                2.004 169697.8
                1.983999999 161228.2
                3.677 141739
                3.183 133648.5
                3.347 133020.5
                8.126 109170.3
                7.158 95993.6
                7.798 96359.3
                5.236 141535.5
                5.5 148427.5
                4.153 147686.5
                14.111 103112.1
                15.315 117153.9
                12.545 102504
                2.066 181537.9
                2.065 169697.3
                1.938 181775.6
                3.636 132065.5
                3.251 132608.5
                3.686 135296
                8.66 98301.3
                7.266 109991
                7.736 109893.2
                4.157 151880.5
                14.291 115053.5
                1.809 196030
                3.66 169604
                7.917 94670
                5.407 161468.5
                12.064 124193.5
                1.832 182299.5
                3.089 142398
                7.609 103654
                4.894 151763.5
                10.49 131129.5
                1.715 195695
                3.937 166419
                11.716999999 110808
                4.091 152054
                12.593 114480.5
                1.751 195764
                3.42 144178.5
                6.315 95598
            };
            \addplot [only marks, mark=*, draw=black, fill=black, colormap/viridis]
            table{%
                x                      y
            };
            \addlegendentry{0}
            \addplot [only marks, mark=*, draw=white!41.1764705882353!black, fill=white!41.1764705882353!black, colormap/viridis]
            table{%
                x                      y
            };
            \addlegendentry{1}
            \addplot [only marks, mark=*, draw=white!75.2941176470588!black, fill=white!75.2941176470588!black, colormap/viridis]
            table{%
                x                      y
            };
            \addlegendentry{2}
        \end{axis}

    \end{tikzpicture}
\end{document}

My actual goal is to include this graphic into an article, for which I get a memory excess error, if I call the tikz code as a simple *.tex file. Next I tried externalizing, which doesn't seem to work for some reason (I tried almost all suggestions on tex.se). So my last straw is standalone compiling and then load it into the main document. But I feel like the error is somewhere in the tikz code itself, which I exported from python with tikzplotlib.
I'm grateful of any suggestion!


text:
Q: Array empty in map returning promise - NODE JS i am newbie on this.
My problem is when I tried to return array full of values, it returned empty.
I faced some weeks before and I solved it, declaring the map as a const and returning its value in a function... but I can't remeber how I did it.
This is my code:
module.exports.deleteLockedEmail = (req, res, next) => {
  const maxDateAd = new Date().getTime() - 2592000000;
  const adIdsToDelete = [];
  Admin.find({})
    .then(emailLocked => {
      const mapToLockedEm =  emailLocked.map(element => {
        return User.findOne({email:element.email})
                .then(userLocked => {
                  return adIdsToDelete.push(userLocked)
                })
                .catch(error => console.log(error))
      })
      return mapToLockedEm
    })
    .catch(error => console.log(error))

  cron.schedule("* * * * *", function() {
  console.log("running a task every minute => delete locked ads");
  });
}

How can I fill this array?
adIdsToDelete = [];

A: Remember that all these calls to database are asynchronous. To get the values you have to wait till the promise is resolved and return values. In this case we can wait for all Promises with Promise.all to be executed and after that in next then context
module.exports.deleteLockedEmail = (req, res, next) => {
  const maxDateAd = new Date().getTime() - 2592000000;
  const adIdsToDelete = [];
  Admin.find({})
    .then(emailLocked => {
      const mapToLockedEm =  emailLocked.map(element => {
        return User.findOne({email:element.email})
                .then(userLocked => {
                  return adIdsToDelete.push(userLocked)
                })
                .catch(error => console.log(error))
      })
      return Promise.all(mapToLockedEm)
    }).then(() => {
      // In this context the adIdsToDelete will be filled
    });
    .catch(error => console.log(error))

  cron.schedule("* * * * *", function() {
  console.log("running a task every minute => delete locked ads");
  });
}

Also in general it can be a little tricky to work with variables like adIdsToDelete as they are in different scope than your promise chain. As it happened in your example - it can be confusing when this variable actually fills with values.
You can rewrite it as following
module.exports.deleteLockedEmail = (req, res, next) => {
  const maxDateAd = new Date().getTime() - 2592000000;
  Admin.find({})
    .then(emailLocked => {
      const mapToLockedEm =  emailLocked.map(element => {
        return User.findOne({email:element.email})
                .catch(error => console.log(error))
      })
      return Promise.all(mapToLockedEm)
    }).then(adIdsToDelete  => {
      // In this context the adIdsToDelete will be filled
    });
    .catch(error => console.log(error))

  cron.schedule("* * * * *", function() {
  console.log("running a task every minute => delete locked ads");
  });
}


text:
Q: Why the While loop keep running in the following Python code? I am new to Python, and could not figure out why the While loop is kept running in the following code?
prompt = "Please enter the customer's age: "
age = input(prompt)
while age != 'quit':
    age = int(age)
    if age <= 3:
        print("Welcome little buddy, no charges for you!")
    elif age > 3 and age < 12:
        print("The ticket price is $10")
    elif age >= 12:
        print("The ticket price is 15")
    elif age == 'quit':
        print("rerun the code")

A: i think you expect this from your code..i did some changes.your while loop didn't stop because it didn't have a reason to stop.it is testing same value again and again against condition
def agetest():
age = input("Please enter the customer's age: ")
age = int(age)
if 0<age <= 3:
    print("Welcome little buddy, no charges for you!")
    agetest()
elif age > 3 and age < 12:
    print("The ticket price is $10")
    agetest()
elif age >= 12:
    print("The ticket price is 15")
    agetest()
elif age == -1:
    print("thnks")

agetest()
here is the answer with while loop
age=0
while(age!= -1):

print("Please enter the customer's age: ")
age = int(input())
if 0<age <= 3:
    print("Welcome little buddy, no charges for you!")

elif age > 3 and age < 12:
    print("The ticket price is $10")

elif age >= 12:
    print("The ticket price is 15")

elif age == -1:
    print("thanks")

A: I have taken your code and did some modifications.
problems were :

*

*you were getting input out the loop so it was not interactive.

*there was no statement to modify age to break the loop.

*you can not cast the input as integer if you are expecting a string input.

 while True:
        prompt = "Please enter the customer's age: "
        age = input(prompt)
        if age == 'quit':
          print("rerun the code")
          break
        elif age <= 3:
            print("Welcome little buddy, no charges for you!")
        elif age > 3 and age < 12:
            print("The ticket price is $10")
        elif age >= 12:
            print("The ticket price is 15")