text:
Q: É possivel realizar uma conexão com PostgreSQL via ODBC no Delphi 7? Estou tendo dificuldades para realizar a conexão com o banco de dados PostgreSQL no Delphi 7, consegui com o Zeos Lib, porém preciso que seja via dbExpress a conexão, então vi que nas versões mais atuais do Delphi é possível realizar a conexão via ODBC, porém o Delphi 7 não disponibiliza essa opção, será que tem algum componente que preciso adicionar para poder realizar tal conexão via ODBC no Delphi 7?

A: R. Santos para utilizar conexão ODBC é necessário que seja utilizado os componentes ADO, com ele é possível realizar a conexão por meio da lib odbc do PostgreSQL.
Para começar baixe a lib odbc do postgresql https://odbc.postgresql.org/
Em seguida adicione um componente ADOConnection no seu projeto e configure a propriedade ConnectionString selecionando o provider PostgreSQL OLE Provider e preenchendo as demais opções disponíveis para conexão com o banco de dados.
Feito isso ative o ADOConnection e coloque um ADODataSet, especifique o comando SQL e pode utilizar sozinho ou em conjunto ao dataset provider + clientdataset.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Application runs out of memory when started from another application, but not when launched from Visual Studio. Why? I have this console application that handles pretty much data, more specifically it manipulates large Bitmap objects.
When I launch the Console application through Visual Studio, everything works fine. If I launch it from another application through new Process(), the Console application runs into Out of memory exceptions (working with the same data that works well from Visual Studio), and some other GDI+ errors (but I am fairly sure these errors are the result of earlier out of memory exceptions).
I have checked that the Maximum working set of memory is the same when the Console application is run from Visual studio (vshost), and when it is run from another application.
So my question is: Why does this happen??
I can also mention that the Console application is multithreaded.


text:
Q: SPWeb = this.Web always points to Central Administration? I'm learning SharePoint 2010 and facing a strange problem :
I implement a custom action to add a ribbon button under Documents tab, this button has a command to  open a modal dialog in my site which is being located at http://sharepointserver/dev/ .
The Url parameter of showModalDialog function is pointed to my application page : test.aspx. The code of test.aspx.cs as below:
     ......................
     protected void Page_Load(object sender, EventArgs e)
    {
        SPWeb web = this.Web;
            try
            {
                SPList list = web.Lists[this.TargetListId];
                SPListItem item = list.GetItemById(this.TargetItemId);
            }
    }

My problem here is this.Web always points to http://sharepointserver, not my current site
http://sharepointserver/dev/. This results in list #notfound when I execute SPList list = web.Lists[this.TargetListId]
My Sharepoint project Site URL is http://sharepointserver/dev/ and Feature Scope is being set to Web so I don't know why this.Web doesn't want to give me the current site address. (SPContext.Current.Web also has a same problem)
Any help will be appreciated.

A: is the link to your application page pointing to http://sharepointserver/dev/_layouts/test.aspx
or
is the link to your application page pointing to http://sharepointserver/_layouts/test.aspx
It should be the first if is the second this will explain your problem.
if not then the question will be is dev/ as sub site or a managed path site collection ?

A: It is very strange that you cant use this:
 protected void Page_Load(object sender, EventArgs e)
{
        SPWeb web = SPContext.Current.Web;
        try
        {
            SPList list = web.Lists[this.TargetListId];
            SPListItem item = list.GetItemById(this.TargetItemId);
        }
        catch(exception a)
        {
        }
}

http://msdn.microsoft.com/en-gb/library/microsoft.sharepoint.spweb.aspx
but you can use this:
string url = HttpContext.Current.Request.Url
using (SPSite site = new SPSite(url))
{
    using (SPWeb web = site.OpenWeb())
    {
            try
            {
                SPList list = web.Lists[this.TargetListId];
                SPListItem item = list.GetItemById(this.TargetItemId);
            }
            catch(exception a)
            {
            }
    }
}

can you explain where your putting the code? as i can see page_load event (asp.net code behined) or webpart within feature or within feature reciver?
hope it helps :)

A: pls use like this for current web...
SPWeb spweb = SPContext.Current.Web;

or
using (SPSite spsite=new SPSite(SPContext.Current.Web.Url))
{
      using (SPWeb spweb=spsite.OpenWeb())
      {
          // you can access current spweb object
      }
}


text:
Q: Why do I get different output from within a java applet then from native java? I have the following class definition, which extends Applet:
public class TestApplet extends Applet {
  public static void main(String []argv) {
    TestApplet a = new TestApplet();
    InetAddress b = a.justATest();
    if (b != null) {
      System.out.println(b.getHostAddress());
    }
    if (a.hasError()) {
      System.out.println(a.getErrorTrace());
    }
  }

  public InetAddress justATest(String ip) {
    err = null;
    try {
      final DatagramChannel ch = DatagramChannel.open();
      final InetSocketAddress s = new InetSocketAddress(InetAddress.getByName(ip), 53);
      final InetSocketAddress c = new InetSocketAddress((InetAddress)null, 0);

      class testAction implements PrivilegedExceptionAction<Object> {
        public Object run() throws IOException {
          ch.bind(c);
          try {
            ch.connect(s);
          } catch (NoRouteToHostException ex) {
          }
          return null;
        }
      }

      testAction a = new testAction();
      try {
        AccessController.doPrivileged(a);
      } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof IOException) {
          throw (IOException)ex;
        } else {
          throw (RuntimeException)ex;
        }
      }
      return ((InetSocketAddress)ch.getLocalAddress()).getAddress();
    } catch (Exception ex) {
      err = ex;
      return null;
    }
  }
}

The code simply creates a DatagramSocket, binds and "connects" it, and then grabs the local address.  When I run the following on a command line, I get the following output:
$ java TestApplet 2001:db8::1
0:0:0:0:0:0:0:0
$ java TestApplet 192.0.2.1
192.168.1.3

This is expected behavior.  192.168.1.3 is my own address.  The ANY IPv6 address (0:0:0:0:0:0:0:0) is expected because I don't currently have IPv6 access.
Now, when I run the code from a browser with the following code:
function deployApplet() {
  dtjava.embed({
      id: 'test-applet',
      url: 'testapplet.jnlp',
      width: 1,
      height: 1,
      placeholder: "appletPlaceholder",
    },
    {},
    {
      onJavascriptReady: function(id) {
        var applet = document.getElementById(id);
        var addr;
        addr = applet.justATest("192.0.2.1");
        if (addr != null) {
          console.log(addr.getHostAddress());
        }
        if (applet.hasError()) {
          console.log(applet.getErrorTrace());
        }
        addr = applet.justATest("2620:db8::1");
        if (addr != null) {
          console.log(addr.getHostAddress());
        }
        if (applet.hasError()) {
          console.log(applet.getErrorTrace());
        }
      },
    }
  );
}
dtjava.addOnloadCallback(deployApplet);

The jar file from which the applet is running is signed, and I have the following in the jnlp file:
<security>
  <all-permissions />
</security>

Without those provisions (and the doPrivileged() wrapper included in the code) I would get a permissions failure.
Now, I run that in the browser and get the following output in the Web console:
127.0.0.1
127.0.0.1

Any reason why I would get different output when running from the browser environment that from command line?
Note that other than the output of getLocalAddress(), the channel appears to behave as expected.  I use this code in a less simplified context to send DNS queries, and there are no other issues (that I can see).  The communication, including connect(), read(), and write() calls, works just fine in the applet.

A: Apparently calling getLocalAddress() on a DatagramChannel also requires being in a privileged block of code.  The behavior is somewhat misleading, as other cases in which there are insufficient permissions to run something in an applet, AccessControlException is thrown, but in this case 127.0.0.1 is returned when getLocalAddress() is called from an applet outside a doPrivileged() block.
So, to fix the code in the original question, the call to getLocalAddress() is simply added to the doPrivileged block.  The justATest() definition is as follows:
  public InetAddress justATest(String ip) {
    err = null;
    try {
      final DatagramChannel ch = DatagramChannel.open();
      final InetSocketAddress s = new InetSocketAddress(InetAddress.getByName(ip), 53);
      final InetSocketAddress c = new InetSocketAddress((InetAddress)null, 0);

      class testAction implements PrivilegedExceptionAction<InetSocketAddress> {
        public InetSocketAddress run() throws IOException {
          ch.bind(c);
          try {
            ch.connect(s);
          } catch (NoRouteToHostException ex) {
          }
          return ((InetSocketAddress)ch.getLocalAddress());
        }
      }

      testAction a = new testAction();
      try {
        return AccessController.doPrivileged(a).getAddress();
      } catch (PrivilegedActionException pae) {
        Exception ex = pae.getException();
        if (ex instanceof IOException) {
          throw (IOException)ex;
        } else {
          throw (RuntimeException)ex;
        }
      }
    } catch (Exception ex) {
      err = ex;
      return null;
    }
  }


text:
Q: Why does the negative sign arise in this thermodynamic relation? I can't understand why $\left(\frac{\partial P}{\partial V} \right)_T=-\left(\frac{\partial P}{\partial T} \right)_V\left(\frac{\partial T}{\partial V}\right)_P$. Why does the negative sign arise? I can easily write $\left(\frac{\partial P}{\partial V}\right)_T=\left(\frac{\partial P}{\partial T}\right)_V\left(\frac{\partial T}{\partial V}\right)_P$ from the rule of partial derivative, but what's the negative sign for?

A: As others have said, this is simply the triple product rule.
It is relatively simple to understand how the minus sign comes about. Suppose you have a fixed amount of money, and you allocate $x$, $y$, and $z$ dollars to three things. Then $(\partial x / \partial y)|_z$ is clearly $-1$, because if you keep $z$ constant, then you need to remove one dollar from $y$ to add one dollar to $x$. Similarly, $(\partial y / \partial z)|_x = (\partial z / \partial x)|_y = -1$, and the product of all three is thus $(-1)^3 = -1$. Note how the total money constraint on the three variables is crucial. In thermodynamics, the constraint between $P$, $V$, and $T$ is provided by an equation of state, such as the ideal gas law.

A: This is not a simple application of partial derivatives, since the variables that are being held constant vary here, but an instance of the triple product rule, which says that for any three quantities $x,y,z$ depending on each other, the relation
$$ \left(\frac{\partial x}{\partial y}\right)_z\left(\frac{\partial y}{\partial z} \right)_x\left(\frac{\partial z}{\partial x}\right)_y = -1$$
holds.

