text:
Q: Java Spring Boot - Project 'org.springframework.boot:spring-boot-starter-parent:2.5.0' not found errors I am trying to start working with Spring Boot. I was going to follow a tutorial, and this tutorial took me to Spring Initializr. I generated a Maven project with Java 1.8, along with only the Spring Web dependency. Then, I tried to open it in IntelliJ community edition.
However, upon opening the project, I noticed 9-10 errors within the pom file. I have tried a number of things, but nothing has worked so far. I am new to Java, so I don't know if it's a JDK issue or whatever, but on the video, it worked seamlessly for him. I will attach a screenshot.
When I type java -version into CMD, I get the response java version "1.8.0_291" for reference.
Here is a list of the errors (screenshot not working):

*

*Project 'org.springframework.boot:spring-boot-starter-parent:2.5.0' not found

*Dependency 'org.springframework.boot:spring-boot-starter-web:' not found

*Plugin 'org.springframework.boot:spring-boot-maven-plugin:' not found

*org.springframework.boot:spring-boot-starter-parent:pom:2.5.0 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.5.0 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.5.0/spring-boot-starter-parent-2.5.0.pom
Each of these errors appears about 3 times. These errors are generated from a fresh Spring Initializr download, so you can get the same exact file through the website yourself, too.
Thank you so much in advance!


text:
Q: Can someone help me in convert this MySql query to sequelize? I am new to sequelize. I am not sure how to convert this MySql query so that I can use it in my node.js file.
MySql query:
SELECT Rtrim(Ltrim(childstatus)),TIMESTAMPDIFF(d,dob,now(3))
INTO @childstatus, @Ageday
FROM childdetails where registno=@registno

I have sequelize model for childdetails. I am not sure how to structure this query.

A: You can use Sequelize.fn to call these two functions indicating them in attributes option like this:
const details = await ChildDetials.findAll({
  attributes: [
  [Sequelize.fn('RTrim', Sequelize.fn('LTrim', Sequelize.col('childstatus'))), 'childsttaus'],
  [Sequelize.fn('TIMESTAMPDIFF', Sequelize.literal('d'), Sequelize.col('dob'), Sequelize.fn('now', 3)), 'Ageday']
  ],
  where: {
    registno: registno
  }
})

redpajama_set_name: RedPajamaStackExchange


text:
Q: Cannot import data.table := operator into mlflow library , error: Invalid Request. could not find function ":=" I am having troubles in bring in the symbol := from data.table into mlflow library.
Basically I am building a docker container to serve machine learning models.

*

*the docker is based off rocker/r-ver:4.1.3

*the ml model is created by R crate function, this model predict function is written in R and uses data.table, including operator :=

*the docker is running to serve API request and use ml model to predict a response. during the ml model predict function, i had error:  Invalid Request.  could not find function ":="

I have read the references, tried all of them but none worked.
Basically I am using remotes to install mlflow locally, instead of devtools.

*

*I clone the mlflow repo to local mlflow-debug

*add data.table (>= 1.9.6), in the depends section of the DESCRIPTION file

*turn on building dependencies by set dependencies and build to TRUE in remotes::install_local, see below dockerfile

FROM rocker/r-ver:4.1.3
blah blash

RUN pip install mlflow==1.24 protobuf==3.20.0
RUN Rscript -e 'install.packages(c("glmnet", "carrier", "data.table", "R.filesets"))'

COPY mlflow-debug mlflow-debug
RUN Rscript -e 'install.packages("remotes")'
RUN Rscript -e 'remotes::install_local(\
    path="mlflow-debug/mlflow/R/mlflow",\
    dependencies = TRUE,\
    build = TRUE,\
    upgrade="never"\
    )'

At this point, I suspect that the issue is not bringing in the := symbol into mlflow library.
Any ideas or help will be welcome, thanks a lot!
references:

*

*Using data.table package inside my own package

*Making a package in R that depends on data.table

*R data.table ':=' works in direct call, but same function in a package fails

*data.table := not working in a package function


text:
Q: Change color of individual section in UICollectionView My question for today that I have been trying to figure out for a while but what is really buggy or doesn't work because I'm unclear on how to implement it is how to change the color of the individual sections in a collection view. For example, I would like sections 0-2 to be orange, 3-5 to be blue, 6-8 to be pink, and 9-11 to be green.
I have tried to implement the code in these two repositories. The first one after implementing worked somewhat but is very buggy when I try to scroll the collection view, but I think I didn't implement it correctly. The second one after trying to implement it, nothing showed up so I don't think I did that correctly either. My goal is to hard-set the color for each section.
Here is the code for creating the collection view:
let friendsCollectionView: UICollectionView = {
        let layout = UICollectionViewFlowLayout()
        //also tried let layout = SectionBackgroundFlowLayout() and let layout = ColorFlowLayout()
        layout.scrollDirection = .horizontal
        let cv = UICollectionView(frame: .zero, collectionViewLayout: layout)
        cv.translatesAutoresizingMaskIntoConstraints = false
        cv.register(FriendsCell.self, forCellWithReuseIdentifier: "cell")
        cv.layer.cornerRadius = 10
        cv.isPagingEnabled = true
        cv.showsHorizontalScrollIndicator = false
        return cv
       }()

This is an addition that I pulled from the example repo of the second repo:
class ColorFlowLayout: UICollectionViewFlowLayout {

// MARK: prepareLayout

override func prepare() {
    super.prepare()

//        minimumLineSpacing = 8.0
//        minimumInteritemSpacing = 8.0
//        sectionInset = UIEdgeInsetsMake(8, 8, 8, 8)
//
//        let width = (UIScreen.main.bounds.width / 3) - 2 * 8.0
//        itemSize = CGSizeMake(width, 100)

    //register(SCSBCollectionReusableView.self, forDecorationViewOfKind: "sectionBackground")

    register(UICollectionView.self, forDecorationViewOfKind: "sectionBackground")
}

// MARK: layoutAttributesForElementsInRect
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
    let attributes = super.layoutAttributesForElements(in: rect)
    var allAttributes = [UICollectionViewLayoutAttributes]()

    if let attributes = attributes {

        for attr in attributes {
            // Look for the first item in a row
            // You can also calculate it by item (remove the second check in the if below and change the tmpWidth and frame origin
            if (attr.representedElementCategory == UICollectionElementCategory.cell && attr.frame.origin.x == self.sectionInset.left) {

                // Create decoration attributes
                let decorationAttributes = SCSBCollectionViewLayoutAttributes(forDecorationViewOfKind: "sectionBackground", with: attr.indexPath)
                // Set the color(s)
                if (attr.indexPath.section % 2 == 0) {
                    decorationAttributes.color = UIColor.orange //Just two different colors to test at the moment
                } else {
                    decorationAttributes.color = UIColor.blue
                }

                // Make the decoration view span the entire row
                let tmpWidth = self.collectionView!.contentSize.width
                let tmpHeight = self.collectionView!.contentSize.height // or attributes.frame.size.height instead of itemSize.height if dynamic or recalculated

                decorationAttributes.frame = CGRect(x: 0, y: attr.frame.origin.y - self.sectionInset.top, width: tmpWidth, height: tmpHeight)

                // Set the zIndex to be behind the item
                decorationAttributes.zIndex = attr.zIndex - 1

                // Add the attribute to the list
                allAttributes.append(decorationAttributes)
            }
        }
        // Combine the items and decorations arrays
        allAttributes.append(contentsOf: attributes)
    }

    return allAttributes
}

}
Let me know if you have any questions or if I could provide any more information. All help is much appreciated!


text:
Q: Center vertically menu icon in Chrome for Mobile I have a menu icon that's perfectly vertically centered in all browsers but in Chrome for Mobile not. This is the code for the menu icon:
-HTML-

