text:
Q: Asking for user input to create two arrays import java.util.Scanner;

public class Ch7AssignArrays1 {

    public static void main(String[] args) {
        int[] population = new int[5];// array to store populations for counties
        String[] county = new String[5]; //array to store county names

        Scanner input = new Scanner(System.in);
        //ask user for county name and store in array
        System.out.println("Please enter the name of a county: ");
        county[0] = input.toString();
        //ask user for population of county entered above, store in array
        System.out.println("Enter the population of the county: " + input.nextLine());
        population[0] = input.nextInt();

        for(int index = 1; index < county.length && index < population.length; index++){
            System.out.println("Please enter the name of a county: ");
            county[index] = input.toString();
            //ask user for population of county entered above, store in array
            System.out.println("Enter the population of the county: ");
            System.out.println(input.hasNext());
            population[index] = input.nextInt();
        }
        for(int index = 0; index < county.length && index < population.length;index++){
        System.out.println(county[index] + "\t" + population[index]);
        }
    }

}

I have written this code and am having an issue when the program reaches the for loop. I want to be able to ask for a user input, store into one array(county), then ask again for input and store into the other array(population), then print both arrays at the end. This works fine with the input.nextLine outside of the for loop, each question is asked then stored. But when in the loop, both questions are asked at once and input is only taken for the second array (population). The solution that I found for outside the for loop does not work inside the loop. What can I put in the for loop that would fix this?

A: My issue was my code line  county[0] = input.toString(); should be .next() to solve the multiple user inputs issue.

A: Thanks Mallory L, this is a good question.
It'll take a little bit longer to answer this question fully.
In the meantime, any reasons for start looping with index=1 instead of index=0 in "for(int index = 1; index < county.length && index < population.length; index++){"?
Also, what would be the example input and example output?
For example, user types in "Los Angeles" for the county, the result will be 12,000,000?
If you want the user to continue adding more counties and populations until the user wants to stop, then consider using a while loop instead of a for loop.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Cannot connect to X display using an ssh tunnel in WSL bash I have VcXsrv installed on windows and I run
ssh -NfXY -t -o ServerAliveInterval=30 -L 2121:PCNAME:21 -L 2020:PCNAME:20 -L 2222:PCNAME:22 USERNAME@SERVER

to tunnel through the university server to my workstation.
I can run xeyes in WSL bash locally and it works
xeyes fails with Error: Can't open display: 0.0
It also hangs forever if I set DISPLAY to localhost:0.0
e.g.
[local WSL]> echo $DISPLAY
:0
[local WSL]> xeyes
"runs"
[local WSL]> ssh -NfXY -t -o ServerAliveInterval=30 -L 2121:PCNAME:21 -L 2020:PCNAME:20 -L 2222:PCNAME:22 USERNAME@SERVER
[workstation]> export DISPLAY=localhost:0.0
Error: Can't open display: localhost:0.0
[workstation]> export DISPLAY=:0.0
[workstation]> xeyes
"hangs with no output"

Can anyone help?
EDIT:
I can run this fine from another PC using localhost:11.0 on the workstation. If I run xeyes from the original PC with localhost:11.0 it uses the other computer!!!

A: First, you need to enable ForwardX11 on the client and X11Forwarding on the remote host in /etc/ssh/sshd_config.
Then, try without adjusting DISPLAY on your workstation/remote machine first.  Only set the DISPLAY variable after you've ensured everything else is set up to work correctly.  You shouldn't have to set this but it is possible.
I believe that the command 'hangs forever' because it is being displayed on the remote machine (which you likely cannot see).
Sometimes it's good to simplify things and try to solve one problem at a time.  Have you tried dropping the port forwarding and everything else and focused on getting X11 Forwarding working in a simple setup?

Summary: Asker enabled ForwardX11 on the client and set DISPLAY=localhost:0.0 only after initial attempt resulted in
connect /tmp/.X11-unix/X0: Connection refused Error: Can't open display: localhost:13.0


text:
Q: how to make relative layout accommodate tablets screen how to make the layout same as for normal screen and tablet screen?
can I change to linear layout with the same spaces and peding ? please help I'm new :)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

the home code is
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/backr"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".FreeDENTAL" >

   <Button
       android:id="@+id/buttonlec"
       android:layout_width="fill_parent"
       android:layout_height="100dp"
       android:layout_alignBottom="@+id/buttonbook"
       android:layout_alignLeft="@+id/buttonbook"
       android:layout_marginBottom="47dp"
       android:background="@drawable/cooltext1218143078" />

<Button
    android:id="@+id/buttonbook"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="158dp"
    android:background="@drawable/cooltext1218138491" />

<Button
    android:id="@+id/button1"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="50dp"
    android:layout_alignLeft="@+id/buttonbook"
    android:layout_alignRight="@+id/buttonbook"
    android:layout_below="@+id/buttonlec"
    android:layout_marginTop="18dp"
    android:background="@drawable/cooltext1218134039" />

<Button
    android:id="@+id/button2"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="160dp"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/button1"
    android:layout_below="@+id/button1"
    android:layout_marginTop="32dp"
    android:background="@drawable/cooltext1218152696" />

<Button
    android:id="@+id/button4"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/button2"
    android:layout_alignRight="@+id/button2"
    android:layout_below="@+id/button2"
    android:background="@drawable/tips"
    />

<Button
    android:id="@+id/button5"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/button2"
    android:layout_alignBottom="@+id/button2"
    android:layout_alignLeft="@+id/button3"
    android:layout_alignRight="@+id/button1"
    android:background="@drawable/news" />

<Button
    android:id="@+id/button3"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="125dp"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/button4"
    android:layout_alignRight="@+id/button1"
    android:layout_below="@+id/button2"
    android:background="@drawable/cooltext1218061123" />

</RelativeLayout>

A: Try working with android:layout_weight instead of fixed dp.
As can be seen here:
Percentage width in a RelativeLayout

A: Check dimen.xml in values-sw600dp or values-sw720dp folder for
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

OR:
May try to change
Change
android:layout_width="match_parent"
android:layout_height="match_parent"

TO
android:layout_width="fill_parent"
android:layout_height="fill_parent"

A: Technically, what you have is the same layout on both screens. A couple reasons things look strange on the tablet are:

*

*It doesn't look like you have different button images for the different screen sizes.

*You're using fill_parent for your top buttons' widths - given the variety of screen sizes possible, that's likely to end up stretching them on at least a few screens.

I'd recommend reading the guide on Supporting Multiple Screens.


text:
Q: How to write JQuery callback function My callback function is not working, I want to run test() after configReq()
$(document).ready(function() {
 configReq($(this).attr('href'), test);
});

