text:
Q: C# WPF Thread Monitoring (If All Created Threads has Ended) I'm a bit new to C# and WPF with my Project. Small picture of what i'm doing in the past. I wrote a Programm that does a backup of my MS SQL Databases. The idea was, to start every backup process in it's own process thread. That worked perfect! I start the process and thread by using:
...
string db_name = Convert.ToString(dataReader.GetValue(0));
var t = new Thread(() => BackupProcess(ServerName, SQLinstance, BackupPath, db_name));
t.Start();

Now, when all comes to an end, i would like to Monitor like "If the last thread comes to end, than do something like XY"
What is the best way do this?
THX for answering

A: Almost there is no reason to directly deal with threads now. It is fairly easy to do with Task Parallel Library and async-await.
You start number of Tasks, keep the reference of tasks, and wait/await it when needed.
Task backupTask = Task.Run(() => BackupProcess(ServerName, SQLinstance, BackupPath, db_name));
Task someOtherTask = Task.Run(() => SomeOtherWork(anyParameter));
...
//Later at some point
await Task.WhenAll(new []{backupTask, someOtherTask });
//At this point all tasks has been completed
//Do whatever you need to execute after all tasks finished

Note: BackupProcess can be made asynchronous if you use asynchronous API of your data provider without the use of Task.Run which makes a ThreadPool thread to wait there.
If you still wanted to go with Thread approach(which you shouldn't), you can use CountDownEvent for synchronization or Thread.Join on all the started threads.

A: Have a look at the TPL and the ContinueWith. It's very elegant and should match your requirements.
Action<string> action =
            (str) =>
                Console.WriteLine("Task={0}, str={1}, Thread={2}", Task.CurrentId, str, Thread.CurrentThread.ManagedThreadId);

// Creating a sequence of action tasks (that return no result).
Console.WriteLine("Creating a sequence of action tasks (that return no result)");
Task.Factory.StartNew(() => action("alpha"))
            .ContinueWith(antecendent => action("beta"))        // Antecedent data is ignored
            .ContinueWith(antecendent => action("gamma"))
            .Wait();

from: https://msdn.microsoft.com/de-de/library/dd321405(v=vs.110).aspx
ContinueWith() also can help you handle exceptions that occured while executing the task.

A: Ok, i do not really understand the way it goes. As you can see, i'm going to start a new Task inside my Loop at Point: "while (dataReader.Read())". As much databases as i have in my Server, the Loop will repeat. I don't know how many DB's i will have in the next time. At the end, when ALL Tasks are finished, i would like to go to the "DoSomething" Method. Is there anybody who can tell me the way it goes. It makes me crazy (this stuff). :-)
    private async void ReadDatabase()
    {
        string errorMSG01 = "...";
        string errorMSG02 = "...";
        string captionMSG = "...

        string BackupPath = txtBakPath.Text;
        string ServerName = txtSqlServer.Text;
        string SQLinstance = cmbSqlInst.SelectedItem.ToString();

        MessageBoxButtons buttons = MessageBoxButtons.OK;

        if (String.IsNullOrEmpty(txtBakPath.Text))
        {
            System.Windows.Forms.MessageBox.Show(errorMSG01, captionMSG, buttons, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
        }
        else if (!Directory.Exists(BackupPath))
        {
            System.Windows.Forms.MessageBox.Show(errorMSG02, captionMSG, buttons, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
        }
        else
        {
            string connetionString = null;
            SqlConnection connection;
            SqlCommand command;
            string sql = null;
            SqlDataReader dataReader;
            connetionString = ("Data Source=DPC-OHEINRICH\\NETZWERKLABOR; Integrated Security=True;");
            sql = "Select * from Sys.Databases";
            connection = new SqlConnection(connetionString);
            try
            {
                connection.Open();
                command = new SqlCommand(sql, connection);
                dataReader = command.ExecuteReader();
                StatusPrinter(0x0003, null);
                CreateLogfile(BackupPath);
                DeleteOldBakFiles();
                while (dataReader.Read())
                {
                    string db_name = Convert.ToString(dataReader.GetValue(0));
                    Task backupTask = Task.Run(() => BackupProcess(ServerName, SQLinstance, BackupPath, db_name));
                }
                dataReader.Close();
                command.Dispose();
                connection.Close();
            }
            catch (Exception ex)
            {
                lblStatusMessage.Content = Convert.ToString(ex.Message);
            }
        }
    }

    private void BackupProcess(string ServerName, string SQLinstance, string BackupPath, string db_name)
    {
        DateTime today = DateTime.Now;
        string todayformat = string.Format("{0:G}", today);
        string BakFileDate = todayformat.Replace(".", "").Replace(" ", "").Replace(":", "");
        string ReportBakFile = BackupPath + "\\" + db_name + "_db_" + BakFileDate + @".bak'";

        if (db_name != "tempdb")
        {
            string connetionString = null;
            SqlConnection connection;
            SqlCommand command;
            string sql = null;
            SqlDataReader dataReader;
            connetionString = ("Data Source="+ServerName+"\\"+SQLinstance+"; Integrated Security=True;");
            sql = @"BACKUP DATABASE " + db_name + @" TO DISK = '" + BackupPath + "\\" + db_name + "_db_" + BakFileDate + @".bak'";
            connection = new SqlConnection(connetionString);
            try
            {
                connection.Open();
                command = new SqlCommand(sql, connection);
                dataReader = command.ExecuteReader();
                dataReader.Close();
                command.Dispose();
                connection.Close();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
            this.Dispatcher.Invoke(new Action(() => this.WriteLogile(1, ReportBakFile)));
            this.Dispatcher.Invoke(new Action(() => this.StatusPrinter(0x0004, db_name)));
        }
    }
    public void DoSomething()
    {
        //we are done...
    }


text:
Q: Div scrolling makes padding-bottom disappears I have a site with the following structure:

        components

where the div 'test' calls the different components.
I´m trying to make it height responsive, so that if the components have 'height:100%', it should grow as the screen grows.
However if i set a min-height in the components, the scroll (from the main-outer div) should appear from that height.
My problem is: When the screen reachs that min-height, the padding-bottom (or margin) that i set in the 'main-inner class' disappears... How can i work around this problem?
I have an example here:
https://jsfiddle.net/4o1j2zmn/1/
Edit: I need the margin in higher div than the 'test' one, because as i call many components, i want to make the margin a global one

A: I have checked your code I think ".main-outer" padding is working fine. It is the issue in ".main-inner" margin and fixed height of the ".test" class. I have shifted your margin property from ".main-inner" to ".test" class and made ".test" height auto so that it will adjust according to the content and also show margin from the outer edge of parent container. Please check and try below snippet :

.main-outer {
  padding: 0 50px;
  height:100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: blue;
}

.main-inner {
  height: 100%;
  box-sizing: border-box;
}

.test{
      display: block;
    content: '';
    height: auto;
    background-color: red;
    margin: 50px 0 50px 0;
}

          http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/ http://www.himanshu-joshi.com/

redpajama_set_name: RedPajamaStackExchange


text:
Q: Python Socket Chat Program Not Work in Remote System I have a python chat program server.py and client.py. And it works in my local system, but when I try to connect to a remote host like koding.com ubuntu-vm or cloud9 ubuntu-vm it does not work.
I cannot reach the remote client across the web.
this link suggests what some of my issues are.
My objective is to chat using internet not local area network
Here is chat server.py
import socket
import thread

HOST = ''
PORT = 4444
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind((HOST, PORT))

while True:
  s.listen(1)
  conn, addr = s.accept()
  print 'Connected by', addr
while 1:
    data = conn.recv(1024)
    if data[:4] == "exit":
        print 'Parted by', addr
    else:
        conn.send(data),
    if not data:
        break
    print data
conn.close

Here is chat client.py
import socket
getHOST = (raw_input('Enter the Host: '))
print getHOST
HOST = getHOST
PORT = 4444
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))

NICK = raw_input('Welcome, Enter your name: ')

while True:
  MSG = raw_input('>> ')
  MSG = NICK + ': ' + MSG
  if MSG[5:] == "exit":
    break
  s.send(MSG)
  data = s.recv(1024)
 print data
s.close()

A: Your server.py shouldn't be even working locally, since it contains bugs.

*

*You must handle each incoming socket connection in a separate thread.

*You must call s.listen(1) only once, not in an infinite loop.

I suggest that you change your server.py as follows:
import socket
import thread

def handleChat(conn, addr):
    print 'Connected by', addr

    while 1:
        data = conn.recv(1024)
        if data[:4] == "exit":
            print 'Parted by', addr
        else:
            conn.send(data),
        if not data:
            break
        print data
    conn.close

def main():
    HOST = ''
    PORT = 4444
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.bind((HOST, PORT))
    s.listen(1)

    while True:
        conn, addr = s.accept()
        thread.start_new_thread(handleChat, (conn, addr,))

if __name__ == "__main__":
    main()

then put it on your server machine, say example.com, and run it. It should work now, as I tested and it did.


text:
Q: Create an avi video with opencv and python on a mac this is my situation:

*

*Im trying to use opencv to generate an avi movie from some png images

*Using OpenCV 2.3.4, Python 2.7 on Mac OSX

*The program ends with no error, generates the file. But is not playable.

Here is the code:
    import cv
    def make_video(nFrames):
        isColor = 1
        fps     = 1  #25 or 30, frames per second
        size = cv.GetSize(cv.LoadImage("canvas.png"))

        writer=cv.CreateVideoWriter("~/Documents/Workspace/Brief/video.avi",cv.CV_FOURCC('D','I','V','X'), fps,size,isColor)
#-----------------------------#Writing the video file:#-----------------------------
        for i in range(nFrames):
            img = cv.LoadImage("canvas%d.png"%i) #specify filename and the extension
        cv.WriteFrame(writer,img) # add the frame to the video

A: You are trying to use the DIVX codec on a platform that has neither a native encoder nor decoder for it. This won't work. Try using something simpler, like MJPG (Motion JPEG), instead.

A: I found a list of codecs that are native on Mac OSX:
http://opencv.willowgarage.com/wiki/QuickTimeCodecs
Now, it works very fine.


text:
Q: Can a group have a cyclical derived series? Given any group $G$, one can consider its derived series
$$G = G^{(0)}\rhd G^{(1)}\rhd G^{(2)}\rhd\dots$$
where $G^{(k)}$ is the commutator subgroup of $G^{(k-1)}$. A group is perfect if $G=G^{(1)}$ and thus has constant derived series, and solvable if its derived series reaches the trivial group after finitely many steps.
Is it possible for a group's derived series to be cyclical, i.e. that $G \cong G^{(n)}$ for some $n>1$ and $G\not\cong G^{(k)}$ for all positive $k<n$?
Note that such a group could not be finite, solvable, nor co-Hopfian.

A: This question was asked on Math Overflow, and was subsequently answered in the affirmative.
(This CW answer is just to lift the question out of the "unanswered" queue.)


text:
Q: Multimeter not reading capacitance accurately? I am trying to measure new electrolytic capacitors before they go into my guitar amp to make sure that they are up to spec.  I'm using a Morris #57044 multimeter, which has an autoranging capacitance measurement setting.
I've used it to test a couple of capacitors, all in the microfarad range (20 - 150 uF), and each time, the meter stays at 0 for a bit, shows a reading in nanofarads, then registers overload OL.  The meter is supposed to have a range from 10pF - 200uF.  EDIT: Looking more closely at the spec sheet, I see the meter has 40nF as its lowest range and 200uF as its highest range.  This should still read a 100uF cap fine though, if I understand correctly.
I am discharging my capacitors before measuring, making sure I am using the leads on the right sides of the cap, and using the relative REL button on the multimeter to zero out internal capacitance of the leads (though the problem persists even when I don't do this).
Is my meter not working properly?  Am I doing something wrong?
Product page:
https://www.morrisproducts.com/pc_product_detail.asp?key=B22E69AD80464A1584F58EF688EE7E38
Spec sheet:
https://www.morrisproducts.com/images/57044-specsheet.pdf
Thank you in advance for your help!


text:
Q: How to add Jquery Confirmation Modal I was trying to delete a data from database using jquery and the following script helped me to do so. Now I want to show a jquery confirmation modal(YES: NO) before it finally goes for deleting it. I went through some tutorials to learn how to do that but I couldn't make those work for me
Please kindly show me how to add the confirmation modal.
Thanks
" title="Delete" class="delete" ><img src="<?php echo base_url(); ?>support/images/icons/cross.png" alt="Delete" />

A: you don't need jQuery to do this. Javascript will do this just lovelyly:
if (confirm("Are you sure you want to contiune with this request?")) {
     //Do stuff
}

Simple :)

A: The simplest way to do this is with basic javascript.
Right before the ajax call, put this
if(!confirm('Are you sure you want to delete this?') {
    return false;
}

So if they decline, it just doesn't bother with the ajax.

A: I find it convinient to use jquery widget for modal dialog, and handle delete/cancel buttons.
(function ($) {
        $.widget('my.confirmDialog', {
            options: {
                url: null,
                elements: null,
                postParamName: 'id',
                afterDelete: null
            },
            _create: function () {
                var that = this;
                var options = that.options;
                that.element.dialog({
                    resizable: false,
                    autoOpen: false,
                    modal: true,
                    buttons: {
                        "Delete": function (e, ui) {
                            $(this).dialog("close");
                            $.post(options.url, that.postData, function (resp) {
                                that._trigger('afterDelete', e, resp);
                            });
                        },
                        "Cancel": function () {
                            $(this).dialog("close");
                        }
                    }
                });
                options.elements.live('click', function (event, ui) {
                    that.askConfirmation(this);
                });
            },
            askConfirmation: function (askElem) {
                var that = this;

                var confirmationText = $(askElem).attr("data-confirmation");
                that.element.text(confirmationText);

                var postData = {};
                postData[that.options.postParamName] = $(askElem).attr("data-value");
                that.postData = postData;

                that.element.dialog("open");
            },
            destroy: function () {
                this.element.dialog("destroy");
                $.Widget.prototype.destroy.apply(this, arguments);
            }

        });

    } (jQuery));

usage is really simple, you just create div for confirmation dialog:

and apply widget to this div, passing the elements that should trigger confirmation dialog show:
    $(document).ready(function () {

        $("#sampleDeleteConfirmation").confirmDialog({
            url: '/DeleteUrl',
            postParamName: 'canChangeThisIfNeeded',
            elements: $(".confirmThis"),
            afterDelete: function (event, response) {
                //callback after delete
            }
        });

    });

also for convinience i use data- attributes on buttons that show modal dialog to modify text and pass value for post to delete action.
          <button type="button" class="confirmThis" data-value="123" data-confirmation="Delete item 123?">
                Delete
           </button>
          <button type="button" class="confirmThis" data-value="567" data-confirmation="Delete item 567?">
                Delete
           </button>

and thats all )


text:
Q: Visual Basic Command Line Compiler has stopped working.I cannot compile my project I am working with visual studio 2010. Its working fine but now showing this popup "Visual Basic Command Line Compiler has stopped working" . I have scanned malware with 'Malwarebytes' & reinstalled visual studio but still facing this problem. I cannot compile my project. I have installed Visual Studio 2015 Community , Its could be any problem ?

After Click on Debug I am getting this message:
An unhandled win32 exception occurred in vbc.exe The Just-In-Time debugger was launched without necessary security permissions. To debug this process, the Just-In-Time debugger must be run as an Administrator. Would you like to debug this process? Process Name: C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe
Thank you for your help in advance !!

A: I have updated windows 8.1 to windows 10. Now my issue is resolved.I tried lot of things & wasted 2 days with this issue but couldn't solve this. After that i updated my windows. I didn't find out what was the actual issue.

A: For anyone having this issue, this Microsoft knowledge base entry solved the issue for me:

Known issue for security updates 3098779 and 3097997 for the .NET Framework 4.5.1 and 4.5.2 after you install the .NET Framework 4.6 on Windows 8.1, Windows RT 8.1, and Windows Server 2012 R2


text:
Q: Daily schedule as an index in Pandas I want to represent a daily schedule, given originally as a CSV file, as a Pandas DataFrame. The key to each row in the schedule is an hourly range in a day. The ranges are not overlapping. For example:
00:00, 01:00, some data
01:00, 03:00, some more data
03:00, 04:30, some other data

How can I create a data frame with one level of the index representing the start-to-end hours range?

A: Starting from your example dataframe (put column names on it):
In [78]: df
Out[78]:
   start    end            other
0  00:00  01:00        some data
1  01:00  03:00   some more data
2  03:00  04:30  some other data

Assuming start and end are strings, we can convert it to a datetime with to_datetime. This will use a default date as the data are only hours:
In [79]: pd.to_datetime(df['end'], format='%H:%M')
Out[79]:
0   1900-01-01 01:00:00
1   1900-01-01 03:00:00
2   1900-01-01 04:30:00
Name: end, dtype: datetime64[ns]

But assuming the start and end are always on the same day, this default date does not matter if we just use the datetime to calculate the time difference between start and end:
In [80]: df['range'] = pd.to_datetime(df['end'], format='%H:%M') - pd.to_datetime(df['start'], format='%H:%M')

In [81]: df
Out[81]:
   start    end            other    range
0  00:00  01:00        some data 01:00:00
1  01:00  03:00   some more data 02:00:00
2  03:00  04:30  some other data 01:30:00


text:
Q: Stack trace shows exception at wrong position I'm dealing with a null pointer exception for which I have a stack trace. In my log files, stack traces provide line numbers. It seems like the line numbers on the exception's stack trace are wrong. This is in a project that's new to me.
When I look at the source code at the specified lines, there is sometimes no code (a blank line) or an end curly brace (}), so I'm unable to find the cause of the NullPointerException.

java.lang.NullPointerException  at
  com.test.AddProductServlet.list(AddProductServlet.java:776)
    at
  com.test.AddProductServlet.list(AddProductServlet.java:436)
    at
  com.test.AddProductServlet.routeAction(AddProductServlet.java:263)
    at
  com.test.AddProductServlet.onService(AddProductServlet.java:145)
    at
  com.test.MqServlet.service(MqServlet.java:500)
    at
  javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

I inserted breakpoints before the lines from the stack trace (i.e. 770, 430 and 260) and still can't find the cause of the exception.
I am using Eclipse Helios with Java 1.6.0_16. Is this an Eclipse problem? If so, what changes are required?
I redeployed the project but still have the same problem.
What do I do next? How can I solve this problem?

A:
I am using eclipse helios, Java 1.6.0_16. Is it eclipse problem ?

No.  The JVM creates the stack traces, not Eclipse.  (It is theoretically possible that Eclipse's Java compiler could insert incorrect line numbers into the .class files ... but hundreds of thousands of Java developers would have noticed by now ...)

I redeployed project still same problem.  what to do next ? How to solve this problem?

As @Mike says "The source code that you're looking at is not the source code that was used to produce the compiled code that's throwing the error."
It therefore is either a build, deployment or configuration problem:

*

*In Eclipse, do an F5 refresh, clean and build the project, then redeploy and see if that fixes the line numbers.

*Manually shutdown the server, delete the deployed WAR file and expanded directory, redeploy the WAR file and restart the server.

*Search the deployed webapp, including all JAR files to find all copies of AddProductServlet.class.

*

*If there is more than one, figure out why.

*If there is only one, check that it is identical to the one that you just built, and if it is not, find out why.

*Use Ant or whatever to build the code outside of Eclipse, then deploy that.  (This will eliminate any possibility that it is Eclipse's fault ...)


text:
Q: The size of byte buffer and the shape do not match (previously not answered) I am trying to create a app that uses tensorflow model. My app crashes when inputFeature0.loadBuffer(byteBuffer) gets executed. ( got to know by commenting the lines)
var img=Bitmap.createScaledBitmap(bmp,229,229,true)
val model = SkinDiseasesDetectionFitSizeFinal24120210504.newInstance(this)
val inputFeature0 = TensorBuffer.createFixedSize(intArrayOf(1, 229, 229, 3), DataType.FLOAT32)
var tensorimage=TensorImage.fromBitmap(img)
var byteBuffer=tensorimage.buffer
inputFeature0.loadBuffer(byteBuffer)

This is the error
FATAL EXCEPTION: main
Process: com.azsky.skincancerdetection, PID: 31954
java.lang.IllegalArgumentException: The size of byte buffer and the shape do not match.

Can someone help me out in this?

A: in the process of converting tensorflow to TfLite if you use optimization then you should read from here first
https://www.tensorflow.org/lite/performance/post_training_quantization. it is said that the optimize version is 4 times smaller so you need to create your byte buffer to
[4 * 229 * 229 * 3] so it can match with the inputfeature0

A: I had same problem. I don't know why does this occurs but it is maybe because of DataType.FLOAT32. I printed both buffers and found the total size was different.
Log.d("shape", byteBuffer.toString())
Log.d("shape", inputFeature0.buffer.toString())

My inputFeature0.buffer was 4-times bigger that byteBuffer. Found it by dividing the both buffers. The solution i got from someplace it was

You should multiply your buffer with 4.

According to their explanation my buffer should be like this
buffer = image.width x image.height x colorChanels x 4

But i don't know how to change the total buffer instead is double the width and height to have the same effect.
Try using 458 x 458 image size.


text:
Q: setMyLocationEnabled(true) shows blue dot but not MyLocation button setMyLocationEnabled(true) isn't doing anything for me. I have the blue dot showing up in my map for the current location, but the MyLocation button does not show up. I have gone through many of the other stack overflow questions about this to no avail. Here is my code below:
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityCompat.requestPermissions(GPS.this,
            new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
            1);
    setContentView(R.layout.activity_gps);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    locationManager = (LocationManager)getSystemService(LOCATION_SERVICE);
    try {
        Log.d("request","done");
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this);
    }
    catch (SecurityException e) {
        Log.d("asdf", "Asdf");
    }
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
           fab.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                          Intent i = new Intent(getApplicationContext(), Leaderboard.class);
                          startActivity(i);
                        }
                });
}