A: This all starts from the basic relationship $$dP=\left(\frac{\partial P}{\partial T}\right)_VdT+\left(\frac{\partial P}{\partial V}\right)_TdV$$Since, at constant pressure, dP=0, if we solve for dT/dV at constant pressure, we obtain:
$$\left(\frac{\partial T}{\partial V}\right)_P=-\frac{\left(\frac{\partial P}{\partial V}\right)_T}{\left(\frac{\partial P}{\partial T}\right)_V}$$

A: Other answers have given the mathematical reasons, but as these are physical functions it's always nice to relate back to physical intuition.
Thinking of an ordinary substance – a lump of "stuff", doesn't matter whether it's a solid or a gas or whatever – if you decrease the volume available to it, the pressure should go up. In fact that is exactly how we physically put a sample under pressure. So the left-hand side should be negative.
On the other hand, if you increase the temperature (usually) the pressure should increase at constant volume, or alternatively the volume should increase at constant pressure.1 So both of the factors on the right-hand side should be positive.2
So we had better include a minus sign, to at least get the signs to match on both sides of the equation.

*

*If you're thinking about a material with negative thermal expansion, then both of these factors should instead be negative, but again the right-hand side of the equation ends up positive.

*To be precise, I have used another identity here: that $(\partial T/\partial V)_P = (\partial V/\partial T)_P^{-1}$.


text:
Q: huawei dongle E8231 support ubuntu 14.04 I bought a Huawei wi-fi dongle but I can't connect it. Please help me install this Huawei dongle in Ubuntu 14.04. Is a driver needed for it?
It is a Huawei Power-Fi E8231:
http://www.huaweidevice.co.in/?q=huawei-power-fi-e8231


text:
Q: Using a foursquare Callback within an HTML5 Android application I am creating a mobile application for Android using HTML5 with PhoneGap and Eclipse. I want my application to be able to check-in, but I dont know how to return it to the application with the Callback URL.

A: You'll either need to have the user authorize your app to check-in on their behalf (https://developer.foursquare.com/overview/auth) or send them to the foursquare app using the proper intent (https://developer.foursquare.com/resources/client). If sending them to the app, there's no way to send a "callback" to take them back to your html5 app though.


text:
Q: How can I get Auth.currentAuthenticatedUser() with amplify and Microsoft OAuth after successfully authenticated? My applications should login with Microsoft account (OAuth Provider). I got stuck to get user info after successfully authenticated.
I'm using two authentication types ( login-password and login with azure) , My shema.graphQl is with authorisation rules private , and I can get Auth.currentAuthenticatedUser() with login password, but when I choose the microsoft authentication I get the access token and the redirection passed successfully , but Auth.currentAuthenticatedUser() doesn't return user info, so I can't call the graphQls APIs!
shema.graphQl
type User @model @searchable @auth(rules: [{allow: private}]) {
  id: ID! @primaryKey
  name: String!
  email: String!
  points: Int!
  phone: String!
}

Login with Microsoft
https://test-auth-ino.auth.eu-central-2.amazoncognito.com/oauth2/authorize?identity_provider=MyOrganisationProviderAzure&redirect_uri=https://feature-test-auth0.abcdefghijk.amplifyapp.com/auth/login.auth.eu-central-2.amazoncognito.com/saml2/idpresponse&response_type=token&client_id=45dffffffd5fdf5e45ee87s&scope=email
result after redirection :
https://feature-test-auth0.abcdefghijk.amplifyapp.com/auth/login.auth.eu-central-2.amazoncognito.com/saml2/idpresponse#access_token=eyJraWQiOiJFS1daODd3WffVJWQ1gwXC9kVklZSVo5eUdwaGdkcFwvb3BcL3ZySjhqcDhlcW1jPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiI5NGYxYWRlNS1jN2ExLTQ5ZTYtOGRmNi0zMjBmZDE5YjI3NWQiLCJ0b2tlbl91rzerzerezc3MiLCJzY29wZSI6ImVtYWlsIiwiYXV0aF90aW1lIjoxNjUzNTYwMDUyLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAuZXUtY2VudHJhbC0xLmFtYXpvbmF3cy5jb21cL2V1LWNlbnRyYWwtMV9aWjMySHNYQ2UiLCJleHAiOjE2NTM1NzerzerezrjM2NTIsImlhdCI6MTY1MzU2MDA1MiwidmVyc2lvbiI6MiwianRpIjoiOWE0NjNhMjQtNmI0Zi00YTgyLWI0ZDYtMTYxODQzMX2lkIjoiNTFtamg1cjYszerezrezrxNW1oZzBiNXI5ODJhbnY0diIsInVzZXJuYW1lIjoibXlvcmdhbmlzYXRpb25wcm92aWRlcmF6dXJlX21vdW5pci5sYXphckBmaW5kbC5sdSJ9.jw8zbgpctZPcdv6D6wo-qGKHG08HF31cq1G93whmly1CSSURi03nLOPma2xiy1t-wxSMlIDNr4ABcb8-IMqTnngZ4E4EAXnzKuxzhRJona2pV9ECl_EhROiq_aU6A72sbFz_B7u-FBRSR6De-uU3VO4lPC2DN5I3Ric7i4avxbvBUJ3DP6wq_UEqa3KPuoxi4A53P8y7Ovn3w1VGsaOOrLqelQ68Tn6bE_HCA6M23PZqF4fosjDmf_mnXrJ09bjXUVt6leQnYfQvCnvNTSXldHWtpCwMC6Gjab4NeTy8Urd0wY2GOXdES71tBDwf25zN3QbYpkPno-u1i1ryoGBW0Q&token_type=Bearer&expires_in=3600

A: •   I would suggest you to please enable the setting for bypasscache:true by modifying the code for amplify as below: -
 Auth.currentAuthenticatedUser({ bypassCache: true}).then(
 (user: CognitoUser) => this.setUser(user),
  _err => {
 console.error(_err)
 this._authState.next(initialAuthState)
 }

As per above, the first instruction in setUser might be localstorage.clear() which got removed by the above command post which you should be able to get user info with Microsoft authentication.
•   Once the above has been done successfully, then you can surely get the user info as follows which can further be passed on to the graphQI APIs: -
function getUser() {
return Auth.currentAuthenticatedUser()
  .then(userData => userData)
  .catch(() => console.log('Not signed in'));
 }

function getSessionInfo() {
Auth.currentSession().then(res=>{
  debugger
  let access_token = res.getAccessToken()
  let id_token = res.getIdToken()
  let refresh_token = res.getRefreshToken();

  setAccessToken(access_token);
  setIdToken(id_token);
  })
  }

For more information regarding this, kindly refer to the documentation link below for amplify: -
https://docs.amplify.aws/lib/auth/manageusers/q/platform/js/#retrieve-current-authenticated-user
https://github.com/aws-amplify/amplify-js/issues/5167


text:
Q: Distributing $n$ identical item to $k$ groups, each group must have at least one item The problem is formulated as distributing $n$ pennies to $k$ children and each child is guaranteed at least one penny. The theorem is given as $\binom{n-1}{k-1}$ but I don't understand this theorem. The explanation is pretty brief.
My thought was that we take $k$ pennies from $n$, and distribute the pennies to each group. So now we are left with $n-k$ pennies, and distribute $n-k$ pennies to $k$ children so the answer is $\binom{n-k}{k}$ ways to distribute them.
What am I missing here?

A: This is the stars and bars problem.
The idea is that we can line the children's pennies up with each child's pennies together like this
$$\begin{array}{ccc|cc|cccc|c}
\circ & \circ & \circ & \circ & \circ & \circ & \circ & \circ & \circ & \circ \end{array}$$
Where the first group belongs to the first child, the second group belongs to the second child and so on.
Then each child has a penny since each child gets at least one penny, so consider the first penny for each child (numbered below).
$$\begin{array}{ccc|cc|cccc|c}
1 & \circ & \circ &
2 & \circ &
3 & \circ & \circ & \circ &
4 \end{array}$$
Notice that in order to divide all these pennies, it is sufficient to pick which penny is each child's first penny and give them all the pennies from that point to the next penny picked. i.e. we can go from this picture:
$$\begin{array}{cccccccccc}
1 & \circ & \circ &
2 & \circ &
3 & \circ & \circ & \circ &
4 \end{array}$$
to this picture:
$$\begin{array}{ccc|cc|cccc|c}
1 & \circ & \circ &
2 & \circ &
3 & \circ & \circ & \circ &
4 \end{array}$$
Note that the first child always has the first penny in the line, but then we are free to choose the other $k-1$ children's first pennies from the $n-1$ remaining pennies. This gives $\binom{n-1}{k-1}$ ways to distribute the pennies.


text:
Q: VBA - The code to complete 0 is missing after converting a file to csv format I have 2 commands to add 0 to number (8 digits, 9 digits required), and 0 addition to cell phone numbers (9 digits beginning with 5 digits need to be 10 digits):
1.Add 0 to 8 digits :
Sub Add_Zeros()
    Selection.NumberFormat = "@"
    For Each CL In Selection.Cells
        If CL <> "" Then CL.Value = Application.Rept("0", (9 - Len(CL))) & CL
    Next
End Sub

2.Add 0 to 9 digits :
Sub Add_Zeros()
    Selection.NumberFormat = "@"
    For Each CL In Selection.Cells
        If CL <> "" Then CL.Value = Application.Rept("0", (10 - Len(CL))) & CL
    Next
End Sub

**1.**First, can I upgrade these codes and combine them as follows?:
A.The first condition: If there are only 8 digits you will add 0 at the beginning (Finally there should be 9 digits)
B.The second condition: If there are 9 digits and the first digit on the left is 5 you add 0 at the beginning (Finally there should be 10 digits)
C.Something else how do I return the command back (ie before the change) to cancel? Do you have a way to insert this into another code?
**2.**In addition, I'm looking for a way to run a code (if it's a VBA or something else) that will convert my Xltm file (after running all the commands) to a .csv file and save me the 0 (zeros) I add.
That the final code for converting the file would be built like this:
A. Make Xltm for csv and keep me the 0 (zero) according to the following law (which is the way to keep the zeros):
1.Click on Data Tab | From Text
2.Select the Csv from the file slection dialog box
3.In text Import Wizard (STEP 1), select 'Delimited' and hit next.
4.In text Import Wizard (STEP 2), select 'Comma' and hit next.
5.In text Import Wizard (STEP 3), select all columns and click on 'text' in the 'column data format'
6.Click finish
7.Select the cell where you want to import the data and click 'ok'
B. After that save me the file as Xlsx.
*C.If you can add another action in the code that also:
Change the extension of the Xlsx again to csv, it is excellent (not save as csv but only change the extension of the file)
The file is attached Link :
Work file
(check that extension Xltm)
Thanks in advance,
Blessed be from heaven