var test = function() {
 alert('hi');
};

 function configReq(thisUrl) {
    $('.progress').empty();
    $('.progress').append('

');
}

Please let me know where i am wrong...?

A: Seems like a synchronous one.
Try,
$(document).ready(function() {
 configReq($(this).attr('href'));
 test();
});

OR
$(document).ready(function() {
     configReq($(this).attr('href'),test);
         });

function configReq(thisUrl,nextFunction) {
    $('.progress').empty();
    $('.progress').append('

');
nextFunction();
}

A: Like this:
$(document).ready(function() {
    configReq('Some item', test);
});

function test() {
    console.log('Callback executed');
};

function configReq(thisUrl, callback) {
    console.log('Executing configReq');
    if (callback) callback();
}

DEMO

A: To write a function which execute a callback function, you can go like this:
function doSomething(arg,callback) {
    // .....
    if (typeof callback === "function") {
        callback();
    }
}

So your code go like this:

DEMO:http://jsfiddle.net/z7LDA/1/
HTML:
click me

Javascript:
$(document).ready(function() {
    $("a").click(function(){
         configReq($(this).attr('href'), test);
    });
});

var test = function() {
    alert('hi');
};

function configReq(thisUrl,callback) {
    $('.progress').empty();
    $('.progress').append('

');
    if (typeof callback === "function") {
        callback();
    }
}

A: This is a simple callback function:
$(document).ready(function() {
     configReq($(this).attr('href'), function(){
        alert('hi');
     });
    });

     function configReq(thisUrl) {
        $('.progress').empty();
        $('.progress').append('

');
    }


text:
Q: Android rotating multiple bitmaps around a point I am rotating a set of bitmaps on canvas around a certain point. I am using following function to rotate:
private void rotateGroupdAtPoint(ArrayList<MyBitmap> group, int degrees) {
        // TODO Auto-generated method stub

        float minx=100000,miny=100000,maxx=-100000,maxy=-100000;
        for(int i = 0; i < group.size(); i++) {
            MyBitmap m = group.get(i);
            if(minx > m.getX()) {
                minx = m.getX();
            }
            if(miny > m.getY()) {
                miny = m.getY();
            }
            if(maxx < m.getX() + m.getBmp().getWidth()) {
                maxx = m.getX() + m.getBmp().getWidth();
            }
            if(maxy < m.getY() + m.getBmp().getHeight()) {
                maxy = m.getY() + m.getBmp().getHeight();
            }
        }

        float x = (minx+maxx)/2;
        float y = (miny+maxy)/2;
        Log.d("minmax","min:"+minx+","+maxx+"    max:"+miny+","+maxy);

        for(int i = 0; i < group.size(); i++) {
            Log.d("position before","x:" + group.get(i).getX() + ", y:" + group.get(i).getY());
            float newx = (float)(((group.get(i).getX() - x) * Math.cos(Math.toRadians(degrees))) + ((group.get(i).getY() - y) * Math.sin(Math.toRadians(degrees)))) + x;
            float newy = (float)(((group.get(i).getX() - x) * Math.sin(Math.toRadians(degrees))) - ((group.get(i).getY() - y) * Math.cos(Math.toRadians(degrees)))) + y;
            group.get(i).setX(newx);
            group.get(i).setY(newy);
            group.get(i).setBmp(rotateBitmap(group.get(i).getBmp(), -90));
            Log.d("position","x:" + group.get(i).getX() + ", y:" + group.get(i).getY());

        }
    }

private Bitmap rotateBitmap(Bitmap bmp, int degrees) {
        if (degrees != 0 && bmp != null) {
            Matrix matrix = new Matrix();

            matrix.setRotate(degrees, (float) bmp.getWidth() / 2, (float) bmp.getHeight() / 2);
            try {
                Bitmap rotatedBmp = Bitmap.createBitmap(bmp, 0, 0, bmp.getWidth(), bmp.getHeight(), matrix, true);
                if (bmp != rotatedBmp) {
                    bmp.recycle();
                    bmp = rotatedBmp;
                }
            } catch (OutOfMemoryError ex) {
                return null;
            }
        }
        return bmp;
    }

Firstly I am finding the mid point that is common to all bitmaps then rotating around that point. Currently I have no issue with orientation, I will add code to do that as well. But my problem is that bitmaps are not rotating properly at the desired angle around the center point. Can anyone guide me where I am wrong?

A: You're not rotating the bitmaps at all.  You use the setX() and setY() properties to move the bitmaps to their new locations.  On top of that, you need to decide what degree they should rotate and use the setRotation() method in conjunction with the setPivotX() and setPivotY() methods.
By default, setRotation(float radians) will rotate the image in radians around the center point of the view you are rotating. So if you call group.get(i).setRotation(Math.PI/2), your bitmap will rotate 90 degrees from the point it is at.
You can adjust the point at which it rotates by calling the setPivot() methods.
View view = group.get(i);
view.setPivotX(0);
view.setPivotY(0);
view.setRotation(Math.PI/2);

This will rotate the view around the top-left corner to a perpendicular angle.


text:
Q: How to decrease header level in Overleaf for table of figures + tables? I'm trying to figure out how to change my list of figures and tables so it refers to figures and tables on a section level. My document type is article in overleaf.
My current code looks as follows:
\documentclass{article}
\begin{document}

\maketitle
\section{Abstract}
\newpage
\tableofcontents
\newpage
\addcontentsline{toc}{section}{\listfigurename}
\listoffigures
\newpage
\addcontentsline{toc}{section}{\listtablename}
\listoftables
\newpage
\section{Introduction}
\section{3}
\section{4}

\begin{table}[H]
\renewcommand{\arraystretch}{2}
\centering
\begin{tabular}{ p{6cm}p{6cm}}
\toprule
\textbf{Variables}                              & \textbf{Description}                                      \\ \midrule
\textit{F\_27608, R\_27730}                     & The amount of cheese and yogurt ordered weekly.           \\
\textit{Year}                                   & Year of the observation.                                  \\
\textit{Winter, Spring, Summer, Autumn} & Season of the observation.                                \\
\textit{Week}                                   & Week of the observation.                                  \\
 \textit{Lag1, Lag2, Lag3, Lag4, Lag5}           &  Lagged order amounts for prior periods.                   \\
\textit{Price}                                  & Mean price of the product for the specific observation.   \\
\textit{Fut1, Fut2, Fut3, Fut4, Fut5}           & Future price of the product.                              \\
\textit{PromoScale}                             & Level of expected increase in orders caused by promotion. \\
\textit{PromoScale(L1, L2, L3)}                 & Lagged PromoScale values for prior periods                \\
\textit{PromoScale(F1, F2, F3)}                 & Future PromosSale values.                                 \\ \bottomrule
\end{tabular}
\caption{Feature space cheese and yogurt}
\end{table}

See picture:
List of tables
How do i make it so that these tables say 4.1 and 4.2 in the list of tables? (the code only shows one table for reference)

A: You can use \counterwithin{figure}{section} to number a counter within a section:
\documentclass{article}

\counterwithin{figure}{section}
\counterwithin{table}{section}

\begin{document}

\section{Abstract}
\newpage
\tableofcontents
\newpage
\addcontentsline{toc}{section}{\listfigurename}
\listoffigures
\newpage
\addcontentsline{toc}{section}{\listtablename}
\listoftables
\newpage

\section{Introduction}
\section{3}
\section{4}

\begin{table}[htbp]
\caption{Feature space cheese and yogurt}
\end{table}

\end{document}


text:
Q: One method called in several methods I have a class that looks like this:
class A {
    public void method1(){
        iniCall();

        // Do something
        finalCall();
    }

    public void method2(){
        iniCall();

        // Do something different
        finalCall();
    } // ... more methods like this
}

How can I simplify this iniCall and finalCall so not to write them in every function (or several functions)?
Is it possible to do something like call(method1), being call something like this:
public void call(method){
    iniCall();
    method();
    finalCall();
}

Otherwise, what is a good alternative?

A: Similar to the other suggestions (who are much quicker than me - but I always want to provide a running example...), I'd suggest passing a Runnable instance to a method that generically calls iniCall(), executes the Runnable and then calls finalCall().
The actual work may be passed in as dedicated Runnable instances, lambdas or method references - the latter is shown here:
public class RepeatedMethodContents
{
    public static void main(String[] args)
    {
        RepeatedMethodContents r = new RepeatedMethodContents();
        r.callWrapped(r::doSomething);
        r.callWrapped(r::doSomethingDifferent);
    }

    private void callWrapped(Runnable runnable)
    {
        iniCall();
        runnable.run();
        finalCall();
    }

    private void doSomething()
    {
        System.out.println("doSomething");
    }

    private void doSomethingDifferent()
    {
        System.out.println("doSomethingDifferent");
    }

    private void iniCall()
    {
        System.out.println("ini");
    }

    private void finalCall()
    {
        System.out.println("final");
    }

}

The output is, as desired:
ini
doSomething
final
ini
doSomethingDifferent
final

BTW: I'd be hesitant to use reflection in general for things like this. Most often, there is an easier, more straightforward and less error-prone way.

A: EDIT
I see that my answer raises some questions.

The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread.

So creation of an instance of this interface may lead to uncertainty and questions. As suggested in comments, you may want to write your own interface and use it instead. It may be something like this:
public interface Method {
    public void run();
}

Your call method will change to something like this:
public void call(Method method) {
    iniCall();
    method.run();
    finalCall();
}

And your call to this method will be something like this:
call(new Method() {
    public void run() {
        // do your stuff here
    }
});

I suggest that you use similar design or consider using of a Template pattern which will probably require some refactoring.

A: You can use a lambda expression (or anonymous class instance that implements Runnable if you don't use Java 8) :
public void call(Runnable method){
    iniCall();
    method.run();
    finalCall();
}

...

public void someMethod () {

    call (() -> {
                   // do something
                });
    ...
    call (() -> {
                   // do something different
                });

}

A: In Java you can't pass methods as argument. You could pass a Runnable though:
public void method1() {
    call(new Runnable() {
        @Override
        public void run() {
            //do something
        }
    });
}

public void method2() {
    call(new Runnable() {
        @Override
        public void run() {
            //do something different
        }
    });
}

public void call(Runnable runnable){
    iniCall();
    runnable.run();
    finalCall();
}

However, I really don't like this approach. I think you could apply template design patter.

A: I'm not sure I like the use of Runnable in the context others have used.  Typically, I think of Runnable as something that will run in a thread, executor service, etc.  And to back that up is the documentation:

The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread.

But making something that does the same thing from scratch is really simple and quick.  We can make an abstract class that will hold the structure you need:
public abstract class AbstractClass
{
    private void iniCall() { ... } // Could also be abstract

    private void finalCall() { ... } // Could also be abstract

    public void doTheThing()
    {
        iniCall();
        foo();
        finalCall();
    }

    public abstract void foo();
}

Of course you need to come up with better names, but that's the starting point.  Then we have two options: instantiate an anonymous class built by extending this class, or creating a new concrete class.  Here's the example of using an anonymous class:
AbstractClass a = new AbstractClass()
    {
        @Override
        public void foo()
        {
            // Place an implementation here.
            method(); // one example, based on the OP.
        }
    };
a.doTheThing();

And here's how you would do an actual class:
public class ConcreteClass extends AbstractClass
{
    @Override
    public void foo()
    {
        // Place an implementation here.
    }
}
ConcreteClass c = new ConcreteClass();
c.doTheThing();

I mainly wanted to bring this up so that you could have a look at the 'anonymous class' paradigm, which is analogous to being able to pass functions as parameters.  Other languages have pointers to functions, delegates, etc - well this is what Java has.  The compiler will ensure that your anonymous class and concrete classes will have an implementation of foo, or it won't compile, so it's not something you can just go 'oops' and forget to implement.


text:
Q: Cron Job mysqldump to daily folder I've created a cron job to dump a table from a database and it works fine:
mysqldump -u username -ppassword dbname tablename > .../backups/matches.sql

This saved the file (note the ... is just the prefix of the location).
What I'd like to do is save this daily to a folder within backups.   For example, backups/20150909/matches.sql
How can I achieve this with a variable?
Will the cron job create the folder if it does not exist?
Any help would be appreciated.   There will be numerous tables that I want to backup daily, so I'd like to simply set up each cron job to do this.

A: I was able to resolve this by using PHP for my backup.
if(!file_exists($dir)) {
    mkdir($dir);
}
if(!file_exists($dir)) {
    echo "Directory (" . $dir . ") was not created.
";
} else {
    echo "Directory (" . $dir . ") successfully created.
";
}

I then proceeded to get the tables
mysqli_select_db($conn, $dbname);
$search = "SHOW TABLES";
$result = mysqli_query($conn, $search);
while($row = mysqli_fetch_assoc($result))
  {
    $tables[] = $row['Tables_in_p3pro_p3live'];
}

Next was to write the sql files
foreach($tables as $key=>$value) {
    $string = "mysqldump -u *username* -p*password* *dbname* " . $value . " > *path_to_dir*/backups/" . $foldername . "/" . $value . ".sql";

    exec($string);
    echo $value . " backup completed.
";
}


text:
Q: EF Core import historical data to Temporal Table I have daily snapshots of historical data.
Is there a way with EF Core to import these into a Temporal Table with a specified Date where this data was valid?
After some research, the only way I can imagine, is to set the systemtime of the SQL Server to the specified date. That seems pretty awful though as normal queries will return 'old' data as long as the SQL Server has the 'wrong' system time. Also I read about some delay after setting the system time until SQL Server will notice.
The application will be a docker container running an ASP.NET Core application, another docker container running the importer service and a third docker container running SQL Server.
I need to import a lot of historical data until yesterday and update the data on a daily basis in the future.
Its also likely that there will be more datasets to be added in the future where I also have to import historical data.
Thanks!


text:
Q: How to request operating system to send email? How can a Qt C++ app request the OS to send email with a specific subject, body and possibly an attachment(s) files? It should be dispatched using the configured default email client.

A: It looks like QDesktopServices::openUrl() will accept a mailto: URL.  But specifying an attachment could be tricky.

A: I've written a small component that handles attachments too. It creates a temporary .eml file filled with the content that you provide to the Email class and opens the default email client with openInDefaultProgram(). The API should be self explaining, but if you have any problems, please don't hesitate to contact me :)
https://github.com/picaschaf/qt-email


text:
Q: How to understand the Uniswap V3 swap fee calculation i read the whitepaper and the code about uniswapv3. but i am still confused about uni-v3 swap fee calculation.
i can't understand  3 formula

qustion1 cant understand Tick struct field feeGrowthOutside(0/1)X128

    struct Info {

        uint256 feeGrowthOutside0X128;
        uint256 feeGrowthOutside1X128;

    }

which at whitepaper is
if swap cross it will be

question2 cant understand above tick i and below tick i formula

which at whitepaper is

i know at uniswapv3 code. when add/remove liquidity will calculate fee owned because liqudity is discrete。 but i really dont konw what 3 formula mean although i tried the fee  distribution result is right

A: feeGrowthOutside tracks how much fee has grown "outside" the tick. In case of the price goes past the tick lower bound from left to right, it is how much fee growth when the price was on the left side of the bound. Noted that, once the price goes past to the right side of the lower bound, the fee earned on its left side will stay the same, and hence, f_o will then be constant.
f_g or feeGrowthGlobal, will still growing no matter the current price is on the left, right side, or inside of the tick, hence the fee earned for the right side of the lower bound of the tick, in this case, is f_g - f_o.


text:
Q: How to specify user using @ if the comp is not part of any domain? I want to run a command as an administrator. So I use runas command. And I want to specify the user using @ character.
Is that possible as the computer (Windows7) is not part of any domain?
Examples:
> runas /noprofile /user:mymachine\administrator cmd
> runas /profile /env /user:mydomain\admin "mmc %windir%\system32\dsa.msc"
> runas /env /user:user@domain.microsoft.com "notepad \"my file.txt\""

I tried

*

*administrator@computer_name

*administrator@workgroup

*administrator@our_company_name

*administrator@computers_ip

and nothing worked. computer_name\administrator works ok.

A: This syntax is not available for non-domain user accounts. You must use the computer\username syntax for local user accounts.
The name@domain syntax is a User Principal Name. This is a feature of Active Directory; it used for specifying user accounts within a domain. It is not available for local user accounts since there is no associated domain suffix.
I've looked for documentation specifying this, but the best I can find is this, which says:

In a Windows 2000 domain, an account can have a user principal name in addition to its SAM account name.

Implicitly, this means that workgroup accounts do not have UPNs.

A: So why not just use computer_name\administrator?
This is standard convention and you may look into your environmental variables if this is an itch your can't scratch.


text:
Q: Why is my Python2 xml parser not working as expected in Python3? The following code is working fine with Python 2.
import xml.etree.ElementTree as ET
import os
import json

file_name = 'sample.xml'
full_path = os.path.join('Test', file_name)

tree = ET.parse(full_path)
myroot = tree.getroot()

for test in myroot.findall('bla/blub/test/'):
    print(test.attrib)
    for fw in test:
        print(fw.tag)
        for dn in fw.findall('name'):
            hostname =  dn.text

If I try to run the code with Python 3, it won´t use the for loop after:
print(fw.tag)

print shows that I'm in the correct location:
{'name': 'test1'}
etc
name

Any ideas, why the code is not working with Python 3?

A: I found a solution. I removed the second for loop.
for test in myroot.findall('bla/blub/test/'):
    print(test.attrib)
    for dn in test.findall('name'):
        hostname =  dn.text


text:
Q: iOS 11 only crash issue - when I tap a tab bar App is crashing I am getting following crash error when I tap a particular tab bar only from hometabviewcontroller. This Happens only in iOS 11. Please help me to solve this issue.
    2017-10-23 16:48:57.000890+0400 FixtrProvider[2520:910402] desc: -[UIView refreshControl]: unrecognized selector sent to instance 0x10af090d0
2017-10-23 16:48:57.001223+0400 FixtrProvider[2520:910402] name: NSInvalidArgumentException
2017-10-23 16:48:57.001308+0400 FixtrProvider[2520:910402] user info: (null)
2017-10-23 16:48:57.001441+0400 FixtrProvider[2520:910402] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView refreshControl]: unrecognized selector sent to instance 0x10af090d0'

Following is the whole Page of my HomeTabView Controller according to the request.
@interface HomeTabBarController ()
{
    ChatSocketIOClient *socket;

}
@property (strong, nonatomic) UIButton *onTheJobOffTheJobButton;
@property (strong, nonatomic) NSString *status;
@property LocationTracker * locationTracker;
@property (nonatomic) NSTimer* locationUpdateTimer;
@end

@implementation HomeTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Crash bug fixing
    self.automaticallyAdjustsScrollViewInsets = NO;
    if (!socket) {
        socket  =[ChatSocketIOClient sharedInstance];
    }
        [self.navigationController setNavigationBarHidden:YES animated:YES];
    [self tabbarImages];
}

-(void)tabbarImages
{
    NSString *homeunselect;
    NSString *homeselect;
    NSString *historyunselect;
    NSString *historyselect;
    NSString *scheduleunselect;
    NSString *scheduleselect;
    NSString *earnunselect;
    NSString *earnselect;
    NSString *proilfeunselect;
    NSString *profileselect;

    UITabBar *tabBar = self.tabBar;

    UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
    UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
    UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
    UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3];
    UITabBarItem *tabBarItem5 = [tabBar.items objectAtIndex:4];

    if ([UIScreen mainScreen].bounds.size.height <= 568) {
        homeunselect = @"provider_popup_home_btn";
        homeselect = @"provider_popup_home_btn_selector";

        historyunselect = @"provider_popup_history_btn";
        historyselect = @"provider_popup_history_btn_selector";

        scheduleunselect = @"provider_popup_schedule_btn";
        scheduleselect = @"provider_popup_selector_btn_selector";

        earnunselect = @"provider_popup_earnings_btn";
        earnselect = @"provider_popup_earnings_btn_selector";

        proilfeunselect = @"provider_popup_profile_btn";
        profileselect = @"provider_popup_profile_btn_selector";
    }else if ([UIScreen mainScreen].bounds.size.height == 667){
        homeunselect = @"6provider_popup_home_btn";
        homeselect = @"6provider_popup_home_btn_selector";

        historyunselect = @"6provider_popup_history_btn";
        historyselect = @"6provider_popup_history_btn_selector";

        scheduleunselect = @"6provider_popup_schedule_btn";
        scheduleselect = @"6provider_popup_selector_btn_selector";

        earnunselect = @"6provider_popup_earnings_btn";
        earnselect = @"6provider_popup_earnings_btn_selector";

        proilfeunselect = @"6provider_popup_profile_btn";
        profileselect = @"6provider_popup_profile_btn_selector";
    }else if ([UIScreen mainScreen].bounds.size.height >= 736){
        homeunselect = @"6pprovider_popup_home_btn";
        homeselect = @"6pprovider_popup_home_btn_selector";

        historyunselect = @"6pprovider_popup_history_btn";
        historyselect = @"6pprovider_popup_history_btn_selector";

        scheduleunselect = @"6pprovider_popup_schedule_btn";
        scheduleselect = @"6pprovider_popup_selector_btn_selector";

        earnunselect = @"6pprovider_popup_earnings_btn";
        earnselect = @"6pprovider_popup_earnings_btn_selector";

        proilfeunselect = @"6pprovider_popup_profile_btn";
        profileselect = @"6pprovider_popup_profile_btn_selector";
    }

    tabBarItem1.selectedImage = [[UIImage imageNamed:homeselect] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem1.image = [[UIImage imageNamed:homeunselect] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

    tabBarItem2.selectedImage = [[UIImage imageNamed:historyselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem2.image = [[UIImage imageNamed:historyunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

    tabBarItem3.selectedImage = [[UIImage imageNamed:scheduleselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem3.image = [[UIImage imageNamed:scheduleunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

    tabBarItem4.selectedImage = [[UIImage imageNamed:earnselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem4.image = [[UIImage imageNamed:earnunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

    tabBarItem5.selectedImage = [[UIImage imageNamed:profileselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
    tabBarItem5.image = [[UIImage imageNamed:proilfeunselect]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];

}

-(void)viewWillAppear:(BOOL)animated{
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"OnChatController"];
    [[NSUserDefaults standardUserDefaults]synchronize];
    self.tabBarController.tabBar.hidden = NO;
    [UIApplication sharedApplication].idleTimerDisabled = YES;
}
-(void)viewDidDisappear:(BOOL)animated{
}

This App getting crashed when I tapped tabbar-4 in iOS 11 only. I don't understand what's the wrong with my code. I didn't get any code related to refreshController either on Hometabviewcontroller or accountscontroller. but I got the following when I search entire code base.
    - (void)refresh:(UIRefreshControl *)refreshControl
{
    [refreshControl endRefreshing];
}

Following is the viewloads code of the particular tabview controller.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{

    [super viewDidLoad];
     _paymentLogs.selected = YES;

    self.automaticallyAdjustsScrollViewInsets = NO;

   self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: UIColorFromRGB(0XfEAA26)};
}

-(void)getFinancialData{
    UIWindow *window = [[UIApplication sharedApplication]keyWindow];
    [[ProgressIndicator sharedInstance] showPIOnWindow:window withMessge:NSLocalizedString(@"Loading...",@"Loading...")];
    _pastCycle = [[NSMutableArray alloc]init];
    NSDictionary *dict =@{
                          @"ent_sess_token": [[NSUserDefaults standardUserDefaults] objectForKey:KDAcheckUserSessionToken],
                          @"ent_dev_id":  [[NSUserDefaults standardUserDefaults] objectForKey:kPMDDeviceIdKey],
                          @"ent_date_time":[Helper getCurrentDateTime],
                          @"ent_pro_id": [[NSUserDefaults standardUserDefaults] objectForKey:@"ProviderId"]
                          };
    NetworkHandler *handler  =[NetworkHandler sharedInstance];
    [handler composeRequestWithMethod:@"GetFinancialData"
                              paramas:dict
                         onComplition:^(BOOL succeeded, NSDictionary *response) {
                             if (succeeded) {
                                 _pastCycle = [response[@"pastCycle"] mutableCopy];
                                 _currentCycle = response[@"currentCycle"];
                                 NSLog(@"financial data %@",response);
                                 [self.currentTableView reloadData];
                                 [self.pastTableView reloadData];
                                 [[ProgressIndicator sharedInstance] hideProgressIndicator];
                             }
                         }];
}

-(void)viewWillAppear:(BOOL)animated{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userSessionTokenExpire) name:@"HandleAcceptAndRejectFromAdmin" object:nil];

}
-(void)viewWillDisappear:(BOOL)animated{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"HandleAcceptAndRejectFromAdmin" object:nil];

}

-(void)userSessionTokenExpire{

    [[NSUserDefaults standardUserDefaults] removeObjectForKey:KDAcheckUserSessionToken];
    [[NSUserDefaults standardUserDefaults] synchronize];
    ProgressIndicator *pi = [ProgressIndicator sharedInstance];
    [pi hideProgressIndicator];
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:
                                @"Main" bundle:[NSBundle mainBundle]];
    iServeSplashController *splah = [storyboard instantiateViewControllerWithIdentifier:@"splash"];
    self.navigationController.viewControllers = [NSArray arrayWithObjects:splah, nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

-(void)viewDidAppear:(BOOL)animated {
    _pastCycle = [[NSMutableArray alloc]init];
    [self getFinancialData];
    [super viewDidAppear:animated];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accountDeactivated) name:@"accountDeactivated" object:nil];
}

-(void)viewDidDisappear:(BOOL)animated {

    [super viewDidDisappear:animated];

    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

A: You can track where the unrecognized selector sent to instance comes from. Something in your code is calling it.
Do a text search in hometabviewcontroller or entire project for refreshControl and see where and what is calling it and make sure it's what you want.
If that does not help we need more code (preferably hometabviewcontroller) to help you.


text:
Q: Google App Engine - Datastore Viewer - GQL Query We have a data store and I want to get some insight on some things like a size sold on a specific date and between dates with GQL.
So basically I want to see 'item', a specific KEY id for size and for a specific time / time range
So first off I made a query for just the first part (Items with Key ID):
SELECT * FROM Item WHERE size = KEY('Size', xxxx)

which works. Then a date range
SELECT * FROM Item WHERE sold_date > DATETIME(2013-11-05 16:57:45) AND  sold_date < DATETIME('2013-11-10 16:57:45')

which also works
Combining these two however seems impossible. For instance:
SELECT * FROM Item WHERE size = KEY('Size', xxxx) AND sold_date > DATETIME('2013-11-05 16:57:45')

how can I combine these?
And then also when I want to see a set of sizes the query does not work. For instance
SELECT * FROM Item WHERE size = (KEY('Size', xxxx), KEY('Size',xxxx))

How can I fix this?

A: To query on multiple properties you will need to create a custom index (I'd recommend reading the docs first: java / python). For example (Java):
<datastore-index kind="Item">
    <property name="size" direction="asc" />
    <property name="sold_date" direction="asc" />
</datastore-index>

Or yaml:
indexes:
- kind: Item
  properties:
  - name: size
  - name: sold_date

If you want to select entities with properties matching a set you need to use IN:
SELECT * FROM Item WHERE size IN ( key('Size', 'xxx'), key('Size','yyy') )

GQL reference


text:
Q: jshint: 'use the function form of "use strict"' and 'document is not defined' in simple javascript file I have bundled these together because I think they are related.
The most simplest of simple bits of code:
'use strict';
const x = document.querySelector('#score strong');

is resulting in the following
"use the function form of use strict (W097)"
"document is not defined (W117)"

which may be errors or warnings; the W suggests a warning but I don't know how to determine this.
So, another question: are these warnings, or errors, and how can I tell this for myself?  Where is this referenced?
I am using Atom 1.31, with I think JSHint (whatever that is - I am new to all this). I am using ES6 - .jshintrc:
{
"esversion": 6
}

How should I be specifying use strict globally? Putting it in a function so that it's used globally means, er, putting the whole contents of my script inside a function. No? Yes?
And how do I circumvent this document is not defined thing?
I have tried
const document=this.document;
const document=global.document;
const document=window.document;

All result in warnings/errors (whatever).
So, to be clear, my questions are:

*

*are these warnings, or errors, and how can I tell this for myself?

*how do I and indeed do I need to, circumvent the use strict thing?

*how do I and indeed do I need to, circumvent the document is not defined thing?

A: You'll need to set the strict option to prefer a global 'use strict', and the browser option to tell JSHint that your script targets browsers.
.jshintrc
{
    "esversion": 6,
    "browser": true,
    "strict": "global"
}

And yes, "W" at the beginning of a code means "warning".


text:
Q: How is a lattice used by a compiler In my graduate class on compiler construction we've been introduced to the concept of a lattice.  Three lectures have been devoted to lattices and so far it seems like an interesting tangent, but the dilemma is that it doesn't really help explain how a compiler uses a lattice to solve a concrete problem.
We have already covered parsing and typechecking. We're about to start liveness analysis and register allocation.
Note, I'm not looking for resources on building compilers.  The following list of links have that covered pretty well. What I'm looking for is an explanation on the relationship between compilers and lattices, bonus points for the most examples.
Learning Resources on Parsers, Interpreters, and Compilers
How much of the compiler should we know?
Learning to write a compiler

A: Lattices are a very useful structure to represent state while doing static analysis on the program being compiled - eg. for removing dead code detected by liveness analysis, available/very busy expressions, reaching definitions, sign analysis and constant propagation.
Here is a very good read if you want the details: Lecture Notes on Static Analysis


text:
Q: Git reset in detached HEAD state I understand that the git reset command moves a branch backwards in the history (*), and that the branch it moves is the one that HEAD is pointing to.
So I got curious and I tried to call it in a detached HEAD state to see what would happen. I was expecting error but git did something, and I'm just unable to figure out what it did.
Did Git acted like HEAD was still pointing to where it was before I checked out and went into the detached HEAD state ?

[ Edit 1 ] I actually figured it out. It does exactly the same as when one is not in a detached head state, except that it doesnt move any branch backward. It's only the
[ Edit 2(*) ] The git reset actually only moves a branch backward in history when specifying an older commit. When doing git reset HEAD, it leaves the branch where it is (see comments below).

A: Just to stress:

I understand that the git reset command always moves a branch backwards in the history,

This is not correct and you might want to edit your question to avoid confusing people new to git. For example, git reset --hard does not do that, it just wipes out the working directory and the index without moving HEAD or the branch.
In fact, all variants where you omit the optional <commit> in git reset [<commit>] do not move the head nor the branch. Other options of git reset do other things, not all of which move HEAD. So moving HEAD around is just one of several actions git resetcan do.

A: git reset makes the current branch and HEAD move to a specific commit. If it's a detached HEAD, it makes only HEAD move.

A: If you've run just: git reset
It performs the opposite operation of git add which is unstage changes...
There are three forms of the git reset command, each one with associated options and performing different operations. Check on git reset docs if you want to go deeper.


text:
Q: Beginners Hibernate problem - simple mapping with non-simple exception! Please help me with this hibernate problem, I'm new to hibernate and still trying to get my head around it. I can't seem to work this issue out. I imagine I'm missing something pretty simple.
I've followed the example here to achieve a many-to-one mapping, as my requirements are almost identical: http://www.coderanch.com/t/217519/ORM/java/Hibernate-Newbie-Many-Relation-Tutorial
Please note that when I try to persist the Picture object, the user variable is (at that point in time) empty, as is every other variable bar image.
Also note that I've set hibernate to generate the database schema by itself via config in the hibernate config file.
Here are my mapping files (declarations removed)
User.hbm.xml

<class name="msc.model.User" table="USER">
    <id name="id" column="USER_ID">
        <generator class="native"/>
    </id>
    <property name="username"/>
    <property name="email"/>

    <bag name="pictures"
       table="PICTURE"
       lazy="true"
       cascade="save-update">
        <key column="PICTURE_ID"/>
        <one-to-many class="msc.model.Picture" />
    </bag>

</class>

And Picture.hbm.xml

<class name="msc.model.Picture" table="PICTURE">
    <id name="id" column="PICTURE_ID">
        <generator class="native"/>
    </id>
    <property name="story"/>
    <property name="tattooist"/>
    <property name="pic"/>

    <many-to-one name="user"
           class="msc.model.User"
           column="USER" />

    <property name="image" type="blob">
        <column name="IMAGE" not-null="true" />
    </property>

</class>

The class files (getters and setters stripped)
Picture.java
package msc.model;

import java.io.File;
import java.sql.Blob;

public class Picture {

private Long id = null;
private User user = null;
private File pic = null;
private String story = null;
private String tattooist = null;
private Blob image = null;
}

User.java
package msc.model;

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

public class User {

private Long id = null;
private String username = null;
private String email = null;
private List<Picture> pictures = null;
}

The persistence code (note that bFile is byte stream created from a file):
    Session hib_ses = HibernateUtil.getSessionFactory().getCurrentSession();

    hib_ses.beginTransaction();
    Picture picture = new Picture();
    picture.setImage(Hibernate.createBlob(bFile));

    Long id = (Long) hib_ses.save(picture);

    hib_ses.getTransaction().commit();

Here is the exception:
Cannot add or update a child row: a foreign key constraint fails (`msc`.`picture`, CONSTRAINT `FK85BE8DE2885129D` FOREIGN KEY (`PICTURE_ID`) REFERENCES `user` (`USER_ID`))

Please help!

A: There is something very strange going on if that is the real error you get.
Cannot add or update a child row: a foreign key constraint fails (`msc`.`picture`, CONSTRAINT `FK85BE8DE2885129D` FOREIGN KEY (`PICTURE_ID`) REFERENCES `user` (`USER_ID`))

This says that PICTURE.PICTURE_ID is a reference to USER.USER_ID. But PICTURE_ID is the PK of picture, which Hibernate will generate upon insertion. Did you mean to create a constraint from PICTURE.USER to USER.USER_ID?
Oh, I see you wrote you generate the schema via Hibernate. I think the error is in your "bag" definition. The key column should not be PICTURE_ID, but USER.

A: It looks like you are trying to save the Picture before saving the User. Try saving the User first.
[edit]
From the mapping - it looks like there is a Parent/Child relationship between User and Picture.
There is a good example in the Hibernate Documentation for a Parent Child relationship.
If you want the User to be able to be null, then a uni-directional relationship would be better.
[edit]
Another good reference about mapping collections with Hibernate.


text:
Q: Div is 100%width, but the browser still scrolls to the right I am using October CMS for a project, but unfortunatley I am having problems. For one of my divs I have the background set to 100% width, however I am getting this problem where the div below it is smaller in width and the browser is scrolling to the right hand side? Anyone have any suggestions, I have tried everything?

A: Without seeing the code or example I cant really comment apart from saying saying try these two
box-sizing: border-box;

overflow-x: hidden;

A: Set body to be max-width: 100%; and overflow-x: hidden; so it doesn't allow user to scroll to the sides.
result:
body {
   max-width: 100%;
   overflow-x: hidden;
   ..
}

A: The only thing that I can think of is that you have another element that is wider than that div.... without a fiddle it is very hard to understand what the issue is.


text:
Q: Redirection with resolvers Angular 6 I use angular-cli for my application and I have a login page and here is the handler to submit it:
onSubmit() {
    this.authService.login(this.uname.value, this.pass.value)
      .subscribe(
        (user: User) => {
          this.username = user.username;
          localStorage.userExist = true;
          this.route.navigate(['/office/1']);
        },
        (err) => {
          this.errorFromServer = err.error;
        });
  }

After submission, I expect that I would be redirected to localhost:3000/office/1, but instead, I get an error:
GET http://localhost:3000/api/plan net::ERR_CONNECTION_RESET.

http://localhost:3000/api/plan provides information about office plan and I get this data with help of PlanResolver. Actually, I can get this data when I switch between offices, but it doesn't work when I try to redirect from login page. So, maybe, something wrong with navigation inside subscription.
I have two resolvers that should be executed before navigation:
{path: 'office/:id', component: OfficesComponent,
  resolve: {cres: OfficeResolver, plan: PlanResolver},
  canActivate: [AuthGuardService]},

When I had one resolver, it worked fine, so I decided to combine two resolvers into one with forkJoin, but I got the same error.
The only one solution I have now is putting navigation in SetTimeout:
setTimeout(() => {
   this.route.navigate(['/office/1']);
}, 500);

If you have any ideas what is wrong please tell me.
Thanks all.

A: .navigate method takes array of commands as a first argument. You are passing composed url like to .navigateByUrl. Thus resolver could not have access to id parameter.
Try redefine redirection like this:
this.route.navigate(['office', 1']);


text:
Q: Adding Yogaglo as supported youtube-dl site I would like to add Yogaglo support for youtube-dl.
I've followed guidance on Github .
And have drafted the following:
# coding: utf-8
from __future__ import unicode_literals

from .common import InfoExtractor

class YogagloIE(InfoExtractor):
 _SIGNIN_URL = 'https://www.yogaglo.com/login'
 _PASSWORD_URL = 'https://www.yogaglo.com/login/password'
 _USER_URL = 'https://www.yogaglo.com/login/user'
 _ACCOUNT_CREDENTIALS_HINT = 'Use --username and --password options to provide yogaglo.com account credentials.'
_NETRC_MACHINE = 'yogaglo'

def _real_initialize(self):
    self._login()

_VALID_URL = r'https?://(?:www\.)?yogaglo\.com/class/(?P<id>[0-9]+)'
_TEST = {
    'url': 'https://www.yogaglo.com/class/7206',
    'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
    'info_dict': {
        'id': '7206',
        'ext': 'mp4',
        'title': 'Have a Great Day!'
        # TODO more properties, either as:
        # * A value
        # * MD5 checksum; start the string with md5:
        # * A regular expression; start the string with re:
        # * Any Python type (for example int or float)
    }
}

def _real_extract(self, url):
    video_id = self._match_id(url)
    webpage = self._download_webpage(url, video_id)
    title = self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title')

    return {
        'id': video_id,
        'title': title,
        'description': self._og_search_description(webpage),
        'uploader': self._search_regex(r'<div[^>]+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False),
        # TODO more properties (see youtube_dl/extractor/common.py)
    }

I've added yogagloIE to the list of extractors and when I run it I get an error that the URL is not supported. This is really a first draft and any guidance on hoe to improve it and make it work is recommended.

A: In Python, indentation is significant, so make sure you indent your class correctly.
After that, you must define a _login method or simply leave _real_initialize empty.
With that being implemented, the extractor will be called (although of course it's not functional yet):
$ youtube-dl test:yogaglo
[TestURL] Test URL: https://www.yogaglo.com/class/7206
[Yogaglo] 7206: Downloading webpage
ERROR: Unable to extract title; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

You can pull this working state with the following command (maybe git stash everything beforehand, and rename your old yogaglo.py file to something else):
git pull https://github.com/phihag/youtube-dl.git yogaglo


text:
Q: DirectoryRef inside a Directory in WiX Consider I have a WiX Setup Library Project named MyLib.wixproj with 2 files that are shared with different installers. This project has the following (simplified) structure:
MyLib.wxs:
<Wix>
  <Fragment>

    <Feature Id="MySharedFeature" ...>
      <ComponentGroupRef Id="MySharedCompGroup" />
    </Feature>

    <ComponentGroup Id="MySharedCompGroup" Directory="Directory_SharedFiles">
      <Component Id="SharedCompA" Guid="*">
        <File Id="SharedFileA Source="$(var.Source)fileA.txt" KeyPath="yes" />
      </Component>
      <Component Id="SharedCompB" Guid="*">
        <File Id="SharedFileB Source="$(var.Source)fileB.txt" KeyPath="yes" />
      </Component>
    </ComponentGroup>

    <Directory Id="Directory_SharedFiles" Name="SharedFiles" />

  </Fragment>
</Wix>

One of my installers (Setup Project) references the library this way:
Product.wxs:
<Wix>
  <Product>

    <FeatureRef Id="MySharedFeature" />

  </Product>
</Wix>

Directories.wxs:
<Wix>
  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLDIR" Name="MyApp">

          <!-- Here I want to add a reference to Directory_SharedFiles. -->

          <Directory Id="OtherFilesNotShared" Name="MoreFiles">
          </Directory>

        <Directory>
      </Directory>
    </Directory>
  </Fragment>
<Wix>

Inside the INSTALLDIR directory I want to add a DirectoryRef to Directory_SharedFiles, declared in my shared project. I tried using DirectoryRef but this tag doesn't exist as a child of Directory and it is not clear to me how to use Directory Id="TARGETDIR" inside the shared project, like this:
MyLib.wxs:
<!-- This code does not compile! -->
<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="Directory_SharedFiles" Name="SharedFiles" />
</Directory>

</Fragment></Wix>

Is there a way to do this?

A: Don't nest the DirectoryRef element under a Directory element. Put it directly under the Fragment element. Read more on DirectoryRef.
Build the directory structure in a shared WiX fragment instead of in each product separately.


text:
Q: Not able to post large JSON data to Web API using Angular 4 app I want to export 100k records for that i have to send large json data to server.
Code:
 public export(payload: string) {
    let headersObj = new HttpHeaders({ 'Content-Type': 'application/json' });
    let body: record;
    var objectToSend = JSON.stringify(payload);

     return this.http
        .post(EXPORT,
        objectToSend,{ headers: headersObj, observe: "response", responseType: "arraybuffer" }).timeout(1000000)
        .map((response: any) => {

        });
}

I am able to post json data with record count upto 50k to 60k. Above that the server call is failing.

Browser is getting crashed.


text:
Q: Meaning of "determine" in 19th century I'm reading Jane Austen's Pride and Prejudice. At the end of chapter 29, she writes "The party then gathered round the fire to hear Lady Catherine determine what weather they were to have on the morrow."
At first I assumed it meant that the Lady Catherine De Bourgh would be so certain of what she expected the weather that it was as though she decided it rather than predicted. Then I started wondering if meaning of determine has shifted over the years, and it had simply meant predicted at the time.
In the early 19th century when Austen was writing, was the meaning of "determine" the same as it is today?

A: The meaning denoted by 'determine' in your quote from Pride and Prejudice is this one, generally:

II. To bring to an end a dispute, controversy, or doubtful matter; to conclude, settle, decide, fix.

The specific sense is

*a. trans. To settle or decide (a dispute, question, matter in debate), as a judge or arbiter.

["determine, v.". OED Online. September 2015. Oxford University Press. http://www.oed.com/view/Entry/51244 (accessed November 20, 2015).]
In this sense, "the party" will consider the question of tomorrow's weather (as parties are wont to do), and Lady Catherine will settle the matter.
This use of 'determine' is still common today.

A: It is a meaning of the word still in use today, though perhaps less so than it was (definition from the American Heritage Dictionary of the English Language, 4th Edition, courtesy of Wordnik):

transitive v. To establish or ascertain definitely, as after consideration, investigation, or calculation. See Synonyms at discover.

The word, in this context, would be synonymous to figure out or discover. It is also very likely that Austen is playing with the ambiguity to imbue the character with the sort of self importance mentioned by Languagemaven, but the word does indeed carry this meaning today as it did then.

A: Interesting question -- I loved Pride and Prejudice when I read it many years ago (and watch the BBC production from time to time).
I actually would think that your initial instinct in this case is on the right track. Remembering the pompous, overbearing, and narcissistic character of Lady Catherine, I'd say that Austen may be sardonically using "determine" there to stress that Lady Catherine believes she's in control of a great deal more in the world than Mr. Collins and her opulent quarters at Rosings Park.


text:
Q: possible to make samba4's internal dns server listen on non-standard port? Is it possible to make samba4's internal dns server listen on a port other than 53?
I need to run two dns server's on this host -- my desire was to use dnsmasq on the standard port for client's and configure dnsmasq to resolve the domain owned by the samba internal dns server correctly via the non-standard port.
Looking through smb.conf -- there are options to control the port binding used by many of the services -- but I'm not finding such an option for the dns server ...

A: The reason you're not finding the option is that OS resolver libraries cannot use ports other than 53. While it's possible to have a nameserver forwarder use ports other than 53, it is unlikely that the authors of this software support and/or anticipate your particular use case. You would need ask them why this feature is absent.
You could try something like

*

*add a secondary IP address to your system.

*

*configure DNSmasq to listen on that address only.

*Configure Samba to listen on the primary IP address

*Configure samba to forward requests it can't handle to the IP DNSmasq is listening on.

I guess you could do it the other way around too.

A: The issue was opened and can be viewed here: https://bugzilla.samba.org/show_bug.cgi?id=14599


text:
Q: decode a data URL in php I need to decode a data url in PHP .This data url is obtained via ajax.
I have used file reader to get the encoded data URL of an image.This data URL is passed to PHP via ajax:
$.ajax({
    url: app,
    async: false,
    type:"POST",
    data : "file="+strGlobalImageData,
    dataType: "jsonp",
    contentType: 'application/x-www-form-urlencoded',
    processData:false,
    jsonp: "jsoncallback",
    success: function(html){
        alert("Thank you. We will be in touch with you");
    },
    error: function(){
        alert("Thank you. We will be in touch with you");
    }
});

How will I do this?

A: $image =$_POST['file'] ;

Was this something you were looking for? Let me know


text:
Q: Start new activity or bring up old one according to intent extra What flag must I set for an intent so if the activity is visible with same extra it does not bring up a new one.
My app is somehow like google play. There are different app that are show in AppActivity by sending the app id as an Extra. User can download app and when download is finished, a complete notification is shown which on press brings up the corresponding activity page.
Currently by pressing notification it start a new activity which is correct for when AppActivity is not visible or showing another app. But it also start a new AppActivity even if the AppActivity is visible for same app.
PendingIntent.getActivity(ServiceDownload.this, id,
    new Intent(ServiceDownload.this, AppActivity.class)
        .setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
        .putExtra(Constants.EXTRA_ID, id), 0);

A: Use Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP while starting your activity and define it single top at your manifest file.
If activity is somewhere in the stack, it will be brought to top(onNewIntent method will be invoked) and all activities above it, will be destroyed. If it is not in the stack it will be created (onCreate method will be invoked)
Edit: You have to handle onNewIntent to get bundle and update your current activity with new values.
Note: Also remember, system may destroy your activity and your both onCreate and onNewIntent methods can be invoked. Design your activity considering this.
Edit2: If you want to have many app details and user can navigate back with pressing back button. And also one detail for one app. Then you should use fragments. Add fragments by tag of your application id/name (something unique) and while showing an app detail search if any detail page exists with findFragmentByTag method. If it exists remove it and add it to top of the stack.


text:
Q: How to understand this pointer to a data structure in C? I have this code, I'm trying to figure out what the second line of code does.
static int table [][4]= {{1,2,3,4},{2,3,4,5},{3,4,5,6}};
int valore = *(*(table+2)+1);
printf("%d",valore);

I have a basic knowledge of pointers in C, can you explain me what does the second line of code do please?

A: Your table is simply a 2D array of integers. In C a 2D array is really an "array or arrays". Your table has the dimensions of static in table[3][4]; (3 rows x 4 cols), it is an array of 3 integer arrays with 4 elements each. Since it is an array, all values will be sequential in memory. You can think of the memory layout as follows.
            +---+---+---+---+
table[0]    | 1 | 2 | 3 | 4 |
            +---+---+---+---+
table[1]    | 2 | 3 | 4 | 5 |
            +---+---+---+---+
table[2]    | 3 | 4 | 5 | 6 |
            +---+---+---+---+

An array is converted to a pointer on access (accept in 4 limited circumstances, not relevant here, see C11 Standard - 6.3.2.1 Other Operands - Lvalues, arrays, and function designators(p3) for details)
You are introduced to "pointer notation" in the question. You can access any element of an array using "array indexes" or "pointer notation". In pointer notation *(a + b) is equivalent to a[b] in array index notation. You have:
*(*(table+2)+1)

If you take it piece by piece *(table + 2) is simply table[2]. Next *(table[2] + 1) is simply table[2][1]. So you are acccessing the 2nd value in the 3rd row with either (which is simply 4).
Look things over and let me know if you have further questions.

A: table is an array of 3 arrays of 4 int.
When an array is used in an expression, it is converted to a pointer to its first element, except when:

*

*It is the operand of sizeof.

*It is the operand of unary &.

*It is a string literal used to initialize an array.

So, in *(*(table+2)+1), table is converted to a pointer to its first element, producing &table[0]. Then we have:
*(*(&table[0]+2)+1)

Next, we have the addition &table[0] + 2. This uses pointer arithmetic. Adding an integer to a pointer (into an array) moves the pointer backward or forward by a number of elements. So &table[0] + 2 produces a pointer to table[2], which is &table[2]. Then we have:
*(*(&table[2])+1)

The inner parentheses are no longer needed, so we have:
*(*&table[2]+1)

Then * &table[2] is the thing that &table[2] points to, which means it is table[2]:
*(table[2] + 1)

Since table is an array of 3 arrays of 4 int, table[2] is an array of 4 int. Since it is an array, it is converted to a pointer to its first element, producing &table[2][0]:
*(&table[2][0] + 1)

Now we have pointer arithmetic again. &table[2][0] is a pointer to element 0 of the array table[2], so adding 1 produces a pointer to element 1, &table[2][1]:
*(&table[2][1])

Again we have parentheses that are no longer needed:
*&table[2][1]

And, finally, * &table[2][1] is the thing that &table[2][1] points to, so it is just:
table[2][1]


text:
Q: Unable to connect registry between wso2IS-5.6.0 and wso2AM-2.5.0 I am trying to configure wso2IS-5.6.0 with wso2AM-2.5.0 to access policy
I am following this link from the wso2 docs.
In that documentation, I find the following step:

2) Share the registry of both WSO2 API Manager and WSO2 Identity Server. For more information, see Sharing the registry space.

From that, I followed this link from the wso2 docs and am receiving the following error:

ERROR - TransactionManager Failed to start new registry transaction.
java.sql.SQLException: Unknown system variable 'tx_isolation'
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
        at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1446)
        at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3050)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:127)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.wso2.carbon.ndatasource.rdbms.ConnectionRollbackOnReturnInterceptor.invoke(ConnectionRollbackOnReturnInterceptor.java:51)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:80)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:153)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:41)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:80)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80)
        at com.sun.proxy.$Proxy18.getTransactionIsolation(Unknown Source)
        at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.beginTransaction(JDBCTransactionManager.java:89)
        at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.beginTransaction(EmbeddedRegistry.java:443)
        at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.resourceExists(EmbeddedRegistry.java:639)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExistsInternal(UserRegistry.java:774)
        at org.wso2.carbon.registry.core.session.UserRegistry.access$800(UserRegistry.java:61)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:757)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:754)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:754)
        at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.resourceExists(MountHandler.java:329)
        at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.resourceExists(MountHandler.java:306)
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.resourceExists(HandlerManager.java:3130)
        at org.wso2.carbon.registry.core.jdbc.handlers.UserDefinedHandlerManager.resourceExists(UserDefinedHandlerManager.java:260)
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.resourceExists(HandlerLifecycleManager.java:1233)
        at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.resourceExists(EmbeddedRegistry.java:645)
        at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.resourceExists(CacheBackedRegistry.java:376)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExistsInternal(UserRegistry.java:774)
        at org.wso2.carbon.registry.core.session.UserRegistry.access$800(UserRegistry.java:61)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:757)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:754)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:754)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.setupMounts(RegistryCoreServiceComponent.java:293)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.buildRegistryService(RegistryCoreServiceComponent.java:535)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.activate(RegistryCoreServiceComponent.java:130)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
        at org.wso2.carbon.user.core.internal.Activator.startDeploy(Activator.java:73)
        at org.wso2.carbon.user.core.internal.BundleCheckActivator.start(BundleCheckActivator.java:61)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
        at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
[2019-01-25 20:11:45,088] ERROR - MountHandler Unable to test existence of resource
org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to start new registry transaction.
        at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.beginTransaction(JDBCTransactionManager.java:105)
        at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.beginTransaction(EmbeddedRegistry.java:443)
        at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.resourceExists(EmbeddedRegistry.java:639)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExistsInternal(UserRegistry.java:774)
        at org.wso2.carbon.registry.core.session.UserRegistry.access$800(UserRegistry.java:61)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:757)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:754)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:754)
        at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.resourceExists(MountHandler.java:329)
        at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.resourceExists(MountHandler.java:306)
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.resourceExists(HandlerManager.java:3130)
        at org.wso2.carbon.registry.core.jdbc.handlers.UserDefinedHandlerManager.resourceExists(UserDefinedHandlerManager.java:260)
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.resourceExists(HandlerLifecycleManager.java:1233)
        at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.resourceExists(EmbeddedRegistry.java:645)
        at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.resourceExists(CacheBackedRegistry.java:376)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExistsInternal(UserRegistry.java:774)
        at org.wso2.carbon.registry.core.session.UserRegistry.access$800(UserRegistry.java:61)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:757)
        at org.wso2.carbon.registry.core.session.UserRegistry$9.run(UserRegistry.java:754)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.wso2.carbon.registry.core.session.UserRegistry.resourceExists(UserRegistry.java:754)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.setupMounts(RegistryCoreServiceComponent.java:293)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.buildRegistryService(RegistryCoreServiceComponent.java:535)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.activate(RegistryCoreServiceComponent.java:130)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
        at org.wso2.carbon.user.core.internal.Activator.startDeploy(Activator.java:73)
        at org.wso2.carbon.user.core.internal.BundleCheckActivator.start(BundleCheckActivator.java:61)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
        at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.sql.SQLException: Unknown system variable 'tx_isolation'
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484)
        at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1446)
        at com.mysql.jdbc.ConnectionImpl.getTransactionIsolation(ConnectionImpl.java:3050)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:127)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.wso2.carbon.ndatasource.rdbms.ConnectionRollbackOnReturnInterceptor.invoke(ConnectionRollbackOnReturnInterceptor.java:51)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:80)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.interceptor.ConnectionState.invoke(ConnectionState.java:153)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.TrapException.invoke(TrapException.java:41)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke(AbstractCreateStatementInterceptor.java:80)
        at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
        at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80)
        at com.sun.proxy.$Proxy18.getTransactionIsolation(Unknown Source)
        at org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCTransactionManager.beginTransaction(JDBCTransactionManager.java:89)
        ... 61 more