@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setMyLocationEnabled(true);
    mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
    // Create a criteria object needed to retrieve the provider
    Criteria criteria = new Criteria();
    // Get the name of the best available provider
    String provider = locationManager.getBestProvider(criteria, true);
    String locationProvider = LocationManager.NETWORK_PROVIDER;
    String GPSProvider = LocationManager.GPS_PROVIDER;
    Location myLoc;
    if (provider == null)
        provider = locationProvider;
    // We can use the provider immediately to get the last known location

    try {
        myLoc = locationManager.getLastKnownLocation(provider);
        LatLng loc;
        if (myLoc == null) {
            loc = new LatLng(38.0317, -78.5108);
        } else {
            loc = new LatLng(myLoc.getLatitude(), myLoc.getLongitude());
            Log.d("lat2", "" + myLoc.getLatitude());
            Log.d("long2", "" + myLoc.getLongitude());
        }

        mMap.addMarker(new MarkerOptions().position(loc).title("Your Location"));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(loc));
        mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(loc, 16.0f));

    } catch (SecurityException e) {
        Log.d("asdf", "Asdf");
    }
}


text:
Q: CSS Grid: column-placed item going to next row I'm trying to achieve a grid showing position, name, evolution and score of users.
This list is dynamic, meaning I don't know how many rows I'm gonna have at the end.
Another constraint is that I can't change the order of elements in HTML.
As you can see in the snippet below, when I place items by column number, .name goes to the next row instead of staying on the current one, and I don't know why...

