text:
Q: Boltzmann distribution in Ising model I've written in Matlab a code for a Ising model in 1 dimension with 40 spins at $k_{B}T=1$.
I record the energy of every step in a Metropolis Monte Carlo algorithm, and then I made an histogram like this.

I want to show the theoretical Boltzmann distribution. What is the exact formula to get this shape? $Ax \exp(-\beta x)$?

A: I have to make a number of assumptions, as you did not state all the necessary information. So, I am going to assume that you are using periodic boundary conditions, that is, your Hamiltonian is
$$
\mathcal{H}(\sigma) = -\sum_{i=1}^N \sigma_i\sigma_{i+1},
$$
where I have denoted by $N$ the number of spins (that is, $N=40$ in your case) and used the convention that $\sigma_{N+1}=\sigma_1$.
Write $D(\sigma)$ the number of $i\in \{1,\dots,N\}$ such that $\sigma_i\neq \sigma_{i+1}$, still using the convention that $\sigma_{N+1} = \sigma_1$. Note that $D(\sigma)$ is necessarily an even number (because of the periodic boundary conditions).
Then, the total energy can be rewritten as
$$
\mathcal{H}(\sigma) = D(\sigma) - (N-D(\sigma)) = 2D(\sigma) - N \,.
$$
The probability that $D(\sigma)=\delta N$ (with $\delta \in \{0,\frac{2}{N},\frac{4}{N},\dots,\frac{2\lfloor N/2 \rfloor}{N}\}$) is
$$
\mathrm{Prob}(D = \delta N) = \binom{N}{\delta N}\frac{\exp(-2\beta\delta N)}{\frac{1}{2}\bigl(1-\exp(-2\beta)\bigr)^N + \frac{1}{2}\bigl(1+\exp(-2\beta)\bigr)^N},
$$
since there are $\binom{N}{\delta N}$ ways of choosing the $\delta N$ pairs of disagreeing neighbors.
This can be easily reformulated in terms of the energy per spin
$$
\frac{1}{N}\mathcal{H}(\sigma) = \frac{2}{N}D(\sigma) - 1.
$$
Note that the possible values of the latter are $-1$, $-1+\frac{4}{N}$, $-1+\frac{8}{N}$, ... , $-1+\frac{4\lfloor N/2\rfloor}{N}$.
The probability of observing an energy per spin equal to $\epsilon$ is then given by
$$
\mathrm{Prob}(\mathcal{H}=\epsilon N)
=
\binom{N}{\frac{1+\epsilon}{2}N}
\frac{\exp\bigl(-\beta (1+\epsilon) N\bigr)}{\frac{1}{2}\bigl(1-\exp(-2\beta)\bigr)^N + \frac{1}{2}\bigl(1+\exp(-2\beta)\bigr)^N} .
$$
Here is a plot of the distribution for your parameters $N=40$ and $\beta=1$ (only values of $\epsilon$ smaller than $-0.2$ are indicated as higher values have too small probability at this temperature):

(The computation using other boundary conditions are similar.)


text:
Q: AngularJS push to array does not work i have a service witch retrieves users from my backend application, but it returns an empty array when there is some data.
Here is code:
var service = this;
service.users = [];
service.getUsers = function()
    {
        $http(
            {
                method: 'GET',
                url: 'http://api.svcassist.dev/index.php/v1/user'
            }
        ).then(
            function( data )
            {
              angular.forEach( data.data.data, function( value, key)
              {
                service.users.push(
                    {
                        id: value.id,
                        first_name: value.first_name,
                        last_name: value.last_name,
                        email: value.email
                    }
                );
              });
             return service.users;
        },
        function( error ){}
        );
        return service.users;
    };

getUsers() function returns empty array, but when i log data in forEach loop i see that there are some data that are pushed to array. I have a lot more services that works exactly like this, i cant figure out whats wrong here.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Getting html textarea with Node JS express returns undefined I'm trying to get input from the following textareas and turn it into a bunch of keywords
<form method="POST" action ="/input" enctype="text/plain">

Enter the keywords you would like first with spaces in between

        <textarea name ="keys1" id="editBox" rows="5" cols="5"></textarea>

Enter the keywords you would like second with spaces in between

        <textarea name ="keys2" id="editBox" rows="5" cols="5"></textarea>
        <button type="submit">Submit</button>
</form>

However whenever I run the following code (see below) I get the error TypeError: Cannot read property 'keys1' of undefined. How do I fix it? I looked at some other questions but their solutions don't really work (or I don't understand them).
Code that returns the error:
app.post('/input', function(req, res) {
    var firstkey = req.body.keys1;
    var secondkey= req.body.keys2;
    var keylist1 = firstkey.split("+");
    var keylist2 = secondkey.split("+");
    if(keylist1.length>0 && keylist2.lenght>0){
        var output = [];
        for(i=0; i<keylist1.length; i++){
            for(j=0; j<keylist2.length;j++){
                output.push(keylist1[i]+" " + keylist2[j]);
            }
        }
        res.send('Upload more
' + output.join('
'));
    }
});


text:
Q: Filtering sequences in MATLAB Is it possible to do something like regular expressions with MATLAB to filter things out?   Basically I'm looking for something that will let me take a vector like:
[1 2 1 1 1 2 1 3 3 3 3 1 1 4 4 4 1 1]

and will return:
[3 3 3 3 4 4 4]

These are the uninterrupted sequences (where there's no interspersion).
Is this possible?

A: Using regular expressions
Use MATLAB's built-in regexp function for regular expression matching. However, you have to convert the input array to a string first, and only then feed it to regexp:
C = regexp(sprintf('%d ', x), '(.+ )(\1)+', 'match')

Note that I separated the values with spaces so that regexp can match multiple digit numbers as well. Then convert the result back to a numerical array:
res = str2num([C{:}])

The dot (.) in the pattern string represents any character. To find sequences of certain digits only, specify them in brackets ([]). For instance, the pattern to find only sequences of 3 and 4 would be:
([34]+ )(\1)+

A simpler approach
You can filter out successively repeating values by checking the similarity between adjacent elements using diff:
res = x((diff([NaN; x(:)])' == 0) | (diff([x(:); NaN])' == 0))

Optionally, you can keep only certain values from the result, for example:
res(res == 3 | res == 4)

A: You can do it like this:
v=[1 2 1 1 1 2 1 3 3 3 3 1 1 4 4 4 1 1];
vals=unique(v); % find all unique values in the vector

mask=[]; % mask of values to retain

for i=1:length(vals)
   indices=find(v==vals(i)); % find indices of each unique value

   % if the maximum difference between indices containing
   % a given value is 1, it is contiguous
   % --> add this value to the mask
   if max(indices(2:end)-indices(1:end-1))==1
       mask=[mask vals(i)];
   end
end

% filter out what's necessary
vproc=v(ismember(v,mask))

Result:
vproc =

     3     3     3     3     4     4     4

A: This can be another approach, although a little bit too elaborated.
If you see the plot of your array, you want to retain its level sets (i.e. a == const) which are topologically connected (i.e. made by one piece).
Coherently, such level sets are exactly the ones corresponding to a==3 and a==4.
Here is a possible implementation
a = [1 2 1 1 1 2 1 3 3 3 3 1 1 4 4 4 1 1]

r = [];  % result
b = a;   % b will contain the union of the level sets not parsed yet
while ~isempty(b)

    m = a == b(1);  % m is the current level set

    connected = sum(diff([0 m 0]).^2) == 2;  % a condition for being a connected set:
                                             % the derivative must have 1 positive and 1
                                             % negative jump
    if connected == true   % if the level set is connected we add it to the result
        r = [r a(m)];
    end

    b = b(b~=b(1));

end

A: If you try something like
a = [1 2 1 1 1 2 1 3 3 3 3 1 1 4 4 4 1 1]    %initial vector
b = a>=3   %apply filter condition

a = a(b)   %keep values that satisfy filter

a will output
a = [3 3 3 3 4 4 4]


text:
Q: JavaScript Sleep Function I have a banner rotator that refreshes every 60 seconds however I would also like each banner to be displayed for 20 seconds as there are 3 of them. I know where to put the setInterval code as indicated by my comment but I can't seem to get it to work. Any help or suggestions are very much appreciated.
var banners1 = {
    0:
    {
        'href': 'http://www.example.com/banner1.html',
        'src': 'http://www.example.com/banner1.gif'
    },
    1:
    {
        'href': 'http://www.example.com/banner2.html',
        'src': 'http://www.example.com/banner2.gif'
    },
    2:
    {
        'href': 'http://www.example.com/banner3.html',
        'src': 'http://www.example.com/banner3.gif'
    }

}
window.addEvent('domready', function() {
        function banner1()
        {
            var banner = $('banner1');
            var banner1Link = $('banner1').getElement('a');
            var banner1Image = $('banner1').getElement('img');

            for (var keys in banners1) {
                var object = banners1[keys];
                for (var property in object) {
                    if (property == 'href') {
                        var href = object[property];
                    }
                    if (property == 'src') {
                        var src = object[property];
                    }
                }
                banner1Link.setProperty('href', href);
                banner1Image.setProperty('src', src);
                console.log(href);
                console.log(src);
                /** wait 20 seconds **/
            }
        }
        var periodical = banner1.periodical(60000);
});

A: Try this instead:
    function banner1()
    {
        var banner = $('banner1');
        var banner1Link = $('banner1').getElement('a');
        var banner1Image = $('banner1').getElement('img');

        var delay = 0;
        for (var keys in banners1) {
            var func = (function(key) { return function() {
                var object = banners1[key];
                for (var property in object) {
                    if (property == 'href') {
                        var href = object[property];
                    }
                    if (property == 'src') {
                        var src = object[property];
                    }
                }
                banner1Link.setProperty('href', href);
                banner1Image.setProperty('src', src);
                console.log(href);
                console.log(src);
            }; })(keys);

            setTimeout(func, delay);
            delay += 20000;
        }
    }

JavaScript does not have a sleep-style function, because the document will not respond while JavaScript is running.  This means the user would not be able to interact with the page while the script is sleeping.
This approach schedules all three updates in one shot.  They will execute at 0 seconds (immediately), 20 seconds, and 40 seconds from the time the script runs.

A: you could use the javascript timeout
 setTimeout('', 20000);

This would be added right after the 20 sec comment. The first variable is any code/function you want called. and the second is the amount of time required before it is called in milliseconds (20 secs).

EDITED ANSWER

This does cycle through all three in 60 secs at a 20 sec interval. and can be viewed at http://jsfiddle.net/jawilliams346614/wAKGp/ (it is set to a 1 sec interval)


text:
Q: Laravel Auth session timeout I have seen several questions in this area and so far all replies seem to focus on detecting expiration on the next User action.
Regardless of being able to do this, what I want is to have the server side code detect the expiration and then force a refresh of the User screen. Conceptually, the process is something like this:

*

*Expiration detected on the server side

*Optionally, a message is sent to the User asking if they wish to continue. If no response, force the logoff process and advise the user accordingly. If User confirms they want to remain in session, then simulate some activity to reset the expiration time. If no message is sent, simply force a new screen.

In my case, I use Auth to login and grant administration rights to the user.  This includes access to maintenance forms / buttons.
Basically what I do NOT want is a screen left as it was pre-expiration suggesting that the User is a) still logged on and b) showing details of what they were doing at the time. If the User has special rights, they should not remain visible after expiration. For example, the administrator is changing a User's personal details and gets called away. Given that he/she should have terminated the process and logged out, if they failed to do this the details should not be left onscreen for some other person to see them sometime later.
The ideal would be some form of Event Listener but even then I am unsure as to how to force a screen change short of running a JS timer loop.
I would assume that I am not the only one with this type of requirement so my question is ...
How do you handle this type of requirement within the constraints of Laravel 5?

