text:
Q: Horizontal scroll - Div - Page-content css class enter image description hereHow to show main horizontal scroll bar for particular part of the page?
I have one of the div like this

                Home

Customer

List Customer

           something

           something

                            Search

                             something

                                        <select name="something" id="somethingn" class="selectcls col-xs-12 col-sm-12" chosen allow-single-deselect="true" data-placeholder="Choose Your Manager" no-results-text="'Tough luck'" ng-model="frmData.bmanagermodel" ng-options="something" ng-change="something()">
                                            <option value="">ALL</option>
                                        </select>

                            something

                                        <input class="form-control" id="something" type="text" placeholder="User Name" ng-model="somethingsomethingsomethingsomethingsomethingsomething">

                            somethingsomethingsomethingsomethingsomething

                                    <select name="status" ng-model="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="col-xs-12 col-sm-12">
                                        <option value="">ALL</option>
                                        <option value="Online">Online</option>
                                        <option value="Active">Active</option>
                                        <option value="Expired">Expired</option>
                                        <option value="Disabled">Disabled</option>
                                        <option value="Hold">Hold</option>
                                    </select>

                             somethingsomethingsomethingsomethingsomething

                                    <select name="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="selectcls col-xs-12 col-sm-12" chosen data-placeholder="Choose Package" no-results-text="'Tough luck'" ng-model="somethingsomethingsomethingsomethingsomething" ng-options="somethingsomethingsomethingsomethingsomething" ng-change="somethingsomethingsomethingsomethingsomething()">
                                        <option value="">ALL</option>
                                    </select>

                             somethingsomethingsomethingsomethingsomething

                                    <input class="form-control date-picker" id="st_date" type="text" data-date-format="dd-mm-yyyy" placeholder="From Date" ng-model="somethingsomethingsomethingsomethingsomething">

                            somethingsomethingsomethingsomethingsomething

                                    <input class="form-control date-picker" id="end_date" type="text" data-date-format="dd-mm-yyyy" placeholder="To Date" ng-model="somethingsomethingsomethingsomethingsomething">

                             somethingsomethingsomethingsomethingsomething

                                    <select name="acctype" ng-model="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="col-xs-12 col-sm-12">
                                        <option value="">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="0" selected>somethingsomethingsomethingsomethingsomething</option>
                                        <option value="1">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="2">somethingsomethingsomethingsomethingsomething</option>
                                    </select>

                            somethingsomethingsomethingsomethingsomething

                                    <select name="somethingsomethingsomethingsomethingsomething" ng-model="somethingsomethingsomethingsomethingsomething" id="somethingsomethingsomethingsomethingsomething" class="col-xs-12 col-sm-12">
                                        <option value="">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="0">somethingsomethingsomethingsomethingsomething</option>
                                        <option value="1">somethingsomethingsomethingsomethingsomething</option>
                                    </select>

                                    <input type="button" value="Search" class="btn btn-sm btn-primary" ng-click="somethingsomethingsomethingsomethingsomething()">

                                    <input type="text" name="table_search"  ng-model="searchText" class="form-control input-sm pull-right" style="width: 150px;height: 33px;" placeholder="Search">

                                        <button class="btn btn-sm btn-info "></button>

                        somethingsomethingsomething

                           somethingsomethingsomething{{somethingsomethingsomething.length}}

                                        <input type="checkbox" class="ace" name="somethingsomething[]" value="{{somethingsomething}}" ng-model="somethingsomething" />

                                            <button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">

                                            </button>

                                 {{list.uname}} {{list.uname}}
                                {{list.firstname}}
                                 {{list.company_name}}

                                {{something}}

                                {{list.ip}}
                                {{something.something}}
                                {{something.something |date:'dd-MM-yyyy'}}
                                {{something.something}}
                                {{something.something}}
                                {{something(something.something)}}
                                {{something(something.something)}}</tdsomething
                                {{something(something.something - something.something)}}
                                {{list.something}}

No Data Available

issue:
If I want to view other columns of table I have to scroll down for every time...!!
Now, all I want main horizontal scroll bar only for page-content at the bottom of the page as I have more number of columns show.
***Note : there's a responsive menu on the left side as a part
Help will appreciated greatly.

A: Set up the height for this element and in CSS add attribute:
overflow: scroll;

http://www.w3schools.com/cssref/pr_pos_overflow.asp

A: use css scroll bar
overflow:scroll;
overflow-x:scroll;

A: It is very difficult to re create a layout with your provided code but as far as your attached image describes, you can get that layout like this:
HTML

Item

Item

Item

Item

Container with some data.

Container with some data.

Container with some data.

Container with some data.

Container with some data.

Container with some data.

                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col
                    col

CSS
html,body, #wrapper{
  height: 100%;
}
#left-nav{
  width: 20%;
  float: left;
}
#container{
  width:80%;
  float: left;
}
#h-content{
 width: 95%;
 overflow-x: scroll;
 height: 200px;
}

Demo with Borders


text:
Q: Need to send separate emails to multiple recipients from excel list I have an excel list of people. I want to send emails to all as separate mails. Need to dynamically change the subject,body and recipients.
I have tried using vba and doing it. But i do not know how to dynamically change the subject and body. Also how can i enter multiple lines in the body?
i do not want all recipients to be sent the same mail.Image shows the field names in excel
I need to have first name and first letter of last name in subject. And in body first line includes Hi firstname..And personal mail goes in the "to" field and professional as "cc"

A: Try it this way:
'Initialize objects
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
  .To = ws.Range("A1") 'Assuming TO mail addresses are located here and separated with ";"
  .CC = ws.Range("B1") 'Assuming TO mail addresses are located here and separated with ";"
  .Subject = ws.Range("C1") 'Assuming subject is declared here
  .HTMLBody = ws.Range("D1") 'Assuming body is declared here
  If address_attachment_line.Value <> "" Then
    .Attachments.Add FilePath & FileName
  End If
  .Display
End With

Through storing the dynamic information in the ranges referenced by the code, you can control the single mails.
Furhermore to make linebreaks in the body text, just use the tag <br> as it is interpreted as HTML content.
Hope this helps you!

redpajama_set_name: RedPajamaStackExchange


