text:
Q: ClassNotFound exception running Kafka Connect S3 Source Connector I am evaluating Confluent Kafka S2 Source Connector and stuck with the issues with following stacktrace:
[2020-12-22 15:27:41,636] ERROR WorkerConnector{id=s3-source-connector} Error while starting connector (org.apache.kafka.connect.runtime.WorkerConnect
or)
org.apache.kafka.connect.errors.ConnectException: Failed to get list of folders from S3 bucket - kafka-connect for key path - topics/ and delimiter - /
        at io.confluent.connect.s3.source.S3Storage.listFolders(S3Storage.java:286)
        at io.confluent.connect.s3.source.S3Storage.getPartitions(S3Storage.java:98)
        at io.confluent.connect.storage.partitioner.TimeBasedPartitioner.getPartitions(TimeBasedPartitioner.java:50)
        at io.confluent.connect.cloud.storage.source.StorageSourceConnector.doStart(StorageSourceConnector.java:77)
        at io.confluent.connect.cloud.storage.source.StorageSourceConnector.start(StorageSourceConnector.java:69)
        at org.apache.kafka.connect.runtime.WorkerConnector.doStart(WorkerConnector.java:111)
        at org.apache.kafka.connect.runtime.WorkerConnector.start(WorkerConnector.java:136)
        at org.apache.kafka.connect.runtime.WorkerConnector.transitionTo(WorkerConnector.java:196)
        at org.apache.kafka.connect.runtime.Worker.startConnector(Worker.java:242)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder.startConnector(DistributedHerder.java:908)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder.access$1300(DistributedHerder.java:110)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder$15.call(DistributedHerder.java:924)
        at org.apache.kafka.connect.runtime.distributed.DistributedHerder$15.call(DistributedHerder.java:920)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: com.amazonaws.SdkClientException: Couldn't initialize a SAX driver to create an XMLReader
        at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.<init>(XmlResponsesSaxParser.java:123)
        at com.amazonaws.services.s3.model.transform.Unmarshallers$ListObjectsV2Unmarshaller.unmarshall(Unmarshallers.java:127)
        at com.amazonaws.services.s3.model.transform.Unmarshallers$ListObjectsV2Unmarshaller.unmarshall(Unmarshallers.java:117)
        at com.amazonaws.services.s3.internal.S3XmlResponseHandler.handle(S3XmlResponseHandler.java:62)
        at com.amazonaws.services.s3.internal.S3XmlResponseHandler.handle(S3XmlResponseHandler.java:31)
        at com.amazonaws.http.response.AwsResponseHandlerAdapter.handle(AwsResponseHandlerAdapter.java:69)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleResponse(AmazonHttpClient.java:1714)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleSuccessResponse(AmazonHttpClient.java:1434)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1356)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1139)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:796)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:764)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:738)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:698)
        at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:680)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:544)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:524)
        at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:5052)
        at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4998)
        at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4992)
        at com.amazonaws.services.s3.AmazonS3Client.listObjectsV2(AmazonS3Client.java:938)
        at io.confluent.connect.s3.source.S3Storage.listFolders(S3Storage.java:283)
        ... 16 more
Caused by: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found
java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
        at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:230)
        at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:191)
        at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.<init>(XmlResponsesSaxParser.java:120)
        ... 37 more
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at org.apache.kafka.connect.runtime.isolation.PluginClassLoader.loadClass(PluginClassLoader.java:104)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.xml.sax.helpers.NewInstance.newInstance(NewInstance.java:82)
        at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:228)
        ... 39 more

Connector config:
{
    "name": "source-connector",
    "config": {
      "connector.class":"io.confluent.connect.s3.source.S3SourceConnector",
      "s3.bucket.name":"bucket-test",
      "s3.region":"us-west-2",
      "tasks.max":"1",
      "topics":"migration-topic",
      "topics.dir":"topics/events",
      "format.class":"io.confluent.connect.s3.format.json.JsonFormat",
      "behavior.on.error": "log",
      "partitioner.class":"io.confluent.connect.storage.partitioner.TimeBasedPartitioner",
      "path.format":"'date'=YYYY-MM-dd/'hour'=HH",
      "key.converter":"com.pandadoc.kafka.connect.msgpack.converter.MessagePackConverter",
      "key.converter.schemas.enable":"false",
      "value.converter":"com.pandadoc.kafka.connect.msgpack.converter.MessagePackConverter",
      "value.converter.schemas.enable":"false",
      "errors.tolerance": "all",
      "errors.deadletterqueue.topic.name": "kafka-connect-dead-letter-queue",
      "errors.deadletterqueue.context.headers.enable": true,
      "confluent.license":"",
      "confluent.topic.bootstrap.servers":"localhost:9092",
      "confluent.topic.replication.factor":"3"
    }
  }

Versions:
[2020-12-22 15:27:41,640] INFO Kafka version: 2.2.2-cp3 (org.apache.kafka.common.utils.AppInfoParser)
[2020-12-22 15:27:41,640] INFO Kafka commitId: 602b2e2e105b4d34 (org.apache.kafka.common.utils.AppInfoParser)

It could be a JDK bug: https://bugs.openjdk.java.net/browse/JDK-8015099.
It has been fixed in JDK 9+.
Confluent docker image confluentinc/cp-kafka-connect:5.2.4 uses JDK8:
openjdk version "1.8.0_172"
OpenJDK Runtime Environment (Zulu 8.30.0.1-linux64) (build 1.8.0_172-b01)
OpenJDK 64-Bit Server VM (Zulu 8.30.0.1-linux64) (build 25.172-b01, mixed mode)

Any other ideas on what could be wrong?

A: I've sorted the issue out
It turned out the JDK bug that caused the kind of behavior.
There is an interoperability table for Kafka Connect version and Kafka here hence there are two options:

*

*Tweak docker Kafka Connect image by installing JDK9+

*Bump up Kafka Connect to 6.x (if Kafka version allows) that uses JDK11.


text:
Q: PyQt drag and drop outside app into Windows file explorer? I would like to create files by dragging from a QListWidget into the OS file explorer (Windows 10 in my case), is this possible? So in the widget below, I want dragging "one" and "two" from the list onto a folder in the system file explorer to create two files named "one.txt" and "two.txt" containing the text "one" and "two" respectively
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt

class DragTest(QtWidgets.QListWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setDragEnabled(True)
        self.addItems(['one', 'two', 'three'])
        self.setSelectionMode(self.MultiSelection)

if __name__ == "__main__":
    app = QtWidgets.QApplication.instance() or QtWidgets.QApplication(sys.argv)

    w = DragTest()
    w.show()

    app.exec_()

A: You need to implement the startDrag() method and add the urls to the QDrag instance.
class DragTest(QtWidgets.QListWidget):
    # ...
    def startDrag(self, actions):
        drag = QtGui.QDrag(self)
        indexes = self.selectedIndexes()
        mime = self.model().mimeData(indexes)
        urlList = []
        for index in indexes:
            urlList.append(QtCore.QUrl.fromLocalFile(index.data()))
        mime.setUrls(urlList)
        drag.setMimeData(mime)
        drag.exec_(actions)

Note that I'm just using the index.data() since you used the full path for the item name, but you might prefer to set a specific data role for the full url in case, for example, you want to show only the file name:
FullPathRole = QtCore.Qt.UserRole + 1

class DragTest(QtWidgets.QListWidget):
    # ...
    def dropEvent(self, e):
        if e.mimeData().hasUrls():
            e.setDropAction(QtCore.Qt.CopyAction)
            e.accept()
            fpath_list = []
            for url in e.mimeData().urls():
                fpath_list.append(str(url.toLocalFile()))

            for fpath in fpath_list:
                print(f'IMPORT {fpath}')
                fileName = QtCore.QFileInfo(fpath).fileName()
                item = QtWidgets.QListWidgetItem(fileName)
                item.setData(FullPathRole, fpath)
                self.addItem(fpath)

    def startDrag(self, actions):
        # ...
            urlList.append(QtCore.QUrl.fromLocalFile(index.data(FullPathRole)))

Also note that you are missing the parentheses in the if e.mimeData().hasUrls(): check.

redpajama_set_name: RedPajamaStackExchange


text:
Q: labelling two summary data in one boxplot I am a new user of R.
•   I would like to combine the results of these two groups and still maintain their labels as two groups. When I combine, they yield a figure, which has lost the labels.
•   I would also like to label number 1 and 2 (for both groups) as "falling" and "falling-rising". respectively and with "black" and "grey" color to show difference easily.
•   I am working with summary results
This is the formula I have used so far to create the figure:
d0<-matrix(c(x1,x2), ncol=2)
d1<-matrix(c(y1,y2), ncol=2)
lmts<-range(d0,d1)
par(mfrow = c(1, 2))
boxplot(d0, ylim=lmts, xlab="x")
boxplot(d1, ylim=lmts, xlab="y")
result1 <-boxplot(d0, ylim=lmts, xlab="x")
result2<- boxplot(d1, ylim=lmts, xlab="y")
mylist <- list(result1, result2)
groupbxp <- do.call(mapply, c(cbind, mylist))
bxp(groupbxp)

A: Like this?

set.seed(1)   # so example is reproduceable
# create example
x1=sample(50,100,10)
x2=sample(50,100,10)
y1=sample(50,100,10)
y2=sample(50,100,10)
d0<-data.frame(falling=x1,"falling-rising"=x2)  # note use of data.frame(...)
d1<-data.frame(falling=y1,"falling-rising"=y2)
lmts<-range(d0,d1)
par(mfrow = c(1, 2))
boxplot(d0, ylim=lmts, xlab="x", col=c("grey80","grey50"))
boxplot(d1, ylim=lmts, xlab="y", col=c("grey80","grey50"))
result1 <-boxplot(d0, ylim=lmts, xlab="x", plot=F)
result2<- boxplot(d1, ylim=lmts, xlab="y", plot=F)
mylist <- list(result1, result2)
groupbxp <- do.call(mapply, c(cbind, mylist))
par(mfrow=c(1,1))
bxp(groupbxp,fill=T,boxfill=c("grey80","grey50","grey80","grey50"))

To get labels other than x, y use data.frame(...) instead of matrix(...). To get colors use boxfill=... in the call to bxp(...). Note, though, that to get colors in boxplot(...) the arguments are different, sadly.


text:
Q: Как обучить агента в частично наблюдаемой среде? Подскажите пожалуйста, нужно обучить агента в частично наблюдаемой среде. Помимо обучения с подкреплением какие ещё существуют методы обучения для частично наблюдаемых сред или для игр с неполной информацией?
Нашёл только "Эволюционные стратегии как масштабируемая альтернатива обучению с подкреплением"


text:
Q: Capistrano with multiple Puma applications I want to deploy multiple rails applications to one Virtual Machine via capistrano.
Both applications in deploy.rb have that kind of setting:
set :puma_bind, "unix://#{shared_path}/tmp/sockets/#{fetch(:application)}-puma.sock"

They have their own Nginx Config files.
First App:
upstream puma {
   server unix:///var/www/first-app/shared/tmp/sockets/first-app-puma.sock;
}

server {
   listen 80 default_server deferred;

Second App:
upstream puma_second {
  server unix:///var/www/second-app/shared/tmp/sockets/second-app-puma.sock;
}

server {
  listen 81;

First is on 80 port, second is on 81 port.
However, when I deploy second app then restart Nginx, then I open example.com:81, it shows me pages of first app without any styles.
Why this is happening? Do I need to bind second app to somewhere else?

A: Have you tried leaving both on port 80 and adding different server_names on each server block for the apps?
server {
  listen 80 default_server deferred;
  server_name railsapp1.com;

  .
  .
  .
}

and
server {
  listen 80 default_server deferred;
  server_name railsapp2.com;
  .
  .
}

A: I was able to solve this problem by changing nginx.conf files of both applications.
First App:
upstream puma_first_app {
   server unix:///var/www/first_app/shared/tmp/sockets/first_app-puma.sock;
}

server {
  listen 9999;

And where location @puma I have added this:
proxy_pass http://puma_first_app;

In second app I used port 80 and changed first_app strings to second app


text:
Q: Split a string into two parts after the first word? For example, I have a string
x <- 'what are you talking about'

How do I split it into two strings 'what' and 'are you talking about'?

A: Do matching instead of splitting.
> x <- 'what are you talking about'
> library(stringi)
> stri_extract_all(x, regex="^\\S+|\\S.*")[[1]]
[1] "what"
[2] "are you talking about"

OR
> library(stringr)
> str_split(x, perl("^\\S+\\K\\s+"))
[[1]]
[1] "what"
[2] "are you talking about"

A: You can do it long hand, since strsplit won't play nice here:
val <- regexpr("\\s",x)
substring(x, c(1,val+1), c(val-1,nchar(x)) )
#[1] "what"                           "are you talking about"


text:
Q: Set Date automaticallly I would add a record field in my form that will tell the user to set the date of registration in the pane "set date" and then after that it fills the time, 365 days is automatically added to the component "Date of end registration" without it can not change the second part. It can only change the first flying "date of registration". How could I do it in java and xml? thank you kindly help me friends.
PS: Look this pic to have an idea of what I want

A: First retrieve the date from the date of registration textbox, using below code:
 SimpleDateFormat formatter = new SimpleDateFormat("dd/MMM/yyyy");
 String dateInString = dateofreg.getText().toString();
    Date date = formatter.parse(dateInString);

After retrieving it set in the date of end registration textbox.
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(Calendar.YEAR, 1);
dateOfEndreg.setText(formatter.format(c.getTime());


text:
Q: Allow or deny access to entire site based on Claim I have a FubuMvc website that uses Claims based authorization from a WIF single signon server. The Authentication happens on the SSO and the claims including roles and a set of custom claims are passed to the website for authorization.
The SSO and website work fine as does the role based authorization but what I want to do is reject access to the entire site save an error page based on the absence of a custom claim. Currently I am using a custom ClaimsAuthenticationManager which inspects the claims and checks for the existence of the required claim. If the claim is missing it throws an exception. This causes a 500 error but what I really want is the system to throw a 401 error and redirect to a Not Authorized page on the website.
The following is an example of the custom ClaimsAuthenticationManager.
public class CustomAuthenticationManager : ClaimsAuthenticationManager
{
    private readonly string expectedClaim;

    public CustomAuthenticationManager (object config)
    {
        var nodes = config as XmlNodeList;
        foreach (XmlNode node in nodes)
        {
            using (var stringReader = new StringReader(node.OuterXml))
            using (var rdr = new XmlTextReader(stringReader))
            {
                rdr.MoveToContent();
                rdr.Read();
                string claimType = rdr.GetAttribute("claimType");
                if (claimType.CompareTo(ClaimTypes.CustomClaim) != 0)
                {
                    throw new NotSupportedException("Only custom claims are supported");
                }
                expectedSystemName = rdr.GetAttribute("customClaimValue");
            }
        }
    }

    public override IClaimsPrincipal Authenticate(
        string resourceName, IClaimsPrincipal incomingPrincipal)
    {
        var authenticatedIdentities = incomingPrincipal.Identities.Where(x => x.IsAuthenticated);
        if (authenticatedIdentities.Any() &&
                authenticatedIdentities.Where(x => x.IsAuthenticated)
                                       .SelectMany(x => x.Claims)
                                       .Where(x => x.ClaimType == ClaimTypes.CustomClaim)
                                       .All(x => x.Value != expectedClaim))
        {
                throw new HttpException(
                    (int)HttpStatusCode.Unauthorized,
                    "User does not have access to the system");
        }
        return base.Authenticate(resourceName, incomingPrincipal);
    }
}

The above works and prevents access to the system but ti is not very use friendly because the user just gets a 500 error. Also because the user is essentially logged in they but have no access they have no way of logging out. I have exposed a Unauthorized error page which provides access to anonymous users but I have no way of redirecting the user yet.

A: I wonder why you have implemented your logic in the authentication manager.
Have you instead considered to switch to a ClaimsAuthorizationManager? For this to work, you need to add the ClaimsAuthorizationModule to your pipeline:
 <system.webServer>
    <modules>
        ...
        <add name="SessionAuthenticationModule" ....
        <add name="ClaimsAuthorizationModule" type="Microsoft.IndentityModel.Web.ClaimsAuthorizationModule, Microsoft.IndentityModel.Web" />
    </modules>
 </system.webServer>

then you create structure of your authorization roles:
 <claimsAuthorizationManager type="yourtype, yourassembly">
      <requiredClaim claimType="foobar" />
 </claimsAuthorizationManager>

and in the manager:
public class FederatedClaimsAuthorizationManager : ClaimsAuthorizationManager
{
    private List<string> _requiredClaims = new List<string>();

    public FederatedClaimsAuthorizationManager( object config )
    {
        XmlNodeList nodes = config as XmlNodeList;
        foreach ( XmlNode node in nodes )
        {
            XmlTextReader xtr = new XmlTextReader( new StringReader( node.OuterXml ) );
            xtr.MoveToContent();

            _requiredClaims.Add( xtr.GetAttribute( "claimType" ) );
        }
    }

    public override bool CheckAccess( AuthorizationContext context )
    {
        IClaimsIdentity identity = context.Principal.Identities[0];

        return !identity.IsAuthenticated ||
                identity.Claims.Any( c => _requiredClaims.Any( rq => c.ClaimType == rq ) );
    }
}

The difference between this and your approach is that failed authorization is handled by just reinvoking the authentication process - there are no exceptions, no 500s.
For example - if you use the <wif:FederatedPassiveSignIn /> on a login page then the failed authorization just redirects users to the login page where you can check if user is authenticated and show the message that says "you were redirected to the login page which possibly means that you tried to access a resources you are not authorized to access".

A: The documentation is not clear on how to implement Authenticate, other than the typical case of transforming claims. If you need to deny a user based on claims, you are on your own.
I have tried returning null and throwing various exceptions, including 401 (similar to your example). The solution that I found that works best is to create and return an anonymous principal.
using System.Security.Principal;

...

public class CustomAuthenticationManager : ClaimsAuthenticationManager
{
    public override IClaimsPrincipal Authenticate(
        string resourceName,
        IClaimsPrincipal incomingPrincipal)
    {
        ...

        ClaimsIdentity identity = new GenericIdentity(String.Empty);
        return new GenericPrincipal(identity, new string[0] { });
    }
}

You must pass an empty string as the identity name in order for IsAuthenticated on the generic claims identity to return false.


text:
Q: GWT: Multi Selection model does not update the celltable status in some cases I am using the GWT MultiSelectionModel within a CellTable in which I have a checkbox in one column and a widget in the other column. I have added handlers to update the selection status based on user clicks. If the user clicks on any part of either columns when the cell is selected, the status gets updated correctly and the cell turns white from light blue. Howvever, If the user clicks on the check box and the cell is selected, the check box gets unchecked but the cell is still blue. Even more strange: This issue does not happen if I have a few breakpoints before the status update code is executed.
In all other cases, the cell state and the checkbox state gets updated correctly. Note that I am not using the ProvidesKeys interface since the object do not change.
Can anyone help me with this? Thanks for your help.

A: Have you tried using a CheckBoxCell for your checkbox column and, specifically, the CheckboxCell(boolean dependsOnSelection, boolean handlesSelection) constructor (by passing true to both params)?

A: I've got almost the same problem when I use MultiSelectionModel. What's my walkaround is to see the checkbox's column as a special one and then to deal with it manually. Say:
myDataGrid.addCellPreviewHandler(
  @Override
  public void onCellPreview(final CellPreviewEvent<MyCellData> event){
    if("click".equals(event.getNativeEvent().getType()) && 0 != event.getColumn()){
      doWhatYouWant();
    }
  }
)


text:
Q: Why does the sync with my SO profile not work properly in SE? I asked a question which received 6 upvotes, and should be in the list of top questions in my Stack Exchange profile.
It didn't show up. Why? Is there any specific reason for that? Or will the sync process take some time?


text:
Q: Creating an arraylist in java I am trying to create an ArrayList in java and in some code i found this line Node head=(Node)array[b]. In that code this line was executed for creating an ArrayList.
What is the difference between Node head=(Node)array[index] and Node head=(array[index],null).
How does Node head=(Node)array[b] work??

A: This is how you create an ArrayList in JAVA:
List<String> someList = new ArrayList<>();

Above exaple will create an ArrayList of String.

I found this line Node head=(Node)array[b];

This is just initializing the object of Node class with the value of an array named array of type Node at index b.

What is the difference between Node head=(Node)array[index] and
  Node head=(array[index],null)

Node head=(array[index],null) this does not make any sense to me unless you are doing something like Node head=someFunction(array[index],null) where you are passing the value of array at index b and null as parameters and it is returning you an object of type Node.

A: the way to create Array list in java is
ArrayList name of list = ArrayList<>();
in the above example your going to create the Array list type NODe class


text:
Q: Cube: Passing one dimension current member inside the argument of another dimension In OLAP cube, while creating calculated measures, is it possible to pass the current member of one dimension (say [Dimension_Two]) as a parameter of Lead() or Lag() functions for another dimension ([Dimension_One])?
Something like this:

Sum( PERIODSTODATE ( [Dimension_One].[All].level,
  [Dimension_One].CurrentMember.Lead([Dimension_Two].[Dimension_Hierarcy].CurrentMember)
  ) ,[Measures].[Cost] )


text:
Q: Parent Child component object transfer in reactJS var MyComponent = React.createClass({
 getInitialState: function () {
   return { items: '' };
},

componentDidMount: function () {

    this.onSuccess();

},

onSuccess: function () {

  this.setState({ items: items });
 },

 render: function () {

  return (

          <Cart items={this.state.items} >
            <CartHeader />
            <CartContent />
            <CartFooter />
          </Cart>
   )
  }
 });

window.Cart = React.createClass({

render: function () {

return (

        Cart{this.props.children}

  );
 }
 });

window.CartHeader = React.createClass({

render: function () {
return (

        CartHeader
        {this.props.items}

   );
 }
 });

 window.CartContent = React.createClass({

render: function () {
return (

            CartContent
            {this.props.items}

  );
  }
 });

 window.CartFooter = React.createClass({

render: function () {
return (

        CartFooter
        {this.props.items}

  );
  }
 });

Where "items" is an object.
Now, my question is how to get the value of object in child?
Is it proper way to do? Actually, I am new to this.
If any suggestion, please let me know.
My purpose is to send object data to each child, so that in future if I don't want to "cartHeader", I can remove the component from that.

A: Three ways you can do:
1. <Cart items={this.state.items} >
    Under Cart component load the child component and pass the this.props.item in each child.

2. Use Context

3. Use cloneElement function

I prefer 2 option in this case(scenario)


text:
Q: Altium Draftsman Error: "Object reference not set to an instance of an object" I am trying to create a Draftsman template that includes the parameter names, view locations, etc already built-in. This way when I set the Draftsman drawing template, the views are automatically populated. Altium claims this can be done by editing the DwfDot template file. I created a drawing based on an actual board and set the locations of all the views, and also created the parameters I wanted. I then saved the file as a DwfDot. When I set the template of the Draftsman document for a different board, the views are populated as expected but the parameters have problems. Some of the parameters don't "stick" (I set them but when I close the parameter dialog they are automatically cleared). I re-opened the DwfDot template file for editing and now when I try to edit the parameters I get the error "Object reference not set to an instance of an object".

So at this point I'm stuck -- trying to add the value for the parameter in my actual drawing does not work as it automatically clears when I exit the parameters window, and I am unable to edit the template because of the object reference error. What is the cause of this error, and how might it be resolved?
EDIT:
I managed to solve the problem with the parameters being automatically cleared. It turns out I had some parameter names in my document that matched the names of some of the project parameters. When I added the parameter to the project options parameter dialog, the field in the Draftsman document filled in. To combat this issue I simply prefaced all document parameter names (that I only wanted visible in the Draftsman documents) with "Doc" and adjusted the document parameters to reflect the change. For example, "Title" is a system project parameter, and I had a document-specific "Title" parameter. The system project parameter was overriding the value I placed in the document "Title" parameter. I changed the Draftsman template so that instead of showing "=Title" it now shows "=DocTitle", and added "DocTitle" as a document parameter, and this is working perfectly. Unfortunately the other issue I mentioned still exists, and that is I can't seem to clear parameters in the template created from another document.


text:
Q: Set of Infinite Sets Contradiction? Consider the set $S$ that contains all sets $X$ such that $|X|\geq |\Bbb N|$.
The whole reason ZFC was made was because of Russel's paradox right? And so we know that we can't have a set that contains itself. So because of this: $S \notin S$
And so we have that $|S| < |\Bbb N|$.(i.e: that there are only finitely many sets of infinite cardinality).
But clearly this is not the case! One way to see this is to note that all of:
$\{x \in \Bbb{Z}$ $s.t. x \equiv 1$ (mod 2)}, $\{x \in \Bbb{Z}$ $s.t. x \equiv 1$ (mod 3)}, $\{x \in \Bbb{Z}$ $s.t. x \equiv 1$ (mod 4)}, ... $\in S$
So clearly $|S| \geq |\Bbb N|$
This brings about a contradiction. And one would determine that it was irrational to consider the set $S$.
My question, essentially, is: What's going on here? Surely there is some problem with the logic above, as it should be rational to consider the collection of sets with infinite cardinality, right?
I'm afraid my ZFC knowledge isn't quite up to par (at all) so I'm not able to work out exactly what is wrong with my argument.
In my search for answers I came across some other posts on here, but none of them seemed to be directly comparable to my question.
Thank you in advance!!

A: The thing is that you define $S$ to be the "set" of $X$ that satisfy some property. If you do not tell where you pick $X$ from, the object $S$ you're creating might not even be a set. Some of the sets that are constructed this way and is axiomatized to be a set are the power set $P(A)=\{X\mid X\subseteq A\}$, and the union $\bigcup C=\{x\mid \exists A\in C : x\in A\}$. If $S$ is not a set, some properties we are familiar with might not be true.
See the term "class" for further information.


text:
Q: How to check if thread is killed or keep running when you stop the tomcat Server? I have a thread pool of 10 threads to serve some task and they are keep running in my web application in tomcat server.
I am using the ExecutorService to create Thread Pool as given below.
ExecutorService executor = Executors.newFixedThreadPool(10);

Will these thread be killed or keep running after stopping the tomcat server without executing executor.shutdown()?
Thanks.

A: As others have mentioned if you execute tomcat shutdown, it's going to terminate your thread.
However, as per your comment you are trying to gracefully kill your threads. So I think you need to implement your shutdown logic in the ServletContextListener and use the contextDestroyed method.

A: When the Tomcat shuts down, all remaining threads will be terminated as well. Your threadpool might stop tomcat from shutting down gracefully. Eventually, the process might be killed by the script that runs your Tomcat (so, it depends on how you initiate/shutdown your Tomcat).

A: Creating threads inside a web container not always recommended because they do not let container shuts down gracefully. You should use managed thread pool, they will also be useful if you want to access other container's managed resources for example EJB's.
Explanation here


text:
Q: Does "who are naked" mean "who are very poor"? "Naked" means "being without clothing" - so I guess "who are naked" means "who are very poor".  Am I on the right track?

Pope Francis tweeted 1m ago:

Everyone is called to contribute with courage and determination to the respect for the fundamental rights of every person, especially the "invisible": of the many who are hungry and thirsty, who are naked, sick, outcast or imprisoned.

A: This is typical Biblical language: when all these adjectives are used together, we are encouraged to think of the needy in general. It's not so much about specific naked people. So, your interpretation is pretty good.
Typical examples:

I was naked and you clothed Me; I was sick and you visited Me; I was
in prison and you came to Me.' (Matthew 25:36)
Is it not to share your bread with the hungry, And that you bring to
your house the poor who are cast out; When you see the naked, that you
cover him, And not hide yourself from your own flesh? (Isaiah 58:7)


text:
Q: What happened to Vaatu? After the events of The Legend of Korra: Light in the Dark, we see that Korra's spirit calms vaatu with the knowledge of Spirit Calming she learned from Unalaq. Therefore where did Vaatu go as in a spirit cannot be destroyed as said by Raava to Avatar Wan. Therefore where did unalaq and Vaatu's fused spirit go physically??

A:
where did Vaatu go as in a spirit cannot be destroyed as said by Raava to Avatar Wan.

When Raava was explaining this, I'm pretty sure that she meant that you can't kill either her or Vaatu forever. So Vaatu didn't necessarily go anywhere, but rather just died for the time being.

where did unalaq and Vaatu's fused spirit go physically?

If we stick to the above idea that Vaatu is dead at the moment, so would be Unalaq (they don't go anywhere physically - they're gone at least until their reincarnation).
But if you're wondering whether Unalaq's spirit will reincarnate along with Vaatu, we'd have to speculate a bit:
If they were indeed fused as one entity (both are the same now), then it would be logical that in 10.000 years both would return, as one. However, be mindful that the fusion using the Harmonic Convergence isn't as strong as we thought it was, because clearly Korra was not perfectly fused with Raava, who used the exact same method in the past.

Basically, there doesn't seem to be any official word regarding Unalaq's or Vaatu's current state.

A: Well, I don't think there would be a reincarnation of Vaatu and Unalaq because technically he was in the avatar state when he "died", so the cycle would end there. I think that the reason the next book is called change because now that Vaatu has been assimilated, the worlds balance has been shifted as there is no longer a dark spirit. Which I hope isn't true, because I loved Vaatu, and I was so happy that he fused with Unalaq. Don't get me wrong, I hoped that Korra and Raava would win, I was just as giddy as a schoolgirl when they did the same thing Raava and Wan did. However, I wasn't exactly expecting him to turn into Satan. Nor was I expecting a macro Korra/Vaatu fight.
I have another theory as well that I really hope is not the case, but the reason that the next book is called change is because as it progresses, Korra becomes more and more evil until Vaatu is reborn within her and escapes. That would just suck balls after seeing her gain the power of the universe just to save Raava (and the world but I like to think it was more about Raava.)

A: I think when vaatu and unalaq fused and they became the dark avatar, same rules applied for them as they applied to light avatar. When korra killed them they were in an avatar form so korra broke the unstarted dark avatar chain there. It doesn't satisfy me however, that korra can kill something that much powerful without raava's aid but I say to myself "Unalaq have never trained with vaatu like wan did and plus they didn't have the experience of hundreds of light avatars had" to justify the end. In fact this end was not bad either offering something fantastic to wait for.
About vaatu's next appearance, I think he will appear somewhere close to next harmonic convergence in somewhere dark in the spirit world. After all we all agree on raava saying neither can destroy each other and she said if one wins the battle defeated will appear next harmonic convergence. She actually said that.
Damn I would love to see a two avatar world. But it would be too depressing for many viewers I think.

A: Hello I know vaatu neither exists.
Vaatu can not be gone. unulaq is a man so he can not leave. The only
that he has no control forces. And vaatu least possible strength.
Vaatu Satan. Vaatu Raava and continue until the end of the world.
Looks like there is one god in the story and that word obviously does not show.
Vaatu did not pray for the first man on earth before the first humans arrived. At the time of the prophet.

A: dark avatar cycle has broken because if any avatar die in the avatar state the cycle will broke so the dark avatar has kill in the avatar state so vaatu will never return again

A: In a prior episode, Unalaq threatened to destroy destroy Jinora's spirit with a dark version of his water-based spirit bending. The big Vaatu-Unalaq thing attempted the same thing on Giant Blue Korra; and then when she merged with the portion of Raava that Jinora (somehow) managed to rescue, Korra used that same waterbending technique.
I believe that Vattu has been destroyed. According to Raava in Beginnings, this means that he will regrow within Raava (and therefore the Avatar) until he becomes powerful enough to break free, presumably at the next Harmonic Convergence in ten thousand years time. Perhaps this will be an element of future seasons of Korra, or future series in the Avatar franchise. Or perhaps Wan (by merging with Raava) and/or Korra (by doing what she did) have changed things enough that Vattu has finally been destroyed forever. But that second one would seem like a tremendous waste of a potential story to me.

A: i belive korra and raava have deafeted vaatu and unalq, but not forever. vaatu and unalq will probably be back for the next hermonic convergence in 10,000 that still leaves many questions though. i think the episode should have explained more for what has happened to unalq and vaatu.

A: Ow man. I have a story. vaatu grows becouse of the bad that happens in the world. You can't see a spirit with his real form . But they change there forms. There is a difference between spirits and souls. Spirits dies and Souls didn't die. Spirits have their souls like humans have their souls. A spirit can die. They say the spirits are imortal. But that means the humans can't kill a spirit when they are in the spirit world. becouse we saw that the spirits dies when the humans go in the spirit world and kills the spirits. but the soul that can't die. In our religion it is that Satan will die on the end of the world and that the Angels will die on the end of the world. that means the devil and the Angels can't die until on the end of the world. Vaatu is alive and will go back in the boddy of korra. that is why Korra saw Vaatu when she was grazy.


text:
Q: Send Notifications from Service Worker just whether it has permission I've the following problem: I'm working in a web application that send notification to the user using Notification API. These  notifications are send from Service Worker because we need to get the datas from the server.
I've checked that Notification object doesn't have the permission property in SW context. My doubt is: is there any way to check whether the application have permission to send Notification in SW context?

A: As far as I understand, no, you cannot explicitly check that the user has granted permission through an API like Notification (in window context).
What you could do for instance is:

*

*When user grants permission, store that information to either to Caches or IndexedDB; check that when you would like to show a notification (both of these storages are available in window and SW)

*When you want to show a notification, ask the page if the user has granted the permission; you would do this via postMessage API and you would have to register a listener both in the page and the SW


text:
Q: Galaxy Tab A6 reading inconsistent values for bluetooth rssi I am using the Altbeacon library to detect and evaluate the distance from a BLE beacon in order to take some actions in my application.
I was using a Galaxy J7 device for the first tests and the result was ok. Not that precise, but precise enough.
The problem is that my target device is a Tablet Samsung Galaxy Tab A6. After I bought one, all the readings was like < 2 cm.
At first I tought it would be a calibration issue, since Tablet antenna should be much better Cell Phone.
I started the calibration process, but there was something that was not consistent: with the cell phone the RSSI readings were from -65 to -80 (between 0,25m and 20m) , which is consistent with fre space path loss, but the readings for the table were from -46 to -47 for the same distance. I tried different apps for measure, different locations, positions, everything but the result was always similar.
I tried to find someone with similar problem with no success.
I am running out of ideas of what may cause those readings, so I need some help from you guys.
1 - I think those readings are not consistent. Is that correct? Maybe I am on wrong premises
2 - What may cause those inconsistency?
3 - How can I get consistent readings?

A: If you are only seeing the RSSI change by 1dB between 0.25 m and 20 m, hen that RSSI value being returned by the device is incorrect.  It's unclear why, but there are at lest three possibilities:

*

*That tablet is broken.  Something is wrong in the A/D converter hardware in the bluetooth chip that measures signal strength.  A second device of the same model might work fine.  You'd have to try another to see.

*That tablet model has a flawed hardware design.  The way the A/D converter hardware in the bluetooth chip is hooked up has a design flaw.  Every device of this model will have this same problem.  Again, you'd have to try another to see.

*The firmware or driver does not properly convert the A/D output value from the chip to a floating point RSSI value.  The chip might have an 8-bit output value from 0-255 that must be scaled in the firmware to a floating point value.  Samsung may have done this improperly in the BLE driver in the Android ROM.  If this is indeed the problem, you might be able to correct the RSSI in software by taking a bunch of measurements at various distances and then running an algebraic least squares regression to get a formula that will provide a good fit to an expected RSSI curve at various distances.


text:
Q: X509 certificate error for HTTPS on BizTalk I want to send a request to HTTPS adapter through BizTalk server 2009. My BizTalk adapter is dynamic and it's takes configuration details from database instead of directly mentioning it on server.
I have installed X509 certificate in my browser and imported it in MMC.
I am getting following error in my BizTalk

A message sent to adapter "HTTP" on send port "sndHL7" with URI "https://xxxxxxxxx/imm/test (https://xxxxxxxxxxxxx/imm/test)" is suspended.
   Error details: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

I searched for this error, but every where I got following response only :

Error: – Details: "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
Solution: The error message normally occurs if the client certificate is not configured correctly.  You should check that you have configured your client certificate in certificate store under BizTalk service account that hosts the HTTP adapter.

I am not getting how to configure that certificate in proper certificate store. I have 3 files wih extension .cer, .cer and .pfx. The file with extension .pfx requires password to install it in any store.
Also, how to configure certificate under BizTalk service Account? Should I select "Service Account" while adding snap in in MMC and then select BizTalk service from the list of services.

A: The two .cer files must be the root authority and server certificates and you must trust them.so you need to place them in your LOCAL MACHINE- Trusted Root Certification store. (use MMC)
Now the .pfx file will have the client authentication certificate that you will be passing into get authenticated. Import this certificate to LOCAL MACHINE,Personal (or MY certificate store if using command line) check private key as exportable.
Now allow BizTalk service account access to the private key of this certificate.
MMC use add snap in and add local machine.
select the client certificate in Personal right click- AllTasks- Manage private keys. Now add your BizTalk service account as a user and give access.
Or else use winhttpcertcfg tool in command line

A: I don't know about biztalk but if you are presenting a cert you need the associated private key. A cert is like a photo ID. It is hard to forge, but it still doesn't prove your identity unless you can present your face for someone to compare with the ID. Assuming the file extensions match the actual format of the files, the cer files are either DER, BER or PEM encoded certificates without the private key. So you need the pfx file. So if the proposed solution from the error message is correct, you need to find that password and install the certificate and private key from the PFX file into the store.


text:
Q: How to set a custom directory for layouts in Sinatra? I have a Sinatra app with multiple layouts. I want to isolate them into their own subdirectory in views:
app.rb
views/
views/layouts/
views/layouts/default.haml
views/layouts/print.haml
views/layouts/mobile.haml

This works, except that I have to explicitly set a layout with each render call:
get '/' do
    haml :index, {:layout => :'layouts/default'}
end

Is there a way to set the layout globally (for all routes within a module, for example), or to tell Sinatra where look for layouts outside of default directory?

A: Need to RTFM better... So there is no specific option for Sinatra itself, but you can set a default layout for each rendering engine, e.g. HAML:
configure do
  set :haml, :layout => :'layouts/default'
end


text:
Q: Reduce file path when calling a file from terminal I'm using Lua in interactive mode on a Mac (thanks to rudix.org).
When I want to load a file I do:
dofile("/my/long/path/to/my/directory/file.lua")

I want to do a different thing, that is:

*

*put all my files in a desktop directory myDirectory;

*then call the file from the terminal this way dofile("file.lua");

Is this possible? How?

A: If the path is fixed, you can just redefine dofile:
local _dofile=dofile
local path=("/my/long/path/to/my/directory/")
function dofile(x)
    return _dofile(path..x)
end

You may put this (and other initializations) in a file and set the environment variable LUA_INIT to its location. After this, every invocation of lua will see the version of dofile redefined above and the users will be able to say simply dofile("foo.lua").
Alternatively, you can use require, which looks for modules in a list of paths in package.path or LUA_PATH.


text:
Q: Drupal 6: using bitbucket.org for my Drupal projects as a real version control system dummy Here is a real version control system dummy! proper new starter!

The way I have worked so far:
I have a Drupal-6 web project www.blabla.com and making development under www.blabla.com/beta . I'm directly working on blabla.com/beta on server. nothing at my local, nothing at anywhere else. Only taking backup to local, time to time. I know horrible and not safe way :/

The new way I want to work from now on:
I decided to use Mercurial. I have one more developer to work on same project with me. I have a blabla.com Drupal-6 project on bluehost and making development blabla.com/beta. I found out http://bitbucket.org/ for mercurial hosting. I have created an account.
So now how do I set up things? I'm totally confused after reading tens of article :/

*

*bitbucket is only for hosting revised files? so if I or my developer friend edit index.php, bitbucket will host only index.php?

*from now on do I have to work at localhost and upload the changes to blueshost? no more editing directly at blabla.com/beta? or can I still work on bluehost maybe under blabla.com/beta2?

*When I need to edit any file, do I first download update from bitbucket, I make my change at localhost, update bitbucket for edited files, and uploading to bluehost?

Sorry for silly questions, I really need a guidance...
Appreciate helps so much! thanks a lot!

A:
bitbucket is only for hosting revised files?

The main service of bitbucket is to host files under revision control, but there is also a way to store arbitrary files there.

so if I or my developer friend edit index.php, bitbucket will host only index.php?

I a typical project every file which belongs to the product is cheked into revision control, not only index.php. see this example

from now on do I have to work at localhost and upload the changes to blueshost? no more editing directly at blabla.com/beta? or can I still work on bluehost maybe under blabla.com/beta2?

Mercurial does not dictate a fix workflow. But I recommend that you have mercurial installed where you edit the files. For example then you can see direct which changes you did since the last commit, without to need to copy the files from your server to your local repository.
I absolutely recommend a workflow where somewhere in the repository is a script which generates the archive file which is transmitted to the server, containing the revision of the repository when the archive got created. This revision information should also be somewhere stored on the server (not necessarily in a public accessible area), since this information can get very handy when something went wrong.

When I need to edit any file, do I first download update from bitbucket, I make my change at localhost, update bitbucket for edited files, and uploading to bluehost?

There are several different approaches to get the data to the server:

*

*export the local repo into an archive and transmit this onto the server (hg archive production.tar.bz2), this is the most secure variant, since it does not depend on any extra software on the server. Also depending on how big the archive is this approach can waste lots of bandwidth.

*work on the server and copy changed files back, but I don't recommend this since is is very easy to miss something important

*install mercurial on the server, work in a working copy there and hg export locally there into the production area

*install mercurial on the server and hg fetch from bitbucket(or any other server-accessible repository)

*install mercurial on the server and hg push from your local working copy to the server (and hg update on the server afterwards)

The last two points can expose the repository to the public. This exposition can be both good and bad, depending on what your repository contains, and if you want to share the content. When you want to share the content, or you can limit the access to www.blabla.com/beta/.hg, you can clone directly from your web server.
Also note that you should not check in any files with passwords or critical secrets, even when you access-limit the repository. It is much more save to check in template files (with a different name than in production), and copy-and-edit these files on the server.


text:
Q: Is it possible to have OTP autofill but manually entering is not allowed? I have a weird problem i am facing with. I know about OTP autofill with
textField.textContentType = .oneTimeCode .
But i have a different problem, i want this autofill to work but the text field should be disabled for any manual typing.
Basically , user gets message with OTP on his/her phone and OTP gets autofilled by using .oneTimeCode. But in any case if the app can't read or find OTP through this method(from SMS) , the user should NOT be allowed to manually enter the OTP.
Is there anyway to attain this scenario ?

A: You can set a transparent view on textField & make its userInteraction disable. & for showing keyboard automatically you can use textField.becomeFirstResponder()
You need to disable userInteraction of view that is on your TextField:
transparentView.isUserInteractionEnabled = false

And for display keyboard automatically:
Yoy can write this line in viewWillAppear method when your otpScreen appear.
textField.becomeFirstResponder()

A: At first glance, my suggestion will be adding clear view to block the text field touch, but this will prevent filling the OTP
Disabling user interaction will be preventing filling the OTP too.
Maybe you can use text field delegate on text change, check the new characters. When the characters are less than your OTP length then just ignore the new characters.
textField:shouldChangeCharactersInRange:replacementString:


text:
Q: Configuration Mandril Heroku Ruby on rails I have been trying for a long time to configure a mail sender for heroku,
It was imposible with sendgrid, now im trying with Mandril.
It says i have to put this code, but i don't know where, any sugestion?
require 'mandrill'
m = Mandrill::API.new # All official Mandrill API clients will automatically pull your API key from the environment
rendered = m.templates.render 'MyTemplate', [{:name => 'main', :content => 'The main content block'}]
puts rendered['html'] # print out the rendered HTML

This is my logs:
2015-06-17T01:01:50.949397+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2015-06-17T01:01:50.949399+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
2015-06-17T01:01:50.949400+00:00 app[web.1]:
2015-06-17T01:01:50.949402+00:00 app[web.1]:
2015-06-17T01:01:50.957251+00:00 heroku[router]: at=info method=POST path="/users/password"

enviroment/production.rb
}

ActionMailer::Base.smtp_settings = {
    :port =>           '587',
    :address =>        'smtp.mandrillapp.com',
    :user_name =>      ENV['mandrilusername'],
    :password =>       ENV['mandrilpass'],
    :domain =>         'heroku.com',
    :authentication => :plain
}
ActionMailer::Base.delivery_method = :smtp

end

Any erros here

A: Here's how I configure ActionMailer to send through Mandrill on Heroku.  Stick this in your config/environments/production.rb (or the appropriate environment for your Heroku instance):
# Send emails through Mandrill
config.action_mailer.default_url_options = { :host => 'example.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address: 'smtp.mandrillapp.com',
  port: 587,
  domain: 'example.com',
  user_name: ENV['MANDRILL_USERNAME'],
  password: ENV['MANDRILL_PASSWORD']
}

Then set the two environment variables from the command line:
heroku config:set MANDRILL_USERNAME=myusername
heroku config:set MANDRILL_PASSWORD=mypassword


text:
Q: What is the most efficient desktop to install with mini.iso? I have a friends previously xp machine, that is about 10 years old. It only boots through CD but I've made two different CD-R's with Lubuntu and it won't take. I do get mini-iso to load, and have installed Lubuntu, but is there a more efficient desktop than Lubuntu-desktop?
The computer has 256mb RAM, and when I had Lubuntu-Desktop installed half of it was used up by the desktop. The machine loads Chrome well enough and plays youtube videos barely, but getting movies to play through xbmc/vlc is almost impossible (even logging out and logging in directly to xbmc).
So is there any other desktop I can install other than sudo apt-get install lubuntu-desktop that would allow the computer to browse/watch movies.

A: The lightest desktop you can install from mini.iso or from a full iso is Lubuntu (LXDE).
But if you have installed an Ubuntu desktop (or Lubuntu desktop etc.) you can switch to IceWM, JWM, i3 or other very light window managers.
I would recommend IceWM as a good alternative because there where a debian menu preinstalled and it is very easy to install.
Here is a memory usage overview:

Soure: A Memory Comparison of Light Linux Desktops on l3net

To install IceWM run this:
sudo apt-get install icewm

More info https://help.ubuntu.com/community/IceWM
LXDE vs IceWM

To install JWM run this:
sudo apt-get install jwm

To customize the JWM menu you have to create this file $HOME/.jwmrc
A good jwmrc example file: Link

To install i3 run this in a terminal:
# login to the root shell for one 'echo' command
sudo -i
echo "deb http://debian.sur5r.net/i3/ $(lsb_release -c -s) universe" >> /etc/apt/sources.list
logout
# we're back our user account
sudo apt-get update
sudo apt-get --allow-unauthenticated install sur5r-keyring
sudo apt-get update
sudo apt-get install i3

Source: brentwalther.net
i3 user guide -> http://i3wm.org/docs/userguide.html

A: I have an old XP machine with 256 MB, and I use XFCE, so Xubuntu would probably be your best option.


text:
Q: How to compare an value using xpath? i am currently doing java and html, i have to check some values from the website against my database. i would like to ask if XPATH has such function like "is text present" or "get text = data" rather than get element, is there something to check if the value is there or something?

A: You can use boolean method in XPath.
For example, lets say your XML is this
<?xml version="1.0" >
<persons>
<person>
  <name>Peter</name>
  <sex>MALE</sex>
  <age>25</age>
</person>
</persons>

You can use the boolean method as,
boolean(/persons/person[name = 'Peter'])


text:
Q: Angular2 Resolve before CanActivate I have an Authentication service that implements the Resolve interface to return an observable that is resolved once a user's authentication state is retrieved from the server.
This same authentication service implements the CanActivate interface to block users from accessing a component if they are not logged in.
Currently, the canActivate function is triggered before the resolve function is resolved, meaning it checks the user's login state before the login state has been retrieved from the server.
My question is, how can I prevent the canActivate function being called until resolve is resolved, or otherwise is there another way I can achieve what I want?
Thanks
Max.

A: CanActivate always runs before resolve by design..
..because the resolver should only run after the CanActivate guards have done their job (authentication, cleanup, ..). When you follow this pattern (see below), there is usually little reason to reverse or change this order.

1. CanActivate (authentication):

*

*Authenticate/verify user.

*Get tokens needed to query/get data from a server or API.

*Use either a Promise or Observable to make sure the resolvers wait for the CanActivate guards to complete.

2. Resolve (get data):

*

*When all guards have passed, then it's time for the resolvers to run.

*Get data when you're sure the user is authenticated.

*Get data from the server using the tokens, etc.

*Use either a Promise or Observable to make sure the components are loaded when the resolve data is available.

3. constructor/OnInit (use data):

*

*Get the data from the resolver (with, for example, ActivatedRoute.snapshot.data).

*Render the data in your template or send it to a service.

If, somehow, you really need to wait for the resolvers to complete, just move your code from a guard to a resolver.
You can read more about this in this thread on GitHub.

A: canActivate() can return a boolean, Promise<boolean> or Observable<boolean>.
If you return Promise or Observable, the component can't be navigated to until they are resolved to true.

A: There is a solution to this,
As stated above the resolver always runs after the guard even though the resolver maybe defined at parent level and guard be defined at child level (there is a dirty hack to get around this though) consider the example,
...
{
            path: ':id',
            resolve: { authData: AuthenticationResolverService },
            children:[
              {
                path: 'edit',
                component: ProgramCreateEditComponent,
                children: [
                  {
                    path: 'general',
                    component: ProgramGeneralInfoComponent,
                    canActivate: [AuthGuard],
                  },
                ]
              }
            ]
}
...

you see even in this particular case the AuthGuard shall run before the AuthenticationResolverService, now one solution as stated above would be to simply move the AuthenticationResolverService logic for fetching authentication data to AuthGuard since the guard is also capable of consuming observables(return Observable), however this would be bad in a sense that everytime the guard runs you will fetch authentication data from the server.
However if i introduce a Parent Guard let's say ResolverGuard (it imitates our resolver service) and apply it at the parent route and since Parent Guard shall always run before the Child Guard, we can move our authentication data fetching logic to the parent guard and this would work!,
{
            path: ':id',
            canActivate:[ResolverGuard],
            children:[
              {
                path: 'edit',
                component: ProgramCreateEditComponent,
                children: [
                  {
                    path: 'general',
                    component: ProgramGeneralInfoComponent,
                    canActivate: [AuthGuard],
                  },
                ]
              }
            ]
}

so in this way we can make our ParentGuard imitate as a sort of resolver service, but you may say that how do i get the resolver data Authdata(in our case) then? well its simple you can introduce another service(or any other place) in that case and simply pass data to it while resolving data in parent guard ResolverGuard(in this case) and then get access to that data later on in a resolver or the component.


text:
Q: Removing just position attribute in jQuery I set up a code that have this traits:

*

*the navigation Items-texts- are hidden behind the some Divs I'll call them Navigation Divs

*when the mouse move over the some of pixels-navigation Divs-, the text that they are behind this, slide right and left and in some cases,  some of them move top and bottom about 15 px with animate() method...

*when the mouse move to another Div, other text will be reset to first position
for next action and I did this with:
$(document).on('mouseover', '.pixel#p18', function(){
   $('.submenus').not("this Div's TEXT").fadeOut('fast').removeAttr('style');
});/* this Div's Text is for Example*/

and I wrote this kind for all of my navigation texts..
Now my problem is:

*

*When I hover mouse on one of navigation Divs, some of the texts that they did not animated, become to visible because of removeAttr('style')!!! But I don't want that...

*is there any alternative way that I can slide the texts or other elements to left, right, top and down with optional values of move...??? for example 23px to left or 17px to top...  etc???- I'm familiyar with slideUp and Down and toggle but not sure that they  are good enough for my code...

*Do you have some better Idea for this---that actualy you'll have because I think this is very bad

*and the last Question is that why my codes are very slow in running? the animations that I wrote have lak some times and I'm not Sure that the problem is my selector or other stuff.

A: For this you need something like .animate which has a callback. So something like:
$('.submenus').not("this Div's TEXT").animate({opacity:0},500,'linear', function() {
    $(this).removeAttr('style');
});

This will only remove the attribute when the animation is complete.


text:
Q: Alternative to PyGObject? Does anyone have an alternative to using PyGObject? I can't seem to get it to run at all in Mac OS X. I'm trying to use papyon, which fails amazingly well if GObject isn't around.

A: By its description, it is used for async I/O only. You can try to rework the library to use any of the other Python async libraries, like asyncore, Twisted, or any other.
Also, getting PyGObject on Mac OS X is hard, but you can try to use the one from macports,  macports being the new name for darwinports

A: You can instally PyGobject on Mac OS X with Darwinports, instructions here .


text:
Q: expo-cli Errors on fresh installation I ran the following commands as in the documentation to get started:
$ yarn global add expo-cli
$ expo init myNewProject
$ cd myNewProject
$ expo start

Got the following errors
Error: Invalid sdkVersion. Valid options are 7.0.0, 8.0.0, 9.0.0, 10.0.0, 11.0.0, 12.0.0, 13.0.0, 14.0.0, 15.0.0, 16.0.0, 17.0.0, 18.0.0, 19.0.0, 20.0.0, 21.0.0, 22.0.0, 23.0.0, 24.0.0, 25.0.0, 26.0.0, 27.0.0, 28.0.0, 29.0.0, 30.0.0, 31.0.0, 32.0.0, 33.0.0, 34.0.0, 35.0.0, 36.0.0, 37.0.0, 38.0.0, 39.0.0
error: unknown option `--assetExts'

Metro Bundler process exited with code 1

Than I added "sdkVersion": "39.0.0", to app.json.expo, ran $ expo start again and the second error still remains:
error: unknown option `--assetExts'

Metro Bundler process exited with code 1

Running $ EXPO_DEBUG=true expo start gives the following:
Metro Bundler process exited with code 1
Error: Metro Bundler process exited with code 1
    at ChildProcess.<anonymous> (/@expo/xdl@56.2.7/src/Project.ts:1804:16)
    at Object.onceWrapper (events.js:284:20)
    at ChildProcess.emit (events.js:196:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)

my app.json is:
{
  "name": "reactNativeExpo",
  "displayName": "React Native Expo",
  "expo": {
    "name": "reactNativeExpo",
    "slug": "expo-template-bare",
    "version": "1.0.0",
    "sdkVersion": "39.0.0",
    "assetBundlePatterns": ["**/*"]
  }
}

My system info
$ yarn global list expo
yarn global v1.21.1
info "expo-cli@3.27.13" has binaries:
   - expo
   - expo-cli

$ npm -v
6.14.8

$ node -v
v12.0.0

Again this is a fresh installation, I haven't done anything except the steps I outlined above.
Any help is appreciated :)

A: upgrading node to 12.13.0 did the trick. Opened an issue in expo-cli to suggest documentation for that


text:
Q: hg command for git bundle In git, there is a command 'git bundle' which bundles a git repository into 1 big file.
Is there the equivalent command for 'hg'?

A: Hg supports the same command.  Here's the help for it:

U:\>hg help bundle
hg bundle [-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]

create a changegroup file

    Generate a compressed changegroup file collecting changesets not known to
    be in another repository.

    If you omit the destination repository, then hg assumes the destination
    will have all the nodes you specify with --base parameters. To create a
    bundle containing all changesets, use -a/--all (or --base null).

    You can change compression method with the -t/--type option. The available
    compression methods are: none, bzip2, and gzip (by default, bundles are
    compressed using bzip2).

    The bundle file can then be transferred using conventional means and
    applied to another repository with the unbundle or pull command. This is
    useful when direct push and pull are not available or when exporting an
    entire repository is undesirable.

    Applying bundles preserves all changeset contents including permissions,
    copy/rename information, and revision history.

options:

 -f --force      run even when the destination is unrelated
 -r --rev        a changeset intended to be added to the destination
 -b --branch     a specific branch you would like to bundle
    --base       a base changeset assumed to be available at the destination
 -a --all        bundle all changesets in the repository
 -t --type       bundle compression type to use (default: bzip2)
 -e --ssh        specify ssh command to use
    --remotecmd  specify hg command to run on the remote side

The command for the reverse operation is hg unbundle.


text:
Q: Collisional quenching in fluorescence I am studying collisional quenching phenomenon in fluorescent measuring and I am focusing on Stern - Volmer relationship.

I can't understand why the ratio of the intensities of fluorescence is equal to quantum yields' one (and so of time-fluorescence), and there is no exponential relationship according to Lambert-Beer equation.


text:
Q: Python yield inside lambda function I am trying to create a pytest fixture that takes an argument and yields a pymongo.MongoClient:
@pytest.fixture(scope='session')
def mongo_test_db(django_db_setup) -> Database:
    """ Fixture to use in tests that require access to Mongo

    Drops database first to ensure a clean state.

    Depends on the external Mongo process running in the background

    Changes setting MONGO_CONNECTION to MONGO_TEST_CONNECTION defined in settings.
    """
    def _generate(db_name):
        assert settings.MONGO_TEST_CONNECTION, "MONGO_TEST_CONNECTION not defined"

        settings.MONGO_CONNECTION = settings.MONGO_TEST_CONNECTION

        client = MongoClient(settings.MONGO_CONNECTION)
        client[db_name].command("dropDatabase")
        yield client[db_name]
        client[db_name].command("dropDatabase")

    return _generate

The code does work, but instead of yielding and actual value of generator I get a generator object instead; therefore, I need to call next(mongo_test_db("test")) instead of mongo_test_db("test")
I want to simply call mongo_test_db("test") and get the actual pymongo client, not the generator object.


text:
Q: If eight out of nine vertexes can't be roots, is the last vertex a root? I want to modelize an electrical circuit. In order to be isolated from electrical issues power has to be put in a root vertex.
Consider that $x$ is a root $iif \ \ \forall y_i \ne x,\ x$ is ascendent of  $y_i$. That is to say if there is no edges that comes into $x$.
If eight out of nine vertexes can't be roots, why is the last vertex a root?
Consider that $x$ is an anti-root $iif \ \ \forall y_i \ne x,\ x$ is descendent (going-out) from $y_i$. That is to say if there is no edges that comes from $x$.
Let consider this graph $G=(X,U)$ I have showed that eight out of nine vertexes can't be roots as far as if it were the case, one must be an anti-root of all others. Yet $g$ is outgoing of $f$ and $d$ is outgoing of $e$. Thus eight out of nine vertexes can't be root of all others.
However it doesn't show that the last vertex is actually a root!
Thus how can I show that the last vertex must be a root of $G$?

A: You have not made it exactly clear why a node can or can't be a root (or what an anti-root is). I assume that the current in your graph only flows in the direction of the edges. So you could prove a node is the root by showing that there is a directed path from that node to every other node.
It looks like that if there is a root, it must be $a$ since $a$ has no edges pointing into it.


text:
Q: Force wordpress page to refresh ==SITUATION==
Currently, I am using Wordpress to display announcement.
There is 1 server to host Wordpress and 4 other PC to show the announcement. Each PC have their own page URL to show the announcement. For example

*

*PC1 (1st floor) - http://localhost/announcement1

*PC2 (2nd floor) - http://localhost/announcement2

*PC3 (3rd floor) - http://localhost/announcement3

*PC4 (4th floor) - http://localhost/announcement4

*Admin PC

Currently, let say if I do some announcement changes to http://localhost/announcement1, then I need to walk to 1st floor and manually refresh the page to get the latest announcement. This goes same with others announcement.
==QUESTION==

*

*What I want to accomplish is, I would like to force the PC1 browser to refresh the page directly from the Wordpress admin dashboard (PC1 automatically refresh when the page is saved/updated). Is it possible?

I searched all over the web for the solution but I don't know the exact keyword to search for and have no luck.
Thank you

A: The most simple way would be to set a refresh meta for your announcement page. For example, 5 seconds:
<meta http-equiv="Refresh" content="5">

I don't know if you have a theme that you can modify, but one route to go about this is by using the hook on the wp_head action. Like this:
function wp_50642305_add_refresh_header() {
   echo '<meta http-equiv="Refresh" content="5">';
}
add_action( 'wp_head', 'add_refresh_header' );

You could place that in functions.php of your theme or perhaps in a plugin file.
https://codex.wordpress.org/Plugin_API/Action_Reference/wp_head

A: After a while, I found a plugin that helps what I want to achieve.
https://wordpress.org/plugins/force-refresh/
With a single click, I manage to "force" refresh the client browser.
"The way the plugin works is that the user's browser will check with the website every two minutes to make sure it's up to date, and if not it'll refresh."
Hope this will help others who are looking for the same solution.


text:
Q: Can Master also be configured as memory-optimized? I am currently discovering the new SQL Server 2022 features and found this message in the error log

cleanup of stale db entries skipped because master db is not memory optimized

At first I thought this message was due to a non-memory-optimized TempDB, but after enabling MO tempdb (and a restart) I still get this message.
My friend google doesn't provide me with an answer. Is this a future extension?


text:
Q: How to override method via keyboard shortcut in Android Studio I can finally ask a question to get my points up.
In android studio, I want to be able to override the method, however I do not know the keyboard shortcut.  Does anyone know?

A: CTRL + O
For more shortcut look here (archive.org mirror)

A: Windows and Linux
CTRL + O
Mac
^ + O

Complete IntelliJ shortcuts
Windows and Linux
MacOSX

A: You can not remember all shortcuts :)
Android Studio(actually Intellij)
has a solution
quick command search : ctrl+shift+A

if you have more memory here it is CTRL + O

A: ctrl + o -> windows shows overriden method in Android Studio


text: Q: creates a Debian binary package, a .deb file from cx_Freeze-d Python executables After freezing my python scripts into executables via cx_Freeze, I wonder how to package this executables into a debian binary package, a .deb file. Any ideas?


text:
Q: Android: getting Null Pointer Exception when inserting in Array I'm getting the error "java.lang.NullPointerException: Attempt to write to null array" when, after getting some data from database I have to put that data in a ArrayAdapter.
DatabaseHelper databaseHelper = new DatabaseHelper(this.getApplicationContext());

        List <Gasto> gastos;
        gastos = databaseHelper.getAllGastos();

        Gasto[] items=null;

        for(int i=0;i<gastos.size();i++)
        {
            items[i] = new Gasto(gastos.get(i).getMes(),gastos.get(i).getAno(), gastos.get(i).getDespesa_final());

        }

dataAdapter = new ArrayAdapter<Gasto>(this,android.R.layout.simple_list_item_1, items);

Can you please tell me how can I solve this error?

A: Gasto[] items=null;

you have to create the array of Gastos before accessing it:
Gasto[] items = new Gastos[gastos.size()];

A: Gasto[] items = null; is the problem. Array is not created when you insert to it. Use Gasto[] items = new Gasto[gastos.size()];


text:
Q: Problem with XeLaTeX xdv2pdf mode and font compilation I recently upgraded to TexLive2013 (Basic) and this broke the setup I use for letters of recommendation. I need to use a legacy university font which requires XeLaTeX in the mode xdv2pdf. MWE is below
%!TEX TS-program = XeLaTeX-xdv2pdf
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{xltxtra} % Loads fontspec, xunicode, metalogo, fxltx2e, and some extra customizations for XeLaTeX
\setmainfont{YaleAdmin}
\begin{document}

 Look at the following data from six different languages and answer the questions below:
\end{document}

I get the following errors:
(/usr/local/texlive/2013basic/texmf-dist/tex/latex/realscripts/realscripts.sty
*************************************************
* LaTeX warning: "xparse/redefine-command"
*
* Redefining document command \textsubscript with arg. spec. 's' on line 25.
*************************************************
*************************************************
* LaTeX warning: "xparse/redefine-command"
*
* Redefining document command \textsuperscript with arg. spec. 's' on line 28.
*************************************************
) (/usr/local/texlive/2013basic/texmf-dist/tex/latex/metalogo/metalogo.sty))
kpathsea: Running mktextfm YaleAdmin
/usr/local/texlive/2013basic/texmf-dist/web2c/mktexnam: Could not map source abbreviation Y for YaleAdmin.
/usr/local/texlive/2013basic/texmf-dist/web2c/mktexnam: Need to update /usr/local/texlive/2013basic/texmf-dist/fonts/map/fontname/special.map?
mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input YaleAdmin
This is METAFONT, Version 2.718281 (TeX Live 2013)

kpathsea: Running mktexmf YaleAdmin
! I can't find file `YaleAdmin'.
<*> ...jfour; mag:=1; nonstopmode; input YaleAdmin

Please type another input file name
! Emergency stop.
<*> ...jfour; mag:=1; nonstopmode; input YaleAdmin

Transcript written on mfput.log.
grep: YaleAdmin.log: No such file or directory
mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input YaleAdmin' failed to make YaleAdmin.tfm.
kpathsea: Appending font creation commands to missfont.log.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "YaleAdmin" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.7 \setmainfont{YaleAdmin}

The font is installed in the same directory as other fonts that fontspec can find.


text:
Q: Similar matrices and eigenvectors I'm reading a paper and came across the following line.
$R_g = R_{cg} R_c R_{cg}^{T}$
I recognize that $R_g$ and $R_c$ are similar matrices, and since they represent rotations, they are orthogonal.

As a result, the eigenvector matrix of $R_g$ can be transformed from that of $R_{c}$ using $R_{cg}$

I don't really understand the significance of the above statement nor how it came about. I understand that similar matrices share the same eigenvalues, but I don't know about any statements regarding eigenvectors.

A: Let $v$ be an eigenvector of $R_c$ with eigenvalue $\lambda$. Then since $R_{cg}$ are rotation matrices, $R^{-1}_{cg}=R^{T}_{cg}$, so that if $u:=R_{cg}v$, then $R_gu=R_{cg}R_cv=\lambda R_{cg}v = \lambda u$, so that $u$ is an eigenvector of $R_{g}$. All the above transformations are invertible, so that any eigenvector $u$ of $R_{g}$ is of the form $R_{cg}v$ for $v$ an eigenvector of $R_c$.


text:
Q: Metes and bounds automation in ArcMap? We are using the metes and bounds in old pipeline alignment sheets in an edit session in ArcMap to plug in the "direction/length" values to generate the line segments.
Does anyone have any idea how I could explore further on how would this be done in Python?
For example if I used an insert cursor and some how mangled that with some trigonometry... (grasping for straws here).  All I have is an alignment sheet giving a string of these: S-34-47-00-E 567'.

A: Look at cogo tools. I think there is a toolbar for that in arceditor.
Autocad map3d and civil3d both have that also.
I believe I have even seen something on th Qgis list mentioning a plugin for it.
Also a paid for desktop application for Arcmap. This is a very nice software (opinion based on how well it works, how often it is updated, what the output is, and the quality of help you get).
They also have an online version. so you can program and make calls to their server for output back to yours.


text:
Q: How can I convert this percentage into odds? How can I convert the percentage 0.000007151123842% into odds, so the outcome would be 1 in 13983816. Basically, I am looking for a way to convert any positive percentage into odds so the outcome gives me 1 in N.

A: To convert something to be "1 in N", you simply take the reciprocal. In this case, you have it correct:
$$ \frac{1}{0.00000007151123842} = 13,983,816 $$
So you get an event that happens "1 in 13,983,816" tries.
Odds are a bit different in that they usually give the ratio between two events happening. For example 1:1 (pronounced "1 to 1") odds means a 50% chance of that event happening and is equivalent to "1 in 2". A 20% chance would be 1:4. So, you'll subtract 1 from the reciprocal to get odds of 1:13,983,815.
In general, the odds are
$$ 1:\bigg(\frac{1}{p}-1\bigg) $$
where $p$ is the probability of the event expressed as a decimal.


text:
Q: Background coloring in R Markdown (html) with KableExtra based on multiple conditions (problems with NA) (R) I would like to background-color the values of the corresponding matrix based on several conditions.

The conditions are the following:

*

*X > 0.5 -> green

*X < 0.5 -> red

*X = 0.5 -> no coloring

Input:
matrix %>%
    mutate_at(vars(BM), ~ cell_spec(
        ., "html",
        background = ifelse(. > 0.5, "lightgreen", ifelse(. < 0.50, "tomato"))
        )) %>%
    mutate_at(vars(COM), ~ cell_spec(
        ., "html",
        background = ifelse(. > 0.5, "lightgreen", ifelse(. < 0.50, "tomato"))
        )) %>%
    kable(format = "html", escape = FALSE, digits = 2) %>%
    kable_styling("striped", full_width = FALSE)

The above code works fine for column "BM and "COM" as no NAs are apparent.

However, as soon as I add column "CC" the following error message occurs.
Error: Problem with `mutate()` input `CC`.
x missing value where TRUE/FALSE needed
i Input `CC` is `(structure(function (..., .x = ..1, .y = ..2, . = ..1) ...`.
i The error occured in group 2: CNTRY = "MX":

Problems to solve

*

*How can I work around the NAs so that I can color all the columns?

*The rounding seems not to work in the colored matrix. Why? How can I work around that?

Any help is very appreciated!


text:
Q: Converting a discrete statistical energy distribution to a continuous version The probability of finding a particle at a particular energy level when energy is considered discrete is according to Boltzmann:
$$P(E_j) = \frac{g_j\cdot e^{-\beta E_j}}{\sum_{j=1}^\infty g_j \cdot e^{-\beta E_j}}$$
Where $g_j$ is the degeneracy of energy level $Ej$ and is derived by calculating the surface of 1/8th of a sphere in n-dimensions.
When energy is considered continuous, it is said that the probability density $P′(E)$ is proportional to:
$$P'(E) \propto D(E) \cdot e^{-\beta E}$$
Here $D(E)$ is the Density of states formula and is the derivative of 1/8th of the volume of the sphere in n-dimensions.
I have a hard time understanding the derivation of this proportionality in the continuous approach. How is it concluded from the discrete formula and/or by other means?


text:
Q: Using .load in JavaScript I am using .load() function in JavaScript and I'm working with JSP java files. I am loading a page like this in JavaScript
$("#body").load("livestatus #status")

The problem is the div I'm trying to load doesn't load immediately on page load because it contains some data from APIs, so there's a one second delay but my code doesn't accommodate that delay.

A: Try to put your code in document.ready block or if you are making an ajax request then put your code in Ajax success function

A: If you use jQuery and it just not initialized for some element, you can use
$(function() {
    $("#body"). // ... your code
});

If it calls through some time and you can't track when exactly, you can use live listeners on some event. Like, click on this element.
$("body").on("click", "#body", function() {
    // your code
});

$("body") can contain any parent element which had loaded before jQuery.
Or you can load 1px image with you code which loads after main code and track when it will load.

The second image is encoded with base64.
[UPD] old version of jQuery have another syntax. More: http://api.jquery.com/live/


text:
Q: jQuery Scrollbar on window resize not working I am using jquery scrollbar plugin for my website. Everything is working good. But when I resize window in mozilla and make scroll div and resize again its looks uneven scrollbar.
How to make the custom scrollbar will be visible if the browser resize also.
script I have tried:
$('.scroll-lmenu').scrollbar({
    autoUpdate :true,
    autoScrollSize: true
});

$(document).ready(function(){
    $('.scrollbar-inner').scrollbar();
});
.scrollbar-inner {
    max-height: 300px;
    overflow: auto;
}

<link href="https://gromo.github.io/jquery.scrollbar/jquery.scrollbar.css" rel="stylesheet"/>

            Simple inner scrollbar over content

            Click to test #anchors

            <input type="text" value="Use TAB to focus next input" style="max-width:220px; width: 100%;">

            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a,
            scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
            Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel
            hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue,
            pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam
            sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare,
            ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
            nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam
            viverra nisi, in interdum massa nibh nec erat.

            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a,
            scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
            Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel
            hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue,
            pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam
            sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare,
            ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
            nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam
            viverra nisi, in interdum massa nibh nec erat.

            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a,
            scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
            Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel
            hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue,
            pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam
            sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare,
            ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
            nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam
            viverra nisi, in interdum massa nibh nec erat.

        <input type="text">

Anchor

A: Mozilla does have some extensions for manipulating the scroll-bars but they are all recommended not to be used.
-moz-scrollbars-none They recommend using overflow:hidden in place of this.
-moz-scrollbars-horizontal Similar to overflow-x
-moz-scrollbars-vertical Similar to overflow-y
-moz-hidden-unscrollable Only works internally within a users profile settings. Disables scrolling XML root elements and disables using arrow keys and mouse wheel to scroll web pages.
Mozilla Developer Docs on 'Overflow'
Further details about Mozilla
This is not really useful as far as I know, but it's worth noting that the attribute which controls whether or not scrollbars are displayed in Firefox is: (reference link)
Attribute:       scrollbars
Type:              nsIDOMBarProp
Description:  The object that controls whether or not scrollbars are shown in the window. This attribute is "replaceable" in JavaScript. Read only
Last but not least, padding is like magic.
As has been previously mentioned in some other answers, here is an illustration which is sufficiently self-explanatory

A: That was you body's scroll bar disable the body's overflow-y.

$(document).ready(function(){
    $('.scrollbar-inner').scrollbar();
});
.scrollbar-inner {
    max-height: 300px;
    overflow: auto;
}
body{
overflow:hidden;

}

<link href="https://gromo.github.io/jquery.scrollbar/jquery.scrollbar.css" rel="stylesheet"/>

            Simple inner scrollbar over content

            Click to test #anchors

            <input type="text" value="Use TAB to focus next input" style="max-width:220px; width: 100%;">

            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a,
            scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
            Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel
            hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue,
            pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam
            sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare,
            ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
            nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam
            viverra nisi, in interdum massa nibh nec erat.

            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a,
            scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
            Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel
            hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue,
            pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam
            sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare,
            ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
            nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam
            viverra nisi, in interdum massa nibh nec erat.

            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a,
            scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus.
            Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis, turpis vel
            hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue,
            pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam
            sit amet lectus quis est congue mollis. Phasellus congue lacus eget neque. Phasellus ornare,
            ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget
            nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam
            viverra nisi, in interdum massa nibh nec erat.

        <input type="text">

Anchor

Use overflow-x: scroll and overflow-y: hidden, or overflow: hidden scroll instead.
Link To developer.mozilla.org

A: You can add max-height:100vh and remove body margin margin:0

$(document).ready(function() {
  $('.scrollbar-inner').scrollbar();
});
body {
  margin: 0
}

.scrollbar-inner {
  max-height: 100vh;
  overflow: auto;
}

<link href="https://gromo.github.io/jquery.scrollbar/jquery.scrollbar.css" rel="stylesheet" />

    Simple inner scrollbar over content

    Click to test #anchors

    <input type="text" value="Use TAB to focus next input" style="max-width:220px; width: 100%;">

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a, scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis,
    turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet lectus quis est congue mollis. Phasellus congue
    lacus eget neque. Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in interdum massa
    nibh nec erat.

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a, scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis,
    turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet lectus quis est congue mollis. Phasellus congue
    lacus eget neque. Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in interdum massa
    nibh nec erat.

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Proin nibh augue, suscipit a, scelerisque sed, lacinia in, mi. Cras vel lorem. Etiam pellentesque aliquet tellus. Phasellus pharetra nulla ac diam. Quisque semper justo at risus. Donec venenatis,
    turpis vel hendrerit interdum, dui ligula ultricies purus, sed posuere libero dui id orci. Nam congue, pede vitae dapibus aliquet, elit magna vulputate arcu, vel tempus metus leo non est. Etiam sit amet lectus quis est congue mollis. Phasellus congue
    lacus eget neque. Phasellus ornare, ante vitae consectetuer consequat, purus sapien ultricies dolor, et mollis pede metus eget nisi. Praesent sodales velit quis augue. Cras suscipit, urna at aliquam rhoncus, urna quam viverra nisi, in interdum massa
    nibh nec erat.

  <input type="text">

Anchor

A: body {
  margin: 0
}

.scrollbar-inner {
  max-height: 100vh;
  overflow: overflow-x ;
}

A: You can directly hide the scroll bar by
.scrollbar-inner > .scroll-element{ display:none;}

A: Try not Using
$(document).ready(function(){
$('.scrollbar-inner').scrollbar();

});
https://codepen.io/sheetalsinghwd/pen/povoYbv
like this

A: try adding the following to document ready
    $(".scrollbar-inner").hover(function() {
      $("body").css("overflowY", "hidden");
    });

    $(".scrollbar-inner").mouseleave(function() {
      $("body").css("overflowY", "auto");
    });


text:
Q: Building Decision Tree on a high dimensional data set with sparse Boolean values I have been trying to learn a decision tree on a data-set with almost 400 features. The target variable has only two values and the data is highly skewed towards the non-event class (90 % of the data set).
All the features take only Boolean values. The decision tree plots are skewed towards the non event class. I am looking for the path that helps me predict the event class.
I couldn't find a definitive answer anywhere. Can anyone give me some ideas?
EDIT:
Apologies if the question wasn't clear. I just started as a Data Science inter, and this is my first project.
The decision tree predicts almost all the non-event class (90% of the data) with high accuracy, whereas almost entirely misclassifies the event class.
What do I need to do to build the tree that predicts the non-event class with high accuracy and to see the decision paths that makes up such a tree?
I tried ensemble methods but it only improved my classifier marginally

A: Clarification of the problem
To clarify the OP's problem, as I read it (and your edit makes this more clear): Given a dataset with 10% events and 90% nonevents, a naive classifier could obtain 90% accuracy simply by choosing the 'nonevent' outcome every single iteration.
Tree-based algorithms (as well as other types of classifiers) can easily fall into this minimization 'mistake' because the algorithm is designed to treat all errors as equal; in many real-world situations, this is simply not acceptable, and one may prefer an algorithm that makes proportionally more false-alarm errors in order to improve the detection rate. 90% vs. 10% is actually a fairly benign example of this problem, in many real world cases the ratio is much worse.
Possible solutions
The two common ways to deal with this problem are:
1) Sampling. For each training step, either a) over-sample the underrepresented class, or b) under-sample the overrepresented class.
2) Error-weighting. Penalize misses of the event (model says "no event" when there is one) more than false alarms (model says "event" when there is no event).
Different packages that implement tree-based classification often implement one or both of these approaches out of the box.