A: The default value of the session is defined under config/session.php. You can get the value by using the config helper function config('session.lifetime').
In your case you will need to check the session time on the client side (javascript.)
Here a code example to refresh the page before the session expires. This code is for the blade template.
@if (Auth::check())
    <script>
    var timeout = ({{config('session.lifetime')}} * 60000) -10 ;
    setTimeout(function(){
        window.location.reload(1);
    },  timeout);

    </script>
@endif

You can adjust the code to prompt with a dialog to confirm if the user wants to extends his session time and do an ajax to get or refresh the session time.


text:
Q: shallow copying of data type with heap objects and destruction conflict I have the following data type:
class A{
public:
    A(){
    }
    ~A(){
        for(size_t i=0; i<b_elements.size(); i++)
            delete b_elements[i];
        b_elements.clear();
    }
    vector<B*> b_elements;
    //other operations ...
};

A visitor design pattern is implemented to do some calculations on A.
The problem starts when I want to work on a subset of b_elements only and to apply the visitor on specifically those elements.
One solution would be to create another object of A with its b_elements pointing to the desired elements in the original object and calling the visitor on the newly created object. But (as you would expect) the problem is when the new object is destroyed, the destructor will delete those references which will affect the original object as a side effect.
Hint: I cannot create a copy from the original object with the desired b_elements because it is too expensive.
My question is, is this a common pattern? and what is the best practice to avoid such problem?

A: Store vector of shared pointers:
class A{
public:
    A(){
    }
    vector<std::shared_ptr<B>> b_elements;
    //other operations ...
};

A: Or a shared pointer for the vector
class A{
public:
    A(){
    }
    std::shared_ptr< std::vector<B*> > b_elements;
    //other operations ...
};

With this approach, only the vector will be destroyed at the end, and not it's elements.


text:
Q: How to show that a integrable function is finite a.e.? I want to show that an integrable function is finite a.e.
Then I have to show that if
$$\int fd\mu<\infty \implies \mu(\{x\mid |f(x)|=\infty \})=0$$
for a measure $\mu$.
My idea is:
$$\{x\mid |f(x)|=\infty \}=\bigcap_{k\in\mathbb N}\{x\mid |f(x)|\geq k\}$$
Moreover, there exist a sequence a simple function $\{\varphi_n\}_{n\in\mathbb N}$ with $\varphi_n>0$ for all $n$ such that $\varphi_n(x)\nearrow |f(x)|$ for almost every $x$. Therefore
$$\{x\mid \varphi_n(x)\geq k\}\nearrow \{x\mid |f(x)|\geq k \}$$
and thus
$$\{x\mid |f(x)|\geq k\}=\bigcup_{n=k}^\infty \{x\mid \varphi_n(x)\geq k\}.$$
Finally, we get
$$\{x\mid |f(x)|=\infty \}=\bigcap_{k\in\mathbb N}\bigcup_{n=k}^\infty \{x\mid \varphi_n(x)\geq k\}.$$
Now I want to use Borel-Cantelli, but how to prove that $$\sum_{n=0}^\infty \mu(A_n)<\infty$$
where $A_n=\{x\mid \varphi_n(x)\geq k\}$ ?