text:
Q: Looking through folders on my server with $.ajax forbidden
I'm building a simple webpage with p5.js where a script looks for images in folders and put them all on 1 page.
I'm using the $.ajax({}); to find out if there is anything in the folder, if so, look for images/text files/other folders. The script works when I run it locally, but it the $.ajax({});-part doesn't work and gives a '403 (Forbidden)' message in the browser's console. I set all the folders, text files and images to a 755 permissions on the server, so I don't think the problem is there. It may have to do with CORS, but I'm totally new to that. I'm using GoDaddy as a webhost.
Does anyone know what I need to do in order the look through the files on my server? Thanks in advance
function setup() {
noCanvas();

var folder = "collections/"; //root of folder structure
var num = 'num'; //part of a CSS class name
var digit = "";

$.ajax({
    type: 'GET',
    url : folder,
    success: function (data) {
        console.log("before this line works");
        $(data).find("a").attr("href", function (i, val) {

            if((i>=0)  ){
                console.log("found a thing! : i "+i+" : "+val);

                //if there is a text file:
                if( val.match(/\.(txt)$/) ) {
                    //console.log("found a textfile! :"+i+" : "+val);

                    jQuery.get(folder+val, function(x) {

                        //get the first line in that text file and put it in a div
                        collectiondiv = createDiv(x.split('\n')[0]);
                        if(i<10){digit="-0"+i;}
                        if(i>=10){digit="-"+i;}
                        collectiondiv.class("menunamee").id("menuname"+digit).parent(menu);

                    });
                }

                //if there is an image
                else if( val.match(/\.(jpe?g|png|gif)$/) ) {
                    console.log("found an image! : i "+i+" : "+val);
                    var img;
                    img = createImg(folder+val);
                    img.class(num+floor(random(1,4))).parent("body");
                }

                //if it's not an image or a text file, it's a folder
                else if( !val.match(/\.(jpe?g|png|gif)$/) && !val.match(/\.(txt)$/) && val.match(/^[0-9]+/)) {
                    //console.log("found a folder! : i "+i+" : "+val);

                    if(i>=0){

                        var collectionDiv;
                        collectionDiv = createDiv("");
                        collectionDiv.class("collectionDivs").id("collectionDiv"+i);

                        //go 1 level deeper into the folder structure
                        var deeperlink = folder+val;
                        $.ajax({
                            url : deeperlink,
                            success: function (d) {
                                $(d).find("a").attr("href", function (j, value) {
                                    //console.log("found a thing in a folder! : i "+i+"  j "+j+" : "+deeperlink+value);
                                    if(j>=0){
                                        //console.log("found a thing in a folder! : i"+i+" j"+j+" : "+deeperlink+value);

                                        //if there is a text file:
                                        if( value.match(/\.(txt)$/)) {
                                            //console.log("found a textfile in a folder! : i "+i+" j"+j+" : "+deeperlink+value);

                                            jQuery.get(deeperlink+value, function(y) {

                                                //get the first line in that text file and put it in a div
                                                menunamediv = createDiv(y.split('\n')[0]);
                                                collectionDivname = createDiv("

"+y.split('\n')[0]);
                                                if(i<10){digit="-0"+i;}
                                                if(i>=10){digit="-"+i;}
                                                menunamediv.class("menuname").id("menuname"+digit).parent(menu);
                                                collectionDivname.class("collectionDivname").id("collectionDivname"+i).parent("#collectionDiv"+i);
                                                menunamediv.mouseClicked(function(){
                                                        $('html,body').animate({scrollTop: $('#collectionDivname'+i).offset().top},1111,"swing");
                                                });

                                                if(y.split('\n').length>1){
                                                    collectionDivdescription = createDiv("");
                                                    collectionDivdescription.class(num+floor(4)).id("collectionDivdescription"+i).parent("#collectionDiv"+i);
                                                    for(var x=1;x<y.split('\n').length;x++){
                                                       $( "#collectionDivdescription"+i ).append(y.split('\n')[x]);
                                                    }
                                                }
                                            });
                                        }

                                        //if there is an image
                                        else if( value.match(/\.(jpe?g|png|gif)$/) ) {
                                            //console.log("found an image in a folder! : i "+i+": "+j+" : "+deeperlink+value);
                                            var img;
                                            img = createImg(deeperlink+value);
                                            img.class(num+floor(random(1,4))).parent("#collectionDiv"+i);
                                            //select("#collectionDiv"+i).append( "" );
                                        }

                                        //if it's not an image or a text file, it's a folder
                                        else if( !value.match(/\.(jpe?g|png|gif)$/) && !value.match(/\.(txt)$/) && value.match(/^[0-9]+/)) {
                                            //console.log("found a folder in a folder! : i "+i+" j "+j+" : "+deeperlink+value);

                                            //go 2 levels deeper into the folder structure
                                            var deeperlink2 = deeperlink+value;
                                            $.ajax({
                                                url : deeperlink2,
                                                success: function (d) {
                                                    $(d).find("a").attr("href", function (k, v) {
                                                        if((k>=0) ){
                                                            //console.log("found a thing! : i "+i+" j "+j+" k "+k+" : "+deeperlink2+v);

                                                            //if there is a text file:
                                                            if( v.match(/\.(txt)$/) ) {
                                                                //console.log("found a textfile in a folder in a folder! : "+k+" : "+deeperlink2+value);

                                                                jQuery.get(deeperlink2+v, function(d) {

                                                                    //get the first line in that text file and put it in a div
                                                                    menunamediv = createDiv(d.split('\n')[0]);
                                                                    menunamediv.class("menuname");
                                                                });
                                                            }

                                                            //if there is an image
                                                            else if( v.match(/\.(jpe?g|png|gif)$/) ) {
                                                                //console.log("found an image in a folder in a folder! : i"+i+" j"+j+" k"+k+" : "+deeperlink2+value);

                                                                var img;
                                                                img = createImg(deeperlink2+v);
                                                                //tweak 'grid' here
                                                                var noisynumber = noise(k*.1)*6+1;
                                                                //console.log(noisynumber+" | " +floor(noisynumber));
                                                                img.class(num+floor(noisynumber)).parent("#collectionDiv"+i);
                                                                //$("body").append( "" );

                                                            }
                                                        }
                                                    });
                                                }
                                            });
                                        }
                                    }
                                });
                            }
                        });
                    }
                }
            }
        });
    },
    error: function() {
        console.log("there was an error");
    }
});

}

A: Your directory indexes must be enabled, otherwise you get 403 Forbidden message. You can do it by adding:
Options +Indexes

in your .htaccess file. The name of the index file is controlled by DirectoryIndex Directive. By default it is:
DirectoryIndex index.html


text:
Q: In the listview control i need to display an an message telling an number of records found i have an datatable  with  23  records so now the Count of the table is  "23"
i need  to  display  this message in listview  control.
so where  should i write this message telling number  of records in  23
which template  should i  use  here to achive this one
 do we have  any builtin option  for this
thank  you

A: You can use InsertItemTemplate to be a workaround as a footer row to display summary:
http://blog.evonet.com.au/post/2008/08/17/Inserting-a-new-record-from-the-Listviews-footer.aspx
Or you can set a footer row in LayoutTemplate with  tag:
http://basgun.wordpress.com/2008/01/01/listview-freeze-lock-header-footer-with-css/
Thanks,

A: Something like this:
DataTable mytable = new DataTable();
int table_count = mytable.count;
mylistview.items.Add("number of records is: "+ table_count.ToString());


text:
Q: How do I get the number of days in a month for the specific date in that row of data using SQL? For example, if I have a data set including two columns, one which shows the month as a number and the other which shows the year (result of grouping my data using GROUP BY), I want to add another column called 'Days in the month' which will display the number of days in the respective month. Is there a way I can do this? Is there some function I can add in the SELECT clause?
I want to do this since there are further calculations I need to do with that number for each row.

A: In SQL Server 2012+, you can use:
select day(eomonth(datecol))

eomonth() gets the last day of the month.  day() just returns the day of the month -- the number of days in the month, in this case.

A: For older SQL Server versions, I use the following:
DAY(DATEADD(MONTH, DATEDIFF(MONTH, -1, date_column)- 1, -1))

Much less elegant than the previous answer, but functional.


text:
Q: How can a Interface be a variable within a class? I'm trying to understand a class in a project and am a little confused about Interface's.
From my understanding an Interface is a 'Contract' that a particular class will adhere to so that it shall always provide an implementation for the specified methods, properties etc.
So how is it possible that I can implement this as an Object? For example
private IMyInterfaceName _interfaceObject;

Could someone please explain what is the purpose of an interface as an object and how it might be used?

A: _interfaceObject is able to hold a reference to an instance of a class which implements the interface:
public class MyClass : IMyInterfaceName {}

...
_interfaceObject = new MyClass();

A: Here's a contract with two implementations :
interface ICalculator
{
    //this contract makes it possible to add to given numbers a and b
    int Add(int a, int b);
}

class SmartCalculator : ICalculator
{
    // a concise way to add two numbers
    public int Add(int a, int b)
    {
        return a+b;
    }
}

class DumbCalculator : ICalculator
{
    //A not that beautiful way to add to numbers
    public int Add(int a, int b)
    {
        int result = a;
        for(var i=1;i<=b;i++)
        {
            result+=1;
        }
        return result;
    }
}

Now the  class you're asking about
class MyMainClass
{
    private readonly ICalculator calcuator;

    public MyClass()
    {
        //If I'm smart i'll do the following
        calculator = new SmartCalculator();
        //If I'm not, well..
        calculator = new DumbCalculator();
    }
}


text:
Q: How to multiply two integers using two classes, Class one contains method int calculateMultiplication (int, int) and two contains main method? I need help with this program. I need to multiply the two integers that are inputted by the user and then use the method int calculateMultiplication (int, int) to calculate the result. The first class contains the declaration of variables and the methods and the second class contains the main method with all the print. I don't know how to call the calculateMultiplication method to implement in my final print which gives "The multiplication of first user input (I got) and second user input (I got) is result (I don't have).
public class JavaApplication19 {

    public static void main(String[] args) {

    Scanner input = new Scanner (System.in);
    System.out.print("Enter the first int number: ");
    int num1 = input.nextInt();
    Two Num1 = new Two();
    Num1.setN1 (num1);
    int numOne = Num1.getN1();

    System.out.print("Enter the second int number: ");
    int num2 = input.nextInt();
    Two Num2 = new Two();
    Num2.setN2 (num2);
    int numTwo = Num2.getN2();
    }
}

This is the part I need help on: (this is just what i have so far)

    System.out.println("The multiplication of " + numOne + " and " + numTwo + " is" + product + "." );
    Two Result = new Two();
    int result = Result.calculateMultiplication(num1, num2);

class Two {

    private int result;
    private int n1;
    private int n2;

    public int getN1(){
        return n1;
    }

    public void setN1(int _n1){
        n1 = _n1;
    }

    public int getN2(){
        return n2;
    }

    public void setN2(int _n2){
        n2 = _n2;
    }

    public int calculateMultiplication(int n1, int n2){
        int answer = this.n1 * this.n2;
        return result;

    }

}

A: Be careful with instance variables and method parameters.
The two class could be written a bit differently:
public class Two {
    private int n1;
    private int n2;
    private int result;
    public void setN1(int n1) {
        this.n1 = n1;
    }
    public void setN2(int n2) {
        this.n2 = n2;
    }
    public void multiply() {
        this.result = this.n1 * this.n2;
    }
    public int getResult() {
        return this.result;
    }
}

It has two private int instance variables, n1 and n2.
int num1 = 10; // for example
int num2 = 20; // for example

Two two = new Two();
two.setN1(num1);
two.setN2(num2);
two.multiply();
int result = two.getResult();

From here you can do whatever you need with the values.

A: Try this:
public class Testing {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        System.out.print("Enter the first int number: ");
        Two num = new Two();

        int num1 = in.nextInt();
        num.setN1(num1);

        System.out.print("Enter the second int number: ");
        int num2 = in.nextInt();
        num.setN2(num2);

        System.out.println("Multiplication: " + num.calculateMultiplication());
    }
}

public class Two {

    private int n1;
    private int n2;

    public int getN1(){
        return n1;
    }

    public void setN1(int n1){
        this.n1 = n1;
    }

    public int getN2(){
        return n2;
    }

    public void setN2(int n2){
        this.n2 = n2;
    }

    public int calculateMultiplication(){
        return this.n1 * this.n2;
    }

}


text:
Q: Yesod WebSocketsT handler cleanup I'm currently authoring an application in Haskell that relies on Yesod and its web sockets implementation.
I was wondering what is the correct way to acquire and release resources for a WebSocketT handler.
For example, in the following naive case...
chatApp :: WebSocketsT Handler ()
chatApp = do
    let outgoingFlow = forever $ deliverOutgoingMessages
    let incomingFlow = forever $ deliverIncomingMessages
    bracket_ acquireResource
             releaseResource
             (race_ outgoingFlow incomingFlow)