body {
  background-color: darkslategrey;
  color: white;
}

.container {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 10px;
  text-align: center;
}

.name,
.evolution,
.score {
  border-top: 1px solid white;
  border-bottom: 1px solid white;
}

.position {
  grid-column: 1 / span 3;
}

.name {
  grid-column: 1;
}

.evolution {
  grid-column: 2;
}

.score {
  grid-column: 3;
}

1st

+2

85pts

Jack

2nd

+3

82pts

Kate

3rd

-2

80pts

Sawyer

What am I missing here ?

A: The grid is filling in the order in which you have given it the HTML elements
But you'd like it to fill up any spare space if it can. CSS has the grid-auto-flow property which will make this happen. It'll spot the empty cell on row two and put Jack into it for example.

body {
  background-color: darkslategrey;
  color: white;
}

.container {
  display: grid;
  grid-template-columns: repeat(3, auto);
  grid-auto-flow: dense;
  gap: 10px;
  text-align: center;
}

.name,
.evolution,
.score {
  border-top: 1px solid white;
  border-bottom: 1px solid white;
}

.position {
  grid-column: 1 / span 3;
}

.name {
  grid-column: 1;
}

.evolution {
  grid-column: 2;
}

.score {
  grid-column: 3;
}

1st

+2

85pts

Jack

2nd

+3

82pts

Kate

3rd

-2

80pts

Sawyer


text:
Q: Writing down cohomology groups of the complex Grassmannian I am studying a homogeneous space and would like to know its cohomology groups. Using some sequences and fibrations I have figured out some of these groups, but largely in terms of the cohomology group of another space. That space is the complex Grassmannian:
$SU(m+n)/SU(m)\times SU(n)$
The cohomology ring of the Grassmannian is complicated. The treatment in
http://www-personal.umich.edu/~jblasiak/grassmannian.pdf
is understandable and I am working through it. However, I am a little bit confused about how to actually recover the "classical" cohomology groups from something like example 5.4, page 15 in the pdf. I find myself in the strange position of being told that these cohomology groups are known and, although complicated, possible to write down, without seeing how.


text:
Q: Spring Boot Servlet 4 support Which version of Spring Boot will (or does) officially support Servlet 4 spec?  Where can one see the new features that come with it documented?
Thank you.

A: Spring Framework 5 supports the Servlet 4 spec (see SPR-12674).
Not a lot of new features related to that, really. You can now inject a PushBuilder as a controller method argument if it is available (HTTP/2 enabled, supported by the client, etc).
Note that you need to use a Servlet 4 based container to use those features (see SPR-15593), or you'll need to fall back on container specific APIs which have been available for quite a while now.
Spring Framework does the job here, so there isn't anything special scheduled for now in Spring Boot 2.0; don't hesitate to open enhancement requests on the dedicated issue tracker if you've got ideas.


text:
Q: React Warning: Can only update a mounted or mounting component I have 2 components that I route between them by using the Route component from react router dom. One of the component get data from a dummy API server on componentDidMount event (using axios package), here is the code:
    componentDidMount() {
    axios.get('/posts')
        .then(response => {
            const posts = response.data.slice(0, 4);
            const updatedPost = posts.map(post => {
                return {
                    ...post,
                    author: 'Max'
                };
            });
            this.setState({ posts: updatedPost });
        })
        .catch(error => {
            console.log(error);
        });
}

The bug is, when I redirect from one component to another too fast, or something even not so fast, I get this warning on the console:

Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.

Please check the code for the Posts component.

What can I do to solve this issue?
I tried to figure out by:
setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op
but I didn't really understand when to pass a ref and how. If anyone can give an example how this issue can be solved, it would be great. Thanks!

A: Reacts warning is valid. How should react react when you call setState on a component that has already unmounted. The right way to handle it would be to cancel the data fetching request if the component will be unmounted for some reason (like user navigating away).
Below is an advice from the official blog. make use of the componentWillUnmount lifecycle
class ExampleComponent extends React.Component {
  state = {
    externalData: null,
  };

  componentDidMount() {
    this._asyncRequest = asyncLoadData().then(
      externalData => {
        this._asyncRequest = null;
        this.setState({externalData});
      }
    );
  }

  componentWillUnmount() {
    if (this._asyncRequest) {
      this._asyncRequest.cancel();
    }
  }

  render() {
    if (this.state.externalData === null) {
      // Render loading state ...
    } else {
      // Render real UI ...
    }
  }
}

It looks like Axios supports "cancellable" requests.

A: I solved this by dubes's answer! Thanks a lot, here is my code and it works great!
const CancelToken = axios.CancelToken;
let cancel;

class Posts extends Component {

    asyncRequest = null;
    state = {
        posts: []
    };

    componentDidMount() {
        this.asyncRequest = axios.get('/posts', {
            cancelToken: new CancelToken(function executor(c) {
                // An executor function receives a cancel function as a parameter
                cancel = c;
            })
        })
            .then(response => {
                const posts = response.data.slice(0, 4);
                const updatedPost = posts.map(post => {
                    return {
                        ...post,
                        author: 'Max'
                    };
                });
                this.setState({ posts: updatedPost });
            })
            .catch(error => {
                console.log(error);
            });
    }

    componentWillUnmount() {
        if (this.asyncRequest) {
            cancel();
        }
    }
}


text:
Q: Do "temporary" followers have special abilities? Do others followers (e.g. Leah, Tyreal) that join you in some parts of the story have special abilities (buff, active skills, etc.)?

A: Aside from cinematic powers, the answer thus far appears to be no, unless they're very well hidden.
Though do be careful - they have the power of being willful jerks, and Tyreal really loves to pull Champion packs or attack treasure goblins you weren't quite ready for.


text:
Q: Confusion about type refinement syntax On Type Level, i stumble upon the following:
sealed abstract class StSource[A] {
  type S
  def init: S            // create the initial state
  def emit(s: S): (A, S) // emit a value, and update state
}

object StSource {
  type Aux[A, S0] = StSource[A] {type S = S0}

  def apply[A, S0](i: S0)(f: S0 => (A, S0)): Aux[A, S0] =
    new StSource[A] {
      type S = S0
      def init = i
      def emit(s: S0) = f(s)
    }
}

The line that intrigued me is type Aux[A, S0] = StSource[A] {type S = S0}
In paerticular {type S = S0} in StSource[A] {type S = S0}
I do not really know how to read this, as in interpreting the construct involved here.
What is StSource[A] {type S = S0} ??? is that a structural type (part of it looks like it)
When defining type like trait, or class, Is the body of a class part of the type constructor represented by the class itself? what happened to the method in it ?
Really confused. Can someone deconstruct that please ?

A: StSource[A] {type S = S0} is a refined type.  {type S = S0} is a type refinement.
From one side, StSource[A] {type S = S0} is a subtype of StSource[A].
From the other side, StSource[A] is also an existential type with respect to StSource[A] {type S = S0}, namely StSource[A] is StSource.Aux[A, _] (aka StSource.Aux[A, X] forSome {type X}).
def test[A, S] = {
  implicitly[StSource.Aux[A, S] <:< StSource[A]]
  implicitly[StSource.Aux[A, _] =:= StSource[A]]
  implicitly[StSource[A] =:= StSource.Aux[A, _]]
}

https://scala-lang.org/files/archive/spec/2.13/03-types.html#compound-types

A compound type 1 with … with {} represents objects with members as given in the component types 1,…, and the refinement {}. A refinement {} contains declarations and type definitions. If a declaration or definition overrides a declaration or definition in one of the component types 1,…,, the usual rules for overriding apply; otherwise the declaration or definition is said to be "structural".

See also examples how to use refined types:
https://typelevel.org/blog/2015/07/19/forget-refinement-aux.html
How can I have a method parameter with type dependent on an implicit parameter?
When are dependent types needed in Shapeless?
Why is the Aux technique required for type-level computations?
Understanding the Aux pattern in Scala Type System
Enforcing that dependent return type must implement typeclass

When defining type like trait, or class, Is the body of a class part of the type constructor represented by the class itself? what happened to the method in it ?

You can replace
def apply[A, S0](i: S0)(f: S0 => (A, S0)): Aux[A, S0] =
  new StSource[A] {
    override type S = S0
    override def init = i
    override def emit(s: S0) = f(s)
  }

aka
def apply[A, S0](i: S0)(f: S0 => (A, S0)): StSource[A] {type S = S0} =
  new StSource[A] {
    override type S = S0
    override def init = i
    override def emit(s: S0) = f(s)
  }

with
def apply[A, S0](i: S0)(f: S0 => (A, S0)): StSource[A] {
  type S = S0
  def init: S
  def emit(s: S): (A, S)
} =
  new StSource[A] {
    override type S = S0
    override def init = i
    override def emit(s: S0) = f(s)
  }

but there is no sense in that because the type remains the same
def test[A, S0] = {
  implicitly[(StSource[A] {
    type S = S0
    def init: S
    def emit(s: S): (A, S)
  }) =:= (StSource[A] {type S = S0})]
}

When you add type S = S0 to the type you provide additional information (that type S is specific) but when you add def init: S, def emit(s: S): (A, S) to the type you don't provide additional information (methods init, emit being there is clear from the definition of class StSource[A]).
Other situation would be if the class were defined as just
sealed abstract class StSource[A] {
  type S
}

or even
sealed abstract class StSource[A]

Then
StSource[A] {
  type S = S0
  def init: S
  def emit(s: S): (A, S)
}

would be a type different from StSource[A] or StSource[A] {type S = S0} (a subtype of them). It would be a structural type (existence of init, emit would be checked using runtime reflection). Here
{
  type S = S0
  def init: S
  def emit(s: S): (A, S)
}

is a refinement but not type refinement.
Unlike defs (init, emit) type members don't have runtime representation (unless you persist them, e.g. with TypeTags) so using type refinement doesn't have runtime overhead.


text:
Q: log file handling with docker syslog logging driver Is there a way to pick up the log messages which are logged to a log file, when using the syslog log driver of Docker?
Whatever I write to sysout are getting picked by Rsyslog but anything logged to a log file is not picked. I don't see any option in the syslog driver option which could help indicate a log file to be picked up.
Thanks

A: Dockers logging interface is defined as stdout and stderr, so the best way is to modify the log settings of your process to send any log data to stdout and stderr.
Some applications can configure logging to go directly to syslog. Java processes using log4j are a good example of this.
If logging to file is the only option available, scripts, logstash, fluentd, rsyslog, and syslog-ng can all ingest text files and output syslog. This can either be done inside the a container with an additional service, or using a shared, standardised logging area on each Docker host and running the ingestion from there.


text:
Q: Runtime semantics for for-bodies in JavaScript In the specification, the runtime semantics for for-body evaluation in JavaScript are:

When running the following code, I expect two function-objects to be created, one per iteration of the for-body.
for(let x = 0; x < 2; x++) {
    function f() {}
}

Is this covered by 4.b. in the above specification snippet?