[2019-01-25 20:11:45,117] ERROR - RegistryCoreServiceComponent Unable to create fixed remote mounts.
org.wso2.carbon.registry.core.exceptions.RegistryException: An exception occurred while executing handler chain. null
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.delete(HandlerManager.java:2649)
        at org.wso2.carbon.registry.core.jdbc.handlers.UserDefinedHandlerManager.delete(UserDefinedHandlerManager.java:215)
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerLifecycleManager.delete(HandlerLifecycleManager.java:443)
        at org.wso2.carbon.registry.core.jdbc.EmbeddedRegistry.delete(EmbeddedRegistry.java:851)
        at org.wso2.carbon.registry.core.caching.CacheBackedRegistry.delete(CacheBackedRegistry.java:595)
        at org.wso2.carbon.registry.core.session.UserRegistry.deleteInternal(UserRegistry.java:867)
        at org.wso2.carbon.registry.core.session.UserRegistry.access$1100(UserRegistry.java:61)
        at org.wso2.carbon.registry.core.session.UserRegistry$12.run(UserRegistry.java:842)
        at org.wso2.carbon.registry.core.session.UserRegistry$12.run(UserRegistry.java:839)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.wso2.carbon.registry.core.session.UserRegistry.delete(UserRegistry.java:839)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.setupMounts(RegistryCoreServiceComponent.java:305)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.buildRegistryService(RegistryCoreServiceComponent.java:535)
        at org.wso2.carbon.registry.core.internal.RegistryCoreServiceComponent.activate(RegistryCoreServiceComponent.java:130)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146)
        at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620)
        at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197)
        at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343)
        at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222)
        at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
        at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
        at org.wso2.carbon.user.core.internal.Activator.startDeploy(Activator.java:73)
        at org.wso2.carbon.user.core.internal.BundleCheckActivator.start(BundleCheckActivator.java:61)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
        at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
        at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
        at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:390)
        at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1176)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
        at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.NullPointerException
        at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.delete(MountHandler.java:490)
        at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.del