... releaseResource does not seem to be called when a client disconnects abruptly or purposefully.

A: This is what I ended up doing over the weekend. This is essentially a replication of how web socket background ping process works, apart for the fact that I'm not swallowing the ping send exception when the other end is no longer reachable, but rather using it to detect the disconnection.
echoApp' :: WebSocketsT Handler ()
echoApp' = do
  conn <- ask
  let acquire = putStrLn "Acquiring..."
      release = putStrLn "Releasing"
      hardWork = (threadDelay 600000000)
      ping i = do
          threadDelay (30 * 1000 * 1000)
          WS.sendPing conn (T.pack $ show i)
          ping (i + 1)

  liftIO $ bracket_ acquire release $ race_ hardWork (ping 1)

The downside of this approach is that there's still an up to 30 seconds window when the web socket process is lingering, but at least the resource gets eventually released in a more or less controllable way.


text:
Q: Advice needed for multi-threading strategy for WPF application I'm building a single window WPF application
In the window is a list items (which are persisted in a database of course)
Periodically I need to start a background task that updates the database from an Atom feed. As each new item is added to the database, the list in the UI must also update to reflect this. I don't want this background task to slow down the UI but at the same time it needs to interact with the UI.
Having read loads of articles and seen lots of simple examples, I am still unsure of the best way to implement this.
What I think maybe I could do is:
On the Window_Loaded event, create a DispatchTimer.
When the Tick event fires, call UpdateDb() method.
UpdateDB() will get the items from the Atom feed and add to the database. As I iterate through each item I will call another method to rebind the list to the database so that it "refreshes".
When all the tasks are finished reset the DispatchTimer ??? (not sure if this can / needs to be / done).
Remember, this is background task so a user could be using the UI at the same time.
How does this sound?
Thanks.

A: This sounds suboptimal because you're doing database connectivity on the UI thread. When the Tick event fires on the DispatcherTimer, handlers will execute on the UI thread. You need to minimize the amount of work you do on this thread to keep the UI responsive, and you definitely shouldn't be doing IO-bound work on this thread.
I would probably have a data service whose responsibility is to update the database and raise events as changes are made. Your UI layer can attach to these events and marshal to the UI thread to apply changes. To marshal to the UI thread, you just need to call Dispatcher.Invoke.
Regardless of your specific approach, the key is to do as much as you can (including any database access) on a separate thread. Marshal back to the UI thread as late as possible and do as little work as possible on the UI thread.
One other thing to note is that WPF automatically marshals changes to scalar values for you. You only need to marshal changes to collections (adding/removing/replacing items).

A: Your approach would work.
You'd start the timer when the app loads. For each tick of the timer, you start a thread to update the database. Once the database update has happened, you can call .BeginInvoke() on your UI objects to update the UI on the presentation thread (that will be the only time your UI should be affected).

A: I'd use a System.Threading.Timer, which will call a specified method at a specified interval on a threadpool thread, so no need to create an additional thread, do your db work with that and marshal back to the ui thread as needed.

A: WPF Multithreading with BackgroundWorker by Pavan Podila:

The good news is that you really don't have to write such a component since one is available already: the BackgroundWorker class introduced in .Net Framework 2.0. Programmers who are familiar with WinForms 2.0 may have already used this component. But BackgroundWorker works equally well with WPF because it is completely agnostic to the threading model.


text:
Q: SAPUI5_JSON Data binding issue

I'm trying to bind a local JSON data(in file) to a <SELECT>/<ComboBox> element, I could see the data being pulled by the server. However, the data is not getting bound to element. Please help.
--- Controller
sap.ui.define([
        'jquery.sap.global',
        'sap/ui/core/mvc/Controller',
        'sap/ui/model/json/JSONModel'
    ], function(jQuery, Controller, JSONModel) {
    "use strict";

    var PageController = Controller.extend("survey.App", {

        onInit: function () {
            var oModel = new JSONModel(jQuery.sap.getModulePath("sap", "/products.json"));
            this.getView().setModel(oModel);
            console.log(oModel);
        }
    });
    return PageController;

   });

-- XML VIEW
<mvc:View
height="100%"
controllerName="survey.App"
xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<Page showHeader="true">
    <content>
        <ComboBox id="prodlist"
                items="{
                    path: '/ProductCollection',
                    sorter: { path: 'Name' }
                }">
                <core:Item key="{ProductId}" text="{Name}" />
        </ComboBox>

    </content>
</Page>

A: You should check your console an see if there is a 404 for the json file that you try to load via
jQuery.sap.getModulePath("sap", "/products.json")

The issue might be related to wrong resource-roots settings in the bootstrapping, which you have not posted...
This here is a working example. As you can see I'm not using jQuery.sap.getModulePath(...), instead I use the URL directly. I works just fine for me. Maybe there is also CORS issue in your case, which my example does not have because I just use cors-anywere. Again, nobody can tell you more before you post the complete code including the bootstrap!

<!DOCTYPE html>

        <meta charset="utf-8" />
        <title>SAPUI5 single file template | nabisoft</title>


text:
Q: How to restart flask server? I am using Flask to create a web service. I hope to restart it like every 30 minutes. Is that possible to do that and how can it be realized?
Meanwhile, I tried to use subprocess (popen) to start the flask web service, terminate it and start it again, but the server could not be shut down unless the whole program, where I call subprocess, is also down.
I would very appreciate if you could share your knowledge and experience regarding to this issue.

A: Flask web server is not supposed to serve production traffic. You should consider using some other service on top of WSGI protocol, such as gunicorn or uwsgi or apache mod_wsgi.


text:
Q: create animation of vehicle moving along a route "with timeline of events" This is a followup question on How to create animation of vehicle moving form A to B along a route?. I could learn how to animate vehicles moving from A to B along the route. Thanks for the help!
But is it possible to make a self explanatory video (for a hypothetical client) by adding timeline (with a moving marker showing the instantaneous time and the corresponding event).  Example of timeline
For example - Here is a sample sequence of events -

library(sf)
library(dplyr)
library(tidygeocoder)
library(osrm)
library(lubridate)

# adresses
adresses <- c("285 Fulton St, New York, NY 10007", # One World Trade Center
              "11 Madison Ave, New York, NY 10010",
              "Rockefeller Center, 45 Rockefeller Plaza, New York, NY 10111")

# geocoded addresses
geocoded_addresses <- tidygeocoder::geo(adresses, method = "osm") %>%
  st_as_sf(coords = c("long", "lat"), crs = 4326)

# reference time
t <- as_datetime("2021-08-23 8:00:00", tz = "America/New_York")

timeline <- tibble(
  time = c(t, t+minutes(10), t+minutes(12), NA, t+minutes(25), t+minutes(30), t+minutes(32), NA, t+minutes(38), NA),
  events = c("Wait", "Ride request", "Start trip", "End trip", "Ride request", "Start trip", "Ride request", "End trip", "Start trip", "End trip")
)


text:
Q: mssql 2008 - creating stored procedure using select into I'm new to Mssql 2008. In Oracle when im trying to create stored prod based on the value from another table i can use something similar like this;
Select username into temp_value from logintbl;

Then i insert the temp_value to my table. How do i achieve this in MSSQL? Any comments,reference or advice is highly appreciated. Thanks.

A: Try:
DECLARE @Username nvarchar(100)
SELECT @Username = username FROM logintbl

INSERT INTO table1 (usernames)
VALUES (@username)


text:
Q: How to call method in loop using vuejs I already call method in v-for, it works. But I get

[Vue warn]: You may have an infinite update loop in a component render function.

How to solve this?
This is my code:

    {{ item.name }}
    {{ toMakeLocalString(item.data_trx.total_penjualan) }}
    {{ roundDataPercentPerline(item.data_trx.total_penjualan,all_data_trx.penjualan) }}

     {{ resetVal() }}
     <template v-for="(itemBodyJum,indexBodyJum) in arrHeader">
         <template v-if="itemBodyJum == item.data_provider[incrementI].denom">
         {{ toMakeLocalString(item.data_provider[incrementI].jumlah_trx) }}
         {{ incVal(incrementI) }}
      </template>
      <template v-else>
         0
      </template>

My method:
incVal(val, flagcond) {
   console.log(this.flagInc+'---1')
   if(this.flagInc == false) {
      this.flagInc = true
      console.log(this.flagInc+'---2')
      this.incrementI = val + 1
   }
},
resetVal() {
  this.flagInc = false
  this.incrementI=0
}

A: Your problem is that you change the incrementI variable during the V-FOR. Try to use something else instead - e.g. indexBodyJum or indexBodyPen.