A: Regarding question 1:
I'm not following your explanation fully, but this will hopefully get you started:
Sub Add_Zeros()
    Selection.NumberFormat = "@"
    For Each CL In Selection.Cells
        If CL <> "" Then CL.Value = ZeroPad(CL) ' Move the logic to a function for better readability
    Next
End Sub

Function ZeroPad(Value)
    ZeroPad = Value ' Make sure you have a return value
    If Len(Value) <= 8 Then 'Pad with zeroes up to 9 chars
        ZeroPad = Right("000000000" & Value, 9)
    End If
    If Left(Value, "5") Then ' I didn't understand your question here. Just guessing
        ZeroPad = Right("000000000" & Value, 10)
    End If
End Function

Regarding question 2:
As it is currently worded, it is not a question for StackOverFlow. I suggest you remove that part and have a look at https://stackoverflow.com/help/mcve


text:
Q: How to use transpose function (t) to transpose rows by hours of day (0 to 23)? I want to transpose hours of day (0 to 23) on each rows of each subjects( i have 21 subjects)
I use to create two data frame: test and teste. Then i use two loops to transpose all (0,1,2,3 to 23) of each subject. But my code is so bad that i can't find expect result.
test=data.frame(1:24,t(0:23))
teste=data.frame(1:21,t(0:23))

for(i in 1:21){
  for(j in 1:24){
    test[j,]=t(data_temps_All1[j,])
    j=j+1
  }
  teste[i,]= test[j,]
  i=i+1
}

i want to have:
first row: 0 ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
second row: 0 ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
---
21 row: 0 ,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
This is my data set:
structure(list(hour = c(0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L,
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,
23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L,
3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L,
17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 17L, 18L, 19L, 20L,
21L, 22L, 23L, 16L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L,
11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L,
0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,
18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 6L,
0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,
18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L,
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,
18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L,
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,
18L, 19L, 20L, 21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
21L, 22L, 23L, 0L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L)), row.names = c(NA,
-504L), class = c("data.table", "data.frame"))

A: Since you have only one column you could unlist the data convert it into matrix with required dimension and change it to data frame / data.table
data.frame(matrix(unlist(df), ncol = 24, byrow = TRUE))

A: Don't know what is your application, but isn't this the data.frame you wish to have
data.frame(1:21, t(0:23)[rep(1, 21), ])


text:
Q: Getting Error(42,1): PLS-00103: Encountered the symbol "END" on PlSQL code. Using sql developer.  I am a newbie to PLSQl.  I have tried a lot of the solutions that have been suggested and a bunch that have not been suggested. Seems like I either get the "end" or "Begin" PLS-00103 error.  Below is the code.  Thanks in advance for any help - greatly appreciate it.
CREATE OR REPLACE PROCEDURE PROCEDURE1
(
       category_id in Messages.category_id%type,
       messagetext in Messages.messagetext%type,
       lastupdatedBy in Messages.lastupdatedBy%type,
       message_id out Messages.message_id%type,
       txtcomment out varchar2)
as
BEGIN
  Declare  uniquecategoryid number := 0;
  uniquemsgid number := 0;
    BEGIN
        -- verify that category id is a valid category
     SELECT Categories.category_id
           INTO uniquecategoryid
           FROM Categories
           WHERE  Categories.category_id = PROCEDURE1.category_id;
    EXCEPTION
     WHEN NO_DATA_FOUND THEN
     uniquecategoryid := 0;
    END;

     BEGIN
      SELECT message_id into uniquemsgid
            FROM Messages
            where Messages.messagetext = PROCEDURE1.messagetext
            AND uniquecategoryid > 0;
     EXCEPTION
       WHEN NO_DATA_FOUND THEN
       uniquecategoryid := 0;
    END;

     Begin
      INSERT INTO Messages (CATEGORY_ID, messagetext, lastupdatedby, lastupdated, status)
            VALUES (PROCEDURE1.category_id, PROCEDURE1.messagetext,
                  PROCEDURE1.lastupdatedBy, SYSDATE,'A')
            returning Messages.message_id INTO PROCEDURE1.message_id;
      COMMIT;
      PROCEDURE1.txtcomment := 'SUCCESS';
    end;
END;
END PROCEDURE1;

A: Remove the END; stated above END PROCEDURE1;. The code understands the end of procedure block by END PROCEDURE1;. END; is useless in this case.


text:
Q: Como chamar um método do CODEIGNITER numa view TWIG Bom estou iniciando a jornada num projeto, oferecido pela minha Escola, para ganhar experiência na área de programação, entrei no meio dele, e estou com alguns problemas de executar tarefas simples. Então estou tentando executar uma método, que depende de dados preenchidos na view, porém não faço a mínima ideia de como fazer tal ato.
o Código a view:
{% for post in posts %}

                        {{ post['data'] }}

{{ post['titulo']|e }}

{{ post['descricao']|e }}

                        {{ post[''] }} Likes
//AVISO AQUI EM CIMA É O LOCAL ONDE DEVERIA SER PREECHIDO COM A QUANTIDADE DE CURTIDAS //

                         {{ "%s %s"|format(post['nome'], post['ultimo_nome']) }}

 {% endfor %}

O método:
 public function countCurtidas($idpost){
        return ($this->db->query("SELECT COUNT(id_curtida) as curtidas FROM curtida WHERE id_post = $idpost")->row_array());
    }

Então para executar esse método preciso do id_post fornecido da view para logo em seguida já preencher com a quantidade de curtidas que esse post possui. Lembrando que a view é um template TWIG e estou usando o CODEIGNITER.

A: Você pode chamar o método countCurtidas dentro do método que busca pelos posts e carrega a view e passar esse número por pârametro para view assim como os posts, ou também pode realizar uma chamada ajax para o método countCurtidas, passando o id_post como pârametro.


text:
Q: AngularJS ng-repeat for dynamic child json array I'm having a dynamic JSON, which contains the list of name, it also contains the children names as a subset. How can I show it in the HTML UI using angularJS ng-repeat
The Sample Dynamic JSON is
$scope.family = [
   {
      "name":"Siva",
      "child":[
         {
            "name":"Suriya"
         },
         {
            "name":"Karthick"
         }
      ]
   },
   {
      "name":"Kumar",
      "child":[
         {
            "name":"Rajini"
         },
         {
            "name":"Kamal"
         },
         {
            "name":"Ajith"
         }
      ]
   },
   {
      "name":"Samer"
   },
   {
      "name":"Mahesh"
   }
];

Note: The JSON is generated based on Request. The Child array is
  Optional and it may contain the length 'n'

A: You can better your answer by adding an ng-if directive, as the child is optional. Of course, it won't make any impact to you app, but it is a good way to code.
Plus, instead of adding ng-repeat on ul, it should be in li. It makes no sense in looping the ul for a single list.
Please refer the sample here.
HTML:

            {{member.name}}
             0">

{{c.name}}

JS:
var app = angular.module('app', []);

app.controller('test', function ($scope) {
    $scope.family = [
       {
           "name": "Siva",
           "child": [
              {
                  "name": "Suriya"
              },
              {
                  "name": "Karthick"
              }
           ]
       },
       {
           "name": "Kumar",
           "child": [
              {
                  "name": "Rajini"
              },
              {
                  "name": "Kamal"
              },
              {
                  "name": "Ajith"
              }
           ]
       },
       {
           "name": "Samer"
       },
       {
           "name": "Mahesh"
       }
    ];
});

A: The Corrected answer

{{member.name}}


text:
Q: how to run tensorflow lite movenet lightning model with flutter? TFLite (movenet/multipose/lightning/tflite/float16)
I have loaded the model successfully but whenever I tried to run it... it just crashes the
app.
here is the code for loading and running the model:
 Future loadModel() async {
try {
  res = await Tflite.loadModel(
    model:
    "assets/lite-model_movenet_multipose_lightning_tflite_float16_1.tflite",
  );
  print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> model loaded: " + res.toString());
} catch (e) {
  print(e);
  print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Failed to load model.');
} }

  Future poseNet(File image) async {
int startTime = new DateTime.now().millisecondsSinceEpoch;

var output = await Tflite.runPoseNetOnImage(
  threshold: 0.7,
  path: image.path,
  numResults: 5,
  nmsRadius: 15
);

print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> recognitions: ${output}');

setState(() {
  _recognitions = output!;
});
int endTime = new DateTime.now().millisecondsSinceEpoch;
print(
    ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Inference took ${endTime - startTime}ms ");}

here are the logs:
I/tflite  (11904): Initialized TensorFlow Lite runtime.
I/flutter (11904): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> model loaded: success
W/System  (11904): A resource failed to call close.
D/EGL_emulation(11904): eglCreateContext: 0xead612c0: maj 2 min 0 rcv 2
E/flutter (11904): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(Failed to run model, length=3; index=3, java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
E/flutter (11904):  at sq.flutter.tflite.TflitePlugin.initPoseNet(TflitePlugin.java:1262)
E/flutter (11904):  at sq.flutter.tflite.TflitePlugin$RunPoseNet.<init>(TflitePlugin.java:1290)
E/flutter (11904):  at sq.flutter.tflite.TflitePlugin.runPoseNetOnImage(TflitePlugin.java:1217)
E/flutter (11904):  at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:179)
E/flutter (11904):  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (11904):  at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/flutter (11904):  at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/flutter (11904):  at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$6ZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown Source:12)
E/flutter (11904):  at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (11904):  at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (11904):  at android.os.Looper.loop(Looper.java:223)
E/flutter (11904):  at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (11904):  at java.lang.reflect.Method.invoke(Native Method)
E/flutter (11904):  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (11904):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (11904): , null)
E/flutter (11904): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (11904): #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904): #2      Tflite.runPoseNetOnImage (package:tflite/tflite.dart:350:12)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904): #3      _SelectImageState.poseNet (package:model_ui/main/select_image.dart:105:18)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904):

any help will be appreciated!
thank you!

A: I'm not an expert. But tflite plugin is out of date. You should try your luck with the tflite_flutter, which is also a bit outdated. But worked for me.