A: Yes, indeed section 13.7.4.8 of the EcmaScript 2015 specification, point 4.b describes that the body of the for loop  (the statement, as identified in 13.7.4.7) is evaluated, which in your example case means that the function object f is created.
This happens in each iteration (step 4).
You can spy on the double creation as follows:

let set = new Set;

for(let x = 0; x < 2; x++) {
    function f() {}
    set.add(f);
}

console.log(set.size); // 2 in Chrome, Firefox and Edge

I get output 2 in Chrome, FireFox and Edge. Some report 1 as output. This may well be a possible optimisation by the JavaScript engine.
In this context, mdn notes:

Functions can be conditionally declared, that is, a function statement can be nested within an if statement, however the results are inconsistent across implementations and therefore this pattern should not be used in production code. For conditional function creation, use function expressions instead.

This remark applies to loop constructs as well, since they also execute conditionally. So a more reliable result would be achieved with function expressions:

let set = new Set;

for(let x = 0; x < 2; x++) {
    var f = function f() {};
    set.add(f);
}

console.log(set.size); // 2 in Chrome, Firefox and Edge

Note that in both snippets, f is not scoped within the for body, but in the surrounding scope. So f is accessible after the loop has finished.

A:
Is this covered by 4.b. in the above specification snippet?

Not exactly. Point 4b in that snippet just says that the body is getting evaluated again during each iteration, regardless of what the body is.
The body itself is the statement
{
    function f() {}
}

and to see how that is evaluated we need to look at §13.2.13 Runtime Semantics: Evaluation of Block Statements, which does create the lexical environment for the body (which is nested inside the lexical environment with the variable x declared in the loop head) and runs the BlockDeclarationInstantiation, where the function is instantiated and bound to the name f.


text:
Q: dealing with tuple of list with flexible size in haskell I am learning Haskell, this question may be very stupid, but sorry I don't know its answer
I have a function that take a 4-tuple of list, size of these lists could be different, But in the tuple they have the same size
foo ([a],[b],[c],[d]) = concat [[a],[b])

it does not work for the list larger that size one
for example
foo ([1],[2],[3],[4]) // works fine
foo ([1,2] , [2,3] , [3,4] , [5,7]) or any larger size of those list generate error

any hint  about to generalize it ?

A: Much as the source code text [1] means a list with a single element which is the value 1, the source code text [a] means a list with a single element which is the variable a1. It does not mean a list of any size, and a refers to the single element of the list, not the list.
On the left hand side of an equation, [a] would be a pattern that only matches lists containing precisely one element (not zero, and not 2 or 3 or more); the value of that single element can be referred to by a on the right hand side of the equation.
So this code:
foo ([a],[b],[c],[d]) = concat [[a],[b]]

Gives a definition for the result of applying foo to a tuple of 4 singleton lists. It takes the single element in the first two lists (a and b), wraps those up in new singleton lists ([a] and [b]), puts those two lists in another list to make a list of lists ([[a],[b]]), and then passes that list to a function (concat [[a],[b]]).
If any one of the lists has more than one element, or is empty, then this equation doesn't say what the result of foo is. And if there are no other equations helping to define the function foo, then you'll get a pattern match error if you call foo on such non-conforming input.
If (as I suspect) what you wanted was to say that this definition applies to to a tuple of any 4 lists, then you would write it this way:
foo (a,b,c,d) = concat [a,b]

Note the lack of square brackets around a, b, c, and d. This version takes the entirety of the first two lists (a and b), puts those in another list to make a list of lists ([a,b]), and then passes that list to a function (concat [a,b]).
The type of the function (whether inferred from your code or declared by you) says that the things in the tuple that foo receives as argument are lists2; you don't have to put square brackets around every variable that is a list - indeed you can't, because that means something else quite specific! When you want to match against any possible list, you just write a; writing [a] says the list has to be a list of exactly one element, and it's only that element which is freely matched by the variable a, not the list itself.
Any time you use the square bracket syntax you are writing a list with a fixed number of elements,3 and the things in the brackets are individual elements of the list.

1 In a context where [a] is a value expression. If this occurs in a type expression then [a] is the type of lists whose elements are the type a.
2 Technically if you're using inferred types here then there's nothing at all constraining the types of c and d in my suggested version because they are unused, so they don't have to be lists.
3 Unless you're writing a list comprehension (e.g. [x + 1 | x <- [1, 2, 3]]) or a numeric range expression (e.g. [1..n]).

A: This should work:
foo (a:_,b:_,c:_,d:_)= concat [[a],[b]]

In the above function you just pattern match the first element of the parameters of each list.
A much simpler code:
foo (a:_,b:_,_,_)= [a, b]

In ghci:
ghci> foo ([1],[2],[3],[4])
[1,2]
ghci> foo ([1,2] , [2,3] , [3,4] , [5,7])
[1,2]


text:
Q: Как одновременно взаимодействовать с тремя многомерными массивами? У меня есть три многомерных массива с объектами внутри и 4 функций пересчета массива.
function fun_1(val_1,val_2,val_3){
return val_1 + val_2 - val_3
}

function fun_2(val_1,val_2,val_3){
return val_1 + val_2 + val_3
}

function fun_3(val_1,val_2,val_3){
return val_1 - val_2 + val_3
}

function fun_4(val_1,val_2,val_3){
return val_1 - val_2 - val_3
}

arr_1 =[
  { x: 20, y: 20, moveTo: true },
  { x: 70, y: 20 },
  { x: 70, y: 40 },
  { curve: {type: "cubic", x1:10, y1:20, x2:30, y2:5},
    x: 3,
    y: 4
  },

  { x: 90, y: 30 },
  { x: 50, y: 30 },
  { x: 50, y: 50 },
  {
    curve: {type: "cubic", x1:50, y1:20, x2:10, y2:4},
    x: 45,
    y: 40
  },
  { x: 40, y: 30 },
  { x: 20, y: 20 }
];

arr_2 =[
  { x: 11, y: 65, moveTo: true },
  { x: 44, y: 43 },
  { x: 70, y: 33 },
  { x: 31, y: 2 },
  { curve: {type: "cubic", x1:10, y1:20, x2:30, y2:5},
      x: 3,
    y: 4
  },
  { x: 530, y: 30 },
  { x: 2, y: 150 },

  { x: 253, y: 233 },
  { x: 212, y: 545 },
  {
      curve: {type: "cubic", x1:50, y1:20, x2:10, y2:4},
    x: 45,
    y: 40
  }
];

arr_3 = [
  { x: 54, y: 123, moveTo: true },
  { x: 44, y: 41 },
  { x: 56, y: 14 },
  { x: 7, y: 2 },

  { x: 11, y: 2 },
  {
  curve: {type: "cubic", x1:1, y1:4, x2:5, y2:66},
  x: 33,
  y: 11

  },
  { x: 55, y: 33 },

  { x: 66, y: 77 },
  { x: 334, y: 211 },
  {
      curve: {type: "cubic", x1:7, y1:20, x2:5, y2:4},
    x: 45,
    y: 13
  }
];

Мне нужно пересчитать весь массив и после создать массив с новыми данными.
Я пытался сделать это таким способом
result = []

var type = 1;

$.each(arr_1, function( index, val_1 ) {
result_1 = []

var val_2 = arr_2[index]
var val_3 = arr_3[index]

//Проверка существования  curve
curve_check_1 = "curve" in val_1;
curve_check_2 = "curve" in val_2;
curve_check_3 = "curve" in val_3;

if (curve_check_1 || curve_check_2 || curve_check_3){
//Подгон
cur = {type: "cubic", x1:0, y1:0, x2:0, y2:0}

if((curve_check_3 || curve_check_2) &&  !curve_check_1){
val_1['curve'] = cur;
}else if((curve_check_3 || curve_check_1) &&  !curve_check_2){
val_2['curve'] = cur;
} else if((curve_check_1 || curve_check_2) &&  !curve_check_3){
val_3['curve'] = cur;
}

result_1['curve']= [];

result_1['curve']['type'] = "cubic";

if(type == 1){
result_1['curve']['x1'] = fun_1(val_1['curve']['x1'] , val_1['curve']['x1'], val_1['curve']['x1']);
result_1['curve']['y1'] = fun_1(val_1['curve']['y1'] , val_1['curve']['y1'], val_1['curve']['y1']);
result_1['curve']['x2'] = fun_1(val_1['curve']['x2'] , val_1['curve']['x2'], val_1['curve']['x2']);
result_1['curve']['y2'] = fun_1(val_1['curve']['y2'] , val_1['curve']['y2'], val_1['curve']['y2']);
} else if (type == 2){
result_1['curve']['x1'] = fun_2(val_1['curve']['x1'] , val_1['curve']['x1'], val_1['curve']['x1']);
result_1['curve']['y1'] = fun_2(val_1['curve']['y1'] , val_1['curve']['y1'], val_1['curve']['y1']);
result_1['curve']['x2'] = fun_2(val_1['curve']['x2'] , val_1['curve']['x2'], val_1['curve']['x2']);
result_1['curve']['y2'] = fun_2(val_1['curve']['y2'] , val_1['curve']['y2'], val_1['curve']['y2']);
} else if (type == 3){
result_1['curve']['x1'] = fun_3(val_1['curve']['x1'] , val_1['curve']['x1'], val_1['curve']['x1']);
result_1['curve']['y1'] = fun_3(val_1['curve']['y1'] , val_1['curve']['y1'], val_1['curve']['y1']);
result_1['curve']['x2'] = fun_3(val_1['curve']['x2'] , val_1['curve']['x2'], val_1['curve']['x2']);
result_1['curve']['y2'] = fun_3(val_1['curve']['y2'] , val_1['curve']['y2'], val_1['curve']['y2']);
} else if (type == 4){
result_1['curve']['x1'] = fun_4(val_1['curve']['x1'] , val_1['curve']['x1'], val_1['curve']['x1']);
result_1['curve']['y1'] = fun_4(val_1['curve']['y1'] , val_1['curve']['y1'], val_1['curve']['y1']);
result_1['curve']['x2'] = fun_4(val_1['curve']['x2'] , val_1['curve']['x2'], val_1['curve']['x2']);
result_1['curve']['y2'] = fun_4(val_1['curve']['y2'] , val_1['curve']['y2'], val_1['curve']['y2']);
}

}

if(type == 1){
result_1['x'] = fun_1(val_1['x'] , val_2['x'], val_3['x']);
result_1['y'] = fun_1(val_1['y'] , val_2['y'], val_3['y']);
} else if (type == 2){
result_1['x'] = fun_2(val_1['x'] , val_2['x'], val_3['x']);
result_1['y'] = fun_2(val_1['y'] , val_2['y'], val_3['y']);
} else if (type == 3){
result_1['x'] = fun_3(val_1['x'] , val_2['x'], val_3['x']);
result_1['y'] = fun_3(val_1['y'] , val_2['y'], val_3['y']);
} else if (type == 4){
result_1['x'] = fun_4(val_1['x'] , val_2['x'], val_3['x']);
result_1['y'] = fun_4(val_1['y'] , val_2['y'], val_3['y']);
}

result.push(result_1);

});

console.log(arr_1);

console.log(result);

Но почему то у меня ни как не получается сделать это правильно.
Кто нибудь может мне помочь с этим?

A:

function fun_1(a,b,c){
return a+b-c;
}
function fun_2(a,b,c){
return a+b+c;
}
function fun_3(a,b,c){
return a-b+c;
}
function fun_4(a,b,c){
return a-b-c;
}