text:
Q: Is it possible to send file to Azure Event Hubs? I want to send .zip files to Event Hubs and then listen the Event Hub with a console application and receive this file to unzip it. Is Event Hubs the correct solution for this ?
I need a relaible solution for this because there will be thousands of clients that will send .zip files to my Event Hub.

A: It is certainly possible to send files to Event Hubs by sending the file contents as byte array but it is not recommended because the maximum size of event data is 256KB.
Better approach would be to upload the zip files in blob storage and send the link to those blobs as event data. On the client side when you fetch the event data, extract the blob url and download the blobs.


text:
Q: simple javascript, functions in objects var rooms = {
bedroom: {
    info: "A dusty bed lies sideways in the midle of the room";

    north: function (  ) {
        //this function returns an error
    }
}
};

I cant work out why this returns an unexpected identifier
-- edit
thanks another question
in javascript the good parts he has
var myObject = {
    value: 0;
    increment: function (inc) {
        this.value += typeof inc === 'number' ? inc : 1;
    }
};

is this different to what I am doing?

A: One should use a , inside of object literals when defining keys and values to separate them, not ;.
var o = { name: 'john', age: 13 }

A: the room";

There should be ,, not ;.

A: To answer your second question, it looks there is a typo in the book.
The incorrect example is:
var myObject = {
    value: 0;
    increment: function (inc) {
        this.value += typeof inc === 'number' ? inc : 1;
    }
};

The correct example is:
var myObject = {
    value: 0,
    increment: function (inc) {
        this.value += typeof inc === 'number' ? inc : 1;
    }
};

Note the comma on the line value: 0,.
As others have mentioned, the comma should be used (instead of the semicolon) for object literals.