text:
Q: the triangle inscribed in a circle with maximum area If $r$ is the  radius of the circle, $\Delta{ABC}$ a triangle inscribed in it and  $x,y,z$ are  the angles at $A,B,C$ then how to find the triangle that has the  maximum area.
In my book it's mentioned that the
area$=\frac12ab \sin z$ where $a,b$ are the sides opposite to $A,B$, also $a=2r\sin z, b=2r\sin z .$
Can anyone tell me how to find expression for $a,b$ and the  area mentioned above?

A: If $x$, $y$ and $z$ are given then $$S_{\Delta ABC}=2r^2\sin{x}\sin{y}\sin{z}$$ if it's not so,
we'll get much interesting problem.
Let $a$, $b$ and $c$ be sides-lengths of the triangle.
For $a=b=c$ we have $r=\frac{a}{\sqrt3}$ and $$S_{\Delta ABC}=\frac{a^2\sqrt3}{4}=\frac{3\sqrt3}{4}r^2.$$
We'll prove that $$S_{\Delta ABC}\leq\frac{3\sqrt3}{4}r^2.$$
Indeed, since $$S_{\Delta ABC}=\sqrt{p(p-a)(p-b)(p-c)}=\frac{1}{4}\sqrt{\sum\limits_{cyc}(2a^2b^2-a^4)}$$ and
$$S_{\Delta ABC}=\frac{abc}{4r},$$ we need to prove that
$$\frac{1}{4}\sqrt{\sum\limits_{cyc}(2a^2b^2-a^4)}\leq\frac{3\sqrt3}{4}\frac{a^2b^2c^2}{16\left(\frac{1}{4}\sqrt{\sum\limits_{cyc}(2a^2b^2-a^4)}\right)^2}$$ or
$$\left(\sqrt{\sum\limits_{cyc}(2a^2b^2-a^4)}\right)^3\leq3\sqrt3a^2b^2c^2$$ or
$$\sum\limits_{cyc}(2a^2b^2-a^4)\leq3\sqrt[3]{a^4b^4c^4}$$ or
$$\sum_{cyc}(a^4+\sqrt[3]{a^4b^4c^4}-2a^2b^2)\geq0.$$
Now, let $a^2=x^3$, $b^2=y^3$ and $c^2=z^3$.
Hence, we need to prove that
$$\sum_{cyc}(x^6+x^2y^2z^2-2x^3y^3)\geq0,$$
which follows from Schur: $\sum_{cyc}(x^6-x^4y^2-x^4z^2+x^2y^2z^2)\geq0.$
Indeed, by Schur we obtain:
$$\sum_{cyc}(x^6+x^2y^2x^2-2x^3y^3)\geq\sum_{cyc}(x^4y^2+x^4z^2-2x^3y^3)=\sum_{cyc}x^2y^2(x-y)^2\geq0$$
and we are done!

A: I would think of it without trigonometry and calculus: If the triangle has maximum area, then we can't make the area larger by moving a single corner.
Pick one side of the triangle as base (rotate the circle so that the base is horizontal for clearer view). Then the largest area you can get is by putting the point opposite the base as far away from from the base as possible. This happens to be halfway along the longest arc between the end points of the base. In other words, the opposite point must be exactly in the middle of the two end points of the base for the area to be maximal.
Now, if the triangle is not equilateral, there is at least one point which is not in the middle of the two others, so we can increase the area of the triangle. An equilateral triangle is the only one which cannot be increased this way, so it must be maximal.
To find the area of an equilateral triangle inscribed in a circle, the height of the triangle is $\frac32r$. This is because in an equilateral triangle, heights, medians and side bisectors coincide, and we know that

*

*The center of the circumcircle of a triangle is where the side bisetors intersect

*The medians partition one another in segmenst of ratio $2:1$

*The $2$ part of the medians is the radius in the circle, so its length is $r$

Now you have an equilateral triangle where you know the height is $\frac32r$, so you can work out that the side length is $\sqrt3r$, which gives the triangle an area of $\frac{3\sqrt3}2r^2$.

A: HINT
First, I suppose only $r$ is given, otherwise it doesn't make much sense.
Since $S_{\Delta ABC}=2r^2\sin{x}\sin{y}\sin{z}$, we'll have to find the maximum of $X = \sin{x}\sin{y}\sin{z}$. Now, let's fix $z$. Then $X=\frac {\cos(x - y) - \cos(x + y)}{2}\sin z$. Since $z$ it's fixed, $x + y$ is fixed and $X$ will reach a maximum when $\cos(x - y)$ reaches a maximum, that is when $x=y$

A: The maximum area will be for an equilateral triangle. Draw a radial line from each vertex to the circle's centre, to make three isosceles triangles. The central angle $θ$ is 120 degrees or 2π/3 radians. The area of each triangle is $\frac {r^2\sinθ}{2}$ and the whole area will be 3 times that.
Edit after a comment from @miracle173.
Why is it an equilateral triangle? Consider such an inscribed triangle with one vertex centrally at the top and a horizontal base line. The area of a triangle is height * base / 2. Now, if you move the top vertex either way, the height decreases and the base remains the same, so the area decreases.
The side lengths $a$ and $b$ can also be found from simple trigonometry
$a=b=2r\sin(θ/2)$


text:
Q: Cannot launch inkscape and w3m with same error message "Wrong __data_start/_end pair" On Ubuntu 19.04 x86_64, I cannot launch inkscape due to the following error message.
% inkscape
Wrong __data_start/_end pair
[1]    XXXX abort      inkscape

The same issue arises with w3m.
% w3m
Wrong __data_start/_end pair
[1]    XXXX abort      w3m

I tried the reinstallation ("apt purge inkscape && apt install inkscape") but still see the same error message.
How can I resolve this issue?

I found a solution by myself.
The zsh built-in command "unlimit" written in my .zshrc was the cause of this issue.
Removing "unlimit" from .zshrc, inkscape and w3m can be launched normally now.
Strictly speaking, "unlimit stacksize" seems to be the root cause.

A: The questioner solved their own question:

I found a solution by myself. The zsh built-in command "unlimit" written in my .zshrc was the cause of this issue. Removing "unlimit" from .zshrc, inkscape and w3m can be launched normally now. Strictly speaking, "unlimit stacksize" seems to be the root cause.


text:
Q: image with link and keep it centered Hi I am trying to add an image with a link and keep it centered and my code isn't working can you help?

A: Just add some style to change  from inline element to block element and use margin to center it.
For example

img {
  display: block;
  margin: 0 auto;
}

Hope this might help you


text:
Q: Como definir uma variável na configuração de um Virtual Host, para evitar repetição? Eu sempre fico chateado quando vejo que meu virtualhost acaba sendo configurado dessa forma:
<VirtualHost :80>

    ServerName meusite.local
    ServerAlias www.meusite.local

    DocumentRoot /var/www/meusite/public

    ErrorLog /var/www/meusite/__apache__.log

</VirtualHost>

Note que eu repeti o /var/www/meusite/ duas vezes ali e, considerando que eu pudesse ter mais configurações que usasse essa mesma pasta raiz, poderia ser um saco fazer isso.
Eu queria saber se tem alguma forma de salvar essa /var/www/meusite numa variável e usá-la, concatenando com /public e __apache__.log, por exemplo.
Existe alguma maneira de fazer isso?

A: No Core do apache existe o Define, conforme a documentação: https://httpd.apache.org/docs/2.4/mod/core.html#Define
É usado para definir variáveis
Define root_dir /var/www/meusite

<VirtualHost :80>
    ServerName meusite.local
    ServerAlias www.meusite.local

    DocumentRoot ${root_dir}/public

    ErrorLog ${root_dir}/__apache__.log
</VirtualHost>

Em multiplos hosts:
Define root_dir1 /var/www/meusite1
Define root_dir2 /var/www/meusite2

<VirtualHost meusite1.local:80>
    ServerAlias www.meusite2.local

    DocumentRoot ${root_dir1}/public

    ErrorLog ${root_dir1}/__apache__.log
</VirtualHost>

<VirtualHost meusite2.local:80>
    ServerAlias www.meusite2.local

    DocumentRoot ${root_dir2}/public

    ErrorLog ${root_dir2}/__apache__.log
</VirtualHost>

Vale notar que se você usa muitos "includes" talvez volta e meia possa acidentalmente acabar conflintando, e incluir algo duas vezes, neste caso você pode usar o <IfDefined> para checar se um arquivo ou se uma variavel já foi definida
<IfDefine !FOO>
Include Foo.config
</IfDefine>

Neste exemplo claro que dentro de Foo.config deve existir algo como:
Define FOO valor

Além de definir é possivel remover uma variavel, assim:
<IfDefine FOO>
UnDefine FOO
</IfDefine>

É bom ressaltar este trecho da documentação:

Virtual Host scope and pitfalls
While this directive is supported in virtual host context, the changes
  it makes are visible to any later configuration directives, beyond any
  enclosing virtual host.

Traduzindo:

O escopo do Virtual Host e sua armadilhas
Embora essa diretiva seja suportada no contexto do Virtual Host, as alterações feitas são visíveis para qualquer outra diretiva de configuração posterior, além de qualquer outro Virtual Host incluído.

A: Pode utilizar a directiva Define
Ver documento em https://httpd.apache.org/docs/2.4/mod/core.html#define
Define pasta /var/www/meusite/

<VirtualHost :80>

    ServerName meusite.local
    ServerAlias www.meusite.local

    DocumentRoot ${pasta}public

    ErrorLog ${pasta}__apache__.log

</VirtualHost>


text:
Q: Node JS with Cronjob: Screen terminates when detached, but I want to have it run indefinitely I'm using terminal with node.js, and the screen keeps terminating. I'm not sure what is happening, but I would love for the script to run every day, not terminate when I detach.
In terminal, I run: screen node server.js
server.js contains:
var cronJob = cron.job('06 17 * * *', function(){
// do things
});
cronJob.start();

//  send Responses
var cronJob2 = cron.job('04 19 * * *', function(){
// do other things
});
cronJob2.start();

var cronJob3 = cron.job('06 19 * * *', function(){
// do other things
});
cronJob3.start();

var cronJob4 = cron.job('05 17 * * *', function(){
// do other things
});
cronJob4.start();

A: You may like to nohup to detached from terminal as following
nohup node server.js > /dev/null 2>&1 &

and you may check running
ps aux | grep node

I hope this will help you :)