-CSS-
.menuIcon{
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    margin-left: auto;
    padding: 2px 6px;
    color: #424242;
    transition: background-color 0.8s ease 0s;
}
.menuIcon:hover{
    background-color: #ddd;
}
.im {
  display: inline-block;
  font: normal normal normal 24px/1 'iconmonstr-iconic-font';
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

I tried with line-height: 24px and other properties but with no result. With padding: 6px 2px 2px is more or less centered in Chrome for Mobile but in desktop browsers is malformed so it's not an option. If someone could also explain me this behaviour I will be very grateful.
Here's the link to my website. Remember that the problem is only in Chrome for Mobile.
I upload a screenshot of the problem.


text:
Q: How can I make a VBA function work upon opening the workbook I created a function in vba to determine if a row is visible.  The function returns 1 if visible and 0 if not visible.  The function looks like this:
Function IsRowVisible(MyRange As Range) As Integer

    If (MyRange.EntireRow.Hidden = False) Then
        IsRowVisible = 1
    Else
        IsRowVisible = 0
    End If

End Function

I then have a column in my workbook where I refer to this function in a formula such as:
=IsRowVisible(A1)
The formula returns #VALUE! until I run a macro that runs some other code or until I click the formula and hit Enter.  Then it works fine.
I would like it to work like a normal function in Excel where a value is returned when you open the workbook.  Where am I going wrong?
Thanks for your help!

A: Does this improve things?:
Function IsRowVisible(MyRange As Range) As Integer
    Application.Volatile
    If (MyRange.EntireRow.Hidden = False) Then
        IsRowVisible = 1
    Else
        IsRowVisible = 0
    End If

End Function

This is probably a volatility issue.  Your function may only be re-calculating when the value in A1 changes.
You may need to combine your function with a SUBTOTAL() function because SUBTOTAL() does recalculate when rows are hidden/unhidden.


text:
Q: Unix Sockets : AF_LOCAL vs AF_INET I'm just starting with socket programming in UNIX and I was reading the man pages for the socket system call. I'm a bit confused about the AF_LOCAL argument and when it is used. The manual just says local communication. Wouldn't an AF_INET format also work for local communication?

A: AF_LOCAL uses UNIX domain sockets which are local to the filesystem and can be used for internal communications. AF_INET is an IP socket. AF_LOCAL will not incur some performance penalties related to sending data over IP. See this old but very nice discussion of the topic.


text:
Q: Numpy append not adding row to Numpy array I have a method where it checks if we are at row 0.
If yes: it creates the Numpy array as that row.
If no: it appends the row to the Numpy array
def printStatement(row):
    global newData
    if(count == 0):
        newData = np.array(row)

    else:
        print("Made it to second row")
        np.append(newData, row)

It does confirm that it made it to the else statement. But newData does not grow past the first row.
Is there something I need to specify when creating the array? All rows are the same shape.
***2D Array (Added for search engine)

A: You're not storing the result, assign it to something. E.g. newData = no.append(newData, row)
Quoting https://numpy.org/doc/stable/reference/generated/numpy.append.html:
A copy of arr with values appended to axis. Note that append does not occur in-place: a new array is allocated and filled.
And by the way, prefer avoiding np.append unless really necessary.


text:
Q: Trying to add Facebook Get Started button I am trying to add a Facebook Messenger get started button to a bot I am working on.  The API documentation says I need the following code:
{
  "get_started":{
    "payload":"<GET_STARTED_PAYLOAD>"
  }
}

I'm using the Chrome Postman App as I've been trying to mess around with Curl and I don't really like it.
I set up my URL as follows:
https://graph.facebook.com/v2.6/me/thread_settings?access_token=(MY-ACCESS-TOKEN)

I know the access token works because I used it when setting up my bot's greeting and it worked.
Body of the request is as follows:
{
    "get_started":{
        "payload":"GET_STARTED"
    }
}

When I try to send, I get the following error:
{
    "error": {
        "message": "(#100) The parameter setting_type is required",
        "type": "OAuthException",
        "code": 100,
        "fbtrace_id": "BC+QucQjBck"
    }
}

The API documentation doesn't say anything about needing to specify "setting_type", nor does it say what "setting_type" should be.  I know that I need "setting_type":"greeting" for setting the greeting message.
Any suggestions?
If it's easier to make sense of what I'm doing, here is a screenshot:
Screenshot of Error

A: You are using the wrong endpoint.
The Getting Started button is part of Messenger Profile API, so you have to POST to
https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>
                                   ^^^^^^^^^^^^^^^^^^ not "thread_settings"

https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api#post


text:
Q: How to decrypt a file into a string using OpenSSL inside Rails console? I'm new to programming and I'm using OpenSSL inside a Rails app to decrypt the content of a file into another file.
openssl enc -in "#{bin}" -a -A -out "#{stamp}"
But I need the result of the decryption into a variable (string) and not into a file. Is this possible?


text:
Q: ZHow to use Zclip in Asp.net MVC razor? We are developing site based on ASP.net MVC razor engine. We create serialkey dynamically using guid. we want to allow our users to copy the serial key(which is a label) to clipboard. i have tried using zclip,
it says
$('a#copy-dynamic').zclip({
    path:'js/ZeroClipboard.swf',
    copy:function(){return $('input#dynamic').val();}
});

Since I'm new to this MVC, I couldn't find out what is the ID of that label where it is just mentioned as @item.serialkey.  Could someone help me out here.

A: You can use @item.serialkey again inside the JavaScript.
I'm not sure if this is what you were getting at with the #dynamic, but if it was meant as a place-holder for the value stored in the model, then the following should do the job.
$('a#copy-@item.serialkey').zclip({
    path:'js/ZeroClipboard.swf',
    copy:function(){return $('input#@item.serialkey').val();}
});


text:
Q: How to compute hypergeometric distribution probabilities for complex events? How would I calculate the sums of two (or more) hypergeometric distributions. If, using a standard deck of cards, I want to determine the probability of draw 2 red cards and one Black Queen. I cannot just change my "good card" size and use one formula cause that wouldn't tell me what I need.
So, given 52 cards, 26 of which are red and given a draw of 4 cards, the hypergeometric probability of drawing 2 red cards is 0.32. With Black Queens, there are 2 "successes" in the population and I want to draw 1, the probability is 0.17.
In Python using Scipy I can use the hypergeom function
[M,n,N] = [52,26,5] # M=Population,n=Successes,N=drawn
rv = hypergeom(M,n,N)
pR = rv.pmf(2) # probability of two reds in a hand of 5

n1 = 2
rv = hypergeom(M,n1,N)
pBQ = rv.pmf(1) # probability of 1 Black Queen in a hand a 5

How do I then calculate the probability that out of a 5 card draw I get 2 reds and 1 black Queen?

A: Since drawing more red cards implies you have drawn fewer black cards, the red card count and black queen count are not independent.  That makes it difficult to combine the probabilities of each event in any simple way to obtain the answer.
Instead, do it the old-fashioned way: count every hand having two red cards, one black queen, and (presumably) two other black cards.  Divide that by the count of all possible five-card hands, because each such hand has the same probability (under a fair draw, anyway).
The number of such hands is counted by taking the number of two-card subsets of all $26$ cards, written $\binom{26}{2}$, multiplying that by the number of one-card subsets of the two black queens, written $\binom{2}{1},$ and multiplying the result by the number of two-card subsets of the remaining $24$ black cards, written $\binom{24}{2}.$  This will be divided by $\binom{52}{5}$ to obtain the probability.
Applying the formula
$$\binom{n}{k} = \frac{n!}{(n-k)!k!} = \frac{n(n-1)\cdots(n-k+1)}{k(k-1)\cdots(1)}$$
yields the answer
$$\frac{\binom{26}{2}\binom{2}{1}\binom{24}{2}}{\binom{52}{5}} = \frac{5\times 23}{2\times 7^2 \times 17}=\frac{115}{1666}\approx 6.9\%.$$

This reasoning applies, mutatis mutandis, to any event that specifies how many elements of each non-overlapping subset of a population must appear in a sample (without replacement) of a given size.


text:
Q: Swing JFrame rendering a webpage with embedded video shows a white page and throws IOException with "invalid URL" I wonder if I do some mistakes because I do not get the content of the webpage displayed on the JFrame. Instead, I only get a white page. The error I got was:
java.io.IOException: invalid URL

Here is the code for video.html:
<iframe width="560" height="315" src="video-file.mp4" allowfullscreen></iframe>

Thanks in advance for any help!
import java.awt.*;
import java.io.IOException;
import java.net.URL;
import javax.swing.*;

public class Vid extends JFrame{

    public Vid(String title){
        super(title);
        setBounds(100, 100, 550, 500);
        Container ControlHost = getContentPane();
        ControlHost.setLayout(new FlowLayout());

        JEditorPane jep = new JEditorPane();
        jep.setEditable(false);

        JScrollPane scroll = new JScrollPane(jep);
        Dimension ScrollSize = new Dimension(500, 450);
        scroll.setPreferredSize(ScrollSize);
        scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        ControlHost.add(scroll);

        URL HtmlPage = Vid.class.getResource("video.html");
        try {
            jep.setPage(HtmlPage);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

A: Probably problem is in:
URL HtmlPage = Vid.class.getResource("video.html");

If this file is in your root-level class-path, you should ask for it:
URL HtmlPage = Vid.class.getResource("/video.html");


text:
Q: Running scripts in Spyder using windows Command Prompt or PowerShell I would like to know if there is a way to run python scripts in spyder-ide using windows cmd or PowerShell instead of IPython console.
Ipython sometimes works differently than if the script is run in cmd specially for plotting packages like matplotlib, etc.
I am using Spyder latest version.
Regards

A: In Spyder, you can click Run > Configuration per file, which will give you plenty of options in where your Spyder-IDE-Script is launched.

A: I think the option you are looking for is "Execute in External System Terminal" in the options found under the menu item of [Tools] / [Preferences] / [Run]


text:
Q: Returning a specific value from a pandas dataframe after searching an entire column I have the following portion of my code below.
self.result_rows=summer17.index[summer17['Company'].str.contains(self.searche1_value.get(),na=False,case=False)]
self.c0=0
print(summer17.iloc[self.result_rows,self.c0])

and the output is
0    CAPS
Name: Company, dtype: object

What I am trying to do is to pass the value (in this case CAPS) from that specific cell into the variable results_rows. THe problem is what I'm getting in return is a bunch of data about the dataframe that I don't want.

A: You are passing the row_indexer parameter as a an array so iloc method returns a series( which contains data about the dataframe). If you want the values you use values accessor i.e print(summer17.iloc[self.result_rows,self.c0].values)
Example Dataframe :
df = pd.DataFrame([[0,1,2,3,5,6],[1,3,5,7,9,11]])
df.iloc[[0],0]

Output:

0    0
Name: 0, dtype: int64

So with values accessor i.e df.iloc[[0],0].values Output:
array([0])


text:
Q: How to distinguish algebraic numbers as roots? Supposing you want to define an algebraic number as the root of a polynomial. The problem is the polynomial has more than one root. But each root is has different properties. (Or do they?)
If the roots are from irreducible polynomials, e.g. roots of $x^3-2=0$, does any operations in the field depend on the particular root you choose?
i.e. the polynomial $(x-3)(x^2-3)=0$ has two types of roots.
But in general if you multiplied two algebraic numbers which is the nth and mth root of polynomials. Could you say the result is an algebraic number which is the root of a bigger polynomial which is the pth root.

A:
If the roots are from irreducible polynomials, e.g. roots of $x^3−2=0$,
  does any operations in the field depend on the particular root you
  choose?

Which field? There are several relevant fields you may be having in mind.
If $F$ is a field and $p(x) \in F[x]$ an irreducible polynomial, the field $K=F[x]/\langle p(x) \rangle$ is an extension field of $F$ containing a root of $p$. There's also the splitting field $L$ of $F$ which extends $F$ and contains all the roots of $p$. And finally, when the base field $F$ is the rationals $\mathbb{Q}$, each of $K$ and $L$ can be realized as subfields of $\mathbb{C}$; in the case of $K$, this may be doable in more than one way, as is the case with your example $p(x)=x^3-2$.
The different embeddings of $K$ in $\mathbb{C}$ are all isomorphic, so no operations inside those fields "depend" in any way on which embedding you've chosen (meaning, which root of the complex roots you've chosen to bring in). The abstract field $K$ of course doesn't depend on any such choice, since it has a unique definition independent of any choices.
The field $L$ is different (in your case, it has degree $6$ over $\mathbb{Q}$, instead of $3$), but it, too, is uniquely determined. No choices involved.

But in general if you multiplied two algebraic numbers which is the
  nth and mth root of polynomials. Could you say the result is an
  algebraic number which is the root of a bigger polynomial which is the
  pth root.

The product of two algebraic numbers is an algebraic number, yes. There's no natural order on the roots, if that's what you mean, so we can't make a statement like "the 3rd root of this polynomial times the 5th root of that polynomial is the 12th root of this other polynomial."


text:
Q: How to create a nested sequence in bash? I have to create a nested Sequence in bash script like a1b1 a1b2 ab3 a2b1 a2b2 a2b3.
The upper limit of both the sequences will be taken via command line argument.
I came to know about seq command but with this I am able to create only single sequence.
I used this statement echo $(seq -f "a%g" 8).
Is there a way to create the nested sequence using seq command or by any other way.
Note: I tried with expansion braces but it won't work as I have to take the limits from command line argument.

A: $for i in $(seq 2); do for j in $(seq 3); do  echo "a${i}b${j}"; done; done;
a1b1
a1b2
a1b3
a2b1
a2b2
a2b3
$

A: Another method is using GNU parallel (https://www.gnu.org/software/parallel/):
a=$(seq -f "a%g" 8)
b=$(seq -f "b%g" 8)
parallel echo {} ::: $a ::: $b

NB. If you need the output in the correct order use parallel --keep-order echo {} ::: $a ::: $b or pipe the results to sort e.g. parallel echo {} ::: $a ::: $b | sort

A: Following does your job. Simply you have to implement some sort of looping mechanism
for i in `seq -f "a%g" 2`
do
   for j in `seq -f "b%g" 3`
   do
      echo $i$j
   done
done

A: Just brace expansion from bash
printf '%s\n' a{1..2}b{1..3}

Output
a1b1
a1b2
a1b3
a2b1
a2b2
a2b3


text:
Q: PAServer 22 is not working in Mac Monterey, it use dylib that link with framework Python 2.7 and not exist in /System/library/Frameworks of Monterey I'm download the lastest version of Delphi 11.1 and all is Ok, but when I try to debug project in MAC Monterey 12.3.1 using PAServer 22, I have an error in PAServer Terminal window, it said that Framework Python can't be found in System/library/Frameworks/.., I install Python 2.7 but it's not installed in System/... is installed in Library/... and PaServer can't find it.
Have you any Solutions for that problem?
Thank you.

A: At this time, this is a known issue. See https://quality.embarcadero.com/browse/RSP-37609 for more details. Sadly there is no official fix yet. But in that RSP you will find a workaround by Michael Geddes that might help you:

For those that want to get going no matter what, I suspect this will work (haven't tried it yet, and it will probably not survive an update):

Install Python 2.7 package from python.org
Disable SIP
    Reboot Mac hold down Command + R
    From a shell:
        > csrutil disable
        > reboot
Remount / as read-write
    > sudo mount -uw /
Check that /System/Library/Frameworks doesn't exist and then Copy (?link) in the Python framework.
    > cp -R /Library/Frameworks/Python.framework /System/Library/Frameworks
Enable SIP
    Reboot Mac, hold down Command + R
    From a shell:
        > csrutil enable
        > reboot

A: Finally I have the solution, use:
sudo install_name_tool -change '/System/Library/Frameworks/Python.framework/Versions/2.7/Python' /Library/Frameworks/Python.framework/Versions/2.7/Python liblldb.3.8.0.dylib
I change the dylib that crash, with new path for Python.

A: I was having the same issue, followed the link posted by Sherlock70 to the link posted (https://quality.embarcadero.com/browse/RSP-37609)
I saw part way down in the comments that Marco Cantu posted saying the patch was available and had this link on his post https://blogs.embarcadero.com/rad-studio-11-1-alexandria-patch-1-available/
Once I ran the RadStudio 11.1 patch, I copied the new PAServer 22.0 over to my Mac and followed the "Additional Steps for Python Configuration on macOS" that Marco has in his post above.
Once I did that, everything is able to run on my iPad running iOS 15.4.1 now

A: I've followed the steps in the linked Embo blog. Using Montery. It still returns the error about not being able to find the System/Library/Frameworks/Python.framework/Versions/2.7/Python path etc.
Stupid thing was working yesterday.
Have just reinstalled Delphi 11.1 and the two patches on GetIt (so version is now Embarcadero® Delphi 11 Version 28.0.44500.8973)
Installed Python 2.7 on the Mac and ran the 3 commands in the terminal.
This is beyond frustrating ....


text:
Q: Error 403:Authentication Failed in sso I have created bluemix sso and enabled cloud directory
I have configured web.xml
    <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

    <display-name>SSOTestPoject</display-name>
  <servlet>
    <servlet-name>javax.ws.rs.core.Application</servlet-name>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>javax.ws.rs.core.Application</servlet-name>
    <url-pattern>/api/*</url-pattern>
  </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <security-constraint>

    <web-resource-collection>
      <web-resource-name>UserCollection</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>any-authenticated</role-name>
    </auth-constraint>
  </security-constraint>

</web-app>

I have configured  ibm-application-bnd.xml
    <?xml version="1.0" encoding="UTF-8"?>

<application-bnd
    xmlns="http://websphere.ibm.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-application-bnd_1_2.xsd"
    version="1.2">

    <security-role name="any-authenticated">
        <special-subject type="ALL_AUTHENTICATED_USERS" />
    </security-role>
</application-bnd>

After pushing the application in bluemix I am able to access the application it is redirecting to login pageSSO Login Page.
After login instead of taking to application it is throwing error. Error 403:Authentication Failed


text:
Q: Android paging library show empty viewholder when list is empty I am using paging library with recyclerView and my task is to shows empty viewHolder when I receive empty arrayList from server.
I tried to check that list is empty or not, but when I get response it calls the Observer method 2 times (1st time empty list, 2nd time real list), after when I use swipeRefresh it DataSource class sends empty list as it has same list already in cache. Also I have pagination and checking for dataset size is difficult as there are many cases.
/**
 * Simple Adapter used to show list of Appeals with pagination
 */
class MyAppealsAdapter : PagedListAdapter<Appeal, RecyclerView.ViewHolder>(diffCallBack) {

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
        return AppealsViewHolder(LayoutInflater.from(parent.context).inflate(R.layout.item_my_appeal, parent, false))
    }

    override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
        when (holder) {
            is AppealsViewHolder -> holder.bind(position)
        }
    }

    inner class AppealsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
        @SuppressLint("SimpleDateFormat")
        fun bind(position: Int) {
            getItem(position)?.let { item ->
                item.fields?.get(AppealKeyObj.K_SUB_ISSUE)?.let {
                    itemView.mTypeOfAppeal.text = it
                }
            }
        }
    }

    companion object {
        open var diffCallBack: DiffUtil.ItemCallback<Appeal> = object : DiffUtil.ItemCallback<Appeal>() {
            override fun areItemsTheSame(oldItem: Appeal, newItem: Appeal): Boolean {
                return oldItem.id === oldItem.id
            }

            override fun areContentsTheSame(oldItem: Appeal, newItem: Appeal): Boolean {
                return oldItem == newItem
            }
        }
    }
}

Please help to show empty viewHolder when I receive empty arrayList

A: I did it like this
override fun getItemViewType(position: Int): Int {
        return if (super.getItemCount() == 0) EMPTY else FILLED
    }

    override fun getItemCount(): Int {
        return if (super.getItemCount() == 0) 1 else super.getItemCount()
    }

And also changed linearlayoutmanager to custom one with overriden method
override fun onLayoutChildren(recycler: Recycler?, state: RecyclerView.State?) {
        try {
            super.onLayoutChildren(recycler, state)
        } catch (e: IndexOutOfBoundsException) {
            Timber.e(e)
        }
    }


text:
Q: slider overlaping on collapsed icon on navigation bootstrap 4 (on mobile)

<button class="navbar-toggler navbar-toggler-right" type="button"   data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText"   aria-expanded="false" aria-label="Toggle navigation">

</button>

      Home (current)

    About Us

    Gallery

       Services (current)

       Events

    Contact Us

this is my navigation bootstrap code i used for my navigation

First Slide

This is a description for the first slide.

Second Slide

This is a description for the second slide.

Third Slide

This is a description for the third slide.

            Previous

            Next

i am having problem when i view my website on mobile at collapsed navigation stage slider over lap icon of collapsed button which hide that i am new with bootstrap so anyone have idea how to resolve this issue. sorry for bad english

A: ok here we go,
remove class justify-content-center from nav tag in html this is causing lot of problems, and apply below css this will fix your css issues
.navbar{
  min-height: 60px;
}
.navbar .container{
  width: 100%;
}

see img1


text:
Q: Hide Doc.Lib column from entering values while uploading a document How can I hide a  form from Displaying a custom field that is created in my document library ? Its a document library  and I am updating this column through itemadded() eventreceiver.
My issue is this column - NPDModifiedBy will be filled with my code in eventreceiver and should not be from sharepoint UI.
So, i dont want to show this field, when end user uploads the document into my document library
How to hide this doc.lib column while uploading the document upload? [this is not a  site column]
  []1

A: Try below powershell:
$web = Get-SPWeb https://sitecollection
$list = $web.Lists["ListName"]
$column = $list.Fields.GetFieldByInternalName("NPDModifiedBy")

#Change the ShowInEditForm and other properties and update objects
$column.ShowInEditForm = $false
$column.ShowInNewForm = $false
$column.ShowInDisplayForm = $false
$column.ShowInViewForms = $false
$column.PushChangesToLists = $true;
$column.Update()
$web.Update()
$web.Dispose()

Reference - Hide column in display form
Hide list using powershell


text:
Q: Angular/material autocomplete: options do not render Angular version: 5.0.0
angular/material version: 5.2.4
I've got this form:
<form #updateForm="ngForm">
 <mat-form-field>
  <input type="text" matInput [formControl]="studentFormControl [matAutocomplete]="auto">
  <mat-autocomplete #auto="matAutocomplete">
   <mat-option *ngFor="let student of students" [value]="student">
    {{student}}
   </mat-option>
  </mat-autocomplete>
 </mat-form-field>
</form>

And I've got this component:
import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatInputModule, MatAutocompleteModule, MatFormFieldModule } from '@angular/material';
export class DashboardComponent implements OnInit {
  this.studentFormControl = new FormControl();
  this.students = ['hi', 'hello'];
...
}

Although the form shows up, the autocomplete box remains dimensionless without options rendered within:
screenshot of input/autocomplete box
It should be noted as well that the form is nested within an ngbModal. Any ideas what could be happening here?

A: So I'm no expert here, but from what I understand, the autocomplete function requires an observable of sorts, at least if you want to be able to filter results as you type, to be selected. Since you are using an array you need to first turn it into an observable. As your array is loaded immediately you would need to use RXJS's subjects and more specifically the BehaviorSubject.
Once it becomes an observable you can then call it using the asyncpipe on your form.
This is not to say you couldn't have done it with an array and not used the asyncPipe, however that array would have to be loaded in OnInit.
See the example for both

import { Observable, from, Subscription, BehaviorSubject } from 'rxjs';
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatInputModule, MatAutocompleteModule, MatFormFieldModule } from '@angular/material';

@Component({
  selector: 'app-test',
  templateUrl: './test.component.html',
  styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
  studentFormControl = new FormControl();
  studentFormControl1 = new FormControl();
  array = ['test','one','two'];
  array1=[];
  arrayObs: Observable<any>;
  arrayBehObs = new BehaviorSubject(this.array);
  constructor() { }

  ngOnInit() {

    this.array1.push('test','one','two');
    this.arrayObs = this.returnAsObs();

  }
  private returnAsObs() {
    return this.arrayBehObs.asObservable();
  }

}
<form #updateForm="ngForm">
        <input type="text" matInput [formControl]="studentFormControl" [matAutocomplete]="auto">
        <mat-autocomplete #auto="matAutocomplete">
            <mat-option *ngFor="let student of arrayObs|async" [value]="student">
                {{student}}
               </mat-option>
        </mat-autocomplete>

            <input type="text" matInput [formControl]="studentFormControl1" [matAutocomplete]="auto1">
            <mat-autocomplete #auto1="matAutocomplete">
                <mat-option *ngFor="let student of array1" [value]="student">
                    {{student}}
                   </mat-option>
            </mat-autocomplete>

</form>


text:
Q: How to keep ComboBox from scrolling? C# I have a ComboBox. It is critical that the user cannot scroll by accident and change the selected value.
How can I prevent the ComboBox from changing the value and text when the use scrolls? Thanks.
Visual Studio 2008

A: combobox.MouseWheel += new MouseEventHandler(combobox_MouseWheel);

void combobox_MouseWheel(object sender, MouseEventArgs e)
{
    ((HandledMouseEventArgs)e).Handled = true;
}

A: If you don't want the user messing with the control, disable it. On another level however, if it's critical the user NOT use the control... maybe you should change the control.
ComboBox.Enabled = false;


text:
Q: Windows API `GetPixel()' always return `CLR_INVALID`, but `SetPixel()` is worked well? My OS is windows 7 64-bits with 2 monitors display.
I use GetPixel(), but it always return CLR_INVALID as result like that:
COLORREF result = GetPixel(dc,x,y);

My GetDeviceCaps(RASTERCAPS) returns result that RC_BITBLT is enabled.
GetDeviceCaps(COLORMGMTCAPS) returns result is CM_GAMMA_RAMP.
Most importantly, if I SetPixel(dc,x,y,RGB(250,250,250)) in advance, and GetPixel(dc,x,y) later, I can ALWAYS retreive correct result like that:
COLORREF result = SetPixel(dc,x,y,RGB(250,250,250));
COLORREF cr = GetPixel(dc,x,y);

So I think my coordination should be alright. I have no idea about why GetPixel() always return CLR_INVALID, but SetPixel() is always worked well? Any suggestions?

A: From GetPixel documentation

A bitmap must be selected within the device context, otherwise,
  CLR_INVALID is returned on all pixels.

Try the below code and see if it works for your device context.
HDC dc = ... // <-- your device context
HDC memDC = CreateCompatibleDC(dc);
HBITMAP memBM = CreateCompatibleBitmap(dc, 1, 1);
SelectObject(memDC, memBM);

int x = ... // point's coordinates
int y = ...
BitBlt(memDC, 0, 0, 1, 1, dc, x, y, SRCCOPY);

COLORREF cr = GetPixel(memDC, 0, 0);
std::cout << cr << std::endl;

DeleteDC(memDC);
DeleteObject(memBM);


text:
Q: bulk delete - cascading delete performance killer? My SQL Server 2008R2 database has a lot of large, related tables:

*

*master

*detail-1

*detail-2

*detail-2-A

all foreign keys are cascading:

*

*master -> detail1

*master -> detail2

*detail2- > detail-2-A

So when I delete a record from master, all the related details follow.
Deleting takes a very long time. E.g. one master can have 1.2 million records in detail2 and 60 million records in detail2A.
Would it a more efficient to create a stored procedure that deletes first the detail2A, then detail2 etc. Or is there a better approach.
DB is not partioned.

A: We don't allow delete cascade on our systems because you have no control over locking table when a large delete is done. If you have large numbers of records to delete frequently, there are several choices. First, do you really need to delete or should you just make them as inactive?  This is probably the most efficient way to handle.
Or you can process in batches. Move all the id values you want to delte to a staging table and then delete them 1000 (or 20000 or 200 the actual number can only be determined by the system for performance reasons.) at a time and loop through until all the records are deleted. You still might want to experiement with deleting the records one table at a time, rather than deleting in a cascade.
Or you can mark the records for deletion and do the actual deletes overnight during the low usage periods of the database to avoid blocking other users.
One thing to consider with cascade delete is do you really want to delete the record if child records exist? Foreign keys exist, in part, to stop you from doing that and cascade delete overrides that behavior. So if your child records are something like orders, under no circumstances do you want to delete them automatically in a cascade delete or you will lose financial information you need even if the customer is no longer active.


text:
Q: Pyspark kernel doesnt start on Jupyterhub The Jupyterhub Pyspark kernel used to work very well but now will not start or will have Kernel connected status (doesnt go to idle) but will not run any code in cells. It is using localprocess spawner with PAM auth on Centos.In the jupyterhub logs we see these messages:
[I 2020-03-10 15:13:08.644 SingleUserNotebookApp restarter:110] KernelRestarter: restarting kernel (4/5), new random ports
Assertion failed: rc == 0 (src/socket_poller.cpp:41)
[W 2020-03-10 15:13:11.666 SingleUserNotebookApp restarter:100] KernelRestarter: restart failed
[W 2020-03-10 15:13:11.666 SingleUserNotebookApp kernelmanager:127] Kernel 0148c77d-143a-4721-90e7-0d9a41a878c4 died, removing from map.

Any thoughts?

A: This was resolved by reinstalling sparkmagic in the base conda environment:
(base) [root@]# pip install sparkmagic


text:
Q: C++11 Uniform initialization (i.e. list initialization) doesn't compile with inheritance struct B {
  int b;
  B(int i = 0) : b(i) {};  // constructor
};

struct D : B  {
  int d;
};

int main () {
  D obj = {1};  // <-- error
  // D obj {1}; // <-- error (different)

}

Above code doesn't compiles, and gives:
error: could not convert '{1}' from '<brace-enclosed initializer list>' to 'D'

The same is true, even if I remove the "constructor" line.
If I remove = sign, i.e. D obj {1}; then it gives below:
error: no matching function for call to 'D::D(<brace-enclosed initializer list>)'

What is the correct syntax to fix such issue?

A: D doesn't have a constructor taking an int. If you want it to inherit B's constructor, say so, like this:
struct D : B  {
  using B::B;
  int d;
};

You probably want to do more than that though, given that D has another int member.
A more complete D which initialises both B::b (by calling B::B) and D::d would probably look like this:
struct D : B  {
  D(int d_) : B(d_), d(d_) {}
  int d;
};

Either way, your code needs to say D has a constructor taking an int.
Link to working example using your code and my snippet: http://goo.gl/YbSSHn

A: In what you've written D has only a default constructor and does not know how to invoke B::B(int i). All you have to do is to provide a corresponding constructor in D like:
struct D : B  {
  D(int i) : B(i) {}//;
  int d;
};


text:
Q: Reflection $\mathscr{R}H$ through given hyperplane exchanges given points. Let $P$, $Q$ be two points in $\mathbb{R}^n$. Consider the hyperplane $H = \{v \in \mathbb{R}^n : \, |P − v| = |Q − v|\}$. Prove that the reflection through the hyperplane $H$, $\mathscr{R}H$, exchanges $P$ and $Q$.

A: You could just rotate and translate the entire situation to one you're familiar with. If you can prove the situation there and then rotate and translate back to your starting position, you're done.
The easiest way to do this, it seems, would be to first rotate your situation to one in which the line through $P$ and $Q$ is parrallel to the $x_1$-axis. You can then translate this situation to one where $P$ and $Q$ lie on the $x_1$-axis and have equal distances to the origin. At this point, your hyperplane is just a hyperplane through the origin, perpendicular to the $x_1$-axis and showing that $P$ and $Q$ are mapped onto one another shouldn't be too hard.


text:
Q: Selenium - bypass ads Google_Vignette I'm trying to crawl a site and am running into a google ad. I think I've found the iframe of it but I can't find the element to click to remove the ad. I've spent about 7 hours now and think this is over my head. Help v much appreciated.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

chrome_options = Options()
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--window-size=1920x1080")
# chrome_options.add_argument("--headless")
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path ='C:\/Users\/gblac\/OneDrive\/Desktop\/Chromedriver.exe')

url = 'https://free-mp3-download.net/'
driver.get(url)

WebDriverWait(driver, 4)
search = driver.find_element(By.ID,'q')
search.send_keys('testing songs')
search.click()

button = driver.find_element(By.ID,'snd')
button.click()

WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.CLASS_NAME,'container'))).click()
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID,"results_t")));
results = driver.find_element(By.ID,'results_t').find_elements(By.TAG_NAME,'tr')
results[0].find_element(By.TAG_NAME,'a').click()
# The code to remove the ad would go here
# driver.find_elements(By.CSS_SELECTOR,'[text()="Close"]').click()

A: Add the below code block in your code - before searching any text:
time.sleep(1)
driver.execute_script("""
const elements = document.getElementsByClassName("google-auto-placed");
while (elements.length > 0) elements[0].remove();
                      """)

time.sleep(1)
driver.execute_script("""
const elements = document.getElementsByClassName("adsbygoogle adsbygoogle-noablate");
while (elements.length > 0) elements[0].remove();
                      """)

time.sleep(1)
driver.find_element(By.ID,"q").send_keys("tamil songs")
driver.find_element(By.ID,"snd").click()

It will close the 2 ad blocks in that page, but if you refresh or move forward and backward, the ads will display again, then you have to remove those ad blocks again using the above code, please add the code for that condition.
WebDriverWait(driver,20).until(EC.visibility_of_element_located((By.CLASS_NAME,'container'))).click()
WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.ID,"results_t")))
results = driver.find_element(By.ID,'results_t').find_elements(By.TAG_NAME,'tr')
results[0].find_element(By.TAG_NAME,'a').click()
time.sleep(2)
driver.find_element(By.XPATH, ".//button[contains(text(),'Download')]").click()
driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")
time.sleep(1)

# handling captcha
iframe_captcha = driver.find_element(By.XPATH,".//iframe[@title='reCAPTCHA']")
driver.switch_to.frame(iframe_captcha)
time.sleep(1)
driver.find_element(By.CSS_SELECTOR, ".recaptcha-checkbox-border").click()
time.sleep(2)
driver.switch_to.default_content()

driver.find_element(By.XPATH, ".//button[contains(text(),'Download')]").click()


text:
Q: Backing up entire Ubuntu system before disk resize Thanks for people pointing out that my question is too broad and hard to answer. Here is the edited question:
Question: Create an easy-to-restore system backup for Ubuntu 14.04 before resizing linux partition on a Windows-Ubuntu dual-boot system
Detailed requirements:

*

*Retain everything in Ubuntu partition (/home, /usr, /bin etc)

*Be able to be restored onto a resize linux partition (larger than original) where the head of the partition is moved.

*Easy restoration: I restore the system by "copying" or "cloning" back my backup file. I don't have to reinstall libraries, programs, or restore links, ~/.ssh ~/.bashrc or other system setup files.

*I would prefer softwares such as Clonezilla or Déjà Dup. But I am also very happy to learn using internal utility such as tar, as long as it allows requirement 3.
Current disk layout:
500 GB disk (Partition1 + Partition 2 + Partition 3 + Partition 4)
Partition 1: Dell Utility FAT (41 MB)
Partition 2: Windows Recovery NTFS (786 MB)
Partition 3: Windows 7 NTFS (254 GB)
Partition 4: Extended (246 GB)
Partition 5: Filesystem Ext4 (256 GB)
Partition 6: SWAP Swap (10 GB)

Desired disk layout:
500 GB disk (Partition1 + Partition 2 + Partition 3 + Partition 4)
Partition 1: Dell Utility FAT (41 MB)
Partition 2: Windows Recovery NTFS (786 MB)
Partition 3: Windows 7 NTFS (100 GB)
Partition 4: Extended (354 GB)
Partition 5: Filesystem Ext4 (356 GB)
Partition 6: SWAP Swap (10 GB)

Final remarks: A brief procedure would be greatly appreciated in case I missed some important procedure and sabotage my backup process.
I hope the resizing process will just go successfully without doing restoration though.
References:
https://ubuntuforums.org/showthread.php?t=35087

https://ubuntuforums.org/showthread.php?t=35087

http://www.howtogeek.com/114503/how-to-resize-your-ubuntu-partitions/

A: You ask a lot of questions in ... well.. one question.  This site works best if you ask one question per question, therefore I will only answer one of your questions:
The VeryEasyWay™ to do this is to use Clonezilla Live as long as you:

*

*turn off hibernation in Windows

*save the CloneZilla disk-to-image to an external, removable drive

*set a chkdsk /f x: for all your disks and then shut down

*use GParted Live to resize

*first boot Windows, then Ubuntu


text:
Q: Any way to stop a specific line of text from overflowing onto the next line? I've currently got a div tag with several text rules set, p, h1, h2... etc etc.
I'm wondering is there anyway I can make it so that one of these rules will not go onto the next line down if the text becomes too long for the width of the div and instead, the text which runs off the div not being displayed in the browser?
So, for example, my p tag is normal, if the line of text gets too long it will simply overflow onto the next line down, same with my h1 and h2 but I want my h3 to only ever take up one line and to never take up more than one, even if that means some of the text getting chopped off at the edge of the div.
HTML

This is the first header and this will overflow onto the next line when it gets too long.

This is the second header and this will overflow onto the next line when it gets too long..

This is the paragraph and this will overflow onto the next line when it gets too long.

This is the third header and I do not want this to overflow when it gets too long... But it does :(

CSS
#box {
position:absolute;
width:540px;
height:auto;
left:80px;
top:0px;
padding-bottom:20px;
background-color:#000000;
}
#box h1{
font-family:Ebrima;
font-size:22px;
font-weight:normal;
text-decoration:underline;
text-align:center;
margin-bottom:10px;
color:pink;
}
#box h2{
font-family:Ebrima;
font-size:20px;
font-weight:normal;
font-style:italic;
text-align:center;
margin-bottom:15px;
color:lightyellow;
}
#box h3{
font-family:Ebrima;
font-size:14px;
font-weight:bold;
text-align:center;
margin-top:10px;
margin-left:25px;
margin-right:25px;
color:lightgreen;
overflow:hidden;
}
#box p{
font-family:Ebrima;
font-size:16px;
font-weight:lighter;
text-align:justify;
margin-left:25px;
margin-right:25px;
color:lightblue;
}

I also made a JSfiddle to help.
I have tried adding overflow:hidden; to the h3 rule and that worked in firefox but not in IE, Opera, Chrome or Safari.
I've also tried text-overflow:hidden; and textoverflow-hidden because for some reason I thought those might work but they didn't in any of the browsers.
Should any of those have worked properly or are there other ways I can achieve this?

A: You need to specify a height in order for overflow: hidden to work as you expect.

A: Use the following rules:
overflow: hidden;
white-space: nowrap;

Note that nowrap doesn't have a hyphen.

A: text-overflow: clip

this should help. Read here: https://developer.mozilla.org/en/CSS/text-overflow

A: white-space: nowrap;
overflow: hidden;

should do it (in ie8 and up at least)
*edit Just double-checked and it shoudl be ok in older ie too http://reference.sitepoint.com/css/white-space


text:
Q: Quasi/Complete separation due to huge and infinite values (R statistics)
My question is regarding this warning. My data contains patients and healthy subjects. Exponential decay is my outcome measure.
I have a example dataset here
I managed to run bayesglm and firth method with brglm.
However, I wanted to try the regular glm while this is easier to write down in a paper.
I found out that because of the high numbers >100 seconds, the quasi separation warning arises (kinda makes sense, while the slope of propability will exceed a near vertical line).
To test this, I calculated the mean + (6*std) of the healthy subjects and replaced the values of the patients exceeding this value with this value. Now the warnings are gone.
They more or less give the same ROC-curve as the bayesglm and firth's method.
However, I do not know if this is a valid method to "arbitrarily" change values. Maybe non-parametric ranking is in place instead of using the actual values to undermine this problem or changing it to log values.
Hope somebody can give me a valid solution in order to write my paper.
Moreover, how do I present values that are infinite, like mean+/-SD is not possible ofcourse! Thanks in advance!
Data:
column [1]= Type (healthy=0,patient=1).
column [2]= decay.
column [3]= if the value is higer than mean(health)+(6*std(health)) it was replaced by this value.
# STACK EXCHANGE
library("caret")
library("ROCR")
library("readxl")

stackdata <- read_excel("STACK.xlsx",sheet = "DATA")
stackdata$type <- as.factor(stackdata$type)
levels(stackdata$type)<-c('H','P')
head(stackdata)

set.seed(777)
partitionRule<-createDataPartition(stackdata$type,p=0.7,list=F)
trainingSet<-stackdata[partitionRule,]
testingSet<-stackdata[-partitionRule,]
splitRule<-trainControl(method="repeatedcv",repeats=3, savePredictions=TRUE, classProbs=TRUE, number=5, p=0.7, summaryFunction=twoClassSummary, returnResamp = "all")

## GLM with extreme values
glmModel<-train(type~decay,data=stackdata,method="glm",family=binomial(logit),trControl=splitRule, metric="ROC")
glmTest<-predict(glmModel,newdata=testingSet,type="raw")
confusionMatrix(data=glmTest,testingSet$type)

ROC_glmModel <- roc(as.numeric(glmModel$trainingData$.outcome=='P'),aggregate(P~rowIndex,glmModel$pred,mean)[,'P'])
ROC_mean95_plot <- plot.roc(ROC_glmModel$response,ROC_glmModel$predictor)
Youden_coords_mean95 <- coords(ROC_mean95_plot, "b", ret="t", best.method="youden")

## GLM   mean+(6*std) of the healthy subjects
glmModel<-train(type~decay6std,data=stackdata,method="glm",family=binomial(logit),trControl=splitRule, metric="ROC")
glmTest<-predict(glmModel,newdata=testingSet,type="raw")
confusionMatrix(data=glmTest,testingSet$type)

ROC_glmModel <- roc(as.numeric(glmModel$trainingData$.outcome=='P'),aggregate(P~rowIndex,glmModel$pred,mean)[,'P'])
ROC_mean95_plot <- plot.roc(ROC_glmModel$response,ROC_glmModel$predictor)
Youden_coords_mean95 <- coords(ROC_mean95_plot, "b", ret="t", best.method="youden")

```

A: If you were only interested in decay as a single predictor of patient/normal status, then this problem would disappear if you use decay non-parametrically. Just rank order the cases by decay values and plot true-positive fractions against false-positive fractions for each decay value as a cutoff in sequence to get a receiver operating characteristic (ROC) curve. You can then choose any specific cutoff that you wish for a confusion matrix. There is no need for a logistic regression and potential problems with complete separation.
As a comment says that you intend to include decay as only one among several predictors, however, you need to find a way to combine it with the other predictors to get an overall linear predictor of the log-odds of patient/normal status.
From what you describe, the problem might arise from your attempt to use decay as an untransformed predictor. With some individual decay times more than 6 standard deviations above the mean in the original scale of seconds, it seems unlikely that the log-odds of patient/normal would be linearly related to untransformed decay values. Yet that is the hidden assumption in the way you are modeling decay.
So I recommend trying different transformations of the decay values to find one that bears a better linear relationship to log-odds of patient/normal. Consider a logarithmic transformation, some other power transformation, or maybe even an inverse transformation so that the high-value outliers get bunched close to 0.
A few more notes:
First, it's possible that your perfect separation is real and that there is some value of decay that perfectly distinguishes patients from normals. If that's the case, your problem is again solved non-parametrically. Check that possibility.
Second, I would recommend against the stepwise selection of predictors that you describe in a comment. Recall that logistic regression has an inherent omitted-variable bias so that your coefficient values will be biased if you thus remove from your model any predictor that is related to patient/normal status. Provided that you have on the order of 15 of the lower of patient or normal cases per predictor you shouldn't be in danger of overfitting. It's better to use knowledge of the subject matter rather than stepwise to choose predictors if you have fewer cases than that.
Third, unless you have an extremely large number (hundreds to thousands) of cases, the use of separate training and test sets suggested in your code may limit your power. See this page for discussion. Using the entire data set with cross-validation or bootstrapping might be preferable.


text:
Q: mysql subquery field application Range Here is my code:
SELECT field1, field2,
       (SELECT * FROM table1 WHERE a = field2),
       (SELECT COUNT(*)
          FROM (SELECT *
                  FROM table2
                 WHERE c = field2) as t1) as count
  FROM table3;

...and here is error message:

/* SQL Error (1054): Unknown column
  'field2' in 'where clause' */

I want to execute one query, to get table2's total counts.

A: The problem is that you're trying to use a variable declared in the outer query in the inner query. Variables are scoped the opposite way in SQL, you only have access to inner queries. What you want to do (I believe) is look for the number of table2 that have a c that matches the a from table1. This should give you that answer.
SELECT
    table1.a,
    table2.c,
    count(*)
FROM
    table1
JOIN
    table2 ON table2.c = table1.a
GROUP BY
    table1.a

A: I re-wrote your query as:
   SELECT t3.field1,
          t3.field2,
          t1.*,
          t2.cnt
     FROM TABLE3 t3
LEFT JOIN TABLE1 t1 ON t1.a = t3.field2
LEFT JOIN (SELECT t.c,
                  COUNT(*) AS cnt
             FROM TABLE2 t
         GROUP BY t.c) t2 ON t2.c = t3.field2

The 1054 error is due to referencing field2 two subqueries deep - most only support one level deep.

A: UPDATE:
I want to edit the answer, since in MySQL 8.0 your query is already correct, derived tables can access external references no matter the level.
SELECT field1, field2,
       (SELECT 'hola' FROM table1 WHERE a = field2),
       (SELECT COUNT(*)
          FROM (SELECT *
                  FROM table2
                 WHERE c = field2) as t1) as count
FROM table3;

"Prior to MySQL 8.0.14, a derived table cannot contain outer references. This is a MySQL restriction that is lifted in MySQL 8.0.14, not a restriction of the SQL standard. For example, the derived table dt in the following query contains a reference t1.b to the table t1 in the outer query:" https://dev.mysql.com/doc/refman/8.0/en/derived-tables.html


text:
Q: Class Table Inheritance: Can anyone suggest methods for selecting data from subclasses/subtables? I'm attempting to model objects in MySQL using what is commonly (?) referred to as Class Table Inheritance.
See here: http://martinfowler.com/eaaCatalog/classTableInheritance.html
Essentially I have three tables:
Items (item_id,posX,posY,sort)

Items_Text (item_id,text)

Items_Image (item_id, url)

When I select data I only want to get:
item_id,posX,posY,sort,text

OR
item_id,posX,posY,sort,url

Can anyone suggest a method for doing this?
The only method I can think of is hard coding it based on an additional column "type" in the Items table or some other method of hard coding it into the application logic I'd prefer not to consider. I guess I'm hoping for some complex (or otherwise) method of using joins I'm unfamiliar with?
Thanks,
Ken

A: You can use left outer join, and check the results for null in the joined ID column, like this:
select
    i.item_id
,   i.posX
,   i.posY
,   i.sort
,   t.item_id
,   t.text
,   u.item_id
,   u.url
from Items i
left outer join Items_Text t on t.item_id=i.item_id
left outer join Items_Image u on u.item_id=i.item_id

When you examine the result set that you get back, you will get non-null in t.item_id only when the item is in the Items_Text, and a non-null in u.item_id only when the item is in the Items_Image. You can use this test to determine the type without having an explicit column.


text:
Q: New 256GB SDCARD gnome-disk said that is a 249 GB Drive. Is broken? I have bought my new Kingston 256 GB SDCard.
But Gnome Disk Utility is able to see only 249 GB?
I'd like to know if it is normal and why.
Thanks you

A: No.  It's a different way of calculating.  Storage on computers if often calculated in powers of two.  Humans calculate in powers of 10.  In small numbers, that doesn't show.  But in large sizes it shows.


text:
Q: vue-clickaway exclude component I have a component (component A) which uses vue-clickaway to close the component when the user clicks elsewhere on the page. However I similar component (component B) and when the user clicks the close button on  component B it causes component A and component B to close. How can I exclude component B from listening to the vue-clickaway?
Component A:
<template>

        <button
            @click="startEditing"
            class="flex w-full items-center pl-2 pr-4 py-3 text-sm font-medium text-gray-800 bg-gray-100 rounded-md hover:bg-gray-200"
        >
            <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
                <path fill-rule="evenodd" d="M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z" clip-rule="evenodd" />
            </svg>
            Add list
        </button>

            <textarea
                class="rounded-md shadow py-1 px-2 outline-none w-full text-gray-900 text-sm bg-white h-16 resize-none"
                ref="title"
                placeholder="Enter list title..."
                @keyup.esc="hideEditor"
                @keypress.enter="addList"
                v-model="title"
            ></textarea>

                <button
                    @click="addList"
                    class="text-sm text-white mr-1 px-2 py-2 font-medium bg-gray-700 rounded-md hover:bg-gray-600 cursor pointer"
                >
                    Add List
                </button>
                <button
                    @click="hideEditor"
                    class="text-sm px-2 py-2 text-white font-medium bg-gray-400 bg-gray-100 rounded-md hover:bg-gray-300"
                >
                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-5 w-5">
                        <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
                    </svg>
                </button>

</template>

Component B
<template>

        <textarea
            class="rounded-md shadow py-1 px-2 outline-none w-full text-gray-900 text-sm bg-white h-16 resize-none"
            placeholder="Please enter a title for this card"
            :value="value"
            ref="card"
            @keyup.esc="closed"
            @keyup.enter="saved"
            @input="$emit('input', $event.target.value)"
        ></textarea>

            <button
                @click="saved"
                class="text-sm text-white mr-1 px-2 py-2 font-medium bg-gray-700 rounded-md hover:bg-gray-600 cursor pointer"
            >
                {{ label }}
            </button>
            <button
                @click="closed"
                class="text-sm px-2 py-2 text-white font-medium bg-gray-400 bg-gray-100 rounded-md hover:bg-gray-300"
            >
                <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
                    <path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" />
                </svg>
            </button>

</template>


text:
Q: SchemaDisagreementException Trying to set up a cassandra cluster, but it tells me that I have a SchemaDisagreementException.  What is weird is that writing sometimes works, just not all of the time.  I assume that I must somewhere have different schemas, but I've cleared my data directories several times before, so it must not be in there.  Where else would my schema be declared, other than in my code?

A: You've inspired a FAQ entry! :)
http://wiki.apache.org/cassandra/FAQ#schema_disagreement
(This didn't exist until 10 minutes ago, so no, you didn't miss it.)

A: FAQ didn't helped me in getting this issue resolved, instead fuzzed me. I have document all my concerns and reasons of confusion at http://nsinfra.blogspot.in/2013/06/cassandra-schema-disagreement-problem.html
Anyways I got rid of this problem by synchronizing the clocks of cluster nodes.

A: I'm seeing this too, about 1 in 3 times.
I'm able to reproduce it on a clean cluster -- no operations performed apart from starting the nodes -- and then listing schema versions confirms different some nodes already sometimes have different schemas.
I get the error even with just 2 nodes, seeds on both nodes set to the two nodes' IP addresses. Occurs starting concurrently or with a 2m delay before starting the second node.
This is Cassandra version 1.2.2. Times on the machines are in sync (<1s difference).


text:
Q: How to automate integration testing that requires multiple computers? How do you automate integration testing that requires 2 or more PCs (distributed app)? What's your strategy for performing integration testing (or performance testing) on the cases where multiple machines are involved?
Example
We need to integration-test our client/server app. To mimic the live-system, we need to deploy the client on one machine, and the server on another. Then we measure the TCP transfer speed.

A: There are ways to do this, but none of them are built into any frameworks that I am aware of.
Below are the three ways I have addressed it in the past:

*

*use VMWare Server/ESX - What we have done most recently is to actually build VM images for the server and client machine with a mountable second drive (data drive). We then build and unit test our software, before the performance test we spin up the VM, then deploy the code to the data drive. After that we deploy a set of test scripts to the machines and kick them off (via Powershell). This works pretty well, has good replay-ability and allows us to give the test servers to other teams/customers for their evaluation. The downside is that it is very resource intensive.

*Dedicated Server & Client Test Sets - We had two different Source Repositories, one for the server and one for the client. We then went through the build as above, but one at a time, deploying the server (and testing it against the old client), deploying the client (and testing it against the old server), and then deploying both and testing the combination. This worked fairly well, but required some manual testing for certain scenarios and could get cumbersome if we needed to test multiple server changes or client changes at the same time.

*Test against production only - We only ever updated the client OR the server and then we updated that part and tested it against the current production setup. The downside of this of course is that we had to deploy much slower and make incremental changes in one system or the other, deploy, test and release, then make changes in the other component. Rinse and repeat.

If you have the resources I highly recommend #1. Its harder to setup initially but it pays for itself very quickly, and once its setup its repeatable for other products as well (as long as they follow a relatively similar deployment pattern).

A: It depends on your setup.  For example I needed to test a group of web services that my team created/modified.  During the test we deployed the app to one machine as the producer and used SoapUI to generated a few thousand transactions via many threads (from 1 to 100 threads as I remember).  That way we guaranteed the response and the SLA (service level agreement).


text:
Q: AngularJS sending values between screens I am building a cross platform app using Onsen UI, Monaca and AngularJS.
I have 2 screens. The first is where a user have to enter a Vehicle ID which calls an API. Based on the input Vehicle ID, I want to populate the API URL with this value and on the next screen display a list of all options that are returned as a JSON object based on the Vehicle ID.
E.g the API call looks as follows: mymadeupdomain/api/vehicle.php?id=109
Where 109 would be the ID the user enters to determine what will be displayed on the detailed vehicle screen.
I have hard-coded the values and I can read back the JSON object that is returned, but I cant seem to send the values for when the user enters them.
vehicle-id.html form that gets the vehicle id from the user
<form class="login-form" style="text-align: center" name="myForm">

        <input type="text"
        class="text-input--underbar"
        required
        minlength="3"
        maxlength="10"
        ng-model-options="{ debounce : 800 }"
        placeholder="Vehicle ID / Fleet Number"
        ng-model="fleetIDSearch" >

</form>

app.js is the controller for handling the form check
angular.module("myApp", ['onsen']).controller("vehicleController", function($scope, $http)
{
    // Watch for changes on the vehicle ID screen
    $scope.$watch('fleetIDSearch', function()
    {
       fetchFleetDetails();
    });

    $scope.fleetIDSearch = "";

    function fetchFleetDetails()
    {
        $http.get("http://mymadeupdomain/api/vehicle.php?id=" + $scope.fleetIDSearch).success(function(data)
        {
            $scope.fleetIDs = data;
        });
    }

    // Returns a list of all Vehivle Checks associated with Vehicle ID
    $http.get("http://mymadeupdomain/api/getfleetchecks.php?fleetid=" + $scope.fleetIDSearch).success(function(data) // NOT WORKING HERE
    {
        $scope.checkItemDescriptions = data;
    });
});

How do I get values entered in $scope.fleetIDSearch = ""; in the first screen and pass them to the API URL in the second screen?
I want to display a list of all checks associated with the ID as per below - working when API URL is hard coded
vehicleCheck.html

        {{checkItemDescription.checkitemdesc}}

            <input type="checkbox"
                class="switch__input"
                checked >

A: You have multiple choice in your case, at multiple levels.
If you want to simply share data between controllers, you can use Factories
Another solution is to:

*

*Manage a ng-model on your first page

*When the form is submitted, redirect to an url looking like /content/:id

*Manage your request (fetching remote data) inside of the router resolver

*Take the result directly in the other controller of the other page


text:
Q: Telerik RadGridView problem I am using Telerik RadGridView in my project. I want to show  image in column.
                GridViewImageColumn col1 = new GridViewImageColumn();
                col1.Width = 100;
                col1.DataMemberBinding = new Binding("id");
                col1.Header = "PhotoByConverter";
                col1.DataMemberBinding.Converter = new ThumbnailConverter();
                grid.Columns.Add(col1);

                GridViewDataColumn col2 = new GridViewDataeColumn();
                col2.Width = 100;
                col2.DataMemberBinding = new Binding("firstName");
                col2.Header = "Person name";
                grid.Columns.Add(col2);

                Grid.ItemsSource=DataTable;

First column not wokrs but second works fine. I use Converter for image shown below
    public class ThumbnailConverter : IValueConverter
    {

    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
                    IEnumerable<thumbNail> result = from n in thumbnails
                                        where n.personID == value.ToString()
                                        select n;

        if (result != null && result.First().thumbnail != null)
        {
            return result.First().thumbnail.file;
        }
        else
        {
            return null;
        }
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new Exception("The method or operation is not implemented.");
    }
   }

I found by id thumbnail of person and set it like data for GridViewImageColumn. I checked with Debuger conveter works properly. I can't undesrtand why it doesn't work.
Any ideas?

A: I found solution for these problem. Only thing that is require is use Property name in square brackets
    GridViewImageColumn col1= new GridVeiwImageColumn();
    col1.DataMemberBinding = new Binding("[id]");


text:
Q: HTML / CSS: Section + Aside Issue I've an issue with my aside bar and the timestamp in my section.

                Sample

                    02-11-2016 18:51 P.M.

                Hello this is random text that I will test today to see if my sizing is correct.
                ello this is random text that I will test today to see if my sizing is correct.

            Random Aside Text.

If I add more sections, the aside bar sticks to the last section, where as I want it to stick from top downwards.
Also my timestamp is okay if one section exists but if more sections are added, timestamp get's pushed below the text.
Here is the CSS:
section,
aside
{
    margin: 20px 20px 24px 0;
}

section
{
    float: left;
    width: 55%;
    margin-left: 20px;
    border: 3px solid black;
    padding-bottom: 20px;
    border-radius: 10px;
}

.thumbnail-title
{
    border: 3px solid black;
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 15px;
    text-align: center;
    font-size: 24px;
    margin-bottom: 20px;
}

.thumbnail-image
{
    float: left;
    height: 200px;
    width: 300px;
    border: 3px solid black;
    margin-left: 20px;
    margin-right: 20px;
    border-radius: 10px;
}

.thumbnail-text
{
    font-size: 18px;
    text-align: left;
    padding: 20px;
    padding-left: 20px;
    margin-left: 20px;
    margin-right: 20px;
    border-radius: 10px;
}

.thumbnail-timestamp
{
    border: 1px solid black;
    text-align: right;
    float: right;
    width: 360px;
    height: 10px;
    padding: 2px;
    font-size: 10px;
    margin-bottom: 10px;
    border-top: none;
    border-left: none;
    border-right: none;
}

aside
{
    float: right;
    width: 38%;
    padding: 10px;
    border: 3px solid black;
    border-radius: 10px;
}

I want my page to look like this:
Idea

A: *

*Be care with margin property. (I mean by that margin: 20px 20px 24px 0; is cool, but it's 'dangerous' when you want inline elements)

*Set display: inline-block or play with flexbox (amazing things)

*Set correct percentage for your width.

*If you set a margin: 20px, it doesn't seem to be big, but in fact, it's huge (especially when you resizing, or when you want to set elements in same line.)

Is this something you want ? http://codepen.io/anon/pen/ZBrYde


text:
Q: How to configure in mysql that works with following PHP code? Please tell me how to configure data in mysql so it can work with below mentioned PHP code.
I don't know what is $GYAZO_DB_PREFIX. in readme file they are telling it is // Database table prefix .
If it is Database table prefix  how to add it?
Also what is UserID & UserIP. They are fields or saprate tables?
Any help would be appreciated.

A: Assuming you set $GYAZO_DB_PREFIX = 'yourdb_',
 then, your table's name would be yourdb_members, yourdb_table1, etc. The DB prefix is usually configured by the user, or could be left blank, if your tables are going to be named 'members', 'table1', etc.
UserID & UserIP are both columns in the table yourdb_members.
You are trying to store UserID and UserIP in that table. If the userid exists, you are updating UserIP.
As @Truth said, mysql_ functions are going to be deprecated soon, so refrain from using them.


text:
Q: Using dplyr to add summary rows        Gender Year.10 Year.11 Year.12 Year.13 Year.10.1 Year.11.1 Year.12.1 Year.13.1
1      FEMALE 1181980 1113480 1040960 1033150   1116220   1059850   1022950    974490
2        MALE  674020  783150  571170  594330    641620    767590    554290    563670
3 UNSPECIFIED   31930    7740   14670   17420     31930      5590      9170     17420

I have summed up my data and want to add these sums to underneath their respective Genders in my data.frame. So for instance after my female rows, I want to add my female sums underneath it (with Age == "All")
I think I can accomplish this using dplyr, but I don't know how to select positions in the data.frame.
I think it would have to be something along the lines of:
dummy.c %>%
group_by(Gender) %>%
rowwise () %>%
mutate () #### It's here where I don't know where to go on from

I used summarise_each(funs(sum=sum(., na.rm=TRUE)), starts_with("Year")) to generate my summary, I probably have to put that in my mutate ().
> dput(dummy.c[sample(1:nrow(dummy.c), 15, replace=FALSE),])
structure(list(Gender = structure(c(1L, 1L, 2L, 2L, 3L, 2L, 2L,
2L, 3L, 3L, 1L, 2L, 2L, 3L, 3L), .Label = c("FEMALE", "MALE",
"UNSPECIFIED"), class = "factor"), Age = structure(c(5L, 3L,
3L, 4L, 7L, 6L, 5L, 8L, 6L, 8L, 2L, 7L, 1L, 5L, 2L), .Label = c("0-2",
"3-9", "10-19", "20-39", "40-59", "60-64", "65+", "UNSP"), class = "factor"),
Year.10 = c(484770L, 58440L, 58570L, 200290L, NA, 54780L,
238600L, NA, 2470L, 10920L, 46890L, 63360L, 16900L, 12850L,
NA), Year.11 = c(439860L, 92870L, 60060L, 264280L, NA, 54400L,
258820L, NA, NA, NA, 30150L, 84750L, 22380L, NA, 2150L),
Year.12 = c(454200L, 50900L, 55600L, 230460L, 3610L, 47960L,
148530L, NA, NA, 5500L, 18020L, 64810L, 2260L, 5560L, NA),
Year.13 = c(412650L, 84110L, 38000L, 205600L, NA, 40600L,
185770L, 5670L, NA, 5700L, 19060L, 79150L, 5860L, NA, NA),
Gender.1 = structure(c(1L, 1L, 2L, 2L, 3L, 2L, 2L, 2L, 3L,
3L, 1L, 2L, 2L, 3L, 3L), .Label = c("FEMALE", "MALE", "UNSPECIFIED"
), class = "factor"), Age.1 = structure(c(5L, 3L, 3L, 4L,
7L, 6L, 5L, 8L, 6L, 8L, 2L, 7L, 1L, 5L, 2L), .Label = c("0-2",
"3-9", "10-19", "20-39", "40-59", "60-64", "65+", "UNSP"), class = c("ordered",
"factor")), Year.10.1 = c(460340L, 52680L, 58570L, 197110L,
NA, 54780L, 226110L, NA, 2470L, 10920L, 41370L, 52240L, 16900L,
12850L, NA), Year.11.1 = c(417800L, 87280L, 60060L, 264280L,
NA, 54400L, 248810L, NA, NA, NA, 30150L, 79200L, 22380L,
NA, NA), Year.12.1 = c(447400L, 50900L, 50100L, 224700L,
3610L, 47960L, 148530L, NA, NA, NA, 18020L, 59190L, 2260L,
5560L, NA), Year.13.1 = c(395700L, 78440L, 36520L, 200050L,
NA, 37360L, 185770L, 5670L, NA, 5700L, 19060L, 62130L, 5860L,
NA, NA)), .Names = c("Gender", "Age", "Year.10", "Year.11",
"Year.12", "Year.13", "Gender.1", "Age.1", "Year.10.1", "Year.11.1",
"Year.12.1", "Year.13.1"), row.names = c(5L, 3L, 11L, 12L, 22L,
14L, 13L, 16L, 21L, 23L, 2L, 15L, 9L, 20L, 17L), class = "data.frame")

Edit 1: To show data
> head(dummy.c)
  Gender   Age Year.10 Year.11 Year.12 Year.13 Gender.1 Age.1 Year.10.1 Year.11.1 Year.12.1 Year.13.1
1 FEMALE   0-2   13700    2470    7820    2100   FEMALE   0-2     13700      2470      7820      2100
2 FEMALE   3-9   46890   30150   18020   19060   FEMALE   3-9     41370     30150     18020     19060
3 FEMALE 10-19   58440   92870   50900   84110   FEMALE 10-19     52680     87280     50900     78440
4 FEMALE 20-39  380610  387080  291930  371290   FEMALE 20-39    356070    372370    280720    356500
5 FEMALE 40-59  484770  439860  454200  412650   FEMALE 40-59    460340    417800    447400    395700
6 FEMALE 60-64   80090   76670   92750   60710   FEMALE 60-64     80090     76670     92750     49240`

tail(dummy.c)
        Gender   Age Year.10 Year.11 Year.12 Year.13    Gender.1 Age.1 Year.10.1 Year.11.1 Year.12.1
18 UNSPECIFIED 10-19    5690      NA      NA      NA UNSPECIFIED 10-19      5690        NA        NA
19 UNSPECIFIED 20-39      NA    5590      NA   11720 UNSPECIFIED 20-39        NA      5590        NA
20 UNSPECIFIED 40-59   12850      NA    5560      NA UNSPECIFIED 40-59     12850        NA      5560
21 UNSPECIFIED 60-64    2470      NA      NA      NA UNSPECIFIED 60-64      2470        NA        NA
22 UNSPECIFIED   65+      NA      NA    3610      NA UNSPECIFIED   65+        NA        NA      3610
23 UNSPECIFIED  UNSP   10920      NA    5500    5700 UNSPECIFIED  UNSP     10920        NA        NA
   Year.13.1
18        NA
19     11720
20        NA
21        NA
22        NA
23      5700

A: An alternative using reshape2 and dplyr packages (both of the same author, btw=P):
df <- structure(...) # structure of your question

Now, melt and cast:
df %>%
  select(-Gender.1,-Age.1) %>%
  melt %>% # melting data.frame. See the results until here to better understanding.
  dcast(Gender + Age ~ variable, sum, na.rm=TRUE, margins = "Age")

What's going on, line by line:

*

*your data.frame

*removing duplicated columns

*melting data.frame. See the results until here to better understanding.

*aggregate by Gender, Age and variable (Years, in this case). The aggregation function is sum with na.rm=TRUE. Then, margin = "Age" puts the totals by Age, as desired.

Results:
        Gender   Age Year.10 Year.11 Year.12 Year.13 Year.10.1 Year.11.1 Year.12.1 Year.13.1
1       FEMALE   3-9   46890   30150   18020   19060     41370     30150     18020     19060
2       FEMALE 10-19   58440   92870   50900   84110     52680     87280     50900     78440
3       FEMALE 40-59  484770  439860  454200  412650    460340    417800    447400    395700
4       FEMALE (all)  590100  562880  523120  515820    554390    535230    516320    493200
5         MALE   0-2   16900   22380    2260    5860     16900     22380      2260      5860
...
17 UNSPECIFIED  UNSP   10920       0    5500    5700     10920         0         0      5700
18 UNSPECIFIED (all)   26240    2150   14670    5700     26240         0      9170      5700

Hope it helps.


text:
Q: Universal Control Stopped Working (12.5) Every update Universal Control stops working. There is another thread here: Universal Control Stopped Working (12.4)
Trying the usual steps:

*

*Creating another admin user on mac

*Booting in safe mode

*Turning of share cursor and keyboard on the ipad / reboot / turn back on

*Factory resetting the Macbook Pro 13" M1, iPad Air4 and iPad Mini 6 - it fixes it for a few hours and then it breaks again.

Nothing works.
I called Apple and they said you need to re-install the OS again (I just re-installed a week ago!!).
It seems every OS update universal control stops working.
Is there any solution to this other than to format and reinstall?
EDIT:
I managed to get 1 iPad Air4 to connect and captured these logs: https://gist.github.com/rgaufman/7ff744d6d4b412544ecb4da660c4f7d9
When I switch on the iPad Mini 5, the Air4 disconnects immediately and then struggles to reconnect. This is what I see in the logs: https://gist.github.com/rgaufman/b13890f8277266ac7636a2ceb9a7cea2
UPDATE:
I had 4 separate people from Apple promise to take ownership of this ticket and scheduled calls that they did not turn up to. It has been a horribly disappointing experience.
I purchased a Mac Mini M1 16GB, did a fresh install and Handoff was working on it all day (got it today). I then thought ah, I will try to re-install Mac (4th time) on the Macbook Pro, this immediately killed handoff on the Mac Mini but now works on the Macbook Pro (I am guessing very temporarily!).
Still looking for a solution for this :(

A: After literally months of trying to find a solution, what I did was change my iCloud account password and ticked "sign out all devices".
Note it is not enough to just change the password (which I've tried) and it is not enough to manually sign out of iCloud on each device (which I've tried multiple times). You must tick "sign out all devices" which does something different.
This is a pain because it resets all your app specific passwords, stops things like SMS forwarding, even after re-signing in, things like imessage don't work across devices until you sign in messages manually on your iPhone. But it's worth it if you want Universal Control to work.
After doing this song and dance, it still wasn't working, so the final step was to turn all devices off and back on. After booting, I can now move my mouse between a Macbook Pro 13" M1, a Mac Mini M1 and an iPad Air 3, excellent!
As a side note, I had duplicate devices listed for features like Wifi Calling, "Calls on other devices" and "Text Message Forwarding" - it didn't impact the functionality but those duplicates are gone too.
I hope this lasts as this is game changing functionality!
UPDATE: This was very short lived, the next day this stopped working after a reboot. I give up.

A: After many months of struggling with this, this has been working stable after updating to Ventura 13.0, woo!

A: I have Ventura 13.2 I was trying to do this in many ways, until I checked some options, and it worked!!!

*

*Sign in all the computers with you Apple ID

*Check the options for Universal Control as in the guide: https://support.apple.com/en-us/HT212757 Steps related with the Handoff and Universal Control

*Check the in General that your main laptop - the one who has the keyboard and mouse associates have the proper sharing options (notice that in general you could see AirDrop and Handoff check those options too):

then go to Sharing. Note: it's important to have all the 3 or 2 laptops/devices sharing bluetooth in case you have a external bluetooth keyboard (please check the bluetooth check as follow)

then check all of these options. I was able to configure this with the next steps:

I was able to link the keyboard and mouse to navigate between 3 MacBook Pro computers


text:
Q: SVG group dragging with its foreignobject child and allowing its foriengobject child's content to be draggable too using gsap draggable I am using gsap draggable to achieve svg group dragging with its content (contains foreignObject) and allowing its contents (contents inside foreignObject) to be draggable independent too.
what I want to achieve is when dragging grey box, its content (cyan colored cell) should be dragged as well and also allow me to drag only cyan cells as well.
if I comment child dragging functionality then parent-child dragging works but when I add child dragging, it's not working as expected.
the code written below is based on an example I found on gsap's form.

Draggable.create('.node-container');

Draggable.create('.tablecelldiv', {
  onPress: function(event){
    event.stopPropagation();
  }
});
.tablecelldiv {

  background: cyan;
}

<svg width="900" height="250">
  <g class="node-container">
   <rect height="290" width="290" fill="grey"></rect>
        <foreignObject width="230" height="220" y="62" x="12.5" style="overflow: hidden" >

row 1

row 2

row 3

row 4

        </foreignObject>
      </g>
</svg>

EDIT: I have tested this code on MS Edge and FireFox browsers and it worked perfectly. I believe its a bug either in GSAP or with Google Chrome Implementation.


text:
Q: Writing code to a file, and then executing it I have a Python script that imports an existing file in the same directory as a module. How does writing to the file, then using the import to execute it differ from exec()? Is it safer?
Here's an example to illustrate what I'm talking about:
import example
examplefile = open("example.py", "w")
exampletext = "def examplefunction():\n\tprint('This is an example!')\n\treturn"
examplefile.write(exampletext)
examplefile.close()
example.examplefunction()

A: No, it's no safer than using exec(). Both importing and exec() compile the text to bytecode and then execute the bytecode. The generated bytecode will be exactly the same.
The only difference will be that a .pyc bytecode cache file can be created for a file on disk, while exec() will re-compile the text each and every time. If you generate the file just once, then import it across Python invocations, then writing the file to disk is going to benefit from that cache.


text:
Q: How do I make the images fit for all kind of devices I am Adding a image slide bar below the menu bar. It is perfectly fitting to all kind of devices. So what can I do to fit for all kinds of devices.

A: Follow this code

CSS
.slidebar{
  width:100%;
  height:auto;
  overflow:hidden;
}

.slidebar img{
  width:100%;
  height:auto;
}

Working Demo https://jsfiddle.net/Rahul_Ravi/6kqxwjz8/


text:
Q: How to get camunda authorization id I am trying to create a REST application in camunda, and I want to get the default athorization id, but have no idea how to do this.
Can someone explain what should I do? It seems to me that I should send some request to the server, but I have looked up to the camunda documentation and have not found how to get authorithation id.

A: Did you create a user id before?
Can you try to create a user then give some Authorization Permission types.
Create user: POST /user/create
{"profile":
  {"id": "jonny1",
   "firstName":"John",
   "lastName":"Doe",
   "email":"aNewEmailAddress"},
   "credentials":
  {"password":"s3cret"}
}

Authorization Management: POST /authorization/create
{"type" : 0,
 "permissions": ["CREATE", "READ"],
 "userId": "*",
 "groupId": null,
 "resourceType": 1,
 "resourceId": "*"
}

*

*Permissions.READ

*Permissions.UPDATE

*Permissions.DELETE


text:
Q: How to set threeview node checkbox to mix state i.e. if any of the child node is selected, Parent node should fill in to indicate that I am working on a windows form application, where I connect to the database and get a list of projects and sub-projects. I am able to show this as a treeview with checkboxes, that later an user can select to do further operations.
My problem is that, I can't set the Parent node state when one of the child nodes is selected. Here, I want some indication, if any of the child nodes is selected the parent node should fill in to show that something has been selected below that parent node.

A: Okay, meanwhile, I found answer to my problem. Not really wise but thanks to this Simple Tri-State TreeView control.  code link here.
I will definitely try to build my own custom version of this. For now, this works fine.


text:
Q: How do I use Entity Framework 6 with MySQL in ASP.NET 5? I have an existing site that uses ASP.NET MVC 4, Entity Framework 6 and MySQL. I'm trying to upgrade it to ASP.NET 5, but want to continue using Entity Framework 6 as Entity Framework is missing some features and does not yet support MySQL. How do I use EF6 in ASP.NET 5?

A: Since Web.config is no longer used with ASP.NET 5, you need to use code-based configuration to configure it instead. To do so, create a new class that inherits from DbConfiguration:
public class MyDbConfiguration : DbConfiguration
{
    public MyDbConfiguration()
    {
        // Register ADO.NET provider
        var dataSet = (DataSet)ConfigurationManager.GetSection("system.data");
        dataSet.Tables[0].Rows.Add(
            "MySQL Data Provider",
            ".Net Framework Data Provider for MySQL",
            "MySql.Data.MySqlClient",
            typeof(MySqlClientFactory).AssemblyQualifiedName
        );

        // Register Entity Framework provider
        SetProviderServices("MySql.Data.MySqlClient", new MySqlProviderServices());
        SetDefaultConnectionFactory(new MySqlConnectionFactory());
    }
}

The first part of the configuration is a hack to register the ADO.NET provider at runtime, by dynamically adding a new configuration entry to the system.data section. This is very hacky, but does appear to work correctly.
Add the connection string to config.json rather than Web.config:
{
  "Data": {
    "DefaultConnection": {
      "ConnectionString": "Server=localhost; Database=test; Uid=test; Pwd=password;"
    }
  }
}

Modify the DbContext to use the correct configuration and connection string:
[DbConfigurationType(typeof(MyDbConfiguration))]
public class MyContext : DbContext
{
    public MyContext(IConfiguration config)
      : base(config["Data:DefaultConnection:ConnectionString"])
      {
      }
      // ...
}

Register MyContext in the dependency injection container in Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
    // ...
    services.AddScoped<MyContext>();
}

Then you can just use constructor injection to get MyContext into your controllers.
More details in my blog post at http://dan.cx/2015/08/entity-framework-6-mysql-aspnet, and a sample project at https://github.com/Daniel15/EFExample


text:
Q: Calling someone, "harsh" I know that we can say someone is "harsh on someone," but I wonder if we can call someone harsh without specifying on whom.In dictionaries, I couldn't find definitions or examples of "harsh" in which it says it can be used that way. So I have the need to ask you guys. For example, is it fine to say sentences like the ones below:

*

*He is a harsh person.

*He is harsh.

*You are being harsh.

Contexts:
Sentence 1: I mean he is generally a mean person.
Sentence 2: I  mean he is generally a mean person.
Sentence 3: I mean he is being mean.


text:
Q: Apex scheduled job to call .net web services hosted in IIS periodically I just wondering if someone could guide me to a document of how to perform Apex scheduled job – To call .net web service hosted in IIS of external server on a periodic basis. My requirement is every 30 mins my Apex scheduled Batch job to call .net webservices hosted in IIS and update respective fields in Account object with resultset recieved from the Remote Call. I dont have the Webservice Up yet but I am trying to find an example on how the whole integration is done. Is it possible? Can any one guide me out in the integration part?

A: You'll need to write some Apex to make the callout to IIS.  Whether this happens via Apex to WSDL generated code, writing a simple class to call a REST service, or using outbound messaging perhaps depends on your IIS web service.
Assuming you have the webservice code already in place, you'll need a few things to schedule the callouts

*

*A scheduled class that calls a batch job.

*A batch job, which implements Database.AllowsCallouts (See: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm)

*The batch job will likely call another Apex class that performs the callout to your web service.

*Once your code is in place, you can schedule it to run through the "Schedule Apex" button on the Apex Classes list view in Salesforce.

Batch jobs cannot call future methods, but can make callouts if they implement Database.AllowsCallouts.
Furthermore, you are limited to 10 callouts per batch.  For instance, if your webservice only supports one record per request, you'll need to restrict the batch size in your scheduled Apex to 10.
Your schedule class might look similar to the following:
global class myscheduleclass implements Schedulable {
    global void execute(SchedulableContext sc) {
        //10 denotes my batch size, if you can afford 200 records, then remove second parameter
        Database.executeBatch(new mybatchclass(),10);
    }
}

Your batch class might look like:
global class mybatchclass implements Database.Batchable<sObject>,Database.AllowsCallouts    {

    global mybatchclass() {}

    global List<sobject> start(Database.BatchableContext BC) {
        //Query for your records here
    }

    global void execute(Database.BatchableContext BC, List<sobject> scope) {
        //Call your class that executes the IIS callout here
    }

    global void finish(Database.BatchableContext BC) {
        //chain other batch processes if need be here
    }
}

That should help get you started.


text:
Q: Using Google Adwords API in PHP Hi there I was wondering if anyone could help me out.
Basically I am trying to use the trafficEstimatorService in order to retrieve how much traffic a keyword that is entered through a HTML generates.
I have an idea of how to make it work but I am totally new to using the google API.
Firstly would I create the form in php and perform a GET request on the trafficEstimator url with the keywords in the form as parameters?
Thanks!

A: I found that the hardest part of getting started was the Oauth Authentication. Ewan Hemming's tutorial on the subject helped me out a lot: http://www.ewanheming.com/adwords-api-oauth-tutorial

A: Take a look at https://github.com/googleads/googleads-php-lib
It's a php client library including examples on how to do things + a video which is a very good and detailed starting point.

A: If you already tried to follow Make Your First API Call and video with talk through instead of walkthrough of the steps and you felt confused and unclear, then here is step by step tutorial for you.