What am I doing incorrectly when attempting to configure registry between wso2is-5.6.0 and wso2AM-2.5.0?


text:
Q: :nth-child() not work on li added with foraeach data-bind Im making a single page app on codepen.io (http://codepen.io/ntibbs/pen/ZbPPBm?editors=101) using knockout.js and jquery and while trying to figure out a way to select individual <li> elements that are added to my page using a foreach binding I noticed I can not use :nth-child() to do this. All the elements are considered :nth-child(1), not sure why its doing that. Are there any ways I could select an individual <li> element ?

A: The n in :nth-child() represents the depth, not the order. So :nth-child(1) selects every element that is the first child of its parent.
I'm not sure under what conditions you're trying to select a particular element, but I'll give you some options.

*

*If each element already has a unique identifier, use that.

*If you are already iterating through the set of elements, use logic in your loop to get the one you want.

If you can give me some more info on that, I can edit this accordingly.


text:
Q: my values on one column wont update immediately after inserting data, but after refresh the values shows up after I inserting data, what shows on the column table "Jumlah Hasil Perah" shows '0'. but after refreshing the browser, the value shows up the result.
here's the code
Model (m_hasilperah):
public function jumlahPerahSapi($id)
{
    $this->db->select('hasilPerahPagi, hasilPerahSore');
    $this->db->where('idSapi', $id);
    $cek = $this->db->get('tb_hasilperah');
    if ($cek) {
        $this->db->set('jumlahPerah', "hasilPerahPagi + hasilPerahSore", FALSE);
        $this->db->where('idSapi', $id);
        $this->db->update('tb_hasilperah');
    }
    return false;
}

Controller
public function tambahHasilPerah(){
    $idSapi = $this->input->post('idSapi');
    $tglPerah = $this->input->post('tglPerah');
    $hasilPerahPagi = $this->input->post('hasilPerahPagi');
    $hasilPerahSore = $this->input->post('hasilPerahSore');
    $jumlahPerah = $this->m_hasilperah->jumlahPerahSapi($idSapi);;

    $data =
        [
            'idSapi' => $idSapi,
            'tglPerah' => $tglPerah,
            'hasilPerahPagi' => $hasilPerahPagi,
            'hasilPerahSore' => $hasilPerahSore,
            'jumlahPerah' => $jumlahPerah
        ];
    $insert = $this->m_hasilperah->tambahHasilPerahModel($data, $idSapi);
    if ($insert) {
        redirect('C_hasilperah/tampilHasilPerah/' . $idSapi, 'refresh');
    } else {
        echo 'gagal';
    }
}

Screenshot:
View after insert(before manual refresh)
View after manual refresh

A: Your Model method jumlahPerahSapi() every time returned false. Even if after the data update. Please look into this.

A: Your Model function jumlahPerahSapi($id) is always return false even inserted successfully in DB.
So This is not run redirect('C_hasilperah/tampilHasilPerah/' . $idSapi, 'refresh');
Every time run echo 'gagal';
Modify the model function as follows.
public function jumlahPerahSapi($id)
{
    $this->db->select('hasilPerahPagi, hasilPerahSore');
    $this->db->where('idSapi', $id);
    $cek = $this->db->get('tb_hasilperah');
    if ($cek) {
        $this->db->set('jumlahPerah', "hasilPerahPagi + hasilPerahSore", FALSE);
        $this->db->where('idSapi', $id);
        $this->db->update('tb_hasilperah');

        return true;
    }
    return false;
}


text:
Q: how to change images on mouseover and leave here is my site: http://iaddesign.com/beta/portfolio.php
i tried this:
$("#portfolio li img").hover(

function() {

 $(this).attr("src", function() {

 return "images/" + this.alt + ".png";

 }),

 $(this).attr("src", function() {

 return "images/" + this.alt + "-over.png";

 });

but what it does is not show the image (for some reason) then when i mouse over the image shows then when i take my mouse off nothign happends. i want all is
when the page loads the each images src will equal to what is in the alt attribuate concated with .png
but when the mouse goes over the image the src equals
its alt attribe + "-over.png" then when the mouse leaves it goes back to what alt was + ".png"

A: Something like this?
$("#portfolio li img").bind('mouseover', function(){
    this.src = "images/" + this.alt + "-over.png";
});

$("#portfolio li img").bind('mouseout', function(){
    this.src = "images/" + this.alt + ".png";
});

A: This code may accomplish what you are trying to. hover() takes 2 parameters, the first is the event handler for mouseenter and the 2nd for mouseleave. Additionally, it isn't entirely necessary to use an anonymous function with attr() if all you are doing is building a simple string.
$("#portfolio li img").hover(
    function() {
        $this = $(this);
        $this.attr("src", "images/" + $this.attr('alt') + ".png");
    },
    function() {
        $this = $(this);
        $this.attr("src", "images/" + $this.attr('alt') + "-over.png");
    }
);

This code should be better optimized. Enjoy :)

A: In your second function of the hover, you have forgot to make a function ...
the
 $(this).attr("src", function() {
   return "images/" + this.alt + "-over.png";
 });

should be
function(){
 $(this).attr("src", function() {
   return "images/" + this.alt + "-over.png";
 });
}

Additionally, you do not have to use a function to create the new name .. you could do it directly..
so
$(this).attr("src", function() {
   return "images/" + this.alt + "-over.png";
 });

could be just
$(this).attr("src", "images/" + this.alt + "-over.png");


text:
Q: Howto to limit post per categories? I am trying to limit 2 post per categories (categories id is 12,13,16 and 18) on my homepage and here is my index.php content :
$layout_type_for_index = osetin_get_settings_field('layout_type_for_index');

if(get_query_var('page')){
$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
}else{
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
}
if($paged == 1){
$sticky_posts = osetin_get_field('sticky_posts', false, false, true);
}
$os_posts_per_page = osetin_get_number_of_posts_per_page();
$args = array(
'orderby' => 'position',
'order' => 'DESC',
'posts_per_page' => $os_posts_per_page,
'paged' => $paged,
'tax_query' => array()
);

But I don't know how to do it, any help please?


text:
Q: How to make a list of quoted strings from the string values of a column in postgresql? select my_col from test;
Out:
my_col
x
y
z

How can I change the output of the three rows into an output of a list of three quoted strings in postgresql, so that it looks like:
Out:
'x','y','z'

If I run string_agg(my_val, ''','''), I get
Out:
x','y','z

If I run quote_literal() on top of this output, I get:
Out:
'x'',''y'',''z'

I need this list of quoted strings as an input for the argument of a function (stored procedure). The function works by passing the 'x','y','z' as the argument by hand. Therefore, it is all just about the missing leading and trailing quote.
Side remark, not for the question: it would then get read into the function as variadic _v text[] so that I can check for its values in the function with where t.v = any(_v).

A: You seem to want:
select string_agg('''' || my_val || '''', ',') my_val_agg
from test

That is: concatenate the quotes around the values before aggregating them - then all that is left is to add the , separator in between.
'''' is there to produce a single quote. We can also use the POSIX syntax in Postgres:
select string_agg(E'\'' || my_val || E'\'', ',') my_val_agg
from test