text:
Q: Loop for Python code that simulates/automates keyboard presses. How do I allow it to continuously loop without breaking once CTRL C is pressed? SO basically I wrote this very basic code that will be used to automate a labour intensive part of my job. This involves copying and pasting lines from an excel file by shift clicking down 6 times, copying, alt tabbing to SAP, pasting, shift F1 to add more search lines, and then alt tabbing back to excel (BEGIN LOOPING HERE) where ill have to click down 6 times AND THEN shift click down 7 times, copy, alt tab, paste, shift F1, alt tab.
I have the basic code for the key presses in but cannot figure out how to loop. Can someone help out?
from pynput.keyboard import Key, Controller
import time

keyboard = Controller()

time.sleep(5)

#Shift click down 6 total items
keyboard.press(Key.shift)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.release(Key.shift)

time.sleep(0.25)
#Copy 7 seleced cells
keyboard.press(Key.ctrl)
keyboard.press('c')
keyboard.release(Key.ctrl)

time.sleep(0.25)
#switch tabs (to SAP from Excel)
keyboard.press(Key.alt)
keyboard.press(Key.tab)
keyboard.release(Key.alt)
keyboard.release(Key.tab)

time.sleep(0.25)
#Paste 7 selected cells onto SAP
keyboard.press(Key.ctrl)
keyboard.press('v')
keyboard.release(Key.ctrl)

#Allow for further cells to be added to search "shift F1"
keyboard.press(Key.shift)
keyboard.press(Key.F1)
keyboard.release(Key.shift)
keyboard.release(Key.F1)

time.sleep(0.25)
#switch tabs (Back to Excel from SAP)
keyboard.press(Key.alt)
keyboard.press(Key.tab)
keyboard.release(Key.alt)
keyboard.release(Key.tab)

#BEGIN LOOP HERE
#Shift click down 13 total items
#this first part is to get back to the end of the first row of selected cells
keyboard.press(Key.shift)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)

#this part is to start selecting new cells to be copied and pasted
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.press(Key.down)
keyboard.release(Key.down)
keyboard.release(Key.shift)

time.sleep(0.25)
#Copy 7 seleced cells
keyboard.press(Key.ctrl)
keyboard.press('c')
keyboard.release(Key.ctrl)

time.sleep(0.25)
#switch tabs (to SAP from Excel)
keyboard.press(Key.alt)
keyboard.press(Key.tab)
keyboard.release(Key.alt)
keyboard.release(Key.tab)

time.sleep(0.25)
#Paste 7 selected cells onto SAP
keyboard.press(Key.ctrl)
keyboard.press('v')
keyboard.release(Key.ctrl)

#Allow for further cells to be added to search "shift F1"
keyboard.press(Key.shift)
keyboard.press(Key.F1)
keyboard.release(Key.shift)
keyboard.release(Key.F1)

time.sleep(0.25)
#switch tabs (Back to Excel from SAP)
keyboard.press(Key.alt)
keyboard.press(Key.tab)
keyboard.release(Key.alt)
keyboard.release(Key.tab)

#END LOOP HERE


text:
Q: read entire binary file into an array in single call c++ I am trying to read a binary file into an array of structure
struct FeaturePoint
{
  FeaturePoint (const int & _cluster_id,
            const float _x,
            const float _y,
            const float _a,
            const float _b
            ) : cluster_id (_cluster_id), x(_x), y(_y), a(_a), b(_b) {}
  FeaturePoint (){}
  int cluster_id;
  float x;
  float y;
  float a;
  float b;
};

The code below works but does this one element at a time, by pushing each new element onto an array
void LoadImageFeaturesFromBinaryFile(const char * FileName, std::vector<FeaturePoint>& features )
{
  char strInputPath[200];
  strcpy (strInputPath,"/mnt/imagesearch/tests/");
  strcat (strInputPath,FileName);
  strcat (strInputPath,".bin");
  features.clear();
  ifstream::pos_type size;
  ifstream file (strInputPath, ios::in|ios::binary|ios::ate);
  if (file.is_open())
  {
    size = file.tellg();
    cout<< "this file size is : "<<size<<" for "<<strInputPath<<" " <<sizeof( FeaturePoint )<<endl;
    file.seekg (0, ios::beg);
    while (!file.eof())
    {
      try
      {
        FeaturePoint fp;
        file.read( reinterpret_cast<char*>(&fp), sizeof( FeaturePoint ) );
        features.push_back(fp);

      }
      catch (int e)
      { cout << "An exception occurred. Exception Nr. " << e << endl; }
    }

    sort (features.begin(), features.begin()+features.size(),CompareClusterIndexes);
    file.close();
  }
}

I want to speed it up by reading the entire array in at once, which I think should look something like the following
    void LoadImageFeaturesFromBinaryFile(const char * FileName, std::vector<FeaturePoint>& features )
{
  char strInputPath[200];
  strcpy (strInputPath,"/mnt/imagesearch/tests/");
  strcat (strInputPath,FileName);
  strcat (strInputPath,".bin");
  features.clear();
  ifstream::pos_type size;
  ifstream file (strInputPath, ios::in|ios::binary|ios::ate);
  if (file.is_open())
  {
    size = file.tellg();
    file.seekg (0, ios::beg);
    features.reserve( size/sizeof( FeaturePoint ));
    try
    {
      file.read( reinterpret_cast<char*>(&features),  size );
    }
    catch (int e)
    { cout << "An exception occurred. Exception Nr. " << e << endl; }

    sort (features.begin(), features.begin()+features.size(),CompareClusterIndexes);
    file.close();
  }
  else cout << strInputPath<< " Unable to open file for Binary read"<<endl;
}

But the read is causing a seg fault, how do I fix this?

A: This is wrong:
features.reserve( size/sizeof( FeaturePoint ));

You're about to read data into the vector, you should resize it, not just reserve, like this:
features.resize( size/sizeof( FeaturePoint ));

This also is wrong:
file.read( reinterpret_cast<char*>(&features),  size );

You're not writing over the vector's data there, you're overwriting the structure itself, along with who knows what else.  It should be this:
file.read( reinterpret_cast<char*>(&features[0]),  size );

Like Nemo said though, this is unlikely to improve your performance.

A: Your features has type is an std::vector and you casing it to char. Type vector is not an array.

A: I think you want
file.read( reinterpret_cast<char*>(&features[0]),  size );

You also need to make certain that size is a multiple of sizeof(FeaturePoint).  Otherwise, you will read slightly too much.


text:
Q: MongoDB query from Mongoid criteria object Is there a method in Criteria that will print the actual MongoDB query that criteria is generating?

A: If you inspect Mongoid Criteria instance, you will see "selector" which maps (essentially) directly to the MongoDB selector.  However Mongoid Criteria can be chained and are evaluated lazily, so the result of chaining and lazy evaluation is not available until you do an actual DB operation.  So if you want to see the final result, you should look in the appropriate log.  For a test, this is log/test.log, for "rails c" console, this is log/development.log -- this is standard.

A: Add the Criteria to a Query, and then you can see it with toString().
Query query = new Query();
query.addCriteria(criteria);
query.toString();


text:
Q: What episode of The Fairly OddParents did Cosmo say "three rights make a left"? The IMDB quotes page for The Fairly OddParents has the following quote:

Wanda : Two wrongs don't make a right.
Cosmo : But three rights make a left, and now it's time for the show!

I believe the quote was near the end of an episode and was followed by Cosmo dancing and singing "La Cucaracha" before Wanda blasted him with a hose. What episode of The Fairly OddParents is that quote/scene from?

A: This is from The Switch Glitch

Wanda then tells Timmy that two wrongs don't make a right (meaning
that everything he put Vicky through made him just as horrible as
her), but Cosmo jokingly says "Three rights make a left, and now, it's
time for the show!" Wanda, tired of his lackluster rendition of "La
Cucaracha", turns into a fire hose and blasts him again.


text:
Q: How to clear cookies and close a window, triggered by the laptop's lid being closed? I need a program that can automatically clear the cookies and close the window once I close the lid of my laptop.

*

*This program should only delete the cookie data of one specific website (Not all).

*It should close the window after it clears the cookies.

*It only should work at specific times of the day. (My laptop's time is always wrong so it should use the universal time to ensure it closes at the right time.)

I'm trying to achieve a program that will log me out of a website when I close the lid.
Note: This is not a website that logs users out when they close the lid, this is a program that logs the user out of the wanted website when the lid is closed.


text:
Q: Navigation drawer Recycler View null pointer Exception I am working with recycleView as per material design tutorial,I have done all accordingly but my logCat says:
E/AndroidRuntime: FATAL EXCEPTION: main Process: com.portal.college.myapplication, PID: 6541 java.lang.NullPointerException
 at android.support.v7.widget.RecyclerView$Adapter.createViewHolder(RecyclerView.java:5229)
 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4453)
 at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
 at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
 at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
 at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
 at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
 at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
 at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:1067)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
 at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
 at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
 at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
 at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
 at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
 at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
 at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
 at android.view.View.layout(View.java:14817)
 at android.view.ViewGroup.layout(ViewGroup.java:4631)
 at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1983)
 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1740)
 at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
 at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
 at android.view.Choreographer.doCallbacks(Choreographer.java:574)
 at android.view.Choreographer.doFrame(Choreographer.java:544)
 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
 at android.os.Handler.handleCallback(Handler.java:733)
 at android.os.Handler.dispatchMessage(Handler.java:95)
 at android.os.Looper.loop(Looper.java:136)
 at android.app.ActivityThread.main(ActivityThread.java:5001)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:515)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
 at dalvik.system.NativeStart.main(Native Method)

main_layout.xml
 <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="7dp">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <include
            android:id="@+id/app_bar"
            layout="@layout/app_bar_main"  />
   </LinearLayout>
    <fragment
        android:id="@+id/fragment_navigation_drawer"
        android:layout_width="280dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:layout="@layout/fragment_navigation_drawer"
        android:name="com.portal.college.myapplication.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer"
        />
</android.support.v4.widget.DrawerLayout>

fragment layout xml file is:
fragment_navigation_drawer.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#8c8c8c"
tools:context="com.portal.college.myapplication.NavigationDrawerFragment">

<include
    android:id="@+id/nav_head"
    layout="@layout/nav_header_main"  />
<android.support.v7.widget.RecyclerView
    android:id="@+id/drawerList"
    android:layout_width="match_parent"

    android:layout_height="wrap_content"
    >
</android.support.v7.widget.RecyclerView>

</RelativeLayout>