var arr_1 =[
 {x:20,y:20,moveTo:true},
 {x:70,y:20},
 {x:70,y:40},
 {curve:{type:"cubic",x1:10,y1:20,x2:30,y2:5},x:3,y:4},
 {x:90,y:30},
 {x:50,y:30},
 {x:50,y:50},
 {curve:{type:"cubic",x1:50,y1:20,x2:10,y2:4},x:45,y:40},
 {x:40,y:30},
 {x:20,y:20}];

var arr_2 =[
 {x:11,y:65,moveTo:true},
 {x:44,y:43},
 {x:70,y:33},
 {x:31,y:2},
 {curve:{type:"cubic",x1:10,y1:20,x2:30,y2:5},x:3,y:4},
 {x:530,y:30},
 {x:2,y:150},
 {x:253,y:233},
 {x:212,y:545},
 {curve:{type:"cubic",x1:50,y1:20,x2:10,y2:4},x:45,y:40}];

var arr_3 = [
 {x:54,y:123,moveTo:true},
 {x:44,y:41},
 {x:56,y:14},
 {x:7,y:2},
 {x:11,y:2},
 {curve:{type:"cubic",x1:1,y1:4,x2:5,y2:66},x:33,y:11},
 {x:55,y:33},
 {x:66,y:77},
 {x:334,y:211},
 {curve:{type:"cubic",x1:7,y1:20,x2:5,y2:4},x:45,y:13}];

var result = [];
var type = 2;