A: By definition an integrable function has finite absolute integral, i.e. if $f\in L^1(X,\Sigma, \mu)$ then
$$\int_X |f|\,d\mu<\infty$$
however, if $B\in\Sigma$ is the set for which $|f|=\infty$, we have by monotonicity that
$$\infty\cdot\mu(B)=\int_B |f|<\int_X |f|$$
hence, unless $\mu(B)=0$ we have a contradiction to absolute integrability of $f$.
If you're not comfortable with instantiation of infinity, you can see that
$$f_n\cdot 1_B\equiv n\nearrow f\cdot 1_b$$ is a monotone sequence of integrable functions converging up to $f$ on $B$. If you still have the issue that $\mu(B)=\infty$ might be an issue, then cut down to a finite, postive measure subset and again use monotonicity. That is to say you can say there is a positive, finite measure subset of $B$, $B'$ on which $f=\infty$ and then
$$f_n\cdot 1_{B'}\nearrow f\cdot 1_{B'}$$
so that
$$\lim_{n\to\infty} \int_{B'} f_n\,d\mu=n\cdot \mu(B')\stackrel{n\to\infty}{\longrightarrow}\infty =\int_{B'}|f|\,d\mu<\int_X |f|\,d\mu$$


text:
Q: SwiftUI custom tab bar: how to switch views when user drags finger across tab bar buttons? I have developed a custom tab bar (ready to paste playground source), but now, in addition to user tapping the buttons to switch views, I would like to be able to swipe finger over the tab bar, and have views activated as I'm dragging over the tab bar buttons.
I tried listening on DragGesture(minimumDistance: 0) on individual buttons.
This helps in activating the view on touch down instead of touch up (which is how default Button works), but will only activate the button where user started dragging.
I assume I would somehow need to add .simultaneousGesture(DragGesture(minimumDistance: 0) to the whole tab bar, and I could then probably interpret the touch coordinates against individual button hit tests.
However, this doesn't feel like the SwiftUI way - is there an easier way to let the SwiftUI do the heavy lifting?
(Please note - in playground, I now get AttributeGraph: cycle detected through attribute 2584 notices, and the actual selection lags one tap behind the last tapped button for some reason, but it works okay in Xcode project.)

A: I don't know if it's a best solution, but I:

*

*Saved a frame in global coordinates in each button

*Used DragGesture(minimumDistance: 0, coordinateSpace: .global) on a tab bar, to manually hit test each button

*And disabled hit testing on individual buttons with .allowsHitTesting(false), otherwise they would 'steal' the gesture.
Here's a diff of changes


text:
Q: Simulating Windows UI Desktop Start button feature Greetings and salutation,
"just use Windows" is not the answer I am looking for, as I just decided to leave Windows for good and finally use Linux again. I use Ubuntu Studio, currently Groovy Guerrilla, and the windows manager is xfce. slightly geeky, but fast and clean, and I want to user the standard
My question is rather simple, yet I thought I would ask in openly, as the result might just be very useful for many.
Microsoft Windows has hung plenty of useful features on the Windows Key, a modifier key. My question thus relates what I now call the "start" modifier or start button.
I have manage to simulate some of the useful feature I use every day at work, but can for the life of me not figure out how to the windows(application) management the same way.

How do I jump application windows from one screen to another using only the keyboard start and arrow buttons?

For the hardcore Ubuntu users:

Windows allow you to move, snap and hide  any application using this feature. The logic is if a window is tiled, the left/right arrow will snap it to half the current screen, the next arrow in the same direction, jumps to the next screen, if any. The up arrow maximize the app window, and down tiles it again, another down minimizes it to the task-bar.

What I have managed to do so far is to use xfce4-keyboard-settings and xfwm4-settings to setup some of the start+ (1,2,3...,E,D,P,S,L,left,right) functions, the jump feature however, is a conditional function binding, making it impossible to configure in these tools, or am I missing something.

A: This is currently a pending Xfce feature that hasn't been implemented yet, but these tools below provide a workaround for the time being.
https://github.com/jc00ke/move-to-next-monitor
http://ssokolow.com/quicktile/


text:
Q: Can I import and save each event in a public google calendar to my asp.net mvc database? I'm working in asp.net mvc, and am trying to display all events from any public google calendar in the fullCalendar I've built for my application. Currently, I'm displaying a users events that are saved in the database under an Events model, as well as in that users list of events. I have a button on the view displaying their calendar that says "Sync My Google Calendar". What I want to do is have them input their Calendar ID to pass into a SyncGoogleCalendar() method. From there I'll save each event to the databases. Then I can display all events from their google calendar, as well as all the events they created in my application on one calendar.
Would this be possible? I know fullCalendar has a way to display the events in the calendar but that hasn't been working so far....I'll keep playing with it until I get any suggestions, but thanks in advance for anyone willing to comment!


text:
Q: What is Google source for United States topographic data? I'm looking for as detailed as possible topographic data for a certain area and have found information displayed by Google Maps to be far more detailed than what is provided by 7.5 minute maps (from USGS).
Does anyone know the source of Google's topography data?
Specifically, I'm looking for data on the Los Angeles area.

A: In the US, it appears that Google is using LiDAR data where it is available. I ran some tests in two areas.  One where I had actual LiDAR data, the other where I had field survey data.  Google Elevation data was amazingly accurate.
You can read more on my blog - https://chasmtech.wordpress.com/2017/01/17/civil-site-design-satellite-to-surface-feature-is-amazingly-accurate/

A: There is more than one source depending on the area of interest around the globe.

Google Maps is the terrain layer, which provides a shaded relief (aka
  hillshade) view of the topography derived from a digital elevation
  model.  Google has done a nice job generating a visually pleasing
  terrain layer, and we use it for all of our Google Maps-based
  interfaces in OpenTopography.  Google appears to use a range of
  digital elevation model data sources to derive the terrain layer.
  Throughout the US, it appears that the terrain layer comes from either
  10 or 30 m (1/3 arc-second & 1 arc-second respectively) DEMs from the
  USGS National Elevation Dataset (NED).  Globally the terrain data
  appear to be derived from either Shuttle Radar Topography Mission
  (SRTM) data or something like the NOAA Global Land One-km Base
  Elevation Project (GLOBE) dataset.  Recently however, I've begun to
  notice higher resolution data in the Google Maps terrain layer.  These
  higher-resolution data are localized, and are patched into the terrain
  layer among the standard 10 and 30 m derived images, but they are
  impressive when you find them.  Based on the location of these patches
  of high-resolution terrain, and their appearance, it is pretty easy to
  deduce that Google is now incorporating bare earth LiDAR digital
  elevation models into the Google Maps terrain layer.
Thus far, I've noticed high-resolution data in downtown Portland, OR,
  the greater Los Angeles area, and Mount Saint Helens in Washington.
  There may be other examples of LiDAR-derived terrain

Source:
http://www.opentopography.org/blog/lidar-beginning-appear-google-maps-terrain-layer


text:
Q: Cross domain issue for Express js and Angular Js I have a node.js rest api built with Express framework version 4.11.1 and hosted in a server 'abc.com:5142'. Also have a front end website built with cg-angular which is hosted on the same domain but a different port 'abc.com:7070'.
When I access the front end causes a cross domain issue. I have tried almost all solutions including cors npm package. But it is not working.
Any help would be appreciated.
Thanks

A: Try this (keep the order):
var expr = require('express');
var app = expr.express();
var cors = require('cors');
app.use(cors());


text:
Q: What is the time complexity of this prime factors algorithm What would be the complexity of this program for finding prime factors of a number. And what are the ways to improve it (Considering only time complexity and not coding standards or space complexity).
Thanks and regards.
See source code :

function primes(n) {
  let primeNumbers = [2];

  if (n < 2) {
    return [];
  } else if (n == 2) {
    return [2];
  }

  for (let i = 3; i <= n; i++) {
    let x = i;
    let j = 0;
    let isPrime = true;
    while (j < primeNumbers.length && primeNumbers[j] <= Math.sqrt(i)) {
      if (x % primeNumbers[j] == 0) {
        isPrime = false;
        break;
      } else {
        j++;
      }
    }
    if (isPrime) {
      primeNumbers.push(x);
    } else {}
  }

  return primeNumbers;
}

function primeFactors(n) {
  let primeNumbers = primes(Math.sqrt(n));
  let i = 0;
  let x = n;

  if (n == 1) {
    return [1];
  }

  if (n == 2) {
    return [2];
  }

  let primeFactors = [];

  while (i < primeNumbers.length) {

    while (x % primeNumbers[i] == 0) {
      primeFactors.push(primeNumbers[i])
      x = x / primeNumbers[i];
      if (x == 1) {
        break;
      }
    }

    if (x == 1) {
      break;
    }

    i++;
  }

  if (x == 1) {} else if (x > 2) {
    primeFactors.push(x);
  }

  return primeFactors;
}

console.log("test : " + primes(122));

A: This is a slight improvement on the Sieve of Eratosthenes where you terminate the algorithm at step i = sqrt(n). Assuming each step takes constant time, the runtime is O(sqrt(n)).
A better algorithm is the randomized primality algorithm which takes O(log n).
http://www.cs.ust.hk/mjg_lib/Classes/COMP3711H_Fall14/lectures/Randomized_Primality_Handout.pdf


text:
Q: How can I fire a function in a click(function)? I have a javascript file which I want to start when a div has been clicked.
I have already this when clicking the div "option_one", an input will be set to "Option 1":
$("#option_one").click(function() {
$("#input").val('Option 1');
});

How can I fire another js file after clicking the div?
I try something with getScript but I couldn't get it working.
Kind regards,
Arie

A: There is no need to load the calculate.js file on the click event. Just load it with the page load like so:
HTML:
<!--Your page HTML here... -->

<!--Before your closing body tag-->
<script type="text/javascript" src="somefile.js"></script>
<script type="text/javascript" src="calculate.js"></script>

JS:
// This is inside somefile.js
$("#option_one").click(function() {

    $("#input").val('Option 1');

    // This function is inside calculate.js
    calculate();

});

A: $("#option_one").click(function() {
    $("#input").val('Option 1');

    $.getScript( "path/calculating.js" )
    .done(function( script, textStatus ) {
        //Just after the scripts finishes loading you will be able
        //to perform/use functionality included on this script
        console.log( textStatus );
    })
    .fail(function( jqxhr, settings, exception ) {
        console.log("Triggered ajaxError handler.");
    });
});


text:
Q: How to avoid lost focus of TextBox when click a button in wpf?
Now the cursor is focusing in the TextBox. If i click on the the Button (RemoveLostFocus),The TextBox's Lost focus event get fired. But What i need is , Lost Focus event of TextBox should not fire. is there any way to do so ?.
private void Window_Loaded(object sender, RoutedEventArgs e)
    {
        txtUserName.Focus();
    }

private void UserName_LostFocus(object sender, RoutedEventArgs e)
    {
        if (txtUserName.Text.Length < 1)
        {
            MessageBox.Show("UserName should not be empty");
        }
    }

    private void btnCancel_Click(object sender, RoutedEventArgs e)
    {
        this.Close();
                    anotherWindow.Show();
    }

A: You will want to use the FocusManager attached properties to apply the focus to the TextBox when the Button focus changes
Example:
<StackPanel>
    <TextBox Name="txtbx" />
    <Button Content="Click Me!" FocusManager.FocusedElement="{Binding ElementName=txtbx}"/>
</StackPanel>

With this solution the The TextBox will always be focused even when the Button is pressed and the TextBox LostFocus event will not be fired

A: you could Set Focusable="False" on the Button. here is a link of the answer enter link description here

A: Set Focusable Property
<Button Focusable="False" />

A: In the Click-Event of you Button you can do something like
this.textBox.Focus();

If your lostfocus-method looks like this:
private void UserName_LostFocus(object sender, RoutedEventArgs e){ ... }

you can prevent the lostfocus with the following code:
this.textBox.LostFocus -= UserName_LostFocus;


text:
Q: Impliment a changeStream with aggregation pipeline I'm trying to hack around a MongoDB driver that doesn't yet implement changeStreams by using an aggregation pipeline which it looks like I can do according to this document.
If I just want every change made to a collection, what do I put as the Value to "$changeStream"?


text:
Q: is there a way to make JQuery animation functions blocking JQuery animation functions are non-blocking, but i'm looking for a way to make them blocking. For example i want something like this:
$("#btn").fadeOut(1000);
console.log("fadeOut() Completed..");

One solution I have found in other answers is to use callbacks, so this can be achieved using a callback function like this:
$("#btn").fadeOut(1000, function () {
    console.log("fadeOut() Completed..");
});

But i'm looking for a different solution (if possible) to make the call to fadeOut function blocking, i.e, when i call fadeOut(1000), the next line of code should not be executed until the fadeOut function is completed.

A: No, you can't make the animation functions blocking.
You can use the callback method you've discovered.
If you're in an environment where you can use async functions, it's not awfully hard to promisify the callback, and then do something like await fadeOutP("#btn", 1000):
function fadeOutP(selector, time) {
  return new Promise(resolve => $(selector).fadeOut(time, resolve));
}
// buttons fade out in sequence:
async function thing() {
  await fadeOutP("#btn1", 1000);
  await fadeOutP("#btn2", 1000);
  await fadeOutP("#btn3", 1000);
}

A: You can use method promise().

The .promise() method returns a dynamically generated Promise that is resolved once all actions of a certain type bound to the collection, queued or not, have ended.

Read more.

$("#btn").fadeOut(1000);
$("#btn").promise().done(function () {
      console.log("fadeOut() Completed..");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<button id="btn">button</button>


text:
Q: OLAP Cube design issue for Telecommunication Data Background: I'm doing analysis of call detail record (CDR) data in order to segmentify customer with respect to their call duration, time of call (holiday call or non holiday call, Business call or non Business call), age group of subscriber and gender. Data is from two table name cdr (include card_number, service_key, calling, called, start_time, clear_time, duration column) and subscriber_detail (include subscriber_name, subscriber_address, DOB, gender column)
I have design OLAP as given below.

Call_date includes Date of call with year, month, and day. Call_time is time of call happen in second.
Question:- if we take call_time in second then it has 86400 column for each day (may be curse of dimensionality) and so we think to reduce its dimensional by taking 30 second time pulse ( telecom charges money on the basic of the pulse and 30 is pulse duration for our context). First Question is :- Is it the best way to replace time by pulse duration? And second is :- if one subscriber do more than 2 call on range of pulse it may cause problem i.e. first call start at 21:01:00 and end at 21:01:05 and he start second call at 21:01:15 and end at 21:01:20. How to resolve these type of problem.

A: If I were you I would divide the time in 10 minute slot and use link list to store multiple duration time within given time slot so total dimension of time is 144 (Which restrict roll down upto 10 minutes only).

A: I would keep start_call_time, end_call_time and ellapsed_call_time in seconds.
Then having ellapsed_time does not mean the cube would have a dimension of 86400 members; you could setup a 'ranged/banded' dimension : i.e., a dimension that is built using intervals instead of instants. This is something possible for example with icCube (www).


text:
Q: Trying to store values received in a ViewController and store them in a single instance of an NSMutableArray in another View Controller in iOS I have an application where A View Controller (A)is called twice in close succession.  Now each time it is called, an NSString object is created, and I need this value to be stored in an NSMutableArray that is a public property of ANOTHER View Controller (B).
In A, I create an instance of the second View Controller (B), and using that instance, add the NSString objects into the NSMutableArray which I've created as a public property.  Later, when I am inside View Controller B and print the contents of the NSMutableArray property, the array is empty.  Why?  Here is the code that is inside View Controller A:
-(void)viewDidLoad {

    ViewControllerA *aVC = [[ViewControllerA alloc] init];
    if (aVC.stringArray == nil) {
        aVC.stringArray = [[NSMutableArray alloc] init];
    }

    [aVC.stringArray addObject:@"hello"];
    [aVC.stringArray addObject:@"world"];

    for (NSString *wow in aVC.stringArray) {
        NSLog(@"The output is: %@", wow);
    }

}

Inside my View Controller B class, I have the following code:
- (IBAction)buttonAction:(UIButton *)sender {

        NSLog(@"Button selected");
        for (NSString *test in self.stringArray) {
            NSLog(@"Here are the contents of the array %@", test);
        }

}

Now the buttonAction method gets called, as I do see the line Button selected in the system output, but nothing else is printed.  Why?  One thing I want to ensure is that View Controller A is called twice, which means I would like to see in the output, "Hello World", "Hello World" (i.e. printed twice), and not "Hello World" printed just once.
The other thing I wish to point out is that View Controller B may not be called at all, or it may be called at a later point in time.  In any case, whenever View Controller B is called, I would like to have the values inside the array available, and waiting for the user to access.  How do I do this?

A: Your approach is not ideal, potentially leading to a memory cycle, with two objects holding strong pointers to each other.
You can instead achieve your goal in two ways;
Delegate Protocol
This method allows you to set delegates and delegate methods to pass data back and forth between view controllers
in viewControllerA.h
@protocol viewControllerADelegate <NSObject>

- (void)addStringToNSMutableArray:(NSString *)text;

@end

@interface viewControllerA : UIViewController

@property (nonatomic, weak) id <viewControllerADelegate> delegate;

in viewControllerB.m
// create viewControllerA class object
[self.viewControllerA.delegate = self];

- (void)addStringToNSMutableArray:(NSString *)text
{
    [self.mutableArray addObject:text];
}

in viewControllerA.m
[self.delegate addStringToNSMutableArray:@"some text"];

Utility Classes
Alternatively you can use a utility class with publicly accessible methods (and temporary data storage). This allows both viewController classes to access a shared data store, also if you use class methods, you don't even need to instantiate the utility class.
in XYZUtilities.h
#import <Foundation/Foundation.h>

@interface XYZUtilities : NSObject

+ (void)addStringToNSMutableArray;
@property (strong, nonatomic) NSMutableArray *array;

@end

in XYZUtilities.m
+ (void)addStringToNSMutableArray
{
    NSString *result = @"some text";
    [self.array addObject:result];
}

+ (NSArray)getArrayContents
{
    return self.array;
}

in viewControllerA.m
NSString *stringFromObject = [XYZUtilities addStringToNSMutableArray];

in viewControllerB.m
self.mutableArray = [[NSMutableArray alloc] initWithArray:[XYZUtilities getArrayContents]];

A: I'm not sure what kind of a design pattern you are trying to follow but from the looks of it IMHO that's not a very safe one. However, there are many, many ways this could be accomplished.
One thing though, you said that View Controller B may never get allocated and if it is alloc-ed, it will be down the road. So you can't set a value/property on an object that's never been created.
Since you already aren't really following traditional patterns, you could make a static NSMutableArray variable that is declared in the .m of your View Controller B Class and then expose it via class methods.
So it would look like this:
viewControllerB.h
    +(void)addStringToPublicArray:(NSString *)string;

viewContrllerB.m
   static NSMutableArray *publicStrings = nil;

    +(void)addStringToPublicArray:(NSString *)string{

            if (publicStrings == nil){
                publicStrings = [[NSMutableArray alloc]init];
            }

            if (string != nil){
               [publicStrings addObject:string];
            }
    }

Then it would be truly public. All instances of view controller B will have access to it. This, of course is not a traditional or recommended way of doing it—I'm sure that you will have many replies pointing that out ;).
Another idea would be to use a singleton class and store the values in there. Then, when or if view controller B is ever created, you can access them from there.


text:
Q: Was Gary Mitchell the First Officer on the Enterprise? In "Where No Man Has Gone Before," Star Trek's second pilot, we are introduced to Lt. Cmdr. Gary Mitchell, Captain Kirk's best friend and the Enterprise's navigator.
In that episode it is not explicitly stated that Spock is the first officer, and Spock was not the First Officer in "The Cage" (the first pilot), so perhaps Roddenberry hadn't finalized that role for Spock.
I believe in Vonda McIntyre's novel, Enterprise, Gary Mitchell is supposed to be the first officer, but is absent from most of the action in that story.
Is there any other evidence that supports this idea? Was Gary Mitchell the First Officer before Spock?

A: According to the information at Memory Beta, representing canon, Gary Mitchell was intended to be First Officer, but did not ever hold the position:
I don't know whether the role was in flux for the first two episodes or not - that would be a question for someone who was there at the time to answer.

A: According to the transcript of "Where No Man Has Gone Before" the department heads gather on the bridge:

MITCHELL: Department heads, sir. You wanted everybody on the Bridge before we left the galaxy. Jones. SMITH: The name's Smith, sir.
  SULU: Astro sciences standing by, Captain.
  SCOTT: Engineering division ready, as always.
  PIPER: Life sciences ready, sir. This is Doctor Dehner, who joined the ship at the Aldebaran colony.
  DEHNER: Psychiatry, Captain. My assignment is to study crew reaction in emergency conditions.

So Sulu (possibly the twin brother or clone brother or something of Hikaru Sulu) is the head of the astro sciences department.
But in the briefing room scene Kirk says:

KIRK: It is my duty, whether pleasant or unpleasant, to listen to the reports, observations, even speculations, on any subject that might affect the safety of this vessel, and it's my science officer's duty to see I'm provided with that. Go ahead, Mister Spock.

So Kirk clearly says Spock is the science officer aboard the Enterprise during this episode.
Spock and Mitchell are both on the bridge when the Enterprise approaches the energy barrier:

SPOCK: Force field of some kind.
  MITCHELL: We're coming up on it fast.
  SPOCK: Sensor beam on.
  KELSO: Sensor beam on, sir.
  SPOCK: Deflectors full intensity.
  KELSO: Deflectors full intensity.
  SPOCK: Deflectors say there's something there, sensors say there isn't. Density negative. Radiation negative. Energy negative.
  KELSO: Whatever it is, contact in twelve seconds.
  KIRK: Gravitation on automatic. (consoles blow up) Emergency stations. All decks on fire alert. Neutralise controls. Kelso, put it on manual. Any radiation? Anything?
  SPOCK: Negative!
  KIRK: Helmsmen, take us out of here. (Dehner gets hit by an electric charge, then Mitchell) Helmsmen! (Kirk takes controls) Lateral power! (Spock takes over, Enterprise veers away) Take damage reports.
  SPOCK: Damage control reports, all stations!
  CREWMAN [OC]: Gravity control switching to batteries.
  DEHNER: Something hit me, like an electrical charge.
  PIPER: He's alive. Appears to be in shock.
  CREWMAN [OC]: Engineering deck three, can you give damage report?
  CREWMAN 2 [OC]: Sensor beams. Full power on the deflectors.
  SPOCK: Main engines are out, sir. We're on emergency power cells. Casualties, nine dead.
  CREWMAN [OC]: Gravity is down to point eight.
  CREWMAN 2 [OC]: All decks, this is Bridge Engineering. Due to emergency conditions.

Much of what Spock says could be doing his duty as science officer.
But he does give orders to Kelso:

SPOCK: Sensor beam on.
  KELSO: Sensor beam on, sir.
  SPOCK: Deflectors full intensity.
  KELSO: Deflectors full intensity.

And a little later:

KIRK: Helmsmen, take us out of here. (Dehner gets hit by an electric charge, then Mitchell) Helmsmen! (Kirk takes controls) Lateral power! (Spock takes over, Enterprise veers away) Take damage reports.
  SPOCK: Damage control reports, all stations!

http://www.chakoteya.net/StarTrek/2.htm1
Calling or damage reports is something that the first officer would normally do, but Kirk has just requested damage reports and Mitchell has just been incapacitated.
My interpretation of that scene is either Spock is first officer and second in command all through he scene, or else Mitchell is first officer and second in command but is too busy with steering the ship as helmsman to do first officer stuff and then is knocked out.
I think that it is a little inefficient to have the first officer steer the ship instead of doing first officer stuff to assist the captain to command.  In the first season of TNG the steering role was often assigned to either a blind lieutenant junior grade or to a fifteen year old acting ensign, not to Commander Riker.  In modern merchant marines and navies the helmsman is usually an enlisted sailor.
So I believe that Spock was probably the first officer and second in command in "Where No Man Has Gone Before".

A: Roddenberry has stated many times that Spock was the first officer in the second pilot.  In fact it was the most important change he made, because the biggest complaint from the first pilot was that a woman (Majel Barret) wasn't believable as first officer.  (The studio didn't especially like Spock either, but Roddenberry ignored that critique; though it may explain why he didn't immediately emphasize Spock's position as 1st officer).
In Vonda McIntyre's novel Enterprise: The First Adventure, she addressed this issue specifically.
Christopher Pike was offered a promotion, and to accept it he would have to relinquish command of The Enterprise.
Kirk was promoted to Captain, to relieve Pike.
Kirk fully intended to have his best friend, Gary Mitchell be the First Officer.   HOWEVER, unbeknownst to Kirk, Pike had accepted his promotion conditionally: the condition was that Spock would be made First Officer of The Enterprise.  Starfleet agreed and overruled Kirk.  Kirk & Mitchell would have had to take a different (lesser) ship to avoid this condition.  Both (Kirk especially) had their hearts set on the Enterprise.  They decided to take the Enterprise with Mitchell as helmsman and play it by ear, not fully giving up on the idea that Mitchell would one day be first officer.
This backstory fits the attitudes & interactions between Kirk, Spock and Mitchell in Where No Man Has Gone Before extremely well.  So well, that it feels like canon to me, in other words, that Roddenberry may have had something like this in mind when he wrote the script.
I can say this as a fan who loves and knows TOS and for the most part don't have a lot of respect or time for the novels.  INCLUDING the book I'm referring to; except this exact aspect of it, the book wasn't very good or true to the characters.  Which further leads me to believe it was an idea that existed before Vonda.

A: In Episode 6 of the first season, The Enemy Within, Spock makes a log entry and refers to himself as Second officer Spock.

Captain's Log, stardate 1673.1. Entry made by Second Officer Spock.
  Captain Kirk retains command of this vessel, but his force of will
  rapidly fading. Condition of landing party critical. Transporter unit
  still under repair.

A: In the audiobook of "I Am Spock by Leonard Nimoy (I recently listened to), Nimoy mentions that the first scene in Where No Man Has Gone Before shows Kirk playing three dimensional chess with his (and he uses these words) "second in command" - Spock.

A: I read a very good article once which argued that the first episodes represent kirk "shaking down" his new crew; that he made spock first officer BECAUSE of his cold blooded prioritization of the safety of the ship (maroon gary mitchell!). Also mccoy clearly has just come on board for the salt monster episode, and uhura came on at kirks request from the lexington. Also sulu is fading from sciences (penny talk in where no man) to helm in naked time (the biology references)


text:
Q: Execute a shell command from react native app for mac os I am trying to build a mac os application based on react native(https://github.com/ptmt/react-native-macos) that execute a shell script and show output on the app. I wanted to start by running a simple ls command.
Documentation - https://nodejs.org/api/child_process.html#child_process_spawning_bat_and_cmd_files_on_windows
Following is my code
import React from 'react';
import {
  Button,
  SafeAreaView,
  ScrollView,
  StatusBar,
  StyleSheet,
  Text,
  View,
} from 'react-native';
import {Colors} from 'react-native/Libraries/NewAppScreen';
const {spawn} = require('child_process');

class App extends React.Component {
  super;
  constructor(props) {
    super(props);
    this.state = {
      textValue: 'Change me',
    };
  }

  onPress = () => {
    const ls = spawn('ls', ['-lh', '/usr']);
    ls.stdout.on('data', data => {
      console.log(`stdout: ${data}`);
      this.setState({
        textValue: data,
      });
    });
  };

  render() {
    return (
      <>
        <StatusBar barStyle="dark-content" />
        <SafeAreaView>
          <ScrollView
            contentInsetAdjustmentBehavior="automatic"
            style={styles.scrollView}>
            <View style={{paddingTop: 25}}>
              <Text>{this.state.textValue}</Text>
              <Button title="Change Text" onPress={this.onPress} />
            </View>
          </ScrollView>
        </SafeAreaView>
      </>
    );
  }
}

const styles = StyleSheet.create({
  scrollView: {
    backgroundColor: Colors.lighter,
  },
  body: {
    backgroundColor: Colors.white,
  },
});

export default App;

But is throwing below error.
error: Error: Unable to resolve module child_process from /Users/Ramu/apps/PdfTools/App.js: child_process could not be found within the project.

If you are sure the module exists, try these steps:
 1. Clear watchman watches: watchman watch-del-all
 2. Delete node_modules and run yarn install
 3. Reset Metro's cache: yarn start --reset-cache
 4. Remove the cache: rm -rf /tmp/metro-*
  10 | } from 'react-native';
  11 | import {Colors} from 'react-native/Libraries/NewAppScreen';
> 12 | const {spawn} = require('child_process');
     |                          ^

I hope child_process should be part of react native bundle. Could some body please help on how to fix it.

A: This seems to be an old post, but I'll add an answer incase others read. It seems that the child_process nodejs module doesn't work with React Native. There is however a React specific child process package: https://www.npmjs.com/package/react-native-childprocess


text:
Q: How to use the lookup plugin to get the directory path and file in Ansible I have a two playbooks where one creates SSH Keys and the other one creates a new user and deploys the public ssh key for the new user created.
My issue is I created a task that create a new directory with a timestamp to store the relevant data, I was able to get the path to a variable where I added it as a dummy host so that I can be able to call that path with all my plays but it seems like I am unable to use the same variable in lookup so that I can be able to deploy the ssh key. Kindly assist, below are the relevant tasks.
# Create the directory with timestamp
- name: Create Directory with timestamp to store data that was run multiple times that day
  when: inventory_hostname in groups['local']
  file:
    path: "{{store_files_path}}/{{ansible_date_time.date}}/{{ansible_date_time.time}}"
    state: directory
    mode: "0755"
  register: dir_path

# Add the directory path to dummy host called save so that I can call it from other plays
- name: Add dir path:"{{dir_path.path}}" as a 'save' host
  when: inventory_hostname in groups['local']
  add_host:
    name: "save"
    dir: "{{dir_path.path}}"

# Deploying SSH Key I tried this -->
- name: Deploy Public Key to the server
  when: inventory_hostname in groups['Servers']
  authorized_key:
    user: "{{hostvars['new-user']['user']}}"
    state: present
    key: "{{dir_path.path}}/SSH-Key.pub"

# ...this -->
- name: Deploy Public Key to the server
  when: inventory_hostname in groups['Servers']
  authorized_key:
    user: "{{hostvars['new-user']['user']}}"
    state: present
    key: "{{ lookup('file','{{dir_path.path}}/SSH-Key.pub') }}"

# .... and this -->
- name: Deploy Public Key to the server
  when: inventory_hostname in groups['Servers']
  authorized_key:
    user: "{{hostvars['new-user']['user']}}"
    state: present
    key: "{{ lookup('file','{{hostvars['save']['dir']}}/SSH-Key.pub') }}"

None of them worked, what am I doing wrong?

A: If you put a Jinja expression into a string in a Jinja expression, then you indeed end up with a your variable not being interpreted.
A basic example of this is:
- hosts: all
  gather_facts: no

  tasks:
    - debug:
        msg: "{{ '{{ foo }}' }}"
      vars:
        foo: bar

Which gives:
ok: [localhost] => {
    "msg": "{{ foo }}"
}

When
- hosts: all
  gather_facts: no

  tasks:
    - debug:
        msg: "{{ foo }}"
      vars:
        foo: bar

Gives thes expected:
ok: [localhost] => {
    "msg": "bar"
}

So in order to achieve what you want here, you should use the concatenation operator of Jinja: ~, in order to let Jinja interpret your variable and concatenate it with the rest of your "hardcoded" string.
Effectively ending with the instruction:
key: "{{ lookup('file', hostvars['save']['dir'] ~ '/SSH-Key.pub') }}"


text:
Q: Schedule apex class to run every year I need the apex class to be scheduled at 1st January 12:00 AM every year how to achieve it?
global class autoCreateIS implements Schedulable {

    global void execute(SchedulableContext arc) {
        autoCreateIS schedule =new autoCreateIS();
        String sch = '0 0 0 1 1 ?';
        System.schedule('autoCreateISsched',sch, schedule);
        Date dateToday = system.Today();
        Integer year = dateToday.year();
        Integer nextYear = (year + 1);
        IS__c createIS = new IS__c();
        createIS.Name = String.valueOf(nextYear);
        insert createIS;
     }
}

A: Your job does not need to reschedule itself, just schedule it to run annually from an execute anonymous script. You can take out the System.schedule logic. You can call the schedule logic directly in execute anonymous.
    autoCreateIS schedule =new autoCreateIS();
    String sch = '0 0 0 1 1 ?';
    System.schedule('autoCreateISsched',sch, schedule);

A: You can user below cron expression to schedule the batch every year

0 0 0 1 1 ? *

it means
0 Seconds 0 Minutes 0 Hours 1 Day_of_month 1 Month Any Day_of_week Any optional_year
autoCreateIS p = new autoCreateIS();
String sch = '0 0 0 1 1 ? *';
system.schedule('Name for Job', sch, p);


text:
Q: Compartir archivo mp4 generado por mi app a redes sociales. share intent Necesito compartir mi archivo de video mp4 generado por mi app, el cual adquiere nombre con un (System.currentTimeMillis /1000). la acción compartir debe escoger ese ultimo archivo generado para compartirlo en redes sociales.
Dejo el método initRecorder el cual genera el archivo mp4 y el metodo compartir actual.
private final String MAIN_FOLDER = "DCApp/";

private final String RUTA_VIDEO = MAIN_FOLDER + "DCvideos";

private void initRecorder(){

        String videoName = "DC_" + (System.currentTimeMillis() / 1000) + ".mp4";
        File fileVideo = new File(Environment.getExternalStorageDirectory(), VIDEO_RUTE);

        try{

            mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
            mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.SURFACE);
            mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
            mMediaRecorder.setOutputFile(fileVideo + videoName);
            mMediaRecorder.setVideoSize(DISPLAY_WIDTH, DISPLAY_HEIGHT);
            mMediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
            mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
            mMediaRecorder.setVideoEncodingBitRate(512 * 1000);
            mMediaRecorder.setVideoFrameRate(30);
            int rotation = getWindowManager().getDefaultDisplay().getRotation();
            int orientation = ORIENTATIONS.get(rotation + 90);
            mMediaRecorder.setOrientationHint(orientation);
            mMediaRecorder.prepare();

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

    }

Método compartir:
 private void share() {

    Intent share = new Intent(android.content.Intent.ACTION_SEND);
    share.putExtra(Intent.ACTION_PICK, MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
    share.setType("video/");
    startActivity(Intent.createChooser(share, "share via:"));
}

A: Teniendo en cuenta lo comentado y lo que me consultaste, mas algo de documentación oficial leída, tomaría el siguiente camino:
private void share(String videoName ) {

        Intent share = new Intent(android.content.Intent.ACTION_SEND);
        share.setType("video/mp4"); // Configuras el tipo de archivo

        // Tomas el archivo desde la ruta de guardado, para que no haya error
        File fileToShare = new File(RUTA_VIDEO + videoName );
        Uri uri = Uri.fromFile(fileToShare);

        //Agregas la uri del video que deseas enviar, esto se puede usar para cualquier archivo.
        share.putExtra(Intent.EXTRA_STREAM, uri);
        startActivity(Intent.createChooser(share, "Compartilo!"));
}

Deberias enviar el nombre de archivo como parametro.


text:
Q: What can I use to make an ROC Curve in WPF? I want to make a graph of several ROC curves in WPF.  I've found the WPF Toolkit, but I don't see an out-of-the box solution for what I want, just several basic graphing types.  Is it possible to build an ROC curve (preferably, an ROC convex hull curve) in the WPF Toolkit?  Once it's built, is there an easy way to get the AUC? Or is there an off-the-shelf solution I can just use?
Basically, I want a graph that looks like these graphs, but nicer and scaling with resolution.

A: It seems to me that you'll need to learn using WPF PathGeometries. I haven't used them much, but from what I learned, I think it's possible to do the ROC curves.
If you want scaling, resolution, zooming. I think you'll be better of getting something that is already done like Telerik, Infragistics, DevExpress or ZedGraph. Otherwise you're likely to spend a lot of time implementing it yourself.

A: I used ZedGraph to create nice ROC curves, even with the color scales at the side.
It is not so hard to do, you just need to use ZedGraph's custom LineObj objects.
Here's example of using ...Obj objects in ZedGraph (you can add LineObj to the chart just as it is done with TextObj or ArrowObj there).

A: I went with the visifire controls, and then added in a first series for the points and a second series for the convex hull.


text:
Q: Bad Request 400 - Freeswitch CLI Oiriginate Connect two Clients Im Trying to use Freeswitch CLI to trigger a call between to SIP Clients:
 originate sofia/internal/5003%192.168.2.180 &bridge(sofia/internal/linphone%192.168.2.180)

It always calls the first client and the second call fails. Making Calls between the Clients works perfectly. Its all a internal setup only.
Any suggestions on what it could be?
siptrace:
    freeswitch@freeswitch-vm> originate sofia/internal/5003%192.168.2.180 &bridge(sofia/internal/linphone%192.168.2.180)
+OK d6f539ec-e763-4c0e-8864-fbc53eab8b93

2019-06-21 05:12:33.931678 [DEBUG] switch_ivr_originate.c:2136 Parsing global variables
2019-06-21 05:12:33.931678 [NOTICE] switch_channel.c:1104 New Channel sofia/internal/5003 [d6f539ec-e763-4c0e-8864-fbc53eab8b93]
2019-06-21 05:12:33.931678 [DEBUG] mod_sofia.c:4753 (sofia/internal/5003) State Change CS_NEW -> CS_INIT
2019-06-21 05:12:33.931678 [DEBUG] switch_core_state_machine.c:543 (sofia/internal/5003) Running State Change CS_INIT
2019-06-21 05:12:33.931678 [DEBUG] switch_core_state_machine.c:586 (sofia/internal/5003) State INIT
2019-06-21 05:12:33.931678 [DEBUG] mod_sofia.c:90 sofia/internal/5003 SOFIA INIT
2019-06-21 05:12:33.950925 [DEBUG] sofia_glue.c:1276 sofia/internal/5003 sending invite version: 1.6.10 -17-726448d 64bit
Local SDP:
v=0
o=FreeSWITCH 1561079777 1561079778 IN IP4 192.168.2.180
s=FreeSWITCH
c=IN IP4 192.168.2.180
t=0 0
m=audio 32176 RTP/AVP 102 9 0 8 104 101
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:104 telephone-event/48000
a=fmtp:104 0-16
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
m=video 19038 RTP/AVP 103
b=AS:1024
a=rtpmap:103 VP8/90000
a=rtcp-fb:103 ccm fir
a=rtcp-fb:103 ccm tmmbr
a=rtcp-fb:103 nack
a=rtcp-fb:103 nack pli

2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:40 sofia/internal/5003 Standard INIT
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:48 (sofia/internal/5003) State Change CS_INIT -> CS_ROUTING
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:586 (sofia/internal/5003) State INIT going to sleep
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:543 (sofia/internal/5003) Running State Change CS_ROUTING
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:602 (sofia/internal/5003) State ROUTING
2019-06-21 05:12:33.950925 [DEBUG] mod_sofia.c:143 sofia/internal/5003 SOFIA ROUTING
2019-06-21 05:12:33.950925 [DEBUG] switch_ivr_originate.c:67 (sofia/internal/5003) State Change CS_ROUTING -> CS_CONSUME_MEDIA
send 1556 bytes to udp/[192.168.2.181]:5060 at 05:12:33.952162:
   ------------------------------------------------------------------------
   INVITE sip:5003@192.168.2.181:5060;ob SIP/2.0
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKjD1mZ9cZ8gDtB
   Max-Forwards: 70
   From: "" <sip:0000000000@192.168.2.180>;tag=tc5B4j279yjSD
   To: <sip:5003@192.168.2.181:5060;ob>
   Call-ID: ed928166-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002184 INVITE
   Contact: <sip:mod_sofia@192.168.2.180:5060>
   User-Agent: FreeSWITCH-mod_sofia/1.6.10-17-726448d~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 625
   X-FS-Support: update_display,send_info
   Remote-Party-ID: <sip:0000000000@192.168.2.180>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1561079777 1561079778 IN IP4 192.168.2.180
   s=FreeSWITCH
   c=IN IP4 192.168.2.180
   t=0 0
   m=audio 32176 RTP/AVP 102 9 0 8 104 101
   a=rtpmap:102 opus/48000/2
   a=fmtp:102 useinbandfec=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=10; maxptime=40
   a=rtpmap:9 G722/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:8 PCMA/8000
   a=rtpmap:104 telephone-event/48000
   a=fmtp:104 0-16
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   m=video 19038 RTP/AVP 103
   b=AS:1024
   a=rtpmap:103 VP8/90000
   a=rtcp-fb:103 ccm fir
   a=rtcp-fb:103 ccm tmmbr
   a=rtcp-fb:103 nack
   a=rtcp-fb:103 nack pli
   ------------------------------------------------------------------------
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:602 (sofia/internal/5003) State ROUTING going to sleep
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:543 (sofia/internal/5003) Running State Change CS_CONSUME_MEDIA
2019-06-21 05:12:33.950925 [DEBUG] sofia.c:6962 Channel sofia/internal/5003 entering state [calling][0]
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:621 (sofia/internal/5003) State CONSUME_MEDIA
2019-06-21 05:12:33.950925 [DEBUG] switch_core_state_machine.c:621 (sofia/internal/5003) State CONSUME_MEDIA going to sleep
recv 298 bytes from udp/[192.168.2.181]:5060 at 05:12:33.966566:
   ------------------------------------------------------------------------
   SIP/2.0 100 Trying
   Via: SIP/2.0/UDP 192.168.2.180;rport=5060;received=192.168.2.180;branch=z9hG4bKjD1mZ9cZ8gDtB
   Call-ID: ed928166-0eaf-1238-7aa7-080027ca0286
   From: <sip:0000000000@192.168.2.180>;tag=tc5B4j279yjSD
   To: <sip:5003@192.168.2.181;ob>
   CSeq: 6002184 INVITE
   Content-Length:  0

   ------------------------------------------------------------------------
recv 482 bytes from udp/[192.168.2.181]:5060 at 05:12:34.002969:
   ------------------------------------------------------------------------
   SIP/2.0 180 Ringing
   Via: SIP/2.0/UDP 192.168.2.180;rport=5060;received=192.168.2.180;branch=z9hG4bKjD1mZ9cZ8gDtB
   Call-ID: ed928166-0eaf-1238-7aa7-080027ca0286
   From: <sip:0000000000@192.168.2.180>;tag=tc5B4j279yjSD
   To: <sip:5003@192.168.2.181;ob>;tag=e26f5b27-ba66-4dec-ba73-ec2fe95f3fd6
   CSeq: 6002184 INVITE
   Contact: <sip:5003@192.168.2.181:5060;ob>
   Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
   Content-Length:  0

   ------------------------------------------------------------------------
2019-06-21 05:12:33.973497 [DEBUG] sofia.c:6962 Channel sofia/internal/5003 entering state [proceeding][180]
2019-06-21 05:12:33.973497 [NOTICE] sofia.c:7070 Ring-Ready sofia/internal/5003!
2019-06-21 05:12:33.973497 [DEBUG] switch_channel.c:3343 (sofia/internal/5003) Callstate Change DOWN -> RINGING
recv 897 bytes from udp/[192.168.2.181]:5060 at 05:12:34.174942:
   ------------------------------------------------------------------------
   SIP/2.0 200 OK
   Via: SIP/2.0/UDP 192.168.2.180;rport=5060;received=192.168.2.180;branch=z9hG4bKjD1mZ9cZ8gDtB
   Call-ID: ed928166-0eaf-1238-7aa7-080027ca0286
   From: <sip:0000000000@192.168.2.180>;tag=tc5B4j279yjSD
   To: <sip:5003@192.168.2.181;ob>;tag=e26f5b27-ba66-4dec-ba73-ec2fe95f3fd6
   CSeq: 6002184 INVITE
   Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
   Contact: <sip:5003@192.168.2.181:5060;ob>
   Supported: replaces, 100rel, timer, norefersub
   Content-Type: application/sdp
   Content-Length:   338

   v=0
   o=- 3770100759 3770100760 IN IP4 192.168.2.181
   s=pjmedia
   b=AS:1498
   t=0 0
   a=X-nat:0
   m=audio 8000 RTP/AVP 9 101
   c=IN IP4 192.168.2.181
   b=TIAS:1411200
   a=rtcp:8001 IN IP4 192.168.2.181
   a=sendrecv
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   m=video 0 RTP/AVP 103
   c=IN IP4 127.0.0.1
   b=AS:1024
   ------------------------------------------------------------------------
2019-06-21 05:12:34.171043 [DEBUG] sofia.c:6962 Channel sofia/internal/5003 entering state [completing][200]
2019-06-21 05:12:34.171043 [DEBUG] sofia.c:6972 Remote SDP:
v=0
o=- 3770100759 3770100760 IN IP4 192.168.2.181
s=pjmedia
b=AS:1498
t=0 0
a=X-nat:0
m=audio 8000 RTP/AVP 9 101
c=IN IP4 192.168.2.181
b=TIAS:1411200
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtcp:8001 IN IP4 192.168.2.181
m=video 0 RTP/AVP 103
c=IN IP4 127.0.0.1
b=AS:1024

send 403 bytes to udp/[192.168.2.181]:5060 at 05:12:34.177702:
   ------------------------------------------------------------------------
   ACK sip:5003@192.168.2.181:5060;ob SIP/2.0
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKKptD14X25S3cQ
   Max-Forwards: 70
   From: "" <sip:0000000000@192.168.2.180>;tag=tc5B4j279yjSD
   To: <sip:5003@192.168.2.181:5060;ob>;tag=e26f5b27-ba66-4dec-ba73-ec2fe95f3fd6
   Call-ID: ed928166-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002184 ACK
   Contact: <sip:mod_sofia@192.168.2.180:5060>
   Content-Length: 0

   ------------------------------------------------------------------------
2019-06-21 05:12:34.171043 [DEBUG] sofia.c:6962 Channel sofia/internal/5003 entering state [ready][200]
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4276 Audio Codec Compare [G722:9:8000:20:64000:1]/[opus:116:48000:20:0:1]
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4276 Audio Codec Compare [G722:9:8000:20:64000:1]/[G722:9:8000:20:64000:1]
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4331 Audio Codec Compare [G722:9:8000:20:64000:1] ++++ is saved as a match
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4276 Audio Codec Compare [G722:9:8000:20:64000:1]/[PCMU:0:8000:20:64000:1]
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4276 Audio Codec Compare [G722:9:8000:20:64000:1]/[PCMA:8:8000:20:64000:1]
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4192 Set telephone-event payload to 101@8000
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:3017 Set Codec sofia/internal/5003 G722/8000 20 ms 160 samples 64000 bits 1 channels
2019-06-21 05:12:34.171043 [DEBUG] switch_core_codec.c:111 sofia/internal/5003 Original read codec set to G722:9
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4537 Set telephone-event payload to 101@8000
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:4596 sofia/internal/5003 Set 2833 dtmf send payload to 101 recv payload to 101
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:6434 AUDIO RTP [sofia/internal/5003] 192.168.2.180 port 32176 -> 192.168.2.181 port 8000 codec: 9 ms: 20
2019-06-21 05:12:34.171043 [DEBUG] switch_rtp.c:3824 Starting timer [soft] 160 bytes per 20ms
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:6652 Activating RTCP PORT 8001
2019-06-21 05:12:34.171043 [DEBUG] switch_rtp.c:4210 RTCP send rate is: 5000 and packet rate is: 20000 Remote Port: 8001
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:6733 sofia/internal/5003 Set 2833 dtmf send payload to 101
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:6740 sofia/internal/5003 Set 2833 dtmf receive payload to 101
2019-06-21 05:12:34.171043 [DEBUG] switch_core_media.c:6763 sofia/internal/5003 Set rtp dtmf delay to 40
2019-06-21 05:12:34.171043 [NOTICE] sofia.c:7993 Channel [sofia/internal/5003] has been answered
2019-06-21 05:12:34.171043 [DEBUG] switch_ivr_originate.c:3616 Originate Resulted in Success: [sofia/internal/5003]
2019-06-21 05:12:34.171043 [DEBUG] switch_channel.c:3770 (sofia/internal/5003) Callstate Change RINGING -> ACTIVE
2019-06-21 05:12:34.171043 [INFO] switch_channel.c:3127 sofia/internal/5003 Flipping CID from "" <0000000000> to "Outbound Call" <5003%192.168.2.180>
2019-06-21 05:12:34.171043 [DEBUG] mod_commands.c:4785 (sofia/internal/5003) State Change CS_CONSUME_MEDIA -> CS_EXECUTE
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:543 (sofia/internal/5003) Running State Change CS_EXECUTE
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:609 (sofia/internal/5003) State EXECUTE
2019-06-21 05:12:34.171043 [DEBUG] mod_sofia.c:198 sofia/internal/5003 SOFIA EXECUTE
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:328 sofia/internal/5003 Standard EXECUTE
EXECUTE sofia/internal/5003 bridge(sofia/internal/linphone%192.168.2.180)
2019-06-21 05:12:34.171043 [DEBUG] switch_channel.c:1823 (sofia/internal/5003) Callstate Change ACTIVE -> RING_WAIT
2019-06-21 05:12:34.171043 [DEBUG] switch_ivr_originate.c:2136 Parsing global variables
2019-06-21 05:12:34.171043 [NOTICE] switch_channel.c:1104 New Channel sofia/internal/linphone [a8adcc82-8819-4e0d-a332-b270b61da925]
2019-06-21 05:12:34.171043 [DEBUG] mod_sofia.c:4753 (sofia/internal/linphone) State Change CS_NEW -> CS_INIT
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:543 (sofia/internal/linphone) Running State Change CS_INIT
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:586 (sofia/internal/linphone) State INIT
2019-06-21 05:12:34.171043 [DEBUG] mod_sofia.c:90 sofia/internal/linphone SOFIA INIT
2019-06-21 05:12:34.171043 [DEBUG] sofia_glue.c:1276 sofia/internal/linphone sending invite version: 1.6.10 -17-726448d 64bit
Local SDP:
v=0
o=FreeSWITCH 1561093772 1561093773 IN IP4 192.168.2.180
s=FreeSWITCH
c=IN IP4 192.168.2.180
t=0 0
m=audio 18182 RTP/AVP 9 101
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:40 sofia/internal/linphone Standard INIT
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:48 (sofia/internal/linphone) State Change CS_INIT -> CS_ROUTING
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:586 (sofia/internal/linphone) State INIT going to sleep
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:543 (sofia/internal/linphone) Running State Change CS_ROUTING
send 1218 bytes to udp/[192.168.28.31]:5060 at 05:12:34.189358:
   ------------------------------------------------------------------------
   INVITE sip:linphone@192.168.28.31;transport=udp SIP/2.0
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   Max-Forwards: 70
   From: "Outbound Call" <sip:50032.168.2.180@192.168.2.180>;tag=UNy45DKB778BS
   To: <sip:linphone@192.168.28.31;transport=udp>
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE
   Contact: <sip:mod_sofia@192.168.2.180:5060>
   User-Agent: FreeSWITCH-mod_sofia/1.6.10-17-726448d~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 224
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "Outbound Call" <sip:5003%192.168.2.180@192.168.2.180>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1561093772 1561093773 IN IP4 192.168.2.180
   s=FreeSWITCH
   c=IN IP4 192.168.2.180
   t=0 0
   m=audio 18182 RTP/AVP 9 101
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   ------------------------------------------------------------------------
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:602 (sofia/internal/linphone) State ROUTING
2019-06-21 05:12:34.171043 [DEBUG] mod_sofia.c:143 sofia/internal/linphone SOFIA ROUTING
2019-06-21 05:12:34.171043 [DEBUG] switch_ivr_originate.c:67 (sofia/internal/linphone) State Change CS_ROUTING -> CS_CONSUME_MEDIA
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:602 (sofia/internal/linphone) State ROUTING going to sleep
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:543 (sofia/internal/linphone) Running State Change CS_CONSUME_MEDIA
2019-06-21 05:12:34.171043 [DEBUG] sofia.c:6962 Channel sofia/internal/linphone entering state [calling][0]
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:621 (sofia/internal/linphone) State CONSUME_MEDIA
2019-06-21 05:12:34.171043 [DEBUG] switch_core_state_machine.c:621 (sofia/internal/linphone) State CONSUME_MEDIA going to sleep
recv 221 bytes from udp/[192.168.28.31]:5060 at 05:12:34.203391:
   ------------------------------------------------------------------------
   SIP/2.0 400 Bad request
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   To: <sip:linphone@192.168.28.31;transport=udp>;tag=oUWqD
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE

   ------------------------------------------------------------------------
2019-06-21 05:12:34.231177 [DEBUG] switch_rtp.c:6721 Correct audio ip/port confirmed.
2019-06-21 05:12:34.251475 [DEBUG] switch_rtp.c:1847 rtcp_stats_init: audio ssrc[989071824] base_seq[9414]
send 1218 bytes to udp/[192.168.28.31]:5060 at 05:12:35.194482:
   ------------------------------------------------------------------------
   INVITE sip:linphone@192.168.28.31;transport=udp SIP/2.0
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   Max-Forwards: 70
   From: "Outbound Call" <sip:50032.168.2.180@192.168.2.180>;tag=UNy45DKB778BS
   To: <sip:linphone@192.168.28.31;transport=udp>
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE
   Contact: <sip:mod_sofia@192.168.2.180:5060>
   User-Agent: FreeSWITCH-mod_sofia/1.6.10-17-726448d~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 224
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "Outbound Call" <sip:5003%192.168.2.180@192.168.2.180>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1561093772 1561093773 IN IP4 192.168.2.180
   s=FreeSWITCH
   c=IN IP4 192.168.2.180
   t=0 0
   m=audio 18182 RTP/AVP 9 101
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   ------------------------------------------------------------------------
recv 221 bytes from udp/[192.168.28.31]:5060 at 05:12:35.201925:
   ------------------------------------------------------------------------
   SIP/2.0 400 Bad request
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   To: <sip:linphone@192.168.28.31;transport=udp>;tag=oUWqD
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE

   ------------------------------------------------------------------------
send 1218 bytes to udp/[192.168.28.31]:5060 at 05:12:37.202147:
   ------------------------------------------------------------------------
   INVITE sip:linphone@192.168.28.31;transport=udp SIP/2.0
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   Max-Forwards: 70
   From: "Outbound Call" <sip:50032.168.2.180@192.168.2.180>;tag=UNy45DKB778BS
   To: <sip:linphone@192.168.28.31;transport=udp>
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE
   Contact: <sip:mod_sofia@192.168.2.180:5060>
   User-Agent: FreeSWITCH-mod_sofia/1.6.10-17-726448d~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 224
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "Outbound Call" <sip:5003%192.168.2.180@192.168.2.180>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1561093772 1561093773 IN IP4 192.168.2.180
   s=FreeSWITCH
   c=IN IP4 192.168.2.180
   t=0 0
   m=audio 18182 RTP/AVP 9 101
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   ------------------------------------------------------------------------
recv 221 bytes from udp/[192.168.28.31]:5060 at 05:12:37.231809:
   ------------------------------------------------------------------------
   SIP/2.0 400 Bad request
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   To: <sip:linphone@192.168.28.31;transport=udp>;tag=oUWqD
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE

   ------------------------------------------------------------------------
send 1218 bytes to udp/[192.168.28.31]:5060 at 05:12:41.203772:
   ------------------------------------------------------------------------
   INVITE sip:linphone@192.168.28.31;transport=udp SIP/2.0
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   Max-Forwards: 70
   From: "Outbound Call" <sip:50032.168.2.180@192.168.2.180>;tag=UNy45DKB778BS
   To: <sip:linphone@192.168.28.31;transport=udp>
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE
   Contact: <sip:mod_sofia@192.168.2.180:5060>
   User-Agent: FreeSWITCH-mod_sofia/1.6.10-17-726448d~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 224
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "Outbound Call" <sip:5003%192.168.2.180@192.168.2.180>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1561093772 1561093773 IN IP4 192.168.2.180
   s=FreeSWITCH
   c=IN IP4 192.168.2.180
   t=0 0
   m=audio 18182 RTP/AVP 9 101
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   ------------------------------------------------------------------------
recv 221 bytes from udp/[192.168.28.31]:5060 at 05:12:41.234270:
   ------------------------------------------------------------------------
   SIP/2.0 400 Bad request
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   To: <sip:linphone@192.168.28.31;transport=udp>;tag=oUWqD
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE

   ------------------------------------------------------------------------
send 1218 bytes to udp/[192.168.28.31]:5060 at 05:12:49.205014:
   ------------------------------------------------------------------------
   INVITE sip:linphone@192.168.28.31;transport=udp SIP/2.0
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   Max-Forwards: 70
   From: "Outbound Call" <sip:50032.168.2.180@192.168.2.180>;tag=UNy45DKB778BS
   To: <sip:linphone@192.168.28.31;transport=udp>
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE
   Contact: <sip:mod_sofia@192.168.2.180:5060>
   User-Agent: FreeSWITCH-mod_sofia/1.6.10-17-726448d~64bit
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
   Supported: timer, path, replaces
   Allow-Events: talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 224
   X-FS-Support: update_display,send_info
   Remote-Party-ID: "Outbound Call" <sip:5003%192.168.2.180@192.168.2.180>;party=calling;screen=yes;privacy=off

   v=0
   o=FreeSWITCH 1561093772 1561093773 IN IP4 192.168.2.180
   s=FreeSWITCH
   c=IN IP4 192.168.2.180
   t=0 0
   m=audio 18182 RTP/AVP 9 101
   a=rtpmap:9 G722/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=ptime:20
   ------------------------------------------------------------------------
recv 221 bytes from udp/[192.168.28.31]:5060 at 05:12:49.234961:
   ------------------------------------------------------------------------
   SIP/2.0 400 Bad request
   Via: SIP/2.0/UDP 192.168.2.180;rport;branch=z9hG4bKmZK62Ze622SZj
   To: <sip:linphone@192.168.28.31;transport=udp>;tag=oUWqD
   Call-ID: edb6b4b1-0eaf-1238-7aa7-080027ca0286
   CSeq: 6002185 INVITE

   ------------------------------------------------------------------------

A: It seems to be a bug in the VM-Image from freeswitch.com
Installing freeswitch 1.6 on Centos 7 or 1.6/1.8 Debian 9 manually both didn't produce that problem.


text:
Q: Is there a way I can reduce the boot up time on my Ubuntu? I am using Ubuntu 18.04 on a HP laptop dual booted with Windows 10, with 40 GB of disk space for Ubuntu and a 20 GB of SWAP area since I have an 8 GB of RAM.
I am using a HDD. Out of the 40 GB, 32.5 GB is still available and free. I have freshly installed the OS a few weeks back.
The shutdown time is really short, say 5 seconds, but the time it takes to boot up goes up to 1 minute.
I have edited /etc/initramfs-tools/initramfs.conf and changed MODULES=dep.
This has greatly reduced time taken by initramfs.
I'm not sure how else to improve it and reduce the time taken.
Boot time from systemd-analyze blame:
 23.512s dev-sda6.device
 21.462s plymouth-quit-wait.service
 18.832s systemd-udevd.service
 18.395s apparmor.service
 17.486s systemd-tmpfiles-setup.service
  6.801s NetworkManager-wait-online.service
  6.732s plymouth-start.service
  5.873s plymouth-read-write.service
  4.169s udisks2.service
  3.890s networking.service
  3.889s accounts-daemon.service
  3.013s speech-dispatcher.service
  2.573s networkd-dispatcher.service
  2.527s NetworkManager.service
  2.453s avahi-daemon.service
  2.449s thermald.service
  2.446s alsa-restore.service
  2.446s systemd-logind.service
  2.443s pppd-dns.service
  2.438s gpu-manager.service
  2.434s rsyslog.service
  2.016s apport.service
  1.426s wpa_supplicant.service
  1.388s dns-clean.service
  1.276s grub-common.service
  1.269s keyboard-setup.service
  1.056s tlp.service
  1.007s systemd-random-seed.service
   987ms packagekit.service
   896ms fwupd.service
   878ms systemd-tmpfiles-setup-dev.service
   779ms systemd-remount-fs.service
   758ms dev-mqueue.mount
   714ms sys-kernel-debug.mount
   712ms dev-hugepages.mount
   694ms systemd-modules-load.service
   590ms polkit.service
   579ms iio-sensor-proxy.service
   574ms systemd-sysctl.service
   442ms colord.service
   434ms systemd-journal-flush.service
   379ms systemd-timesyncd.service
   332ms dev-disk-by\x2duuid-72e62aa6\x2deefa\x2d49e1\x2daba3\x2d858b0e7dfbd3.swap
   330ms upower.service
   321ms systemd-journald.service
   312ms systemd-backlight@backlight:intel_backlight.service
   230ms setvtrgb.service
   217ms ufw.service
   209ms user@1000.service
   179ms systemd-resolved.service
   174ms bolt.service
   141ms gdm.service
   106ms kmod-static-nodes.service
    87ms console-setup.service
    73ms systemd-update-utmp.service
    56ms systemd-udev-trigger.service
    52ms kerneloops.service
    22ms systemd-user-sessions.service
    20ms sys-fs-fuse-connections.mount
    19ms rtkit-daemon.service
    19ms sys-kernel-config.mount
     8ms systemd-update-utmp-runlevel.service

free --human:
              total        used        free      shared  buff/cache   available
Mem:           7.7G        1.2G        5.4G        148M        1.1G        6.3G
Swap:           19G          0B         19G

Output of ls /etc/apparmor.d/:
abstractions  force-complain  tunables         usr.bin.man                           usr.lib.libreoffice.program.soffice.bin  usr.sbin.cupsd     usr.sbin.tcpdump
cache         local           usr.bin.evince   usr.lib.libreoffice.program.oosplash  usr.lib.libreoffice.program.xpdfimport   usr.sbin.ippusbxd
disable       sbin.dhclient   usr.bin.firefox  usr.lib.libreoffice.program.senddoc   usr.sbin.cups-browsed                    usr.sbin.rsyslogd

NOTE:

*

*In order to improve the time taken by systemd-journal-flush.service I have reduced the MAX file size the journal flush service uses to 50M.

*sda6 is the partition where I have installed Ubuntu on my HDD

*I do not use Thunderbolt on my machine

*I don't use SSD

EDIT: Added benchmark results
sudo hdparm -Tt /dev/sda :
/dev/sda:
 Timing cached reads:   11730 MB in  2.00 seconds = 5876.89 MB/sec
 Timing buffered disk reads: 322 MB in  3.00 seconds = 107.22 MB/sec

sudo hdparm -v /dev/sda :
/dev/sda:
 multcount     = 16 (on)
 IO_support    =  1 (32-bit)
 readonly      =  0 (off)
 readahead     = 256 (on)
 geometry      = 121601/255/63, sectors = 1953525168, start = 0

dd if=/dev/zero of=/tmp/output bs=8k count=10k; rm -f /tmp/output :
10240+0 records in
10240+0 records out
83886080 bytes (84 MB, 80 MiB) copied, 0.0681511 s, 1.2 GB/s

Graphical Results Image Here


text:
Q: Assigning a version number to a DLL created using CSharpCodeProvider I have a method that creates a DLL from a .cs file that is based on the code found here on MSDN.
Using that code, is there any way to specify the version number of the DLL that gets generated? Right now it's always 0.0.0.0. I can't find a property or constructor that I can call to specify the version number.

A: Since you are compiling from a source file, have you tried just adding the Reflection namespace and the version attributes to the top of your .cs file before compiling it?
using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]


text:
Q: Sending List into Partial View I'm still trying to get my head wrapped around .net MVC, and maybe I'm just not searching the right key words to find my answer.
In short, I have a partial view that has a list that I want to include in the main view.
Index.cshtml:
@Html.Action("Checklist")

Checklist.cshtml:
@model List<Area>

Outcomes

        @foreach (var item in Model)
        {

@Html.DisplayFor(modelItem => item)

        }

Controller:
public PartialViewResult Checklist()
    {
        var outcomeAreas = db.OutcomeArea.Select(oa => oa.Area).Distinct();
        return PartialView("Checklist", outcomeAreas.ToList());
    }

Edit: I get a weird rendering now in the html when testing the website.  if you look at the page source code, I see:
System.Collections.Generic.List`1[System.String] List<Area>

A: Your view is expecting a model of type List<Namespace.toModel> but the type of the outcomeAreas variable passed to it appears to be either IEnumerable<OutcomeArea> or IQueryable<OutcomeArea>
Try changing Checklist.cshtml to have this at the top:
@Model List<OutcomeArea>

And then change your controller action to return:
return PartialView("Checklist", outcomeAreas.ToList());

Edit: Just noticed that you're doing .Select(oa => oa.Area), so you'll actually want to use whatever type the 'Area' property is. @Model List<Area> or @Model List<string> if it's a string, etc..

A: I think this specific error is related to the fact that the lamdba doesn't use the same alias:

@Html.DisplayFor(modelItem => item.Area)

to

@Html.DisplayFor(item => item.Area)

The lambda alias and usage has to match.   I think this is what the CS1001 error usually refers to, but @Ben's answer is a change also needed; either have the model expect IEnumerable, or as he said, call ToList() in the action method to ensure it's a list type.


text:
Q: How to get field value of selected Row Devexpress GridView? I use a DevexpressGridView to display all TOPIC (id,title,content)
<dx:ASPxGridView ID="gv" runat="server"
OnSelectionChanged="gv_SelectionChanged" >

I have grid_SelectionChanged event:
protected void gv_SelectionChanged(object sender, EventArgs e)
    {

        int id= selected row...???; //how can I get the value of selected row
        string sql = "select * from TOPIC where idTOPIC="+id;
        DataTable topic = l.EXECUTEQUERYSQL(sql);
        TextBox1.Text = topic.Rows[0][1].ToString();
    }

...
It seems gv.SelectedRow method isn't exist in DevGridview.
As recommended, I've tried with FocusedRowIndex method, but I really dont know the right syntax to get the value of selected row.
Help!!!

A: Changing the selection is different from changing the focused row. See the documentation for Selection for the difference between the two.
You can use gv.GetSelectedFieldValues to get the rows which are selected.
var ids = gv.GetSelectedFieldValues("id");
foreach( var id in ids )
    DoSomethingWithObject(id);

You should handle the FocusedRowChanged event if you're interested in the focused row.
You can use the FocusedRowIndex value to index the rows of gv.DataSource, for example:
DataTable ds = (DataTable)gv.DataSource;
var id = ds.Rows[gv.FocusedRowIndex]["id"];

or you can use var id = gv.GetRowValues(gv.FocusedRowIndex, "id").

A: I've found my answere here after a long time searching google:
http://www.devexpress.com/Support/Center/Question/Details/Q347704
Use the ASPxGridView.GetSelectedFieldValues method get selected row values on the server side.

A: You can also get selected data row as
int rowHandle = gridView1.FocusedRowHandle;
   if (rowHandle != DevExpress.XtraGrid.GridControl.InvalidRowHandle)
   {
    return this.gridView1.GetDataRow(rowHandle);
   }

This would return DataRow
Please note this is when I am using Devexpress gridControl in WinForms

A: If you want to get only ID field value you can use this
int id =  Convert.ToInt32(gv.GetRowValues(gv.FocusedRowIndex, "ID").ToString());

if you have an object you can use this
Personels selectedPersonel = gv.GetRow(gv.FocusedRowIndex) as Personels;

and get value method is
int ID = selectedPersonel.ID;


text:
Q: Batch file subraction/substitution I'm trying to decipher a batch file and there is a certain part of the code that I'm having trouble wrapping my head around:
for /f "tokens=*" %%A in ('getmac') do set "macaddr1=%%A"
echo %macaddr1
for /f "tokens=1" %%A in ("%macaddr1%") do set "macaddr1=%%A"
set "macaddr1=%macaddr1:-=%"

From what I gather, this piece of code is running the "getmac" command and then going through and setting each line and setting the variable v to equal %a, which is each line of the getmac command.
Since running the getmac command returns more than just the mac address, the second line seems to be going through and telling it to do the same thing but this time only assigning the first part of the line (which is the mac address in XX-XX-XX-XX-XX-XX " format.
The last part is the part I'm having trouble understanding. It says
set "macaddr1=%macaddr1:-=%"

From what I gather, this is somehow stripping out " - " from the format and just leaving the mac address in XXXXXXXXXXXX format.
As far as I understand, the : in there is a substitution operator, and according to the set command -= is supposed to "Subtract" variable, and the whole thing is in inside % %
I guess I don't understand this part. How does it know to subtract the dashes?
Or am I looking at this completely wrong?

A: What your program is doing is not subtracting, that's the Batch syntax for string replacement. The syntax is %VARIABLE:search=replace%. The value before the = is searched for and replaced with the value after the =.
In your case, it's replacing - with an empty string.


text:
Q: bWaitOnReturn has no effect on mstsc.exe when run from HTA In VBScript, the WScript.Shell.Run method has three arguments, the third of which is a boolean value specifying whether the program should wait for a newly-spawned process to finish before proceeding.
I am having trouble getting this behaviour to work properly with mstsc.exe (the Remote Desktop Connection program in Windows).
If I save the below file as test.vbs and execute it with cscript test.vbs, it works as expected.
Set obj = CreateObject("WScript.Shell")
Call obj.Run("notepad.exe", 1, true)
MsgBox "You just closed notepad."
Call obj.Run("mstsc.exe", 1, true)
MsgBox "Remote desktop just closed."

However, if I try to execute the same code from an HTA file, it does not work properly -- rather, the message box after running mstsc.exe appears immediately instead of waiting.
<html>
<head>
<script language="VBScript">
Sub RunProgram
  Set obj = CreateObject("WScript.Shell")
  Call obj.Run("notepad.exe", 1, true)
  MsgBox "You just closed notepad."
  Call obj.Run("mstsc.exe", 1, true)
  MsgBox "Remote desktop is still open!"
End Sub
</script>
</head>
</body>
<body onload=RunProgram>
</html>

Any idea why this happens and how to fix it?
EDIT: I've tested this on Windows 10 and 7.

A: Use the 64 bit version of mstsc. c:\windows\sysnative\mstsc.exe Sysnative allows 32 bit programs to access System32 directory. A 32 bit program trying to access C:\windows\system32 gets redirected to c:\windows\syswow64.
From my first comment.
I get the same on Windows 10. I suspect it is to do with HTA being set to run as 32 bit but even changing mstsc to the 32 bit version made no difference


text:
Q: Unable to display text box results in div I want to display all the resulting expressions under the Result and Entered button every time I hit "=". But I am stuck trying to figure it out. This is what I have so far. Any help would be much appreciated. Thank you.
<!DOCTYPE html>

 CALCULATOR

ADD

SUBTRACT

MULTIPLY

DIVIDE

                <input type ="text" size="3" id="op1"/>
                <input type = "text" size="1" id = "operator">
                <input type = "text" size="3"  id="op2"/>
                <input type = "button" value = "="  id="calculate" onClick = "calculation()"/>
                <input type = "text" size="6" id = "result" />

 PAST CALCULATIONS

                    SORT

                    <input type = "button" value = "As Entered" id = "enteredBut">
                    <input type = "button" value = "By Result" id = "resultBut">

A: The values for dispArr are in quotes so they're treated as strings. Remove the quotes, then you are using document.getElementbyId instead of document.getElementById on line 39 (under dispArr.toString();)

 CALCULATOR

ADD

SUBTRACT

MULTIPLY

DIVIDE

                <input type ="text" size="3" id="op1"/>
                <input type = "text" size="1" id = "operator">
                <input type = "text" size="3"  id="op2"/>
                <input type = "button" value = "="  id="calculate" onClick = "calculation()"/>
                <input type = "text" size="6" id = "result" />

 PAST CALCULATIONS

                    SORT

                    <input type = "button" value = "As Entered" id = "enteredBut">
                    <input type = "button" value = "By Result" id = "resultBut">


text:
Q: Content Providers or Application Cache directory for storing image path i am trying to perform an action where i can access and tag images stored in the sd-card from my application based on certain actions.
i would like to know the best way to temporary store the image path or the images, so that the application always remembers the set tagged images when ever it gets restarted(so the user does not have to do it all over again) and the images are still available on the sdcard when the application gets deleted or uninstalled.
should i use a content provider or the applications cache?.. Any other solution is highly appreciated.

A: I would simply store the path to the images in a sqlite database. That has the added benefit that if there's any additional data you'd like to associate with the image, you can just add fields to the sqlite table.
You could implement a content provider for the functionality, but that might be overkill. The easiest way would be to write to the database.


text:
Q: What does ":*" (colon-star) mean in Ruby? Looking up how to calculate the factorial of a number I came across this code:
(1..5).inject(:*) || 1 # => 120

What is the (:*) || 1 doing?
How does it compare to this line of code (1..5).inject(1) { |x, y| x * y } # => 120, which uses .inject to achieve similar functionality?

A: test.rb:
def do_stuff(binary_function)
  2.send(binary_function, 3)
end

p do_stuff(:+)
p do_stuff(:*)

$ ruby test.rb

5
6

If you pass a method name as a symbol, it can be called via send. This is what inject and friends are doing.
About the || part, in case the left hand side returns nil or false, lhs || 1 will return 1

A: It's absolutely equal. You may use each way, up to your taste.

A: Colon-star in itself doesn't mean anything in Ruby. It's just a symbol and you can pass a symbol to the inject method of an enumerable. That symbol names a method or operator to be used on the elements of the enumerable.
So e.g.:
(1..5).inject(:*) #=> 1 * 2 * 3 * 4 * 5 = 120
(1..5).inject(:+) #=> 1 + 2 + 3 + 4 + 5 = 15

The || 1 part means that if inject returns a falsey value, 1 is used instead. (Which in your example will never happen.)


text:
Q: Discord Bot in Python. Playing two audio files at once I've been trying to make my bot play short audio file while playing other, music. I had no success.
I have tried to use the play_audio function while playing using create_ffmpeg_player for playing the other audio file but play_audio just makes a crashing sound and doesn't play the audio file.
async def cmd_noise(self, message):
    vc = message.author.voice_channel
    voice_client = await self.get_voice_client(vc)
    voice_client.play_audio('other/Qoo.mp3')

Is there is even a way to make a Discord bot play 2 audio files at once?

A: There is no way with ffmpeg to play 2 audio files at once. You could only make another Bot which plays the wanted sounds.