Now MainActivity.java
 package com.portal.college.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {
private RecyclerView recyclerView;
    private Toolbar toolbar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
        NavigationDrawerFragment drawerFragment = (NavigationDrawerFragment)
                getSupportFragmentManager().findFragmentById(R.id.fragment_navigation_drawer);

        drawerFragment.setUp((DrawerLayout) findViewById(R.id.drawer_layout),toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

    }

    @Override
    public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (drawer.isDrawerOpen(GravityCompat.START)) {
            drawer.closeDrawer(GravityCompat.START);
        } else {
            super.onBackPressed();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        if(id == R.id.action_settings) {
            return true;
        }
        if(id == R.id.search) {
             startActivity(new Intent(this, SearchActivity.class));
        }

        return super.onOptionsItemSelected(item);

    }

    @SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }
}

NavigationDrawerFragment.java
package com.portal.college.myapplication;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.v7.widget.Toolbar;

import java.util.ArrayList;
import java.util.List;

    public class NavigationDrawerFragment extends Fragment {
        private ActionBarDrawerToggle mDrawerToggle;
        private DrawerLayout mDrawerLayout;
        private RecyclerView recyclerView;
    private VivzAdapter adapter;
        public NavigationDrawerFragment() {
            // Required empty public constructor
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            // Inflate the layout for this fragment
            View layout = inflater.inflate(R.layout.fragment_navigation_drawer,container,false);
            recyclerView = (RecyclerView) layout.findViewById(R.id.drawerList);
            adapter = new VivzAdapter(getActivity(),getData());

            recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
            recyclerView.setAdapter(adapter);
            return layout;
        }
        public static List<Information> getData(){
            List<Information> data = new ArrayList<>();
            int icons[] = {
                    R.drawable.ic_menu_camera,
                    R.drawable.ic_menu_gallery,
                    R.drawable.ic_menu_manage,
                    R.drawable.ic_menu_send};
            String[] title = {"Camera","Gallery","Settings","Send"};
            for(int i=0;i<title.length && i<icons.length;i++){
                Information current = new Information();
                current.iconId = icons[i];
                current.title = title[i];
                data.add(current);
            }
            return data;

        }

        public void setUp(DrawerLayout drawerLayout,Toolbar toolbar) {
            mDrawerLayout = drawerLayout;
            mDrawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close){
                public void onDrawerOpened(View drawerView){
                    super.onDrawerOpened(drawerView);

                    }
                public void onDrawerClosed(View drawerView){
                    super.onDrawerClosed(drawerView);

                }

            };
            mDrawerLayout.setDrawerListener(mDrawerToggle);
            mDrawerLayout.post(new Runnable() {

                @Override
                public void run() {
                    mDrawerToggle.syncState();
                }
            });
          /*  containerView = getActivity().findViewById(fragment_id);
            mDrawerLayout=drawerLayout;
            mDrawerToggle = new ActionBarDrawerToggle(getActivity(), drawerLayout, toolbar, R.string.open_drawer,R.string.close_drawer){
                @SuppressLint("NewApi")
                public void onDrawerOpened(View drawerView){
                    super.onDrawerOpened(drawerView);
                     if(!mUserLearnedDrawer){
                         mUserLearnedDrawer = false;
                         saveToPreferences(getActivity(),KEY_USER_LEARNED_DRAWER, mUserLearnedDrawer+"");
                     }
                     getActivity().invalidateOptionsMenu();
                     */
                }

    }

Adapter class is VivzAdapter.cjava
    package com.portal.college.myapplication;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.Collections;
import java.util.List;

/**
 * Created by admin on 08-Feb-16.
 */
public class VivzAdapter extends RecyclerView.Adapter<VivzAdapter.MyViewHolder>{
    private final LayoutInflater inflater;
    List<Information> data = Collections.emptyList();

    public VivzAdapter(Context context,List<Information> data){
    inflater=LayoutInflater.from(context);
        this.data=data;
}
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.custom_row,parent,false);
        MyViewHolder holder = new MyViewHolder(view);
        return null;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
Information current = data.get(position);
        holder.title.setText(current.title);
        holder.id.setImageResource(current.iconId);
    }

    @Override
    public int getItemCount() {

            return data.size();

    }
class MyViewHolder extends RecyclerView.ViewHolder{
    TextView title;
    ImageView id;

    public MyViewHolder(View itemView) {
        super(itemView);
        title = (TextView) itemView.findViewById(R.id.listText);
        id = (ImageView) itemView.findViewById(R.id.listIcon);
    }
}
}

The list Item class is Information.java
  package com.portal.college.myapplication;

/**
 * Created by admin on 08-Feb-16.
 */
public class Information {
    int iconId;
    String title;
}

List Row layout is custom_row.xml
    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="match_parent"
    android:layout_height="match_parent">
<ImageView
    android:id="@+id/listIcon"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_menu_camera"/>
    <TextView
        android:id="@+id/listText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Camera"
        />
         </LinearLayout>

I have gone through most of the solution on stackoverflow which are regarding the same issue, but I failed here.
One thing I noticed that in VivzAdapter.java, the function name getItemCount() which is getting the data Count return the data.size(), when I change it to return 0 it works by without recyclerView, but when returned with data.size(), it gives NullPointerException.
Hope I have explained everything in detail.
Any advice would be really appreciated

A: In your VivzAdapter.java you are returning null instead of your created ViewHolder.
change it to
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = inflater.inflate(R.layout.custom_row,parent,false);
    MyViewHolder holder = new MyViewHolder(view);
    return holder;
}

then it should work

A: Your VivzAdapter.java is returning null ,Because of what at the run time it throwing out the null pointer exception there.
    package com.portal.college.myapplication;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.Collections;
import java.util.List;

/**
 * Created by admin on 08-Feb-16.
 */
public class VivzAdapter extends RecyclerView.Adapter<VivzAdapter.MyViewHolder>{
    private final LayoutInflater inflater;
    List<Information> data = Collections.emptyList();

    public VivzAdapter(Context context,List<Information> data){
    inflater=LayoutInflater.from(context);
        this.data=data;
}
    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.custom_row,parent,false);
        MyViewHolder holder = new MyViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
Information current = data.get(position);
        holder.title.setText(current.title);
        holder.id.setImageResource(current.iconId);
    }

    @Override
    public int getItemCount() {

            return data.size();

    }
class MyViewHolder extends RecyclerView.ViewHolder{
    TextView title;
    ImageView id;

    public MyViewHolder(View itemView) {
        super(itemView);
        title = (TextView) itemView.findViewById(R.id.listText);
        id = (ImageView) itemView.findViewById(R.id.listIcon);
    }
}
}

above code might solve the issue.


text:
Q: Roslyn CompletionService does not infer type for implicit foreach variable I'm using Roslyn's CompletionService for autocomplete functionality in my app, that allows users to write and execute c# scripts.
When writing an expression such as (pipe denotes the caret position):
var m = Selected.Measure;
m.|

Roslyn is perfectly able to infer that m is a variable of the same type as the Measure property, and it suggests all of its properties, methods, etc. for autocomplete, as expected.
However, in the following expression, where Measures is an IEnumerable<Measure>:
foreach(var m in Selected.Measures)
{
    m.|
}

...the Roslyn CompletionService does not provide any suggestions. Specifically, this code returns 0 CompletionItems:
sourceText = SourceText.From(text);
document = document.WithText(sourceText);
var completionService = CompletionService.GetService(document);
return await completionService.GetCompletionsAsync(document, position).ConfigureAwait(false);

Am I missing some configuration of the CompletionService or the MefHostService in order to allow type inference of implicit foreach variables (which is something that Visual Studio seems to do just fine)?
I'm using the following code to configure Roslyn:
var assemblies = new List<Assembly>(MefHostServices.DefaultAssemblies);
assemblies.Add(typeof(ScriptEngine).Assembly); // This is the assembly that contains the Selected class, the Measure class, etc.
var host = MefHostServices.Create(assemblies);
this.workspace = new AdhocWorkspace(host);

var compilationOptions = new CSharpCompilationOptions(
    OutputKind.DynamicallyLinkedLibrary,
    usings: new[] { "System" })
    .WithUsings(ScriptEngine.DefaultUsings);