for (var i=0; i<arr_1.length; i++) {//Проверка существования  curve
 if (arr_1[i].curve){
  if (arr_2[i].curve){
   if (arr_3[i].curve){}else{
    arr_3[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
   }
  }else if (arr_3[i].curve){
   arr_2[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }else{
   arr_2[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
   arr_3[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }
 }else if (arr_2[i].curve){
  if (arr_3[i].curve){
   arr_1[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }else{
   arr_1[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
   arr_3[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }
 }else if (arr_3[i].curve){
  arr_1[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  arr_2[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
 }
}

for (var i=0; i<arr_1.length; i++) {//создание массива
 if (type == 1){
  if (arr_1[i].curve){
   result.push({curve:{type:"cubic",x1:fun_1(arr_1[i].curve.x1,arr_2[i].curve.x1,arr_3[i].curve.x1),y1:fun_1(arr_1[i].curve.y1,arr_2[i].curve.y1,arr_3[i].curve.y1),x2:fun_1(arr_1[i].curve.x2,arr_2[i].curve.x2,arr_3[i].curve.x2),y2:fun_1(arr_1[i].curve.y2,arr_2[i].curve.y2,arr_3[i].curve.y2)},x:fun_1(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_1(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
  }else{
   if(arr_1[i].moveTo){
    result.push({x:fun_1(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_1(arr_1[i].y,arr_2[i].y,arr_3[i].y),moveTo:arr_1[i].moveTo});
   }else{
    result.push({x:fun_1(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_1(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
   }
  }
 }else if (type == 2){
  if (arr_1[i].curve){
   result.push({curve:{type:"cubic",x1:fun_2(arr_1[i].curve.x1,arr_2[i].curve.x1,arr_3[i].curve.x1),y1:fun_2(arr_1[i].curve.y1,arr_2[i].curve.y1,arr_3[i].curve.y1),x2:fun_2(arr_1[i].curve.x2,arr_2[i].curve.x2,arr_3[i].curve.x2),y2:fun_2(arr_1[i].curve.y2,arr_2[i].curve.y2,arr_3[i].curve.y2)},x:fun_2(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_2(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
  }else{
   if(arr_1[i].moveTo){
    result.push({x:fun_2(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_2(arr_1[i].y,arr_2[i].y,arr_3[i].y),moveTo:arr_1[i].moveTo});
   }else{
    result.push({x:fun_2(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_2(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
   }
  }
 }else if (type == 3){
  if (arr_1[i].curve){
   result.push({curve:{type:"cubic",x1:fun_3(arr_1[i].curve.x1,arr_2[i].curve.x1,arr_3[i].curve.x1),y1:fun_3(arr_1[i].curve.y1,arr_2[i].curve.y1,arr_3[i].curve.y1),x2:fun_3(arr_1[i].curve.x2,arr_2[i].curve.x2,arr_3[i].curve.x2),y2:fun_3(arr_1[i].curve.y2,arr_2[i].curve.y2,arr_3[i].curve.y2)},x:fun_3(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_3(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
  }else{
   if(arr_1[i].moveTo){
    result.push({x:fun_3(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_3(arr_1[i].y,arr_2[i].y,arr_3[i].y),moveTo:arr_1[i].moveTo});
   }else{
    result.push({x:fun_3(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_3(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
   }
  }
 }else if (type == 4){
  if (arr_1[i].curve){
   result.push({curve:{type:"cubic",x1:fun_4(arr_1[i].curve.x1,arr_2[i].curve.x1,arr_3[i].curve.x1),y1:fun_4(arr_1[i].curve.y1,arr_2[i].curve.y1,arr_3[i].curve.y1),x2:fun_4(arr_1[i].curve.x2,arr_2[i].curve.x2,arr_3[i].curve.x2),y2:fun_4(arr_1[i].curve.y2,arr_2[i].curve.y2,arr_3[i].curve.y2)},x:fun_4(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_4(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
  }else{
   if(arr_1[i].moveTo){
    result.push({x:fun_4(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_4(arr_1[i].y,arr_2[i].y,arr_3[i].y),moveTo:arr_1[i].moveTo});
   }else{
    result.push({x:fun_4(arr_1[i].x,arr_2[i].x,arr_3[i].x),y:fun_4(arr_1[i].y,arr_2[i].y,arr_3[i].y)});
   }
  }
 }
}
console.log(result);

A: Предположим, что вам потребуется следующее.
функции ваши переименованы. pp -  плюс-плюс, pm - плюс-минус и т.д.
текущая функция для операций указывается в переменной func.

function pm(a,b,c){ return a + b - c; }
function pp(a,b,c){ return a + b + c; }
function mp(a,b,c){ return a - b + c; }
function mm(a,b,c){ return a - b - c; }

const arr_1 = [{x:20,y:20,moveTo:true},{x:70,y:20},{x:70,y:40},{curve:{type:"cubic",x1:10,y1:20,x2:30,y2:5},x:3,y:4},{x:90,y:30},{x:50,y:30},{x:50,y:50},{curve:{type:"cubic",x1:50,y1:20,x2:10,y2:4},x:45,y:40},{x:40,y:30},{x:20,y:20}];
const arr_2 = [{x:11,y:65,moveTo:true},{x:44,y:43},{x:70,y:33},{x:31,y:2},{curve:{type:"cubic",x1:10,y1:20,x2:30,y2:5},x:3,y:4},{x:530,y:30},{x:2,y:150},{x:253,y:233},{x:212,y:545},{curve:{type:"cubic",x1:50,y1:20,x2:10,y2:4},x:45,y:40}];
const arr_3 = [{x:54,y:123,moveTo:true},{x:44,y:41},{x:56,y:14},{x:7,y:2},{x:11,y:2},{curve:{type:"cubic",x1:1,y1:4,x2:5,y2:66},x:33,y:11},{x:55,y:33},{x:66,y:77},{x:334,y:211},{curve:{type:"cubic",x1:7,y1:20,x2:5,y2:4},x:45,y:13}];

var result = [];
var func = pp;

for(let idx = 0; idx < arr_1.length; idx++){
    const a = arr_1[idx],
          b = arr_2[idx],
          c = arr_3[idx];

    const curve = a.curve || b.curve || c.curve;

    var item =  { };

    if(curve){
        const points = ['x1', 'y1', 'x2', 'y2'];
        item.curve = { type: 'cubic' };

        let cp = (v,p) => v.curve ? v.curve[p] : 0;

        points.forEach(function(p){
            item.curve[p] = func(cp(a,p), cp(b,p), cp(c,p));
        });
    }

    item.x = func(a.x, b.x, c.x);
    item.y = func(a.y, b.y, c.y);

    result.push(item);
}

console.log(result);

A: Код основанный на ответе @moxolim

function fun_1(a,b,c){
return a+b-c;
}
function fun_2(a){
return a[0]+a[1]+a[2];
}
function fun_3(a,b,c){
return a-b+c;
}
function fun_4(a,b,c){
return a-b-c;
}

var arr_1 =[
 {x:20,y:20,moveTo:true},
 {x:70,y:20},
 {x:70,y:40},
 {curve:{type:"cubic",x1:10,y1:20,x2:30,y2:5},x:3,y:4},
 {x:90,y:30},
 {x:50,y:30},
 {x:50,y:50},
 {curve:{type:"cubic",x1:50,y1:20,x2:10,y2:4},x:45,y:40},
 {x:40,y:30},
 {x:20,y:20}];

var arr_2 =[
 {x:11,y:65,moveTo:true},
 {x:44,y:43},
 {x:70,y:33},
 {x:31,y:2},
 {curve:{type:"cubic",x1:10,y1:20,x2:30,y2:5},x:3,y:4},
 {x:530,y:30},
 {x:2,y:150},
 {x:253,y:233},
 {x:212,y:545},
 {curve:{type:"cubic",x1:50,y1:20,x2:10,y2:4},x:45,y:40}];

var arr_3 = [
 {x:54,y:123,moveTo:true},
 {x:44,y:41},
 {x:56,y:14},
 {x:7,y:2},
 {x:11,y:2},
 {curve:{type:"cubic",x1:1,y1:4,x2:5,y2:66},x:33,y:11},
 {x:55,y:33},
 {x:66,y:77},
 {x:334,y:211},
 {curve:{type:"cubic",x1:7,y1:20,x2:5,y2:4},x:45,y:13}];

var result = [];
var type = 2;

for (var i=0; i<arr_1.length; i++) {//Проверка существования  curve
 if (arr_1[i].curve){
  if (arr_2[i].curve){
   if (arr_3[i].curve){}else{
    arr_3[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
   }
  }else if (arr_3[i].curve){
   arr_2[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }else{
   arr_2[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
   arr_3[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }
 }else if (arr_2[i].curve){
  if (arr_3[i].curve){
   arr_1[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }else{
   arr_1[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
   arr_3[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  }
 }else if (arr_3[i].curve){
  arr_1[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
  arr_2[i].curve = {type:"cubic",x1:0,y1:0,x2:0,y2:0};
 }
}

for (var i=0; i<arr_1.length; i++) {//создание массива
var arr_x = [arr_1[i].x,arr_2[i].x,arr_3[i].x];
var arr_y = [arr_1[i].y,arr_2[i].y,arr_3[i].y];
if (type == 1){
var arr_fun_x = fun_1(arr_x);
var arr_fun_y = fun_1(arr_y);
}
else if (type == 2){
var arr_fun_x = fun_2(arr_x);
var arr_fun_y = fun_2(arr_y);
}
else if (type == 3){
var arr_fun_x = fun_3(arr_x);
var arr_fun_y = fun_3(arr_y);
}
else if (type == 4){
var arr_fun_x = fun_4(arr_x);
var arr_fun_y = fun_4(arr_y);
}
if (arr_1[i].curve){
var arr_x1 = [arr_1[i].curve.x1,arr_2[i].curve.x1,arr_3[i].curve.x1];
var arr_y1 = [arr_1[i].curve.y1,arr_2[i].curve.y1,arr_3[i].curve.y1];
var arr_x2 = [arr_1[i].curve.x2,arr_2[i].curve.x2,arr_3[i].curve.x2];
var arr_y2 = [arr_1[i].curve.y2,arr_2[i].curve.y2,arr_3[i].curve.y2];
if (type == 1){
var arr_fun_x1 = fun_1(arr_x1);
var arr_fun_y1 = fun_1(arr_y1);
var arr_fun_x2 = fun_1(arr_x2);
var arr_fun_y2 = fun_1(arr_y2);
}
else if (type == 2){
var arr_fun_x1 = fun_2(arr_x1);
var arr_fun_y1 = fun_2(arr_y1);
var arr_fun_x2 = fun_2(arr_x2);
var arr_fun_y2 = fun_2(arr_y2);
}
else if (type == 3){
var arr_fun_x1 = fun_3(arr_x1);
var arr_fun_y1 = fun_3(arr_y1);
var arr_fun_x2 = fun_3(arr_x2);
var arr_fun_y2 = fun_3(arr_y2);
}
else if (type == 4){
var arr_fun_x1 = fun_4(arr_x1);
var arr_fun_y1 = fun_4(arr_y1);
var arr_fun_x2 = fun_4(arr_x2);
var arr_fun_y2 = fun_4(arr_y2);
}
result.push({curve:{type:"cubic",x1:arr_fun_x1,y1:arr_fun_y1,x2:arr_fun_x2,y2:arr_fun_y2},x:arr_fun_x,y:arr_fun_y});
}else{
if(arr_1[i].moveTo){
result.push({x:arr_fun_x,y:arr_fun_y,moveTo:arr_1[i].moveTo});

}else{
result.push({x:arr_fun_x,y:arr_fun_y});
}
}
}
console.log(result);


text:
Q: Trouble accessing svg path attributes I am working with html5, js & css3.
I have the following code:
HTML
<object id="bottom" data="img/model/skirt.svg"
title="bottom" type="image/svg+xml" width="325"
height="500"> </object>

JS
var b = document.getElementById("bottom");
b = b.getSVGDocument().getElementById("here");
alert(b);

, which gives me "object SVGPathElement".
But when I try to access the fill property I get an "undefined" message.
alert(b.fill); for example.
The fill property is definitely set in the svg file. I'm obviously missing something though. Any pointers appreciated.

A: You have to access SVG properties with svgEl.setAttribute(name, value) and svgEl.getAttribute(name).
There is no shortcuts for accessing properties like HTMLElement.
But if you really want, you can extend SVGElement.prototype:
Object.defineProperties(SVGElement.prototype, {
  fill: {
    get: function() {
      return this.getAttribute('fill');
    },
    set: function(value) {
      return this.setAttribute('fill', value);
    }
  }
});


text:
Q: Select the most recent record with groupby in Laravel I have two tables entries similar as follows:
gym_clients
+---------+---------+-----------------+
|      id | first_name|     last_name |
+---------+-----------+---------------+
|      1  |  Name 1   |        Last 1 |
|      2  |  Name 2   |        Last 2 |
+---------+-----------+---------------+

gym_client_purchases

+---------+---------+-----------------+
|      id | client_id | purchase_date |
+---------+-----------+---------------+
|      15 |       1   |    2018-04-01 |
|      16 |       1   |    2018-05-01 |
|      17 |       2   |    2018-05-01 |
+---------+-----------+---------------+

I want to group by the purchases of each client and show the latest.
I tried this query but the groupby shows me the oldest purchase (id 15).
any ideas?
 $this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
              ->leftJoin('gym_clients', 'gym_clients.id', '=', 'client_id')
              ->groupBy('gym_client_purchases.client_id')
              ->orderBy('gym_client_purchases.purchase_date', 'desc')
              ->get();

Thanks in advance.

A: If you are explicitly calling the table names to specify their columns, isn't that supposed to be the same on the ON clause? on your code it's  like this
$this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
      //client_id here isn't specified
      ->leftJoin('gym_clients', 'gym_clients.id', '=', 'client_id')
      ->groupBy('gym_client_purchases.client_id')
      ->orderBy('gym_client_purchases.purchase_date', 'desc')
      ->get();

It should be like this:
$this->data['latestSubscriptions'] = GymPurchase::select('first_name', 'last_name', 'gym_client_purchases.*')
      ->leftJoin('gym_clients', 'gym_clients.id', '=', 'gym_client_purchases.client_id')
      ->groupBy('gym_client_purchases.client_id')
      ->orderBy('gym_client_purchases.purchase_date', 'desc')
      ->get();

I tested your code, it should be working properly due to the orderby descending, I think just a little typo on your code snippets

A: First, when you use group by you have o specify in this clause the columns for which the query is gioing to group, so I suggest to you to try you query on sql engine.
You will have something like this
select first_name, last_name, A.*
from gym_client_purchases A
left Join gym_clients B on B.id = A.client_id
group by A.client_id
order By A.purchase_date desc

and you will notice that it doesn't work
Maybe what you want is something like this
select A.client_id, B.first_name, B.last_name, max(A.purchase_date)
from gym_client_purchases A
left Join gym_clients B on B.id = A.client_id
group by A.client_id, B.first_name, B.last_name
order By max(A.purchase_date) desc


text:
Q: Best way of logging multiple values in a Scala / Akka class I'm in a situation where I need to log multiple values in an Akka (Scala) project to a single entry. Consider the following pseudocode, comments show where I have the information needed for the log entry.
def buildUrl() {
    // Item 1: Log url parameters
    val a = getMeSth(...)
    stuff(a);
}

def fetchUrl() {
    // Item 2: Log start time
    fetchAndHitAndRun(buildUrl())
}

def parseResponse() {
    // Item 3, 4, 5 ... 6: Log values from response
    // Item 7: Log time taken
    parseRsp(fetchUrl());
}

I need multiple values from multiple functions in order to build my logging model. How can I achieve that in Scala? Filling a class with the information seems to be a wrong approach...

A: My understanding is that you want to log all those values as a single event. Please correct me if you are wrong.
The most simple approach would be to return the values you need from the inner functions.
def buildUrl() {
    // Item 1: Log url parameters
    val a = getMeSth(...)
    val urlParameters = ???
    (stuff(a), urlParameters)
}

def fetchUrl() {
    val (stuff, urlParameters) = buildUrl()
    // Item 2: Log start time
    val startTime = ???
    (fetchAndHitAndRun(stuff), urlParameters, startTime)
}

... and so for each item you need.
Another is to use an actor that collects all the items it needs and then logs the entry.
class TransactionLogger extends Actor with ActorLogging {
  override def receive = append(Map.empty)
  def append(entries: Map[String, Any] = {
    case Append(key, value) =>
      context become append(entries + (key -> value))
    case Log =>
      log.info("{}", entries)
      context stop self
 }
}

So for each transaction you create this actor and then you send it stuff
val logger = system.actorOf(Props[TransactionLogger], transactionId)
logger ! Append("startTime", startTime)
logger ! Append("somethingElse", ???)

And when you are ready to flush it out
logger ! Log


text:
Q: How to stop ROLLBACK in progress? How do I stop a rollback in progress. I killed a very long running INSERT INTO table1 SELECT * FROM table2 statement. I want to commit what's already there but I can't since it's rolling back. Appears the rollback happened automatically once I killed the long running process.
This is a mySQL database.

A: You could try this.
https://dba.stackexchange.com/questions/5654/internal-reason-for-killing-process-taking-up-long-time-in-mysql

You can kill the mysqld process and set innodb_force_recovery to 3 to bring the database up without the rollback, then DROP the table that is causing the runaway rollback.


text:
Q: Are variables local to a class that are not declared as pointers, created on the heap or stack? Take the following:
A a;

class B; // No content for brevity

class A
{
public:

    A()
    {
         b.SetTitle("hi");
    }

private:

    B b;

}

int main()
{
    return 0;
}

The question here is if b which is declared inside A is declared on the heap or on the stack.
If on the heap, does this mean it is automatically deleted or must i also delete this too?
Side question:
This is what i was originally doing but thought i was being a bit stupid as i had to keep declaring everything as new everywhere.. if the above is on the stack, i guess it wasn't so stupid right?
A a;

class B; // No content for brevity

class A
{
public:

    A()
    {
         this->b( new B() ); // I don't have C++ 14 :( so i can't do make_unique
         b->SetTitle("hi");
    }

private:

    unique_ptr<B> b;

}

int main()
{
    return 0;
}

A: It still could be either or even (as Thomas Matthews points out below) in a fixed memory block. In this case you can think of it as "inside of A". If you put A on the heap it's on the heap. If you allocate "A" at the top of a function, say, it's on the stack (but inside of A).
Written like this it is a part of A and its lifetime is tied to A. You only need to worry about managing A.

A: Code Examples: Stack Vs Heap.
// Not a proper class but used for demonstration purposes
class SomeClass {
private:
    int x;
    int* ptr;

public:
    SomeClass() {
        // Both On x and ptr are on the stack when this constructor is defined and used.
        x = 10;
        ptr = &x;
    }

    SomeClass() {
        // x is on the stack but ptr is on the heap and delete needs to be called to release the memory.
        x = 10;
        ptr = new int;
    }
};

void someOtherFunction() {
    SomeClass a;  // on the stack relative to this function
    SomeClass* ptr = nullptr; // ptr is on the stack and is initialize to null.
    ptr = &a; // Still on the stack and ptr stores the address of (a).

    ptr = new SomeClass(); // Now ptr lives on the heap and delete needs to be called to release its memory.
}

Initially (ptr) does not have an address stored within in it because we initialized it to nullptr upon declaring it. It is stored on the stack, the address of (ptr) at this time has an address that is part of the stack memory addressing. Now we assign the address of (a) to (ptr); (ptr) is still on the stack, (a) is on the stack and the address of (a) is stored into (ptr).
Once we set (ptr) = new SomeClass() it is at this point that the compiler sets aside memory with the size of this class object and saves a random address from the heap into (ptr). (ptr) itself is still on the stack of this function but the memory address that (ptr) now stores is from the heap. The contents of (ptr) is accessible outside the scope of this function but needs to be return either through this functions return type or one of its parameters by reference.
Another words the address of (ptr) does not change within this function, it remains the same because the variable (ptr) itself still lives on the stack, it is what this pointer variable holds that changes from a stack memory address to a heap memory address once new is used.
To demonstrate this run this code in main() and look at the results; this still applies within other functions and class-struct objects.
#include <iostream>

int main() {
    int a = 10;
    int* ptr = nullptr;
    std::cout << "Memory Address that ptr is pointing to: " << ptr << std::endl;
    std::cout << "Memory Address of ptr: " << &ptr << std::endl;
    // std::cout << "What is stored in the variable at this memory address: " << *ptr << std::endl; // This can not be called program will crash,
    // ptr can not be dereferenced for it is not pointing to anything
    std::cout << std::endl;

    ptr = &a;
    std::cout << "Memory Address that ptr is pointing to: " << ptr << std::endl;
    std::cout << "Memory Address of ptr: " << &ptr << std::endl;
    std::cout << "What is stored in the variable at this memory address: " << *ptr << std::endl;
    std::cout << std::endl;

    ptr = new int;
    *ptr = 12;
    std::cout << "Memory Address that ptr is pointing to: " << ptr << std::endl;
    std::cout << "Memory Address of ptr: " << &ptr << std::endl;
    std::cout << "What is stored in the variable at this memory address: " << *ptr << std::endl;
    std::cout << std::endl;

    delete ptr;

    return 0;
}

As you can see the memory address of (ptr) does not change, what does change is the memory address that is stored within (ptr). Now the address of (ptr) can change if you use new on another pointer that is pointing to (ptr).
Now when you call new on a class type and you store the heap memory address into a pointer of that type, the memory address is where the class object lives so in this case anything that belongs to this class is on the heap.

Globals & Static Variables:

*

*Globals - Globals are listed in the (program file namespace)* and are accessible anywhere in the file they are declared and have the life time of the application.

*Static local variables are like global variables except they are only accessible in the function they are declared and are only initialized once per application runtime. They have the life time of the application.

*Static member variables to a class behave similar as regular static variables but they do not have the (this) pointer associated to them. They are visible to the function that declares them, they are initialized once per application runtime, and they have the life time of either the application run time or until there exists no more instances of that class object.
(*) Do not know the technical name but using program file namespace makes sense according to how global variables and their memory behave. - I rarely use global variables!

Here are some links for references.

*

*Stack Vs. Heap: StackOverflow

*Variables & Memory

*Static & Global Memory

*Static & Global Variables


text:
Q: Flutter web Error while loading network image url  Future<Uint8List> _loadNetworkImage(String imgname) async {
    try {
      final ByteData imageData = await NetworkAssetBundle(Uri.parse('https://picsum.photos/250?image=9')).load("");
      final Uint8List bytes = imageData.buffer.asUint8List();
      return bytes;
    } catch (_) {
      throw "Couldn't resolve network Image.";
    }
  }

when i run this code on flutter web i am getting this error i dont know why can anyone please help me.
Error: Couldn't resolve network Image.

A: Uri uri = Uri.parse(filePath);
Uint8List fileData = await http.readBytes(uri);


text:
Q: Java's Pattern/quote equivalent in ClojureScript When I am in Clojure, I can use (re-pattern (java.util.regex.Pattern/quote foo)) to exactly match the pattern string with another string. How can I do a similar thing in ClojureScript?
Edit: I also found this - Replicate the functionality of Java's "Pattern.quote" in a JavaScript RegExp

A: There is no built-in Clojure or Javascript function for this.
This clojure function should escape special regexp characters in a string:
(defn re-quote [s]
  (let [special (set ".?*+^$[]\\(){}|")
        escfn #(if (special %) (str \\ %) %)]
    (apply str (map escfn s))))

http://ideone.com/QXbbB
Disclaimer: I haven't tested this extensively so you may want to get a second opinion before using this code to sanitize potentially evil strings.

A: I should say first off that I use neither ClojureScript nor Javascript, but a quick search for ClojureScript regex support brought me to this page: https://github.com/clojure/clojurescript/wiki/Differences-from-Clojure, where under the "Other Functions" section, it says: "ClojureScript regular expression support is that of JavaScript", providing this link: http://www.w3schools.com/jsref/jsref_obj_regexp.asp. That next link seems to provide you with what you would be looking for (as a person who doesn't use JavaScript, I am cautious to say for certain).
Edit
Ooh, and maybe the answer to this old question here: Converting user input string to regular expression will give you a more complete answer.


text:
Q: Conditional react.js render is throwing an error In a react.js app I have a Tip component that uses the Tether library, as a mixin, to allow it to attach to some other component that requires a tip.  This works great, however I am a little confuses on how to remove the tip when the user clicks the close link.
After some reading around it seems that the best practice is, from the tip component, call a passsed in method from the parent, that will not render the component on the next pass.  Unfortunately, when I do this I get an error message saying:
Uncaught Error: Invariant Violation: processUpdates(): Unable to find child 2 of element. This probably means the DOM was unexpectedly mutated

The first question is, whether there is a better way to insert the tip?  If you checkout the getTip() method that seems pretty ugly to do a conditional insertion of the component.
The second question is to why the error mentioned above is occuring.
Thanks for any help.
Here is the code:
parent component
React.createClass({

    getTip: function() {
        if (!this.state.showTip) return React.createElement('div', null, '');

        return React.createElement(Tip, {
            closeText: 'Got it!',
            destroy: this.removeTip,
            attachment: 'top center',
            targetAttachment: 'bottom center'
          },
          'Click outer arrows to skip by the week and inner arrows to skip by the day.');
    },

    removeTip: function() {
      this.setState({showTip: false});
    },

    render: function() {
        var tip = this.getTip();

        return (

                {tip}

              ...
})

Tip component
var React = require('react');
var Tether = require('../tether/tether');

var Tip = React.createClass({

  mixins: [Tether],

  propTypes: {
    destroy: React.PropTypes.func.isRequired
  },

  getInitialState: function() {
    return {
      isVisible: true
    }
  },

  remove: function() {
    this.setState({isVisible: false});
    setTimeout(function() {
      this.props.destroy();
    }.bind(this), 500);
  },

  render: function() {
    // ...

    return (

        {this.props.children}

{this.props.closeText}

    );
  }

});

Tether component
var React = require('react');
var T = require('../../../../../bower_components/tether/tether');

var Tether = {

  propTypes: {
    attachment: React.PropTypes.string.isRequired,
    targetAttachment: React.PropTypes.string.isRequired
  },

  componentDidMount: function() {
    var el = this.getDOMNode();

    var tether = new T({
      target: el.parentNode,
      element: el,
      attachment: this.props.attachment,
      targetAttachment: this.props.targetAttachment
    });

    this.setState({'tether': tether});
  },

  componentWillUnmount: function() {
    var t = this.state.tether;
    t.destroy();
  }
};

module.exports = Tether;

A: According to the react docs hiding elements is the suggested approach.


text:
Q: Android Development: how to make the uses-permissions work? I'm wondering how can I make the uses permissions works?
In fact, i'm trying to make a phone call trhough a simple code but in the phone app, I've to press the green phone to confirm the call.
To make the app phone automatically I tried to introduce
<uses-permission android:name="android.permission.CALL_PHONE" />

in the AndroidManifest.XML but it doesn't change anything.
It doesn't matter if the uses-permission is there or not, I've to confirm the call.
Am I doing wrong with the permission?

A: I'm using the following permission (in AndroidManifest.xm):
<uses-permission android:name="android.permission.CALL_PHONE" />

With this permission in place, I can setup a call using:
 Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
 callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

 startActivity(callIntent);

A: To make the call from your application you have to add the CALL_PHONE permission in your manifest file as below:

 <uses-permission android:name="android.permission.CALL_PHONE" />

A: Make sure you have added
<uses-permission android:name="android.permission.CALL_PHONE" />

out side application tag and inside manifest tag in manifest.xml


text:
Q: LINQ One to Many, 3 levels Deep Question I am trying to figure out what I am doing wrong in the below LINQ statement.  It doesn't like the third SELECT.  It finds tblAddresse.tblAdminCounty in Intelisense when I am typing the query but when I type the SELECT after it it freaks.
Does it have to do with how tblAddress and tblAdminCounty are related?  I would have thought that the fact it shows in Intellisense under tblAddress would make that statement self-evident but obviously not.
If I was to query just the CountyName in a seperate function it would look like this -->
var countyName = from adminCounty in context.tblAdminCounties
                 where adminCounty.CountyID == countyID
                 select adminCounty.CountyName;

And this is the larger 3-tiered approach based on this site --> HERE
var query = from tblBusinesse in context.tblBusinesses
            where tblBusinesse.BusinessID == businessID
            select new
            {
                tblBusinesse.BusinessName,
                tblBusinesse.ContactName,
                tblBusinesse.EmailAddress,
                Address = from tblAddresse in tblBusinesse.tblAddresses
                      select new
                      {
                          tblAddresse.AddressLine1,
                          tblAddresse.AddressLine2,
                          tblAddresse.AddressLine3,
                          tblAddresse.CityName,
                          County = from adminCounty in tblAddresse.tblAdminCounty
                                   select new
                                   {
                                       adminCounty.CountyName
                                   }

                      }
            };

A: You're trying to query it as if a single address has multiple counties. Doesn't the fact that it's called tblAdminCounty rather than tblAdminCounties suggest that it's just a single item?
Try changing this:
County = from adminCounty in tblAddresse.tblAdminCounty
         select new
         {
             adminCounty.CountyName
         }

to just:
County = tblAddresse.tblAdminCounty


text:
Q: Connected metric space with at least two points is uncountable. I solved this problem in the baby rudin as follows:
take any point p in the metric space X and suppose X is at most countable. there must be r such that the set of all points q in X satisfying d(p,q)=r is empty. If not, X will be uncountable.
so X can be partitioned into two sets: B, the set of all points q in X such that d(p,q) >r and A, the set of all points q in X such that d(p,q) is strictly less than r
then A,B are open in X, disjoint in X. so X is disconnected, a contradiction.
so X is uncountable.
is this solution has any fallacy? any help will be appreciated.

A: Almost there, but one problem: You don't use the fact that X has at least two points, and – in a sense, because of that – you can't guarantee that both A and B are nonempty, which you need for X to be disconnected.
Let $p_0, p_1$ be two distinct points in X, and let $r_0 = \mathsf{d}(p_0, p_1)$, so $r_0 > 0$.
The rest is a tweaked version of your proof that takes $r_0$ into account.
For $r \ge 0$ let $D_r = \{p \in X \mid \mathsf{d}(p_0, q) = r\}$.
Suppose X is countable. Then so is $\bigcup_{r \le r_0} D_r$. The $D_r$ are pairwise disjoint, so for some $s \le r_0$, $D_s$ must be $\emptyset$. As $D_{r_0} \neq \emptyset$, we must have $s < r_0$.
Let $A = \bigcup_{r < s} D_r$ and $B = \bigcup_{r > s} D_r$
Then $p_0 \in A$, $p_1 \in D_{r_0} \subseteq B$, so both are nonempty, and are open. Thus $X = A \cup B$ is not connected.


text:
Q: ChildViewController/View does not get focus with GMSMapView Context: I want to achieve something similar with How can I mimic the bottom sheet from the Maps app? based on https://github.com/grendio/XBottomSheet/tree/master/XBottomSheet.Samples/XBottomSheet.Touch
Problem: If I use the BottomSheet with Google Maps for iOS View it does not let me to drag up or down the BottomSheet, even if it adds (it's visible on the screen).
Code: As already mentioned I have a Google Maps View and my BottomSheet View:
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        SetMap();
        SetBottomSheet();
    }

    private void SetMap()
    {
        var frame = new CGRect(0, View.Frame.GetMaxY(), View.Frame.Width, View.Frame.Height);
        mapView = new MapView(View.Frame);
        mapView.MyLocationEnabled = true;

        mapView.BuildingsEnabled = false;
        mapView.SetMinMaxZoom(15f, 18f);

        View = mapView;
    }

    private void SetBottomSheet()
    {
        var bottom = UIScreen.MainScreen.Bounds.Height - UIApplication.SharedApplication.StatusBarFrame.Height;
        bottomSheetViewController = new BottomSheetViewController(100, 300, bottom, true, BottomSheetState.Middle);

        AddChildViewController(bottomSheetViewController);
        View.AddSubview(bottomSheetViewController.View);
        bottomSheetViewController.DidMoveToParentViewController(this);

        bottomSheetViewController.View.Frame = new CGRect(0, View.Frame.GetMaxY(), View.Frame.Width, View.Frame.Height);
    }

How can I wire these two views (mapView and bottomSheetViewController.View) in order to not lose the drag up/down feature from the BottomSheet control?
Even if the question is for Xamarin, an answer from swift or objective-c will do just fine as I will do the 'translation' afterwards.

A: I had a similar project, my solution at that time was to set the ConsumeGesturesInView property to false.
So your SetMap() method should look like this:
private void SetMap()
{
    var frame = new CGRect(0, View.Frame.GetMaxY(), View.Frame.Width, View.Frame.Height);
    mapView = new MapView(View.Frame);
    mapView.MyLocationEnabled = true;
    mapView.Settings.ConsumeGesturesInView = false;
    mapView.BuildingsEnabled = false;
    mapView.SetMinMaxZoom(15f, 18f);

    View = mapView;
}


text:
Q: matlab - fix wrong complicated structure I have this structure with paths stored in columns. For constellation 3 I have longer and shorter paths between points 1 and 2 with the first two being:
const(3).path{1,2}=[1,1;  9,10;  7,8;  6,6;  2,2];
I would like to add another path that is shorter:
const(3).path2{1}=[1;9;7;3];
const(3).path{1,2}(:,end+1)=const(3).path2{1};

The whole code is:
for i2 = 1:Num.paths
 if const(k).path{const(k).path2{i2}(1),const(k).path2{i2}(end)}>0
  const(k).path{const(k).path2{i2}(1),const(k).path2{i2}(end)}(:,end+1)=const(k).path2{i2};
  else
  const(k).path{const(k).path2{i2}(1),const(k).path2{i2}(end)}=const(k).path2{i2};
  end
 end

I understand the error but don't know how to change the structure in order to keep all paths stored where they belong.
The error is:
Unable to perform assignment because the size of the left side is 5-by-1 and the size of the
right side is 4-by-1.


text:
Q: Does $(x+1)\log{(x+1)}-2x\log{x}+(x-1)\log{(x-1)}\geq\frac{1}{x}$ hold for $x\geq 1$? While calculating some integrals I happened to face the following estimate: $$\int_m^{m+1}\int_n^{n+1}\frac{dy dx}{x+y}\geq\frac{1}{m+n+1}.$$ After some tedious calculations, I figured that this estimate follows from the inequality $$ (x+1)\log{(x+1)}-2x\log{x}+(x-1)\log{(x-1)}\geq\frac{1}{x}\quad\text{for }x>1.$$ (If we interpret $0\log0$ as $\lim_{\epsilon\rightarrow 0} \epsilon\log{\epsilon}=0$, then the inequality also holds for $x=1$.)
But how do we prove this inequality?
What I have tried: Let $f(x)=x\log{x}-(x-1)\log{(x-1)}$ for $x>1$. Then the RHS equals $f(x+1)-f(x)$ so by the Mean Value Theorem there exist some $\xi$ between $x$ and $x+1$ such that $$f(x+1)-f(x)=f'(\xi)=\log{\left(1+\frac{1}{\xi-1}\right)},$$ and it suffices to show that $\log{(1+\frac{1}{x})}\geq\frac{1}{x}$ ... which is unfortunately not valid !
I think some clever use of the MVT can solve this problem, but I don't see how I should proceed. Please enlighten me.

A: Let $f(x)=(x+1)\ln{(x+1)}-2x\ln{x}+(x-1)\ln{(x-1)}-\frac{1}{x}$.
Hence, $f''(x)=\frac{2}{x^3(x^2-1)}>0$ for $x>1$ and the rest is smooth.
Because $f'(x)=\ln(x-1)-2\ln{x}+\ln(x+1)+\frac{1}{x^2}<\lim\limits_{x\rightarrow+\infty}f'(x)=0$
and $f(x)>\lim\limits_{x\rightarrow+\infty}f(x)=\lim\limits_{x\rightarrow+\infty}\ln\frac{\left(1+\frac{1}{x}\right)^{x+1}}{\left(1+\frac{1}{x-1}\right)^{x-1}}=\ln\frac{e}{e}=0$


text:
Q: Does ARMv8 AArch32 mode has backward compatible with armv4 , armv5 or armv6? As we know that ARMv8 AArch32 bit mode is fully backward compatible with ARMv7 architecture. And ARMv7 has backward compatibly with ARMv4 , ARMv5te and ARMv6.
From above statement, can we say that ARMv8 AArch32 mode also has backward compatible with ARMv4 , ARMv5te and ARMv6. i.e Code compiled with ARMv4 , ARMv5te or ARMv6 can run on ARMv8 AArch32 mode?

A: Simple answer is AARCH32 is as backward compatible to v4,5,6 as much as ARM V7 is. If your legacy ARM code worked on V7 it would definitely work on AARCH32.


text:
Q: Ubuntu 16.04 Fresh Install, headphones not detected I had a working copy of Ubuntu 16 for a while which suddenly decided it didn't want to play audio. After following this forum like a hawk and trying absolutely everything I figured it may be a good time for a fresh install.
I have now formatted the drive, installed a fresh version of Ubuntu 16 and I have no audio in the headphones.
When I plug the headphones in they are not detected, now I have seen on the forums somebody suggesting to do this to set Element Speaker in a config file to On, when I do this it in fact detects headphones plugged in but only outputs sound via the laptops speakers.
I am using a DellXPS 15 9550
ALSA Info: http://www.alsa-project.org/db/?f=ff9c1ae35e5cc00282fe937713af8e0afb2440c1
I have typed alasmixer into terminal and unmuted headphones and ensured the driver is selected, that has made no difference.
anthony@LPT-0112:~$ lspci
00:00.0 Host bridge: Intel Corporation Sky Lake Host Bridge/DRAM Registers (rev 07)
00:01.0 PCI bridge: Intel Corporation Sky Lake PCIe Controller (x16) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation Skylake Integrated Graphics (rev 06)
00:04.0 Signal processing controller: Intel Corporation Skylake Processor Thermal Subsystem (rev 07)
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31)
00:15.0 Signal processing controller: Intel Corporation Sunrise Point-H LPSS I2C Controller #0 (rev 31)
00:15.1 Signal processing controller: Intel Corporation Sunrise Point-H LPSS I2C Controller #1 (rev 31)
00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] (rev 31)
00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
00:1c.1 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #2 (rev f1)
00:1d.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #9 (rev f1)
00:1d.4 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #13 (rev f1)
00:1d.6 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #15 (rev f1)
00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
00:1f.3 Audio device: Intel Corporation Sunrise Point-H HD Audio (rev 31)
00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)
02:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 32)
03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS525A PCI Express Card Reader (rev 01)
04:00.0 Non-Volatile memory controller: Device 1c5c:1284
06:00.0 PCI bridge: Intel Corporation Device 1576
07:00.0 PCI bridge: Intel Corporation Device 1576
07:01.0 PCI bridge: Intel Corporation Device 1576
07:02.0 PCI bridge: Intel Corporation Device 1576
0a:00.0 USB controller: Intel Corporation Device 15b5


text:
Q: Data is not being fully exported from MySQL to CSV via PHP Context:
I'm working with the following stack: HTML/CSS, PHP, MySQL, and XAMPP to build a web app that stores and retrieves data entered to a form.
Problem:
I have two files (i) export.php and (ii) export_index.php. As you can see from the picture below the export_index.php file indexes the data and is a complete representation of the data in my MySQL database when viewed locally in the web browser. The export.php file is supposed to output to the local downloads folder the exact same thing you see in the export_index.php file to a .csv format file to be easily opened in Excel.
After reading the documentation and trying to debug it I still can't figure out where the error is but I think that it is coming from either/both of $data[] and $row. Appreciate any help I can get on this bug. Thanks for your time!
Images:
output of index_export.php file

output of export.php file

Code:
index_export.php
<?php
ob_start();

/*
* this file is used to index the data stored in
* the MySQL database. it will display the data
* on the screen that is in the db but DOESNT
* format the data for excel files. export.php
* does that.
*/

// dn login credentials
include("dbconfig.php");

// connect with credentials held in dbconfig file
$con = new mysqli($server, $user, $pass, $db);

if ($con->connect_error) {
    die("Connection failed: " . $con->connect_error);
}

session_start();

// List Data
$query = "SELECT * FROM comp";
if (!$result = mysqli_query($con, $query)) {
    exit(mysqli_error($con));
}

if (mysqli_num_rows($result) > 0) {
    $data = '

            Title
            Overview
            Threat Details
            Customer Name
            Field Insight
            Competitor
            ID
            Revenue Damage
            Technology
            Geography

    ';
    while ($row = mysqli_fetch_assoc($result)) {
        $data .= '

        '.$row['titleBinded'].'
        '.$row['overviewBinded'].'
            '.$row['threatDetailsBinded'].'
            '.$row['customerNameBinded'].'
            '.$row['fieldInsightBinded'].'
            '.$row['competitorBinded'].'
            '.$row['idBinded'].'
            '.$row['revDamageBinded'].'
            '.$row['techBinded'].'
            '.$row['geoBinded'].'

';
    }
    $data .= '
';
}

?>

<!doctype html>

    <meta charset="UTF-8">
    <title>Export Database Data</title>

    <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css"/>

Export Data from MySQL to CSV

        <?php echo $data ?>

        <button onclick="Export()" class="btn btn-primary">Export to CSV File</button>

export.php
<?php
ob_start();

// passes in the login credentials
include("dbconfig.php");

// !!!CAUSED A MEMORY LEAK!!!!
// includes the index file
//include("export.php");

// connect with credentials held in dbconfig file
$con = new mysqli($server, $user, $pass, $db);
if ($con->connect_error) {
    die("Connection failed: " . $con->connect_error);
}

session_start();

// list all data in the db
$query = "SELECT * FROM comp";
if (!$result = mysqli_query($con, $query)) {
     exit(mysqli_error($con));
}

$data = array();
if (mysqli_num_rows($result) > 0) {

    while ($row = mysqli_fetch_assoc($result)) {
        $data[] = $row;
    }
}

// header labels for the CSV file
header('Content-Type: text/csv; charset=utf-8');

header('Content-Disposition: attachment; filename = comp.csv');

$output = fopen('php://output', 'w');

fputcsv($output, array('Title', 'Overview', 'Threat Details', 'Customer Name', 'Field Insight', 'Competitor', 'ID', 'Revenue Damage', 'Technology', 'Geography') );

// iteratively exports row by row
if (count($comp) > 0) {
    foreach ($data as $row) {
    fputcsv($output, $row);
    }
}

?>

create.sql
drop database if exists comp;
create schema comp;
use comp;

create table comp (
    titleBinded VARCHAR(50),
    overviewBinded VARCHAR(255),
    threatDetailsBinded VARCHAR(255),
    customerNameBinded VARCHAR(30),
    fieldInsightBinded VARCHAR(255),
    competitorBinded VARCHAR(30),
    idBinded INT,
    revDamageBinded INT,
    techBinded VARCHAR(225),
    geoBinded VARCHAR(255),
    PRIMARY KEY (idBinded)
);

A: You have done small mistake in  export.php file:
// iteratively exports row by row
 if (count($comp) > 0) {
   foreach ($data as $row) {
      fputcsv($output, $row);
   }
 }

In if condition of above code use
if(count($data) > 0)

Instead of
 if(count($comp) > 0)

Best of luck!!!


text:
Q: Firestore - Database limitation I'm starting a project with Cloud Firestore and I added my first collections and documents.
In order to be sure to use the right tool, I tried to search if there were limitations with Cloud Firestore.
I saw there were some limitations in bandwidth, number of commits etc.. but I didn't find (or didn't understand) if there was a limitation with the size of the database (number of collections / documents).
Is there a limitation? If yes, does it exist plans/bundles to extend those limitations ?
Best Regards,

A: Cloud Firestore scales effortlessly.  It will store as much data as you're willing to put into it (and pay for).  Practically speaking, volume of data is not a concern.