text:
Q: Unable to get proper custom AlertDialog I have been trying to set a custom AlertDialog but was not able to get correctly.
prompt.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#ffe3e3"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="HardcodedText">

    <TextView
        android:id="@+id/prompttitile"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical|left"
        android:padding="5dp"
        android:text="Error Title Here"
        android:textColor="#c50200"
        android:textSize="16sp"
        android:textStyle="normal"
        android:visibility="visible"
        />
    <TextView
        android:id="@+id/promptmessage"
        android:layout_below="@+id/prompttitile"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical|center_horizontal"
        android:padding="5dp"
        android:text="Error Title Here"
        android:textColor="#c50200"
        android:textSize="16sp"
        android:textStyle="normal" />
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/promptmessage"
        android:weightSum="2"
        android:padding="10dp"
        android:background="#333"
        >
        <Button
            android:text="@android:string/no"
            android:id="@+id/promptno"
            android:layout_width="0sp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:padding="7dp"
            android:textColor="@android:color/black"
            android:textSize="14sp"
            android:textStyle="bold"
            android:background="@drawable/button_selector"
            android:layout_marginRight="5dp"
            android:gravity="center"
            />

        <Button
            android:text="@android:string/ok"
            android:id="@+id/promptok"
            android:layout_width="0sp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:padding="7dp"
            android:textColor="@android:color/black"
            android:textSize="14sp"
            android:textStyle="bold"
            android:background="@drawable/button_selector"
             android:gravity="center"
            />
    </LinearLayout>
</RelativeLayout>

I am getting black color background at the top of the AlertDialog and I want to only the AlertDialog to be displayed.
Dialog code
Dialog d=new Dialog(mContext);
d.setContentView(R.layout.prompt);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
d.getWindow().setAttributes(lp);
d.show();

A: Try this
Dialog dialog = new Dialog(MainAppActivity.this, R.style.PauseDialog);
dialog.setContentView(R.layout.prompt);
dialog.setCancelable(true);
dialog.show();

and in style.xml
<style name="PauseDialog" parent="@android:style/Theme.Translucent.NoTitleBar"></style>

A:     Dialog d=new Dialog(this);
    //Add this
    d.requestWindowFeature(Window.FEATURE_NO_TITLE);

    d.setContentView(R.layout.prompt);
    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
    lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
    d.getWindow().setAttributes(lp);
    d.show();


text:
Q: Form authentication problem with multiple IIS worker processes I'm running an asp.net mvc5 application on a shared hosting environment (a2 Hosting). I ran into a problem where users get randomly un-authenticated when browsing pages WAY before session timout or expiration should be reached.
I tried playing with applicaiton pool configurations to fixed the problem and finally find out that this was related to numbers of worker processes. When the maximum number of worker processes is set to 1, no more disconnection problems.
My appliciation use real basic from authentication. The only customizing I did was usins a custom Principal object to store extra data in authentication cookie. I DON'T use Session in the application so this can't be the problem.

A: Set it back to 1.  Why you shouldn't use web gardens: https://www.youtube.com/watch?v=9bOTesCnszo

A: For enabling multiple IIS worker processes.

*

*Go to Services & find Asp.Net State Service Set it to Startup
Automatic

*Open IIS Manager Goto Web Application, right click and select Explore, this will take you to the folder, find web.config file & edit this file in notepad and Change Session State to State server and Save the web.config file.

*Now edit the app pool by right clicking on it & select Advanced settings and find Maximum Worker processes & change the value & change load user profile to true. Click on OK. Open command prompt as Admin and run an "IISRESET" after complete, TEST.
This helps to boost overall application performance.


text:
Q: Create haskel socket client I try to connect to created socket by haskell:
-- Logger
  putStrLn "Create socket"
  sock_logger <- socket AF_INET Stream 0
  putStrLn "Bind socket"
  connect sock_logger (SockAddrInet 5000 0)
  putStrLn "Listen socket"
  listen sock_logger 2
  putStrLn "Logger listening on port 5000..."
  (conn_logger, _) <- accept sock_logger
  putStrLn "Logger connection accepted"

Scocket already created by other application. But after connect sock_logger (SockAddrInet 5000 0) i get
helloworld-exe.EXE: Network.Socket.connect: <socket: 440>: failed (Cannot assign requested address (WSAEADDRNOTAVAIL))

How can i connect to socket as client (without creation new socket)
All sockets i create with SockAddrInet 5000 0. Can it depends on addlress (maybe need 127.0.0.1 instead localhost?)

A: Perhaps you're looking for tupleToHostAddress, as in
connect sock_logger (SockAddrInet 5000 (tupleToHostAddress (127, 0, 0, 1)))

A: Thx Daniel Wagner, it's  really need to use tupleToHostAddress (127, 0, 0, 1) and listen ... is wrong. Right version:
  putStrLn "Create socket"
  sock_logger <- socket AF_INET Stream 0
  putStrLn "Bind socket"
  connect sock_logger (SockAddrInet 5000 (tupleToHostAddress (127, 0, 0, 1)))
  putStrLn "Connected to logger on port 5000..."


text:
Q: Error on installing C# Extension for VSCode I am trying to install the VSCode Extension C# for Visual Studio Code (powered by OmniSharp) without any success. In the Output tab of VSCode I am getting the following error:
Updating C# dependencies...
Platform: win32, x86_64

Downloading package 'OmniSharp for Windows (.NET 4.6 / x64)'    Retrying from 'https://omnisharpdownload.blob.core.windows.net/ext/omnisharp-win-x64-1.26.3.zip' Downloading package '.NET Core Debugger (Windows / x64)'   Retrying from 'https://vsdebugger.blob.core.windows.net/coreclr-debug-1-13-0/coreclr-debug-win7-x64.zip'
Installing package 'OmniSharp for Windows (.NET 4.6 / x64)'
Failed at stage: installPackages
Error: end of central directory record signature not found

Finished

A: According to the related issues I found on the omnisharp-vscode GitHub page here:

*

*Issue #1549

*Issue #1712
and knowing I am behind an enterprise proxy, I had to set the http.proxy setting in vscode like that in my vscode user settings:
{
    "http.proxy": "<my-proxy-uri>" // e.g. http://1.2.3.4:55,
}

A: Its always better to check why the download of omnisharp failed.

You can do check by switching the tab to Output and then changing the drop down menu to OmniSharp Log

For me the errors were different each time ,most of the time it was the corporate proxy and next time it was in-compatible c# extension with omnisharp being downloaded.
This issue occurs mainly because VS code is trying to download and install the file automatically which is prevented by corporate proxy.
To tackle the issue download the file manually by clicking on the errored link,
Close the Vs Code ,Manually extract the downloaded zip and paste in the location based on omnisharp log.
Now you must be good to go.


text:
Q: How can I integrate Admob mediation in an Adobe Air app? I want to use Admob mediation on an Air app.
Is there any ane for this or can I use any ane and then just change settings in Admob account ?
Thank you.

A: To integrate Admob in your AIR APP, you can use :
Free ANEs :

*

*admob-for-flash : https://github.com/lilili87222/admob-for-flash.

*Advertising-ANE : https://github.com/digicrafts/Advertising-ANE.
You can find some other projects on github.
Commercial ANEs :

*

*AdMob from milkmanplugins.com : ActionScript API, and how to use it here.

Hope that can help.

A: Are you mean https://github.com/monumentichb/Firebase-Admob-Mediation-ANE ?
Google Firebase Admob Mediation Ane provides as3 api for flex and flash developer to integrate admob,unityads,inmobi,chartboost,vunlge and gdt into adobe air ios and android app ,support banner Ad,Interstitial Ad,Native Express Ad and Video ,not need java or oc.Support banner,Intersitial,native express ads,Video


text:
Q: What is the Open Source CMS of choice? I've been told that Sitecore is the closed-source CMS of choice (due to its insane flexibility).
That said, what is the Open source equivalent? Or is there one? I've played with Drupal and it seems more of a blogging platform than a CMS. Do you have a different experience? Do you love a different CMS?