var scriptProjectInfo = ProjectInfo.Create(ProjectId.CreateNewId(),
    VersionStamp.Create(), "Script", "Script",
    LanguageNames.CSharp, isSubmission: true, hostObjectType: typeof(ScriptHost))
    .WithMetadataReferences(new[] {
        MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
        MetadataReference.CreateFromFile(typeof(ScriptEngine).Assembly.Location
    })
    .WithParseOptions(new CSharpParseOptions(LanguageVersion.Latest, kind: SourceCodeKind.Script))
    .WithCompilationOptions(compilationOptions);

sourceText = SourceText.From("");
var scriptProject = workspace.AddProject(scriptProjectInfo);
var scriptDocumentInfo = DocumentInfo.Create(
    DocumentId.CreateNewId(scriptProject.Id), "Script",
    sourceCodeKind: SourceCodeKind.Script,
    loader: TextLoader.From(TextAndVersion.Create(sourceText, VersionStamp.Create())));
document = workspace.AddDocument(scriptDocumentInfo);

A: When providing MetadataReferences to Roslyn, we must explicitly provide transient dependencies. It is not enough to pass a reference to the typeof(object).Assembly.
Replacing this code:
.WithMetadataReferences(new[] {
    MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
    MetadataReference.CreateFromFile(typeof(ScriptEngine).Assembly.Location
})

with:
var metadataReferences = ((String)AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES")).Split(Path.PathSeparator)
    .Select(l => MetadataReference.CreateFromFile(l)).ToList();
metadataReferences.Add(MetadataReference.CreateFromFile(typeof(ScriptEngine).Assembly.Location));
// ...
.WithMetadataReferences(metadataReferences)

did the trick!
See also:

*

*https://github.com/dotnet/roslyn/issues/22931


text:
Q: Which function required? Which WordPress function allows you to include the footer.php file into index.php file?

A: Add
<?php get_footer(); ?>

into index.php or the template you are using
Then create footer.php and add in something like this:
<?php
    /* Always have wp_footer() just before the closing </body>
    * tag of your theme, or you will break many plugins, which
    * generally use this hook to reference JavaScript files.
    */
    wp_footer();
    ?>
    </body>
</html>

A: Found the answer here: Reference Guide. It seems the default footer.php and header.php as well as some other template files are in wp-includes/theme-compat/


text:
Q: R 3.1.2 library file I need to link to R library and have seen some pointers on the Web - all referencing Rdll.lib file.
However, in my installation directory \R\R-3.1.2\bin\x64 contains only DLL file - R.dll.
Does the default installation of R ships a library and if yes, where to find it?
As a note, this all relates to attempts to create an R wrapper for C++ library with SWIG

A: You need to manually build the Rdll.lib. Instruction can be found in R folder in the doc/README.packages (at least for my 3.1.3 R installation):

First build the import library Rdll.lib by (from the sources)
make R.exp
lib /def:R.exp /out:Rdll.lib

or, depending on your version of VC++:
link /lib /def:R.exp /machine:x86 /out:Rdll.lib


text:
Q: How can I stack two arrow images (upvote/downvote) on top of eachother using CSS?
uparrow.gif and downarrow.gif
So, it would look like so:

How can I create 3 divs and style them with CSS so those arrows are positions with the top arrow above the bottom arrow?

Should I create a "vote" div with restricted width?  Would I float: top and float: bottom the two arrow divs with the background set as my two images?  I plan on having content directly to the right of the vote arrows so it needs to be restricted and tight.

A: Don't use divs for an image - there's already a perfectly good img tag!

And then simply:
.vote
{
    width: 15px;
    float: left; clear: left;
}

.vote img
{
    display: block;
    float: none; clear: both;
}

You may want to add some margin to the .vote to separate it from the content it will be next to.

A: By default,
 elements are block-level meaning they are one-per-line and will expand horizontally to fill their container.
Adding the click handling is another problem.  You could include the  and  elements in the uparrow and downarrow elements or you do it in CSS as you suggested (the less compatible way).  Another option is registering DOM events with Javascript.
HTML:

CSS:
div.vote {
  width: 50px;
  float: left;
}

div.uparrow {
  background-image: url(...);
}

div.downarrow {
  background-image: url(...);
}

A: Use 2 divs. Float the text div left and put the two images in a single div.  use display: block on the images to force one below the other.

A: A more semantic and efficient solution than divs would be this, which also takes care of positioning the vote box.
.content-item {padding-left:110px;position:relative; width:500px;border:1px solid red;}
.vote{width:100px;position:absolute; top:0; left:0;border:1px solid red;}
.vote h4 {style heading how you like}
.vote img{width:100px;height:30px;background:black;}

 content

Vote


text:
Q: WPF Datatemplating an ItemsControl I have an ItemsControl whose ItemsSource gets bound to an ObservableCollection<Component> at run time. I have defined a data template for type Component which works fine.
Now Component has a ObservableCollection<Control> and I want to add another ItemsControl inside my Component Datatemplate to render all the controls. Control here is my own custom object not related to a wpf control.
There are different types of controls so I am trying to use an ItemTemplateSelector to select the right template for each type. In the example below to keep it small I have only shown one of the templates "RWString" which I find using a FindResource in MyControlTemplateSelector overriding SelectTemplate. But the SelectTemplate never gets called(using a breakpoint to check). Is there something wrong in my xaml?
<ItemsControl.Resources>
    <src:MyControlTemplateSelector x:Key="XSelector" />
    <DataTemplate DataType="{x:Type src:Component}"  >
        <Expander Visibility="{Binding Path=Show}">
                <ItemsControl ItemsSource="{Binding Path=Contrls}"
                          ItemTemplateSelector="{StaticResource XSelector}">
                <ItemsControl.Resources>
                    <DataTemplate x:Key="RWstring" >
                        <TextBlock Text="{Binding Path=Label}"/>
                    </DataTemplate>
                </ItemsControl.Resources>
                <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate><WrapPanel /></ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
            </ItemsControl>
        </Expander>
    </DataTemplate>
</ItemsControl.Resources>

Update: Contrls is not a typo, its just me using a silly naming system. Contrls is a property of Component of type ObservableCollection<Control>. Also the reason I am trying to use the the ItemsTemplateSelector is that the ObservableCollection<Control>  contains objects of generic types like Control<int> Control<string> etc all deriving from Control and apparently you cant create datatemplates referring to generic types.
Update3: Removed update 2 as it was unrelated. I got the ItemTemplateSelector to work by changing StaticResource to DynamicResource. But I don't know why this works...

A: I'm guessing this doesn't work with a StaticResource as the Resource is inside the ItemsControl which probably has not been created at load time when StaticResources are evaluated.
DynamicResources at load time are evaluated to an expression at load time and then evaluated to the correct value when requested.
Try move the Resource outside of the ItemsControl.

A: In the line where you bind the nested ItemsControl, is the Path correct?  It is currently "Contrls", should it be "Controls"?


text:
Q: Starting solution in CPLEX Optimization Studio I am solving a MIP in IBM ILOG CPLEX Optimization Studio. I would like to first generate a solution where the main decision variables need not be integers, which will then be used as a starting solution to solve the model where the decision variables should be integers.
What should I type in my .mod file to obtain this?
Thank you!

A: You will probably need to use a main() function to control the sequence of solves. This can be done either all in one .mod file or with the main() in a separate .mod file that controls the process of using/solving the others. This is described in the documentation. There are examples in the OPL samples folder; see mulprod or LangrangianRelaxation. Give it a go, and when you have something concrete that doesn't work, come back and ask again.


text:
Q: Openstack instances cannot access Internet [linuxbridge] I am having serious issues in the deployment of the Openstack scenario related to the Linux Bridge.
This is the scenario:
Controller machine:

*

*Management Interface enp2s0: 138.100.10.25.

Compute machine:

*

*Management Interface enp2s0: 138.100.10.26.

*Provider Interface enp0s20f0u4: 138.100.10.27.

Openstack Train scenario has been successfully deployed in Centos 8, choosing networking option 2 (self-service network).
To verify the functionality, an image has been uploaded, created an Openstack flavor and security group, and launched a couple of cirrOS instances for connection testing.
We have created a provider network following this tutorial and a selfservice network following this one.
The network scenario is the next one:
Network Topology
As can be seen in the network topology, an external network 138.100.10.0/21 (provider) and an internal network 192.168.1.1 (selfservice) have been created, connected through a router by the interfaces 138.100.10.198 and 192.168.1.1, both active.
Our problem is that our Linux bridge is not working as expected: the Openstack cirrOS instances has no internet access.
This is the controller ip a and brctl show command output:
Modena_ip_a
This is the compute ip a and brctl show command output:
Testarossa_ip_a
Testarossa_brctl
(The output of ovs-vsctl show command is empty in both machines).
Are the Linux Bridges correctly created?
These are the Linux bridge configuration files:

*

*Controller /etc/neutron/plugins/ml2/linuxbridge_agent.ini:

[linux_bridge]
physical_interface_mappings = provider:enp2s0   # enp2s0 is the interface associated to 138.100.10.25

[vxlan]
enable_vxlan = true
local_ip = 138.100.10.25    # controller has only 1 IP
l2_population = true

*

*Compute /etc/neutron/plugins/ml2/linuxbridge_agent.ini:

[linux_bridge]
physical_interface_mappings = provider:enp0s20f0u4      # interface associated to 138.100.10.26

[vxlan]

enable_vxlan = true
local_ip = 138.100.10.27
l2_population = true

An observation to keep in mind is that compute management interface (138.100.10.26) is inaccessible from anywhere, which I think is not correct since this prevents us, for example, from accessing the instance console through the URL.
I have made some conection tests and these are the results:

*

*Cirros_a ip a command output:

Cirros_a_ip_a

*

*Cirros_b ip a command output:

Cirros_b_ip_a

*

*There is connection between Cirros A and Cirros B (in both directions).

*There is connection between Cirros A/B and self-service gateway (192.168.1.1) (in both directions).

*There is connection between Cirros A/B and provider gateway (138.100.10.198) (in both directions).

*There is connection between Cirros A/B and controller management interface (138.100.10.25) (in both directions).

*There is no connection between Cirros A/B and compute management interface (138.100.10.26). This interface is not accessible.

*There is connection between Cirros A/B and compute provider interface (138.100.10.27) (in both directions).

I do not know if there is a problem on linux bridge configuration files, or maybe I need another network interface on controller machine.


text:
Q: How are persistent database connections stored in PHP? As stated in the documentation on sqlite_popen php tries to make use of a persistent resource mechanism. Where is this mechanism described in detail? Is it possible to view all resources currently stored/used? Is it possible to access this mechanism and store/read other values?

A: sqlite_popen uses the (executor) global hashtable "persistent_list" to store the connection resource. This hashtable is not part of the php "instance" which executes your script but of the php "runtime", which means it's not cleared/removed after the script is done but held in memory as long as the php .so/.dll/fastcgi.exe.
You cannot access EG(persistent_list) from within a php script but any php module/extension can.


text:
Q: How is final prediction value calculated in multiple regression? I am just trying to understand how the final prediction is made in multiple regression. Say there are 4 independent variables and one dependent variable. The multiple regression model will first solve the linear relationships between the dependent and each individual variables. Then we have 4 sub linear models don't we? And how is the final value for prediction is calculated from these sub models?

A: Your question suggests you are not familiar with the concept of multiple regression (not to be confused with multivariate regression).  Given that, I will provide you a basic answer and clarification addressing the questions.  And, I will also suggests other related topics to study so to get a good educated grasp of the overall subject.
Multiple regression is one single model with one dependent variable Y and several independent variables Xs (multivariate regression is several Ys with several Xs.  But, let's keep to the basics for now).  A multiple regression is solved using a closed form math formula using Matrix Algebra.  The multiple regression uses your entire time series history and can therefore estimate every single point within your time series.
There are no sublinear models.  All the variables/regressors are regressed together in one single model as mentioned above.
The final point estimate is not derived any differently than any of the other points within your time series.
To clarify any confusion regarding multiple regression, I recommend related Wikipedia articles on the subject that will confirm all of the above and also give you greater details in the underlying mathematics.
To further understand the topic, I also recommend you study Wikipedia articles on Hold Out samples, cross validation, model testing, etc.

A: Calculating predicted values for multiple regression is no different than simple linear regression.
After obtaining your estimated regression equation, you plug the values of the independent variables for each observation. For example, if your estimated equation is
$$
\hat{y} = 2x_{1}+3x_{2}+3x_{3}+2x_{4}
$$
and suppose the first observation has values (1,0,10,20) for each independent variable, respectively. The predicted value for this observation is calculated as such
$$
\hat{y}_{1} = 2(1)+3(0)+3(10)+2(20) = 72
$$


text:
Q: short url for parameter passing in either php or jquery i see some websites is having a very simple URL without the GET value or something like this.
for instance www.test.com/12345
the 12345 is the ID of an item. i am sure that ID will be pass to back end or j query for processing such as fetch from db etc. But i am not sure in what way i need to use to get the ID in the URL in such simple format instead of the old way
www.test.com/index.php?id=12345
can someone guide me on this. not sure which method to do this


text:
Q: Using a page's functions in a Chrome extension I have a Chrome extension which is injecting some code into a web page (I know that part's working), which is trying to call a function that is part of the original web page. The function works fine from the console, but gives an error when the extension calls it. I assume this is some sort of security feature, but is there a way to get around it? Please help!
PS. It's just for one website, if that helps

A: You can't do it with content scripts. Chrome extensions content scripts live in isolated worlds, meaning they share DOM, but have separate JavaScript sandboxes. Read more here:
The workaround to this is to inject a <script> into the DOM of the page, but that code won't have privileges to call any chrome.* APIs.


text:
Q: Target Interface is not instantiable. Laravel 4 When I search the error 'Target Interface is not instantiable' I get a lot of results. Somehow I can still not find the solution to my problem.
I am not sure where it goes wrong.
PartnerController.php
<?php use CmsBlox\MOD\PartnerInterface;

class PartnerController extends BaseController {
    public function __construct(PartnerInterface $partner)
    {
        $this->partner = $partner;
    }

    public function Get()
    {
        return "I'm the Get function in class PartnerController";
    }
}

PartnerServiceProvider.php
<?php namespace CmsBlox\Providers;

use App, Illuminate\Support\ServiceProvider;

class PartnerServiceProvider extends ServiceProvider {
    public function register()
    {

    }

    public function boot()
    {
        app::bind('CmsBlox\MOD\PartnerInterface') ;
    }
}

Routes.php
app::bind('CmsBlox\MOD\PartnerInterface') ;

PartnerInterface.php
<?php namespace CmsBlox\MOD;

interface PartnerInterface {
    public function get();
}

I have also added the provider to App.php (for testing also a app::bind() in the routes.php)
'CmsBlox\Providers\PartnerServiceProvider'

As far I know every file should be correct. Somehow I am missing something!

A: I just found the answer! Thanks to the Laravel.io forums.
<?php use CmsBlox\MOD\PartnerInterface;

class PartnerController extends BaseController implements PartnerInterface {

    public function get() {...}
}


text:
Q: Measure of rational hyperplanes of $\mathbb{R}$ Let's view $\mathbb{R}$ as a vector space over $\mathbb{Q}$, and pick some basis $(v_\alpha)_{0 \leq \alpha < \mathfrak{c}}$ of it. We can then consider the subspace $L$ spanned by $(v_\alpha)_{0 < \alpha < \mathfrak{c}}$ (ie leaving out one vector from the basis). Given the horrible way we have built $L$, I don't suppose there is much a priory reason for $L$ to be measurable. However, I am wondering whether we can say something about the outer measure of $L$.

A: This is the (a version of the) Vitali set, which is not Lebesgue measurable. A quick reason is:
$\mathbb{R}=  (v_0\mathbb{Q})\oplus_\mathbb{Q} V$ shows that $\mathbb{R}$ is a countable union of translates of $V$, so $V$ cannot be a Lebesgue set of measure zero, but must have positive outer measure. To show that the outer measure of $V$
is actually $+\infty$, note that, being $V$ a $\mathbb{Q}$-linear subspace, $2V=V$ so that its Lebesgue outer measure is $\lambda^*(V)=2\lambda^*(V)$, which has to be $+\infty$ because it is not $0$.
On the other hand, for any Lebesgue measurable set of positive measure $S$, according to  Steinhaus property, $S-S$ is a nbd of $0$. Therefore $V=V-V$, which is nowhere dense, contains no measurable set of positive measure.


text:
Q: Managing textures in c# via instantiating them all in one or several arrays I am developing a game in c#, I'm rather new at C#. I would like to know if this approach would affect adversely the performance?

*

*Instantiate all textures in four categories, id est 4 different arrays.

*This is to keep relevant textures apart from each other (example MonsterA needs 3 textures that are in the same array)

*Have objects with generic Lists to point at the texture(s) they need.

*Since the textures are in the same array this would help with the caching etc, I think

As far as I know List would only create pointers that have locality not so much the actual textures. I am Using SFML.Net, but this should apply to say, listing pictures of some sort, or listing objects you want to have locality.
The question is then, will doing this affect it adversely, will it work as I expect or will it not matter at all? And why?

A: If you are very serious about that - try all approaches and measure/compare. Don't forget to set your goals first, otherwise you'll be trying to save time/memory when it does not cause problem for your case. Note that you need to measure complete sequence you worry about, not just "load textures" part.
It is very unlikely if performance will be impacted by the way you are arranging metadata portion of textures (everything but image bytes) - the amount of memory used by images themselves would be much bigger than any list/dictionaries you refer textures from.
Main optimizations with textures are

*

*not load them at all till needed/potentially need

*somehow make them smaller (multiple detail levels, compression,...)

*sometimes number of textures matter and image strips / sprite sheets can be used to combine multiple images into one.

But for most projects doing nothing special is a good start - if you finished game/program that is somewhat slower that you'd like is much better than 1/3 complete one but with very fast texture loading (or whatever you decide to optimize too much).


text:
Q: rational functions on projective n space
How to prove that the field of rational functions on whole of projective $n$-space is constant functions?

By rational function I mean quotients of homogeneous polynomials of same degree defined/regular on whole of projective space.

A: A rational function $\phi\in \text {Rat}(\mathbb P^n)$ is defined at $p\in \mathbb P^n$ if there is some representative $P/Q$ of $\phi$ with $P,Q\in k[T_0,\cdots,T_n]$ homogeneous of the same degree such that $Q(p)\neq 0$.
You are asking to characterize those $\phi$'s that are defined at all $p\in  \mathbb P^n$.
The answer is that the only such $\phi$ are the elements of $k$, the constants . Here is why:
Any non-constant $\phi\in \text {Rat}(\mathbb P^n)$ has a unique (up to a non-zero constant ) expression of  the form  $P/Q$ with $P,Q$ homogeneous of the same positive degree and, crucially!, with $P,Q$ relatively prime.
The reason for this pleasant unicity is of course that $k[T_0,\cdots,T_n]$ is a UFD when $k$ is a field.
But now I claim that at any zero $p\in \mathbb P^n$ of $Q$, the rational function $\phi$ is not defined.
Proof of claim
Another representative of $\phi$ will be of the form  $P_1/Q_1$ with $P_1,Q_1$ homogeneous of the same degree .
Since $P/Q,P_1/Q_1$ both represent $\phi$, we have $PQ_1=P_1Q$  so that $Q$ divides $PQ_1$ and since $P,Q$ are relatively prime $Q$ must divide $Q_1$.
Ah, but then $Q(p)=0$ implies $Q_1(p)=0$: so try as we can we will never find a representative of $\phi$ whose denominator does not vanish at $p$.
Long story short, $\phi$ is not defined at $p$.
The end of the story is that if we assume $k$ algebraically closed, any homogeneous polynomial of positive degree $Q$ will have some zero $p$ and the reasoning above shows that no non-constant $\phi\in \text {Rat}(\mathbb P^n)\setminus k$ is defined on all of $\mathbb P^n$.
Say it in formulas
$$  \mathcal O(\mathbb P^n)=k\subsetneq     \text {Rat}(\mathbb P^n)=k(T_1/T_0,\cdots, T_n/T_0)\subsetneq   k(T_0,T_1,\cdots, T_n) =   \text {Rat}(\mathbb P^n)(T_0)    $$


text:
Q: "How to perform statistical analysis in python on bin file?" I have a bin file that contains binary values and I converted it into a text file(human readable form).
the code which I have used to convert the bin file to text file:
def main():
with open("G:/Dataset/attach-file-1562323491012.bin", "rb") as text_file:
# One option is to call readline() explicitly

# single_line = text_file.readline()

# It is easier to use a for loop to iterate each line
    data1 = text_file.read(10000)

datastring = str(data1)

print(datastring)
print(' '.join(str(ord(c)) for c in datastring))

decode(data1)

now I want to perform statistical analysis to get the output on this converted text file.
I am not very familiar with Statistical analysis in python.
Any idea or help would be really appreciated.
Thank you,

A: You should take a good look at Pandas 10 minutes tutorial.
If it's an one dimensional list, you should start looking at Pandas Series


text:
Q: PPTP: Linux clients unreachable I have setup a PPTP server on a CentOS 6 box.
Several clients (Windows and Linux) connect to this server.
All clients use the same subnet.
All clients (Win or Lin) can surf the Internet using the VPN successfully.
Windows clients can ping any other Windows client (XP/Vista/7) connected to VPN.
Linux clients (KVPNC) can ping any Windows client (XP/Vista/7) connected to VPN.
So far so good.  But there's this weird problem and I've been trying to figure it out with no luck:
No client can ping (reach) a Linux client (successfully) connected to VPN.  And yes, the firewall is completely disabled.
I'd really appreciate any hint/idea.  TIA,
EDIT:  The ultimate goal of this is to share services across the VPN, like accessing a HTTPD running on a Linux box from a Windows client.

A: On the VPN SERVER, following need to be done:
Enable tcp/ip forwarding
Linux TCP/IP stack by default does not forward packets (either between interfaces or re-routing them between IP network). It has to be enabled
echo 1 > /proc/sys/net/ipv4/ip_forward

Without that, VPN server will accept VPN client packet locally, and route client packet according to NAT rule, but will not route traffic to local network, which include other vPN client.
Iptables
Iptables block all traffic by default. You need rules to allow traffic to get through.
$IPTABLES -A FORWARD -s 192.168.1.0/24 -d 192.168.1.0/24 -j ACCEPT

Change 192.168.1.0/24 to match your vpn network ip addresses. That will allow traffic between your vpn network machines.
/etc/pptp.conf
When vpn client need to talk to each together, the vpn server is acting as a routing point and need to be on the same netowrk.
localip 192.168.1.1
remoteip 192.168.1.2-254

Modify the above according to your network setup.


text:
Q: In md-contact-chips How to select the Selected Items Can anybody tell me that how to use  md-contact-chips  to push in an array to all selected Items. I tried with md-on-select="getChipInfo($chip)" md-on-remove="removeChip($chip)"
but its not working for me.

A: See this:
https://angular-material.firebaseapp.com/1.0.0/api/directive/mdContactChips/
http://flowersinthesand.github.io/material/#/demo/material.components.chips/
Use the attribute ng-model="myProperty" and in the controller this code:
$scope.myProperty = new Array({value: "A", id: 1}, {value: "B", id: 2});
$scope.$watch("myProperty ", function (newValue, oldValue) {
// my code on change
});