A: Despite not being familiar with Sitecore, I'm going to go out on a limb and suggest that Drupal is a pretty good match, exactly because it is insanely flexible.
When looking to migrate a church website from static HTML to a CMS platform, I downloaded and trialled over 50 different platforms. Took my weekends for several months- yeah, I'm a sucker for punishment! Most I could discard in less than half an hour - stability problems, lack of documentation, no community to speak of, and so on. Drupal was my final choice.
The default configuration of Drupal is blog-like, sure, but that seems to be mostly because that's a configuration new users understand and can use as a staring point for customisation.
A key ability that I like is the way that Drupal treats all content the same - allowing you to show multiple perspectives of the same content from different places within your site.
Some modules, such as CCK and Views, are so powerful as to require independent study in their own right. As you can guess, this is both a good thing and a bad one.
I'm a full time developer - but have almost never needed to crack the hood and worry about PHP code.
If you want a prepackaged solution with full support - something close to the closed-source model - check out Aquia Drupal, they offer a full installer and support with some stunning extras. (Clarification: Aquia's Drupal distribution is still GPL, so you can download and trial/use it for free. They just provide support and some network services as well).

A: I speak about Drupal because it's the only I know and use.
Drupal is a bit "programmer oriented". It's written in php, works mainly on mysql but you can hook ldap too.
Things are not exactly easy if you are not satisfied by what a module does and it takes a while even to be understood and used.
The good news is that Drupal has great community and a lot of good books/ebooks very usefull to learn it (http://www.packtpub.com/drupal-books)

A: Having investigated a number of Content Management Systems for several different projects, I must say that it depends.
The biggest challenge I experienced was matching the functionality provided by the hosting provider with the goals of the client. Basically, the client wanted a fancy new site but didn't want to pay significantly more for the needed hosted functionality.
That said, I have had good success using Drupal. I found it easy to administer, the designers were able to use the modules to deliver the functionality desired, most hosting plans included the PHP and SQL db functionality needed, and the end customer liked the results. Unfortunately, I have also been hit hard by XSS vulnerabilities

A: Joomla and Plone seem to belong on the list.
Drupal's out-of-the-box default setup is somewhat "bloggish", but it can be used as more of a straight CMS, and take into account that blog software is just CMS software designed for posting articles over time.

A: Joomla or Typo3 depending on how much time you have to learn to customize , Joomla is easier to learn , Drupal is good too there is alot of plugins to choose from. I really liked making typo3 websites after I got the hang of it, it has a great backend interface, good for organizations where there will be multiple website editors in different departments.

A: Plone
Because it`s secure, flexible, looks phantastic by default, has many additional modules and is written in python.

A: I think that Wordpress is the CMS of choice. Even though it is a "blogging" platform, the sheer volume of community contributions allows a wordpress site to achieve anything that "pure" cms solutions like Joomla can.
All that is needed is a  tweaked theme to leave out the blogging features such as comments if you don't want to use them.
An example of this is this non-blogging site of mine which runs on wordpress and was built from scratch. This one runs on a tweaked, out of the box theme that I modified the header graphic and removed comments, and we only use pages, not posts.

A: Plone is a really good CMS, with a fantastically friendly and helpful community. It works out of the box for small sites, it has a new tool called Deliverance that makes skinning it trivial, and it can be extended up to enterprise level, and is very flexible.
That said, obviously it depends on requirements. A lot. But as a safe bet to start with, Plone is good.

A: If you're looking for a very flexible (the only really flexible that I know) and robust CMS MODx is your choice. MODx have the thing that in my opinion is the most difficult thing to find in this kind of product: It is oriented to end users and also to developers.

A: I posted a little write up of CMS offerings in the .NET world:
http://blogs.conchango.com/howardvanrooijen/archive/2009/03/26/cms-in-the-net-world.aspx
Of the OS ones - Umbraco & N2CMS come out top - am actually using N2 on my current project and it's working out very well.

A: It really depends on the requirements of the individual project. For us, Umbraco (a .NET based CMS) turned out to be a good solution, as it's highly customizable and extendible. It's possible to develop the website or application completely in the browser (using razor) without any setup of development tools, but you can also develop with visual studio and deploy the CMS and your custom extensions yourself. They have a good community and lots of plugins available. You set up individual document types for every installation, therefore your users will only find input sections and options relevant to their site. I guess it's not the best solution if you're looking for a CMS with lots of templates and if you want to install and instantly run an out-of-the-box solution. There are a few starter kits available to do so, but it's not like joomla, wordpress, typo3, etc. where there are numerouse templates available.

A: Joomla! has a lot going for it. Having grown from Mambo, the number of very professional plug-ins and templates available is just staggering. It's easy to learn, and very customisable.
Although I personally don't care especially for PHP, credit where it's due: Joomla is a well designed, extensible framework.


text:
Q: Is there an introduction to uniform structures besides Bourbaki? Chapter 2 of Bourbaki's General Topology is the only introduction to uniform structures on topological spaces of which I am aware.
However, for me it is very time-consuming to extract any understanding at all from Bourbaki's writing. Because of this I would be very grateful for an introduction to the topic which is at a more elementary level, even though I understand that Bourbaki is the definitive reference.
Is there an introduction to uniform structures besides Bourbaki?

A: If you read German (as you can from the comments), Herrlich's 2 book series Topologie I (Topologische Räume), Topologie II (Uniforme Räume) are quite accessible, and have lots of exercises. You can use the first book to get acquainted with his terminology (which is sometimes non-standard) and the uniform spaces part start completely from scratch, connecting the notions to topological ones from book 1.
Also, James' book on Topologies and Uniformities (Springer Undergraduate series) is also pretty easy-going.
Warren Page's book on uniform structures is very oriented towards functional analysis and quite formal in its treatment; it covers topological groups and vector spaces quite early on, as well as Haar measure and function spaces. It's more of a reference book than James and Herrlich's (which are self study-able books)
Engelking (General Topology) has a chapter on uniform spaces as well. But that is pretty basic. Just to get the flavour, really, and see the connection to topologies. This from browsing my shelves.

A: Metric notions (such as  well-chainedness, completeness, precompactness,
and uniform continuity, for instance) can be best clarified and treated in relator spaces (X, Y)(Cal R) consisting of two sets X, Y and a family
Cal R of relations on  X to Y.
There, it turns out that connectedness and compactness are particular cases
of well-chainedness and precompactness. Moreover, convergent and Cauchy are
actually equivalent notions. Furthermore fat and dense sets are usually
more important than the open and closed ones.
And instead of continuities of functions it is better to define and
investigate those of relations and relators.
Unfortunately, the publications of our papers on relators are frequently
prevented by the leading topologists acting in editorial boards of various
journals. And we cannot even publish in the mathematical journals of Debrecen and Budapest.
Several authors study generalized topologies instead of generalized uniformities. Moreover, relators are also completely ignored by
the editors of the  Mathematical Subject Classification.


text:
Q: Ordering line segments consisting of two points How would I implement a operator< for line segments that consist of a start and a end Point. I want to insert the line segments into a map so the order doesn't need to be semantic, but it should work for all cases.

A: Order everything lexicographically:
struct Point { int x; int y; };

bool operator<(Point const & a, Point const & b)
{
    return (a.x < b.x) || (!(b.x < a.x) && (a.y < b.y));
}

Or use the ready made comparator from tuple:
#include <tuple>

// ...

return std::tie(a.x, a.y) < std::tie(b.x, b.y);

Or actually use a std::tuple<int, int> for your points and do nothing at all!
Then, do the same for the lines:
struct LineSegment { Point x; Point y; };

// repeat same code as above, e.g.

bool operator<(LineSegment const & a, LineSegment const & b)
{
    return std::tie(a.x, a.y) < std::tie(b.x, b.y);
}

To repeat, the no-work-at-all solution just uses tuples all the way:
typedef std::tuple<int, int> Point;
typedef std::tuple<Point, Point> LineSegment;
// everything "just works"


text:
Q: How to handle a list of S:3 objects in a for loop when making API calls I am trying to create a function which can return a data.frame consisting of data from various customers. This is done through an API call, but the challenge is to handle the data types that the API call returns. I have done this before for one customer at a time with no problem. But, things turn difficult when I want to loop over multiple customers.
The far from finished code looks like:
vClients = c("1234", "4321")

clientTransactions <- function(vClients) {

  #Create a vector of URL strings:
  urlClients = paste0("http:///api/clients/",vClients,"/transactions?")

  #Use the URLS in API calls to get data for each client

  for (i in 1:length(urlClients)) {

    getClients = httr::GET(urlClients[i], accept_json()) #Returns a list [10](S3:Response)
    getClients_content = httr::content(getClients[i], as = "text") #This step is wrong
    getClients_json = jsonlite::fromJSON(getClients_content[i]) #This is where i want to end up with a data.frame of data for each client

  }

}

Once again, I know the function is far from complete. But, in order for me to get any further I need to understand how to loop over the "getClients" object. If we look for a single customer we have:
getClients = paste0("http:///api/clients/1234/transactions?")
getClients_content = httr::GET(getClients, accept_json())
getClients_content

Response [http://api/clients/1234/transactions?]
  Date: 2022-02-16 10:02
  Status: 200
  Content-Type: application/json; charset=utf-8
  Size: 801 kB

But, when I try to do it for multiple web URLs in the urlClients it does not work. For example, if I write getClients[I] It just returns the web_url. Not the "response object".
So I guess my question is, how can I deal with this list of S:3 respones in my function and loop?
]
Any ideas or other thoughts would be much appreciated.


text:
Q: Error using Mads Kristensen's WebEssentials.AspNetCore.PWA with Razor I am trying to convert a website to a PWA (Progressive Web App) using Mads Kristensen's WebEssentials.AspNetCore.PWA.  When looking at the generated code with Chrome F12 Dev tools, the service worker and the web manifest are not found because the paths in the _Layout have an extra ~/ in them (an extra tilde & and extra slash).
I am developing using localhost and .NETCore 2.1. Is this particular package not compatible with localhost or .NET Core 2.1 or Razor?  I'm really stuck and would appreciate some help.  If I type the generated paths into the URL box manually I get 404s.  If I type them in without the extra ~/ if they are found.
I have determined 2 issues.
The WebEssentials.AspNetCore.PWA package injects 2 lines into _Layout.cshtml.  The first line, in the head, should be <link rel="manifest" href="/manifest.webmanifest">. Instead, in my configuration (localhost, Windows 10, Visual Studio 2017, ASP.NET Core 2.1, Razor Pages) it generates <link rel="manifest" href="~/manifest.webmanifest">.  See the extra ~ . This causes chrome to fail to locate the manifest.webmanifest.
The second line it injects, in html region, should be script nws-csp-add-nonce='true'>'serviceWorker' in navigator and navigator.serviceWorker.register('/serviceworker').  Instead it is injecting script nws-csp-add-nonce='true' 'serviceWorker' in navigator and navigator.serviceWorker.register('~/serviceworker').  Again, see the tilde. My question is what do I need to do to make it generate the code correctly? Is it because I am using .NET Core 2.1 instead of .NET Core 2.0 or is there something else I need to change? Thanks.

A: https://github.com/madskristensen/WebEssentials.AspNetCore.ServiceWorker/issues/36
appareantly ther is a bug, reverting back to  1.0.33, solved the problem.

A: Looks like you might be able to fix it yourself if you're so inclined.  I'm not sure what the intention of the change was, the commit said "added support when hosted in a virtual directory" but it just added those tilde's to the constants.
File: src/Constants.cs
internal class Constants
{
    public const string ServiceworkerRoute = "~/serviceworker";
    public const string Offlineroute = "~/offline.html";
    public const string DefaultCacheId = "v1.0";
    public const string WebManifestRoute = "/manifest.webmanifest";
    public const string WebManifestFileName = "manifest.json";
}

Change To:
internal class Constants
{
    public const string ServiceworkerRoute = "/serviceworker";
    public const string Offlineroute = "/offline.html";
    public const string DefaultCacheId = "v1.0";
    public const string WebManifestRoute = "/manifest.webmanifest";
    public const string WebManifestFileName = "manifest.json";
}


text:
Q: Can we create Cloud server in single Pc (for a learning purpose) I am M.Tech student and reading about cloud computing. I am good in .NET development.
I want to ask , can I create a cloud server in my winodws server 2008 PC for a learning purpose?
If so, how can I create a cloud server on Pc?
I want to develop program which is secure in a cloud. I also want to create a private cloud for my learnig purpose.

A: It is possible to run a 'cloud-in-a-box'. Both OpenStack and Apache CloudStack support this.
For OpenStack, use devstack. For CloudStack, use DevCloud
Apache CloudStack is available as a VirtualBox image, so you can just install VirtualBox on Windows, download the DevCloud image and start it. When you do, give the VirtualBox image as much memory as you can spare, and follow the DevCloud setup instructions carefully.  The instructions include some important network configuration steps.  If you experience problems, you can contact the user mailing list.

A: You can certainly use your PC to host virtual machines if this is what you mean. For example VMware have a free version of their hypervisor and Oracle have VirtualBox (inherited from SUN). More info at:

*

*http://www.vmware.com/products/vsphere-hypervisor/

*https://www.virtualbox.org
This would allow you experiment with some of the core technologies used to implement most public and private clouds.


text:
Q: How to play video in tkinter using Python VLC in mac OS? Can anyone show me a simple code of how to play a video using Python VLC package in mac operating system. I try to configure the sample script in tkvlc.py but it's so hard for me to understand. Please help me so that I can fix the issue on the project that I'm working now.
I want to have a simple code of how to play a video in mac OS using python VLC
Here's the code that I try to configure.
import sys
from ctypes import cdll, c_void_p
from os.path import join

import vlc
from tkinter import *
import tkinter as tk

root = Tk()
instance = vlc.Instance()
p = instance.media_player_new()

'''
FOR windows
'''
# p.set_hwnd(root.winfo_id())

'''
FOR MAC
'''

try:
    libtk = 'libtk%s.dylib' % (tk.TkVersion,)
    prefix = getattr(sys, 'base_prefix', sys.prefix)
    libtk = join(prefix, 'lib', libtk)
    dylib = cdll.LoadLibrary(libtk)
    # getNSView = dylib.TkMacOSXDrawableView is the
    # proper function to call, but that is non-public
    # (in Tk source file macosx/TkMacOSXSubwindows.c)
    # and dylib.TkMacOSXGetRootControl happens to call
    # dylib.TkMacOSXDrawableView and return the NSView
    _GetNSView = dylib.TkMacOSXGetRootControl
    # C signature: void *_GetNSView(void *drawable) to get
    # the Cocoa/Obj-C NSWindow.contentView attribute, the
    # drawable NSView object of the (drawable) NSWindow
    _GetNSView.restype = c_void_p
    _GetNSView.argtypes = c_void_p,
    del dylib

except (NameError, OSError):  # image or symbol not found
    def _GetNSView(unused):
        return None

    libtk = "N/A"

h = root.winfo_id()  # .winfo_visualid()?
# XXX 1) using the videopanel.winfo_id() handle
# causes the video to play in the entire panel on
# macOS, covering the buttons, sliders, etc.
# XXX 2) .winfo_id() to return NSView on macOS?

v = _GetNSView(h)

if v:
    p.set_nsobject(v)
else:
    p.set_xwindow(h)  # plays audio, no video

p.set_media(instance.media_new('1.mp4'))

p.play()
root.mainloop()

Here's the error :
[00007fc07bb3c6f0] main video output error: video output creation failed
[00007fc07d87c5e0] main decoder error: failed to create video output
[00007fc07d87c5e0] videotoolbox decoder: vt cvpx chroma: 420v
[00007fc07b7bdc70] macosx vout display error: No drawable-nsobject nor vout_window_t found, passing


text:
Q: how to apply deep-learning for UI test automation? Deep-learning is applied to play game in some projects, so it should make sense to apply it for UI test automation. Any comments on this idea?

A: In large software, it is really hard and time taking to test out all possible scenarios via traditional approach. So, building a machine learning model to do this is a neat idea. The end goal for such a system would be to crash to make the software unresponsive.
There is research being done on this idea. You should take a look at this research paper which explores Reinforcement Learning as an approach to automated GUI robustness testing. Reinforcement Learning is also one of the approaches used in teaching computers to play games.


text:
Q: validate form for dynamically created inputs count I am dynamically creating the inputs in the form
I want user to enter at least 'n' elements.

    <meta name="referrer" content="origin">

            <form name="simples" action="part.php" align="center" onsubmit="return validateForm()" method="POST">

                         Emotion <input type="text" value="" name="emotion" id="emotion" class="generatedEmotion" readonly>
                         <input type="hidden" value="" name="uniqueID" id="uniqueID">

                                <textarea rows="5" cols="50" readonly class="floating-box">
    John arrived at Sally's house to pick her up. John and Sally were going to a fancy restaurant that evening for a dinner. John was little nervous because he was going to ask Sally to marry him.</textarea>

                         <input type="button" value="Add connecting sentences" onClick="addInput('dynamicInput_1', 'myInputs_1');">

                <input type="submit" value="show me what is next">
                </form>

The method validateForm() works only if number text boxes are greater than equal to 2, for 0 and 1 it does not work.
Please not that this is minimal example, in real website, I have many such divs collecting input in multiple arrays, so I am summing them over something like:
var sum = parseInt(frm.elements['myInputs_1[]'].length) + parseInt(frm.elements['myInputs_2[]'].length) + parseInt(frm.elements['myInputs_3[]'].length)
but it may happen that few of the arrays are empty.
How do I check that collectively there are atleast n inputs?

A: frm.elements['myInputs_1[]'] has a different behavior for each of the cases.
for no elements entered, it will be undefined
for 1 element, it only contains that element, so it does not have a length
for two elements onwards it is an object of type RadioNodeList, which is inherited from NodeList and has a length attribute.
so the validate form method changes to:
function validateForm(){
    var frm = document.forms['simples'];
    ele = frm.elements['myInputs_1[]'];
    if(typeof ele === 'undefined'){
        alert('no element at all..');
        return false;
    }

    else if(ele.value == ""){
        if (ele.length < 4){
            alert("You must write at least 4 sentences ");
            return false;
        }
    }
    else{
        alert('contains one element');
        return false;
    }
    return true;
}

and it works!


text:
Q: how to get the left shift value in C? I have a question the following marco is defined:
TO_TI(a, b) ((b)<<13|(a))

then I call the following statement:
int c = TO_TI(1,2);

then I pass the result c to a function, in this function, how to based on the value c and input a calculate the value of b?

A: Given a and c you cannot (in general) compute b, because a and b were bitwise-OR'd together, and that's not reversible (again, in general).  Consider a=101 and b=1 with a shift of 2.  Then c=101 which is identical to if b=0.  There's simple no way to know.
If you were using XOR instead of OR, or you had some more information such as restrictions on the range of the values involved, we might make more progress.

A: Packing multiple integers into one larger integer is often a useful thing to do, and writing a macro is a good way to get it right (although I'd prefer an inline function, perhaps).
The key thing is that you have to know what you're doing! If you don't understand the underlying bit operations properly, or at least follow the rules, then you won't get back what you put in.
Your TO_TI macro will work fine provided that a is a positive integer that uses not more than 12 bits. b must not have more that 20 bits of data (assuming 32-bit words).
If a is unsigned it can be extracted like this:
unsigned int a = c & 0xFFF;

But, if a is signed then you have to "sign-extend" the value, like this:
int a = ((int)c << 20) >> 20;

Similarly, if b is signed it must be sign-extended, but that's easier:
int b = (int)c >> 12;

But, is b is unsigned you must be very careful not to sign-extend it:
unsigned int b = (unsigned int)c >> 12;

Finally, if you want to allow a to have negative values then you macro must be defined like this:
#define TO_TI(a, b) ((b)<<13|((a)&0xFFF))

(Otherwise the sign-bits of a will overwrite b.)
If you have three or more values encoded into the same integer then things get even more hairy. And beware of systems where int has 64-bits.
The rules:

*

*Understand what you want the bits to do.

*Understand what the bitwise operators do to signed and unsigned values.

*Test the boundary conditions carefully.

This is why bit-fields were invented and you should strongly consider using them.

A: If you are sure that a does not have one of bits except the first 12 bits set (then the | would destroy your information on b) you can use & and shift right to reverse the operation:
b = (c & ~a) >> 13

(The ~a is the bitwise negation of a)
Edit: Indeed is is not even necessary to do the & because by shifting right the lowest 12 bits will be shifted out...

A: The macro TO_TI is following an idiom to pack multiple values into bitfields. (It's also winking at you.)
b << 13 multiplies b by 213 = 8192. As long as a is at most 13 bits long, that is 0 <= a < 8192, you can recover it by taking the modulus with 8192. You don't need b to recover a… or vice versa.
The whole idea is that a and b should be easy to recover from the result of TO_TI, so the first thing would be to look at the source around that macro definition to find the macro which is supposed to reverse the process. Otherwise, c >> 13 should be sufficient to recover b.
It should be noted that both numbers must be positive and within the required ranges for this to work. If the author of TO_TI never mentioned that a cannot be greater than 8192, they were asleep at the wheel.

A: If I understand the question correctly, given c resulting from
c = b<<13 | a;

can we find out the original a and b?
It depends on

*

*the length (number of bits) of a: besides the problem above, if a msb (most significant bit) is 2^13 or more, the | operation will impact where b is after the shift (b << 13), and thus you cannot know if the c value from bit 13 is from the original b, or from a

*the length of b: shifting 13 bits is multiplying b by 2^13 (8192), and if b is originally big enough, after the shift it may overflow c, i.e. the result would not fit within c size (length), and the b retrieved from the method below would be less than the original b.
So, If a is smaller than 8192 (2^13) but positive (otherwise its msb would reach b shifted) and b shifted left 13 bits doesn't overflow c you can retrieve a and b, using
a = c & 8191; // 2^13 - 1 or 0x1fff in hexa
b = c >> 13;


text: Q: Keep getting "open in app" warning trying to open "about:blank" on page load When I open certain pages on my website (here is one example) inside my iOS app, I get the "Open in app?" warning but it wants to open "about:blank" (see below). Is there a reason it prompts for that? I'm wondering if scripts that load using the protocol-less style prompt in that way, e.g. <script src="//service.maxymiser.net..."/>


text:
Q: Font won't display in header for php include ![

Developing Software by Delacrank

][Screen Shot PhP and after]

.titlez {
    font-family: fantasy;
    font-size: xx-large;
    color: darkgreen;
    background-color: lightcyan;
}

#headz{
    text-align: center;
    margin-left: -2em;
    margin-right: -2em;
    padding-bottom: 1em;
    padding-top: 1em;
    background-color: black;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html;
 charset=utf-8" />
<title>Our first Website (Lists, Definitions and Tables)</title>
<link rel="stylesheet"
      type = "text/css"
      href="testcss.css">

<?php include('/Applications/XAMPP/xamppfiles/htdocs/includes/header.php'); ?>

Recently I decided to start using php to organize my website which consists of html files.  Currently, I am using xampp which comes with an apache server.  I added a .htaccess file to my server ('AddHandler application/x-httpd-php .htm .html') so that it can use the php scripts in my html files.
Everything seems fine, the problem is that when I add files from my includes folder the css styles which are linked to the html page work fine, except for the fonts. . .  I am not using any special fonts, the only font which displays seems to be courier by default, it won't display fantasy, times, arial, etc.
Am I missing something, please help.
I added the css file to the htdocs folder, its obviously locating it because the other styles work fine.  The includes file is in /applications/xampp/xamppfiles/htdocs/includes/.
I added a screen shot of the code, above is the include php, below is the same code without the php.  Everything is the same the only difference is the size of the font as well as the font family and font color, so nothing in the font is changed.

A: I solved the problem.  Turns out it was something very simple, I added
 tags when they didn't need to be added. meh.


text:
Q: Representation of Cyclic Group over Finite Field The post Irreducible representations of a cyclic group over a field of prime order discusses the irreducible representations of a cyclic group of order $N$ over a finite field $\mathbb{F}_p$ where $N$ does not divide $p$.
Where can I find information about the irreducible representations in the case where $p$ does divide $N$?
(I'm interested in this because I'm wondering if, given a finite dimensional vector space $\mathbb{F}_{p}^{M}$ if there are examples of particularly simple invertible linear operators $T$ such that $T$ does not preserve a subspace. Since the vector space contains finitely many elements it seems that this is the same thing as an irreducible representation of a cyclic group.
However, based on the post I read above, where p does not divide N, it seems like T is just multiplication by a primitive element that generates the extension $\mathbb{F}_{q^{M}}$.)

A: The question of how to classify all finite-dimensional representations of $C_n$ over an arbitrary field $F$ can be studied using the structure theorem for finitely-generated modules over a principal ideal domain, in this case $F[x]$. The structure theorem asserts that any finitely-generated module is uniquely a finite direct sum of modules of the form $F[x]/p(x)^r$ where $p \in F[x]$ is irreducible and $r$ is a non-negative integer.
If $T$ is an operator acting on $F^k$ for some $n$, then $F^k$ becomes a finitely-generated module over $F[x]$ with $x$ acting by $T$. $T$ gives a representation of the cyclic group $C_n$ if and only if $T^n = 1$, in which case the summands $F[x]/q(x)^r$ in the decomposition of $F^k$ must have the property that $q(x)^r | x^n - 1$.
If $F$ has characteristic $0$ or has characteristic $p$ and $p \nmid n$, then $x^n - 1$ is separable over $F$, hence $r \le 1$ and $F^k$ is a direct sum of irreducible representations, all of which are of the form $F[T]/q(T)$ where $q$ is an irreducible factor of $x^n - 1$ over $F$.
If $F$ has characteristic $p$ and $p | n$, then writing $n = p^s m$ where $p \nmid m$ we have
$$x^n - 1 = (x^m - 1)^{p^s}$$
from which it follows that $r \le p^s$ (but now it is possible to have $r > 1$). If $r > 1$, then the corresponding representation $F[T]/q(T)^r$ is indecomposable and not irreducible, where $q$ is an irreducible factor of $x^m - 1$ over $F$. The irreducible representations occur precisely when $r = 1$. In other words,

The irreducible representations of $C_{p^s m}$, where $p \nmid m$, over a field of characteristic $p$ all factor through the quotient $C_{p^s m} \to C_m$.

One can also see this more directly as follows. If $V$ is an irreducible representation of $C_{p^s m}$ over a field of characteristic $p$ and $T : V \to V$ is the action of a generator, then
$$T^{p^s m} - 1 = (T^m - 1)^{p^s} = 0.$$
Thus $T^m - 1$ is an intertwining operator which is not invertible, so by Schur's lemma it is equal to zero.

A: In general, if a finite group $G$ has a normal subgroup $U$ whose order is  power of a prime $p,$ and $G$ acts irreducibly on  finite dimensional vector space $V$ over a field $F$ of characteristic $p,$ then $U$ has a non-zero fixed vector on $V,$ while on the other hand, the fixed-point subspace $V^{U}$ of $U$ on $V$ is easily checked to be $G$-invariant, so we must have $V^{U} = V$ by irreducibility as $V^{U}$ is non-zero. This is a well-known fact, and a more general version of the remark at the end of Qiaochu's answer. The argument when $V$ has finite cardinality is easier considering orbit lengths on non-zero vectors. However, in general, to prove that $V^{U} \neq \{0 \}$ (without further assumption) we can proceed by induction on $|U|.$ The case that $U$ has order $p$ is just linear algebra, as a generator of $U$ has the eigenvalue $1$. If $|U| >p,$ let $Z$ be a subgroup of $Z(U)$ of order $p,$ which is possible as $Z(U) \neq 1$ (since $U$ is  $p$-group). If $Z \neq U,$ then we still have $Z \lhd U$ as $Z$ is characteristic in $U.$ By induction $V^{Z} = V,$ and then we can replace $G$ by $G/U$ and $U$ by $U/Z$ to obtain the desired inclusion by induction.


text:
Q: jQuery 1.9 doesn't bubble file select/change event in old Firefox As of jQuery 1.9, the file select change event doesn't bubble / propagate anymore in old Firefox.  It was fine in jQuery 1.8, but it stopped working in jQuery 1.9.
Here is an example:

    <input class="file_input" name="file" type="file" />

Here's a fiddle using jQuery 1.8 that demonstrates how I expect the behavior to work:
http://jsfiddle.net/UMxkt/
In all browsers (including Firefox 3.6), every time I select a file, the change event on the input[type=file] element bubbles.
Here's the same example using jQuery 1.9.  Using Firefox 3.6, the change event no longer bubbles.   It seems to work fine in Firefox 18+ though:
http://jsfiddle.net/UMxkt/1/
This leads me to 2 questions:
1) What version of Firefox does this stop working?
2) Is there a way around this problem?

A: i ran into this problem today and figured out that the way they detect browser features for change event bubbling is broken for older versions of firefox.  Bug 13609 was submitted and then closed because jQuery does not support old versions of firefox
Edit
after getting to work and testing with IE8 a bunch, i came up with the following as probably the most compatible solution. you can see my revisions to see how i ended up with this as my workaround. This should be executed after loading jQuery 1.9 and later

Fiddle: http://jsfiddle.net/UMxkt/14/

A: Interesting find,
As far as your first question, I don't know the answer, the only way I can think of to figure that out is to go through and try to find as many FireFox versions as possible testing to identify when the issue occurred.  Though I did find a Firefox version archive http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
If your .file_input element is not created dynamically you could do something like this:
$('.file_input').change(function(){
   $('.result').append('
file selected
');
});

I worked with the code for a while to see if I could come up with a work around that uses event delegation. I found that while .change does not work in firefox 3.6 and jQuery 1.9 .click however does.
I came up with the following:
var file = '';
var selected = false;
var tid;
function fileCheck() {
    if(file != $('.file_input').val())
    {
        file = $('.file_input').val();
        $('.result').append('
file selected
');
        selected = false;
        clearInterval(tid);
    }
}
$('.wrapper').on('click','.file_input',function(){
   clearInterval(tid);
   selected = true;
   tid = setInterval(fileCheck, 300);
});

Fiddle

Update
It seemingly does not work when referencing the file input by class or id using event delegation, but referencing it other ways works. Such as:
$('.wrapper input[type=file]').on('change', function() {
    $('.result').append('
file selected
');
});

A: Try with this code instead:
$('.wrapper input:first-child').on('change', function() {
$('.result').append('
file selected
');
});


text:
Q: if and elseif json, angular right now i'm trying to finish  a task in our project . to explain  the situation i have field with iteams im must choose an iteam then another field appear and must choose again other  elements. those  element i  want to send them using json
for exemple:
base:'the element of the first field'
headers:'the elements ot the  second field'.
when i use if and  else  if the operation stop after if and i dont know why.
this is the code i usedenter image description here.
thanks a lot of any help .

A: Actually you need to just to implement *ngIf Directory
Like I write example code below of button example
<input type="button" (click)="textBox=false">
<input type="text" placeholder="enter text" *ngIf="!textBox">

And if you again get problem after this code then please post sample code...
Thanks


text:
Q: How to do service request in background when app receives push notification iOS I want to do a service request in background when app receives push notification. I am able to get notifications in foreground and background, in foreground I am using below method to do the service request,
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
    completionHandler([.alert,.sound])
}

But in the background I am not getting how to do service request, the above method is not calling when app in background. How can I do this?

A: *

*Enable background mode for push notifications in the capabilities tab

*Implement the didReceiveRemoteNotification method and add your service request code there.

*Make sure the notification payload has "content-available": 1 for the silent push notification.
Thats it.


text:
Q: Why can't I call template class's function in declaration line? In my class assignment, I got a function call in the declaration line of a template class.
test.h
template <typename T, char N, char C, typename K>
class MyClass
{
    public:
    static const char* Get()
    {
    }
};

template <char N, char C>
class MyClass<std::string, N, C, char>
{
    private:
        std::string x;
    public:

    void setX(size_t t){
        x.resize(t);
    }

    void operator()(std::string y){
        setX(y.size());
        for (std::string::size_type i = 0; i < y.size(); i++) {
            x[i] = y[i];
        }
    }

    void print(){
        for(int i = 0; i < x.size(); i++){
            std::cout << x[i];
        }
    }
};

test.cpp
int main(){
    std::stringstream ss;
    ss << "Hello";
    MyClass<std::string, ' ', '*', char> tn( ss.str() ); <---- "This is where I got the error"
    tn.print();
};

I got a no matching function for call error, but if I do it like in the following, I got no error:
int main(){
    std::stringstream ss;
    ss << "Hello";
    MyClass<std::string, ' ', '*', char> tn;
    tn( ss.str() );
    tn.print();
};

Edit:
Here is the complete error output:
test.cpp: In function 'int main()':
test.cpp:15:52: error: no matching function for call to 'MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>::MyClass(std::__cxx11::basic_stringstream<char>::__string_type)'
  MyClass<std::string, ' ', '*', char> tn( ss.str() );
                                                    ^
In file included from test.cpp:4:0:
test.h:17:7: note: candidate: MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>::MyClass()
 class MyClass<std::string, N, C, char>
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test.h:17:7: note:   candidate expects 0 arguments, 1 provided
test.h:17:7: note: candidate: MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>::MyClass(const MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>&)
test.h:17:7: note:   no known conversion for argument 1 from 'std::__cxx11::basic_stringstream<char>::__string_type {aka std::__cxx11::basic_string<char>}' to 'const MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>&'
test.h:17:7: note: candidate: MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>::MyClass(MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>&&)
test.h:17:7: note:   no known conversion for argument 1 from 'std::__cxx11::basic_stringstream<char>::__string_type {aka std::__cxx11::basic_string<char>}' to 'MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>&&'

A: The error has nothing to do with templates. You'd get the same error if MyClass was not a template.
This
MyClass<std::string, ' ', '*', char> tn( ss.str() );

calls the constructor. MyClass<std::string,' ','*',char> has no matching constructor, hence the error.
This works for temporaries:
MyClass<std::string, ' ', '*', char>{}.operator()( ss.str() );

If you want to squezee everything in a single line, you could make operator() return a reference to *this. However, code does not get more readable by squeezing everything in a single line of code.

PS: The method mentioned in the error, eg here:
 candidate: MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>::MyClass()

is not MyClass::operator(). It is the constructor. If you cannot modify main you need to provide a constructor that takes a string as parameter. This is what the compiler is looking for when it complains here:
test.cpp:15:52: error: no matching function for call to 'MyClass<std::__cxx11::basic_string<char>, ' ', '*', char>::MyClass(std::__cxx11::basic_stringstream<char>::__string_type)'
  MyClass<std::string, ' ', '*', char> tn( ss.str() );
                                                    ^


text:
Q: AR images not working inside the WKWebView Here is the AR Quick Look website from Apple docs - https://developer.apple.com/augmented-reality/quick-look/
If I go to this website in the Safari browser on my iPhone 8, then everything is working correctly. I can tap any of the 3D model and place it inside the Augmented Reality.
However, if I view the same website in the WKWebView, then the AR models are not working correctly. I am not able to tap any model and place it inside the AR.
For the comparison I am attaching screenshots from the Safari browser and from the WKWebView
Safari

WKWebView

As you can see in WKWebView, the AR icon is not even showing up.
Does anyone knows why AR images are not working inside the WKWebView?
I will be very glad for any help.

A: I just found a tweet from 2018 suggesting that WKWebView does not support AR Quick Look. You can find it here. The WebKit website also suggests that.
Most probably SFSafariController should be used instead.


text:
Q: What is the sample variance-covariance matrix? This is a more succinct question from a previous post, but I have arrived at two different answers, and need help determining which - if either - is correct.
I start with a 4*3 matrix:
5  4  -1
2  3  -3
3  4  -4
1  3  -2

and I need to compute the variance-covariance matrix. I had originally tried:

*

*For the non-diagonals, calculate the covariance values using the formula:
$cov(x,y)=\frac{1}{n-1} \sum_{i=1}^n~(x_i- \overline{x} )*(y_i- \overline{y} )$

*For the diagonals, I caculate the variance values using the formula:
$var(x)=\frac{1}{n-1} \sum_{i=1}^n~(x_i- \overline{x} )^2$
which lead me to an "answer" of:
2.916  4.042  -1.458
4.042  0.333  -2.917
-1.458 -2.917  1.666

However, I tried to double-check this hand-done work using R, and wrote:
m  = matrix(c(5,2,3,1,4,3,4,3,-1,-3,-4,-2), nrow=4, ncol=3)
covM = cov(m, method = "pearson")

which lead to a different "answer" of:
2.916  0.833  0.833
0.833  0.333  0.000
0.833  0.000  1.666

So, it makes me wonder if I am using the wrong R function, or if I am using the wrong equations and calculations. Any ideas are greatly appreciated!!
Edit: What I am asking is, notice that the diagonal is the same for my hand calculation and R calculation. Only the off-diagonal is incorrect. For my hand calculation of the off-diagonals, I used the covariance equation I listed above (for my hand calculation of the diagonals, I used the varaince equation I listed above). The off-diagonal use of the covariance equation is what differs with the R output. So, am I using the correct equation? Many thanks!
Here is an example of how I got an off-diagonal value, and it was different than the same cell of the R output:
cov(1,2)=((5-2.75)(4-3.5)+(2-2.75)(3-3.5)+(3-2.75)(4-3.5)+(1-2.75)(3-3.5))/(4-1)=4.042

A: In general the R-result is ok. Your formulas for the estimated variance and covariance are looking fine, too. You have to show your calculations, so that someone can proof them.

A: The R output is correct. The reason for the diverging results must be a computation error when you calculated the cov by hand.
Also, one could use the following formula to compute the matrix by hand instead of computing each cov per variable:
$ S_{XY} = \frac{1}{n-1} ( \sum^n \textbf{x}_i\textbf{x}_j^T - n\bar{\textbf{x}}\bar{\textbf{x}}^T ) $,
where $n$ is the number of observations/rows and the sum is iterating over the 4 rows in you example.
This will yield the same as the R output when calculated by hand.


text:
Q: Can't connect to docker redis container from the host using StackExchange.Redis Not sure if it's the issue with connection string or my docker image. Running docker container ls I see
57cb0c982c76 redis "docker-entrypoint.s…" 0.0.0.0:32773->6379/tcp

The port seems to be mapped to the outside. I tried to run
docker run -d -P redis:alpine

with this and other different variations of parameters, and using StackExchange.Redis C# driver and it times out. Connection string looks like that:
localhost:6379,ssl=True,abortConnect=False

(no password). What am I doing wrong?
UPDATE
Tried with docker run -d -p 6379:6379/tcp redis (also redis:alpine). Still can't connect. docker inspect shows HostConfig:
        "PortBindings": {
            "6379/tcp": [
                {
                    "HostIp": "",
                    "HostPort": "6379"
                }
            ]
        }

A: Since you ran docker run -P (with a capital P), Docker picks a host port for every exposed port in the container.  Which port exactly is in the docker ps output: 0.0.0.0:32773->6379/tcp means Docker has picked port 32773, bound to all host interfaces, to forward to TCP port 6379.
This means your Redis client needs to connect to some IP address for the host, on the public-facing port 32773.  Changing 6379 to 32773 in your connection string should work.
It's more common to explicitly pick your own port; docker run -p 6379:6379 (lowercase p) would use the "normal" Redis port 6379 on the host to forward to the Redis port in the container.  The one downside is that this can fail if anything else is already using that port (a host Redis daemon, some other container).